From 0c6f543cd5a99b37e32c195fa2da51575e017bbc Mon Sep 17 00:00:00 2001 From: o-az Date: Fri, 20 Jun 2025 08:06:34 -0700 Subject: [PATCH 1/8] feat: multi-arch forge npm deployment --- .gitattributes | 3 + .github/workflows/release.yml | 81 ++++++++++ npm/.env.example | 9 ++ npm/.gitignore | 37 +++++ npm/.npmrc | 2 + npm/@foundry-rs/forge-darwin-arm64/README.md | 4 + .../forge-darwin-arm64/package.json | 37 +++++ npm/@foundry-rs/forge-darwin-x64/README.md | 4 + npm/@foundry-rs/forge-darwin-x64/package.json | 32 ++++ npm/@foundry-rs/forge-linux-arm64/README.md | 4 + .../forge-linux-arm64/package.json | 37 +++++ npm/@foundry-rs/forge-linux-x64/README.md | 4 + npm/@foundry-rs/forge-linux-x64/package.json | 32 ++++ npm/@foundry-rs/forge-win32-x64/README.md | 4 + npm/@foundry-rs/forge-win32-x64/package.json | 32 ++++ npm/@foundry-rs/forge/README.md | 4 + npm/@foundry-rs/forge/package.json | 37 +++++ npm/README.md | 5 + npm/bun.lock | 144 +++++++++++++++++ npm/bunfig.toml | 2 + npm/env.d.ts | 26 +++ npm/package.json | 14 ++ npm/scripts/prepublish.ts | 136 ++++++++++++++++ npm/scripts/publish.ts | 83 ++++++++++ npm/src/const.ts | 149 ++++++++++++++++++ npm/src/forge.ts | 75 +++++++++ npm/src/install.ts | 108 +++++++++++++ npm/src/utilities.ts | 10 ++ npm/tsconfig.json | 38 +++++ npm/tsdown.config.ts | 67 ++++++++ 30 files changed, 1220 insertions(+) create mode 100644 npm/.env.example create mode 100644 npm/.gitignore create mode 100644 npm/.npmrc create mode 100644 npm/@foundry-rs/forge-darwin-arm64/README.md create mode 100644 npm/@foundry-rs/forge-darwin-arm64/package.json create mode 100644 npm/@foundry-rs/forge-darwin-x64/README.md create mode 100644 npm/@foundry-rs/forge-darwin-x64/package.json create mode 100644 npm/@foundry-rs/forge-linux-arm64/README.md create mode 100644 npm/@foundry-rs/forge-linux-arm64/package.json create mode 100644 npm/@foundry-rs/forge-linux-x64/README.md create mode 100644 npm/@foundry-rs/forge-linux-x64/package.json create mode 100644 npm/@foundry-rs/forge-win32-x64/README.md create mode 100644 npm/@foundry-rs/forge-win32-x64/package.json create mode 100644 npm/@foundry-rs/forge/README.md create mode 100644 npm/@foundry-rs/forge/package.json create mode 100644 npm/README.md create mode 100644 npm/bun.lock create mode 100644 npm/bunfig.toml create mode 100644 npm/env.d.ts create mode 100644 npm/package.json create mode 100644 npm/scripts/prepublish.ts create mode 100644 npm/scripts/publish.ts create mode 100644 npm/src/const.ts create mode 100644 npm/src/forge.ts create mode 100644 npm/src/install.ts create mode 100644 npm/src/utilities.ts create mode 100644 npm/tsconfig.json create mode 100644 npm/tsdown.config.ts diff --git a/.gitattributes b/.gitattributes index c3c54b1cfce95..ab25414626e35 100644 --- a/.gitattributes +++ b/.gitattributes @@ -5,5 +5,8 @@ testdata/cheats/Vm.sol linguist-generated *.rs diff=rust crates/lint/testdata/* text eol=lf +bun.lock linguist-language=JSON-with-Comments + +.env.example linguist-generated=Dotenv dprint.json linguist-language=JSON-with-Comments .devcontainer/devcontainer.json linguist-language=JSON-with-Comments \ No newline at end of file diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index 2faf123e4741e..fc2b2e4313e42 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -16,6 +16,7 @@ env: IS_NIGHTLY: ${{ github.event_name == 'schedule' || github.event_name == 'workflow_dispatch' }} PROFILE: maxperf STABLE_VERSION: "v1.1.0" + ACTIONS_RUNNER_DEBUG: true jobs: prepare: @@ -149,6 +150,7 @@ jobs: cargo install cross - name: Build binaries + id: binaries env: TAG_NAME: ${{ (env.IS_NIGHTLY == 'true' && 'nightly') || needs.prepare.outputs.tag_name }} SVM_TARGET_PLATFORM: ${{ matrix.svm_target_platform }} @@ -185,6 +187,8 @@ jobs: echo "${name}_bin_path=${bin}" >> $GITHUB_ENV done + echo "FORGE_BIN_PATH='${OUT_DIR}/forge${ext}'" >> "$GITHUB_OUTPUT" + - name: Archive binaries id: artifacts env: @@ -264,6 +268,83 @@ jobs: ${{ steps.artifacts.outputs.file_name }} ${{ steps.man.outputs.foundry_man }} + - name: Setup Bun + uses: oven-sh/setup-bun@main + env: + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + with: + scope: '@foundry-rs' + bun-version: 'latest' + registry-url: 'https://registry.npmjs.org' + + - name: Install dependencies + working-directory: ./npm + run: bun install --frozen-lockfile + + - name: Build ./npm scripts + working-directory: ./npm + run: bun x tsdown --config tsdown.config.ts + + - name: Prepublish npm package + working-directory: ./npm + shell: bash + env: + ARCH: ${{ matrix.arch }} + FORGE_BIN_PATH: ${{ steps.binaries.outputs.FORGE_BIN_PATH }} + run: |- + bun run ./scripts/prepublish.ts \ + --arch=${{ env.ARCH }} \ + --forge-bin-path=${{ env.FORGE_BIN_PATH }} + + - name: Publish npm package + shell: bash + working-directory: ./npm + env: + ARCH: ${{ matrix.arch }} + PLATFORM: ${{ matrix.platform }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} + run: |- + bun run ./scripts/publis.ts ./@foundry-rs/forge-${{ env.PLATFORM }}-${{ env.ARCH }} + + # bump version, bump version of each item in `optionalDependencies` + - name: Finally, publish @foundry-rs/forge + shell: bash + working-directory: ./npm + env: + ARCH: ${{ matrix.arch }} + PLATFORM: ${{ matrix.platform }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} + NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} + BUMP_VERSION: "TODO: Find this" + run: |- + cd @foundr-rs/forge + + export NPM_TOKEN=${{ secrets.NPM_TOKEN }} + export BUN_AUTH_TOKEN=${{ secrets.NPM_TOKEN }} + export NPM_CONFIG_TOKEN=${{ secrets.NPM_TOKEN }} + + npm version ${{ env.BUMP_VERSION }} \ + --message 'new forge release' \ + --git-tag-version=false \ + --workspace-update=false \ + --sign-git-tag=false \ + --git-tag-version=false \ + --commit-hook=false \ + --allow-same-version + + bun pm pack + + bun publish \ + --access='public' \ + --production \ + --verbose \ + --registry='https://registry.npmjs.org' \ + ./foundry-rs-forge-${{ env.BUMP_VERSION }}.tgz + cleanup: name: Release cleanup runs-on: ubuntu-latest diff --git a/npm/.env.example b/npm/.env.example new file mode 100644 index 0000000000000..7a8d082437f0f --- /dev/null +++ b/npm/.env.example @@ -0,0 +1,9 @@ +NODE_ENV="development" + +NPM_CONFIG_TOKEN="" + +FOUNDRY_OUT_DIR="" + +FORGE_BIN_PATH="" +PLATFORM_NAME="" +ARCH="" \ No newline at end of file diff --git a/npm/.gitignore b/npm/.gitignore new file mode 100644 index 0000000000000..a30b6992eba9d --- /dev/null +++ b/npm/.gitignore @@ -0,0 +1,37 @@ +# dependencies (bun install) +node_modules + +# output +out +dist +*.tgz + +# code coverage +coverage +*.lcov + +# logs +logs +_.log +report.[0-9]_.[0-9]_.[0-9]_.[0-9]_.json + +# dotenv environment variable files +.env +.env.development.local +.env.test.local +.env.production.local +.env.local + +# caches +.eslintcache +.cache +*.tsbuildinfo + +# IntelliJ based IDEs +.idea + +# Finder (MacOS) folder config +.DS_Store + +forge/*/bin/forge +@foundry-rs/*/bin/ \ No newline at end of file diff --git a/npm/.npmrc b/npm/.npmrc new file mode 100644 index 0000000000000..bea0cdb30b662 --- /dev/null +++ b/npm/.npmrc @@ -0,0 +1,2 @@ +enable-pre-post-scripts=true +node-options='--disable-warning=ExperimentalWarning --disable-warning=DeprecationWarning' diff --git a/npm/@foundry-rs/forge-darwin-arm64/README.md b/npm/@foundry-rs/forge-darwin-arm64/README.md new file mode 100644 index 0000000000000..61f4dbb6e15c3 --- /dev/null +++ b/npm/@foundry-rs/forge-darwin-arm64/README.md @@ -0,0 +1,4 @@ +# forge + +This is the macOS ARM 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts. +See for details. diff --git a/npm/@foundry-rs/forge-darwin-arm64/package.json b/npm/@foundry-rs/forge-darwin-arm64/package.json new file mode 100644 index 0000000000000..8bbd7b597b0ea --- /dev/null +++ b/npm/@foundry-rs/forge-darwin-arm64/package.json @@ -0,0 +1,37 @@ +{ + "name": "@unfoundry/forge-darwin-arm64", + "version": "0.0.3", + "type": "module", + "homepage": "https://getfoundry.sh", + "description": "Fast and flexible Ethereum testing framework (macOS arm64)", + "bin": { + "forge": "./bin/forge" + }, + "os": [ + "darwin" + ], + "cpu": [ + "arm64" + ], + "files": [ + "bin", + "package.json", + "README.md" + ], + "engines": { + "node": ">=20" + }, + "license": "MIT OR Apache-2.0", + "repository": { + "directory": "npm", + "url": "https://github.com/foundry-rs/foundry" + }, + "keywords": [ + "foundry", + "testing", + "ethereum", + "solidity", + "blockchain", + "smart-contracts" + ] +} diff --git a/npm/@foundry-rs/forge-darwin-x64/README.md b/npm/@foundry-rs/forge-darwin-x64/README.md new file mode 100644 index 0000000000000..87b0255019198 --- /dev/null +++ b/npm/@foundry-rs/forge-darwin-x64/README.md @@ -0,0 +1,4 @@ +# forge + +This is the macOS 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts. +See for details. diff --git a/npm/@foundry-rs/forge-darwin-x64/package.json b/npm/@foundry-rs/forge-darwin-x64/package.json new file mode 100644 index 0000000000000..7c76aec4c03dc --- /dev/null +++ b/npm/@foundry-rs/forge-darwin-x64/package.json @@ -0,0 +1,32 @@ +{ + "name": "@unfoundry/forge-darwin-x64", + "version": "0.0.2", + "type": "module", + "homepage": "https://getfoundry.sh", + "description": "Fast and flexible Ethereum testing framework (macOS x64)", + "bin": { + "forge": "./bin/forge.mjs" + }, + "os": [ + "darwin" + ], + "cpu": [ + "x64" + ], + "engines": { + "node": ">=20" + }, + "license": "MIT OR Apache-2.0", + "repository": { + "directory": "npm", + "url": "https://github.com/foundry-rs/foundry" + }, + "keywords": [ + "foundry", + "testing", + "ethereum", + "solidity", + "blockchain", + "smart-contracts" + ] +} diff --git a/npm/@foundry-rs/forge-linux-arm64/README.md b/npm/@foundry-rs/forge-linux-arm64/README.md new file mode 100644 index 0000000000000..2e209e9b965d6 --- /dev/null +++ b/npm/@foundry-rs/forge-linux-arm64/README.md @@ -0,0 +1,4 @@ +# forge + +This is the Linux ARM 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts. +See for details. diff --git a/npm/@foundry-rs/forge-linux-arm64/package.json b/npm/@foundry-rs/forge-linux-arm64/package.json new file mode 100644 index 0000000000000..fbc91d5d40185 --- /dev/null +++ b/npm/@foundry-rs/forge-linux-arm64/package.json @@ -0,0 +1,37 @@ +{ + "name": "@unfoundry/forge-linux-arm64", + "version": "0.0.3", + "type": "module", + "homepage": "https://getfoundry.sh", + "description": "Fast and flexible Ethereum testing framework (Linux arm64)", + "bin": { + "forge": "./bin/forge" + }, + "os": [ + "linux" + ], + "cpu": [ + "arm64" + ], + "files": [ + "bin", + "package.json", + "README.md" + ], + "engines": { + "node": ">=20" + }, + "license": "MIT OR Apache-2.0", + "repository": { + "directory": "npm", + "url": "https://github.com/foundry-rs/foundry" + }, + "keywords": [ + "foundry", + "testing", + "ethereum", + "solidity", + "blockchain", + "smart-contracts" + ] +} diff --git a/npm/@foundry-rs/forge-linux-x64/README.md b/npm/@foundry-rs/forge-linux-x64/README.md new file mode 100644 index 0000000000000..c1731c7427772 --- /dev/null +++ b/npm/@foundry-rs/forge-linux-x64/README.md @@ -0,0 +1,4 @@ +# forge + +This is the Linux 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts. +See for details. diff --git a/npm/@foundry-rs/forge-linux-x64/package.json b/npm/@foundry-rs/forge-linux-x64/package.json new file mode 100644 index 0000000000000..464adb4e6bd2d --- /dev/null +++ b/npm/@foundry-rs/forge-linux-x64/package.json @@ -0,0 +1,32 @@ +{ + "name": "@unfoundry/forge-linux-x64", + "version": "0.0.2", + "type": "module", + "homepage": "https://getfoundry.sh", + "description": "Fast and flexible Ethereum testing framework (Linux x64)", + "bin": { + "forge": "./bin/forge.mjs" + }, + "os": [ + "linux" + ], + "cpu": [ + "x64" + ], + "engines": { + "node": ">=20" + }, + "license": "MIT OR Apache-2.0", + "repository": { + "directory": "npm", + "url": "https://github.com/foundry-rs/foundry" + }, + "keywords": [ + "foundry", + "testing", + "ethereum", + "solidity", + "blockchain", + "smart-contracts" + ] +} diff --git a/npm/@foundry-rs/forge-win32-x64/README.md b/npm/@foundry-rs/forge-win32-x64/README.md new file mode 100644 index 0000000000000..bec6364573068 --- /dev/null +++ b/npm/@foundry-rs/forge-win32-x64/README.md @@ -0,0 +1,4 @@ +# forge + +This is the Windows 64-bit binary for `forge`, a CLI tool for testing, building, and deploying your smart contracts. +See for details. diff --git a/npm/@foundry-rs/forge-win32-x64/package.json b/npm/@foundry-rs/forge-win32-x64/package.json new file mode 100644 index 0000000000000..317dacd6a8b57 --- /dev/null +++ b/npm/@foundry-rs/forge-win32-x64/package.json @@ -0,0 +1,32 @@ +{ + "name": "@unfoundry/forge-win32-x64", + "version": "0.0.2", + "type": "module", + "homepage": "https://getfoundry.sh", + "description": "Fast and flexible Ethereum testing framework (Windows x64)", + "bin": { + "forge": "./bin/forge.mjs" + }, + "os": [ + "win32" + ], + "cpu": [ + "x64" + ], + "engines": { + "node": ">=20" + }, + "license": "MIT OR Apache-2.0", + "repository": { + "directory": "npm", + "url": "https://github.com/foundry-rs/foundry" + }, + "keywords": [ + "foundry", + "testing", + "ethereum", + "solidity", + "blockchain", + "smart-contracts" + ] +} diff --git a/npm/@foundry-rs/forge/README.md b/npm/@foundry-rs/forge/README.md new file mode 100644 index 0000000000000..459d0ac64956d --- /dev/null +++ b/npm/@foundry-rs/forge/README.md @@ -0,0 +1,4 @@ +# forge + +A CLI tool for testing, building, and deploying your smart contracts. +See for details. diff --git a/npm/@foundry-rs/forge/package.json b/npm/@foundry-rs/forge/package.json new file mode 100644 index 0000000000000..fd6cb9c8a92cf --- /dev/null +++ b/npm/@foundry-rs/forge/package.json @@ -0,0 +1,37 @@ +{ + "name": "@unfoundry/forge", + "version": "0.0.3", + "type": "module", + "homepage": "https://getfoundry.sh", + "description": "Fast and flexible Ethereum testing framework", + "main": "./bin/forge.mjs", + "module": "./bin/forge.mjs", + "engines": { + "node": ">=20" + }, + "bin": { + "forge": "./bin/forge.mjs" + }, + "files": [ + "bin", + "dist", + "package.json", + "README.md" + ], + "scripts": { + "postinstall": "node ./dist/install.mjs" + }, + "optionalDependencies": { + "@unfoundry/forge-darwin-arm64": "0.0.3", + "@unfoundry/forge-linux-arm64": "0.0.3" + }, + "publishConfig": { + "access": "public", + "registry": "https://registry.npmjs.org" + }, + "license": "MIT OR Apache-2.0", + "repository": { + "directory": "npm", + "url": "https://github.com/foundry-rs/foundry" + } +} diff --git a/npm/README.md b/npm/README.md new file mode 100644 index 0000000000000..b362c75ae691e --- /dev/null +++ b/npm/README.md @@ -0,0 +1,5 @@ +
+

@foundry-rs/forge

+
+ +# TODO: README diff --git a/npm/bun.lock b/npm/bun.lock new file mode 100644 index 0000000000000..80fba13313a37 --- /dev/null +++ b/npm/bun.lock @@ -0,0 +1,144 @@ +{ + "lockfileVersion": 1, + "workspaces": { + "": { + "dependencies": { + "@types/bun": "^1.2.16", + "@types/node": "^24.0.3", + "tsdown": "^0.12.8", + "typescript": "^5.8.3", + }, + }, + }, + "packages": { + "@babel/generator": ["@babel/generator@7.27.5", "", { "dependencies": { "@babel/parser": "^7.27.5", "@babel/types": "^7.27.3", "@jridgewell/gen-mapping": "^0.3.5", "@jridgewell/trace-mapping": "^0.3.25", "jsesc": "^3.0.2" } }, "sha512-ZGhA37l0e/g2s1Cnzdix0O3aLYm66eF8aufiVteOgnwxgnRP8GoyMj7VWsgWnQbVKXyge7hqrFh2K2TQM6t1Hw=="], + + "@babel/helper-string-parser": ["@babel/helper-string-parser@7.27.1", "", {}, "sha512-qMlSxKbpRlAridDExk92nSobyDdpPijUq2DW6oDnUqd0iOGxmQjyqhMIihI9+zv4LPyZdRje2cavWPbCbWm3eA=="], + + "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.27.1", "", {}, "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow=="], + + "@babel/parser": ["@babel/parser@7.27.5", "", { "dependencies": { "@babel/types": "^7.27.3" }, "bin": "./bin/babel-parser.js" }, "sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg=="], + + "@babel/types": ["@babel/types@7.27.6", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q=="], + + "@emnapi/core": ["@emnapi/core@1.4.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.0.2", "tslib": "^2.4.0" } }, "sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g=="], + + "@emnapi/runtime": ["@emnapi/runtime@1.4.3", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-pBPWdu6MLKROBX05wSNKcNb++m5Er+KQ9QkB+WVM+pW2Kx9hoSrVTnu3BdkI5eBLZoKu/J6mW/B6i6bJB2ytXQ=="], + + "@emnapi/wasi-threads": ["@emnapi/wasi-threads@1.0.2", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-5n3nTJblwRi8LlXkJ9eBzu+kZR8Yxcc7ubakyQTFzPMtIhFpUBRbsnc2Dv88IZDIbCDlBiWrknhB4Lsz7mg6BA=="], + + "@jridgewell/gen-mapping": ["@jridgewell/gen-mapping@0.3.8", "", { "dependencies": { "@jridgewell/set-array": "^1.2.1", "@jridgewell/sourcemap-codec": "^1.4.10", "@jridgewell/trace-mapping": "^0.3.24" } }, "sha512-imAbBGkb+ebQyxKgzv5Hu2nmROxoDOXHh80evxdoXNOrvAnVx7zimzc1Oo5h9RlfV4vPXaE2iM5pOFbvOCClWA=="], + + "@jridgewell/resolve-uri": ["@jridgewell/resolve-uri@3.1.2", "", {}, "sha512-bRISgCIjP20/tbWSPWMEi54QVPRZExkuD9lJL+UIxUKtwVJA8wW1Trb1jMs1RFXo1CBTNZ/5hpC9QvmKWdopKw=="], + + "@jridgewell/set-array": ["@jridgewell/set-array@1.2.1", "", {}, "sha512-R8gLRTZeyp03ymzP/6Lil/28tGeGEzhx1q2k703KGWRAI1VdvPIXdG70VJc2pAMw3NA6JKL5hhFu1sJX0Mnn/A=="], + + "@jridgewell/sourcemap-codec": ["@jridgewell/sourcemap-codec@1.5.0", "", {}, "sha512-gv3ZRaISU3fjPAgNsriBRqGWQL6quFx04YMPW/zD8XMLsU32mhCCbfbO6KZFLjvYpCZ8zyDEgqsgf+PwPaM7GQ=="], + + "@jridgewell/trace-mapping": ["@jridgewell/trace-mapping@0.3.25", "", { "dependencies": { "@jridgewell/resolve-uri": "^3.1.0", "@jridgewell/sourcemap-codec": "^1.4.14" } }, "sha512-vNk6aEwybGtawWmy/PzwnGDOjCkLWSD2wqvjGGAgOAwCGWySYXfYoxt00IJkTF+8Lb57DwOb3Aa0o9CApepiYQ=="], + + "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@0.2.11", "", { "dependencies": { "@emnapi/core": "^1.4.3", "@emnapi/runtime": "^1.4.3", "@tybys/wasm-util": "^0.9.0" } }, "sha512-9DPkXtvHydrcOsopiYpUgPHpmj0HWZKMUnL2dZqpvC42lsratuBG06V5ipyno0fUek5VlFsNQ+AcFATSrJXgMA=="], + + "@oxc-project/runtime": ["@oxc-project/runtime@0.72.3", "", {}, "sha512-FtOS+0v7rZcnjXzYTTqv1vu/KDptD1UztFgoZkYBGe/6TcNFm+SP/jQoLvzau1SPir95WgDOBOUm2Gmsm+bQag=="], + + "@oxc-project/types": ["@oxc-project/types@0.72.3", "", {}, "sha512-CfAC4wrmMkUoISpQkFAIfMVvlPfQV3xg7ZlcqPXPOIMQhdKIId44G8W0mCPgtpWdFFAyJ+SFtiM+9vbyCkoVng=="], + + "@quansync/fs": ["@quansync/fs@0.1.3", "", { "dependencies": { "quansync": "^0.2.10" } }, "sha512-G0OnZbMWEs5LhDyqy2UL17vGhSVHkQIfVojMtEWVenvj0V5S84VBgy86kJIuNsGDp2p7sTKlpSIpBUWdC35OKg=="], + + "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.0.0-beta.15", "", { "os": "darwin", "cpu": "arm64" }, "sha512-YInZppDBLp5DadbJZGc7xBfDrMCSj3P6i2rPlvOCMlvjBQxJi2kX8Jquh+LufsWUiHD3JsvvH5EuUUc/tF5fkA=="], + + "@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.0.0-beta.15", "", { "os": "darwin", "cpu": "x64" }, "sha512-Zwv8KHU/XdVwLseHG6slJ0FAFklPpiO0sjNvhrcMp1X3F2ajPzUdIO8Cnu3KLmX1GWVSvu6q1kyARLUqPvlh7Q=="], + + "@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.0.0-beta.15", "", { "os": "freebsd", "cpu": "x64" }, "sha512-FwhNC23Fz9ldHW1/rX4QaoQe4kyOybCgxO9eglue3cbb3ol28KWpQl3xJfvXc9+O6PDefAs4oFBCbtTh8seiUw=="], + + "@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.15", "", { "os": "linux", "cpu": "arm" }, "sha512-E60pNliWl4j7EFEVX2oeJZ5VzR+NG6fvDJoqfqRfCl8wtKIf9E1WPWVQIrT+zkz+Fhc5op8g7h25z6rtxsDy9g=="], + + "@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.0.0-beta.15", "", { "os": "linux", "cpu": "arm64" }, "sha512-d+qo1LZ/a3EcQW08byIIZy0PBthmG/7dr69pifmNIet/azWR8jbceQaRFFczVc/NwVV3fsZDCmjG8mgJzsNEAg=="], + + "@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.0.0-beta.15", "", { "os": "linux", "cpu": "arm64" }, "sha512-P1hbtYF+5ftJI2Ergs4iARbAk6Xd6WnTQb3CF9kjN3KfJTsRYdo5/fvU8Lz/gzhZVvkCXXH3NxDd9308UBO8cw=="], + + "@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.0.0-beta.15", "", { "os": "linux", "cpu": "x64" }, "sha512-Q9NM9uMFN9cjcrW7gd9U087B5WzkEj9dQQHOgoENZSy+vYJYS2fINCIG40ljEVC6jXmVrJgUhJKv7elRZM1nng=="], + + "@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.0.0-beta.15", "", { "os": "linux", "cpu": "x64" }, "sha512-1tuCWuR8gx9PyW2pxAx2ZqnOnwhoY6NWBVP6ZmrjCKQ16NclYc61BzegFXSdugCy8w1QpBPT8/c5oh2W4E5aeA=="], + + "@rolldown/binding-wasm32-wasi": ["@rolldown/binding-wasm32-wasi@1.0.0-beta.15", "", { "dependencies": { "@napi-rs/wasm-runtime": "^0.2.10" }, "cpu": "none" }, "sha512-zrSeYrpTf27hRxMLh0qpkCoWgzRKG8EyR6o09Zt9xkqCOeE5tEK/S3jV1Nii9WSqVCWFRA+OYxKzMNoykV590g=="], + + "@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.0.0-beta.15", "", { "os": "win32", "cpu": "arm64" }, "sha512-diR41DsMUnkvb9hvW8vuIrA0WaacAN1fu6lPseXhYifAOZN6kvxEwKn7Xib8i0zjdrYErLv7GNSQ48W+xiNOnA=="], + + "@rolldown/binding-win32-ia32-msvc": ["@rolldown/binding-win32-ia32-msvc@1.0.0-beta.15", "", { "os": "win32", "cpu": "ia32" }, "sha512-oCbbcDC3Lk8YgdxCkG23UqVrvXVvllIBgmmwq89bhq5okPP899OI/P+oTTDsUTbhljzNq1pH8a+mR6YBxAFfvw=="], + + "@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.0.0-beta.15", "", { "os": "win32", "cpu": "x64" }, "sha512-w5hVsOv3dzKo10wAXizmnDvUo1yasn/ps+mcn9H9TiJ/GeRE5/15Y6hG6vUQYRQNLVbYRHUt2qG0MyOoasPcHg=="], + + "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-beta.15", "", {}, "sha512-lvFtIbidq5EqyAAeiVk41ZNjGRgUoGRBIuqpe1VRJ7R8Av7TLAgGWAwGlHNhO7MFkl7MNRX350CsTtIWIYkNIQ=="], + + "@tybys/wasm-util": ["@tybys/wasm-util@0.9.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw=="], + + "@types/bun": ["@types/bun@1.2.16", "", { "dependencies": { "bun-types": "1.2.16" } }, "sha512-1aCZJ/6nSiViw339RsaNhkNoEloLaPzZhxMOYEa7OzRzO41IGg5n/7I43/ZIAW/c+Q6cT12Vf7fOZOoVIzb5BQ=="], + + "@types/node": ["@types/node@24.0.3", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg=="], + + "ansis": ["ansis@4.1.0", "", {}, "sha512-BGcItUBWSMRgOCe+SVZJ+S7yTRG0eGt9cXAHev72yuGcY23hnLA7Bky5L/xLyPINoSN95geovfBkqoTlNZYa7w=="], + + "ast-kit": ["ast-kit@2.1.0", "", { "dependencies": { "@babel/parser": "^7.27.3", "pathe": "^2.0.3" } }, "sha512-ROM2LlXbZBZVk97crfw8PGDOBzzsJvN2uJCmwswvPUNyfH14eg90mSN3xNqsri1JS1G9cz0VzeDUhxJkTrr4Ew=="], + + "birpc": ["birpc@2.4.0", "", {}, "sha512-5IdNxTyhXHv2UlgnPHQ0h+5ypVmkrYHzL8QT+DwFZ//2N/oNV8Ch+BCRmTJ3x6/z9Axo/cXYBc9eprsUVK/Jsg=="], + + "bun-types": ["bun-types@1.2.16", "", { "dependencies": { "@types/node": "*" } }, "sha512-ciXLrHV4PXax9vHvUrkvun9VPVGOVwbbbBF/Ev1cXz12lyEZMoJpIJABOfPcN9gDJRaiKF9MVbSygLg4NXu3/A=="], + + "cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="], + + "chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], + + "debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], + + "defu": ["defu@6.1.4", "", {}, "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="], + + "diff": ["diff@8.0.2", "", {}, "sha512-sSuxWU5j5SR9QQji/o2qMvqRNYRDOcBTgsJ/DeCf4iSN4gW+gNMXM7wFIP+fdXZxoNiAnHUTGjCr+TSWXdRDKg=="], + + "dts-resolver": ["dts-resolver@2.1.1", "", { "peerDependencies": { "oxc-resolver": ">=11.0.0" }, "optionalPeers": ["oxc-resolver"] }, "sha512-3BiGFhB6mj5Kv+W2vdJseQUYW+SKVzAFJL6YNP6ursbrwy1fXHRotfHi3xLNxe4wZl/K8qbAFeCDjZLjzqxxRw=="], + + "empathic": ["empathic@1.1.0", "", {}, "sha512-rsPft6CK3eHtrlp9Y5ALBb+hfK+DWnA4WFebbazxjWyx8vSm3rZeoM3z9irsjcqO3PYRzlfv27XIB4tz2DV7RA=="], + + "fdir": ["fdir@6.4.6", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w=="], + + "get-tsconfig": ["get-tsconfig@4.10.1", "", { "dependencies": { "resolve-pkg-maps": "^1.0.0" } }, "sha512-auHyJ4AgMz7vgS8Hp3N6HXSmlMdUyhSUrfBF16w153rxtLIEOE+HGqaBppczZvnHLqQJfiHotCYpNhl0lUROFQ=="], + + "hookable": ["hookable@5.5.3", "", {}, "sha512-Yc+BQe8SvoXH1643Qez1zqLRmbA5rCL+sSmk6TVos0LWVfNIB7PGncdlId77WzLGSIB5KaWgTaNTs2lNVEI6VQ=="], + + "jiti": ["jiti@2.4.2", "", { "bin": { "jiti": "lib/jiti-cli.mjs" } }, "sha512-rg9zJN+G4n2nfJl5MW3BMygZX56zKPNVEYYqq7adpmMh4Jn2QNEwhvQlFy6jPVdcod7txZtKHWnyZiA3a0zP7A=="], + + "jsesc": ["jsesc@3.1.0", "", { "bin": { "jsesc": "bin/jsesc" } }, "sha512-/sM3dO2FOzXjKQhJuo0Q173wf2KOo8t4I8vHy6lF9poUp7bKT0/NHE8fPX23PwfhnykfqnC2xRxOnVw5XuGIaA=="], + + "ms": ["ms@2.1.3", "", {}, "sha512-6FlzubTLZG3J2a/NVCAleEhjzq5oxgHyaCU9yYXvcLsvoVaHJq/s5xXI6/XXP6tz7R9xAOtHnSO/tXtF3WRTlA=="], + + "pathe": ["pathe@2.0.3", "", {}, "sha512-WUjGcAqP1gQacoQe+OBJsFA7Ld4DyXuUIjZ5cc75cLHvJ7dtNsTugphxIADwspS+AraAUePCKrSVtPLFj/F88w=="], + + "picomatch": ["picomatch@4.0.2", "", {}, "sha512-M7BAV6Rlcy5u+m6oPhAPFgJTzAioX/6B0DxyvDlo9l8+T3nLKbrczg2WLUyzd45L8RqfUMyGPzekbMvX2Ldkwg=="], + + "quansync": ["quansync@0.2.10", "", {}, "sha512-t41VRkMYbkHyCYmOvx/6URnN80H7k4X0lLdBMGsz+maAwrJQYB1djpV6vHrQIBE0WBSGqhtEHrK9U3DWWH8v7A=="], + + "readdirp": ["readdirp@4.1.2", "", {}, "sha512-GDhwkLfywWL2s6vEjyhri+eXmfH6j1L7JE27WhqLeYzoh/A3DBaYGEj2H/HFZCn/kMfim73FXxEJTw06WtxQwg=="], + + "resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="], + + "rolldown": ["rolldown@1.0.0-beta.15", "", { "dependencies": { "@oxc-project/runtime": "=0.72.3", "@oxc-project/types": "=0.72.3", "@rolldown/pluginutils": "1.0.0-beta.15", "ansis": "^4.0.0" }, "optionalDependencies": { "@rolldown/binding-darwin-arm64": "1.0.0-beta.15", "@rolldown/binding-darwin-x64": "1.0.0-beta.15", "@rolldown/binding-freebsd-x64": "1.0.0-beta.15", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.15", "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.15", "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.15", "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.15", "@rolldown/binding-linux-x64-musl": "1.0.0-beta.15", "@rolldown/binding-wasm32-wasi": "1.0.0-beta.15", "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.15", "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.15", "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.15" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-ep788NsIGl0W5gT+99hBrSGe4Hdhcwc55PqM3O0mR5H0C4ZpGpDGgu9YzTJ8a6mFDLnFnc/LYC+Dszb7oWK/dg=="], + + "rolldown-plugin-dts": ["rolldown-plugin-dts@0.13.11", "", { "dependencies": { "@babel/generator": "^7.27.5", "@babel/parser": "^7.27.5", "@babel/types": "^7.27.6", "ast-kit": "^2.1.0", "birpc": "^2.3.0", "debug": "^4.4.1", "dts-resolver": "^2.1.1", "get-tsconfig": "^4.10.1" }, "peerDependencies": { "@typescript/native-preview": ">=7.0.0-dev.20250601.1", "rolldown": "^1.0.0-beta.9", "typescript": "^5.0.0", "vue-tsc": "~2.2.0" }, "optionalPeers": ["@typescript/native-preview", "typescript", "vue-tsc"] }, "sha512-1TScN31JImk8xcq9kdm52z2W8/QX3zeDpEjFkyZmK+GcD0u8QqSWWARBsCEdfS99NyI6D9NIbUpsABXlcpZhig=="], + + "semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], + + "tinyexec": ["tinyexec@1.0.1", "", {}, "sha512-5uC6DDlmeqiOwCPmK9jMSdOuZTh8bU39Ys6yidB+UTt5hfZUPGAypSgFRiEp+jbi9qH40BLDvy85jIU88wKSqw=="], + + "tinyglobby": ["tinyglobby@0.2.14", "", { "dependencies": { "fdir": "^6.4.4", "picomatch": "^4.0.2" } }, "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ=="], + + "tsdown": ["tsdown@0.12.8", "", { "dependencies": { "ansis": "^4.1.0", "cac": "^6.7.14", "chokidar": "^4.0.3", "debug": "^4.4.1", "diff": "^8.0.2", "empathic": "^1.1.0", "hookable": "^5.5.3", "rolldown": "1.0.0-beta.15", "rolldown-plugin-dts": "^0.13.11", "semver": "^7.7.2", "tinyexec": "^1.0.1", "tinyglobby": "^0.2.14", "unconfig": "^7.3.2" }, "peerDependencies": { "@arethetypeswrong/core": "^0.18.1", "publint": "^0.3.0", "typescript": "^5.0.0", "unplugin-lightningcss": "^0.4.0", "unplugin-unused": "^0.5.0" }, "optionalPeers": ["@arethetypeswrong/core", "publint", "typescript", "unplugin-lightningcss", "unplugin-unused"], "bin": { "tsdown": "dist/run.mjs" } }, "sha512-niHeVcFCNjvVZYVGTeoM4BF+/DWxP8pFH2tUs71sEKYdcKtJIbkSdEmtxByaRZeMgwVbVgPb8nv9i9okVwFLAA=="], + + "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], + + "typescript": ["typescript@5.8.3", "", { "bin": { "tsc": "bin/tsc", "tsserver": "bin/tsserver" } }, "sha512-p1diW6TqL9L07nNxvRMM7hMMw4c5XOo/1ibL4aAIGmSAt9slTE1Xgw5KWuof2uTOvCg9BY7ZRi+GaF+7sfgPeQ=="], + + "unconfig": ["unconfig@7.3.2", "", { "dependencies": { "@quansync/fs": "^0.1.1", "defu": "^6.1.4", "jiti": "^2.4.2", "quansync": "^0.2.8" } }, "sha512-nqG5NNL2wFVGZ0NA/aCFw0oJ2pxSf1lwg4Z5ill8wd7K4KX/rQbHlwbh+bjctXL5Ly1xtzHenHGOK0b+lG6JVg=="], + + "undici-types": ["undici-types@7.8.0", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="], + } +} diff --git a/npm/bunfig.toml b/npm/bunfig.toml new file mode 100644 index 0000000000000..1269bdd642056 --- /dev/null +++ b/npm/bunfig.toml @@ -0,0 +1,2 @@ +bun.run = true +telemetry = false diff --git a/npm/env.d.ts b/npm/env.d.ts new file mode 100644 index 0000000000000..38c255bb9f49f --- /dev/null +++ b/npm/env.d.ts @@ -0,0 +1,26 @@ +interface ImportMetaEnv { + readonly CI: string + readonly NPM_TOKEN: string + readonly BUN_AUTH_TOKEN: string + + readonly NODE_ENV: 'development' | 'production' + + readonly ARCH: string + readonly PLATFORM_NAME: string + readonly FORGE_BIN_PATH: string + readonly FOUNDRY_OUT_DIR: string + readonly TARGET: string + readonly PROFILE: string +} + +declare namespace NodeJS { + interface ProcessEnv extends ImportMetaEnv {} +} + +interface ImportMeta { + readonly env: ImportMetaEnv +} + +declare namespace Bun { + interface Env extends ImportMetaEnv {} +} diff --git a/npm/package.json b/npm/package.json new file mode 100644 index 0000000000000..8c250da9050e8 --- /dev/null +++ b/npm/package.json @@ -0,0 +1,14 @@ +{ + "private": true, + "version": "0.0.2", + "scripts": { + "check": "bun x @biomejs/biome check . --fix --unsafe --indent-style=space --semicolons=as-needed --trailing-commas=none --bracket-spacing=true --javascript-formatter-quote-style=single" + }, + "dependencies": { + "@types/bun": "^1.2.16", + "@types/node": "^24.0.3", + "tsdown": "^0.12.8", + "typescript": "^5.8.3" + }, + "license": "MIT OR Apache-2.0" +} diff --git a/npm/scripts/prepublish.ts b/npm/scripts/prepublish.ts new file mode 100644 index 0000000000000..9c9fc7ce522a6 --- /dev/null +++ b/npm/scripts/prepublish.ts @@ -0,0 +1,136 @@ +#!/usr/bin/env bun + +import * as NodeFS from 'node:fs' +import * as NodePath from 'node:path' +import * as NodeUtil from 'node:util' +import * as Bun from 'bun' +import { colors } from '../src/utilities.ts' + +const nonGeneratedArtifacts = ['package.json', 'README.md'] + +const platformMap = { + linux: 'linux', + alpine: 'linux', // alpine uses linux in npm package names + darwin: 'darwin', + win32: 'win32' +} as const + +const archMap = { + amd64: 'x64', + arm64: 'arm64', + aarch64: 'arm64' +} as const + +main().catch((error) => { + console.error(colors.red, error) + process.exit(1) +}) + +async function main() { + const platform = Bun.env.PLATFORM_NAME as keyof typeof platformMap + const arch = Bun.env.ARCH as keyof typeof archMap + const profile = + Bun.env.NODE_ENV === 'production' ? 'release' : Bun.env.PROFILE || 'release' + + if (!platform) + throw new Error('PLATFORM_NAME environment variable is not set') + if (!arch) throw new Error('ARCH environment variable is not set') + + const [npmPlatform, npmArch] = [platformMap[platform], archMap[arch]] + + if (!npmPlatform || !npmArch) + throw new Error('Invalid platform or architecture') + + const packageDir = `${npmPlatform}-${npmArch}` + + const { values } = NodeUtil.parseArgs({ + args: Bun.argv, + strict: true, + allowPositionals: true, + options: { + arch: { type: 'string', default: arch }, + target: { type: 'string', default: Bun.env.TARGET }, + 'forge-bin-path': { type: 'string', default: Bun.env.FORGE_BIN_PATH } + } + }) + + // `darwin-arm64`, `darwin-x64`, `linux-arm64`, `linux-x64`, `win32-arm64`, `win32-x64` + const distribution = `${npmPlatform}-${npmArch}` + if (!distribution) throw new Error('Distribution is required') + + const packagePath = NodePath.join( + process.cwd(), + '@foundry-rs', + `forge-${distribution}` + ) + + const directoryItems = await NodeFS.promises.readdir(packagePath, { + withFileTypes: true, + recursive: true + }) + directoryItems + .filter((item) => !nonGeneratedArtifacts.includes(item.name)) + .forEach((item) => + NodeFS.rmSync(NodePath.join(packagePath, item.name), { + recursive: true, + force: true + }) + ) + + console.info(colors.green, 'Cleaned up package directory', colors.reset) + + // Use the forge_bin_path from GitHub Actions if available, otherwise construct it + const forgeBinPath = + values['forge-bin-path'] || + (values.target + ? `../target/${values.target}/${profile}/forge` + : `../target/${values.arch}/${profile}/forge`) + + if (!(await Bun.file(forgeBinPath).exists())) + throw new Error(`Source binary not found at ${forgeBinPath}`) + + const buildScripts = await Bun.$`bun x tsdown --config tsdown.config.ts` + .nothrow() + .quiet() + + if (buildScripts.exitCode !== 0) + throw new Error( + `Failed to build scripts: ${buildScripts.stderr.toString()}` + ) + + console.info(colors.green, buildScripts.stdout.toString(), colors.reset) + + // Determine binary name (add .exe for Windows) + const binaryName = platform === 'win32' ? 'forge.exe' : 'forge' + + // Copy to npm/@foundry-rs/forge-{platform}-{arch}/bin/ + const forgePackageDir = NodePath.join( + '@foundry-rs', + `forge-${packageDir}`, + 'bin' + ) + + if (!(await Bun.file(forgePackageDir).exists())) + NodeFS.mkdirSync(forgePackageDir, { recursive: true }) + + const targetPath = NodePath.join(forgePackageDir, binaryName) + + if (!(await Bun.file(forgeBinPath).exists())) + throw new Error(`Source binary not found at ${forgeBinPath}`) + + console.info( + colors.green, + `Copying ${forgeBinPath} to ${targetPath}`, + colors.reset + ) + await Bun.write(targetPath, Bun.file(forgeBinPath)) + + // Make binary executable on Unix-like systems + if (platform !== 'win32') NodeFS.chmodSync(targetPath, 0o755) + + console.info( + colors.green, + 'Binary copy completed successfully!', + colors.reset + ) +} diff --git a/npm/scripts/publish.ts b/npm/scripts/publish.ts new file mode 100644 index 0000000000000..488a01db531ec --- /dev/null +++ b/npm/scripts/publish.ts @@ -0,0 +1,83 @@ +#!/usr/bin/env bun +import * as NodeFS from 'node:fs' +import * as NodePath from 'node:path' +import * as Bun from 'bun' +import { colors } from '../src/utilities.ts' + +/** + * TODO: + * - handle publishing `@foundry-rs/forge` + * - auto-bump own version, + * - auto-bump versions in `optionalDependencies`, + */ + +main().catch((error) => { + console.error(error) + process.exit(1) +}) + +async function main() { + const packagePath = Bun.argv.at(2) + if (!packagePath) throw new Error('Package path is required') + + const publishVersion = (() => { + if (Bun.env.BUMP_VERSION) return Bun.env.BUMP_VERSION + const cargoToml = NodeFS.readFileSync( + NodePath.join(import.meta.dirname, '..', '..', 'Cargo.toml'), + 'utf-8' + ) + for (const line of cargoToml.split('\n')) { + if (!line.toLowerCase().startsWith('version = "')) continue + const [, publishVersion] = line.split('"') + return publishVersion + } + throw new Error('Version not found in Cargo.toml') + })() + + const NPM_TOKEN = Bun.env.NPM_TOKEN + if (!NPM_TOKEN) throw new Error('NPM_TOKEN is required') + + console.info(colors.green, 'Publish version:', publishVersion) + + const bumpVersion = await Bun.$` + npm version ${publishVersion} \ + --message "TODO: Add message" \ + --git-tag-version=false \ + --workspace-update=false \ + --sign-git-tag=false \ + --git-tag-version=false \ + --commit-hook=false \ + --allow-same-version` + .cwd(packagePath) + .env({ + ...Bun.env, + ...process.env, + NPM_TOKEN + }) + .quiet() + .nothrow() + + if (bumpVersion.exitCode !== 0) throw new Error(bumpVersion.stderr.toString()) + + console.log(bumpVersion.stdout.toString()) + + let packedFile: string | undefined + + for await (const line of Bun.$`bun pm pack`.cwd(packagePath).lines()) { + console.info(line) + if (line.endsWith('.tgz')) packedFile = line + } + console.info(colors.green, 'Packed file:', packedFile) + + const publishPackage = + await Bun.$`bun publish --access='public' --verbose --registry='https://registry.npmjs.org' ./${packedFile}` + .cwd(packagePath) + .quiet() + .nothrow() + console.info(publishPackage.stdout.toString()) + console.info(publishPackage.stderr.toString()) + if (publishPackage.exitCode !== 0) + throw new Error(publishPackage.stderr.toString()) + + console.log(publishPackage.stdout.toString()) +} diff --git a/npm/src/const.ts b/npm/src/const.ts new file mode 100644 index 0000000000000..a1bcbd92e2bc7 --- /dev/null +++ b/npm/src/const.ts @@ -0,0 +1,149 @@ +import * as NodeFS from 'node:fs' +import * as NodePath from 'node:path' +import type * as Process from 'node:process' +import packageJSON from '#package.json' with { type: 'json' } + +export const BINARY_DISTRIBUTION_VERSION = packageJSON.version + +export type Architecture = Extract<(typeof Process)['arch'], 'arm64' | 'x64'> +export type Platform = Extract< + (typeof Process)['platform'], + 'darwin' | 'linux' | 'win32' +> + +/** + * foundry doesn't ship arm64 binaries for windows + */ +export type ArchitecturePlatform = Exclude< + `${Platform}-${Architecture}`, + 'win32-arm64' +> + +const referenceMap = { + 'darwin-x64': 'x86_64-apple-darwin', + 'darwin-arm64': 'aarch64-apple-darwin', + 'linux-x64': 'x86_64-unknown-linux-gnu', + 'linux-arm64': 'aarch64-unknown-linux-gnu', + 'win32-x64': 'x86_64-pc-windows-msvc' +} as const satisfies Record + +export const BINARY_DISTRIBUTION_PACKAGES = { + 'darwin-x64': { + cpu: 'x64', + os: 'darwin', + arch: 'amd64', + reference: referenceMap['darwin-x64'], + path: 'forge-darwin-x64', + get name() { + return `@unfoundry/${this.path}` + }, + get version() { + return JSON.parse( + NodeFS.readFileSync( + NodePath.join( + NodePath.join(import.meta.dirname, '..', this.name), + 'package.json' + ), + { encoding: 'utf-8' } + ) + ).version + } + }, + 'darwin-arm64': { + cpu: 'arm64', + os: 'darwin', + arch: 'arm64', + reference: referenceMap['darwin-arm64'], + path: 'forge-darwin-arm64', + get name() { + return `@unfoundry/${this.path}` + }, + get version() { + return JSON.parse( + NodeFS.readFileSync( + NodePath.join( + NodePath.join(import.meta.dirname, '..', this.name), + 'package.json' + ), + { encoding: 'utf-8' } + ) + ).version + } + }, + 'linux-x64': { + cpu: 'x64', + os: 'linux', + arch: 'amd64', + reference: referenceMap['linux-x64'], + path: 'forge-linux-x64', + get name() { + return `@unfoundry/${this.path}` + }, + get version() { + return JSON.parse( + NodeFS.readFileSync( + NodePath.join( + NodePath.join(import.meta.dirname, '..', this.name), + 'package.json' + ), + { encoding: 'utf-8' } + ) + ).version + } + }, + 'linux-arm64': { + cpu: 'arm64', + os: 'linux', + arch: 'arm64', + reference: referenceMap['linux-arm64'], + path: 'forge-linux-arm64', + get name() { + return `@unfoundry/${this.path}` + }, + get version() { + return JSON.parse( + NodeFS.readFileSync( + NodePath.join( + NodePath.join(import.meta.dirname, '..', this.name), + 'package.json' + ), + { encoding: 'utf-8' } + ) + ).version + } + }, + 'win32-x64': { + cpu: 'x64', + os: 'win32', + arch: 'amd64', + reference: referenceMap['win32-x64'], + path: 'forge-win32-x64', + get name() { + return `@unfoundry/${this.path}` + }, + get version() { + return JSON.parse( + NodeFS.readFileSync( + NodePath.join( + NodePath.join(import.meta.dirname, '..', this.name), + 'package.json' + ), + { encoding: 'utf-8' } + ) + ).version + } + } +} as const satisfies Record< + ArchitecturePlatform, + { + version: string + cpu: string + os: string + arch: string + reference: string + path: string + name: string + } +> + +export const BINARY_NAME = process.platform === 'win32' ? 'forge.exe' : 'forge' diff --git a/npm/src/forge.ts b/npm/src/forge.ts new file mode 100644 index 0000000000000..cd2838ea35add --- /dev/null +++ b/npm/src/forge.ts @@ -0,0 +1,75 @@ +import * as NodeChildProcess from 'node:child_process' +import * as NodeFS from 'node:fs' +import * as NodeModule from 'node:module' +import * as Process from 'node:process' + +const require = NodeModule.createRequire(import.meta.url) + +function getBinaryPath() { + const { platform, arch } = Process + + let packageName: string | undefined + let binaryName = 'forge' + + switch (platform) { + case 'win32': + binaryName += '.exe' + if (arch === 'x64') packageName = '@foundry-rs/forge-win32-x64' + break + case 'darwin': + if (arch === 'x64') packageName = '@foundry-rs/forge-darwin-x64' + else if (arch === 'arm64') packageName = '@foundry-rs/forge-darwin-arm64' + break + case 'linux': + if (arch === 'x64') packageName = '@foundry-rs/forge-linux-x64' + else if (arch === 'arm64') packageName = '@foundry-rs/forge-linux-arm64' + break + default: + throw new Error(`Unsupported platform: ${platform}-${arch}`) + } + + if (!packageName) { + console.error(`Unsupported platform: ${platform}-${arch}`) + Process.exit(1) + } + + // Try to find the binary in the platform-specific package + try { + const binaryPath = require.resolve(`${packageName}/bin/${binaryName}`) + if (NodeFS.existsSync(binaryPath)) return binaryPath + } catch (error) { + // Package not installed + console.error( + 'Package not installed', + error instanceof Error ? error.message : error + ) + } + + console.error(`Platform-specific package ${packageName} not found.`) + console.error( + 'This usually means the installation failed or your platform is not supported.' + ) + console.error(`Platform: ${platform}, Architecture: ${arch}`) + Process.exit(1) +} + +function main() { + const binaryPath = getBinaryPath() + + // Spawn the binary with all arguments + const child = NodeChildProcess.spawn(binaryPath, Process.argv.slice(2), { + stdio: 'inherit', + windowsHide: false + }) + + child.on('close', (code) => { + Process.exit(code) + }) + + child.on('error', (error) => { + console.error('Error executing forge:', error.message) + Process.exit(1) + }) +} + +if (import.meta.url === `file://${Process.argv[1]}`) main() diff --git a/npm/src/install.ts b/npm/src/install.ts new file mode 100644 index 0000000000000..e42619388f2f1 --- /dev/null +++ b/npm/src/install.ts @@ -0,0 +1,108 @@ +import * as NodeFS from 'node:fs' +import * as NodeHttps from 'node:https' +import * as NodePath from 'node:path' +import * as Process from 'node:process' +import * as NodeZlib from 'node:zlib' +import { colors } from '#utilities.ts' +import { + type Architecture, + type ArchitecturePlatform, + BINARY_DISTRIBUTION_PACKAGES, + BINARY_DISTRIBUTION_VERSION, + BINARY_NAME, + type Platform +} from './const.ts' + +const platformSpecificPackage = + BINARY_DISTRIBUTION_PACKAGES[ + `${Process.platform as Platform}-${Process.arch as Architecture}` as ArchitecturePlatform + ] + +const fallbackBinaryPath = NodePath.join(import.meta.dirname, BINARY_NAME) + +function makeRequest(url: string): Promise { + return new Promise((resolve, reject) => { + NodeHttps.get(url, (response) => { + if ( + response?.statusCode && + response.statusCode >= 200 && + response.statusCode < 300 + ) { + const chunks: Buffer[] = [] + response.on('data', (chunk) => chunks.push(chunk)) + response.on('end', () => { + resolve(Buffer.concat(chunks)) + }) + } else if ( + response?.statusCode && + response.statusCode >= 300 && + response.statusCode < 400 && + response.headers.location + ) { + // Follow redirects + makeRequest(response.headers.location).then(resolve, reject) + } else { + reject( + new Error( + `npm responded with status code ${response.statusCode} when downloading the package!` + ) + ) + } + }).on('error', (error) => { + reject(error) + }) + }) +} + +function extractFileFromTarball( + tarballBuffer: Buffer, + filepath: string +): Buffer { + // Tar archives are organized in 512 byte blocks. + // Blocks can either be header blocks or data blocks. + // Header blocks contain file names of the archive in the first 100 bytes, terminated by a null byte. + // The size of a file is contained in bytes 124-135 of a header block and in octal format. + // The following blocks will be data blocks containing the file. + let offset = 0 + while (offset < tarballBuffer.length) { + const header = tarballBuffer.subarray(offset, offset + 512) + offset += 512 + + const fileName = header.toString('utf-8', 0, 100).replace(/\0.*/g, '') + const fileSize = Number.parseInt( + header.toString('utf-8', 124, 136).replace(/\0.*/g, ''), + 8 + ) + + if (fileName === filepath) + return tarballBuffer.subarray(offset, offset + fileSize) + + // Clamp offset to the uppoer multiple of 512 + offset = (offset + fileSize + 511) & ~511 + } + throw new Error(`File ${filepath} not found in tarball`) +} + +async function downloadBinaryFromNpm() { + const url = `https://registry.npmjs.org/${platformSpecificPackage.name}/-/${platformSpecificPackage.path}-${BINARY_DISTRIBUTION_VERSION}.tgz` + console.info( + colors.green, + 'Downloading binary from:\n', + url, + '\n', + colors.reset + ) + // Download the tarball of the right binary distribution package + const tarballDownloadBuffer = await makeRequest(url) + + const tarballBuffer = NodeZlib.unzipSync(tarballDownloadBuffer) + + // Extract binary from package and write to disk + NodeFS.writeFileSync( + fallbackBinaryPath, + extractFileFromTarball(tarballBuffer, `package/bin/${BINARY_NAME}`), + { mode: 0o755 } // Make binary file executable + ) +} + +if (import.meta.url === `file://${Process.argv[1]}`) downloadBinaryFromNpm() diff --git a/npm/src/utilities.ts b/npm/src/utilities.ts new file mode 100644 index 0000000000000..5f633692e34c0 --- /dev/null +++ b/npm/src/utilities.ts @@ -0,0 +1,10 @@ +export const colors = { + red: '\x1b[31m', + green: '\x1b[32m', + yellow: '\x1b[33m', + blue: '\x1b[34m', + magenta: '\x1b[35m', + cyan: '\x1b[36m', + white: '\x1b[37m', + reset: '\x1b[0m' +} diff --git a/npm/tsconfig.json b/npm/tsconfig.json new file mode 100644 index 0000000000000..eef11206b16f8 --- /dev/null +++ b/npm/tsconfig.json @@ -0,0 +1,38 @@ +{ + "schema": "https://json.schemastore.org/tsconfig.json", + "compilerOptions": { + "strict": true, + "baseUrl": ".", + "noEmit": true, + "allowJs": true, + "checkJs": true, + "lib": ["ESNext"], + "target": "ESNext", + "module": "ESNext", + "skipLibCheck": true, + "alwaysStrict": true, + "esModuleInterop": true, + "isolatedModules": true, + "strictNullChecks": true, + "resolveJsonModule": true, + "verbatimModuleSyntax": true, + "moduleResolution": "Bundler", + "useDefineForClassFields": true, + "noUncheckedIndexedAccess": true, + "resolvePackageJsonImports": true, + "resolvePackageJsonExports": true, + "useUnknownInCatchVariables": true, + "allowImportingTsExtensions": true, + "noFallthroughCasesInSwitch": true, + "allowSyntheticDefaultImports": true, + "forceConsistentCasingInFileNames": true, + "types": ["node", "bun"], + "paths": { + "#*": ["./src/*"], + "#package.json": ["./package.json"] + } + }, + "exclude": ["dist", "**/_/**", "node_modules"], + "include": ["src/**/*", "bin/**/*", "scripts/**/*"], + "files": ["env.d.ts", "tsdown.config.ts", "package.json"] +} diff --git a/npm/tsdown.config.ts b/npm/tsdown.config.ts new file mode 100644 index 0000000000000..08e43d97b4376 --- /dev/null +++ b/npm/tsdown.config.ts @@ -0,0 +1,67 @@ +import * as NodeFS from 'node:fs' +import * as NodePath from 'node:path' +import { defineConfig, type UserConfig } from 'tsdown' + +/** + * this makes it so that the bin automatically runs if bun, deno, or node is installed + */ +const shebang = /* sh */ `#!/bin/sh +//bin/true; (command -v bun && bun $0) || (command -v deno && deno --allow-all $0) || (command -v node && node $0) || exit 1 + +` + +const config = { + dts: false, + clean: true, + format: ['es'], + target: 'node20', + platform: 'node', + outExtensions: () => ({ js: '.mjs' }), + onSuccess: ({ name }) => console.info(`🎉 [${name}] Build complete!`), + hooks: { + 'build:before': ({ options }) => { + const packagePath = options.env?.PACKAGE_PATH + if (!packagePath) return + + NodeFS.readdirSync(packagePath, { withFileTypes: true }) + .filter((item) => !['package.json', 'README.md'].includes(item.name)) + .forEach((item) => + NodeFS.rmSync(NodePath.join(packagePath, item.name), { + recursive: true, + force: true + }) + ) + }, + 'build:done': ({ options }) => { + // prepend shebang to the file + const normalizedPath = NodePath.join( + options.outDir, + `${options.name}.mjs` + ) + NodeFS.writeFileSync( + normalizedPath, + shebang + NodeFS.readFileSync(normalizedPath, { encoding: 'utf8' }), + { encoding: 'utf8' } + ) + } + } +} as const satisfies UserConfig + +export default [ + defineConfig({ + ...config, + name: 'forge', + env: { + PACKAGE_PATH: './@foundry-rs/forge' + }, + outDir: './@foundry-rs/forge/bin', + entry: ['./src/forge.ts'] + }), + defineConfig({ + ...config, + name: 'install', + entry: ['./src/install.ts'], + outDir: './@foundry-rs/forge/dist', + outExtensions: () => ({ js: '.mjs' }) + }) +] From 2606b98c9411122c4b01c6f0c47c0c593215c217 Mon Sep 17 00:00:00 2001 From: o-az Date: Fri, 20 Jun 2025 08:33:11 -0700 Subject: [PATCH 2/8] chore: update gitignore --- .gitignore | 8 ++++++-- 1 file changed, 6 insertions(+), 2 deletions(-) diff --git a/.gitignore b/.gitignore index 64af508ada43c..c3246df7fb4b8 100644 --- a/.gitignore +++ b/.gitignore @@ -8,7 +8,11 @@ out.json .claude CLAUDE.md .env -node_modules + +# npm dist -bin +npm/bin +node_modules +package-lock.json + _ \ No newline at end of file From ca9450f3ec9473796cd4656332769403b866496c Mon Sep 17 00:00:00 2001 From: o-az Date: Fri, 20 Jun 2025 16:06:02 -0700 Subject: [PATCH 3/8] chore: specify registry info in bunfig --- npm/.env.example | 2 +- npm/bunfig.toml | 8 +++++++- 2 files changed, 8 insertions(+), 2 deletions(-) diff --git a/npm/.env.example b/npm/.env.example index 7a8d082437f0f..807bd5f29456a 100644 --- a/npm/.env.example +++ b/npm/.env.example @@ -1,6 +1,6 @@ NODE_ENV="development" -NPM_CONFIG_TOKEN="" +NPM_TOKEN="" FOUNDRY_OUT_DIR="" diff --git a/npm/bunfig.toml b/npm/bunfig.toml index 1269bdd642056..dfda1726e2063 100644 --- a/npm/bunfig.toml +++ b/npm/bunfig.toml @@ -1,2 +1,8 @@ -bun.run = true telemetry = false + +run.bun = true +bun.run = true + +logLevel = "debug" + +"@foundry-rs" = { token = "$NPM_TOKEN", url = "https://registry.npmjs.org" } From b791f4e55ef94cb81918291bb8bdeeaf8e9493bf Mon Sep 17 00:00:00 2001 From: o-az Date: Fri, 20 Jun 2025 23:15:13 -0700 Subject: [PATCH 4/8] chore: mark lockfile as linguist-generated --- .gitattributes | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/.gitattributes b/.gitattributes index ab25414626e35..1b0d5f780884a 100644 --- a/.gitattributes +++ b/.gitattributes @@ -1,12 +1,11 @@ crates/cheatcodes/assets/*.json linguist-generated testdata/cheats/Vm.sol linguist-generated +bun.lock linguist-generated # See *.rs diff=rust crates/lint/testdata/* text eol=lf -bun.lock linguist-language=JSON-with-Comments - .env.example linguist-generated=Dotenv dprint.json linguist-language=JSON-with-Comments .devcontainer/devcontainer.json linguist-language=JSON-with-Comments \ No newline at end of file From dd2b3f08c1ad2f293b5c7bc7cf0ab186dde95aca Mon Sep 17 00:00:00 2001 From: o-az Date: Sun, 22 Jun 2025 04:08:14 -0700 Subject: [PATCH 5/8] chore: use dprint --- dprint.json | 26 +++++++------- npm/.npmrc | 2 -- .../forge-darwin-arm64/package.json | 4 +-- .../forge-linux-arm64/package.json | 4 +-- npm/bun.lock | 6 ++-- npm/bunfig.toml | 6 +++- npm/package.json | 8 ++--- npm/scripts/prepublish.ts | 19 +++++----- npm/scripts/publish.ts | 14 ++++---- npm/src/const.ts | 2 +- npm/src/forge.ts | 4 +-- npm/src/install.ts | 32 ++++++++--------- npm/tsconfig.json | 35 +++++++++++++++---- npm/tsdown.config.ts | 8 ++--- 14 files changed, 94 insertions(+), 76 deletions(-) delete mode 100644 npm/.npmrc diff --git a/dprint.json b/dprint.json index c534f9106fd29..90c71aa44f161 100644 --- a/dprint.json +++ b/dprint.json @@ -1,29 +1,25 @@ { "$schema": "https://raw.githubusercontent.com/dprint/dprint/refs/heads/main/website/src/assets/schemas/v0.json", - "incremental": true, "indentWidth": 2, "useTabs": false, - "includes": [ - "*.md", - "*.{toml}", - "Dockerfile", - "*.{yml,yaml}", - "*.{json,jsonc}", - "*.{js,cjs,mjs,d.ts,d.cts,d.mts,ts,tsx,jsx}" - ], "excludes": [ + "!npm/**/*.{json,md,toml}", + "!npm/**/*.{js,cjs,mjs,d.ts,d.cts,d.mts,ts,tsx,jsx}", + "**/_", + "dprint.json", + "**/abi", "**/build", - "**/abi/**", "**/target", "**/test/**", "**/*.min.*", "**/dist/**", "testdata/**", "**/tests/**", + "node_modules", "changelog.json", "**/test-data/**", - "**/node_modules", "**/cheatcodes/**", + "**/node_modules/**", ".github/scripts/**", ".github/ISSUE_TEMPLATE/**" ], @@ -40,13 +36,15 @@ "textWrap": "maintain" }, "toml": { - "columnWidth": 100 + "lineWidth": 100 }, "json": { - "useTabs": false, + "lineWidth": 1, "indentWidth": 2, + "useTabs": false, "trailingCommas": "never", - "array.preferSingleLine": true + "preferSingleLine": false, + "array.preferSingleLine": false }, "typescript": { "useTabs": false, diff --git a/npm/.npmrc b/npm/.npmrc deleted file mode 100644 index bea0cdb30b662..0000000000000 --- a/npm/.npmrc +++ /dev/null @@ -1,2 +0,0 @@ -enable-pre-post-scripts=true -node-options='--disable-warning=ExperimentalWarning --disable-warning=DeprecationWarning' diff --git a/npm/@foundry-rs/forge-darwin-arm64/package.json b/npm/@foundry-rs/forge-darwin-arm64/package.json index 8bbd7b597b0ea..b1e839de0ac29 100644 --- a/npm/@foundry-rs/forge-darwin-arm64/package.json +++ b/npm/@foundry-rs/forge-darwin-arm64/package.json @@ -15,8 +15,8 @@ ], "files": [ "bin", - "package.json", - "README.md" + "README.md", + "package.json" ], "engines": { "node": ">=20" diff --git a/npm/@foundry-rs/forge-linux-arm64/package.json b/npm/@foundry-rs/forge-linux-arm64/package.json index fbc91d5d40185..bbc7c8391d231 100644 --- a/npm/@foundry-rs/forge-linux-arm64/package.json +++ b/npm/@foundry-rs/forge-linux-arm64/package.json @@ -15,8 +15,8 @@ ], "files": [ "bin", - "package.json", - "README.md" + "README.md", + "package.json" ], "engines": { "node": ">=20" diff --git a/npm/bun.lock b/npm/bun.lock index 80fba13313a37..86a700b0c84dc 100644 --- a/npm/bun.lock +++ b/npm/bun.lock @@ -3,7 +3,7 @@ "workspaces": { "": { "dependencies": { - "@types/bun": "^1.2.16", + "@types/bun": "^1.2.17", "@types/node": "^24.0.3", "tsdown": "^0.12.8", "typescript": "^5.8.3", @@ -73,7 +73,7 @@ "@tybys/wasm-util": ["@tybys/wasm-util@0.9.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw=="], - "@types/bun": ["@types/bun@1.2.16", "", { "dependencies": { "bun-types": "1.2.16" } }, "sha512-1aCZJ/6nSiViw339RsaNhkNoEloLaPzZhxMOYEa7OzRzO41IGg5n/7I43/ZIAW/c+Q6cT12Vf7fOZOoVIzb5BQ=="], + "@types/bun": ["@types/bun@1.2.17", "", { "dependencies": { "bun-types": "1.2.17" } }, "sha512-l/BYs/JYt+cXA/0+wUhulYJB6a6p//GTPiJ7nV+QHa8iiId4HZmnu/3J/SowP5g0rTiERY2kfGKXEK5Ehltx4Q=="], "@types/node": ["@types/node@24.0.3", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg=="], @@ -83,7 +83,7 @@ "birpc": ["birpc@2.4.0", "", {}, "sha512-5IdNxTyhXHv2UlgnPHQ0h+5ypVmkrYHzL8QT+DwFZ//2N/oNV8Ch+BCRmTJ3x6/z9Axo/cXYBc9eprsUVK/Jsg=="], - "bun-types": ["bun-types@1.2.16", "", { "dependencies": { "@types/node": "*" } }, "sha512-ciXLrHV4PXax9vHvUrkvun9VPVGOVwbbbBF/Ev1cXz12lyEZMoJpIJABOfPcN9gDJRaiKF9MVbSygLg4NXu3/A=="], + "bun-types": ["bun-types@1.2.17", "", { "dependencies": { "@types/node": "*" } }, "sha512-ElC7ItwT3SCQwYZDYoAH+q6KT4Fxjl8DtZ6qDulUFBmXA8YB4xo+l54J9ZJN+k2pphfn9vk7kfubeSd5QfTVJQ=="], "cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="], diff --git a/npm/bunfig.toml b/npm/bunfig.toml index dfda1726e2063..8046725851e92 100644 --- a/npm/bunfig.toml +++ b/npm/bunfig.toml @@ -3,6 +3,10 @@ telemetry = false run.bun = true bun.run = true -logLevel = "debug" +[install] +auto = "auto" +[install.scopes] "@foundry-rs" = { token = "$NPM_TOKEN", url = "https://registry.npmjs.org" } + +logLevel = "debug" diff --git a/npm/package.json b/npm/package.json index 8c250da9050e8..55ef0a9d2aae4 100644 --- a/npm/package.json +++ b/npm/package.json @@ -2,13 +2,13 @@ "private": true, "version": "0.0.2", "scripts": { - "check": "bun x @biomejs/biome check . --fix --unsafe --indent-style=space --semicolons=as-needed --trailing-commas=none --bracket-spacing=true --javascript-formatter-quote-style=single" + "build": "tsdown --config='tsdown.config.ts'" }, "dependencies": { - "@types/bun": "^1.2.16", - "@types/node": "^24.0.3", "tsdown": "^0.12.8", - "typescript": "^5.8.3" + "typescript": "^5.8.3", + "@types/bun": "^1.2.17", + "@types/node": "^24.0.3" }, "license": "MIT OR Apache-2.0" } diff --git a/npm/scripts/prepublish.ts b/npm/scripts/prepublish.ts index 9c9fc7ce522a6..da644429a83d0 100644 --- a/npm/scripts/prepublish.ts +++ b/npm/scripts/prepublish.ts @@ -1,9 +1,9 @@ #!/usr/bin/env bun +import * as Bun from 'bun' import * as NodeFS from 'node:fs' import * as NodePath from 'node:path' import * as NodeUtil from 'node:util' -import * as Bun from 'bun' import { colors } from '../src/utilities.ts' const nonGeneratedArtifacts = ['package.json', 'README.md'] @@ -21,7 +21,7 @@ const archMap = { aarch64: 'arm64' } as const -main().catch((error) => { +main().catch(error => { console.error(colors.red, error) process.exit(1) }) @@ -29,8 +29,7 @@ main().catch((error) => { async function main() { const platform = Bun.env.PLATFORM_NAME as keyof typeof platformMap const arch = Bun.env.ARCH as keyof typeof archMap - const profile = - Bun.env.NODE_ENV === 'production' ? 'release' : Bun.env.PROFILE || 'release' + const profile = Bun.env.NODE_ENV === 'production' ? 'release' : Bun.env.PROFILE || 'release' if (!platform) throw new Error('PLATFORM_NAME environment variable is not set') @@ -69,8 +68,8 @@ async function main() { recursive: true }) directoryItems - .filter((item) => !nonGeneratedArtifacts.includes(item.name)) - .forEach((item) => + .filter(item => !nonGeneratedArtifacts.includes(item.name)) + .forEach(item => NodeFS.rmSync(NodePath.join(packagePath, item.name), { recursive: true, force: true @@ -80,9 +79,8 @@ async function main() { console.info(colors.green, 'Cleaned up package directory', colors.reset) // Use the forge_bin_path from GitHub Actions if available, otherwise construct it - const forgeBinPath = - values['forge-bin-path'] || - (values.target + const forgeBinPath = values['forge-bin-path'] + || (values.target ? `../target/${values.target}/${profile}/forge` : `../target/${values.arch}/${profile}/forge`) @@ -93,10 +91,11 @@ async function main() { .nothrow() .quiet() - if (buildScripts.exitCode !== 0) + if (buildScripts.exitCode !== 0) { throw new Error( `Failed to build scripts: ${buildScripts.stderr.toString()}` ) + } console.info(colors.green, buildScripts.stdout.toString(), colors.reset) diff --git a/npm/scripts/publish.ts b/npm/scripts/publish.ts index 488a01db531ec..f02d2c723e701 100644 --- a/npm/scripts/publish.ts +++ b/npm/scripts/publish.ts @@ -1,7 +1,7 @@ #!/usr/bin/env bun +import * as Bun from 'bun' import * as NodeFS from 'node:fs' import * as NodePath from 'node:path' -import * as Bun from 'bun' import { colors } from '../src/utilities.ts' /** @@ -11,7 +11,7 @@ import { colors } from '../src/utilities.ts' * - auto-bump versions in `optionalDependencies`, */ -main().catch((error) => { +main().catch(error => { console.error(error) process.exit(1) }) @@ -69,11 +69,11 @@ async function main() { } console.info(colors.green, 'Packed file:', packedFile) - const publishPackage = - await Bun.$`bun publish --access='public' --verbose --registry='https://registry.npmjs.org' ./${packedFile}` - .cwd(packagePath) - .quiet() - .nothrow() + const publishPackage = await Bun + .$`bun publish --access='public' --verbose --registry='https://registry.npmjs.org' ./${packedFile}` + .cwd(packagePath) + .quiet() + .nothrow() console.info(publishPackage.stdout.toString()) console.info(publishPackage.stderr.toString()) if (publishPackage.exitCode !== 0) diff --git a/npm/src/const.ts b/npm/src/const.ts index a1bcbd92e2bc7..2ea534c79a94d 100644 --- a/npm/src/const.ts +++ b/npm/src/const.ts @@ -1,7 +1,7 @@ +import packageJSON from '#package.json' with { type: 'json' } import * as NodeFS from 'node:fs' import * as NodePath from 'node:path' import type * as Process from 'node:process' -import packageJSON from '#package.json' with { type: 'json' } export const BINARY_DISTRIBUTION_VERSION = packageJSON.version diff --git a/npm/src/forge.ts b/npm/src/forge.ts index cd2838ea35add..5edc813117105 100644 --- a/npm/src/forge.ts +++ b/npm/src/forge.ts @@ -62,11 +62,11 @@ function main() { windowsHide: false }) - child.on('close', (code) => { + child.on('close', code => { Process.exit(code) }) - child.on('error', (error) => { + child.on('error', error => { console.error('Error executing forge:', error.message) Process.exit(1) }) diff --git a/npm/src/install.ts b/npm/src/install.ts index e42619388f2f1..95375ad0d8847 100644 --- a/npm/src/install.ts +++ b/npm/src/install.ts @@ -1,9 +1,9 @@ +import { colors } from '#utilities.ts' import * as NodeFS from 'node:fs' import * as NodeHttps from 'node:https' import * as NodePath from 'node:path' import * as Process from 'node:process' import * as NodeZlib from 'node:zlib' -import { colors } from '#utilities.ts' import { type Architecture, type ArchitecturePlatform, @@ -13,31 +13,30 @@ import { type Platform } from './const.ts' -const platformSpecificPackage = - BINARY_DISTRIBUTION_PACKAGES[ - `${Process.platform as Platform}-${Process.arch as Architecture}` as ArchitecturePlatform - ] +const platformSpecificPackage = BINARY_DISTRIBUTION_PACKAGES[ + `${Process.platform as Platform}-${Process.arch as Architecture}` as ArchitecturePlatform +] const fallbackBinaryPath = NodePath.join(import.meta.dirname, BINARY_NAME) function makeRequest(url: string): Promise { return new Promise((resolve, reject) => { - NodeHttps.get(url, (response) => { + NodeHttps.get(url, response => { if ( - response?.statusCode && - response.statusCode >= 200 && - response.statusCode < 300 + response?.statusCode + && response.statusCode >= 200 + && response.statusCode < 300 ) { const chunks: Buffer[] = [] - response.on('data', (chunk) => chunks.push(chunk)) + response.on('data', chunk => chunks.push(chunk)) response.on('end', () => { resolve(Buffer.concat(chunks)) }) } else if ( - response?.statusCode && - response.statusCode >= 300 && - response.statusCode < 400 && - response.headers.location + response?.statusCode + && response.statusCode >= 300 + && response.statusCode < 400 + && response.headers.location ) { // Follow redirects makeRequest(response.headers.location).then(resolve, reject) @@ -48,7 +47,7 @@ function makeRequest(url: string): Promise { ) ) } - }).on('error', (error) => { + }).on('error', error => { reject(error) }) }) @@ -84,7 +83,8 @@ function extractFileFromTarball( } async function downloadBinaryFromNpm() { - const url = `https://registry.npmjs.org/${platformSpecificPackage.name}/-/${platformSpecificPackage.path}-${BINARY_DISTRIBUTION_VERSION}.tgz` + const url = + `https://registry.npmjs.org/${platformSpecificPackage.name}/-/${platformSpecificPackage.path}-${BINARY_DISTRIBUTION_VERSION}.tgz` console.info( colors.green, 'Downloading binary from:\n', diff --git a/npm/tsconfig.json b/npm/tsconfig.json index eef11206b16f8..e07678b8ccefa 100644 --- a/npm/tsconfig.json +++ b/npm/tsconfig.json @@ -6,7 +6,9 @@ "noEmit": true, "allowJs": true, "checkJs": true, - "lib": ["ESNext"], + "lib": [ + "ESNext" + ], "target": "ESNext", "module": "ESNext", "skipLibCheck": true, @@ -26,13 +28,32 @@ "noFallthroughCasesInSwitch": true, "allowSyntheticDefaultImports": true, "forceConsistentCasingInFileNames": true, - "types": ["node", "bun"], + "types": [ + "bun", + "node" + ], "paths": { - "#*": ["./src/*"], - "#package.json": ["./package.json"] + "#*": [ + "./src/*" + ], + "#package.json": [ + "./package.json" + ] } }, - "exclude": ["dist", "**/_/**", "node_modules"], - "include": ["src/**/*", "bin/**/*", "scripts/**/*"], - "files": ["env.d.ts", "tsdown.config.ts", "package.json"] + "exclude": [ + "dist", + "**/_/**", + "node_modules" + ], + "include": [ + "src/**/*", + "bin/**/*", + "scripts/**/*" + ], + "files": [ + "env.d.ts", + "package.json", + "tsdown.config.ts" + ] } diff --git a/npm/tsdown.config.ts b/npm/tsdown.config.ts index 08e43d97b4376..dcbd005b1a091 100644 --- a/npm/tsdown.config.ts +++ b/npm/tsdown.config.ts @@ -2,9 +2,7 @@ import * as NodeFS from 'node:fs' import * as NodePath from 'node:path' import { defineConfig, type UserConfig } from 'tsdown' -/** - * this makes it so that the bin automatically runs if bun, deno, or node is installed - */ +/* this makes it so that the bin automatically runs if bun, deno, or node is installed */ const shebang = /* sh */ `#!/bin/sh //bin/true; (command -v bun && bun $0) || (command -v deno && deno --allow-all $0) || (command -v node && node $0) || exit 1 @@ -24,8 +22,8 @@ const config = { if (!packagePath) return NodeFS.readdirSync(packagePath, { withFileTypes: true }) - .filter((item) => !['package.json', 'README.md'].includes(item.name)) - .forEach((item) => + .filter(item => !['package.json', 'README.md'].includes(item.name)) + .forEach(item => NodeFS.rmSync(NodePath.join(packagePath, item.name), { recursive: true, force: true From e492757cc7cba8c543510b49c941462e7e1d86aa Mon Sep 17 00:00:00 2001 From: o-az Date: Sun, 22 Jun 2025 04:16:21 -0700 Subject: [PATCH 6/8] chore: cleanup comment --- npm/scripts/publish.ts | 7 ------- 1 file changed, 7 deletions(-) diff --git a/npm/scripts/publish.ts b/npm/scripts/publish.ts index f02d2c723e701..dda214fb1c829 100644 --- a/npm/scripts/publish.ts +++ b/npm/scripts/publish.ts @@ -4,13 +4,6 @@ import * as NodeFS from 'node:fs' import * as NodePath from 'node:path' import { colors } from '../src/utilities.ts' -/** - * TODO: - * - handle publishing `@foundry-rs/forge` - * - auto-bump own version, - * - auto-bump versions in `optionalDependencies`, - */ - main().catch(error => { console.error(error) process.exit(1) From bfc6003eddd5fc55faa6561b0d8e650b605b7993 Mon Sep 17 00:00:00 2001 From: o-az Date: Tue, 15 Jul 2025 21:26:46 -0700 Subject: [PATCH 7/8] chore: sync versions --- .github/workflows/release.yml | 14 ++-- .../forge-darwin-arm64/package.json | 8 +-- npm/@foundry-rs/forge-darwin-x64/package.json | 5 +- .../forge-linux-arm64/package.json | 8 +-- npm/@foundry-rs/forge-linux-x64/package.json | 5 +- npm/@foundry-rs/forge-win32-x64/package.json | 5 +- npm/@foundry-rs/forge/package.json | 10 ++- npm/bun.lock | 68 +++++++++++-------- npm/package.json | 14 ++-- npm/tsconfig.json | 3 + 10 files changed, 82 insertions(+), 58 deletions(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index fc2b2e4313e42..a448bb8dabff0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -274,9 +274,9 @@ jobs: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} with: - scope: '@foundry-rs' - bun-version: 'latest' - registry-url: 'https://registry.npmjs.org' + scope: "@foundry-rs" + bun-version: "latest" + registry-url: "https://registry.npmjs.org" - name: Install dependencies working-directory: ./npm @@ -296,7 +296,7 @@ jobs: bun run ./scripts/prepublish.ts \ --arch=${{ env.ARCH }} \ --forge-bin-path=${{ env.FORGE_BIN_PATH }} - + - name: Publish npm package shell: bash working-directory: ./npm @@ -309,7 +309,7 @@ jobs: run: |- bun run ./scripts/publis.ts ./@foundry-rs/forge-${{ env.PLATFORM }}-${{ env.ARCH }} - # bump version, bump version of each item in `optionalDependencies` + # bump version of each item in `optionalDependencies` - name: Finally, publish @foundry-rs/forge shell: bash working-directory: ./npm @@ -322,7 +322,7 @@ jobs: BUMP_VERSION: "TODO: Find this" run: |- cd @foundr-rs/forge - + export NPM_TOKEN=${{ secrets.NPM_TOKEN }} export BUN_AUTH_TOKEN=${{ secrets.NPM_TOKEN }} export NPM_CONFIG_TOKEN=${{ secrets.NPM_TOKEN }} @@ -335,7 +335,7 @@ jobs: --git-tag-version=false \ --commit-hook=false \ --allow-same-version - + bun pm pack bun publish \ diff --git a/npm/@foundry-rs/forge-darwin-arm64/package.json b/npm/@foundry-rs/forge-darwin-arm64/package.json index b1e839de0ac29..c370cb481b553 100644 --- a/npm/@foundry-rs/forge-darwin-arm64/package.json +++ b/npm/@foundry-rs/forge-darwin-arm64/package.json @@ -1,11 +1,11 @@ { "name": "@unfoundry/forge-darwin-arm64", - "version": "0.0.3", + "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework (macOS arm64)", "bin": { - "forge": "./bin/forge" + "forge": "./bin/forge.mjs" }, "os": [ "darwin" @@ -14,9 +14,7 @@ "arm64" ], "files": [ - "bin", - "README.md", - "package.json" + "bin" ], "engines": { "node": ">=20" diff --git a/npm/@foundry-rs/forge-darwin-x64/package.json b/npm/@foundry-rs/forge-darwin-x64/package.json index 7c76aec4c03dc..0f9047edb7900 100644 --- a/npm/@foundry-rs/forge-darwin-x64/package.json +++ b/npm/@foundry-rs/forge-darwin-x64/package.json @@ -1,6 +1,6 @@ { "name": "@unfoundry/forge-darwin-x64", - "version": "0.0.2", + "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework (macOS x64)", @@ -13,6 +13,9 @@ "cpu": [ "x64" ], + "files": [ + "bin" + ], "engines": { "node": ">=20" }, diff --git a/npm/@foundry-rs/forge-linux-arm64/package.json b/npm/@foundry-rs/forge-linux-arm64/package.json index bbc7c8391d231..dac8a905da5f9 100644 --- a/npm/@foundry-rs/forge-linux-arm64/package.json +++ b/npm/@foundry-rs/forge-linux-arm64/package.json @@ -1,11 +1,11 @@ { "name": "@unfoundry/forge-linux-arm64", - "version": "0.0.3", + "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework (Linux arm64)", "bin": { - "forge": "./bin/forge" + "forge": "./bin/forge.mjs" }, "os": [ "linux" @@ -14,9 +14,7 @@ "arm64" ], "files": [ - "bin", - "README.md", - "package.json" + "bin" ], "engines": { "node": ">=20" diff --git a/npm/@foundry-rs/forge-linux-x64/package.json b/npm/@foundry-rs/forge-linux-x64/package.json index 464adb4e6bd2d..a50811c7d9f97 100644 --- a/npm/@foundry-rs/forge-linux-x64/package.json +++ b/npm/@foundry-rs/forge-linux-x64/package.json @@ -1,6 +1,6 @@ { "name": "@unfoundry/forge-linux-x64", - "version": "0.0.2", + "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework (Linux x64)", @@ -13,6 +13,9 @@ "cpu": [ "x64" ], + "files": [ + "bin" + ], "engines": { "node": ">=20" }, diff --git a/npm/@foundry-rs/forge-win32-x64/package.json b/npm/@foundry-rs/forge-win32-x64/package.json index 317dacd6a8b57..d70654a489507 100644 --- a/npm/@foundry-rs/forge-win32-x64/package.json +++ b/npm/@foundry-rs/forge-win32-x64/package.json @@ -1,6 +1,6 @@ { "name": "@unfoundry/forge-win32-x64", - "version": "0.0.2", + "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework (Windows x64)", @@ -13,6 +13,9 @@ "cpu": [ "x64" ], + "files": [ + "bin" + ], "engines": { "node": ">=20" }, diff --git a/npm/@foundry-rs/forge/package.json b/npm/@foundry-rs/forge/package.json index fd6cb9c8a92cf..80ede7777146c 100644 --- a/npm/@foundry-rs/forge/package.json +++ b/npm/@foundry-rs/forge/package.json @@ -1,6 +1,6 @@ { "name": "@unfoundry/forge", - "version": "0.0.3", + "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework", @@ -14,16 +14,14 @@ }, "files": [ "bin", - "dist", - "package.json", - "README.md" + "dist" ], "scripts": { "postinstall": "node ./dist/install.mjs" }, "optionalDependencies": { - "@unfoundry/forge-darwin-arm64": "0.0.3", - "@unfoundry/forge-linux-arm64": "0.0.3" + "@unfoundry/forge-darwin-arm64": "1.2.3", + "@unfoundry/forge-linux-arm64": "1.2.3" }, "publishConfig": { "access": "public", diff --git a/npm/bun.lock b/npm/bun.lock index 86a700b0c84dc..4f2a3d96cfb82 100644 --- a/npm/bun.lock +++ b/npm/bun.lock @@ -3,9 +3,9 @@ "workspaces": { "": { "dependencies": { - "@types/bun": "^1.2.17", - "@types/node": "^24.0.3", - "tsdown": "^0.12.8", + "@types/bun": "^1.2.18", + "@types/node": "^24.0.14", + "tsdown": "^0.12.9", "typescript": "^5.8.3", }, }, @@ -17,9 +17,9 @@ "@babel/helper-validator-identifier": ["@babel/helper-validator-identifier@7.27.1", "", {}, "sha512-D2hP9eA+Sqx1kBZgzxZh0y1trbuU+JoDkiEwqhQ36nodYqJwyEIhPSdMNd7lOm/4io72luTPWH20Yda0xOuUow=="], - "@babel/parser": ["@babel/parser@7.27.5", "", { "dependencies": { "@babel/types": "^7.27.3" }, "bin": "./bin/babel-parser.js" }, "sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg=="], + "@babel/parser": ["@babel/parser@7.28.0", "", { "dependencies": { "@babel/types": "^7.28.0" }, "bin": "./bin/babel-parser.js" }, "sha512-jVZGvOxOuNSsuQuLRTh13nU0AogFlw32w/MT+LV6D3sP5WdbW61E77RnkbaO2dUvmPAYrBDJXGn5gGS6tH4j8g=="], - "@babel/types": ["@babel/types@7.27.6", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q=="], + "@babel/types": ["@babel/types@7.28.0", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-jYnje+JyZG5YThjHiF28oT4SIZLnYOcSBb6+SDaFIyzDVSkXQmQQYclJ2R+YxcdmK0AX6x1E5OQNtuh3jHDrUg=="], "@emnapi/core": ["@emnapi/core@1.4.3", "", { "dependencies": { "@emnapi/wasi-threads": "1.0.2", "tslib": "^2.4.0" } }, "sha512-4m62DuCE07lw01soJwPiBGC0nAww0Q+RY70VZ+n49yDIO13yyinhbWCeNnaob0lakDtWQzSdtNWzJeOJt2ma+g=="], @@ -39,43 +39,45 @@ "@napi-rs/wasm-runtime": ["@napi-rs/wasm-runtime@0.2.11", "", { "dependencies": { "@emnapi/core": "^1.4.3", "@emnapi/runtime": "^1.4.3", "@tybys/wasm-util": "^0.9.0" } }, "sha512-9DPkXtvHydrcOsopiYpUgPHpmj0HWZKMUnL2dZqpvC42lsratuBG06V5ipyno0fUek5VlFsNQ+AcFATSrJXgMA=="], - "@oxc-project/runtime": ["@oxc-project/runtime@0.72.3", "", {}, "sha512-FtOS+0v7rZcnjXzYTTqv1vu/KDptD1UztFgoZkYBGe/6TcNFm+SP/jQoLvzau1SPir95WgDOBOUm2Gmsm+bQag=="], + "@oxc-project/runtime": ["@oxc-project/runtime@0.71.0", "", {}, "sha512-QwoF5WUXIGFQ+hSxWEib4U/aeLoiDN9JlP18MnBgx9LLPRDfn1iICtcow7Jgey6HLH4XFceWXQD5WBJ39dyJcw=="], - "@oxc-project/types": ["@oxc-project/types@0.72.3", "", {}, "sha512-CfAC4wrmMkUoISpQkFAIfMVvlPfQV3xg7ZlcqPXPOIMQhdKIId44G8W0mCPgtpWdFFAyJ+SFtiM+9vbyCkoVng=="], + "@oxc-project/types": ["@oxc-project/types@0.71.0", "", {}, "sha512-5CwQ4MI+P4MQbjLWXgNurA+igGwu/opNetIE13LBs9+V93R64MLvDKOOLZIXSzEfovU3Zef3q3GjPnMTgJTn2w=="], "@quansync/fs": ["@quansync/fs@0.1.3", "", { "dependencies": { "quansync": "^0.2.10" } }, "sha512-G0OnZbMWEs5LhDyqy2UL17vGhSVHkQIfVojMtEWVenvj0V5S84VBgy86kJIuNsGDp2p7sTKlpSIpBUWdC35OKg=="], - "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.0.0-beta.15", "", { "os": "darwin", "cpu": "arm64" }, "sha512-YInZppDBLp5DadbJZGc7xBfDrMCSj3P6i2rPlvOCMlvjBQxJi2kX8Jquh+LufsWUiHD3JsvvH5EuUUc/tF5fkA=="], + "@rolldown/binding-darwin-arm64": ["@rolldown/binding-darwin-arm64@1.0.0-beta.9-commit.d91dfb5", "", { "os": "darwin", "cpu": "arm64" }, "sha512-Mp0/gqiPdepHjjVm7e0yL1acWvI0rJVVFQEADSezvAjon9sjQ7CEg9JnXICD4B1YrPmN9qV/e7cQZCp87tTV4w=="], - "@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.0.0-beta.15", "", { "os": "darwin", "cpu": "x64" }, "sha512-Zwv8KHU/XdVwLseHG6slJ0FAFklPpiO0sjNvhrcMp1X3F2ajPzUdIO8Cnu3KLmX1GWVSvu6q1kyARLUqPvlh7Q=="], + "@rolldown/binding-darwin-x64": ["@rolldown/binding-darwin-x64@1.0.0-beta.9-commit.d91dfb5", "", { "os": "darwin", "cpu": "x64" }, "sha512-40re4rMNrsi57oavRzIOpRGmg3QRlW6Ea8Q3znaqgOuJuKVrrm2bIQInTfkZJG7a4/5YMX7T951d0+toGLTdCA=="], - "@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.0.0-beta.15", "", { "os": "freebsd", "cpu": "x64" }, "sha512-FwhNC23Fz9ldHW1/rX4QaoQe4kyOybCgxO9eglue3cbb3ol28KWpQl3xJfvXc9+O6PDefAs4oFBCbtTh8seiUw=="], + "@rolldown/binding-freebsd-x64": ["@rolldown/binding-freebsd-x64@1.0.0-beta.9-commit.d91dfb5", "", { "os": "freebsd", "cpu": "x64" }, "sha512-8BDM939bbMariZupiHp3OmP5N+LXPT4mULA0hZjDaq970PCxv4krZOSMG+HkWUUwmuQROtV+/00xw39EO0P+8g=="], - "@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.15", "", { "os": "linux", "cpu": "arm" }, "sha512-E60pNliWl4j7EFEVX2oeJZ5VzR+NG6fvDJoqfqRfCl8wtKIf9E1WPWVQIrT+zkz+Fhc5op8g7h25z6rtxsDy9g=="], + "@rolldown/binding-linux-arm-gnueabihf": ["@rolldown/binding-linux-arm-gnueabihf@1.0.0-beta.9-commit.d91dfb5", "", { "os": "linux", "cpu": "arm" }, "sha512-sntsPaPgrECpBB/+2xrQzVUt0r493TMPI+4kWRMhvMsmrxOqH1Ep5lM0Wua/ZdbfZNwm1aVa5pcESQfNfM4Fhw=="], - "@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.0.0-beta.15", "", { "os": "linux", "cpu": "arm64" }, "sha512-d+qo1LZ/a3EcQW08byIIZy0PBthmG/7dr69pifmNIet/azWR8jbceQaRFFczVc/NwVV3fsZDCmjG8mgJzsNEAg=="], + "@rolldown/binding-linux-arm64-gnu": ["@rolldown/binding-linux-arm64-gnu@1.0.0-beta.9-commit.d91dfb5", "", { "os": "linux", "cpu": "arm64" }, "sha512-5clBW/I+er9F2uM1OFjJFWX86y7Lcy0M+NqsN4s3o07W+8467Zk8oQa4B45vdaXoNUF/yqIAgKkA/OEdQDxZqA=="], - "@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.0.0-beta.15", "", { "os": "linux", "cpu": "arm64" }, "sha512-P1hbtYF+5ftJI2Ergs4iARbAk6Xd6WnTQb3CF9kjN3KfJTsRYdo5/fvU8Lz/gzhZVvkCXXH3NxDd9308UBO8cw=="], + "@rolldown/binding-linux-arm64-musl": ["@rolldown/binding-linux-arm64-musl@1.0.0-beta.9-commit.d91dfb5", "", { "os": "linux", "cpu": "arm64" }, "sha512-wv+rnAfQDk9p/CheX8/Kmqk2o1WaFa4xhWI9gOyDMk/ljvOX0u0ubeM8nI1Qfox7Tnh71eV5AjzSePXUhFOyOg=="], - "@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.0.0-beta.15", "", { "os": "linux", "cpu": "x64" }, "sha512-Q9NM9uMFN9cjcrW7gd9U087B5WzkEj9dQQHOgoENZSy+vYJYS2fINCIG40ljEVC6jXmVrJgUhJKv7elRZM1nng=="], + "@rolldown/binding-linux-x64-gnu": ["@rolldown/binding-linux-x64-gnu@1.0.0-beta.9-commit.d91dfb5", "", { "os": "linux", "cpu": "x64" }, "sha512-gxD0/xhU4Py47IH3bKZbWtvB99tMkUPGPJFRfSc5UB9Osoje0l0j1PPbxpUtXIELurYCqwLBKXIMTQGifox1BQ=="], - "@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.0.0-beta.15", "", { "os": "linux", "cpu": "x64" }, "sha512-1tuCWuR8gx9PyW2pxAx2ZqnOnwhoY6NWBVP6ZmrjCKQ16NclYc61BzegFXSdugCy8w1QpBPT8/c5oh2W4E5aeA=="], + "@rolldown/binding-linux-x64-musl": ["@rolldown/binding-linux-x64-musl@1.0.0-beta.9-commit.d91dfb5", "", { "os": "linux", "cpu": "x64" }, "sha512-HotuVe3XUjDwqqEMbm3o3IRkP9gdm8raY/btd/6KE3JGLF/cv4+3ff1l6nOhAZI8wulWDPEXPtE7v+HQEaTXnA=="], - "@rolldown/binding-wasm32-wasi": ["@rolldown/binding-wasm32-wasi@1.0.0-beta.15", "", { "dependencies": { "@napi-rs/wasm-runtime": "^0.2.10" }, "cpu": "none" }, "sha512-zrSeYrpTf27hRxMLh0qpkCoWgzRKG8EyR6o09Zt9xkqCOeE5tEK/S3jV1Nii9WSqVCWFRA+OYxKzMNoykV590g=="], + "@rolldown/binding-wasm32-wasi": ["@rolldown/binding-wasm32-wasi@1.0.0-beta.9-commit.d91dfb5", "", { "dependencies": { "@napi-rs/wasm-runtime": "^0.2.4" }, "cpu": "none" }, "sha512-8Cx+ucbd8n2dIr21FqBh6rUvTVL0uTgEtKR7l+MUZ5BgY4dFh1e4mPVX8oqmoYwOxBiXrsD2JIOCz4AyKLKxWA=="], - "@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.0.0-beta.15", "", { "os": "win32", "cpu": "arm64" }, "sha512-diR41DsMUnkvb9hvW8vuIrA0WaacAN1fu6lPseXhYifAOZN6kvxEwKn7Xib8i0zjdrYErLv7GNSQ48W+xiNOnA=="], + "@rolldown/binding-win32-arm64-msvc": ["@rolldown/binding-win32-arm64-msvc@1.0.0-beta.9-commit.d91dfb5", "", { "os": "win32", "cpu": "arm64" }, "sha512-Vhq5vikrVDxAa75fxsyqj0c0Y/uti/TwshXI71Xb8IeUQJOBnmLUsn5dgYf5ljpYYkNa0z9BPAvUDIDMmyDi+w=="], - "@rolldown/binding-win32-ia32-msvc": ["@rolldown/binding-win32-ia32-msvc@1.0.0-beta.15", "", { "os": "win32", "cpu": "ia32" }, "sha512-oCbbcDC3Lk8YgdxCkG23UqVrvXVvllIBgmmwq89bhq5okPP899OI/P+oTTDsUTbhljzNq1pH8a+mR6YBxAFfvw=="], + "@rolldown/binding-win32-ia32-msvc": ["@rolldown/binding-win32-ia32-msvc@1.0.0-beta.9-commit.d91dfb5", "", { "os": "win32", "cpu": "ia32" }, "sha512-lN7RIg9Iugn08zP2aZN9y/MIdG8iOOCE93M1UrFlrxMTqPf8X+fDzmR/OKhTSd1A2pYNipZHjyTcb5H8kyQSow=="], - "@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.0.0-beta.15", "", { "os": "win32", "cpu": "x64" }, "sha512-w5hVsOv3dzKo10wAXizmnDvUo1yasn/ps+mcn9H9TiJ/GeRE5/15Y6hG6vUQYRQNLVbYRHUt2qG0MyOoasPcHg=="], + "@rolldown/binding-win32-x64-msvc": ["@rolldown/binding-win32-x64-msvc@1.0.0-beta.9-commit.d91dfb5", "", { "os": "win32", "cpu": "x64" }, "sha512-7/7cLIn48Y+EpQ4CePvf8reFl63F15yPUlg4ZAhl+RXJIfydkdak1WD8Ir3AwAO+bJBXzrfNL+XQbxm0mcQZmw=="], - "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-beta.15", "", {}, "sha512-lvFtIbidq5EqyAAeiVk41ZNjGRgUoGRBIuqpe1VRJ7R8Av7TLAgGWAwGlHNhO7MFkl7MNRX350CsTtIWIYkNIQ=="], + "@rolldown/pluginutils": ["@rolldown/pluginutils@1.0.0-beta.9-commit.d91dfb5", "", {}, "sha512-8sExkWRK+zVybw3+2/kBkYBFeLnEUWz1fT7BLHplpzmtqkOfTbAQ9gkt4pzwGIIZmg4Qn5US5ACjUBenrhezwQ=="], "@tybys/wasm-util": ["@tybys/wasm-util@0.9.0", "", { "dependencies": { "tslib": "^2.4.0" } }, "sha512-6+7nlbMVX/PVDCwaIQ8nTOPveOcFLSt8GcXdx8hD0bt39uWxYT88uXzqTd4fTvqta7oeUJqudepapKNt2DYJFw=="], - "@types/bun": ["@types/bun@1.2.17", "", { "dependencies": { "bun-types": "1.2.17" } }, "sha512-l/BYs/JYt+cXA/0+wUhulYJB6a6p//GTPiJ7nV+QHa8iiId4HZmnu/3J/SowP5g0rTiERY2kfGKXEK5Ehltx4Q=="], + "@types/bun": ["@types/bun@1.2.18", "", { "dependencies": { "bun-types": "1.2.18" } }, "sha512-Xf6RaWVheyemaThV0kUfaAUvCNokFr+bH8Jxp+tTZfx7dAPA8z9ePnP9S9+Vspzuxxx9JRAXhnyccRj3GyCMdQ=="], - "@types/node": ["@types/node@24.0.3", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-R4I/kzCYAdRLzfiCabn9hxWfbuHS573x+r0dJMkkzThEa7pbrcDWK+9zu3e7aBOouf+rQAciqPFMnxwr0aWgKg=="], + "@types/node": ["@types/node@24.0.14", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-4zXMWD91vBLGRtHK3YbIoFMia+1nqEz72coM42C5ETjnNCa/heoj7NT1G67iAfOqMmcfhuCZ4uNpyz8EjlAejw=="], + + "@types/react": ["@types/react@19.1.8", "", { "dependencies": { "csstype": "^3.0.2" } }, "sha512-AwAfQ2Wa5bCx9WP8nZL2uMZWod7J7/JSplxbTmBQ5ms6QpqNYm672H0Vu9ZVKVngQ+ii4R/byguVEUZQyeg44g=="], "ansis": ["ansis@4.1.0", "", {}, "sha512-BGcItUBWSMRgOCe+SVZJ+S7yTRG0eGt9cXAHev72yuGcY23hnLA7Bky5L/xLyPINoSN95geovfBkqoTlNZYa7w=="], @@ -83,12 +85,14 @@ "birpc": ["birpc@2.4.0", "", {}, "sha512-5IdNxTyhXHv2UlgnPHQ0h+5ypVmkrYHzL8QT+DwFZ//2N/oNV8Ch+BCRmTJ3x6/z9Axo/cXYBc9eprsUVK/Jsg=="], - "bun-types": ["bun-types@1.2.17", "", { "dependencies": { "@types/node": "*" } }, "sha512-ElC7ItwT3SCQwYZDYoAH+q6KT4Fxjl8DtZ6qDulUFBmXA8YB4xo+l54J9ZJN+k2pphfn9vk7kfubeSd5QfTVJQ=="], + "bun-types": ["bun-types@1.2.18", "", { "dependencies": { "@types/node": "*" }, "peerDependencies": { "@types/react": "^19" } }, "sha512-04+Eha5NP7Z0A9YgDAzMk5PHR16ZuLVa83b26kH5+cp1qZW4F6FmAURngE7INf4tKOvCE69vYvDEwoNl1tGiWw=="], "cac": ["cac@6.7.14", "", {}, "sha512-b6Ilus+c3RrdDk+JhLKUAQfzzgLEPy6wcXqS7f/xe1EETvsDP6GORG7SFuOs6cID5YkqchW/LXZbX5bc8j7ZcQ=="], "chokidar": ["chokidar@4.0.3", "", { "dependencies": { "readdirp": "^4.0.1" } }, "sha512-Qgzu8kfBvo+cA4962jnP1KkS6Dop5NS6g7R5LFYJr4b8Ub94PPQXUksCw9PvXoeXPRRddRNC5C1JQUR2SMGtnA=="], + "csstype": ["csstype@3.1.3", "", {}, "sha512-M1uQkMl8rQK/szD0LNhtqxIPLpimGm8sOBwU7lLnCpSbTyY3yeU1Vc7l4KT5zT4s/yOxHH5O7tIuuLOCnLADRw=="], + "debug": ["debug@4.4.1", "", { "dependencies": { "ms": "^2.1.3" } }, "sha512-KcKCqiftBJcZr++7ykoDIEwSa3XWowTfNPo92BYxjXiyYEVrUQh2aLyhxBCwww+heortUFxEJYcRzosstTEBYQ=="], "defu": ["defu@6.1.4", "", {}, "sha512-mEQCMmwJu317oSz8CwdIOdwf3xMif1ttiM8LTufzc3g6kR+9Pe236twL8j3IYT1F7GfRgGcW6MWxzZjLIkuHIg=="], @@ -97,7 +101,7 @@ "dts-resolver": ["dts-resolver@2.1.1", "", { "peerDependencies": { "oxc-resolver": ">=11.0.0" }, "optionalPeers": ["oxc-resolver"] }, "sha512-3BiGFhB6mj5Kv+W2vdJseQUYW+SKVzAFJL6YNP6ursbrwy1fXHRotfHi3xLNxe4wZl/K8qbAFeCDjZLjzqxxRw=="], - "empathic": ["empathic@1.1.0", "", {}, "sha512-rsPft6CK3eHtrlp9Y5ALBb+hfK+DWnA4WFebbazxjWyx8vSm3rZeoM3z9irsjcqO3PYRzlfv27XIB4tz2DV7RA=="], + "empathic": ["empathic@2.0.0", "", {}, "sha512-i6UzDscO/XfAcNYD75CfICkmfLedpyPDdozrLMmQc5ORaQcdMoc21OnlEylMIqI7U8eniKrPMxxtj8k0vhmJhA=="], "fdir": ["fdir@6.4.6", "", { "peerDependencies": { "picomatch": "^3 || ^4" }, "optionalPeers": ["picomatch"] }, "sha512-hiFoqpyZcfNm1yc4u8oWCf9A2c4D3QjCrks3zmoVKVxpQRzmPNar1hUJcBG2RQHvEVGDN+Jm81ZheVLAQMK6+w=="], @@ -121,9 +125,9 @@ "resolve-pkg-maps": ["resolve-pkg-maps@1.0.0", "", {}, "sha512-seS2Tj26TBVOC2NIc2rOe2y2ZO7efxITtLZcGSOnHHNOQ7CkiUBfw0Iw2ck6xkIhPwLhKNLS8BO+hEpngQlqzw=="], - "rolldown": ["rolldown@1.0.0-beta.15", "", { "dependencies": { "@oxc-project/runtime": "=0.72.3", "@oxc-project/types": "=0.72.3", "@rolldown/pluginutils": "1.0.0-beta.15", "ansis": "^4.0.0" }, "optionalDependencies": { "@rolldown/binding-darwin-arm64": "1.0.0-beta.15", "@rolldown/binding-darwin-x64": "1.0.0-beta.15", "@rolldown/binding-freebsd-x64": "1.0.0-beta.15", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.15", "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.15", "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.15", "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.15", "@rolldown/binding-linux-x64-musl": "1.0.0-beta.15", "@rolldown/binding-wasm32-wasi": "1.0.0-beta.15", "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.15", "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.15", "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.15" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-ep788NsIGl0W5gT+99hBrSGe4Hdhcwc55PqM3O0mR5H0C4ZpGpDGgu9YzTJ8a6mFDLnFnc/LYC+Dszb7oWK/dg=="], + "rolldown": ["rolldown@1.0.0-beta.9-commit.d91dfb5", "", { "dependencies": { "@oxc-project/runtime": "0.71.0", "@oxc-project/types": "0.71.0", "@rolldown/pluginutils": "1.0.0-beta.9-commit.d91dfb5", "ansis": "^4.0.0" }, "optionalDependencies": { "@rolldown/binding-darwin-arm64": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-darwin-x64": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-freebsd-x64": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-linux-arm-gnueabihf": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-linux-arm64-gnu": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-linux-arm64-musl": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-linux-x64-gnu": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-linux-x64-musl": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-wasm32-wasi": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-win32-arm64-msvc": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-win32-ia32-msvc": "1.0.0-beta.9-commit.d91dfb5", "@rolldown/binding-win32-x64-msvc": "1.0.0-beta.9-commit.d91dfb5" }, "bin": { "rolldown": "bin/cli.mjs" } }, "sha512-FHkj6gGEiEgmAXQchglofvUUdwj2Oiw603Rs+zgFAnn9Cb7T7z3fiaEc0DbN3ja4wYkW6sF2rzMEtC1V4BGx/g=="], - "rolldown-plugin-dts": ["rolldown-plugin-dts@0.13.11", "", { "dependencies": { "@babel/generator": "^7.27.5", "@babel/parser": "^7.27.5", "@babel/types": "^7.27.6", "ast-kit": "^2.1.0", "birpc": "^2.3.0", "debug": "^4.4.1", "dts-resolver": "^2.1.1", "get-tsconfig": "^4.10.1" }, "peerDependencies": { "@typescript/native-preview": ">=7.0.0-dev.20250601.1", "rolldown": "^1.0.0-beta.9", "typescript": "^5.0.0", "vue-tsc": "~2.2.0" }, "optionalPeers": ["@typescript/native-preview", "typescript", "vue-tsc"] }, "sha512-1TScN31JImk8xcq9kdm52z2W8/QX3zeDpEjFkyZmK+GcD0u8QqSWWARBsCEdfS99NyI6D9NIbUpsABXlcpZhig=="], + "rolldown-plugin-dts": ["rolldown-plugin-dts@0.13.13", "", { "dependencies": { "@babel/generator": "^7.27.5", "@babel/parser": "^7.27.7", "@babel/types": "^7.27.7", "ast-kit": "^2.1.0", "birpc": "^2.4.0", "debug": "^4.4.1", "dts-resolver": "^2.1.1", "get-tsconfig": "^4.10.1" }, "peerDependencies": { "@typescript/native-preview": ">=7.0.0-dev.20250601.1", "rolldown": "^1.0.0-beta.9", "typescript": "^5.0.0", "vue-tsc": "~2.2.0" }, "optionalPeers": ["@typescript/native-preview", "typescript", "vue-tsc"] }, "sha512-Nchx9nQoa4IpfQ/BJzodKMvtJ3H3dT322siAJSp3uvQJ+Pi1qgEjOp7hSQwGSQRhaC5gC+9hparbWEH5oiAL9Q=="], "semver": ["semver@7.7.2", "", { "bin": { "semver": "bin/semver.js" } }, "sha512-RF0Fw+rO5AMf9MAyaRXI4AV0Ulj5lMHqVxxdSgiVbixSCXoEmmX/jk0CuJw4+3SqroYO9VoUh+HcuJivvtJemA=="], @@ -131,7 +135,7 @@ "tinyglobby": ["tinyglobby@0.2.14", "", { "dependencies": { "fdir": "^6.4.4", "picomatch": "^4.0.2" } }, "sha512-tX5e7OM1HnYr2+a2C/4V0htOcSQcoSTH9KgJnVvNm5zm/cyEWKJ7j7YutsH9CxMdtOkkLFy2AHrMci9IM8IPZQ=="], - "tsdown": ["tsdown@0.12.8", "", { "dependencies": { "ansis": "^4.1.0", "cac": "^6.7.14", "chokidar": "^4.0.3", "debug": "^4.4.1", "diff": "^8.0.2", "empathic": "^1.1.0", "hookable": "^5.5.3", "rolldown": "1.0.0-beta.15", "rolldown-plugin-dts": "^0.13.11", "semver": "^7.7.2", "tinyexec": "^1.0.1", "tinyglobby": "^0.2.14", "unconfig": "^7.3.2" }, "peerDependencies": { "@arethetypeswrong/core": "^0.18.1", "publint": "^0.3.0", "typescript": "^5.0.0", "unplugin-lightningcss": "^0.4.0", "unplugin-unused": "^0.5.0" }, "optionalPeers": ["@arethetypeswrong/core", "publint", "typescript", "unplugin-lightningcss", "unplugin-unused"], "bin": { "tsdown": "dist/run.mjs" } }, "sha512-niHeVcFCNjvVZYVGTeoM4BF+/DWxP8pFH2tUs71sEKYdcKtJIbkSdEmtxByaRZeMgwVbVgPb8nv9i9okVwFLAA=="], + "tsdown": ["tsdown@0.12.9", "", { "dependencies": { "ansis": "^4.1.0", "cac": "^6.7.14", "chokidar": "^4.0.3", "debug": "^4.4.1", "diff": "^8.0.2", "empathic": "^2.0.0", "hookable": "^5.5.3", "rolldown": "^1.0.0-beta.19", "rolldown-plugin-dts": "^0.13.12", "semver": "^7.7.2", "tinyexec": "^1.0.1", "tinyglobby": "^0.2.14", "unconfig": "^7.3.2" }, "peerDependencies": { "@arethetypeswrong/core": "^0.18.1", "publint": "^0.3.0", "typescript": "^5.0.0", "unplugin-lightningcss": "^0.4.0", "unplugin-unused": "^0.5.0" }, "optionalPeers": ["@arethetypeswrong/core", "publint", "typescript", "unplugin-lightningcss", "unplugin-unused"], "bin": { "tsdown": "dist/run.mjs" } }, "sha512-MfrXm9PIlT3saovtWKf/gCJJ/NQCdE0SiREkdNC+9Qy6UHhdeDPxnkFaBD7xttVUmgp0yUHtGirpoLB+OVLuLA=="], "tslib": ["tslib@2.8.1", "", {}, "sha512-oJFu94HQb+KVduSUQL7wnpmqnfmLsOA/nAh6b6EH0wCEoK0/mPeXU6c3wKDV83MkOuHPRHtSXKKU99IBazS/2w=="], @@ -140,5 +144,15 @@ "unconfig": ["unconfig@7.3.2", "", { "dependencies": { "@quansync/fs": "^0.1.1", "defu": "^6.1.4", "jiti": "^2.4.2", "quansync": "^0.2.8" } }, "sha512-nqG5NNL2wFVGZ0NA/aCFw0oJ2pxSf1lwg4Z5ill8wd7K4KX/rQbHlwbh+bjctXL5Ly1xtzHenHGOK0b+lG6JVg=="], "undici-types": ["undici-types@7.8.0", "", {}, "sha512-9UJ2xGDvQ43tYyVMpuHlsgApydB8ZKfVYTsLDhXkFL/6gfkp+U8xTGdh8pMJv1SpZna0zxG1DwsKZsreLbXBxw=="], + + "@babel/generator/@babel/parser": ["@babel/parser@7.27.5", "", { "dependencies": { "@babel/types": "^7.27.3" }, "bin": "./bin/babel-parser.js" }, "sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg=="], + + "@babel/generator/@babel/types": ["@babel/types@7.27.6", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q=="], + + "ast-kit/@babel/parser": ["@babel/parser@7.27.5", "", { "dependencies": { "@babel/types": "^7.27.3" }, "bin": "./bin/babel-parser.js" }, "sha512-OsQd175SxWkGlzbny8J3K8TnnDD0N3lrIUtB92xwyRpzaenGZhxDvxN/JgU00U3CDZNj9tPuDJ5H0WS4Nt3vKg=="], + + "bun-types/@types/node": ["@types/node@24.0.12", "", { "dependencies": { "undici-types": "~7.8.0" } }, "sha512-LtOrbvDf5ndC9Xi+4QZjVL0woFymF/xSTKZKPgrrl7H7XoeDvnD+E2IclKVDyaK9UM756W/3BXqSU+JEHopA9g=="], + + "ast-kit/@babel/parser/@babel/types": ["@babel/types@7.27.6", "", { "dependencies": { "@babel/helper-string-parser": "^7.27.1", "@babel/helper-validator-identifier": "^7.27.1" } }, "sha512-ETyHEk2VHHvl9b9jZP5IHPavHYk57EhanlRRuae9XCpb/j5bDCbPPMOBfCWhnl/7EDJz0jEMCi/RhccCE8r1+Q=="], } } diff --git a/npm/package.json b/npm/package.json index 55ef0a9d2aae4..c12e066fa10bb 100644 --- a/npm/package.json +++ b/npm/package.json @@ -1,14 +1,18 @@ { "private": true, - "version": "0.0.2", + "version": "0.0.1", + "imports": { + "#package.json": "./package.json" + }, "scripts": { "build": "tsdown --config='tsdown.config.ts'" }, "dependencies": { - "tsdown": "^0.12.8", + "tsdown": "^0.12.9", "typescript": "^5.8.3", - "@types/bun": "^1.2.17", - "@types/node": "^24.0.3" + "@types/bun": "^1.2.18", + "@types/node": "^24.0.14" }, - "license": "MIT OR Apache-2.0" + "license": "MIT OR Apache-2.0", + "$schema": "https://json.schemastore.org/package.json" } diff --git a/npm/tsconfig.json b/npm/tsconfig.json index e07678b8ccefa..2cb91060eda23 100644 --- a/npm/tsconfig.json +++ b/npm/tsconfig.json @@ -36,6 +36,9 @@ "#*": [ "./src/*" ], + // "#Cargo.toml": [ + // "../Cargo.toml" + // ], "#package.json": [ "./package.json" ] From 3547f7668148e6026974b75cf770a82c226d0aba Mon Sep 17 00:00:00 2001 From: o-az Date: Wed, 16 Jul 2025 23:15:16 -0700 Subject: [PATCH 8/8] chore: done testing so replace @unfoundry --- .github/workflows/release.yml | 52 +++++-------------- .../forge-darwin-arm64/package.json | 6 +-- npm/@foundry-rs/forge-darwin-x64/package.json | 4 +- .../forge-linux-arm64/package.json | 4 +- npm/@foundry-rs/forge-linux-x64/package.json | 4 +- npm/@foundry-rs/forge-win32-x64/package.json | 4 +- npm/@foundry-rs/forge/package.json | 7 +-- npm/package.json | 3 +- npm/scripts/clean.sh | 6 +++ npm/scripts/publish.ts | 2 + npm/src/const.ts | 10 ++-- npm/tsdown.config.ts | 3 +- 12 files changed, 45 insertions(+), 60 deletions(-) create mode 100644 npm/scripts/clean.sh diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index a448bb8dabff0..4bf6848731366 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -268,64 +268,32 @@ jobs: ${{ steps.artifacts.outputs.file_name }} ${{ steps.man.outputs.foundry_man }} - - name: Setup Bun - uses: oven-sh/setup-bun@main + - name: Setup Bun (npm) + uses: oven-sh/setup-bun@735343b667d3e6f658f44d0eca948eb6282f2b76 env: NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} with: - scope: "@foundry-rs" bun-version: "latest" + scope: "@foundry-rs" registry-url: "https://registry.npmjs.org" - name: Install dependencies working-directory: ./npm run: bun install --frozen-lockfile - - name: Build ./npm scripts - working-directory: ./npm - run: bun x tsdown --config tsdown.config.ts - - - name: Prepublish npm package - working-directory: ./npm - shell: bash - env: - ARCH: ${{ matrix.arch }} - FORGE_BIN_PATH: ${{ steps.binaries.outputs.FORGE_BIN_PATH }} - run: |- - bun run ./scripts/prepublish.ts \ - --arch=${{ env.ARCH }} \ - --forge-bin-path=${{ env.FORGE_BIN_PATH }} - - - name: Publish npm package - shell: bash - working-directory: ./npm - env: - ARCH: ${{ matrix.arch }} - PLATFORM: ${{ matrix.platform }} - NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} - run: |- - bun run ./scripts/publis.ts ./@foundry-rs/forge-${{ env.PLATFORM }}-${{ env.ARCH }} - # bump version of each item in `optionalDependencies` - - name: Finally, publish @foundry-rs/forge + - name: Publish @foundry-rs/forge (npm) shell: bash working-directory: ./npm env: ARCH: ${{ matrix.arch }} PLATFORM: ${{ matrix.platform }} NPM_TOKEN: ${{ secrets.NPM_TOKEN }} - BUN_AUTH_TOKEN: ${{ secrets.NPM_TOKEN }} - NPM_CONFIG_TOKEN: ${{ secrets.NPM_TOKEN }} BUMP_VERSION: "TODO: Find this" run: |- cd @foundr-rs/forge export NPM_TOKEN=${{ secrets.NPM_TOKEN }} - export BUN_AUTH_TOKEN=${{ secrets.NPM_TOKEN }} - export NPM_CONFIG_TOKEN=${{ secrets.NPM_TOKEN }} npm version ${{ env.BUMP_VERSION }} \ --message 'new forge release' \ @@ -335,9 +303,7 @@ jobs: --git-tag-version=false \ --commit-hook=false \ --allow-same-version - bun pm pack - bun publish \ --access='public' \ --production \ @@ -345,6 +311,16 @@ jobs: --registry='https://registry.npmjs.org' \ ./foundry-rs-forge-${{ env.BUMP_VERSION }}.tgz + - name: Publish Package (npm) + shell: bash + working-directory: ./npm + env: + ARCH: ${{ matrix.arch }} + PLATFORM: ${{ matrix.platform }} + NPM_TOKEN: ${{ secrets.NPM_TOKEN }} + run: |- + bun run ./scripts/publis.ts ./@foundry-rs/forge-${{ env.PLATFORM }}-${{ env.ARCH }} + cleanup: name: Release cleanup runs-on: ubuntu-latest diff --git a/npm/@foundry-rs/forge-darwin-arm64/package.json b/npm/@foundry-rs/forge-darwin-arm64/package.json index c370cb481b553..1d4010a109a9b 100644 --- a/npm/@foundry-rs/forge-darwin-arm64/package.json +++ b/npm/@foundry-rs/forge-darwin-arm64/package.json @@ -1,11 +1,11 @@ { - "name": "@unfoundry/forge-darwin-arm64", - "version": "1.2.3", + "name": "@foundry-rs/forge-darwin-arm64", + "version": "0.0.5", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework (macOS arm64)", "bin": { - "forge": "./bin/forge.mjs" + "forge": "./bin/forge" }, "os": [ "darwin" diff --git a/npm/@foundry-rs/forge-darwin-x64/package.json b/npm/@foundry-rs/forge-darwin-x64/package.json index 0f9047edb7900..0204b729805ac 100644 --- a/npm/@foundry-rs/forge-darwin-x64/package.json +++ b/npm/@foundry-rs/forge-darwin-x64/package.json @@ -1,11 +1,11 @@ { - "name": "@unfoundry/forge-darwin-x64", + "name": "@foundry-rs/forge-darwin-x64", "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework (macOS x64)", "bin": { - "forge": "./bin/forge.mjs" + "forge": "./bin/forge" }, "os": [ "darwin" diff --git a/npm/@foundry-rs/forge-linux-arm64/package.json b/npm/@foundry-rs/forge-linux-arm64/package.json index dac8a905da5f9..69d6ad050fd9e 100644 --- a/npm/@foundry-rs/forge-linux-arm64/package.json +++ b/npm/@foundry-rs/forge-linux-arm64/package.json @@ -1,11 +1,11 @@ { - "name": "@unfoundry/forge-linux-arm64", + "name": "@foundry-rs/forge-linux-arm64", "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework (Linux arm64)", "bin": { - "forge": "./bin/forge.mjs" + "forge": "./bin/forge" }, "os": [ "linux" diff --git a/npm/@foundry-rs/forge-linux-x64/package.json b/npm/@foundry-rs/forge-linux-x64/package.json index a50811c7d9f97..f877774da6d02 100644 --- a/npm/@foundry-rs/forge-linux-x64/package.json +++ b/npm/@foundry-rs/forge-linux-x64/package.json @@ -1,11 +1,11 @@ { - "name": "@unfoundry/forge-linux-x64", + "name": "@foundry-rs/forge-linux-x64", "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework (Linux x64)", "bin": { - "forge": "./bin/forge.mjs" + "forge": "./bin/forge" }, "os": [ "linux" diff --git a/npm/@foundry-rs/forge-win32-x64/package.json b/npm/@foundry-rs/forge-win32-x64/package.json index d70654a489507..4c16ad4acc048 100644 --- a/npm/@foundry-rs/forge-win32-x64/package.json +++ b/npm/@foundry-rs/forge-win32-x64/package.json @@ -1,11 +1,11 @@ { - "name": "@unfoundry/forge-win32-x64", + "name": "@foundry-rs/forge-win32-x64", "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework (Windows x64)", "bin": { - "forge": "./bin/forge.mjs" + "forge": "./bin/forge" }, "os": [ "win32" diff --git a/npm/@foundry-rs/forge/package.json b/npm/@foundry-rs/forge/package.json index 80ede7777146c..a540dee4cfc58 100644 --- a/npm/@foundry-rs/forge/package.json +++ b/npm/@foundry-rs/forge/package.json @@ -1,11 +1,12 @@ { - "name": "@unfoundry/forge", + "name": "@foundry-rs/forge", "version": "1.2.3", "type": "module", "homepage": "https://getfoundry.sh", "description": "Fast and flexible Ethereum testing framework", "main": "./bin/forge.mjs", "module": "./bin/forge.mjs", + "exports": "./bin/forge.mjs", "engines": { "node": ">=20" }, @@ -20,8 +21,8 @@ "postinstall": "node ./dist/install.mjs" }, "optionalDependencies": { - "@unfoundry/forge-darwin-arm64": "1.2.3", - "@unfoundry/forge-linux-arm64": "1.2.3" + "@foundry-rs/forge-darwin-arm64": "1.2.3", + "@foundry-rs/forge-linux-arm64": "1.2.3" }, "publishConfig": { "access": "public", diff --git a/npm/package.json b/npm/package.json index c12e066fa10bb..9803b1c10ae2f 100644 --- a/npm/package.json +++ b/npm/package.json @@ -5,7 +5,8 @@ "#package.json": "./package.json" }, "scripts": { - "build": "tsdown --config='tsdown.config.ts'" + "build": "tsdown --config='tsdown.config.ts'", + "prepublishOnly": "bun build && bun run ./scripts/prepublish.ts" }, "dependencies": { "tsdown": "^0.12.9", diff --git a/npm/scripts/clean.sh b/npm/scripts/clean.sh new file mode 100644 index 0000000000000..47c4ecdf5fc19 --- /dev/null +++ b/npm/scripts/clean.sh @@ -0,0 +1,6 @@ +#!/usr/bin/env bash + +set -eou pipefail + +rm -rf bin dist +rm -rf ./@foundry-rs/forge/bin @foundry-rs/forge/dist \ No newline at end of file diff --git a/npm/scripts/publish.ts b/npm/scripts/publish.ts index dda214fb1c829..56d2568f9cfc4 100644 --- a/npm/scripts/publish.ts +++ b/npm/scripts/publish.ts @@ -4,6 +4,8 @@ import * as NodeFS from 'node:fs' import * as NodePath from 'node:path' import { colors } from '../src/utilities.ts' +// TODO: bump version of each item in `optionalDependencies` + main().catch(error => { console.error(error) process.exit(1) diff --git a/npm/src/const.ts b/npm/src/const.ts index 2ea534c79a94d..4ffb4bf257106 100644 --- a/npm/src/const.ts +++ b/npm/src/const.ts @@ -35,7 +35,7 @@ export const BINARY_DISTRIBUTION_PACKAGES = { reference: referenceMap['darwin-x64'], path: 'forge-darwin-x64', get name() { - return `@unfoundry/${this.path}` + return `@foundry-rs/${this.path}` }, get version() { return JSON.parse( @@ -56,7 +56,7 @@ export const BINARY_DISTRIBUTION_PACKAGES = { reference: referenceMap['darwin-arm64'], path: 'forge-darwin-arm64', get name() { - return `@unfoundry/${this.path}` + return `@foundry-rs/${this.path}` }, get version() { return JSON.parse( @@ -77,7 +77,7 @@ export const BINARY_DISTRIBUTION_PACKAGES = { reference: referenceMap['linux-x64'], path: 'forge-linux-x64', get name() { - return `@unfoundry/${this.path}` + return `@foundry-rs/${this.path}` }, get version() { return JSON.parse( @@ -98,7 +98,7 @@ export const BINARY_DISTRIBUTION_PACKAGES = { reference: referenceMap['linux-arm64'], path: 'forge-linux-arm64', get name() { - return `@unfoundry/${this.path}` + return `@foundry-rs/${this.path}` }, get version() { return JSON.parse( @@ -119,7 +119,7 @@ export const BINARY_DISTRIBUTION_PACKAGES = { reference: referenceMap['win32-x64'], path: 'forge-win32-x64', get name() { - return `@unfoundry/${this.path}` + return `@foundry-rs/${this.path}` }, get version() { return JSON.parse( diff --git a/npm/tsdown.config.ts b/npm/tsdown.config.ts index dcbd005b1a091..3127b9b1aedc9 100644 --- a/npm/tsdown.config.ts +++ b/npm/tsdown.config.ts @@ -3,8 +3,7 @@ import * as NodePath from 'node:path' import { defineConfig, type UserConfig } from 'tsdown' /* this makes it so that the bin automatically runs if bun, deno, or node is installed */ -const shebang = /* sh */ `#!/bin/sh -//bin/true; (command -v bun && bun $0) || (command -v deno && deno --allow-all $0) || (command -v node && node $0) || exit 1 +const shebang = /* sh */ `#!/usr/bin/env node `