From b4b8bc0b684b1d5dba3112d63b271babb75b6757 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Thu, 22 Feb 2024 10:48:52 +0100 Subject: [PATCH] Build packages with `tsup` (#2120) This changes all packages to be built with `tsup`, instead of SWC. `tsup` uses `esbuild` under the hood, so performance should be comparable. More context here: MetaMask/utils#144. --- .github/workflows/build-lint-test.yml | 90 +- .../plugins/local/plugin-workspaces-filter.js | 184 ++- constraints.pro | 50 +- package.json | 13 +- packages/create-snap/package.json | 31 +- packages/create-snap/tsconfig.json | 2 +- packages/create-snap/tsup.config.ts | 14 + packages/examples/package.json | 1 - .../packages/bip32/snap.manifest.json | 2 +- .../packages/bip44/snap.manifest.json | 2 +- .../packages/browserify/snap.manifest.json | 2 +- .../packages/cronjobs/snap.manifest.json | 2 +- .../packages/dialogs/snap.manifest.json | 2 +- .../packages/ethers-js/snap.manifest.json | 2 +- .../packages/get-entropy/snap.manifest.json | 2 +- .../packages/home-page/snap.manifest.json | 2 +- .../packages/images/snap.manifest.json | 2 +- .../interactive-ui/snap.manifest.json | 2 +- .../packages/invoke-snap/package.json | 1 - .../packages/core-signer/snap.manifest.json | 2 +- .../lifecycle-hooks/snap.manifest.json | 2 +- .../packages/manage-state/snap.manifest.json | 2 +- .../packages/notifications/snap.manifest.json | 2 +- .../signature-insights/snap.manifest.json | 2 +- .../transaction-insights/snap.manifest.json | 2 +- packages/snaps-browserify-plugin/package.json | 25 +- .../snaps-browserify-plugin/tsconfig.json | 2 +- .../snaps-browserify-plugin/tsup.config.ts | 14 + packages/snaps-cli/package.json | 34 +- packages/snaps-cli/scripts/updateReadme.js | 2 +- packages/snaps-cli/src/test-utils/webpack.ts | 10 + .../webpack/__snapshots__/config.test.ts.snap | 14 +- packages/snaps-cli/src/webpack/config.test.ts | 4 +- packages/snaps-cli/src/webpack/config.ts | 5 +- .../src/webpack/loaders/function.test.ts | 38 + .../snaps-cli/src/webpack/loaders/function.ts | 61 + .../snaps-cli/src/webpack/loaders/index.ts | 3 + packages/snaps-cli/src/webpack/utils.test.ts | 8 +- packages/snaps-cli/src/webpack/utils.ts | 23 +- packages/snaps-cli/tsconfig.json | 8 +- packages/snaps-cli/tsup.config.ts | 15 + packages/snaps-controllers/package.json | 27 +- packages/snaps-controllers/tsconfig.json | 2 +- packages/snaps-controllers/tsup.config.ts | 14 + .../lavamoat/browserify/iframe/policy.json | 48 +- .../browserify/node-process/policy.json | 64 +- .../browserify/node-thread/policy.json | 64 +- .../lavamoat/browserify/webview/policy.json | 48 +- .../browserify/worker-executor/policy.json | 48 +- .../browserify/worker-pool/policy.json | 48 +- .../lavamoat/build-system/policy.json | 128 +-- .../snaps-execution-environments/package.json | 35 +- .../tsconfig.json | 8 +- .../tsup.config.ts | 15 + packages/snaps-jest/jest-preset.js | 2 +- packages/snaps-jest/package.json | 28 +- packages/snaps-jest/tsconfig.json | 2 +- packages/snaps-jest/tsup.config.ts | 14 + packages/snaps-rollup-plugin/package.json | 27 +- packages/snaps-rollup-plugin/tsconfig.json | 2 +- packages/snaps-rollup-plugin/tsup.config.ts | 14 + packages/snaps-rpc-methods/package.json | 27 +- packages/snaps-rpc-methods/tsconfig.json | 2 +- packages/snaps-rpc-methods/tsup.config.ts | 14 + packages/snaps-sdk/package.json | 27 +- packages/snaps-sdk/tsconfig.json | 2 +- packages/snaps-sdk/tsup.config.ts | 14 + packages/snaps-simulator/package.json | 31 +- packages/snaps-simulator/tsconfig.json | 2 +- packages/snaps-simulator/tsup.config.ts | 14 + packages/snaps-utils/package.json | 48 +- packages/snaps-utils/tsconfig.json | 2 +- packages/snaps-utils/tsup.config.ts | 15 + packages/snaps-webpack-plugin/package.json | 27 +- packages/snaps-webpack-plugin/tsconfig.json | 2 +- packages/snaps-webpack-plugin/tsup.config.ts | 15 + packages/test-snaps/package.json | 1 - tsconfig.json | 2 +- tsup.config.ts | 43 + yarn.lock | 1006 +++++++++++------ 80 files changed, 1660 insertions(+), 956 deletions(-) create mode 100644 packages/create-snap/tsup.config.ts create mode 100644 packages/snaps-browserify-plugin/tsup.config.ts create mode 100644 packages/snaps-cli/src/webpack/loaders/function.test.ts create mode 100644 packages/snaps-cli/src/webpack/loaders/function.ts create mode 100644 packages/snaps-cli/src/webpack/loaders/index.ts create mode 100644 packages/snaps-cli/tsup.config.ts create mode 100644 packages/snaps-controllers/tsup.config.ts create mode 100644 packages/snaps-execution-environments/tsup.config.ts create mode 100644 packages/snaps-jest/tsup.config.ts create mode 100644 packages/snaps-rollup-plugin/tsup.config.ts create mode 100644 packages/snaps-rpc-methods/tsup.config.ts create mode 100644 packages/snaps-sdk/tsup.config.ts create mode 100644 packages/snaps-simulator/tsup.config.ts create mode 100644 packages/snaps-utils/tsup.config.ts create mode 100644 packages/snaps-webpack-plugin/tsup.config.ts create mode 100644 tsup.config.ts diff --git a/.github/workflows/build-lint-test.yml b/.github/workflows/build-lint-test.yml index 88bdd3d76c..7fba40cb93 100644 --- a/.github/workflows/build-lint-test.yml +++ b/.github/workflows/build-lint-test.yml @@ -37,43 +37,14 @@ jobs: id: workspace-package-names run: | { - echo "test-workspace-package-names=$(yarn workspaces filter --include 'packages/*' --exclude 'packages/examples' --json)" - echo "e2e-workspace-package-names=$(yarn workspaces filter --include 'packages/examples/packages/**' --exclude 'packages/examples/packages/invoke-snap' --json)" - echo "all-workspace-package-names=$(yarn workspaces filter --include '{.,packages/**}' --exclude 'packages/snaps-cli/test/snap' --json)" + echo "test-workspace-package-names=$(yarn workspaces filter list --include 'packages/*' --exclude 'packages/examples' --json)" + echo "e2e-workspace-package-names=$(yarn workspaces filter list --include 'packages/examples/packages/**' --exclude 'packages/examples/packages/invoke-snap' --json)" + echo "all-workspace-package-names=$(yarn workspaces filter list --include '{.,packages/**}' --exclude 'packages/snaps-cli/test/snap' --json)" } >> "$GITHUB_OUTPUT" shell: bash - build-source: - name: Build source - runs-on: ubuntu-latest - needs: prepare - steps: - - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: yarn - - run: yarn --immutable --immutable-cache - - name: Build source - run: yarn build:source - - name: Cache build files - uses: actions/cache@v3 - with: - path: | - packages/*/dist/esm - packages/*/dist/cjs - key: build-source-${{ runner.os }}-${{ github.sha }} - - name: Require clean working directory - shell: bash - run: | - if ! git diff --exit-code; then - echo "Working tree dirty at end of job" - exit 1 - fi - - build-types: - name: Build types + build: + name: Build runs-on: ubuntu-latest needs: prepare steps: @@ -84,14 +55,16 @@ jobs: node-version-file: '.nvmrc' cache: yarn - run: yarn --immutable --immutable-cache + - name: Build + run: yarn build:ci - name: Build types run: yarn build:types - name: Cache build files uses: actions/cache@v3 with: path: | - packages/*/dist/types - key: build-types-${{ runner.os }}-${{ github.sha }} + packages/*/dist + key: build-source-${{ runner.os }}-${{ github.sha }} - name: Require clean working directory shell: bash run: | @@ -100,38 +73,6 @@ jobs: exit 1 fi - post-build: - name: Post-build - runs-on: ubuntu-latest - needs: - - build-source - - build-types - steps: - - uses: actions/checkout@v3 - - name: Setup Node - uses: actions/setup-node@v3 - with: - node-version-file: '.nvmrc' - cache: yarn - - run: yarn --immutable --immutable-cache - - name: Restore build files - uses: actions/cache@v3 - with: - path: | - packages/*/dist/esm - packages/*/dist/cjs - key: build-source-${{ runner.os }}-${{ github.sha }} - fail-on-cache-miss: true - - name: Restore types files - uses: actions/cache@v3 - with: - path: | - packages/*/dist/types - key: build-types-${{ runner.os }}-${{ github.sha }} - fail-on-cache-miss: true - - name: Post-build - run: yarn build:post-tsc:ci - build-simulator: name: Build "@metamask/snaps-simulator" runs-on: ubuntu-latest @@ -318,8 +259,7 @@ jobs: runs-on: ubuntu-latest needs: - prepare - - build-source - - build-types + - build strategy: fail-fast: false matrix: @@ -343,17 +283,9 @@ jobs: uses: actions/cache@v3 with: path: | - packages/*/dist/esm - packages/*/dist/cjs + packages/*/dist key: build-source-${{ runner.os }}-${{ github.sha }} fail-on-cache-miss: true - - name: Restore types files - uses: actions/cache@v3 - with: - path: | - packages/*/dist/types - key: build-types-${{ runner.os }}-${{ github.sha }} - fail-on-cache-miss: true - run: yarn --immutable --immutable-cache - name: Build snap run: yarn workspace ${{ matrix.package-name }} run build diff --git a/.yarn/plugins/local/plugin-workspaces-filter.js b/.yarn/plugins/local/plugin-workspaces-filter.js index 378b09130f..38808392b8 100644 --- a/.yarn/plugins/local/plugin-workspaces-filter.js +++ b/.yarn/plugins/local/plugin-workspaces-filter.js @@ -6,8 +6,8 @@ module.exports = { const { Command, Option, UsageError } = require('clipanion'); const { isString, isBoolean } = require('typanion'); - class FilterCommand extends BaseCommand { - static paths = [['workspaces', 'filter']]; + class FilterListCommand extends BaseCommand { + static paths = [['workspaces', 'filter', 'list']]; static usage = Command.Usage({ description: 'Filter workspaces', @@ -18,11 +18,11 @@ module.exports = { examples: [ [ `List workspaces based on a glob pattern`, - `yarn workspaces filter --include "packages/*"`, + `yarn workspaces filter list --include "packages/*"`, ], [ 'Exclude workspaces based on a glob pattern', - `yarn workspaces filter --exclude "packages/*/foo"`, + `yarn workspaces filter list --exclude "packages/*/foo"`, ], ], }); @@ -42,6 +42,34 @@ module.exports = { validator: isBoolean, }); + /** + * List the names of the workspaces. If `--json` is set, the names will be + * printed as a JSON array. + * + * @param {Workspace[]} workspaces + * @param {Configuration} configuration + * @returns {Promise} + */ + async list(workspaces, configuration) { + const report = await StreamReport.start( + { + configuration, + json: this.json, + stdout: this.context.stdout, + }, + async (report) => { + for (const workspace of workspaces) { + report.reportInfo(null, workspace.relativeCwd); + } + + const result = workspaces.map((workspace) => workspace.manifest.raw.name); + report.reportJson(result); + }, + ); + + return report.exitCode(); + } + async execute() { // Note: We have to import `minimatch` here, because Yarn will always // load the plugin, even if the command is not used, and `minimatch` @@ -61,37 +89,137 @@ module.exports = { ); } - const report = await StreamReport.start( - { - configuration, - json: this.json, - stdout: this.context.stdout, - }, - async (report) => { - const filteredWorkspaces = workspaces.filter((workspace) => { - return ( - (!this.include || - minimatch(workspace.relativeCwd, this.include)) && - (!this.exclude || - !minimatch(workspace.relativeCwd, this.exclude)) - ); - }); - - for (const workspace of filteredWorkspaces) { - report.reportInfo(null, workspace.relativeCwd); - } + const filteredWorkspaces = workspaces.filter((workspace) => { + return ( + (!this.include || + minimatch(workspace.relativeCwd, this.include)) && + (!this.exclude || + !minimatch(workspace.relativeCwd, this.exclude)) + ); + }); - const result = filteredWorkspaces.map((workspace) => workspace.manifest.raw.name); - report.reportJson(result); - }, + return await this.list(filteredWorkspaces, configuration); + } + } + + class FilterRunCommand extends BaseCommand { + static paths = [['workspaces', 'filter']]; + + static usage = Command.Usage({ + description: 'Filter workspaces', + details: ` + This command will run a command in workspaces based on the given + criteria. It's like \`yarn workspaces foreach\` but on steroids. + `, + examples: [ + [ + `List workspaces based on a glob pattern`, + `yarn workspaces filter --include "packages/*" run build`, + ], + [ + 'Exclude workspaces based on a glob pattern', + `yarn workspaces filter --exclude "packages/*/foo" run build`, + ], + ], + }); + + commandName = Option.String({ + required: true, + description: `The name of the command to run`, + validator: isString, + }); + + args = Option.Proxy({ + required: false, + }); + + parallel = Option.Boolean(`--parallel`, { + default: false, + description: `Run the commands in parallel`, + validator: isBoolean, + }); + + topological = Option.Boolean(`--topological`, false, { + description: `Run the commands in topological order`, + validator: isBoolean, + }); + + include = Option.String('--include', { + description: `List workspaces based on a glob pattern`, + validator: isString, + }); + + exclude = Option.String('--exclude', { + description: `Exclude workspaces based on a glob pattern`, + validator: isString, + }); + + noPrivate = Option.Boolean(`--no-private`, false, { + description: `Exclude private workspaces`, + validator: isBoolean, + }); + + /** + * Run the given command on the workspaces. + * + * @param workspaces - The workspaces to run the command on. + * @param commandName - The name of the command to run. + * @param args - The arguments to pass to the command. + * @return {Promise} + */ + async run(workspaces, commandName, args) { + let extraArgs = []; + if (this.parallel) { + extraArgs.push('--parallel'); + } + + if (this.topological) { + extraArgs.push('--topological'); + extraArgs.push('--topological-dev'); + } + + const includes = workspaces.map((workspace) => workspace.manifest.name) + .flatMap(({ scope, name }) => ['--include', `@${scope}/${name}`]); + + await this.cli.run(['workspaces', 'foreach', '--verbose', ...includes, ...extraArgs, commandName, ...args], this.context); + } + + async execute() { + // Note: We have to import `minimatch` here, because Yarn will always + // load the plugin, even if the command is not used, and `minimatch` + // may not be installed. + const { minimatch } = await import('minimatch'); + + const configuration = await Configuration.find( + this.context.cwd, + this.context.plugins, ); + const { project } = await Project.find(configuration, this.context.cwd); + const { workspaces } = project; - return report.exitCode(); + if (!this.include && !this.exclude) { + throw new UsageError( + `This command requires at least one of --include or --exclude to be specified.`, + ); + } + + const filteredWorkspaces = workspaces.filter((workspace) => { + return ( + (!this.include || + minimatch(workspace.relativeCwd, this.include)) && + (!this.exclude || + !minimatch(workspace.relativeCwd, this.exclude)) + ); + }).filter((workspace) => { + return !this.noPrivate || !workspace.manifest.private; + }); + + return await this.run(filteredWorkspaces, this.commandName, this.args); } } return { - commands: [FilterCommand], + commands: [FilterListCommand, FilterRunCommand], }; }, }; diff --git a/constraints.pro b/constraints.pro index b5997c9bed..89891f0a5a 100644 --- a/constraints.pro +++ b/constraints.pro @@ -157,24 +157,70 @@ gen_enforced_field(WorkspaceCwd, 'types', './dist/types/index.d.ts') :- \+ is_example(WorkspaceCwd), \+ workspace_field(WorkspaceCwd, 'private', true), WorkspaceCwd \= '.'. +gen_enforced_field(WorkspaceCwd, 'exports["."].types', './dist/types/index.d.ts') :- + \+ is_example(WorkspaceCwd), + \+ workspace_field(WorkspaceCwd, 'private', true), + WorkspaceCwd \= '.'. % The entrypoint for the dependency must be `./dist/cjs/index.js`. -gen_enforced_field(WorkspaceCwd, 'main', './dist/cjs/index.js') :- +gen_enforced_field(WorkspaceCwd, 'main', './dist/index.js') :- + \+ is_example(WorkspaceCwd), + \+ workspace_field(WorkspaceCwd, 'private', true), + WorkspaceCwd \= '.'. +gen_enforced_field(WorkspaceCwd, 'exports["."].require', './dist/index.js') :- \+ is_example(WorkspaceCwd), \+ workspace_field(WorkspaceCwd, 'private', true), WorkspaceCwd \= '.'. % The module entrypoint for the dependency must be `./dist/esm/index.js`. -gen_enforced_field(WorkspaceCwd, 'module', './dist/esm/index.js') :- +gen_enforced_field(WorkspaceCwd, 'module', './dist/index.mjs') :- + \+ is_example(WorkspaceCwd), + \+ workspace_field(WorkspaceCwd, 'private', true), + WorkspaceCwd \= '.'. +gen_enforced_field(WorkspaceCwd, 'exports["."].import', './dist/index.mjs') :- + \+ is_example(WorkspaceCwd), + \+ workspace_field(WorkspaceCwd, 'private', true), + WorkspaceCwd \= '.'. + +% `package.json` must be exported. +gen_enforced_field(WorkspaceCwd, 'exports["./package.json"]', './package.json') :- + \+ is_example(WorkspaceCwd), + \+ workspace_field(WorkspaceCwd, 'private', true), + WorkspaceCwd \= '.'. + +% The list of files included in the package must only include files generated +% during the build step. +gen_enforced_field(WorkspaceCwd, 'files', ['dist']) :- + \+ is_example(WorkspaceCwd), + \+ workspace_field(WorkspaceCwd, 'private', true), + WorkspaceCwd \= '.', + WorkspaceCwd \= 'packages/snaps-jest'. +gen_enforced_field(WorkspaceCwd, 'files', ['dist', 'jest-preset.js']) :- + WorkspaceCwd = 'packages/snaps-jest'. + +% Dependencies must have a build script. +gen_enforced_field(WorkspaceCwd, 'scripts.build', 'tsup --clean && yarn build:types') :- + \+ is_example(WorkspaceCwd), + \+ workspace_field(WorkspaceCwd, 'private', true), + WorkspaceCwd \= '.', + WorkspaceCwd \= 'packages/snaps-simulator', + WorkspaceCwd \= 'packages/snaps-cli'. +gen_enforced_field(WorkspaceCwd, 'build:types', 'tsc --project tsconfig.build.json') :- \+ is_example(WorkspaceCwd), \+ workspace_field(WorkspaceCwd, 'private', true), WorkspaceCwd \= '.'. +gen_enforced_field(WorkspaceCwd, 'scripts.build:ci', 'tsup --clean') :- + \+ is_example(WorkspaceCwd), + \+ workspace_field(WorkspaceCwd, 'private', true), + WorkspaceCwd \= '.', + WorkspaceCwd \= 'packages/snaps-simulator'. % Dependencies must have preview scripts. gen_enforced_field(WorkspaceCwd, 'scripts.publish:preview', 'yarn npm publish --tag preview') :- \+ workspace_field(WorkspaceCwd, 'private', true), WorkspaceCwd \= '.'. +% Dependencies must have a "publishConfig" field. gen_enforced_field(WorkspaceCwd, 'publishConfig.access', 'public') :- \+ workspace_field(WorkspaceCwd, 'private', true), WorkspaceCwd \= '.'. diff --git a/package.json b/package.json index dfac6fbcfa..55ccec3fd5 100644 --- a/package.json +++ b/package.json @@ -10,7 +10,6 @@ "packages/*" ], "scripts": { - "setup": "yarn install", "postinstall": "simple-git-hooks", "lint:eslint": "eslint . --cache --ext js,jsx,ts,tsx", "lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn '**/*.json' '**/*.md' '!**/CHANGELOG.md' '**/*.yml' '**/*.html'", @@ -20,13 +19,12 @@ "lint": "yarn workspaces foreach --parallel run lint:eslint && yarn lint:misc --check && yarn lint:tsconfig && yarn constraints && yarn lint:dependencies", "lint:fix": "yarn workspaces foreach --parallel run lint:eslint --fix && yarn lint:misc --write && yarn lint:tsconfig && yarn constraints --fix", "lint:ci": "yarn lint:eslint && yarn lint:misc --check && yarn lint:tsconfig && yarn constraints && yarn lint:dependencies", - "build": "yarn build:source && yarn build:types && yarn build:post-tsc", + "build": "yarn build:source && yarn build:types", + "build:ci": "yarn workspaces filter --include \"packages/*\" --parallel --topological --no-private run build:ci", "build:clean": "yarn clean && yarn build", - "build:source": "yarn workspaces foreach --parallel --verbose run build:source", + "build:source": "yarn workspaces filter --parallel --topological --exclude \"{packages/examples,packages/examples/packages/invoke-snap}\" run build", "build:types": "tsc --build tsconfig.build.json", "build:examples": "yarn workspace @metamask/example-snaps build", - "build:post-tsc": "yarn workspaces foreach --parallel --topological --topological-dev --verbose run build:post-tsc", - "build:post-tsc:ci": "yarn workspaces foreach --parallel --topological --topological-dev --verbose --exclude root --exclude \"@metamask/snaps-simulator\" --exclude \"@metamask/snaps-execution-environments\" --exclude \"@metamask/snaps-jest\" --exclude \"@metamask/example-snaps\" --exclude \"@metamask/test-snaps\" run build:post-tsc", "clean": "yarn workspaces foreach --parallel --verbose run clean", "test": "yarn workspaces foreach --parallel --verbose run test", "test:browser": "yarn workspaces foreach --verbose run test:browser", @@ -75,7 +73,6 @@ "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/utils": "^8.3.0", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@types/jest": "^27.5.1", "@types/node": "18.14.2", @@ -103,6 +100,7 @@ "semver": "^7.5.4", "simple-git-hooks": "^2.7.0", "ts-node": "^10.9.1", + "tsup": "^8.0.1", "typescript": "~4.8.4" }, "engines": { @@ -118,7 +116,8 @@ "geckodriver": true, "ts-node>@swc/core": true, "@swc/core": true, - "favicons>sharp": true + "favicons>sharp": true, + "tsup>esbuild": true } }, "packageManager": "yarn@3.6.0" diff --git a/packages/create-snap/package.json b/packages/create-snap/package.json index 53b1aab63c..fab0b6732a 100644 --- a/packages/create-snap/package.json +++ b/packages/create-snap/package.json @@ -8,23 +8,25 @@ }, "license": "ISC", "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", "types": "./dist/types/index.d.ts", - "bin": "./dist/cjs/main.js", + "bin": "./dist/main.js", "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**" + "dist" ], "scripts": { - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:post-tsc": "yarn build:chmod", - "build:chmod": "chmod +x ./dist/esm/main.js && chmod +x ./dist/cjs/main.js", + "build:chmod": "chmod +x ./dist/main.mjs && chmod +x ./dist/main.js", "build:clean": "yarn clean && yarn build", "build:watch": "tsc-watch --onSuccess 'yarn build:chmod'", "clean": "rimraf '*.tsbuildinfo' 'dist'", @@ -40,7 +42,8 @@ "publish:package": "../../scripts/publish-package.sh", "lint:ci": "yarn lint", "publish:preview": "yarn npm publish --tag preview", - "lint:dependencies": "depcheck" + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" }, "dependencies": { "@metamask/snaps-utils": "workspace:^", @@ -54,7 +57,6 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@types/jest": "^27.5.1", @@ -81,6 +83,7 @@ "rimraf": "^4.1.2", "ts-node": "^10.9.1", "tsc-watch": "^4.5.0", + "tsup": "^8.0.1", "typescript": "~4.8.4" }, "engines": { diff --git a/packages/create-snap/tsconfig.json b/packages/create-snap/tsconfig.json index 28cf1b8272..85adfc60aa 100644 --- a/packages/create-snap/tsconfig.json +++ b/packages/create-snap/tsconfig.json @@ -3,6 +3,6 @@ "compilerOptions": { "baseUrl": "./" }, - "include": ["./src", "./src/**/*.json"], + "include": ["./src", "./src/**/*.json", "package.json", "tsup.config.ts"], "references": [{ "path": "../snaps-cli" }, { "path": "../snaps-utils" }] } diff --git a/packages/create-snap/tsup.config.ts b/packages/create-snap/tsup.config.ts new file mode 100644 index 0000000000..3eaf645296 --- /dev/null +++ b/packages/create-snap/tsup.config.ts @@ -0,0 +1,14 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/examples/package.json b/packages/examples/package.json index 10104a4f85..c5f894442a 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -14,7 +14,6 @@ "scripts": { "build": "yarn workspaces foreach --parallel --verbose --no-private run build", "build:clean": "yarn clean && yarn build", - "build:post-tsc": "yarn build", "clean": "yarn workspaces foreach --parallel --verbose --no-private run clean", "start": "yarn workspaces foreach --parallel --verbose --interlaced --no-private --jobs unlimited run start", "start:test": "yarn start", diff --git a/packages/examples/packages/bip32/snap.manifest.json b/packages/examples/packages/bip32/snap.manifest.json index d88260d741..36387471f9 100644 --- a/packages/examples/packages/bip32/snap.manifest.json +++ b/packages/examples/packages/bip32/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "lqz9XyQ0fC81A2LIRKSUInXBJEv26N9+8UIT5HcGG8E=", + "shasum": "AaLbshZePKcSV2NORnmd5AjzkX5vNQToD3PaE4YpUUQ=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/bip44/snap.manifest.json b/packages/examples/packages/bip44/snap.manifest.json index a3b8d1f6da..e17638fde4 100644 --- a/packages/examples/packages/bip44/snap.manifest.json +++ b/packages/examples/packages/bip44/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "nsCQTpHVQtjUTxAolBdau7xERxwz4OxKbyXth4kTiz8=", + "shasum": "q5WeZJXrE5mgP2Z6Fo/aJrVuspPsQgsUn3/SmHuwsGY=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/browserify/snap.manifest.json b/packages/examples/packages/browserify/snap.manifest.json index 1c6a4dc9ca..b2cc33e51d 100644 --- a/packages/examples/packages/browserify/snap.manifest.json +++ b/packages/examples/packages/browserify/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "BcolcAaTfVMveEFxF9WLS9sOsrkTf429Pxb0ovhyq/g=", + "shasum": "anrkssxnQgvz6naNxnXCSIHGLkc2FoDcKx0BeDoWR/k=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/cronjobs/snap.manifest.json b/packages/examples/packages/cronjobs/snap.manifest.json index 80daeb6623..17f81c4262 100644 --- a/packages/examples/packages/cronjobs/snap.manifest.json +++ b/packages/examples/packages/cronjobs/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "GF1FU37ecBu7h9lTOK/II+wrXHQCpx8sk7JQ2HqQy7Y=", + "shasum": "wXAAi/QR4BT1Gp6OiSqCpq+3U7pyRtMQ/LP9LeWwEPk=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/dialogs/snap.manifest.json b/packages/examples/packages/dialogs/snap.manifest.json index db9eee844a..28c14b03ed 100644 --- a/packages/examples/packages/dialogs/snap.manifest.json +++ b/packages/examples/packages/dialogs/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "wX4pqJ2RkmZdllC1iVnHP4uE4sWiqTb6GWXNyEUDnCA=", + "shasum": "EepV6igtZ0ZCX579Ws6f9u0/kYnp65+6OK1SgzCm9Dg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/ethers-js/snap.manifest.json b/packages/examples/packages/ethers-js/snap.manifest.json index 25cf17bdf4..eefbaa62cd 100644 --- a/packages/examples/packages/ethers-js/snap.manifest.json +++ b/packages/examples/packages/ethers-js/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "2gFUJsHPYeCR8WTdRtYSxyAuMG3n/IEUj1diV3F002k=", + "shasum": "AjzlrjmJQTKwGM77EXcpEzjF9bsKK7up36BSA4qhasU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/get-entropy/snap.manifest.json b/packages/examples/packages/get-entropy/snap.manifest.json index 8d405f6692..e791889b5e 100644 --- a/packages/examples/packages/get-entropy/snap.manifest.json +++ b/packages/examples/packages/get-entropy/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "H/SD72HvzJOGI687mfl8QLGrMyDIgYjEm45fmmWuZrU=", + "shasum": "9jRaEw4/0RCp3b3oAI+PK2zcgwupdOnBhaL4zX4pKRg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/home-page/snap.manifest.json b/packages/examples/packages/home-page/snap.manifest.json index 3f40257b18..5c0b5cda2b 100644 --- a/packages/examples/packages/home-page/snap.manifest.json +++ b/packages/examples/packages/home-page/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "6wP6Hm3oTFQcO7CU9pj+LB0WvzU1dO1H3D9FRwieyo8=", + "shasum": "4LSF+30bmPlizM/wYBrq4dp72wkcca9rwYyqkz7ZPvY=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/images/snap.manifest.json b/packages/examples/packages/images/snap.manifest.json index c185e30b9e..e5c384046f 100644 --- a/packages/examples/packages/images/snap.manifest.json +++ b/packages/examples/packages/images/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "SVdLbDNPtAVtkX7kium/1sbYrc5r0wYwf1TDp9veeAw=", + "shasum": "v2cJ3d1fomwpUzSR+XZCLF88e5k0NOm5aVo8dftKKSU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/interactive-ui/snap.manifest.json b/packages/examples/packages/interactive-ui/snap.manifest.json index 436b3f1fa9..8f9274d49e 100644 --- a/packages/examples/packages/interactive-ui/snap.manifest.json +++ b/packages/examples/packages/interactive-ui/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "n5pi83PpGX4amRQqR9ij4oWARSt2bCJD3SyR5Bpu+Vw=", + "shasum": "sKqHlIDCKGyzDhV7wlJTv7RR6m6lrJF4KgyoTacwYao=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/invoke-snap/package.json b/packages/examples/packages/invoke-snap/package.json index 00af0e7d5d..786d22969e 100644 --- a/packages/examples/packages/invoke-snap/package.json +++ b/packages/examples/packages/invoke-snap/package.json @@ -14,7 +14,6 @@ "scripts": { "build": "yarn workspaces foreach --parallel --verbose run build", "build:clean": "yarn clean && yarn build", - "build:post-tsc": "yarn build", "clean": "yarn workspaces foreach --parallel --verbose run clean", "start": "yarn workspaces foreach --parallel --verbose --interlaced --jobs unlimited run start", "test": "yarn workspaces foreach --parallel --verbose --interlaced run test", diff --git a/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json b/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json index df2095554f..405ae93c48 100644 --- a/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json +++ b/packages/examples/packages/invoke-snap/packages/core-signer/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "BHbFMJ+A4iS2cbyIvPX3XSaNm356rTaXjoC6kTkGiUQ=", + "shasum": "ojUZu1+nqCNBVoWHAaDkNRqWx+JVQfaKTOcyGDFD2Wg=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/lifecycle-hooks/snap.manifest.json b/packages/examples/packages/lifecycle-hooks/snap.manifest.json index 440213d066..2e23147114 100644 --- a/packages/examples/packages/lifecycle-hooks/snap.manifest.json +++ b/packages/examples/packages/lifecycle-hooks/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "HsMiA68gfvszwts1V24kUURGhMk2iq/Vy0ALXqnA7lE=", + "shasum": "cyr+aslb2DLAQOj2fs5pBwp3l1WKZU6muxrmhsbAtks=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/manage-state/snap.manifest.json b/packages/examples/packages/manage-state/snap.manifest.json index 8ff1642ad2..03d44cde85 100644 --- a/packages/examples/packages/manage-state/snap.manifest.json +++ b/packages/examples/packages/manage-state/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "92szqCrEqmxOcL+MVbmPrOxJmC8jR5U4iKiVViZBupY=", + "shasum": "bTGiQYMk4+EtULq0PhJ3qru/EhL+2gW7G2SPh8mz4XY=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/notifications/snap.manifest.json b/packages/examples/packages/notifications/snap.manifest.json index 8c452d942d..12e0338182 100644 --- a/packages/examples/packages/notifications/snap.manifest.json +++ b/packages/examples/packages/notifications/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "UG9pic6TiYCm/VVuVrbT6586mxjsEWXwXTGmoESR4w8=", + "shasum": "vR6A7OJh/69dD8OisLbtz+PPHEd2oK+cS6h01E0K+/U=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/signature-insights/snap.manifest.json b/packages/examples/packages/signature-insights/snap.manifest.json index 18ea85328a..00dbb027a4 100644 --- a/packages/examples/packages/signature-insights/snap.manifest.json +++ b/packages/examples/packages/signature-insights/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "nD/VgfhacDSZ/cfKIUlgN7a/ENgFjzhzYntl2lh9jWM=", + "shasum": "cn53UKSOkd/fFq93Nwl2DBkMartFXwyyeoArG9Zxp8w=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/examples/packages/transaction-insights/snap.manifest.json b/packages/examples/packages/transaction-insights/snap.manifest.json index 90ad15ddbd..6216182a30 100644 --- a/packages/examples/packages/transaction-insights/snap.manifest.json +++ b/packages/examples/packages/transaction-insights/snap.manifest.json @@ -7,7 +7,7 @@ "url": "https://github.com/MetaMask/snaps.git" }, "source": { - "shasum": "tx2+S+SWVNjrs5O3YbVWBN0TsWwf/uw5u52yBPpIzwU=", + "shasum": "fT6pbcejyNwb8cjgHPXgFWhpzCNYFuWUIrkuqLP70vU=", "location": { "npm": { "filePath": "dist/bundle.js", diff --git a/packages/snaps-browserify-plugin/package.json b/packages/snaps-browserify-plugin/package.json index 2cc2f03862..768ef7439f 100644 --- a/packages/snaps-browserify-plugin/package.json +++ b/packages/snaps-browserify-plugin/package.json @@ -9,13 +9,19 @@ "url": "https://github.com/MetaMask/snaps.git" }, "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", "types": "./dist/types/index.d.ts", "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**" + "dist" ], "scripts": { "test": "jest && yarn posttest", @@ -26,12 +32,9 @@ "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies", "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-browserify-plugin", - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:clean": "yarn clean && yarn build", + "build:ci": "tsup --clean", "clean": "rimraf '*.tsbuildinfo' 'dist'", "publish:preview": "yarn npm publish --tag preview", "lint:ci": "yarn lint", @@ -49,7 +52,6 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@types/browserify": "^12.0.37", @@ -75,6 +77,7 @@ "prettier": "^2.7.1", "prettier-plugin-packagejson": "^2.2.11", "rimraf": "^4.1.2", + "tsup": "^8.0.1", "typescript": "~4.8.4" }, "engines": { diff --git a/packages/snaps-browserify-plugin/tsconfig.json b/packages/snaps-browserify-plugin/tsconfig.json index 4a3ba29e4e..29291d0908 100644 --- a/packages/snaps-browserify-plugin/tsconfig.json +++ b/packages/snaps-browserify-plugin/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "baseUrl": "./" }, - "include": ["./src"], + "include": ["./src", "package.json", "tsup.config.ts"], "references": [ { "path": "../snaps-utils" diff --git a/packages/snaps-browserify-plugin/tsup.config.ts b/packages/snaps-browserify-plugin/tsup.config.ts new file mode 100644 index 0000000000..3eaf645296 --- /dev/null +++ b/packages/snaps-browserify-plugin/tsup.config.ts @@ -0,0 +1,14 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/snaps-cli/package.json b/packages/snaps-cli/package.json index 845217b998..b2d0eadd48 100644 --- a/packages/snaps-cli/package.json +++ b/packages/snaps-cli/package.json @@ -8,28 +8,28 @@ }, "license": "ISC", "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", "types": "./dist/types/index.d.ts", "bin": { - "mm-snap": "./dist/cjs/main.js" + "mm-snap": "./dist/main.js" }, "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**", - ".browserslistrc" + "dist" ], "scripts": { - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types && yarn build:chmod && yarn build:readme", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:post-tsc": "yarn build:chmod && yarn build:readme", - "build:chmod": "chmod +x ./dist/esm/main.js && chmod +x ./dist/cjs/main.js", + "build:chmod": "chmod +x ./dist/main.mjs && chmod +x ./dist/main.js", "build:readme": "node ./scripts/updateReadme.js", - "build:clean": "yarn clean && yarn build", "build:watch": "tsc-watch --onSuccess 'yarn build:chmod'", "clean": "rimraf '*.tsbuildinfo' 'dist'", "test": "jest --runInBand && yarn posttest", @@ -43,7 +43,8 @@ "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "publish:preview": "yarn npm publish --tag preview", "lint:ci": "yarn lint", - "lint:dependencies": "depcheck" + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" }, "dependencies": { "@babel/core": "^7.23.2", @@ -65,7 +66,6 @@ "browserify-zlib": "^0.2.0", "buffer": "^6.0.3", "chalk": "^4.1.2", - "chokidar": "^3.5.2", "console-browserify": "^1.2.0", "constants-browserify": "^1.0.0", "crypto-browserify": "^3.12.0", @@ -104,7 +104,6 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@swc/cli": "^0.1.62", "@swc/jest": "^0.2.26", "@types/browserify": "^12.0.37", "@types/jest": "^27.5.1", @@ -134,6 +133,7 @@ "rimraf": "^4.1.2", "ts-node": "^10.9.1", "tsc-watch": "^4.5.0", + "tsup": "^8.0.1", "typescript": "~4.8.4" }, "engines": { diff --git a/packages/snaps-cli/scripts/updateReadme.js b/packages/snaps-cli/scripts/updateReadme.js index 87fb19c1b8..69b289fa24 100644 --- a/packages/snaps-cli/scripts/updateReadme.js +++ b/packages/snaps-cli/scripts/updateReadme.js @@ -13,7 +13,7 @@ main(); * `mm-snap --help`. */ async function main() { - const binPath = path.join(__dirname, '../dist/cjs/main.js'); + const binPath = path.join(__dirname, '../dist/main.js'); const readmePath = path.join(__dirname, '../README.md'); const currentReadme = await fs.readFile(readmePath, 'utf8'); diff --git a/packages/snaps-cli/src/test-utils/webpack.ts b/packages/snaps-cli/src/test-utils/webpack.ts index 600882caa7..45241f97b2 100644 --- a/packages/snaps-cli/src/test-utils/webpack.ts +++ b/packages/snaps-cli/src/test-utils/webpack.ts @@ -135,6 +135,16 @@ export function normalizeConfig(config: Configuration): Configuration { }; } + if (rule.use.loader.includes('function.ts')) { + return { + ...rule, + use: { + ...rule.use, + loader: '/foo/bar/src/webpack/loaders/function.ts', + }, + }; + } + return rule; }); diff --git a/packages/snaps-cli/src/webpack/__snapshots__/config.test.ts.snap b/packages/snaps-cli/src/webpack/__snapshots__/config.test.ts.snap index 22c39da7c5..d2bd52e2bb 100644 --- a/packages/snaps-cli/src/webpack/__snapshots__/config.test.ts.snap +++ b/packages/snaps-cli/src/webpack/__snapshots__/config.test.ts.snap @@ -600,7 +600,10 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t { "test": /\\\\\\.wasm\\$/u, "use": { - "loader": "/foo/bar/loaders/wasm", + "loader": "/foo/bar/src/webpack/loaders/function.ts", + "options": { + "fn": [Function], + }, }, }, ], @@ -2041,12 +2044,13 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "exclude": /node_modules/u, "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { - "loader": "/foo/bar/loaders/browserify", + "loader": "/foo/bar/src/webpack/loaders/function.ts", "options": { "bundlerCustomizer": undefined, "depsToTranspile": [], "dist": "/foo/bar/dist", "eval": true, + "fn": [Function], "manifest": true, "outfileName": "bundle.js", "port": 8081, @@ -2176,12 +2180,13 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "exclude": /node_modules/u, "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { - "loader": "/foo/bar/loaders/browserify", + "loader": "/foo/bar/src/webpack/loaders/function.ts", "options": { "bundlerCustomizer": undefined, "depsToTranspile": [], "dist": "/foo/bar/dist", "eval": true, + "fn": [Function], "manifest": true, "outfileName": "bundle.js", "port": 8081, @@ -2311,12 +2316,13 @@ exports[`getDefaultConfiguration returns the default Webpack configuration for t "exclude": /node_modules/u, "test": /\\\\\\.\\(js\\|mjs\\|cjs\\|ts\\)\\$/u, "use": { - "loader": "/foo/bar/loaders/browserify", + "loader": "/foo/bar/src/webpack/loaders/function.ts", "options": { "bundlerCustomizer": undefined, "depsToTranspile": [], "dist": "/foo/bar/dist", "eval": true, + "fn": [Function], "manifest": true, "outfileName": "bundle.js", "port": 8081, diff --git a/packages/snaps-cli/src/webpack/config.test.ts b/packages/snaps-cli/src/webpack/config.test.ts index 68355e8344..0404de4255 100644 --- a/packages/snaps-cli/src/webpack/config.test.ts +++ b/packages/snaps-cli/src/webpack/config.test.ts @@ -191,8 +191,10 @@ describe('getDefaultConfiguration', () => { async (config) => { jest.spyOn(process, 'cwd').mockReturnValue('/foo/bar'); + const output = await getDefaultConfiguration(config); + // eslint-disable-next-line jest/no-restricted-matchers - expect(await getDefaultConfiguration(config)).toMatchSnapshot(); + expect(normalizeConfig(output)).toMatchSnapshot(); }, ); diff --git a/packages/snaps-cli/src/webpack/config.ts b/packages/snaps-cli/src/webpack/config.ts index b62c5fa603..4a8553da98 100644 --- a/packages/snaps-cli/src/webpack/config.ts +++ b/packages/snaps-cli/src/webpack/config.ts @@ -6,6 +6,7 @@ import type { Configuration } from 'webpack'; import { DefinePlugin, ProgressPlugin, ProvidePlugin } from 'webpack'; import type { ProcessedWebpackConfig } from '../config'; +import { getFunctionLoader, wasm } from './loaders'; import { SnapsBuiltInResolver, SnapsBundleWarningsPlugin, @@ -206,9 +207,7 @@ export async function getDefaultConfiguration( config.experimental.wasm && { test: /\.wasm$/u, - use: { - loader: resolve(__dirname, 'loaders', 'wasm'), - }, + use: getFunctionLoader(wasm, {}), }, ], }, diff --git a/packages/snaps-cli/src/webpack/loaders/function.test.ts b/packages/snaps-cli/src/webpack/loaders/function.test.ts new file mode 100644 index 0000000000..3574a4d242 --- /dev/null +++ b/packages/snaps-cli/src/webpack/loaders/function.test.ts @@ -0,0 +1,38 @@ +import { resolve } from 'path'; + +import loader, { getFunctionLoader } from './function'; + +describe('getFunctionLoader', () => { + it('returns a loader definition', () => { + const fn = jest.fn(); + expect( + getFunctionLoader(fn, { + foo: 'bar', + }), + ).toStrictEqual({ + loader: resolve(__dirname, 'function.ts'), + options: { + fn, + foo: 'bar', + }, + }); + }); +}); + +describe('loader', () => { + it('executes the function', async () => { + const fn = jest.fn(); + + await loader.call( + // @ts-expect-error - Partial `this` object. + { + getOptions: () => ({ + fn, + }), + }, + 'test', + ); + + expect(fn).toHaveBeenCalledWith('test'); + }); +}); diff --git a/packages/snaps-cli/src/webpack/loaders/function.ts b/packages/snaps-cli/src/webpack/loaders/function.ts new file mode 100644 index 0000000000..3350448a2c --- /dev/null +++ b/packages/snaps-cli/src/webpack/loaders/function.ts @@ -0,0 +1,61 @@ +import type { LoaderDefinitionFunction } from 'webpack'; + +/** + * Options for the function loader. + */ +export type FunctionLoaderOptions = { + /** + * The function to execute. This is bound to the loader context, so it can + * access the loader options and other properties. + */ + fn: LoaderDefinitionFunction; +}; + +/** + * A loader that executes a function. See {@link getFunctionLoader} for more + * information. + * + * @param content - The input file contents as a `Uint8Array`. + * @returns The output of the function. + */ +const loader: LoaderDefinitionFunction = function ( + content, +) { + const { fn } = this.getOptions(); + return fn.bind(this)(content); +}; + +export default loader; + +/** + * Get a loader that executes the given function. This is useful for executing + * loaders without needing to pass a file to Webpack. + * + * @param fn - The function to execute. + * @param options - The options to pass to the loader. + * @returns The loader definition. + */ +export function getFunctionLoader( + fn: LoaderDefinitionFunction, + options: Options, +) { + return { + // We use `__filename` as the loader, so Webpack will execute the loader in + // this file, with the actual function in the options. + loader: __filename, + options: { + fn, + ...options, + }, + }; +} + +// When running as CJS, we need to export the loader as a default export, since +// `tsup` exports it as `loader_default`. +// istanbul ignore next 3 +// eslint-disable-next-line n/no-process-env +if (typeof module !== 'undefined' && process?.env?.NODE_ENV !== 'test') { + module.exports = loader; + module.exports.getFunctionLoader = getFunctionLoader; + module.exports.raw = true; +} diff --git a/packages/snaps-cli/src/webpack/loaders/index.ts b/packages/snaps-cli/src/webpack/loaders/index.ts new file mode 100644 index 0000000000..7c3da56aff --- /dev/null +++ b/packages/snaps-cli/src/webpack/loaders/index.ts @@ -0,0 +1,3 @@ +export * from './function'; +export { default as browserify } from './browserify'; +export { default as wasm } from './wasm'; diff --git a/packages/snaps-cli/src/webpack/utils.test.ts b/packages/snaps-cli/src/webpack/utils.test.ts index 956b9f3c6c..1979050e1a 100644 --- a/packages/snaps-cli/src/webpack/utils.test.ts +++ b/packages/snaps-cli/src/webpack/utils.test.ts @@ -2,6 +2,7 @@ import { dim } from 'chalk'; import type { ProcessedWebpackConfig } from '../config'; import { getMockConfig } from '../test-utils'; +import { browserify } from './loaders'; import { WEBPACK_FALLBACKS, getBrowserslistTargets, @@ -18,8 +19,11 @@ describe('getDefaultLoader', () => { it('returns the Browserify loader if `legacy` is set', async () => { const config = getMockConfig('browserify'); expect(await getDefaultLoader(config)).toStrictEqual({ - loader: expect.stringContaining('browserify'), - options: config.legacy, + loader: expect.stringContaining('function'), + options: { + ...config.legacy, + fn: browserify, + }, }); }); diff --git a/packages/snaps-cli/src/webpack/utils.ts b/packages/snaps-cli/src/webpack/utils.ts index 8447cb2db1..f33699b14f 100644 --- a/packages/snaps-cli/src/webpack/utils.ts +++ b/packages/snaps-cli/src/webpack/utils.ts @@ -7,6 +7,7 @@ import stripAnsi from 'strip-ansi'; import type { Configuration } from 'webpack'; import type { ProcessedWebpackConfig } from '../config'; +import { browserify, getFunctionLoader } from './loaders'; export const BROWSERSLIST_FILE = resolve( dirname( @@ -72,21 +73,13 @@ export async function getDefaultLoader({ sourceMap, }: ProcessedWebpackConfig) { if (legacy) { - return { - /** - * If the snap uses the legacy config, we use the custom `browserify` - * loader. This uses the legacy Browserify config to transpile the code. - * This is necessary for backwards compatibility with the - * `bundlerCustomizer` function. - */ - loader: resolve(__dirname, 'loaders', 'browserify'), - - /** - * The options for the `browserify` loader. These can be overridden in the - * snap config. - */ - options: legacy, - }; + /** + * If the snap uses the legacy config, we use the custom `browserify` + * loader. This uses the legacy Browserify config to transpile the code. + * This is necessary for backwards compatibility with the + * `bundlerCustomizer` function. + */ + return getFunctionLoader(browserify, legacy); } const targets = await getBrowserslistTargets(); diff --git a/packages/snaps-cli/tsconfig.json b/packages/snaps-cli/tsconfig.json index 526029de4f..cf0ed65956 100644 --- a/packages/snaps-cli/tsconfig.json +++ b/packages/snaps-cli/tsconfig.json @@ -3,7 +3,13 @@ "compilerOptions": { "baseUrl": "./" }, - "include": ["./src", "./src/**/*.json", "jest.setup.ts"], + "include": [ + "./src", + "./src/**/*.json", + "jest.setup.ts", + "package.json", + "tsup.config.ts" + ], "references": [ { "path": "../snaps-utils" }, { "path": "../snaps-browserify-plugin" }, diff --git a/packages/snaps-cli/tsup.config.ts b/packages/snaps-cli/tsup.config.ts new file mode 100644 index 0000000000..5af30151f5 --- /dev/null +++ b/packages/snaps-cli/tsup.config.ts @@ -0,0 +1,15 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, + external: ['@metamask/snaps-cli'], +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index 7ecf841287..199ffbeb6b 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -7,17 +7,23 @@ "url": "https://github.com/MetaMask/snaps.git" }, "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", "browser": { "./dist/cjs/services": "./dist/cjs/services/browser.js", "./dist/esm/services": "./dist/esm/services/browser.js" }, "types": "./dist/types/index.d.ts", "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**" + "dist" ], "scripts": { "test:prepare": "yarn mkdirp test/fixtures && ./scripts/generate-fixtures.sh", @@ -25,12 +31,8 @@ "posttest": "ts-node scripts/coverage.ts && rimraf coverage/jest coverage/wdio", "test:browser": "wdio run wdio.config.js", "test:ci": "yarn test", - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:clean": "yarn clean && yarn build", "clean": "rimraf '*.tsbuildinfo' 'dist'", "lint:eslint": "eslint . --cache --ext js,ts,jsx,tsx", "lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore", @@ -39,7 +41,8 @@ "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-controllers", "publish:preview": "yarn npm publish --tag preview", "lint:ci": "yarn lint", - "lint:dependencies": "depcheck" + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" }, "dependencies": { "@metamask/approval-controller": "^5.1.2", @@ -76,7 +79,6 @@ "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/template-snap": "^0.7.0", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@types/chrome": "^0.0.237", @@ -117,6 +119,7 @@ "prettier-plugin-packagejson": "^2.2.11", "rimraf": "^4.1.2", "ts-node": "^10.9.1", + "tsup": "^8.0.1", "typescript": "~4.8.4", "vite": "^4.3.9", "vite-tsconfig-paths": "^4.0.5", diff --git a/packages/snaps-controllers/tsconfig.json b/packages/snaps-controllers/tsconfig.json index f2434f8276..24bec24e1b 100644 --- a/packages/snaps-controllers/tsconfig.json +++ b/packages/snaps-controllers/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "baseUrl": "./" }, - "include": ["./src", "scripts"], + "include": ["./src", "scripts", "package.json", "tsup.config.ts"], "references": [ { "path": "../snaps-execution-environments" }, { "path": "../snaps-rpc-methods" }, diff --git a/packages/snaps-controllers/tsup.config.ts b/packages/snaps-controllers/tsup.config.ts new file mode 100644 index 0000000000..3eaf645296 --- /dev/null +++ b/packages/snaps-controllers/tsup.config.ts @@ -0,0 +1,14 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index eccc6d154b..9931912077 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -94,10 +94,10 @@ "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, - "@swc/cli>semver": true, "browserify>buffer": true, - "eslint>debug": true, - "superstruct": true + "depcheck>semver": true, + "superstruct": true, + "tsup>debug": true } }, "@metamask/utils>@noble/hashes": { @@ -112,20 +112,6 @@ "TextEncoder": true } }, - "@swc/cli>semver": { - "globals": { - "console.error": true - }, - "packages": { - "@swc/cli>semver>lru-cache": true, - "browserify>process": true - } - }, - "@swc/cli>semver>lru-cache": { - "packages": { - "@swc/cli>semver>lru-cache>yallist": true - } - }, "browserify>browser-pack>safe-buffer": { "packages": { "browserify>buffer": true @@ -156,17 +142,18 @@ "browserify>browser-pack>safe-buffer": true } }, - "eslint>debug": { + "depcheck>semver": { "globals": { - "console": true, - "document": true, - "localStorage": true, - "navigator": true, - "process": true + "console.error": true }, "packages": { "browserify>process": true, - "eslint>debug>ms": true + "depcheck>semver>lru-cache": true + } + }, + "depcheck>semver>lru-cache": { + "packages": { + "depcheck>semver>lru-cache>yallist": true } }, "external:../snaps-sdk/src/error-wrappers.ts": { @@ -515,6 +502,19 @@ "console.warn": true, "define": true } + }, + "tsup>debug": { + "globals": { + "console": true, + "document": true, + "localStorage": true, + "navigator": true, + "process": true + }, + "packages": { + "browserify>process": true, + "tsup>debug>ms": true + } } } } \ No newline at end of file diff --git a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json index b41c6bf6a0..5b3829e87c 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -107,10 +107,10 @@ "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, - "@swc/cli>semver": true, "buffer": true, - "eslint>debug": true, - "superstruct": true + "depcheck>semver": true, + "superstruct": true, + "tsup>debug": true } }, "@metamask/utils>@noble/hashes": { @@ -125,20 +125,6 @@ "TextEncoder": true } }, - "@swc/cli>semver": { - "globals": { - "console.error": true, - "process": true - }, - "packages": { - "@swc/cli>semver>lru-cache": true - } - }, - "@swc/cli>semver>lru-cache": { - "packages": { - "@swc/cli>semver>lru-cache>yallist": true - } - }, "@wdio/mocha-framework>mocha>supports-color": { "builtin": { "os.release": true, @@ -175,25 +161,18 @@ "browserify>browser-pack>safe-buffer": true } }, - "eslint>debug": { - "builtin": { - "tty.isatty": true, - "util.deprecate": true, - "util.format": true, - "util.inspect": true - }, + "depcheck>semver": { "globals": { - "console": true, - "document": true, - "localStorage": true, - "navigator": true, + "console.error": true, "process": true }, "packages": { - "@wdio/mocha-framework>mocha>supports-color": true, - "eslint>debug>ms": true, - "tty": true, - "util": true + "depcheck>semver>lru-cache": true + } + }, + "depcheck>semver>lru-cache": { + "packages": { + "depcheck>semver>lru-cache>yallist": true } }, "external:../snaps-sdk/src/error-wrappers.ts": { @@ -560,6 +539,27 @@ "console.warn": true, "define": true } + }, + "tsup>debug": { + "builtin": { + "tty.isatty": true, + "util.deprecate": true, + "util.format": true, + "util.inspect": true + }, + "globals": { + "console": true, + "document": true, + "localStorage": true, + "navigator": true, + "process": true + }, + "packages": { + "@wdio/mocha-framework>mocha>supports-color": true, + "tsup>debug>ms": true, + "tty": true, + "util": true + } } } } \ No newline at end of file diff --git a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json index b41c6bf6a0..5b3829e87c 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -107,10 +107,10 @@ "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, - "@swc/cli>semver": true, "buffer": true, - "eslint>debug": true, - "superstruct": true + "depcheck>semver": true, + "superstruct": true, + "tsup>debug": true } }, "@metamask/utils>@noble/hashes": { @@ -125,20 +125,6 @@ "TextEncoder": true } }, - "@swc/cli>semver": { - "globals": { - "console.error": true, - "process": true - }, - "packages": { - "@swc/cli>semver>lru-cache": true - } - }, - "@swc/cli>semver>lru-cache": { - "packages": { - "@swc/cli>semver>lru-cache>yallist": true - } - }, "@wdio/mocha-framework>mocha>supports-color": { "builtin": { "os.release": true, @@ -175,25 +161,18 @@ "browserify>browser-pack>safe-buffer": true } }, - "eslint>debug": { - "builtin": { - "tty.isatty": true, - "util.deprecate": true, - "util.format": true, - "util.inspect": true - }, + "depcheck>semver": { "globals": { - "console": true, - "document": true, - "localStorage": true, - "navigator": true, + "console.error": true, "process": true }, "packages": { - "@wdio/mocha-framework>mocha>supports-color": true, - "eslint>debug>ms": true, - "tty": true, - "util": true + "depcheck>semver>lru-cache": true + } + }, + "depcheck>semver>lru-cache": { + "packages": { + "depcheck>semver>lru-cache>yallist": true } }, "external:../snaps-sdk/src/error-wrappers.ts": { @@ -560,6 +539,27 @@ "console.warn": true, "define": true } + }, + "tsup>debug": { + "builtin": { + "tty.isatty": true, + "util.deprecate": true, + "util.format": true, + "util.inspect": true + }, + "globals": { + "console": true, + "document": true, + "localStorage": true, + "navigator": true, + "process": true + }, + "packages": { + "@wdio/mocha-framework>mocha>supports-color": true, + "tsup>debug>ms": true, + "tty": true, + "util": true + } } } } \ No newline at end of file diff --git a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json index eb59500cd8..53d296c7b8 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/webview/policy.json @@ -40,10 +40,10 @@ "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, - "@swc/cli>semver": true, "browserify>buffer": true, - "eslint>debug": true, - "superstruct": true + "depcheck>semver": true, + "superstruct": true, + "tsup>debug": true } }, "@metamask/utils>@noble/hashes": { @@ -58,20 +58,6 @@ "TextEncoder": true } }, - "@swc/cli>semver": { - "globals": { - "console.error": true - }, - "packages": { - "@swc/cli>semver>lru-cache": true, - "browserify>process": true - } - }, - "@swc/cli>semver>lru-cache": { - "packages": { - "@swc/cli>semver>lru-cache>yallist": true - } - }, "browserify>browser-pack>safe-buffer": { "packages": { "browserify>buffer": true @@ -102,17 +88,18 @@ "browserify>browser-pack>safe-buffer": true } }, - "eslint>debug": { + "depcheck>semver": { "globals": { - "console": true, - "document": true, - "localStorage": true, - "navigator": true, - "process": true + "console.error": true }, "packages": { "browserify>process": true, - "eslint>debug>ms": true + "depcheck>semver>lru-cache": true + } + }, + "depcheck>semver>lru-cache": { + "packages": { + "depcheck>semver>lru-cache>yallist": true } }, "external:../snaps-sdk/src/error-wrappers.ts": { @@ -461,6 +448,19 @@ "console.warn": true, "define": true } + }, + "tsup>debug": { + "globals": { + "console": true, + "document": true, + "localStorage": true, + "navigator": true, + "process": true + }, + "packages": { + "browserify>process": true, + "tsup>debug>ms": true + } } } } \ No newline at end of file diff --git a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json index eccc6d154b..9931912077 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -94,10 +94,10 @@ "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, - "@swc/cli>semver": true, "browserify>buffer": true, - "eslint>debug": true, - "superstruct": true + "depcheck>semver": true, + "superstruct": true, + "tsup>debug": true } }, "@metamask/utils>@noble/hashes": { @@ -112,20 +112,6 @@ "TextEncoder": true } }, - "@swc/cli>semver": { - "globals": { - "console.error": true - }, - "packages": { - "@swc/cli>semver>lru-cache": true, - "browserify>process": true - } - }, - "@swc/cli>semver>lru-cache": { - "packages": { - "@swc/cli>semver>lru-cache>yallist": true - } - }, "browserify>browser-pack>safe-buffer": { "packages": { "browserify>buffer": true @@ -156,17 +142,18 @@ "browserify>browser-pack>safe-buffer": true } }, - "eslint>debug": { + "depcheck>semver": { "globals": { - "console": true, - "document": true, - "localStorage": true, - "navigator": true, - "process": true + "console.error": true }, "packages": { "browserify>process": true, - "eslint>debug>ms": true + "depcheck>semver>lru-cache": true + } + }, + "depcheck>semver>lru-cache": { + "packages": { + "depcheck>semver>lru-cache>yallist": true } }, "external:../snaps-sdk/src/error-wrappers.ts": { @@ -515,6 +502,19 @@ "console.warn": true, "define": true } + }, + "tsup>debug": { + "globals": { + "console": true, + "document": true, + "localStorage": true, + "navigator": true, + "process": true + }, + "packages": { + "browserify>process": true, + "tsup>debug>ms": true + } } } } \ No newline at end of file diff --git a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json index eb59500cd8..53d296c7b8 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-pool/policy.json @@ -40,10 +40,10 @@ "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, - "@swc/cli>semver": true, "browserify>buffer": true, - "eslint>debug": true, - "superstruct": true + "depcheck>semver": true, + "superstruct": true, + "tsup>debug": true } }, "@metamask/utils>@noble/hashes": { @@ -58,20 +58,6 @@ "TextEncoder": true } }, - "@swc/cli>semver": { - "globals": { - "console.error": true - }, - "packages": { - "@swc/cli>semver>lru-cache": true, - "browserify>process": true - } - }, - "@swc/cli>semver>lru-cache": { - "packages": { - "@swc/cli>semver>lru-cache>yallist": true - } - }, "browserify>browser-pack>safe-buffer": { "packages": { "browserify>buffer": true @@ -102,17 +88,18 @@ "browserify>browser-pack>safe-buffer": true } }, - "eslint>debug": { + "depcheck>semver": { "globals": { - "console": true, - "document": true, - "localStorage": true, - "navigator": true, - "process": true + "console.error": true }, "packages": { "browserify>process": true, - "eslint>debug>ms": true + "depcheck>semver>lru-cache": true + } + }, + "depcheck>semver>lru-cache": { + "packages": { + "depcheck>semver>lru-cache>yallist": true } }, "external:../snaps-sdk/src/error-wrappers.ts": { @@ -461,6 +448,19 @@ "console.warn": true, "define": true } + }, + "tsup>debug": { + "globals": { + "console": true, + "document": true, + "localStorage": true, + "navigator": true, + "process": true + }, + "packages": { + "browserify>process": true, + "tsup>debug>ms": true + } } } } \ No newline at end of file diff --git a/packages/snaps-execution-environments/lavamoat/build-system/policy.json b/packages/snaps-execution-environments/lavamoat/build-system/policy.json index 0d25a177f0..bf3538bb2f 100644 --- a/packages/snaps-execution-environments/lavamoat/build-system/policy.json +++ b/packages/snaps-execution-environments/lavamoat/build-system/policy.json @@ -35,8 +35,8 @@ "depcheck>@babel/parser": true, "depcheck>@babel/traverse": true, "depcheck>json5": true, - "eslint>debug": true, - "lavamoat>@babel/code-frame": true + "lavamoat>@babel/code-frame": true, + "tsup>debug": true } }, "@babel/core>@ampproject/remapping": { @@ -53,8 +53,8 @@ "define": true }, "packages": { - "terser>@jridgewell/source-map>@jridgewell/gen-mapping>@jridgewell/set-array": true, - "terser>@jridgewell/source-map>@jridgewell/gen-mapping>@jridgewell/sourcemap-codec": true + "tsup>sucrase>@jridgewell/gen-mapping>@jridgewell/set-array": true, + "tsup>sucrase>@jridgewell/gen-mapping>@jridgewell/sourcemap-codec": true } }, "@babel/core>@babel/generator": { @@ -65,8 +65,8 @@ "packages": { "@babel/core>@babel/generator>jsesc": true, "@babel/core>@babel/types": true, - "terser>@jridgewell/source-map>@jridgewell/gen-mapping": true, - "terser>@jridgewell/source-map>@jridgewell/trace-mapping": true + "terser>@jridgewell/source-map>@jridgewell/trace-mapping": true, + "tsup>sucrase>@jridgewell/gen-mapping": true } }, "@babel/core>@babel/generator>jsesc": { @@ -1017,9 +1017,9 @@ "@metamask/utils>@noble/hashes": true, "@metamask/utils>@scure/base": true, "@metamask/utils>pony-cause": true, - "@swc/cli>semver": true, - "eslint>debug": true, - "superstruct": true + "depcheck>semver": true, + "superstruct": true, + "tsup>debug": true } }, "@metamask/utils>@noble/hashes": { @@ -1034,20 +1034,6 @@ "TextEncoder": true } }, - "@swc/cli>semver": { - "globals": { - "console.error": true, - "process": true - }, - "packages": { - "@swc/cli>semver>lru-cache": true - } - }, - "@swc/cli>semver>lru-cache": { - "packages": { - "@swc/cli>semver>lru-cache>yallist": true - } - }, "@wdio/mocha-framework>mocha>supports-color": { "builtin": { "os.release": true, @@ -1837,8 +1823,8 @@ "depcheck>@babel/traverse>@babel/helper-hoist-variables": true, "depcheck>@babel/traverse>@babel/helper-split-export-declaration": true, "depcheck>@babel/traverse>globals": true, - "eslint>debug": true, - "lavamoat>@babel/code-frame": true + "lavamoat>@babel/code-frame": true, + "tsup>debug": true } }, "depcheck>@babel/traverse>@babel/helper-function-name": { @@ -1909,6 +1895,20 @@ "process.platform": true } }, + "depcheck>semver": { + "globals": { + "console.error": true, + "process": true + }, + "packages": { + "depcheck>semver>lru-cache": true + } + }, + "depcheck>semver>lru-cache": { + "packages": { + "depcheck>semver>lru-cache>yallist": true + } + }, "eslint-plugin-import>array-includes>get-intrinsic": { "globals": { "AggregateError": true, @@ -1975,25 +1975,6 @@ "eslint>chalk>ansi-styles>color-convert>color-name": true } }, - "eslint>debug": { - "builtin": { - "tty.isatty": true, - "util.deprecate": true, - "util.format": true, - "util.inspect": true - }, - "globals": { - "console": true, - "document": true, - "localStorage": true, - "navigator": true, - "process": true - }, - "packages": { - "@wdio/mocha-framework>mocha>supports-color": true, - "eslint>debug>ms": true - } - }, "eslint>espree": { "packages": { "eslint>eslint-visitor-keys": true, @@ -2386,58 +2367,77 @@ "define": true } }, - "terser>@jridgewell/source-map>@jridgewell/gen-mapping": { + "terser>@jridgewell/source-map>@jridgewell/trace-mapping": { "globals": { "define": true }, "packages": { - "terser>@jridgewell/source-map>@jridgewell/gen-mapping>@jridgewell/set-array": true, - "terser>@jridgewell/source-map>@jridgewell/gen-mapping>@jridgewell/sourcemap-codec": true, - "terser>@jridgewell/source-map>@jridgewell/trace-mapping": true + "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/resolve-uri": true, + "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/sourcemap-codec": true } }, - "terser>@jridgewell/source-map>@jridgewell/gen-mapping>@jridgewell/set-array": { + "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/resolve-uri": { "globals": { "define": true } }, - "terser>@jridgewell/source-map>@jridgewell/gen-mapping>@jridgewell/sourcemap-codec": { + "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/sourcemap-codec": { "globals": { "Buffer": true, "TextDecoder": true, "define": true } }, - "terser>@jridgewell/source-map>@jridgewell/trace-mapping": { + "terser>acorn": { "globals": { + "console": true, "define": true - }, - "packages": { - "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/resolve-uri": true, - "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/sourcemap-codec": true } }, - "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/resolve-uri": { + "terser>source-map-support>buffer-from": { "globals": { - "define": true + "Buffer": true } }, - "terser>@jridgewell/source-map>@jridgewell/trace-mapping>@jridgewell/sourcemap-codec": { + "tsup>debug": { + "builtin": { + "tty.isatty": true, + "util.deprecate": true, + "util.format": true, + "util.inspect": true + }, + "globals": { + "console": true, + "document": true, + "localStorage": true, + "navigator": true, + "process": true + }, + "packages": { + "@wdio/mocha-framework>mocha>supports-color": true, + "tsup>debug>ms": true + } + }, + "tsup>sucrase>@jridgewell/gen-mapping": { "globals": { - "Buffer": true, - "TextDecoder": true, "define": true + }, + "packages": { + "terser>@jridgewell/source-map>@jridgewell/trace-mapping": true, + "tsup>sucrase>@jridgewell/gen-mapping>@jridgewell/set-array": true, + "tsup>sucrase>@jridgewell/gen-mapping>@jridgewell/sourcemap-codec": true } }, - "terser>acorn": { + "tsup>sucrase>@jridgewell/gen-mapping>@jridgewell/set-array": { "globals": { - "console": true, "define": true } }, - "terser>source-map-support>buffer-from": { + "tsup>sucrase>@jridgewell/gen-mapping>@jridgewell/sourcemap-codec": { "globals": { - "Buffer": true + "Buffer": true, + "TextDecoder": true, + "define": true } }, "yargs": { diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index ed41dc03f0..7efa89270c 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -7,14 +7,25 @@ "url": "https://github.com/MetaMask/snaps.git" }, "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" + }, + "./dist/browserify/node-process/bundle.js": { + "default": "./dist/browserify/node-process/bundle.js" + }, + "./dist/browserify/node-thread/bundle.js": { + "default": "./dist/browserify/node-thread/bundle.js" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", "types": "./dist/types/index.d.ts", "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**", - "dist/browserify/**" + "dist" ], "scripts": { "test": "rimraf coverage && jest && yarn test:browser && yarn posttest", @@ -28,20 +39,16 @@ "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-execution-environments", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies", "clean": "rimraf '*.tsbuildinfo' 'dist' 'src/__GENERATED__/' 'coverage/*' '__test__/*'", - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:clean": "yarn clean && yarn build", - "build:post-tsc": "yarn build:lavamoat", "build:lavamoat": "lavamoat scripts/build.js --policy lavamoat/build-system/policy.json --policyOverride lavamoat/build-system/policy-override.json", "build:lavamoat:policy": "yarn build:lavamoat --writeAutoPolicy && node scripts/build.js --writeAutoPolicy", "auto-changelog-init": "auto-changelog init", "publish:preview": "yarn npm publish --tag preview", "lint:ci": "yarn lint", "start": "node scripts/start.js", - "lint:dependencies": "depcheck" + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" }, "dependencies": { "@metamask/json-rpc-engine": "^7.3.2", @@ -70,7 +77,6 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@types/express": "^4.17.17", @@ -114,6 +120,7 @@ "ses": "^1.1.0", "terser": "^5.17.7", "ts-node": "^10.9.1", + "tsup": "^8.0.1", "typescript": "~4.8.4", "vite": "^4.3.9", "vite-tsconfig-paths": "^4.0.5", diff --git a/packages/snaps-execution-environments/tsconfig.json b/packages/snaps-execution-environments/tsconfig.json index ce93b29b10..9bb5b593d8 100644 --- a/packages/snaps-execution-environments/tsconfig.json +++ b/packages/snaps-execution-environments/tsconfig.json @@ -5,7 +5,13 @@ "typeRoots": ["../../node_modules/@types", "./node_modules/@types"], "allowJs": true }, - "include": ["./src", "webpack.config.js", "scripts"], + "include": [ + "./src", + "webpack.config.js", + "scripts", + "package.json", + "tsup.config.ts" + ], "references": [ { "path": "../snaps-sdk" diff --git a/packages/snaps-execution-environments/tsup.config.ts b/packages/snaps-execution-environments/tsup.config.ts new file mode 100644 index 0000000000..b341957eee --- /dev/null +++ b/packages/snaps-execution-environments/tsup.config.ts @@ -0,0 +1,15 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, + external: ['@metamask/snaps-execution-environments'], +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/snaps-jest/jest-preset.js b/packages/snaps-jest/jest-preset.js index 4b713a7256..62b1e54322 100644 --- a/packages/snaps-jest/jest-preset.js +++ b/packages/snaps-jest/jest-preset.js @@ -12,7 +12,7 @@ const config = { // timeout to 30 seconds by default. testTimeout: 30000, - setupFilesAfterEnv: [resolve(__dirname, 'dist', 'cjs', 'setup.js')], + setupFilesAfterEnv: [resolve(__dirname, 'dist', 'setup.js')], }; module.exports = config; diff --git a/packages/snaps-jest/package.json b/packages/snaps-jest/package.json index 5725f13cab..c29280c267 100644 --- a/packages/snaps-jest/package.json +++ b/packages/snaps-jest/package.json @@ -3,13 +3,20 @@ "version": "5.0.0", "description": "A Jest preset for end-to-end testing MetaMask Snaps, including a Jest environment, and a set of Jest matchers.", "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" + }, + "./jest-preset": "./jest-preset.js", + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", "types": "./dist/types/index.d.ts", "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**", + "dist", "jest-preset.js" ], "scripts": { @@ -22,15 +29,12 @@ "lint:ci": "yarn lint", "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-jest", - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:clean": "yarn clean && yarn build", "clean": "rimraf '*.tsbuildinfo' 'dist'", "publish:preview": "yarn npm publish --tag preview", - "lint:dependencies": "depcheck" + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" }, "dependencies": { "@jest/environment": "^29.5.0", @@ -65,7 +69,6 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@types/jest": "^27.5.1", @@ -87,6 +90,7 @@ "prettier": "^2.7.1", "prettier-plugin-packagejson": "^2.2.11", "rimraf": "^4.1.2", + "tsup": "^8.0.1", "typescript": "~4.8.4" }, "engines": { diff --git a/packages/snaps-jest/tsconfig.json b/packages/snaps-jest/tsconfig.json index 81d407e968..8fafac73fc 100644 --- a/packages/snaps-jest/tsconfig.json +++ b/packages/snaps-jest/tsconfig.json @@ -4,7 +4,7 @@ "baseUrl": "./", "jsx": "preserve" }, - "include": ["./src"], + "include": ["./src", "package.json", "tsup.config.ts"], "references": [ { "path": "../snaps-utils" diff --git a/packages/snaps-jest/tsup.config.ts b/packages/snaps-jest/tsup.config.ts new file mode 100644 index 0000000000..3eaf645296 --- /dev/null +++ b/packages/snaps-jest/tsup.config.ts @@ -0,0 +1,14 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/snaps-rollup-plugin/package.json b/packages/snaps-rollup-plugin/package.json index 372b6f7365..e92618d640 100644 --- a/packages/snaps-rollup-plugin/package.json +++ b/packages/snaps-rollup-plugin/package.json @@ -10,13 +10,19 @@ "url": "https://github.com/MetaMask/snaps.git" }, "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", "types": "./dist/types/index.d.ts", "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**" + "dist" ], "scripts": { "test": "jest && yarn posttest", @@ -27,16 +33,13 @@ "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies", "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-rollup-plugin", - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:clean": "yarn clean && yarn build", "clean": "rimraf '*.tsbuildinfo' 'dist'", "publish:preview": "yarn npm publish --tag preview", "lint:ci": "yarn lint", - "lint:dependencies": "depcheck" + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" }, "dependencies": { "@metamask/snaps-utils": "workspace:^" @@ -49,7 +52,6 @@ "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", "@rollup/plugin-virtual": "^2.1.0", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@types/jest": "^27.5.1", @@ -72,6 +74,7 @@ "prettier-plugin-packagejson": "^2.2.11", "rimraf": "^4.1.2", "rollup": "^2.73.0", + "tsup": "^8.0.1", "typescript": "~4.8.4" }, "engines": { diff --git a/packages/snaps-rollup-plugin/tsconfig.json b/packages/snaps-rollup-plugin/tsconfig.json index a4f2b5a12e..dc42b0cdc0 100644 --- a/packages/snaps-rollup-plugin/tsconfig.json +++ b/packages/snaps-rollup-plugin/tsconfig.json @@ -3,6 +3,6 @@ "compilerOptions": { "baseUrl": "./" }, - "include": ["./src"], + "include": ["./src", "package.json", "tsup.config.ts"], "references": [{ "path": "../snaps-utils" }] } diff --git a/packages/snaps-rollup-plugin/tsup.config.ts b/packages/snaps-rollup-plugin/tsup.config.ts new file mode 100644 index 0000000000..3eaf645296 --- /dev/null +++ b/packages/snaps-rollup-plugin/tsup.config.ts @@ -0,0 +1,14 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/snaps-rpc-methods/package.json b/packages/snaps-rpc-methods/package.json index 67e7661ef1..8dee77e712 100644 --- a/packages/snaps-rpc-methods/package.json +++ b/packages/snaps-rpc-methods/package.json @@ -7,13 +7,19 @@ "url": "https://github.com/MetaMask/snaps.git" }, "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", "types": "./dist/types/index.d.ts", "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**" + "dist" ], "scripts": { "test": "jest && yarn posttest", @@ -24,16 +30,13 @@ "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies", "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-rpc-methods", - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:clean": "yarn clean && yarn build", "clean": "rimraf '*.tsbuildinfo' 'dist'", "publish:preview": "yarn npm publish --tag preview", "lint:ci": "yarn lint", - "lint:dependencies": "depcheck" + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" }, "dependencies": { "@metamask/key-tree": "^9.0.0", @@ -54,7 +57,6 @@ "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/json-rpc-engine": "^7.3.2", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@types/node": "18.14.2", @@ -75,6 +77,7 @@ "prettier": "^2.7.1", "prettier-plugin-packagejson": "^2.2.11", "rimraf": "^4.1.2", + "tsup": "^8.0.1", "typescript": "~4.8.4" }, "engines": { diff --git a/packages/snaps-rpc-methods/tsconfig.json b/packages/snaps-rpc-methods/tsconfig.json index 2db16954a8..87b8b62915 100644 --- a/packages/snaps-rpc-methods/tsconfig.json +++ b/packages/snaps-rpc-methods/tsconfig.json @@ -3,6 +3,6 @@ "compilerOptions": { "baseUrl": "./" }, - "include": ["./src"], + "include": ["./src", "package.json", "tsup.config.ts"], "references": [{ "path": "../snaps-sdk" }, { "path": "../snaps-utils" }] } diff --git a/packages/snaps-rpc-methods/tsup.config.ts b/packages/snaps-rpc-methods/tsup.config.ts new file mode 100644 index 0000000000..3eaf645296 --- /dev/null +++ b/packages/snaps-rpc-methods/tsup.config.ts @@ -0,0 +1,14 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index 00b4c38e60..b6084e02f5 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -6,13 +6,19 @@ "url": "https://github.com/MetaMask/snaps.git" }, "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", "types": "./dist/types/index.d.ts", "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**" + "dist" ], "scripts": { "test": "jest && yarn posttest", @@ -23,16 +29,13 @@ "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies", "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-sdk", - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:clean": "yarn clean && yarn build", "clean": "rimraf '*.tsbuildinfo' 'dist'", "publish:preview": "yarn npm publish --tag preview", "lint:ci": "yarn lint", - "lint:dependencies": "depcheck" + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" }, "dependencies": { "@metamask/key-tree": "^9.0.0", @@ -49,7 +52,6 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@types/jest": "^27.5.1", "@typescript-eslint/eslint-plugin": "^5.42.1", @@ -72,6 +74,7 @@ "prettier-plugin-packagejson": "^2.2.11", "rimraf": "^4.1.2", "ts-jest": "^29.1.1", + "tsup": "^8.0.1", "typescript": "~4.8.4" }, "engines": { diff --git a/packages/snaps-sdk/tsconfig.json b/packages/snaps-sdk/tsconfig.json index 7d6092a4d3..c3cd554d5a 100644 --- a/packages/snaps-sdk/tsconfig.json +++ b/packages/snaps-sdk/tsconfig.json @@ -3,5 +3,5 @@ "compilerOptions": { "baseUrl": "./" }, - "include": ["./src"] + "include": ["./src", "package.json", "tsup.config.ts"] } diff --git a/packages/snaps-sdk/tsup.config.ts b/packages/snaps-sdk/tsup.config.ts new file mode 100644 index 0000000000..3eaf645296 --- /dev/null +++ b/packages/snaps-sdk/tsup.config.ts @@ -0,0 +1,14 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/snaps-simulator/package.json b/packages/snaps-simulator/package.json index 071d66164d..876efd67a0 100644 --- a/packages/snaps-simulator/package.json +++ b/packages/snaps-simulator/package.json @@ -1,35 +1,14 @@ { "name": "@metamask/snaps-simulator", "version": "2.4.3", + "private": true, "description": "A simulator for MetaMask Snaps, to be used for testing and development", "homepage": "https://github.com/MetaMask/snaps#readme", - "bugs": { - "url": "https://github.com/MetaMask/snaps/issues" - }, - "repository": { - "type": "git", - "url": "https://github.com/MetaMask/snaps.git" - }, "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", - "types": "./dist/types/index.d.ts", - "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/src/**", - "dist/webpack/**" - ], "scripts": { - "build": "yarn build:source && yarn build:types && yarn build:webpack", - "build:source": "yarn build:esm && yarn build:cjs", - "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", + "build": "yarn build:vendor && yarn build:webpack", "build:webpack": "yarn webpack --config-name main --config-name test --mode production --progress", "build:vendor": "webpack --config-name vendor --mode production --progress", - "build:clean": "rimraf dist && yarn build", - "build:post-tsc": "yarn build:vendor && yarn build:webpack", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies", "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-simulator", "lint:eslint": "eslint . --cache --ext js,ts,jsx,tsx", @@ -91,7 +70,6 @@ "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10", "@redux-saga/is": "^1.1.3", "@redux-saga/symbols": "^1.1.3", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@testing-library/react": "^14.0.0", "@types/express": "^4.17.17", @@ -140,6 +118,7 @@ "terser-webpack-plugin": "^5.3.9", "ts-node": "^10.9.1", "tsconfig-paths-webpack-plugin": "^4.0.1", + "tsup": "^8.0.1", "typescript": "~4.8.4", "webpack": "^5.88.0", "webpack-cli": "^5.1.4", @@ -149,9 +128,5 @@ "engines": { "node": "^18.16 || >=20" }, - "publishConfig": { - "access": "public", - "registry": "https://registry.npmjs.org/" - }, "packageManager": "yarn@3.2.1" } diff --git a/packages/snaps-simulator/tsconfig.json b/packages/snaps-simulator/tsconfig.json index ff5642e437..ab6982a118 100644 --- a/packages/snaps-simulator/tsconfig.json +++ b/packages/snaps-simulator/tsconfig.json @@ -5,7 +5,7 @@ "jsx": "react-jsx", "resolveJsonModule": true }, - "include": ["./src", "webpack.config.ts", "package.json"], + "include": ["./src", "webpack.config.ts", "package.json", "tsup.config.ts"], "references": [ { "path": "../snaps-rpc-methods" }, { "path": "../snaps-controllers" }, diff --git a/packages/snaps-simulator/tsup.config.ts b/packages/snaps-simulator/tsup.config.ts new file mode 100644 index 0000000000..3eaf645296 --- /dev/null +++ b/packages/snaps-simulator/tsup.config.ts @@ -0,0 +1,14 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index c512f0a016..b901ec9bc9 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -9,39 +9,29 @@ "exports": { ".": { "browser": { - "import": "./dist/esm/index.browser.js", - "require": "./dist/cjs/index.browser.js" + "import": "./dist/index.browser.mjs", + "require": "./dist/index.browser.js" }, - "import": "./dist/esm/index.js", - "require": "./dist/cjs/index.js" + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" }, "./test-utils": { - "import": "./dist/esm/test-utils/index.js", - "require": "./dist/cjs/test-utils/index.js", + "import": "./dist/test-utils/index.mjs", + "require": "./dist/test-utils/index.js", "types": "./dist/types/test-utils/index.d.ts" - } + }, + "./package.json": "./package.json" }, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "main": "./dist/index.js", + "module": "./dist/index.mjs", "browser": { - "./dist/cjs/index.js": "./dist/cjs/index.browser.js", - "./dist/esm/index.js": "./dist/esm/index.browser.js" + "./dist/index.js": "./dist/index.browser.js", + "./dist/index.mjs": "./dist/index.browser.mjs" }, "types": "./dist/types/index.d.ts", - "typesVersions": { - "*": { - "*": [ - "./dist/types/index.d.ts" - ], - "test-utils": [ - "./dist/types/test-utils/index.d.ts" - ] - } - }, "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**" + "dist" ], "scripts": { "test": "rimraf coverage && jest && yarn test:browser && yarn posttest", @@ -53,16 +43,14 @@ "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies", "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-utils", - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", "build:clean": "yarn clean && yarn build", "clean": "rimraf '*.tsbuildinfo' 'dist'", "publish:preview": "yarn npm publish --tag preview", "lint:ci": "yarn lint", - "lint:dependencies": "depcheck" + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" }, "dependencies": { "@babel/core": "^7.23.2", @@ -97,7 +85,6 @@ "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", "@metamask/post-message-stream": "^8.0.0", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@types/jest": "^27.5.1", @@ -135,6 +122,7 @@ "prettier-plugin-packagejson": "^2.2.11", "rimraf": "^4.1.2", "ts-node": "^10.9.1", + "tsup": "^8.0.1", "typescript": "~4.8.4", "vite": "^4.3.9", "vite-tsconfig-paths": "^4.0.5", diff --git a/packages/snaps-utils/tsconfig.json b/packages/snaps-utils/tsconfig.json index fd3d195748..0d410cef02 100644 --- a/packages/snaps-utils/tsconfig.json +++ b/packages/snaps-utils/tsconfig.json @@ -3,6 +3,6 @@ "compilerOptions": { "baseUrl": "./" }, - "include": ["./src", "scripts"], + "include": ["./src", "scripts", "package.json", "tsup.config.ts"], "references": [{ "path": "../snaps-sdk" }] } diff --git a/packages/snaps-utils/tsup.config.ts b/packages/snaps-utils/tsup.config.ts new file mode 100644 index 0000000000..c21ce6b3b1 --- /dev/null +++ b/packages/snaps-utils/tsup.config.ts @@ -0,0 +1,15 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, + entry: ['!./src/eval-worker.js'], +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/snaps-webpack-plugin/package.json b/packages/snaps-webpack-plugin/package.json index 943d1ab20a..a705096720 100644 --- a/packages/snaps-webpack-plugin/package.json +++ b/packages/snaps-webpack-plugin/package.json @@ -10,13 +10,19 @@ "url": "https://github.com/MetaMask/snaps.git" }, "sideEffects": false, - "main": "./dist/cjs/index.js", - "module": "./dist/esm/index.js", + "exports": { + ".": { + "import": "./dist/index.mjs", + "require": "./dist/index.js", + "types": "./dist/types/index.d.ts" + }, + "./package.json": "./package.json" + }, + "main": "./dist/index.js", + "module": "./dist/index.mjs", "types": "./dist/types/index.d.ts", "files": [ - "dist/cjs/**", - "dist/esm/**", - "dist/types/**" + "dist" ], "scripts": { "test": "jest && yarn posttest", @@ -27,16 +33,13 @@ "lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies", "lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write", "lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-webpack-plugin", - "build": "yarn build:source && yarn build:types", - "build:source": "yarn build:esm && yarn build:cjs", + "build": "tsup --clean && yarn build:types", "build:types": "tsc --project tsconfig.build.json", - "build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6", - "build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs", - "build:clean": "yarn clean && yarn build", "clean": "rimraf '*.tsbuildinfo' 'dist'", "publish:preview": "yarn npm publish --tag preview", "lint:ci": "yarn lint", - "lint:dependencies": "depcheck" + "lint:dependencies": "depcheck", + "build:ci": "tsup --clean" }, "dependencies": { "@metamask/snaps-sdk": "workspace:^", @@ -51,7 +54,6 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@swc/cli": "^0.1.62", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", "@types/jest": "^27.5.1", @@ -74,6 +76,7 @@ "prettier": "^2.7.1", "prettier-plugin-packagejson": "^2.2.11", "rimraf": "^4.1.2", + "tsup": "^8.0.1", "typescript": "~4.8.4", "webpack": "^5.88.0" }, diff --git a/packages/snaps-webpack-plugin/tsconfig.json b/packages/snaps-webpack-plugin/tsconfig.json index b0bf6cc0b3..7fdd0d0331 100644 --- a/packages/snaps-webpack-plugin/tsconfig.json +++ b/packages/snaps-webpack-plugin/tsconfig.json @@ -3,7 +3,7 @@ "compilerOptions": { "baseUrl": "./" }, - "include": ["./src"], + "include": ["./src", "package.json", "tsup.config.ts"], "references": [ { "path": "../snaps-sdk" diff --git a/packages/snaps-webpack-plugin/tsup.config.ts b/packages/snaps-webpack-plugin/tsup.config.ts new file mode 100644 index 0000000000..ba676e6165 --- /dev/null +++ b/packages/snaps-webpack-plugin/tsup.config.ts @@ -0,0 +1,15 @@ +import deepmerge from 'deepmerge'; +import type { Options } from 'tsup'; + +import packageJson from './package.json'; + +// `tsup.config.ts` is not under `rootDir`, so we need to use `require` instead. +// eslint-disable-next-line @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires +const { default: baseConfig } = require('../../tsup.config'); + +const config: Options = { + name: packageJson.name, + external: ['@swc/core', 'pnpapi', 'uglify-js'], +}; + +export default deepmerge(baseConfig, config); diff --git a/packages/test-snaps/package.json b/packages/test-snaps/package.json index 45bf6d6f4a..1654e207d7 100644 --- a/packages/test-snaps/package.json +++ b/packages/test-snaps/package.json @@ -18,7 +18,6 @@ "start:test": "cross-env NODE_ENV=development webpack serve", "build": "cross-env NODE_ENV=production webpack", "build:clean": "yarn clean && yarn build", - "build:post-tsc": "yarn build", "clean": "rimraf 'dist'", "lint:eslint": "eslint . --cache --ext js,ts,jsx,tsx", "lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore", diff --git a/tsconfig.json b/tsconfig.json index 7842684d4f..39d06b3601 100644 --- a/tsconfig.json +++ b/tsconfig.json @@ -19,5 +19,5 @@ "resolveJsonModule": true }, "files": [], - "include": ["scripts"] + "include": ["scripts", "tsup.config.ts"] } diff --git a/tsup.config.ts b/tsup.config.ts new file mode 100644 index 0000000000..785addc8d6 --- /dev/null +++ b/tsup.config.ts @@ -0,0 +1,43 @@ +import type { Options } from 'tsup'; + +const config: Options = { + // The entry to bundle. + entry: [ + 'src/**/*.ts', + '!src/**/__fixtures__/**/*', + '!src/**/__mocks__/**/*', + '!src/**/__test__/**/*', + '!src/**/__tests__/**/*', + '!src/**/__snapshots__/**/*', + '!src/**/test-utils/**/*', + '!src/**/*.test.ts', + '!src/**/*.test-d.ts', + '!src/**/*.test.*.ts', + ], + + // The output formats. We want to generate both CommonJS and ESM bundles. + // https://tsup.egoist.dev/#bundle-formats + format: ['cjs', 'esm'], + + // Generate sourcemaps as separate files. + // https://tsup.egoist.dev/#generate-sourcemap-file + sourcemap: true, + + // Clean the dist folder before bundling. + clean: true, + + // Enables shimming of `__dirname` and `import.meta.url`, so that they work + // in both CommonJS and ESM. + // https://tsup.egoist.dev/#inject-cjs-and-esm-shims + shims: true, + + // Hide unnecessary logs from the console. Warnings and errors will still be + // shown. + silent: true, + + // Split the output into chunks. This is useful for tree-shaking. + // https://tsup.egoist.dev/#code-splitting + splitting: true, +}; + +export default config; diff --git a/yarn.lock b/yarn.lock index 940ac6dd62..d70b41a671 100644 --- a/yarn.lock +++ b/yarn.lock @@ -2843,6 +2843,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/aix-ppc64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/aix-ppc64@npm:0.19.11" + conditions: os=aix & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/android-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-arm64@npm:0.18.20" @@ -2850,6 +2857,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/android-arm64@npm:0.19.11" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/android-arm@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-arm@npm:0.18.20" @@ -2857,6 +2871,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-arm@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/android-arm@npm:0.19.11" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + "@esbuild/android-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/android-x64@npm:0.18.20" @@ -2864,6 +2885,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/android-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/android-x64@npm:0.19.11" + conditions: os=android & cpu=x64 + languageName: node + linkType: hard + "@esbuild/darwin-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/darwin-arm64@npm:0.18.20" @@ -2871,6 +2899,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-arm64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/darwin-arm64@npm:0.19.11" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/darwin-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/darwin-x64@npm:0.18.20" @@ -2878,6 +2913,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/darwin-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/darwin-x64@npm:0.19.11" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + "@esbuild/freebsd-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/freebsd-arm64@npm:0.18.20" @@ -2885,6 +2927,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-arm64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/freebsd-arm64@npm:0.19.11" + conditions: os=freebsd & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/freebsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/freebsd-x64@npm:0.18.20" @@ -2892,6 +2941,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/freebsd-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/freebsd-x64@npm:0.19.11" + conditions: os=freebsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/linux-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-arm64@npm:0.18.20" @@ -2899,6 +2955,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-arm64@npm:0.19.11" + conditions: os=linux & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/linux-arm@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-arm@npm:0.18.20" @@ -2906,6 +2969,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-arm@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-arm@npm:0.19.11" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + "@esbuild/linux-ia32@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-ia32@npm:0.18.20" @@ -2913,6 +2983,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ia32@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-ia32@npm:0.19.11" + conditions: os=linux & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/linux-loong64@npm:0.14.54": version: 0.14.54 resolution: "@esbuild/linux-loong64@npm:0.14.54" @@ -2927,6 +3004,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-loong64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-loong64@npm:0.19.11" + conditions: os=linux & cpu=loong64 + languageName: node + linkType: hard + "@esbuild/linux-mips64el@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-mips64el@npm:0.18.20" @@ -2934,6 +3018,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-mips64el@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-mips64el@npm:0.19.11" + conditions: os=linux & cpu=mips64el + languageName: node + linkType: hard + "@esbuild/linux-ppc64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-ppc64@npm:0.18.20" @@ -2941,6 +3032,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-ppc64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-ppc64@npm:0.19.11" + conditions: os=linux & cpu=ppc64 + languageName: node + linkType: hard + "@esbuild/linux-riscv64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-riscv64@npm:0.18.20" @@ -2948,6 +3046,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-riscv64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-riscv64@npm:0.19.11" + conditions: os=linux & cpu=riscv64 + languageName: node + linkType: hard + "@esbuild/linux-s390x@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-s390x@npm:0.18.20" @@ -2955,6 +3060,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-s390x@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-s390x@npm:0.19.11" + conditions: os=linux & cpu=s390x + languageName: node + linkType: hard + "@esbuild/linux-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/linux-x64@npm:0.18.20" @@ -2962,6 +3074,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/linux-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/linux-x64@npm:0.19.11" + conditions: os=linux & cpu=x64 + languageName: node + linkType: hard + "@esbuild/netbsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/netbsd-x64@npm:0.18.20" @@ -2969,6 +3088,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/netbsd-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/netbsd-x64@npm:0.19.11" + conditions: os=netbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/openbsd-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/openbsd-x64@npm:0.18.20" @@ -2976,6 +3102,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/openbsd-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/openbsd-x64@npm:0.19.11" + conditions: os=openbsd & cpu=x64 + languageName: node + linkType: hard + "@esbuild/sunos-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/sunos-x64@npm:0.18.20" @@ -2983,6 +3116,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/sunos-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/sunos-x64@npm:0.19.11" + conditions: os=sunos & cpu=x64 + languageName: node + linkType: hard + "@esbuild/win32-arm64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-arm64@npm:0.18.20" @@ -2990,6 +3130,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-arm64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/win32-arm64@npm:0.19.11" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + "@esbuild/win32-ia32@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-ia32@npm:0.18.20" @@ -2997,6 +3144,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-ia32@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/win32-ia32@npm:0.19.11" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + "@esbuild/win32-x64@npm:0.18.20": version: 0.18.20 resolution: "@esbuild/win32-x64@npm:0.18.20" @@ -3004,6 +3158,13 @@ __metadata: languageName: node linkType: hard +"@esbuild/win32-x64@npm:0.19.11": + version: 0.19.11 + resolution: "@esbuild/win32-x64@npm:0.19.11" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@eslint/eslintrc@npm:^1.3.3": version: 1.3.3 resolution: "@eslint/eslintrc@npm:1.3.3" @@ -4050,7 +4211,6 @@ __metadata: "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/snaps-utils": "workspace:^" "@metamask/utils": ^8.3.0 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/jest": ^27.5.1 @@ -4077,10 +4237,11 @@ __metadata: rimraf: ^4.1.2 ts-node: ^10.9.1 tsc-watch: ^4.5.0 + tsup: ^8.0.1 typescript: ~4.8.4 yargs: ^17.7.1 bin: - create-snap: ./dist/cjs/main.js + create-snap: ./dist/main.js languageName: unknown linkType: soft @@ -5172,7 +5333,6 @@ __metadata: "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/snaps-utils": "workspace:^" - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/browserify": ^12.0.37 @@ -5200,6 +5360,7 @@ __metadata: prettier-plugin-packagejson: ^2.2.11 readable-stream: ^3.6.2 rimraf: ^4.1.2 + tsup: ^8.0.1 typescript: ~4.8.4 languageName: unknown linkType: soft @@ -5226,7 +5387,6 @@ __metadata: "@metamask/snaps-utils": "workspace:^" "@metamask/snaps-webpack-plugin": "workspace:^" "@metamask/utils": ^8.3.0 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/browserify": ^12.0.37 @@ -5243,7 +5403,6 @@ __metadata: browserify-zlib: ^0.2.0 buffer: ^6.0.3 chalk: ^4.1.2 - chokidar: ^3.5.2 console-browserify: ^1.2.0 constants-browserify: ^1.0.0 cross-fetch: ^3.1.5 @@ -5287,6 +5446,7 @@ __metadata: timers-browserify: ^2.0.12 ts-node: ^10.9.1 tsc-watch: ^4.5.0 + tsup: ^8.0.1 tty-browserify: ^0.0.1 typescript: ~4.8.4 url: ^0.11.1 @@ -5296,7 +5456,7 @@ __metadata: webpack-merge: ^5.9.0 yargs: ^17.7.1 bin: - mm-snap: ./dist/cjs/main.js + mm-snap: ./dist/main.js languageName: unknown linkType: soft @@ -5326,7 +5486,6 @@ __metadata: "@metamask/snaps-utils": "workspace:^" "@metamask/template-snap": ^0.7.0 "@metamask/utils": ^8.3.0 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/chrome": ^0.0.237 @@ -5377,6 +5536,7 @@ __metadata: rimraf: ^4.1.2 tar-stream: ^3.1.7 ts-node: ^10.9.1 + tsup: ^8.0.1 typescript: ~4.8.4 vite: ^4.3.9 vite-tsconfig-paths: ^4.0.5 @@ -5416,7 +5576,6 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/utils": ^8.3.0 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/express": ^4.17.17 @@ -5463,6 +5622,7 @@ __metadata: superstruct: ^1.0.3 terser: ^5.17.7 ts-node: ^10.9.1 + tsup: ^8.0.1 typescript: ~4.8.4 vite: ^4.3.9 vite-tsconfig-paths: ^4.0.5 @@ -5500,7 +5660,6 @@ __metadata: "@metamask/snaps-utils": "workspace:^" "@metamask/utils": ^8.3.0 "@reduxjs/toolkit": ^1.9.5 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/jest": ^27.5.1 @@ -5529,6 +5688,7 @@ __metadata: redux-saga: ^1.2.3 rimraf: ^4.1.2 superstruct: ^1.0.3 + tsup: ^8.0.1 typescript: ~4.8.4 languageName: unknown linkType: soft @@ -5557,7 +5717,6 @@ __metadata: "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/snaps-utils": "workspace:^" "@rollup/plugin-virtual": ^2.1.0 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/jest": ^27.5.1 @@ -5580,6 +5739,7 @@ __metadata: prettier-plugin-packagejson: ^2.2.11 rimraf: ^4.1.2 rollup: ^2.73.0 + tsup: ^8.0.1 typescript: ~4.8.4 languageName: unknown linkType: soft @@ -5603,7 +5763,6 @@ __metadata: "@metamask/snaps-utils": "workspace:^" "@metamask/utils": ^8.3.0 "@noble/hashes": ^1.3.1 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/node": 18.14.2 @@ -5625,6 +5784,7 @@ __metadata: prettier-plugin-packagejson: ^2.2.11 rimraf: ^4.1.2 superstruct: ^1.0.3 + tsup: ^8.0.1 typescript: ~4.8.4 languageName: unknown linkType: soft @@ -5643,7 +5803,6 @@ __metadata: "@metamask/providers": ^14.0.2 "@metamask/rpc-errors": ^6.1.0 "@metamask/utils": ^8.3.0 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@types/jest": ^27.5.1 "@typescript-eslint/eslint-plugin": ^5.42.1 @@ -5668,6 +5827,7 @@ __metadata: rimraf: ^4.1.2 superstruct: ^1.0.3 ts-jest: ^29.1.1 + tsup: ^8.0.1 typescript: ~4.8.4 languageName: unknown linkType: soft @@ -5704,7 +5864,6 @@ __metadata: "@redux-saga/is": ^1.1.3 "@redux-saga/symbols": ^1.1.3 "@reduxjs/toolkit": ^1.9.5 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@testing-library/react": ^14.0.0 "@types/express": ^4.17.17 @@ -5768,6 +5927,7 @@ __metadata: terser-webpack-plugin: ^5.3.9 ts-node: ^10.9.1 tsconfig-paths-webpack-plugin: ^4.0.1 + tsup: ^8.0.1 typescript: ~4.8.4 webpack: ^5.88.0 webpack-cli: ^5.1.4 @@ -5801,7 +5961,6 @@ __metadata: "@metamask/utils": ^8.3.0 "@noble/hashes": ^1.3.1 "@scure/base": ^1.1.1 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/jest": ^27.5.1 @@ -5847,6 +6006,7 @@ __metadata: ses: ^1.1.0 superstruct: ^1.0.3 ts-node: ^10.9.1 + tsup: ^8.0.1 typescript: ~4.8.4 validate-npm-package-name: ^5.0.0 vite: ^4.3.9 @@ -5870,7 +6030,6 @@ __metadata: "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/utils": ^8.3.0 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@swc/jest": ^0.2.26 "@types/jest": ^27.5.1 @@ -5893,6 +6052,7 @@ __metadata: prettier: ^2.7.1 prettier-plugin-packagejson: ^2.2.11 rimraf: ^4.1.2 + tsup: ^8.0.1 typescript: ~4.8.4 webpack: ^5.88.0 webpack-sources: ^3.2.3 @@ -6118,22 +6278,6 @@ __metadata: languageName: node linkType: hard -"@mole-inc/bin-wrapper@npm:^8.0.1": - version: 8.0.1 - resolution: "@mole-inc/bin-wrapper@npm:8.0.1" - dependencies: - bin-check: ^4.1.0 - bin-version-check: ^5.0.0 - content-disposition: ^0.5.4 - ext-name: ^5.0.0 - file-type: ^17.1.6 - filenamify: ^5.0.2 - got: ^11.8.5 - os-filter-obj: ^2.0.0 - checksum: 696bf652d37732d46d6b48c5a741f07958c2144df5b4a4bef3a235582e84e3687184cfa139c0e12443d03f123869819a0b7f2a7b0edc23daaebb94d70cc2e56c - languageName: node - linkType: hard - "@motionone/animation@npm:^10.12.0": version: 10.15.1 resolution: "@motionone/animation@npm:10.15.1" @@ -6740,6 +6884,97 @@ __metadata: languageName: node linkType: hard +"@rollup/rollup-android-arm-eabi@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-android-arm-eabi@npm:4.9.6" + conditions: os=android & cpu=arm + languageName: node + linkType: hard + +"@rollup/rollup-android-arm64@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-android-arm64@npm:4.9.6" + conditions: os=android & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-arm64@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-darwin-arm64@npm:4.9.6" + conditions: os=darwin & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-darwin-x64@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-darwin-x64@npm:4.9.6" + conditions: os=darwin & cpu=x64 + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm-gnueabihf@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-linux-arm-gnueabihf@npm:4.9.6" + conditions: os=linux & cpu=arm + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-gnu@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-linux-arm64-gnu@npm:4.9.6" + conditions: os=linux & cpu=arm64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-arm64-musl@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-linux-arm64-musl@npm:4.9.6" + conditions: os=linux & cpu=arm64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-linux-riscv64-gnu@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-linux-riscv64-gnu@npm:4.9.6" + conditions: os=linux & cpu=riscv64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-gnu@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-linux-x64-gnu@npm:4.9.6" + conditions: os=linux & cpu=x64 & libc=glibc + languageName: node + linkType: hard + +"@rollup/rollup-linux-x64-musl@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-linux-x64-musl@npm:4.9.6" + conditions: os=linux & cpu=x64 & libc=musl + languageName: node + linkType: hard + +"@rollup/rollup-win32-arm64-msvc@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-win32-arm64-msvc@npm:4.9.6" + conditions: os=win32 & cpu=arm64 + languageName: node + linkType: hard + +"@rollup/rollup-win32-ia32-msvc@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-win32-ia32-msvc@npm:4.9.6" + conditions: os=win32 & cpu=ia32 + languageName: node + linkType: hard + +"@rollup/rollup-win32-x64-msvc@npm:4.9.6": + version: 4.9.6 + resolution: "@rollup/rollup-win32-x64-msvc@npm:4.9.6" + conditions: os=win32 & cpu=x64 + languageName: node + linkType: hard + "@scure/base@npm:^1.0.0, @scure/base@npm:^1.1.1, @scure/base@npm:^1.1.3, @scure/base@npm:~1.1.0, @scure/base@npm:~1.1.3": version: 1.1.3 resolution: "@scure/base@npm:1.1.3" @@ -6809,30 +7044,6 @@ __metadata: languageName: node linkType: hard -"@swc/cli@npm:^0.1.62": - version: 0.1.62 - resolution: "@swc/cli@npm:0.1.62" - dependencies: - "@mole-inc/bin-wrapper": ^8.0.1 - commander: ^7.1.0 - fast-glob: ^3.2.5 - semver: ^7.3.8 - slash: 3.0.0 - source-map: ^0.7.3 - peerDependencies: - "@swc/core": ^1.2.66 - chokidar: ^3.5.1 - peerDependenciesMeta: - chokidar: - optional: true - bin: - spack: bin/spack.js - swc: bin/swc.js - swcx: bin/swcx.js - checksum: d44e88a724ba32d4f63856f15899f8eff78d90d0c5452e4882412307bf6353a64b25e7dc9992fd6e3975c87e6c0d7b494d859a0d8badb9f3c6103623ca89ddc2 - languageName: node - linkType: hard - "@swc/core-darwin-arm64@npm:1.3.78": version: 1.3.78 resolution: "@swc/core-darwin-arm64@npm:1.3.78" @@ -7014,13 +7225,6 @@ __metadata: languageName: node linkType: hard -"@tokenizer/token@npm:^0.3.0": - version: 0.3.0 - resolution: "@tokenizer/token@npm:0.3.0" - checksum: 1d575d02d2a9f0c5a4ca5180635ebd2ad59e0f18b42a65f3d04844148b49b3db35cf00b6012a1af2d59c2ab3caca59451c5689f747ba8667ee586ad717ee58e1 - languageName: node - linkType: hard - "@tootallnate/once@npm:2": version: 2.0.0 resolution: "@tootallnate/once@npm:2.0.0" @@ -7230,10 +7434,10 @@ __metadata: languageName: node linkType: hard -"@types/estree@npm:*, @types/estree@npm:^1.0.0": - version: 1.0.1 - resolution: "@types/estree@npm:1.0.1" - checksum: e9aa175eacb797216fafce4d41e8202c7a75555bc55232dee0f9903d7171f8f19f0ae7d5191bb1a88cb90e65468be508c0df850a9fb81b4433b293a5a749899d +"@types/estree@npm:*, @types/estree@npm:1.0.5, @types/estree@npm:^1.0.0": + version: 1.0.5 + resolution: "@types/estree@npm:1.0.5" + checksum: dd8b5bed28e6213b7acd0fb665a84e693554d850b0df423ac8076cc3ad5823a6bc26b0251d080bdc545af83179ede51dd3f6fa78cad2c46ed1f29624ddf3e41a languageName: node linkType: hard @@ -8830,6 +9034,13 @@ __metadata: languageName: node linkType: hard +"any-promise@npm:^1.0.0": + version: 1.3.0 + resolution: "any-promise@npm:1.3.0" + checksum: 0ee8a9bdbe882c90464d75d1f55cf027f5458650c4bd1f0467e65aec38ccccda07ca5844969ee77ed46d04e7dded3eaceb027e8d32f385688523fe305fa7e1de + languageName: node + linkType: hard + "anymatch@npm:^3.0.3, anymatch@npm:~3.1.2": version: 3.1.2 resolution: "anymatch@npm:3.1.2" @@ -8854,13 +9065,6 @@ __metadata: languageName: node linkType: hard -"arch@npm:^2.1.0": - version: 2.2.0 - resolution: "arch@npm:2.2.0" - checksum: e21b7635029fe8e9cdd5a026f9a6c659103e63fff423834323cdf836a1bb240a72d0c39ca8c470f84643385cf581bd8eda2cad8bf493e27e54bd9783abe9101f - languageName: node - linkType: hard - "archiver-utils@npm:^4.0.1": version: 4.0.1 resolution: "archiver-utils@npm:4.0.1" @@ -9398,16 +9602,6 @@ __metadata: languageName: node linkType: hard -"bin-check@npm:^4.1.0": - version: 4.1.0 - resolution: "bin-check@npm:4.1.0" - dependencies: - execa: ^0.7.0 - executable: ^4.1.0 - checksum: 16f6d5d86df9365dab682c7dd238f93678b773a908b3bccea4b1acb82b9b4e49fcfa24c99b99180a8e4cdd89a8f15f03700b09908ed5ae651f52fd82488a3507 - languageName: node - linkType: hard - "bin-links@npm:4.0.3": version: 4.0.3 resolution: "bin-links@npm:4.0.3" @@ -9420,27 +9614,6 @@ __metadata: languageName: node linkType: hard -"bin-version-check@npm:^5.0.0": - version: 5.0.0 - resolution: "bin-version-check@npm:5.0.0" - dependencies: - bin-version: ^6.0.0 - semver: ^7.3.5 - semver-truncate: ^2.0.0 - checksum: 1d3dc92847f8ecd5e07109f5f44727f0cb3b17c00be5ae2a2e105b86bf161bc4e5c10ee2e2c21d5d28e6382994d8416b5e06048191a485be909a1e49a959c3c3 - languageName: node - linkType: hard - -"bin-version@npm:^6.0.0": - version: 6.0.0 - resolution: "bin-version@npm:6.0.0" - dependencies: - execa: ^5.0.0 - find-versions: ^5.0.0 - checksum: 78c29422ea9597eb4c8d4f0eff96df60d09aa82b53a87925bc403efbe5c55251b1a07baac538381d9096377f92d27e3c03963efa86db5bc0d6431b9563946229 - languageName: node - linkType: hard - "binary-extensions@npm:^2.0.0": version: 2.2.0 resolution: "binary-extensions@npm:2.2.0" @@ -9909,6 +10082,17 @@ __metadata: languageName: node linkType: hard +"bundle-require@npm:^4.0.0": + version: 4.0.2 + resolution: "bundle-require@npm:4.0.2" + dependencies: + load-tsconfig: ^0.2.3 + peerDependencies: + esbuild: ">=0.17" + checksum: 13a78ac0aee0f33614c24f2747167c7faebef6c9d1d5453b464fc85fa164a3a3aab657b2b31b7b5d2a088e4958676fef0454328ff7baddd6bfb03a8ff8d8b928 + languageName: node + linkType: hard + "bytes@npm:3.0.0": version: 3.0.0 resolution: "bytes@npm:3.0.0" @@ -9938,6 +10122,13 @@ __metadata: languageName: node linkType: hard +"cac@npm:^6.7.12": + version: 6.7.14 + resolution: "cac@npm:6.7.14" + checksum: 45a2496a9443abbe7f52a49b22fbe51b1905eff46e03fd5e6c98e3f85077be3f8949685a1849b1a9cd2bc3e5567dfebcf64f01ce01847baf918f1b37c839791a + languageName: node + linkType: hard + "cacache@npm:^16.0.2": version: 16.0.7 resolution: "cacache@npm:16.0.7" @@ -10172,7 +10363,7 @@ __metadata: languageName: node linkType: hard -"chokidar@npm:3.5.3, chokidar@npm:^3.5.2, chokidar@npm:^3.5.3": +"chokidar@npm:3.5.3, chokidar@npm:^3.5.1, chokidar@npm:^3.5.3": version: 3.5.3 resolution: "chokidar@npm:3.5.3" dependencies: @@ -10528,10 +10719,10 @@ __metadata: languageName: node linkType: hard -"commander@npm:^7.1.0": - version: 7.2.0 - resolution: "commander@npm:7.2.0" - checksum: 53501cbeee61d5157546c0bef0fedb6cdfc763a882136284bed9a07225f09a14b82d2a84e7637edfd1a679fb35ed9502fd58ef1d091e6287f60d790147f68ddc +"commander@npm:^4.0.0": + version: 4.1.1 + resolution: "commander@npm:4.1.1" + checksum: d7b9913ff92cae20cb577a4ac6fcc121bd6223319e54a40f51a14740a681ad5c574fd29a57da478a5f234a6fa6c52cbf0b7c641353e03c648b1ae85ba670b977 languageName: node linkType: hard @@ -10686,7 +10877,7 @@ __metadata: languageName: node linkType: hard -"content-disposition@npm:0.5.4, content-disposition@npm:^0.5.4": +"content-disposition@npm:0.5.4": version: 0.5.4 resolution: "content-disposition@npm:0.5.4" dependencies: @@ -10910,17 +11101,6 @@ __metadata: languageName: node linkType: hard -"cross-spawn@npm:^5.0.1": - version: 5.1.0 - resolution: "cross-spawn@npm:5.1.0" - dependencies: - lru-cache: ^4.0.1 - shebang-command: ^1.2.0 - which: ^1.2.9 - checksum: 726939c9954fc70c20e538923feaaa33bebc253247d13021737c3c7f68cdc3e0a57f720c0fe75057c0387995349f3f12e20e9bfdbf12274db28019c7ea4ec166 - languageName: node - linkType: hard - "cross-spawn@npm:^7.0.0, cross-spawn@npm:^7.0.1, cross-spawn@npm:^7.0.2, cross-spawn@npm:^7.0.3": version: 7.0.3 resolution: "cross-spawn@npm:7.0.3" @@ -12309,6 +12489,86 @@ __metadata: languageName: node linkType: hard +"esbuild@npm:^0.19.2": + version: 0.19.11 + resolution: "esbuild@npm:0.19.11" + dependencies: + "@esbuild/aix-ppc64": 0.19.11 + "@esbuild/android-arm": 0.19.11 + "@esbuild/android-arm64": 0.19.11 + "@esbuild/android-x64": 0.19.11 + "@esbuild/darwin-arm64": 0.19.11 + "@esbuild/darwin-x64": 0.19.11 + "@esbuild/freebsd-arm64": 0.19.11 + "@esbuild/freebsd-x64": 0.19.11 + "@esbuild/linux-arm": 0.19.11 + "@esbuild/linux-arm64": 0.19.11 + "@esbuild/linux-ia32": 0.19.11 + "@esbuild/linux-loong64": 0.19.11 + "@esbuild/linux-mips64el": 0.19.11 + "@esbuild/linux-ppc64": 0.19.11 + "@esbuild/linux-riscv64": 0.19.11 + "@esbuild/linux-s390x": 0.19.11 + "@esbuild/linux-x64": 0.19.11 + "@esbuild/netbsd-x64": 0.19.11 + "@esbuild/openbsd-x64": 0.19.11 + "@esbuild/sunos-x64": 0.19.11 + "@esbuild/win32-arm64": 0.19.11 + "@esbuild/win32-ia32": 0.19.11 + "@esbuild/win32-x64": 0.19.11 + dependenciesMeta: + "@esbuild/aix-ppc64": + optional: true + "@esbuild/android-arm": + optional: true + "@esbuild/android-arm64": + optional: true + "@esbuild/android-x64": + optional: true + "@esbuild/darwin-arm64": + optional: true + "@esbuild/darwin-x64": + optional: true + "@esbuild/freebsd-arm64": + optional: true + "@esbuild/freebsd-x64": + optional: true + "@esbuild/linux-arm": + optional: true + "@esbuild/linux-arm64": + optional: true + "@esbuild/linux-ia32": + optional: true + "@esbuild/linux-loong64": + optional: true + "@esbuild/linux-mips64el": + optional: true + "@esbuild/linux-ppc64": + optional: true + "@esbuild/linux-riscv64": + optional: true + "@esbuild/linux-s390x": + optional: true + "@esbuild/linux-x64": + optional: true + "@esbuild/netbsd-x64": + optional: true + "@esbuild/openbsd-x64": + optional: true + "@esbuild/sunos-x64": + optional: true + "@esbuild/win32-arm64": + optional: true + "@esbuild/win32-ia32": + optional: true + "@esbuild/win32-x64": + optional: true + bin: + esbuild: bin/esbuild + checksum: ae949a796d1d06b55275ae7491ce137857468f69a93d8cc9c0943d2a701ac54e14dbb250a2ba56f2ad98283669578f1ec3bd85a4681910a5ff29a2470c3bd62c + languageName: node + linkType: hard + "escalade@npm:^3.1.1": version: 3.1.1 resolution: "escalade@npm:3.1.1" @@ -12879,21 +13139,6 @@ __metadata: languageName: node linkType: hard -"execa@npm:^0.7.0": - version: 0.7.0 - resolution: "execa@npm:0.7.0" - dependencies: - cross-spawn: ^5.0.1 - get-stream: ^3.0.0 - is-stream: ^1.1.0 - npm-run-path: ^2.0.0 - p-finally: ^1.0.0 - signal-exit: ^3.0.0 - strip-eof: ^1.0.0 - checksum: dd70206d74b7217bf678ec9f04dddedc82f425df4c1d70e34c9f429d630ec407819e4bd42e3af2618981a4a3a1be000c9b651c0637be486cdab985160c20337c - languageName: node - linkType: hard - "execa@npm:^5.0.0, execa@npm:^5.1.1": version: 5.1.1 resolution: "execa@npm:5.1.1" @@ -12928,15 +13173,6 @@ __metadata: languageName: node linkType: hard -"executable@npm:^4.1.0": - version: 4.1.1 - resolution: "executable@npm:4.1.1" - dependencies: - pify: ^2.2.0 - checksum: f01927ce59bccec804e171bf859a26e362c1f50aa9ebc69f7cafdcce3859d29d4b6267fd47237c18b0a1830614bd3f0ee14b7380d9bad18a4e7af9b5f0b6984f - languageName: node - linkType: hard - "exit@npm:^0.1.2": version: 0.1.2 resolution: "exit@npm:0.1.2" @@ -13044,25 +13280,6 @@ __metadata: languageName: node linkType: hard -"ext-list@npm:^2.0.0": - version: 2.2.2 - resolution: "ext-list@npm:2.2.2" - dependencies: - mime-db: ^1.28.0 - checksum: 9b2426bea312e674eeced62c5f18407ab9a8653bbdfbde36492331c7973dab7fbf9e11d6c38605786168b42da333910314988097ca06eee61f1b9b57efae3f18 - languageName: node - linkType: hard - -"ext-name@npm:^5.0.0": - version: 5.0.0 - resolution: "ext-name@npm:5.0.0" - dependencies: - ext-list: ^2.0.0 - sort-keys-length: ^1.0.0 - checksum: f598269bd5de4295540ea7d6f8f6a01d82a7508f148b7700a05628ef6121648d26e6e5e942049e953b3051863df6b54bd8fe951e7877f185e34ace5d44370b33 - languageName: node - linkType: hard - "extend@npm:^3.0.0": version: 3.0.2 resolution: "extend@npm:3.0.2" @@ -13136,7 +13353,7 @@ __metadata: languageName: node linkType: hard -"fast-glob@npm:^3.0.3, fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.5, fast-glob@npm:^3.2.9": +"fast-glob@npm:^3.0.3, fast-glob@npm:^3.2.11, fast-glob@npm:^3.2.9": version: 3.2.12 resolution: "fast-glob@npm:3.2.12" dependencies: @@ -13291,17 +13508,6 @@ __metadata: languageName: node linkType: hard -"file-type@npm:^17.1.6": - version: 17.1.6 - resolution: "file-type@npm:17.1.6" - dependencies: - readable-web-to-node-stream: ^3.0.2 - strtok3: ^7.0.0-alpha.9 - token-types: ^5.0.0-alpha.2 - checksum: 797e0d155ecaf4b575d4569a0188bfed85af19d18cf3d93ec8bb66d797172a1fde9f13d56135c6a0b471cacd7ecc1adb0c9a45c6e3a19436f682a275d0be16cc - languageName: node - linkType: hard - "file-uri-to-path@npm:1.0.0": version: 1.0.0 resolution: "file-uri-to-path@npm:1.0.0" @@ -13318,24 +13524,6 @@ __metadata: languageName: node linkType: hard -"filename-reserved-regex@npm:^3.0.0": - version: 3.0.0 - resolution: "filename-reserved-regex@npm:3.0.0" - checksum: 1803e19ce64d7cb88ee5a1bd3ce282470a5c263987269222426d889049fc857e302284fa71937de9582eba7a9f39539557d45e0562f2fa51cade8efc68c65dd9 - languageName: node - linkType: hard - -"filenamify@npm:^5.0.2": - version: 5.1.1 - resolution: "filenamify@npm:5.1.1" - dependencies: - filename-reserved-regex: ^3.0.0 - strip-outer: ^2.0.0 - trim-repeated: ^2.0.0 - checksum: 55a7ed0858eb2655bb1bb1e945a59e3fb30ba4767f6924fa064ccd731bff07678aac3cb4f3899ae0e1621fe81d6472b5688232bb6afd4eeb989ade785fc1c6f1 - languageName: node - linkType: hard - "fill-range@npm:^7.0.1": version: 7.0.1 resolution: "fill-range@npm:7.0.1" @@ -13426,15 +13614,6 @@ __metadata: languageName: node linkType: hard -"find-versions@npm:^5.0.0": - version: 5.1.0 - resolution: "find-versions@npm:5.1.0" - dependencies: - semver-regex: ^4.0.5 - checksum: 680bdb0081f631f7bfb6f0f8edcfa0b74ab8cabc82097a4527a37b0d042aabc56685bf459ff27991eab0baddc04eb8e3bba8a2869f5004ecf7cdd2779b6e51de - languageName: node - linkType: hard - "findup-sync@npm:^5.0.0": version: 5.0.0 resolution: "findup-sync@npm:5.0.0" @@ -13872,13 +14051,6 @@ __metadata: languageName: node linkType: hard -"get-stream@npm:^3.0.0": - version: 3.0.0 - resolution: "get-stream@npm:3.0.0" - checksum: 36142f46005ed74ce3a45c55545ec4e7da8e243554179e345a786baf144e5c4a35fb7bdc49fadfa9f18bd08000589b6fe364abdadfc4e1eb0e1b9914a6bb9c56 - languageName: node - linkType: hard - "get-stream@npm:^5.1.0": version: 5.2.0 resolution: "get-stream@npm:5.2.0" @@ -14096,7 +14268,7 @@ __metadata: languageName: node linkType: hard -"globby@npm:^11.1.0": +"globby@npm:^11.0.3, globby@npm:^11.1.0": version: 11.1.0 resolution: "globby@npm:11.1.0" dependencies: @@ -15160,13 +15332,6 @@ __metadata: languageName: node linkType: hard -"is-plain-obj@npm:^1.0.0": - version: 1.1.0 - resolution: "is-plain-obj@npm:1.1.0" - checksum: 0ee04807797aad50859652a7467481816cbb57e5cc97d813a7dcd8915da8195dc68c436010bf39d195226cde6a2d352f4b815f16f26b7bf486a5754290629931 - languageName: node - linkType: hard - "is-plain-obj@npm:^3.0.0": version: 3.0.0 resolution: "is-plain-obj@npm:3.0.0" @@ -15232,13 +15397,6 @@ __metadata: languageName: node linkType: hard -"is-stream@npm:^1.1.0": - version: 1.1.0 - resolution: "is-stream@npm:1.1.0" - checksum: 063c6bec9d5647aa6d42108d4c59723d2bd4ae42135a2d4db6eadbd49b7ea05b750fd69d279e5c7c45cf9da753ad2c00d8978be354d65aa9f6bb434969c6a2ae - languageName: node - linkType: hard - "is-stream@npm:^2.0.0": version: 2.0.0 resolution: "is-stream@npm:2.0.0" @@ -16045,6 +16203,13 @@ __metadata: languageName: node linkType: hard +"joycon@npm:^3.0.1": + version: 3.1.1 + resolution: "joycon@npm:3.1.1" + checksum: 8003c9c3fc79c5c7602b1c7e9f7a2df2e9916f046b0dbad862aa589be78c15734d11beb9fe846f5e06138df22cb2ad29961b6a986ba81c4920ce2b15a7f11067 + languageName: node + linkType: hard + "js-sdsl@npm:^4.1.4": version: 4.1.5 resolution: "js-sdsl@npm:4.1.5" @@ -16532,6 +16697,13 @@ __metadata: languageName: node linkType: hard +"lilconfig@npm:^3.0.0": + version: 3.0.0 + resolution: "lilconfig@npm:3.0.0" + checksum: a155f1cd24d324ab20dd6974db9ebcf3fb6f2b60175f7c052d917ff8a746b590bc1ee550f6fc3cb1e8716c8b58304e22fe2193febebc0cf16fa86d85e6f896c5 + languageName: node + linkType: hard + "lines-and-columns@npm:^1.1.6": version: 1.1.6 resolution: "lines-and-columns@npm:1.1.6" @@ -16611,6 +16783,13 @@ __metadata: languageName: node linkType: hard +"load-tsconfig@npm:^0.2.3": + version: 0.2.5 + resolution: "load-tsconfig@npm:0.2.5" + checksum: 631740833c4a7157bb7b6eeae6e1afb6a6fac7416b7ba91bd0944d5c5198270af2d68bf8347af3cc2ba821adc4d83ef98f66278bd263bc284c863a09ec441503 + languageName: node + linkType: hard + "loader-runner@npm:^4.2.0": version: 4.2.0 resolution: "loader-runner@npm:4.2.0" @@ -16754,6 +16933,13 @@ __metadata: languageName: node linkType: hard +"lodash.sortby@npm:^4.7.0": + version: 4.7.0 + resolution: "lodash.sortby@npm:4.7.0" + checksum: db170c9396d29d11fe9a9f25668c4993e0c1331bcb941ddbd48fb76f492e732add7f2a47cfdf8e9d740fa59ac41bbfaf931d268bc72aab3ab49e9f89354d718c + languageName: node + linkType: hard + "lodash.union@npm:^4.6.0": version: 4.6.0 resolution: "lodash.union@npm:4.6.0" @@ -16846,9 +17032,9 @@ __metadata: linkType: hard "lru-cache@npm:^10.0.1, lru-cache@npm:^9.1.1 || ^10.0.0": - version: 10.2.0 - resolution: "lru-cache@npm:10.2.0" - checksum: eee7ddda4a7475deac51ac81d7dd78709095c6fa46e8350dc2d22462559a1faa3b81ed931d5464b13d48cbd7e08b46100b6f768c76833912bc444b99c37e25db + version: 10.1.0 + resolution: "lru-cache@npm:10.1.0" + checksum: 58056d33e2500fbedce92f8c542e7c11b50d7d086578f14b7074d8c241422004af0718e08a6eaae8705cee09c77e39a61c1c79e9370ba689b7010c152e6a76ab languageName: node linkType: hard @@ -17176,7 +17362,7 @@ __metadata: languageName: node linkType: hard -"mime-db@npm:1.52.0, mime-db@npm:>= 1.43.0 < 2, mime-db@npm:^1.28.0": +"mime-db@npm:1.52.0, mime-db@npm:>= 1.43.0 < 2": version: 1.52.0 resolution: "mime-db@npm:1.52.0" checksum: 0d99a03585f8b39d68182803b12ac601d9c01abfa28ec56204fa330bc9f3d1c5e14beb049bafadb3dbdf646dfb94b87e24d4ec7b31b7279ef906a8ea9b6a513f @@ -17639,6 +17825,17 @@ __metadata: languageName: node linkType: hard +"mz@npm:^2.7.0": + version: 2.7.0 + resolution: "mz@npm:2.7.0" + dependencies: + any-promise: ^1.0.0 + object-assign: ^4.0.1 + thenify-all: ^1.0.0 + checksum: 8427de0ece99a07e9faed3c0c6778820d7543e3776f9a84d22cf0ec0a8eb65f6e9aee9c9d353ff9a105ff62d33a9463c6ca638974cc652ee8140cd1e35951c87 + languageName: node + linkType: hard + "n12@npm:0.4.0": version: 0.4.0 resolution: "n12@npm:0.4.0" @@ -17954,15 +18151,6 @@ __metadata: languageName: node linkType: hard -"npm-run-path@npm:^2.0.0": - version: 2.0.2 - resolution: "npm-run-path@npm:2.0.2" - dependencies: - path-key: ^2.0.0 - checksum: acd5ad81648ba4588ba5a8effb1d98d2b339d31be16826a118d50f182a134ac523172101b82eab1d01cb4c2ba358e857d54cfafd8163a1ffe7bd52100b741125 - languageName: node - linkType: hard - "npm-run-path@npm:^4.0.1": version: 4.0.1 resolution: "npm-run-path@npm:4.0.1" @@ -18019,7 +18207,7 @@ __metadata: languageName: node linkType: hard -"object-assign@npm:^4.1.1": +"object-assign@npm:^4.0.1, object-assign@npm:^4.1.1": version: 4.1.1 resolution: "object-assign@npm:4.1.1" checksum: fcc6e4ea8c7fe48abfbb552578b1c53e0d194086e2e6bbbf59e0a536381a292f39943c6e9628af05b5528aa5e3318bb30d6b2e53cadaf5b8fe9e12c4b69af23f @@ -18213,15 +18401,6 @@ __metadata: languageName: node linkType: hard -"os-filter-obj@npm:^2.0.0": - version: 2.0.0 - resolution: "os-filter-obj@npm:2.0.0" - dependencies: - arch: ^2.1.0 - checksum: 08808a109b2dba9be8686cc006e082a0f6595e6d87e2a30e4147cb1d22b62a30a6e5f4fd78226aee76d9158c84db3cea292adec02e6591452e93cb33bf5da877 - languageName: node - linkType: hard - "os-tmpdir@npm:~1.0.2": version: 1.0.2 resolution: "os-tmpdir@npm:1.0.2" @@ -18236,13 +18415,6 @@ __metadata: languageName: node linkType: hard -"p-finally@npm:^1.0.0": - version: 1.0.0 - resolution: "p-finally@npm:1.0.0" - checksum: 93a654c53dc805dd5b5891bab16eb0ea46db8f66c4bfd99336ae929323b1af2b70a8b0654f8f1eae924b2b73d037031366d645f1fd18b3d30cbd15950cc4b1d4 - languageName: node - linkType: hard - "p-limit@npm:^2.0.0, p-limit@npm:^2.2.0": version: 2.3.0 resolution: "p-limit@npm:2.3.0" @@ -18554,13 +18726,6 @@ __metadata: languageName: node linkType: hard -"path-key@npm:^2.0.0": - version: 2.0.1 - resolution: "path-key@npm:2.0.1" - checksum: f7ab0ad42fe3fb8c7f11d0c4f849871e28fbd8e1add65c370e422512fc5887097b9cf34d09c1747d45c942a8c1e26468d6356e2df3f740bf177ab8ca7301ebfd - languageName: node - linkType: hard - "path-key@npm:^3.0.0, path-key@npm:^3.1.0": version: 3.1.1 resolution: "path-key@npm:3.1.1" @@ -18660,13 +18825,6 @@ __metadata: languageName: node linkType: hard -"peek-readable@npm:^5.0.0": - version: 5.0.0 - resolution: "peek-readable@npm:5.0.0" - checksum: bef5ceb50586eb42e14efba274ac57ffe97f0ed272df9239ce029f688f495d9bf74b2886fa27847c706a9db33acda4b7d23bbd09a2d21eb4c2a54da915117414 - languageName: node - linkType: hard - "pend@npm:~1.2.0": version: 1.2.0 resolution: "pend@npm:1.2.0" @@ -18704,7 +18862,7 @@ __metadata: languageName: node linkType: hard -"pify@npm:^2.0.0, pify@npm:^2.2.0": +"pify@npm:^2.0.0": version: 2.3.0 resolution: "pify@npm:2.3.0" checksum: 9503aaeaf4577acc58642ad1d25c45c6d90288596238fb68f82811c08104c800e5a7870398e9f015d82b44ecbcbef3dc3d4251a1cbb582f6e5959fe09884b2ba @@ -18727,10 +18885,10 @@ __metadata: languageName: node linkType: hard -"pirates@npm:^4.0.4": - version: 4.0.5 - resolution: "pirates@npm:4.0.5" - checksum: c9994e61b85260bec6c4fc0307016340d9b0c4f4b6550a957afaaff0c9b1ad58fbbea5cfcf083860a25cb27a375442e2b0edf52e2e1e40e69934e08dcc52d227 +"pirates@npm:^4.0.1, pirates@npm:^4.0.4": + version: 4.0.6 + resolution: "pirates@npm:4.0.6" + checksum: 46a65fefaf19c6f57460388a5af9ab81e3d7fd0e7bc44ca59d753cb5c4d0df97c6c6e583674869762101836d68675f027d60f841c105d72734df9dfca97cbcc6 languageName: node linkType: hard @@ -18791,6 +18949,24 @@ __metadata: languageName: node linkType: hard +"postcss-load-config@npm:^4.0.1": + version: 4.0.2 + resolution: "postcss-load-config@npm:4.0.2" + dependencies: + lilconfig: ^3.0.0 + yaml: ^2.3.4 + peerDependencies: + postcss: ">=8.0.9" + ts-node: ">=9.0.0" + peerDependenciesMeta: + postcss: + optional: true + ts-node: + optional: true + checksum: 7c27dd3801db4eae207a5116fed2db6b1ebb780b40c3dd62a3e57e087093a8e6a14ee17ada729fee903152d6ef4826c6339eb135bee6208e0f3140d7e8090185 + languageName: node + linkType: hard + "postcss-modules-extract-imports@npm:^3.0.0": version: 3.0.0 resolution: "postcss-modules-extract-imports@npm:3.0.0" @@ -20261,6 +20437,60 @@ __metadata: languageName: node linkType: hard +"rollup@npm:^4.0.2": + version: 4.9.6 + resolution: "rollup@npm:4.9.6" + dependencies: + "@rollup/rollup-android-arm-eabi": 4.9.6 + "@rollup/rollup-android-arm64": 4.9.6 + "@rollup/rollup-darwin-arm64": 4.9.6 + "@rollup/rollup-darwin-x64": 4.9.6 + "@rollup/rollup-linux-arm-gnueabihf": 4.9.6 + "@rollup/rollup-linux-arm64-gnu": 4.9.6 + "@rollup/rollup-linux-arm64-musl": 4.9.6 + "@rollup/rollup-linux-riscv64-gnu": 4.9.6 + "@rollup/rollup-linux-x64-gnu": 4.9.6 + "@rollup/rollup-linux-x64-musl": 4.9.6 + "@rollup/rollup-win32-arm64-msvc": 4.9.6 + "@rollup/rollup-win32-ia32-msvc": 4.9.6 + "@rollup/rollup-win32-x64-msvc": 4.9.6 + "@types/estree": 1.0.5 + fsevents: ~2.3.2 + dependenciesMeta: + "@rollup/rollup-android-arm-eabi": + optional: true + "@rollup/rollup-android-arm64": + optional: true + "@rollup/rollup-darwin-arm64": + optional: true + "@rollup/rollup-darwin-x64": + optional: true + "@rollup/rollup-linux-arm-gnueabihf": + optional: true + "@rollup/rollup-linux-arm64-gnu": + optional: true + "@rollup/rollup-linux-arm64-musl": + optional: true + "@rollup/rollup-linux-riscv64-gnu": + optional: true + "@rollup/rollup-linux-x64-gnu": + optional: true + "@rollup/rollup-linux-x64-musl": + optional: true + "@rollup/rollup-win32-arm64-msvc": + optional: true + "@rollup/rollup-win32-ia32-msvc": + optional: true + "@rollup/rollup-win32-x64-msvc": + optional: true + fsevents: + optional: true + bin: + rollup: dist/bin/rollup + checksum: cdc0bdd41ee2d3fe7f01df26f5a85921caf46ffe0ae118b2f3deebdf569e8b1c1800b8eee04960425e67aecbd9ccdd37bcdb92595866adb3968d223a07e9b7e6 + languageName: node + linkType: hard + "root@workspace:.": version: 0.0.0-use.local resolution: "root@workspace:." @@ -20273,7 +20503,6 @@ __metadata: "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/utils": ^8.3.0 - "@swc/cli": ^0.1.62 "@swc/core": 1.3.78 "@types/jest": ^27.5.1 "@types/node": 18.14.2 @@ -20301,6 +20530,7 @@ __metadata: semver: ^7.5.4 simple-git-hooks: ^2.7.0 ts-node: ^10.9.1 + tsup: ^8.0.1 typescript: ~4.8.4 languageName: unknown linkType: soft @@ -20471,22 +20701,6 @@ __metadata: languageName: node linkType: hard -"semver-regex@npm:^4.0.5": - version: 4.0.5 - resolution: "semver-regex@npm:4.0.5" - checksum: b9e5c0573c4a997fb7e6e76321385d254797e86c8dba5e23f3cd8cf8f40b40414097a51514e5fead61dcb88ff10d3676355c01e2040f3c68f6c24bfd2073da2e - languageName: node - linkType: hard - -"semver-truncate@npm:^2.0.0": - version: 2.0.0 - resolution: "semver-truncate@npm:2.0.0" - dependencies: - semver: ^6.0.0 - checksum: 713c2bd49add098c3fd6271091e7c8c13908ab3f052d58a19b68920da9f101d34eb6a0c60ef4bd5fa3c345f001e0df37bb831602082441bb35ba857cac42e0f4 - languageName: node - linkType: hard - "semver@npm:2 || 3 || 4 || 5": version: 5.7.2 resolution: "semver@npm:5.7.2" @@ -20717,15 +20931,6 @@ __metadata: languageName: node linkType: hard -"shebang-command@npm:^1.2.0": - version: 1.2.0 - resolution: "shebang-command@npm:1.2.0" - dependencies: - shebang-regex: ^1.0.0 - checksum: 9eed1750301e622961ba5d588af2212505e96770ec376a37ab678f965795e995ade7ed44910f5d3d3cb5e10165a1847f52d3348c64e146b8be922f7707958908 - languageName: node - linkType: hard - "shebang-command@npm:^2.0.0": version: 2.0.0 resolution: "shebang-command@npm:2.0.0" @@ -20735,13 +20940,6 @@ __metadata: languageName: node linkType: hard -"shebang-regex@npm:^1.0.0": - version: 1.0.0 - resolution: "shebang-regex@npm:1.0.0" - checksum: 404c5a752cd40f94591dfd9346da40a735a05139dac890ffc229afba610854d8799aaa52f87f7e0c94c5007f2c6af55bdcaeb584b56691926c5eaf41dc8f1372 - languageName: node - linkType: hard - "shebang-regex@npm:^3.0.0": version: 3.0.0 resolution: "shebang-regex@npm:3.0.0" @@ -20767,7 +20965,7 @@ __metadata: languageName: node linkType: hard -"signal-exit@npm:^3.0.0, signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3, signal-exit@npm:^3.0.7": +"signal-exit@npm:^3.0.2, signal-exit@npm:^3.0.3, signal-exit@npm:^3.0.7": version: 3.0.7 resolution: "signal-exit@npm:3.0.7" checksum: a2f098f247adc367dffc27845853e9959b9e88b01cb301658cfe4194352d8d2bb32e18467c786a7fe15f1d44b233ea35633d076d5e737870b7139949d1ab6318 @@ -20831,7 +21029,7 @@ __metadata: languageName: node linkType: hard -"slash@npm:3.0.0, slash@npm:^3.0.0": +"slash@npm:^3.0.0": version: 3.0.0 resolution: "slash@npm:3.0.0" checksum: 94a93fff615f25a999ad4b83c9d5e257a7280c90a32a7cb8b4a87996e4babf322e469c42b7f649fd5796edd8687652f3fb452a86dc97a816f01113183393f11c @@ -20934,24 +21132,6 @@ __metadata: languageName: node linkType: hard -"sort-keys-length@npm:^1.0.0": - version: 1.0.1 - resolution: "sort-keys-length@npm:1.0.1" - dependencies: - sort-keys: ^1.0.0 - checksum: f9acac5fb31580a9e3d43b419dc86a1b75e85b79036a084d95dd4d1062b621c9589906588ac31e370a0dd381be46d8dbe900efa306d087ca9c912d7a59b5a590 - languageName: node - linkType: hard - -"sort-keys@npm:^1.0.0": - version: 1.1.2 - resolution: "sort-keys@npm:1.1.2" - dependencies: - is-plain-obj: ^1.0.0 - checksum: 5963fd191a2a185a5ec86f06e47721e8e04713eda43bb04ae60d2a8afb21241553dd5bc9d863ed2bd7c3d541b609b0c8d0e58836b1a3eb6764c09c094bcc8b00 - languageName: node - linkType: hard - "sort-object-keys@npm:^1.1.3": version: 1.1.3 resolution: "sort-object-keys@npm:1.1.3" @@ -21009,6 +21189,15 @@ __metadata: languageName: node linkType: hard +"source-map@npm:0.8.0-beta.0": + version: 0.8.0-beta.0 + resolution: "source-map@npm:0.8.0-beta.0" + dependencies: + whatwg-url: ^7.0.0 + checksum: e94169be6461ab0ac0913313ad1719a14c60d402bd22b0ad96f4a6cffd79130d91ab5df0a5336a326b04d2df131c1409f563c9dc0d21a6ca6239a44b6c8dbd92 + languageName: node + linkType: hard + "source-map@npm:^0.5.7, source-map@npm:~0.5.3": version: 0.5.7 resolution: "source-map@npm:0.5.7" @@ -21412,13 +21601,6 @@ __metadata: languageName: node linkType: hard -"strip-eof@npm:^1.0.0": - version: 1.0.0 - resolution: "strip-eof@npm:1.0.0" - checksum: 40bc8ddd7e072f8ba0c2d6d05267b4e0a4800898c3435b5fb5f5a21e6e47dfaff18467e7aa0d1844bb5d6274c3097246595841fbfeb317e541974ee992cac506 - languageName: node - linkType: hard - "strip-final-newline@npm:^2.0.0": version: 2.0.0 resolution: "strip-final-newline@npm:2.0.0" @@ -21456,13 +21638,6 @@ __metadata: languageName: node linkType: hard -"strip-outer@npm:^2.0.0": - version: 2.0.0 - resolution: "strip-outer@npm:2.0.0" - checksum: 14ef9fe861e59a5f1555f1860982ae4edce2edb4ed34ab1b37cb62a8ba2f7c3540cbca6c884eabe4006e6cd729ab5d708a631169dd5b66fda570836e7e3b6589 - languageName: node - linkType: hard - "strnum@npm:^1.0.5": version: 1.0.5 resolution: "strnum@npm:1.0.5" @@ -21470,16 +21645,6 @@ __metadata: languageName: node linkType: hard -"strtok3@npm:^7.0.0-alpha.9": - version: 7.0.0 - resolution: "strtok3@npm:7.0.0" - dependencies: - "@tokenizer/token": ^0.3.0 - peek-readable: ^5.0.0 - checksum: 2ebe7ad8f2aea611dec6742cf6a42e82764892a362907f7ce493faf334501bf981ce21c828dcc300457e6d460dc9c34d644ededb3b01dcb9e37559203cf1748c - languageName: node - linkType: hard - "style-loader@npm:^3.3.2": version: 3.3.3 resolution: "style-loader@npm:3.3.3" @@ -21524,6 +21689,24 @@ __metadata: languageName: node linkType: hard +"sucrase@npm:^3.20.3": + version: 3.35.0 + resolution: "sucrase@npm:3.35.0" + dependencies: + "@jridgewell/gen-mapping": ^0.3.2 + commander: ^4.0.0 + glob: ^10.3.10 + lines-and-columns: ^1.1.6 + mz: ^2.7.0 + pirates: ^4.0.1 + ts-interface-checker: ^0.1.9 + bin: + sucrase: bin/sucrase + sucrase-node: bin/sucrase-node + checksum: 9fc5792a9ab8a14dcf9c47dcb704431d35c1cdff1d17d55d382a31c2e8e3063870ad32ce120a80915498486246d612e30cda44f1624d9d9a10423e1a43487ad1 + languageName: node + linkType: hard + "suffix@npm:^0.1.0": version: 0.1.1 resolution: "suffix@npm:0.1.1" @@ -21744,6 +21927,24 @@ __metadata: languageName: node linkType: hard +"thenify-all@npm:^1.0.0": + version: 1.6.0 + resolution: "thenify-all@npm:1.6.0" + dependencies: + thenify: ">= 3.1.0 < 4" + checksum: dba7cc8a23a154cdcb6acb7f51d61511c37a6b077ec5ab5da6e8b874272015937788402fd271fdfc5f187f8cb0948e38d0a42dcc89d554d731652ab458f5343e + languageName: node + linkType: hard + +"thenify@npm:>= 3.1.0 < 4": + version: 3.3.1 + resolution: "thenify@npm:3.3.1" + dependencies: + any-promise: ^1.0.0 + checksum: 84e1b804bfec49f3531215f17b4a6e50fd4397b5f7c1bccc427b9c656e1ecfb13ea79d899930184f78bc2f57285c54d9a50a590c8868f4f0cef5c1d9f898b05e + languageName: node + linkType: hard + "through2@npm:4.0.2": version: 4.0.2 resolution: "through2@npm:4.0.2" @@ -21855,16 +22056,6 @@ __metadata: languageName: node linkType: hard -"token-types@npm:^5.0.0-alpha.2": - version: 5.0.1 - resolution: "token-types@npm:5.0.1" - dependencies: - "@tokenizer/token": ^0.3.0 - ieee754: ^1.2.1 - checksum: 32780123bc6ce8b6a2231d860445c994a02a720abf38df5583ea957aa6626873cd1c4dd8af62314da4cf16ede00c379a765707a3b06f04b8808c38efdae1c785 - languageName: node - linkType: hard - "tough-cookie@npm:^4.1.2": version: 4.1.3 resolution: "tough-cookie@npm:4.1.3" @@ -21877,6 +22068,15 @@ __metadata: languageName: node linkType: hard +"tr46@npm:^1.0.1": + version: 1.0.1 + resolution: "tr46@npm:1.0.1" + dependencies: + punycode: ^2.1.0 + checksum: 96d4ed46bc161db75dbf9247a236ea0bfcaf5758baae6749e92afab0bc5a09cb59af21788ede7e55080f2bf02dce3e4a8f2a484cc45164e29f4b5e68f7cbcc1a + languageName: node + linkType: hard + "tr46@npm:^3.0.0": version: 3.0.0 resolution: "tr46@npm:3.0.0" @@ -21900,12 +22100,12 @@ __metadata: languageName: node linkType: hard -"trim-repeated@npm:^2.0.0": - version: 2.0.0 - resolution: "trim-repeated@npm:2.0.0" - dependencies: - escape-string-regexp: ^5.0.0 - checksum: 4086eb0bc560f3da0370f427f423db4e3fc0a8e1560ecffc3b68512071319fe82dc9dd86d76b981d36ada76d7d49c3f8897ac054c87bc177e7a25abfd29e2bcd +"tree-kill@npm:^1.2.2": + version: 1.2.2 + resolution: "tree-kill@npm:1.2.2" + bin: + tree-kill: cli.js + checksum: 49117f5f410d19c84b0464d29afb9642c863bc5ba40fcb9a245d474c6d5cc64d1b177a6e6713129eb346b40aebb9d4631d967517f9fbe8251c35b21b13cd96c7 languageName: node linkType: hard @@ -21916,6 +22116,13 @@ __metadata: languageName: node linkType: hard +"ts-interface-checker@npm:^0.1.9": + version: 0.1.13 + resolution: "ts-interface-checker@npm:0.1.13" + checksum: 20c29189c2dd6067a8775e07823ddf8d59a33e2ffc47a1bd59a5cb28bb0121a2969a816d5e77eda2ed85b18171aa5d1c4005a6b88ae8499ec7cc49f78571cb5e + languageName: node + linkType: hard + "ts-jest@npm:^29.1.1": version: 29.1.1 resolution: "ts-jest@npm:29.1.1" @@ -22073,6 +22280,45 @@ __metadata: languageName: node linkType: hard +"tsup@npm:^8.0.1": + version: 8.0.1 + resolution: "tsup@npm:8.0.1" + dependencies: + bundle-require: ^4.0.0 + cac: ^6.7.12 + chokidar: ^3.5.1 + debug: ^4.3.1 + esbuild: ^0.19.2 + execa: ^5.0.0 + globby: ^11.0.3 + joycon: ^3.0.1 + postcss-load-config: ^4.0.1 + resolve-from: ^5.0.0 + rollup: ^4.0.2 + source-map: 0.8.0-beta.0 + sucrase: ^3.20.3 + tree-kill: ^1.2.2 + peerDependencies: + "@microsoft/api-extractor": ^7.36.0 + "@swc/core": ^1 + postcss: ^8.4.12 + typescript: ">=4.5.0" + peerDependenciesMeta: + "@microsoft/api-extractor": + optional: true + "@swc/core": + optional: true + postcss: + optional: true + typescript: + optional: true + bin: + tsup: dist/cli-default.js + tsup-node: dist/cli-node.js + checksum: 7b9e7a412247e374be1f22d9aa68eec64e9bdebfdf36ac915fc24be995fc7b855d74cf210431122cec26351e4c22c0b87f0400181b1de1915a80531f4797d84a + languageName: node + linkType: hard + "tsutils@npm:^3.21.0": version: 3.21.0 resolution: "tsutils@npm:3.21.0" @@ -22994,6 +23240,13 @@ __metadata: languageName: node linkType: hard +"webidl-conversions@npm:^4.0.2": + version: 4.0.2 + resolution: "webidl-conversions@npm:4.0.2" + checksum: c93d8dfe908a0140a4ae9c0ebc87a33805b416a33ee638a605b551523eec94a9632165e54632f6d57a39c5f948c4bab10e0e066525e9a4b87a79f0d04fbca374 + languageName: node + linkType: hard + "webidl-conversions@npm:^7.0.0": version: 7.0.0 resolution: "webidl-conversions@npm:7.0.0" @@ -23203,6 +23456,17 @@ __metadata: languageName: node linkType: hard +"whatwg-url@npm:^7.0.0": + version: 7.1.0 + resolution: "whatwg-url@npm:7.1.0" + dependencies: + lodash.sortby: ^4.7.0 + tr46: ^1.0.1 + webidl-conversions: ^4.0.2 + checksum: fecb07c87290b47d2ec2fb6d6ca26daad3c9e211e0e531dd7566e7ff95b5b3525a57d4f32640ad4adf057717e0c215731db842ad761e61d947e81010e05cf5fd + languageName: node + linkType: hard + "which-boxed-primitive@npm:^1.0.2": version: 1.0.2 resolution: "which-boxed-primitive@npm:1.0.2" @@ -23479,10 +23743,10 @@ __metadata: languageName: node linkType: hard -"yaml@npm:^2.2.2": - version: 2.3.1 - resolution: "yaml@npm:2.3.1" - checksum: 2c7bc9a7cd4c9f40d3b0b0a98e370781b68b8b7c4515720869aced2b00d92f5da1762b4ffa947f9e795d6cd6b19f410bd4d15fdd38aca7bd96df59bd9486fb54 +"yaml@npm:^2.2.2, yaml@npm:^2.3.4": + version: 2.3.4 + resolution: "yaml@npm:2.3.4" + checksum: e6d1dae1c6383bcc8ba11796eef3b8c02d5082911c6723efeeb5ba50fc8e881df18d645e64de68e421b577296000bea9c75d6d9097c2f6699da3ae0406c030d8 languageName: node linkType: hard