diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index bcfb4e1..e75b6e6 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -19,20 +19,52 @@ on: type: boolean description: "Publish to JSR?" required: false - default: false + default: true publish-npm: type: boolean description: "Publish to NPM?" required: false - default: false + default: true publish-gpr: type: boolean description: "Publish to GPR?" required: false + default: true + release: + type: boolean + description: "Create a new GitHub Release?" + required: false + default: false + release-title: + type: string + description: | + Release title template ('{0}' -> $GITHUB_REF_NAME) + required: false + default: "{0}" + release-tag: + type: string + description: | + Git tag to create the release for ('{0}' -> $GITHUB_REF_NAME) + required: false + default: "{0}" + release-draft: + type: boolean + description: "Should the release be a draft?" + required: false default: false + release-discussion-category: + type: string + description: "Discussion category for announcing new Releases" + required: false + default: "Releases" + release-assets: + type: string + description: "Glob pattern for assets to attach to the Release" + required: false + jobs: check: - if: github.event.inputs.check == 'true' || github.event_name != 'workflow_dispatch' + if: inputs.check == 'true' || github.event_name != 'workflow_dispatch' runs-on: ubuntu-latest steps: - uses: actions/checkout@v6 @@ -44,36 +76,57 @@ jobs: - id: ok run: deno task ok + - if: success() + run: | + if [ -d .coverage ]; then + cp -r .coverage coverage + else + exit 1 + fi + - id: coveralls + if: success() + continue-on-error: true uses: coverallsapp/github-action@v2 with: github-token: ${{ secrets.GITHUB_TOKEN }} file: .coverage/lcov.info - id: coverage + if: success() + continue-on-error: true uses: actions/upload-artifact@v6 with: - path: .coverage + path: coverage name: nberlette-math-coverage_${{ github.ref_name }}-${{ github.sha }} + publish: if: | (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && needs.check.result == 'success') || (github.event_name == 'workflow_dispatch' && ( - github.event.inputs.publish-jsr == 'true' || - github.event.inputs.publish-npm == 'true' || - github.event.inputs.publish-gpr == 'true' - ) && (needs.check.result == 'success' || github.event.inputs.check == 'false')) + inputs.publish-jsr == 'true' || + inputs.publish-npm == 'true' || + inputs.publish-gpr == 'true' + ) && (needs.check.result == 'success' || inputs.check == 'false')) runs-on: ubuntu-latest needs: check permissions: - contents: read + contents: write id-token: write packages: write concurrency: cancel-in-progress: true group: publish-${{ github.ref_name }} + env: + IS_TAG: ${{ github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') }} + IS_DISPATCHED: ${{ github.event_name == 'workflow_dispatch' }} + PUBLISH_JSR: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && needs.check.result == 'success') || (github.event_name == 'workflow_dispatch' && inputs.publish-jsr == 'true') }} + PUBLISH_NPM: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && needs.check.result == 'success') || (github.event_name == 'workflow_dispatch' && inputs.publish-npm == 'true') }} + PUBLISH_GPR: ${{ (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/') && needs.check.result == 'success') || (github.event_name == 'workflow_dispatch' && inputs.publish-gpr == 'true') }} + RELEASE_TITLE: ${{ format(inputs.release-title || '{0}', github.ref_name) }} + RELEASE_TAG: ${{ format(inputs.release-tag || '{0}', github.ref_name) }} steps: - uses: actions/checkout@v6 @@ -82,15 +135,12 @@ jobs: with: deno-version: v2.x - - if: | - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || - (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-jsr == 'true') + - if: env.PUBLISH_JSR name: "publish to jsr" + continue-on-error: true run: deno publish - - if: | - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || - (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-npm == 'true') + - if: env.PUBLISH_NPM name: "setup node for npm" uses: actions/setup-node@v6 with: @@ -98,10 +148,7 @@ jobs: registry-url: "https://registry.npmjs.org" - id: build - if: | - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || - (github.event_name == 'workflow_dispatch' && (github.event.inputs.publish-npm == 'true' || - github.event.inputs.publish-gpr == 'true')) + if: env.PUBLISH_NPM || env.PUBLISH_GPR name: "build for npm" run: deno task build env: @@ -109,21 +156,19 @@ jobs: - id: artifact if: steps.build.outcome == 'success' + continue-on-error: true uses: actions/upload-artifact@v6 with: path: npm name: nberlette-math-npm_${{ github.ref_name }}-${{ github.sha }} - - if: | - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || - (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-npm == 'true') + - if: env.PUBLISH_NPM name: "publish to npm" + continue-on-error: true run: npm publish --access public working-directory: npm - - if: | - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || - (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-gpr == 'true') + - if: env.PUBLISH_GPR name: "setup node for gpr" uses: actions/setup-node@v6 with: @@ -132,12 +177,28 @@ jobs: env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - if: | - (github.event_name == 'push' && startsWith(github.ref, 'refs/tags/')) || - (github.event_name == 'workflow_dispatch' && github.event.inputs.publish-gpr == 'true') + - if: env.PUBLISH_GPR name: "publish to gpr" env: NODE_AUTH_TOKEN: ${{ secrets.GITHUB_TOKEN }} NPM_TOKEN: ${{ secrets.GITHUB_TOKEN }} + continue-on-error: true working-directory: npm run: npm publish --access public --registry https://npm.pkg.github.com + + - if: inputs.release != 'false' && (env.IS_TAG || github.ref_type == 'tag') + id: release + run: | + # shellcheck disable=SC2086,SC2206 + ASSETS=(${INPUT_RELEASE_ASSETS:-}) + if [ ${#ASSETS[@]} -eq 0 ]; then + if [ -d npm ]; then + (cd npm && npm pack 2>/dev/null) + ASSETS+=(./npm/*.tgz) + fi + fi + DRAFT="" + if [[ "${INPUT_RELEASE_DRAFT:-false}" == "true" ]]; then + DRAFT=true + fi + gh release create --title "${RELEASE_TITLE:-$GITHUB_REF_NAME}" --generate-notes --discussion-category "${INPUT_RELEASE_DISCUSSION_CATEGORY:-Releases}" "${DRAFT:+--draft}" "${RELEASE_TAG:-$GITHUB_REF_NAME}" "${ASSETS[@]}" diff --git a/.gitignore b/.gitignore index d46ffff..9cb6f6c 100644 --- a/.gitignore +++ b/.gitignore @@ -12,3 +12,4 @@ coverage .cov npm !deno.lock +!coverage diff --git a/deno.lock b/deno.lock index 0ee7e58..5e55d3f 100644 --- a/deno.lock +++ b/deno.lock @@ -33,7 +33,8 @@ "jsr:@std/path@~0.225.2": "0.225.2", "jsr:@std/semver@1.0.3": "1.0.3", "jsr:@ts-morph/bootstrap@0.24": "0.24.0", - "jsr:@ts-morph/common@0.24": "0.24.0" + "jsr:@ts-morph/common@0.24": "0.24.0", + "npm:vite@*": "7.3.0_picomatch@4.0.3" }, "jsr": { "@cliffy/ansi@1.0.0-rc.8": { @@ -186,5 +187,390 @@ "jsr:@std/path@~0.225.2" ] } + }, + "npm": { + "@esbuild/aix-ppc64@0.27.2": { + "integrity": "sha512-GZMB+a0mOMZs4MpDbj8RJp4cw+w1WV5NYD6xzgvzUJ5Ek2jerwfO2eADyI6ExDSUED+1X8aMbegahsJi+8mgpw==", + "os": ["aix"], + "cpu": ["ppc64"] + }, + "@esbuild/android-arm64@0.27.2": { + "integrity": "sha512-pvz8ZZ7ot/RBphf8fv60ljmaoydPU12VuXHImtAs0XhLLw+EXBi2BLe3OYSBslR4rryHvweW5gmkKFwTiFy6KA==", + "os": ["android"], + "cpu": ["arm64"] + }, + "@esbuild/android-arm@0.27.2": { + "integrity": "sha512-DVNI8jlPa7Ujbr1yjU2PfUSRtAUZPG9I1RwW4F4xFB1Imiu2on0ADiI/c3td+KmDtVKNbi+nffGDQMfcIMkwIA==", + "os": ["android"], + "cpu": ["arm"] + }, + "@esbuild/android-x64@0.27.2": { + "integrity": "sha512-z8Ank4Byh4TJJOh4wpz8g2vDy75zFL0TlZlkUkEwYXuPSgX8yzep596n6mT7905kA9uHZsf/o2OJZubl2l3M7A==", + "os": ["android"], + "cpu": ["x64"] + }, + "@esbuild/darwin-arm64@0.27.2": { + "integrity": "sha512-davCD2Zc80nzDVRwXTcQP/28fiJbcOwvdolL0sOiOsbwBa72kegmVU0Wrh1MYrbuCL98Omp5dVhQFWRKR2ZAlg==", + "os": ["darwin"], + "cpu": ["arm64"] + }, + "@esbuild/darwin-x64@0.27.2": { + "integrity": "sha512-ZxtijOmlQCBWGwbVmwOF/UCzuGIbUkqB1faQRf5akQmxRJ1ujusWsb3CVfk/9iZKr2L5SMU5wPBi1UWbvL+VQA==", + "os": ["darwin"], + "cpu": ["x64"] + }, + "@esbuild/freebsd-arm64@0.27.2": { + "integrity": "sha512-lS/9CN+rgqQ9czogxlMcBMGd+l8Q3Nj1MFQwBZJyoEKI50XGxwuzznYdwcav6lpOGv5BqaZXqvBSiB/kJ5op+g==", + "os": ["freebsd"], + "cpu": ["arm64"] + }, + "@esbuild/freebsd-x64@0.27.2": { + "integrity": "sha512-tAfqtNYb4YgPnJlEFu4c212HYjQWSO/w/h/lQaBK7RbwGIkBOuNKQI9tqWzx7Wtp7bTPaGC6MJvWI608P3wXYA==", + "os": ["freebsd"], + "cpu": ["x64"] + }, + "@esbuild/linux-arm64@0.27.2": { + "integrity": "sha512-hYxN8pr66NsCCiRFkHUAsxylNOcAQaxSSkHMMjcpx0si13t1LHFphxJZUiGwojB1a/Hd5OiPIqDdXONia6bhTw==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@esbuild/linux-arm@0.27.2": { + "integrity": "sha512-vWfq4GaIMP9AIe4yj1ZUW18RDhx6EPQKjwe7n8BbIecFtCQG4CfHGaHuh7fdfq+y3LIA2vGS/o9ZBGVxIDi9hw==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@esbuild/linux-ia32@0.27.2": { + "integrity": "sha512-MJt5BRRSScPDwG2hLelYhAAKh9imjHK5+NE/tvnRLbIqUWa+0E9N4WNMjmp/kXXPHZGqPLxggwVhz7QP8CTR8w==", + "os": ["linux"], + "cpu": ["ia32"] + }, + "@esbuild/linux-loong64@0.27.2": { + "integrity": "sha512-lugyF1atnAT463aO6KPshVCJK5NgRnU4yb3FUumyVz+cGvZbontBgzeGFO1nF+dPueHD367a2ZXe1NtUkAjOtg==", + "os": ["linux"], + "cpu": ["loong64"] + }, + "@esbuild/linux-mips64el@0.27.2": { + "integrity": "sha512-nlP2I6ArEBewvJ2gjrrkESEZkB5mIoaTswuqNFRv/WYd+ATtUpe9Y09RnJvgvdag7he0OWgEZWhviS1OTOKixw==", + "os": ["linux"], + "cpu": ["mips64el"] + }, + "@esbuild/linux-ppc64@0.27.2": { + "integrity": "sha512-C92gnpey7tUQONqg1n6dKVbx3vphKtTHJaNG2Ok9lGwbZil6DrfyecMsp9CrmXGQJmZ7iiVXvvZH6Ml5hL6XdQ==", + "os": ["linux"], + "cpu": ["ppc64"] + }, + "@esbuild/linux-riscv64@0.27.2": { + "integrity": "sha512-B5BOmojNtUyN8AXlK0QJyvjEZkWwy/FKvakkTDCziX95AowLZKR6aCDhG7LeF7uMCXEJqwa8Bejz5LTPYm8AvA==", + "os": ["linux"], + "cpu": ["riscv64"] + }, + "@esbuild/linux-s390x@0.27.2": { + "integrity": "sha512-p4bm9+wsPwup5Z8f4EpfN63qNagQ47Ua2znaqGH6bqLlmJ4bx97Y9JdqxgGZ6Y8xVTixUnEkoKSHcpRlDnNr5w==", + "os": ["linux"], + "cpu": ["s390x"] + }, + "@esbuild/linux-x64@0.27.2": { + "integrity": "sha512-uwp2Tip5aPmH+NRUwTcfLb+W32WXjpFejTIOWZFw/v7/KnpCDKG66u4DLcurQpiYTiYwQ9B7KOeMJvLCu/OvbA==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@esbuild/netbsd-arm64@0.27.2": { + "integrity": "sha512-Kj6DiBlwXrPsCRDeRvGAUb/LNrBASrfqAIok+xB0LxK8CHqxZ037viF13ugfsIpePH93mX7xfJp97cyDuTZ3cw==", + "os": ["netbsd"], + "cpu": ["arm64"] + }, + "@esbuild/netbsd-x64@0.27.2": { + "integrity": "sha512-HwGDZ0VLVBY3Y+Nw0JexZy9o/nUAWq9MlV7cahpaXKW6TOzfVno3y3/M8Ga8u8Yr7GldLOov27xiCnqRZf0tCA==", + "os": ["netbsd"], + "cpu": ["x64"] + }, + "@esbuild/openbsd-arm64@0.27.2": { + "integrity": "sha512-DNIHH2BPQ5551A7oSHD0CKbwIA/Ox7+78/AWkbS5QoRzaqlev2uFayfSxq68EkonB+IKjiuxBFoV8ESJy8bOHA==", + "os": ["openbsd"], + "cpu": ["arm64"] + }, + "@esbuild/openbsd-x64@0.27.2": { + "integrity": "sha512-/it7w9Nb7+0KFIzjalNJVR5bOzA9Vay+yIPLVHfIQYG/j+j9VTH84aNB8ExGKPU4AzfaEvN9/V4HV+F+vo8OEg==", + "os": ["openbsd"], + "cpu": ["x64"] + }, + "@esbuild/openharmony-arm64@0.27.2": { + "integrity": "sha512-LRBbCmiU51IXfeXk59csuX/aSaToeG7w48nMwA6049Y4J4+VbWALAuXcs+qcD04rHDuSCSRKdmY63sruDS5qag==", + "os": ["openharmony"], + "cpu": ["arm64"] + }, + "@esbuild/sunos-x64@0.27.2": { + "integrity": "sha512-kMtx1yqJHTmqaqHPAzKCAkDaKsffmXkPHThSfRwZGyuqyIeBvf08KSsYXl+abf5HDAPMJIPnbBfXvP2ZC2TfHg==", + "os": ["sunos"], + "cpu": ["x64"] + }, + "@esbuild/win32-arm64@0.27.2": { + "integrity": "sha512-Yaf78O/B3Kkh+nKABUF++bvJv5Ijoy9AN1ww904rOXZFLWVc5OLOfL56W+C8F9xn5JQZa3UX6m+IktJnIb1Jjg==", + "os": ["win32"], + "cpu": ["arm64"] + }, + "@esbuild/win32-ia32@0.27.2": { + "integrity": "sha512-Iuws0kxo4yusk7sw70Xa2E2imZU5HoixzxfGCdxwBdhiDgt9vX9VUCBhqcwY7/uh//78A1hMkkROMJq9l27oLQ==", + "os": ["win32"], + "cpu": ["ia32"] + }, + "@esbuild/win32-x64@0.27.2": { + "integrity": "sha512-sRdU18mcKf7F+YgheI/zGf5alZatMUTKj/jNS6l744f9u3WFu4v7twcUI9vu4mknF4Y9aDlblIie0IM+5xxaqQ==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@rollup/rollup-android-arm-eabi@4.55.1": { + "integrity": "sha512-9R0DM/ykwfGIlNu6+2U09ga0WXeZ9MRC2Ter8jnz8415VbuIykVuc6bhdrbORFZANDmTDvq26mJrEVTl8TdnDg==", + "os": ["android"], + "cpu": ["arm"] + }, + "@rollup/rollup-android-arm64@4.55.1": { + "integrity": "sha512-eFZCb1YUqhTysgW3sj/55du5cG57S7UTNtdMjCW7LwVcj3dTTcowCsC8p7uBdzKsZYa8J7IDE8lhMI+HX1vQvg==", + "os": ["android"], + "cpu": ["arm64"] + }, + "@rollup/rollup-darwin-arm64@4.55.1": { + "integrity": "sha512-p3grE2PHcQm2e8PSGZdzIhCKbMCw/xi9XvMPErPhwO17vxtvCN5FEA2mSLgmKlCjHGMQTP6phuQTYWUnKewwGg==", + "os": ["darwin"], + "cpu": ["arm64"] + }, + "@rollup/rollup-darwin-x64@4.55.1": { + "integrity": "sha512-rDUjG25C9qoTm+e02Esi+aqTKSBYwVTaoS1wxcN47/Luqef57Vgp96xNANwt5npq9GDxsH7kXxNkJVEsWEOEaQ==", + "os": ["darwin"], + "cpu": ["x64"] + }, + "@rollup/rollup-freebsd-arm64@4.55.1": { + "integrity": "sha512-+JiU7Jbp5cdxekIgdte0jfcu5oqw4GCKr6i3PJTlXTCU5H5Fvtkpbs4XJHRmWNXF+hKmn4v7ogI5OQPaupJgOg==", + "os": ["freebsd"], + "cpu": ["arm64"] + }, + "@rollup/rollup-freebsd-x64@4.55.1": { + "integrity": "sha512-V5xC1tOVWtLLmr3YUk2f6EJK4qksksOYiz/TCsFHu/R+woubcLWdC9nZQmwjOAbmExBIVKsm1/wKmEy4z4u4Bw==", + "os": ["freebsd"], + "cpu": ["x64"] + }, + "@rollup/rollup-linux-arm-gnueabihf@4.55.1": { + "integrity": "sha512-Rn3n+FUk2J5VWx+ywrG/HGPTD9jXNbicRtTM11e/uorplArnXZYsVifnPPqNNP5BsO3roI4n8332ukpY/zN7rQ==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@rollup/rollup-linux-arm-musleabihf@4.55.1": { + "integrity": "sha512-grPNWydeKtc1aEdrJDWk4opD7nFtQbMmV7769hiAaYyUKCT1faPRm2av8CX1YJsZ4TLAZcg9gTR1KvEzoLjXkg==", + "os": ["linux"], + "cpu": ["arm"] + }, + "@rollup/rollup-linux-arm64-gnu@4.55.1": { + "integrity": "sha512-a59mwd1k6x8tXKcUxSyISiquLwB5pX+fJW9TkWU46lCqD/GRDe9uDN31jrMmVP3feI3mhAdvcCClhV8V5MhJFQ==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@rollup/rollup-linux-arm64-musl@4.55.1": { + "integrity": "sha512-puS1MEgWX5GsHSoiAsF0TYrpomdvkaXm0CofIMG5uVkP6IBV+ZO9xhC5YEN49nsgYo1DuuMquF9+7EDBVYu4uA==", + "os": ["linux"], + "cpu": ["arm64"] + }, + "@rollup/rollup-linux-loong64-gnu@4.55.1": { + "integrity": "sha512-r3Wv40in+lTsULSb6nnoudVbARdOwb2u5fpeoOAZjFLznp6tDU8kd+GTHmJoqZ9lt6/Sys33KdIHUaQihFcu7g==", + "os": ["linux"], + "cpu": ["loong64"] + }, + "@rollup/rollup-linux-loong64-musl@4.55.1": { + "integrity": "sha512-MR8c0+UxAlB22Fq4R+aQSPBayvYa3+9DrwG/i1TKQXFYEaoW3B5b/rkSRIypcZDdWjWnpcvxbNaAJDcSbJU3Lw==", + "os": ["linux"], + "cpu": ["loong64"] + }, + "@rollup/rollup-linux-ppc64-gnu@4.55.1": { + "integrity": "sha512-3KhoECe1BRlSYpMTeVrD4sh2Pw2xgt4jzNSZIIPLFEsnQn9gAnZagW9+VqDqAHgm1Xc77LzJOo2LdigS5qZ+gw==", + "os": ["linux"], + "cpu": ["ppc64"] + }, + "@rollup/rollup-linux-ppc64-musl@4.55.1": { + "integrity": "sha512-ziR1OuZx0vdYZZ30vueNZTg73alF59DicYrPViG0NEgDVN8/Jl87zkAPu4u6VjZST2llgEUjaiNl9JM6HH1Vdw==", + "os": ["linux"], + "cpu": ["ppc64"] + }, + "@rollup/rollup-linux-riscv64-gnu@4.55.1": { + "integrity": "sha512-uW0Y12ih2XJRERZ4jAfKamTyIHVMPQnTZcQjme2HMVDAHY4amf5u414OqNYC+x+LzRdRcnIG1YodLrrtA8xsxw==", + "os": ["linux"], + "cpu": ["riscv64"] + }, + "@rollup/rollup-linux-riscv64-musl@4.55.1": { + "integrity": "sha512-u9yZ0jUkOED1BFrqu3BwMQoixvGHGZ+JhJNkNKY/hyoEgOwlqKb62qu+7UjbPSHYjiVy8kKJHvXKv5coH4wDeg==", + "os": ["linux"], + "cpu": ["riscv64"] + }, + "@rollup/rollup-linux-s390x-gnu@4.55.1": { + "integrity": "sha512-/0PenBCmqM4ZUd0190j7J0UsQ/1nsi735iPRakO8iPciE7BQ495Y6msPzaOmvx0/pn+eJVVlZrNrSh4WSYLxNg==", + "os": ["linux"], + "cpu": ["s390x"] + }, + "@rollup/rollup-linux-x64-gnu@4.55.1": { + "integrity": "sha512-a8G4wiQxQG2BAvo+gU6XrReRRqj+pLS2NGXKm8io19goR+K8lw269eTrPkSdDTALwMmJp4th2Uh0D8J9bEV1vg==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@rollup/rollup-linux-x64-musl@4.55.1": { + "integrity": "sha512-bD+zjpFrMpP/hqkfEcnjXWHMw5BIghGisOKPj+2NaNDuVT+8Ds4mPf3XcPHuat1tz89WRL+1wbcxKY3WSbiT7w==", + "os": ["linux"], + "cpu": ["x64"] + }, + "@rollup/rollup-openbsd-x64@4.55.1": { + "integrity": "sha512-eLXw0dOiqE4QmvikfQ6yjgkg/xDM+MdU9YJuP4ySTibXU0oAvnEWXt7UDJmD4UkYialMfOGFPJnIHSe/kdzPxg==", + "os": ["openbsd"], + "cpu": ["x64"] + }, + "@rollup/rollup-openharmony-arm64@4.55.1": { + "integrity": "sha512-xzm44KgEP11te3S2HCSyYf5zIzWmx3n8HDCc7EE59+lTcswEWNpvMLfd9uJvVX8LCg9QWG67Xt75AuHn4vgsXw==", + "os": ["openharmony"], + "cpu": ["arm64"] + }, + "@rollup/rollup-win32-arm64-msvc@4.55.1": { + "integrity": "sha512-yR6Bl3tMC/gBok5cz/Qi0xYnVbIxGx5Fcf/ca0eB6/6JwOY+SRUcJfI0OpeTpPls7f194as62thCt/2BjxYN8g==", + "os": ["win32"], + "cpu": ["arm64"] + }, + "@rollup/rollup-win32-ia32-msvc@4.55.1": { + "integrity": "sha512-3fZBidchE0eY0oFZBnekYCfg+5wAB0mbpCBuofh5mZuzIU/4jIVkbESmd2dOsFNS78b53CYv3OAtwqkZZmU5nA==", + "os": ["win32"], + "cpu": ["ia32"] + }, + "@rollup/rollup-win32-x64-gnu@4.55.1": { + "integrity": "sha512-xGGY5pXj69IxKb4yv/POoocPy/qmEGhimy/FoTpTSVju3FYXUQQMFCaZZXJVidsmGxRioZAwpThl/4zX41gRKg==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@rollup/rollup-win32-x64-msvc@4.55.1": { + "integrity": "sha512-SPEpaL6DX4rmcXtnhdrQYgzQ5W2uW3SCJch88lB2zImhJRhIIK44fkUrgIV/Q8yUNfw5oyZ5vkeQsZLhCb06lw==", + "os": ["win32"], + "cpu": ["x64"] + }, + "@types/estree@1.0.8": { + "integrity": "sha512-dWHzHa2WqEXI/O1E9OjrocMTKJl2mSrEolh1Iomrv6U+JuNwaHXsXx9bLu5gG7BUWFIN0skIQJQ/L1rIex4X6w==" + }, + "esbuild@0.27.2": { + "integrity": "sha512-HyNQImnsOC7X9PMNaCIeAm4ISCQXs5a5YasTXVliKv4uuBo1dKrG0A+uQS8M5eXjVMnLg3WgXaKvprHlFJQffw==", + "optionalDependencies": [ + "@esbuild/aix-ppc64", + "@esbuild/android-arm", + "@esbuild/android-arm64", + "@esbuild/android-x64", + "@esbuild/darwin-arm64", + "@esbuild/darwin-x64", + "@esbuild/freebsd-arm64", + "@esbuild/freebsd-x64", + "@esbuild/linux-arm", + "@esbuild/linux-arm64", + "@esbuild/linux-ia32", + "@esbuild/linux-loong64", + "@esbuild/linux-mips64el", + "@esbuild/linux-ppc64", + "@esbuild/linux-riscv64", + "@esbuild/linux-s390x", + "@esbuild/linux-x64", + "@esbuild/netbsd-arm64", + "@esbuild/netbsd-x64", + "@esbuild/openbsd-arm64", + "@esbuild/openbsd-x64", + "@esbuild/openharmony-arm64", + "@esbuild/sunos-x64", + "@esbuild/win32-arm64", + "@esbuild/win32-ia32", + "@esbuild/win32-x64" + ], + "scripts": true, + "bin": true + }, + "fdir@6.5.0_picomatch@4.0.3": { + "integrity": "sha512-tIbYtZbucOs0BRGqPJkshJUYdL+SDH7dVM8gjy+ERp3WAUjLEFJE+02kanyHtwjWOnwrKYBiwAmM0p4kLJAnXg==", + "dependencies": [ + "picomatch" + ], + "optionalPeers": [ + "picomatch" + ] + }, + "fsevents@2.3.3": { + "integrity": "sha512-5xoDfX+fL7faATnagmWPpbFtwh/R77WmMMqqHGS65C3vvB0YHrgF+B1YmZ3441tMj5n63k0212XNoJwzlhffQw==", + "os": ["darwin"], + "scripts": true + }, + "nanoid@3.3.11": { + "integrity": "sha512-N8SpfPUnUp1bK+PMYW8qSWdl9U+wwNWI4QKxOYDy9JAro3WMX7p2OeVRF9v+347pnakNevPmiHhNmZ2HbFA76w==", + "bin": true + }, + "picocolors@1.1.1": { + "integrity": "sha512-xceH2snhtb5M9liqDsmEw56le376mTZkEX/jEb/RxNFyegNul7eNslCXP9FDj/Lcu0X8KEyMceP2ntpaHrDEVA==" + }, + "picomatch@4.0.3": { + "integrity": "sha512-5gTmgEY/sqK6gFXLIsQNH19lWb4ebPDLA4SdLP7dsWkIXHWlG66oPuVvXSGFPppYZz8ZDZq0dYYrbHfBCVUb1Q==" + }, + "postcss@8.5.6": { + "integrity": "sha512-3Ybi1tAuwAP9s0r1UQ2J4n5Y0G05bJkpUIO0/bI9MhwmD70S5aTWbXGBwxHrelT+XM1k6dM0pk+SwNkpTRN7Pg==", + "dependencies": [ + "nanoid", + "picocolors", + "source-map-js" + ] + }, + "rollup@4.55.1": { + "integrity": "sha512-wDv/Ht1BNHB4upNbK74s9usvl7hObDnvVzknxqY/E/O3X6rW1U1rV1aENEfJ54eFZDTNo7zv1f5N4edCluH7+A==", + "dependencies": [ + "@types/estree" + ], + "optionalDependencies": [ + "@rollup/rollup-android-arm-eabi", + "@rollup/rollup-android-arm64", + "@rollup/rollup-darwin-arm64", + "@rollup/rollup-darwin-x64", + "@rollup/rollup-freebsd-arm64", + "@rollup/rollup-freebsd-x64", + "@rollup/rollup-linux-arm-gnueabihf", + "@rollup/rollup-linux-arm-musleabihf", + "@rollup/rollup-linux-arm64-gnu", + "@rollup/rollup-linux-arm64-musl", + "@rollup/rollup-linux-loong64-gnu", + "@rollup/rollup-linux-loong64-musl", + "@rollup/rollup-linux-ppc64-gnu", + "@rollup/rollup-linux-ppc64-musl", + "@rollup/rollup-linux-riscv64-gnu", + "@rollup/rollup-linux-riscv64-musl", + "@rollup/rollup-linux-s390x-gnu", + "@rollup/rollup-linux-x64-gnu", + "@rollup/rollup-linux-x64-musl", + "@rollup/rollup-openbsd-x64", + "@rollup/rollup-openharmony-arm64", + "@rollup/rollup-win32-arm64-msvc", + "@rollup/rollup-win32-ia32-msvc", + "@rollup/rollup-win32-x64-gnu", + "@rollup/rollup-win32-x64-msvc", + "fsevents" + ], + "bin": true + }, + "source-map-js@1.2.1": { + "integrity": "sha512-UXWMKhLOwVKb728IUtQPXxfYU+usdybtUrK/8uGE8CQMvrhOpwvzDBwj0QhSL7MQc7vIsISBG8VQ8+IDQxpfQA==" + }, + "tinyglobby@0.2.15_picomatch@4.0.3": { + "integrity": "sha512-j2Zq4NyQYG5XMST4cbs02Ak8iJUdxRM0XI5QyxXuZOzKOINmWurp3smXu3y5wDcJrptwpSjgXHzIQxR0omXljQ==", + "dependencies": [ + "fdir", + "picomatch" + ] + }, + "vite@7.3.0_picomatch@4.0.3": { + "integrity": "sha512-dZwN5L1VlUBewiP6H9s2+B3e3Jg96D0vzN+Ry73sOefebhYr9f94wwkMNN/9ouoU8pV1BqA1d1zGk8928cx0rg==", + "dependencies": [ + "esbuild", + "fdir", + "picomatch", + "postcss", + "rollup", + "tinyglobby" + ], + "optionalDependencies": [ + "fsevents" + ], + "bin": true + } } } diff --git a/src/constants/e.ts b/src/constants/e.ts index 5cc71d4..c90723c 100644 --- a/src/constants/e.ts +++ b/src/constants/e.ts @@ -22,4 +22,18 @@ */ export const E: E = 2.718281828459045; +/** + * Type-level alias of the `E` constant exported by this module. This allows + * `E` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { E } from "@nick/math/constants/e"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(2.718281828459045); + * ``` + * @category Constants + */ export type E = 2.718281828459045; diff --git a/src/constants/epsilon.ts b/src/constants/epsilon.ts index 4b3737e..aa7dcc5 100644 --- a/src/constants/epsilon.ts +++ b/src/constants/epsilon.ts @@ -29,4 +29,18 @@ */ export const EPSILON: EPSILON = 2.220446049250313e-16; +/** + * Type-level alias of the `EPSILON` constant exported by this module. This allows + * `EPSILON` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { EPSILON } from "@nick/math/constants/epsilon"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(2.220446049250313e-16); + * ``` + * @category Constants + */ export type EPSILON = 2.220446049250313e-16; diff --git a/src/constants/ln2.ts b/src/constants/ln2.ts index 319ba77..886a8b3 100644 --- a/src/constants/ln2.ts +++ b/src/constants/ln2.ts @@ -21,4 +21,18 @@ * @category Constants */ export const LN2: LN2 = 0.6931471805599453; +/** + * Type-level alias of the `LN2` constant exported by this module. This allows + * `LN2` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { LN2 } from "@nick/math/constants/ln2"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(0.6931471805599453); + * ``` + * @category Constants + */ export type LN2 = 0.6931471805599453; diff --git a/src/constants/log10e.ts b/src/constants/log10e.ts index 37e1328..eff311a 100644 --- a/src/constants/log10e.ts +++ b/src/constants/log10e.ts @@ -21,4 +21,18 @@ * @category Constants */ export const LOG10E: LOG10E = 0.4342944819032518; +/** + * Type-level alias of the `LOG10E` constant exported by this module. This allows + * `LOG10E` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { LOG10E } from "@nick/math/constants/log10e"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(0.4342944819032518); + * ``` + * @category Constants + */ export type LOG10E = 0.4342944819032518; diff --git a/src/constants/log2e.ts b/src/constants/log2e.ts index 97a7652..7e4417c 100644 --- a/src/constants/log2e.ts +++ b/src/constants/log2e.ts @@ -21,4 +21,18 @@ * @category Constants */ export const LOG2E: LOG2E = 1.4426950408889634; +/** + * Type-level alias of the `LOG2E` constant exported by this module. This allows + * `LOG2E` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { LOG2E } from "@nick/math/constants/log2e"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(1.4426950408889634); + * ``` + * @category Constants + */ export type LOG2E = 1.4426950408889634; diff --git a/src/constants/max_safe_integer.ts b/src/constants/max_safe_integer.ts index 85053c9..0024135 100644 --- a/src/constants/max_safe_integer.ts +++ b/src/constants/max_safe_integer.ts @@ -22,4 +22,18 @@ * @category Constants */ export const MAX_SAFE_INTEGER: MAX_SAFE_INTEGER = 9007199254740991; +/** + * Type-level alias of the `MAX_SAFE_INTEGER` constant exported by this module. This allows + * `MAX_SAFE_INTEGER` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { MAX_SAFE_INTEGER } from "@nick/math/constants/max-safe-integer"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(9007199254740991); + * ``` + * @category Constants + */ export type MAX_SAFE_INTEGER = 9007199254740991; diff --git a/src/constants/max_value.ts b/src/constants/max_value.ts index 5c3fab1..5ab9e0e 100644 --- a/src/constants/max_value.ts +++ b/src/constants/max_value.ts @@ -21,4 +21,18 @@ * @category Constants */ export const MAX_VALUE: MAX_VALUE = 1.7976931348623157e308; +/** + * Type-level alias of the `MAX_VALUE` constant exported by this module. This allows + * `MAX_VALUE` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { MAX_VALUE } from "@nick/math/constants/max-value"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(1.7976931348623157e308); + * ``` + * @category Constants + */ export type MAX_VALUE = 1.7976931348623157e308; diff --git a/src/constants/min_safe_integer.ts b/src/constants/min_safe_integer.ts index e6c3233..b6f6eb4 100644 --- a/src/constants/min_safe_integer.ts +++ b/src/constants/min_safe_integer.ts @@ -23,4 +23,18 @@ * @category Constants */ export const MIN_SAFE_INTEGER: MIN_SAFE_INTEGER = -9007199254740991; +/** + * Type-level alias of the `MIN_SAFE_INTEGER` constant exported by this module. This allows + * `MIN_SAFE_INTEGER` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { MIN_SAFE_INTEGER } from "@nick/math/constants/min-safe-integer"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(-9007199254740991); + * ``` + * @category Constants + */ export type MIN_SAFE_INTEGER = -9007199254740991; diff --git a/src/constants/min_value.ts b/src/constants/min_value.ts index 2f035b1..9e58f91 100644 --- a/src/constants/min_value.ts +++ b/src/constants/min_value.ts @@ -21,4 +21,18 @@ * @category Constants */ export const MIN_VALUE: MIN_VALUE = 5e-324; +/** + * Type-level alias of the `MIN_VALUE` constant exported by this module. This allows + * `MIN_VALUE` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { MIN_VALUE } from "@nick/math/constants/min-value"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(5e-324); + * ``` + * @category Constants + */ export type MIN_VALUE = 5e-324; diff --git a/src/constants/pi.ts b/src/constants/pi.ts index 9f18a70..e2dbba3 100644 --- a/src/constants/pi.ts +++ b/src/constants/pi.ts @@ -21,4 +21,18 @@ * @category Constants */ export const PI: PI = 3.141592653589793; +/** + * Type-level alias of the `PI` constant exported by this module. This allows + * `PI` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { PI } from "@nick/math/constants/pi"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(3.141592653589793); + * ``` + * @category Constants + */ export type PI = 3.141592653589793; diff --git a/src/constants/sqrt1_2.ts b/src/constants/sqrt1_2.ts index f3e3acc..846e46b 100644 --- a/src/constants/sqrt1_2.ts +++ b/src/constants/sqrt1_2.ts @@ -20,4 +20,18 @@ * @category Constants */ export const SQRT1_2: SQRT1_2 = 0.7071067811865476; +/** + * Type-level alias of the `SQRT1_2` constant exported by this module. This allows + * `SQRT1_2` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { SQRT1_2 } from "@nick/math/constants/sqrt1_2"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(0.7071067811865476); + * ``` + * @category Constants + */ export type SQRT1_2 = 0.7071067811865476; diff --git a/src/constants/sqrt2.ts b/src/constants/sqrt2.ts index 01a3bb4..c5944f8 100644 --- a/src/constants/sqrt2.ts +++ b/src/constants/sqrt2.ts @@ -20,4 +20,18 @@ * @category Constants */ export const SQRT2: SQRT2 = 1.4142135623730951; +/** + * Type-level alias of the `SQRT2` constant exported by this module. This allows + * `SQRT2` to be imported using a standard named import (i.e. the _value_ level) + * or via type-only import for a compile-time only reference to the same value. + * + * @example + * ```ts + * import type { SQRT2 } from "@nick/math/constants/sqrt2"; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; + * + * expectType(1.4142135623730951); + * ``` + * @category Constants + */ export type SQRT2 = 1.4142135623730951; diff --git a/src/float16/guards.ts b/src/float16/guards.ts index d2172ea..47f7d19 100644 --- a/src/float16/guards.ts +++ b/src/float16/guards.ts @@ -35,7 +35,9 @@ import { roundFloat16 } from "./round.ts"; * @tags float16 */ export function isFloat16(it: N): it is Float16; +/** @inheritDoc */ export function isFloat16(it: unknown): it is Float16; +/** @inheritDoc */ export function isFloat16(it: unknown): it is Float16 { return typeof it === "number" && !isNaN(it) && it === roundFloat16(it); } diff --git a/src/float32/guards.ts b/src/float32/guards.ts index b001c6b..38f2689 100644 --- a/src/float32/guards.ts +++ b/src/float32/guards.ts @@ -37,7 +37,9 @@ import { roundFloat32 } from "./round.ts"; * @tags float32 */ export function isFloat32(it: N): it is Float32; +/** @inheritDoc */ export function isFloat32(it: unknown): it is Float32; +/** @inheritDoc */ export function isFloat32(it: unknown): it is Float32 { return typeof it === "number" && !isNaN(it) && it === roundFloat32(it); } @@ -57,7 +59,9 @@ export function isFloat32(it: unknown): it is Float32 { export function isFiniteFloat32( it: N, ): it is Finite & Float32; +/** @inheritDoc */ export function isFiniteFloat32(it: unknown): it is Float32; +/** @inheritDoc */ export function isFiniteFloat32(it: unknown): it is Float32 { return isFloat32(it) && isFinite(it); } diff --git a/src/guards/integer.ts b/src/guards/integer.ts index e8199ac..6712676 100644 --- a/src/guards/integer.ts +++ b/src/guards/integer.ts @@ -45,10 +45,10 @@ export function isInteger( */ export function isInteger(number: unknown): number is Integer; -/** @internal */ -// deno-lint-ignore no-explicit-any -export function isInteger(number: any): number is Integer { - return (number = +number) % 1 === 0; +/** @inheritDoc */ +export function isInteger(number: unknown): number is Integer { + const value = +(number as number); + return value % 1 === 0; } /** diff --git a/src/types/finite.ts b/src/types/finite.ts index 6206da8..53ce95e 100644 --- a/src/types/finite.ts +++ b/src/types/finite.ts @@ -5,7 +5,7 @@ * @example * ```ts * import type { Finite } from "@nick/math/types/finite"; - * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; * * const value = 42 as Finite; * expectType(value); diff --git a/src/types/float.ts b/src/types/float.ts index 854bdc6..aaf2b3a 100644 --- a/src/types/float.ts +++ b/src/types/float.ts @@ -10,7 +10,7 @@ * @example * ```ts * import type { Float32 } from "@nick/math/types/float"; - * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; * * const value = 1 as Float32; * expectType(value); diff --git a/src/types/integer.ts b/src/types/integer.ts index 274357f..6309b4e 100644 --- a/src/types/integer.ts +++ b/src/types/integer.ts @@ -5,7 +5,7 @@ * @example * ```ts * import type { Int32 } from "@nick/math/types/integer"; - * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; * * const value = 42 as Int32; * expectType(value); diff --git a/src/types/precision.ts b/src/types/precision.ts index 377eafe..3f2ff8e 100644 --- a/src/types/precision.ts +++ b/src/types/precision.ts @@ -5,7 +5,7 @@ * @example * ```ts * import type { P32, Precision } from "@nick/math/types/precision"; - * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; * * expectType(32); * expectType(32); diff --git a/src/types/safe_integer.ts b/src/types/safe_integer.ts index a6cdd5b..8d2b2ed 100644 --- a/src/types/safe_integer.ts +++ b/src/types/safe_integer.ts @@ -6,7 +6,7 @@ * ```ts * import { isSafeInteger } from "@nick/math/is/safe-integer"; * import type { SafeInteger } from "@nick/math/types/safe-integer"; - * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect";; + * import { expectType } from "jsr:@nick/is@0.2.0-rc.6/type/expect"; * * let user_input: number = 42; * if (isSafeInteger(user_input)) {