diff --git a/.eslintrc.js b/.eslintrc.js index 79640f7c5d..2ce16230c2 100644 --- a/.eslintrc.js +++ b/.eslintrc.js @@ -34,7 +34,7 @@ module.exports = { overrides: [ { - files: ['**/*.js'], + files: ['**/*.js', '**/*.cjs'], extends: ['@metamask/eslint-config-nodejs'], parserOptions: { @@ -48,6 +48,14 @@ module.exports = { }, }, + { + files: ['**/*.mjs'], + parserOptions: { + ecmaVersion: 2022, + sourceType: 'module', + }, + }, + { files: ['**/*.ts', '**/*.tsx', '**/*.mts'], extends: ['@metamask/eslint-config-typescript'], diff --git a/.github/workflows/publish-release.yml b/.github/workflows/publish-release.yml index 6a9580d76d..47966fb1e8 100644 --- a/.github/workflows/publish-release.yml +++ b/.github/workflows/publish-release.yml @@ -70,7 +70,6 @@ jobs: run: | yarn install --immutable yarn build - yarn workspace @metamask/snaps-execution-environments run build:lavamoat - uses: actions/cache@v4 id: restore-build with: diff --git a/constraints.pro b/constraints.pro deleted file mode 100644 index 732a92eef5..0000000000 --- a/constraints.pro +++ /dev/null @@ -1,350 +0,0 @@ -%=============================================================================== -% Utility predicates -%=============================================================================== - -% True if and only if VersionRange is a value that we would expect to see -% following a package in a "*dependencies" field within a `package.json`. -is_valid_version_range(VersionRange) :- - VersionRange = 'workspace:^'; - VersionRange = 'workspace:~'; - parse_version_range(VersionRange, _, _, _, _). - -% Succeeds if Number can be unified with Atom converted to a number; throws if -% not. -atom_to_number(Atom, Number) :- - atom_chars(Atom, Chars), - number_chars(Number, Chars). - -% True if and only if Atom can be converted to a number. -is_atom_number(Atom) :- - catch(atom_to_number(Atom, _), _, false). - -% True if and only if Modifier can be unified with the leading character of the -% version range ("^" or "~" if present, or "" if not present), Major can be -% unified with the major part of the version string, Minor with the minor, and -% Patch with the patch. -parse_version_range(VersionRange, Modifier, Major, Minor, Patch) :- - % Identify and extract the modifier (^ or ~) from the version string - atom_chars(VersionRange, Chars), - Chars = [PossibleModifier | CharsWithoutPossibleModifier], - ( - ( - PossibleModifier = '^'; - PossibleModifier = '~' - ) -> - ( - Modifier = PossibleModifier, - CharsWithoutModifier = CharsWithoutPossibleModifier - ) ; - ( - is_atom_number(PossibleModifier) -> - ( - Modifier = '', - CharsWithoutModifier = Chars - ) ; - false - ) - ), - atomic_list_concat(CharsWithoutModifier, '', VersionRangeWithoutModifier), - atomic_list_concat(VersionParts, '.', VersionRangeWithoutModifier), - % Validate version string while extracting each part - length(VersionParts, 3), - nth0(0, VersionParts, MajorAtom), - nth0(1, VersionParts, MinorAtom), - nth0(2, VersionParts, PatchAtom), - atom_to_number(MajorAtom, Major), - atom_to_number(MinorAtom, Minor), - atom_to_number(PatchAtom, Patch). - -% True if and only if the first SemVer version range is greater than the second -% SemVer version range. Such a range must match "^MAJOR.MINOR.PATCH", -% "~MAJOR.MINOR.PATCH", "MAJOR.MINOR.PATCH". If two ranges do not have the same -% modifier ("^" or "~"), then they cannot be compared and the first cannot be -% considered as less than the second. -% -% Borrowed from: -npm_version_range_out_of_sync(VersionRange1, VersionRange2) :- - parse_version_range(VersionRange1, VersionRange1Modifier, VersionRange1Major, VersionRange1Minor, VersionRange1Patch), - parse_version_range(VersionRange2, VersionRange2Modifier, VersionRange2Major, VersionRange2Minor, VersionRange2Patch), - VersionRange1Modifier == VersionRange2Modifier, - ( - % 2.0.0 > 1.0.0 - % 2.0.0 > 1.1.0 - % 2.0.0 > 1.0.1 - VersionRange1Major @> VersionRange2Major ; - ( - VersionRange1Major == VersionRange2Major , - ( - % 1.1.0 > 1.0.0 - % 1.1.0 > 1.0.1 - VersionRange1Minor @> VersionRange2Minor ; - ( - VersionRange1Minor == VersionRange2Minor , - % 1.0.1 > 1.0.0 - VersionRange1Patch @> VersionRange2Patch - ) - ) - ) - ). - -% Slice a list from From to To. -slice(Left, From, To, Right):- - length(LeftFrom, From), - length([_|LeftTo], To), - append(LeftTo, _, Left), - append(LeftFrom, Right, LeftTo). - -% True if and only if the given workspace directory is an example. -is_example(WorkspaceCwd) :- - atomic_list_concat(Parts, '/', WorkspaceCwd), - slice(Parts, 1, 3, RootParts), - atomic_list_concat(RootParts, '/', RootCwd), - RootCwd = 'examples', - WorkspaceCwd \= 'packages/examples', - WorkspaceCwd \= 'packages/examples/packages/invoke-snap'. - -% Repeat a value a given number of times. This is useful for generating lists of -% a given length. For example, repeat('foo', 3, Result) will unify Result with -% ['foo', 'foo', 'foo']. -repeat(Value, Amount, Result) :- - length(Result, Amount), - maplist(=(Value), Result). - -% Resolve a relative path from a workspace directory. -relative_path(WorkspaceCwd, Path, RelativePath) :- - atomic_list_concat(Parts, '/', WorkspaceCwd), - length(Parts, Distance), - repeat('..', Distance, DistanceParts), - atomic_list_concat(DistanceParts, '/', DistanceString), - atomic_list_concat([DistanceString, Path], '/', RelativePath). - -%=============================================================================== -% Constraints -%=============================================================================== - -% All dependency ranges must be recognizable (this makes it possible to apply -% the next two rules effectively). -gen_enforced_dependency(WorkspaceCwd, DependencyIdent, 'a range optionally starting with ^ or ~', DependencyType) :- - workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType), - \+ is_valid_version_range(DependencyRange). - -% All dependency ranges for a package must be synchronized across the monorepo -% (the least version range wins), regardless of which "*dependencies" field -% where the package appears. -gen_enforced_dependency(WorkspaceCwd, DependencyIdent, OtherDependencyRange, DependencyType) :- - workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType), - workspace_has_dependency(OtherWorkspaceCwd, DependencyIdent, OtherDependencyRange, OtherDependencyType), - WorkspaceCwd \= OtherWorkspaceCwd, - DependencyRange \= OtherDependencyRange, - npm_version_range_out_of_sync(DependencyRange, OtherDependencyRange). - -% If a dependency is listed under "dependencies", it should not be listed under -% "devDependencies". We match on the same dependency range so that if a -% dependency is listed under both lists, their versions are synchronized and -% then this constraint will apply and remove the "right" duplicate. -gen_enforced_dependency(WorkspaceCwd, DependencyIdent, null, DependencyType) :- - workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, 'dependencies'), - workspace_has_dependency(WorkspaceCwd, DependencyIdent, DependencyRange, DependencyType), - DependencyType == 'devDependencies'. - -% Dependencies may not have side effects. -gen_enforced_field(WorkspaceCwd, 'sideEffects', 'false') :- - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.'. - -% The type definitions entrypoint for the dependency must be `./dist/index.d.cts`. -gen_enforced_field(WorkspaceCwd, 'types', './dist/index.d.cts') :- - \+ is_example(WorkspaceCwd), - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.'. -gen_enforced_field(WorkspaceCwd, 'exports["."].types', null) :- - \+ is_example(WorkspaceCwd), - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.'. - -% The entrypoint for the dependency must be `./dist/index.cjs`. -gen_enforced_field(WorkspaceCwd, 'main', './dist/index.cjs') :- - \+ is_example(WorkspaceCwd), - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.'. -gen_enforced_field(WorkspaceCwd, 'exports["."].require.types', './dist/index.d.cts') :- - \+ is_example(WorkspaceCwd), - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.'. -gen_enforced_field(WorkspaceCwd, 'exports["."].require.default', './dist/index.cjs') :- - \+ is_example(WorkspaceCwd), - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.'. - -% The module entrypoint for the dependency must be `./dist/index.mjs`. -gen_enforced_field(WorkspaceCwd, 'module', './dist/index.mjs') :- - \+ is_example(WorkspaceCwd), - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.'. -gen_enforced_field(WorkspaceCwd, 'exports["."].import.types', './dist/index.d.mts') :- - \+ is_example(WorkspaceCwd), - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.'. -gen_enforced_field(WorkspaceCwd, 'exports["."].import.default', './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', - WorkspaceCwd \= 'packages/snaps-cli', - WorkspaceCwd \= 'packages/snaps-controllers', - WorkspaceCwd \= 'packages/snaps-sdk'. -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', 'ts-bridge --project tsconfig.build.json --verbose --no-references') :- - \+ is_example(WorkspaceCwd), - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.', - WorkspaceCwd \= 'packages/snaps-simulator', - WorkspaceCwd \= 'packages/snaps-cli', - WorkspaceCwd \= 'packages/snaps-execution-environments'. -gen_enforced_field(WorkspaceCwd, 'scripts.build:types', null) :- - \+ is_example(WorkspaceCwd), - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.'. - -% 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 \= '.'. -gen_enforced_field(WorkspaceCwd, 'publishConfig.registry', 'https://registry.npmjs.org/') :- - \+ workspace_field(WorkspaceCwd, 'private', true), - WorkspaceCwd \= '.'. - -% The "changelog:validate" script for each published package must run a common -% script with the name of the package as an argument. -gen_enforced_field(WorkspaceCwd, 'scripts.changelog:validate', ChangelogValidationScript) :- - \+ workspace_field(WorkspaceCwd, 'private', true), - workspace_field(WorkspaceCwd, 'name', WorkspacePackageName), - relative_path(WorkspaceCwd, 'scripts/validate-changelog.sh', BaseChangelogValidationScript), - atomic_list_concat([BaseChangelogValidationScript, ' ', WorkspacePackageName], ChangelogValidationScript). - -% The "changelog:update" script for each published package must run a common -% script with the name of the package as an argument. -gen_enforced_field(WorkspaceCwd, 'scripts.changelog:update', ChangelogUpdateScript) :- - \+ workspace_field(WorkspaceCwd, 'private', true), - workspace_field(WorkspaceCwd, 'name', WorkspacePackageName), - relative_path(WorkspaceCwd, 'scripts/update-changelog.sh', BaseChangelogUpdateScript), - atomic_list_concat([BaseChangelogUpdateScript, ' ', WorkspacePackageName], ChangelogUpdateScript). - -% The "since-latest-release" script for each published package must run a common -% script. -gen_enforced_field(WorkspaceCwd, 'scripts.since-latest-release', SinceLatestReleaseScript) :- - \+ workspace_field(WorkspaceCwd, 'private', true), - workspace_field(WorkspaceCwd, 'name', WorkspacePackageName), - relative_path(WorkspaceCwd, 'scripts/since-latest-release.sh', SinceLatestReleaseScript). - -% The "lint:dependencies" script must be the same for all packages. -gen_enforced_field(WorkspaceCwd, 'scripts.lint:dependencies', 'depcheck') :- - WorkspaceCwd \= '.'. - -% The test scripts must be the same for all packages. -gen_enforced_field(WorkspaceCwd, 'scripts.test', 'jest --reporters=jest-silent-reporter') :- - WorkspaceCwd \= '.', - WorkspaceCwd \= 'packages/snaps-controllers', - WorkspaceCwd \= 'packages/snaps-execution-environments', - WorkspaceCwd \= 'packages/snaps-utils', - \+ is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.test', 'jest --reporters=jest-silent-reporter && yarn test:browser') :- - WorkspaceCwd == 'packages/snaps-controllers'. -gen_enforced_field(WorkspaceCwd, 'scripts.test', 'jest --reporters=jest-silent-reporter && yarn test:browser') :- - WorkspaceCwd == 'packages/snaps-execution-environments'. -gen_enforced_field(WorkspaceCwd, 'scripts.test', 'jest --reporters=jest-silent-reporter && yarn test:browser') :- - WorkspaceCwd == 'packages/snaps-utils'. -gen_enforced_field(WorkspaceCwd, 'scripts.test:clean', 'jest --clearCache') :- - WorkspaceCwd \= '.', - \+ is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.test:verbose', 'jest --verbose') :- - WorkspaceCwd \= '.', - \+ is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.test:watch', 'jest --watch') :- - WorkspaceCwd \= '.', - \+ is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.test:post', 'jest-it-up') :- - WorkspaceCwd \= '.', - WorkspaceCwd \= 'packages/snaps-controllers', - WorkspaceCwd \= 'packages/snaps-execution-environments', - WorkspaceCwd \= 'packages/snaps-utils', - \+ is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.test:post', 'ts-node scripts/coverage.ts && rimraf coverage/jest coverage/wdio') :- - WorkspaceCwd == 'packages/snaps-controllers'. -gen_enforced_field(WorkspaceCwd, 'scripts.test:post', 'ts-node scripts/coverage.ts && rimraf coverage/jest coverage/wdio') :- - WorkspaceCwd == 'packages/snaps-execution-environments'. -gen_enforced_field(WorkspaceCwd, 'scripts.test:post', 'ts-node scripts/coverage.ts && rimraf coverage/jest coverage/wdio') :- - WorkspaceCwd == 'packages/snaps-utils'. - -% The "engines.node" field must be the same for all packages. -gen_enforced_field(WorkspaceCwd, 'engines.node', '^18.16 || >=20'). - -% Ensure all examples have the same scripts. -gen_enforced_field(WorkspaceCwd, 'scripts.build', 'mm-snap build') :- - is_example(WorkspaceCwd), - WorkspaceCwd \= 'packages/examples/packages/wasm', - WorkspaceCwd \= 'packages/examples/packages/browserify-plugin', - WorkspaceCwd \= 'packages/examples/packages/preinstalled', - WorkspaceCwd \= 'packages/examples/packages/rollup-plugin', - WorkspaceCwd \= 'packages/examples/packages/webpack-plugin'. -gen_enforced_field(WorkspaceCwd, 'scripts.build:clean', 'yarn clean && yarn build') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.start', 'mm-snap watch') :- - is_example(WorkspaceCwd), - WorkspaceCwd \= 'packages/examples/packages/wasm', - WorkspaceCwd \= 'packages/examples/packages/browserify-plugin', - WorkspaceCwd \= 'packages/examples/packages/rollup-plugin', - WorkspaceCwd \= 'packages/examples/packages/webpack-plugin'. -gen_enforced_field(WorkspaceCwd, 'scripts.clean', 'rimraf "dist"') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.test', 'jest --reporters=jest-silent-reporter') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.test:clean', 'jest --clearCache') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.test:verbose', 'jest --verbose') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.test:watch', 'jest --watch') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.lint', 'yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.lint:ci', 'yarn lint') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.lint:fix', 'yarn lint:eslint --fix && yarn lint:misc --write') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.lint:eslint', 'eslint . --cache --ext js,ts,jsx,tsx') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'scripts.lint:misc', LintMiscScript) :- - is_example(WorkspaceCwd), - relative_path(WorkspaceCwd, '.gitignore', GitIgnorePath), - atomic_list_concat(['prettier --no-error-on-unmatched-pattern --loglevel warn "**/*.json" "**/*.md" "**/*.html" "!CHANGELOG.md" "!snap.manifest.json" --ignore-path ', GitIgnorePath], LintMiscScript). - -% Ensure all examples have the same `main` and `types` fields. -gen_enforced_field(WorkspaceCwd, 'main', './dist/bundle.js') :- - is_example(WorkspaceCwd). -gen_enforced_field(WorkspaceCwd, 'types', null) :- - is_example(WorkspaceCwd). - -% Ensure all examples have the same license. -gen_enforced_field(WorkspaceCwd, 'license', '(MIT-0 OR Apache-2.0)') :- - is_example(WorkspaceCwd). diff --git a/package.json b/package.json index 7fd002478c..b433f9a95c 100644 --- a/package.json +++ b/package.json @@ -11,9 +11,11 @@ "packages/*" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose && yarn build:examples", - "build:ci": "ts-bridge --project tsconfig.build.json --verbose --clean", + "build": "ts-bridge --project tsconfig.build.json --verbose", + "build:ci": "ts-bridge --project tsconfig.build.json --verbose", "build:examples": "yarn workspace @metamask/example-snaps build", + "build:execution-environments": "yarn workspace @metamask/snaps-execution-environments build:lavamoat", + "build:post": "yarn build:examples && yarn build:execution-environments", "changelog:update": "yarn workspaces foreach --all --parallel --interlaced --verbose run changelog:update", "changelog:validate": "yarn workspaces foreach --all --parallel --interlaced --verbose run changelog:validate", "child-workspace-package-names-as-json": "ts-node scripts/child-workspace-package-names-as-json.ts", @@ -24,7 +26,7 @@ "lint": "yarn workspaces foreach --all --parallel run lint:eslint && yarn lint:misc --check && yarn lint:tsconfig && yarn constraints && yarn lint:dependencies", "lint:ci": "yarn lint:eslint && yarn lint:misc --check && yarn lint:tsconfig && yarn constraints && yarn lint:dependencies", "lint:dependencies": "yarn workspaces foreach --all --parallel --verbose run lint:dependencies && yarn dedupe --check", - "lint:eslint": "eslint . --cache --ext js,jsx,ts,tsx", + "lint:eslint": "eslint . --cache --ext js,cjs,mjs,jsx,ts,mts,cts,tsx", "lint:fix": "yarn workspaces foreach --all --parallel run lint:eslint --fix && yarn lint:misc --write && yarn lint:tsconfig && yarn constraints --fix && yarn dedupe", "lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn '**/*.json' '**/*.md' '!**/CHANGELOG.md' '**/*.yml' '**/*.html'", "lint:tsconfig": "node scripts/verify-tsconfig.mjs", @@ -81,9 +83,11 @@ "@swc/core": "1.3.78", "@ts-bridge/cli": "^0.5.1", "@types/jest": "^27.5.1", + "@types/lodash": "^4", "@types/node": "18.14.2", "@typescript-eslint/eslint-plugin": "^5.42.1", "@typescript-eslint/parser": "^6.21.0", + "@yarnpkg/types": "^4.0.0", "chromedriver": "^127.0.0", "depcheck": "^1.4.7", "eslint": "^8.27.0", @@ -100,6 +104,7 @@ "jest": "^29.0.2", "jest-silent-reporter": "^0.6.0", "lint-staged": "^12.4.1", + "lodash": "^4.17.21", "minimatch": "^7.4.1", "prettier": "^2.8.8", "prettier-plugin-packagejson": "^2.5.2", diff --git a/packages/create-snap/package.json b/packages/create-snap/package.json index 99b8d5a684..3646fc71f3 100644 --- a/packages/create-snap/package.json +++ b/packages/create-snap/package.json @@ -38,7 +38,7 @@ "dist" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "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'", diff --git a/packages/examples/package.json b/packages/examples/package.json index 09a2a3feb2..872daf050e 100644 --- a/packages/examples/package.json +++ b/packages/examples/package.json @@ -25,6 +25,7 @@ "scripts": { "build": "yarn workspaces foreach --worktree --parallel --verbose --no-private run build", "build:clean": "yarn clean && yarn build", + "changelog:validate": "../../scripts/validate-changelog.sh @metamask/example-snaps", "changelog:validates": "yarn workspaces foreach --worktree --parallel --verbose run changelog:validate", "clean": "yarn workspaces foreach --worktree --parallel --verbose --no-private run clean", "lint": "yarn workspaces foreach --worktree --parallel --verbose --interlaced --no-private run lint && yarn lint:dependencies", diff --git a/packages/examples/packages/bip32/package.json b/packages/examples/packages/bip32/package.json index b1a3f1b0bf..6b00553577 100644 --- a/packages/examples/packages/bip32/package.json +++ b/packages/examples/packages/bip32/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/bip44/package.json b/packages/examples/packages/bip44/package.json index 45052f0ac8..b69f2cd39c 100644 --- a/packages/examples/packages/bip44/package.json +++ b/packages/examples/packages/bip44/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/browserify-plugin/package.json b/packages/examples/packages/browserify-plugin/package.json index 42bf8286d1..7b58c47dd0 100644 --- a/packages/examples/packages/browserify-plugin/package.json +++ b/packages/examples/packages/browserify-plugin/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/browserify/package.json b/packages/examples/packages/browserify/package.json index 744167dd36..0ba3299f9c 100644 --- a/packages/examples/packages/browserify/package.json +++ b/packages/examples/packages/browserify/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/client-status/package.json b/packages/examples/packages/client-status/package.json index 89a4fd4506..a5425b6105 100644 --- a/packages/examples/packages/client-status/package.json +++ b/packages/examples/packages/client-status/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/cronjobs/package.json b/packages/examples/packages/cronjobs/package.json index 384eae78a9..6813f24ab4 100644 --- a/packages/examples/packages/cronjobs/package.json +++ b/packages/examples/packages/cronjobs/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/dialogs/package.json b/packages/examples/packages/dialogs/package.json index 88e4ecb23c..f95b55dea1 100644 --- a/packages/examples/packages/dialogs/package.json +++ b/packages/examples/packages/dialogs/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/errors/package.json b/packages/examples/packages/errors/package.json index 000ed8038d..d1ca433a7f 100644 --- a/packages/examples/packages/errors/package.json +++ b/packages/examples/packages/errors/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/ethereum-provider/package.json b/packages/examples/packages/ethereum-provider/package.json index 3b719b1378..aa40a54f99 100644 --- a/packages/examples/packages/ethereum-provider/package.json +++ b/packages/examples/packages/ethereum-provider/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/ethers-js/package.json b/packages/examples/packages/ethers-js/package.json index b633c926ab..6d8b527a8c 100644 --- a/packages/examples/packages/ethers-js/package.json +++ b/packages/examples/packages/ethers-js/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/file-upload/package.json b/packages/examples/packages/file-upload/package.json index 182e478dd2..0556e60191 100644 --- a/packages/examples/packages/file-upload/package.json +++ b/packages/examples/packages/file-upload/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/get-entropy/package.json b/packages/examples/packages/get-entropy/package.json index ef093566a9..eeb92ffba9 100644 --- a/packages/examples/packages/get-entropy/package.json +++ b/packages/examples/packages/get-entropy/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/get-file/package.json b/packages/examples/packages/get-file/package.json index d358f0527e..d7851edce8 100644 --- a/packages/examples/packages/get-file/package.json +++ b/packages/examples/packages/get-file/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json", "files/" ], diff --git a/packages/examples/packages/home-page/package.json b/packages/examples/packages/home-page/package.json index 2c1c5e94ed..7cadb85f4c 100644 --- a/packages/examples/packages/home-page/package.json +++ b/packages/examples/packages/home-page/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/images/package.json b/packages/examples/packages/images/package.json index 6ffe321e1f..a650a1a427 100644 --- a/packages/examples/packages/images/package.json +++ b/packages/examples/packages/images/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/interactive-ui/package.json b/packages/examples/packages/interactive-ui/package.json index c9729c8e12..5d27d86af5 100644 --- a/packages/examples/packages/interactive-ui/package.json +++ b/packages/examples/packages/interactive-ui/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/invoke-snap/package.json b/packages/examples/packages/invoke-snap/package.json index 2c5c997824..71be50aae7 100644 --- a/packages/examples/packages/invoke-snap/package.json +++ b/packages/examples/packages/invoke-snap/package.json @@ -25,6 +25,7 @@ "scripts": { "build": "yarn workspaces foreach --worktree --parallel --verbose run build", "build:clean": "yarn clean && yarn build", + "changelog:validate": "../../../../scripts/validate-changelog.sh @metamask/invoke-snap-example-snap", "clean": "yarn workspaces foreach --worktree --parallel --verbose run clean", "lint": "yarn workspaces foreach --worktree --parallel --verbose --interlaced run lint && yarn lint:dependencies", "lint:ci": "yarn lint:eslint && yarn lint:misc --check", diff --git a/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json b/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json index 679a5a707b..5af913311d 100644 --- a/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json +++ b/packages/examples/packages/invoke-snap/packages/consumer-signer/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/invoke-snap/packages/core-signer/package.json b/packages/examples/packages/invoke-snap/packages/core-signer/package.json index 09087203e7..61a0467c06 100644 --- a/packages/examples/packages/invoke-snap/packages/core-signer/package.json +++ b/packages/examples/packages/invoke-snap/packages/core-signer/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/json-rpc/package.json b/packages/examples/packages/json-rpc/package.json index fe9937a431..77155de7a5 100644 --- a/packages/examples/packages/json-rpc/package.json +++ b/packages/examples/packages/json-rpc/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/jsx/package.json b/packages/examples/packages/jsx/package.json index 5d4a1dd9ce..0089b72740 100644 --- a/packages/examples/packages/jsx/package.json +++ b/packages/examples/packages/jsx/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/lifecycle-hooks/package.json b/packages/examples/packages/lifecycle-hooks/package.json index efc0cad1df..a8e5a80902 100644 --- a/packages/examples/packages/lifecycle-hooks/package.json +++ b/packages/examples/packages/lifecycle-hooks/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/localization/package.json b/packages/examples/packages/localization/package.json index 551ef4dfe0..933e82a004 100644 --- a/packages/examples/packages/localization/package.json +++ b/packages/examples/packages/localization/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json", "locales/" ], diff --git a/packages/examples/packages/manage-state/package.json b/packages/examples/packages/manage-state/package.json index 03ca067a78..bca541d171 100644 --- a/packages/examples/packages/manage-state/package.json +++ b/packages/examples/packages/manage-state/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/name-lookup/package.json b/packages/examples/packages/name-lookup/package.json index 4740b3845b..521203033c 100644 --- a/packages/examples/packages/name-lookup/package.json +++ b/packages/examples/packages/name-lookup/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/network-access/package.json b/packages/examples/packages/network-access/package.json index 1138811409..63081d3ed9 100644 --- a/packages/examples/packages/network-access/package.json +++ b/packages/examples/packages/network-access/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/notifications/package.json b/packages/examples/packages/notifications/package.json index edb914f484..d67b7fb936 100644 --- a/packages/examples/packages/notifications/package.json +++ b/packages/examples/packages/notifications/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/preinstalled/package.json b/packages/examples/packages/preinstalled/package.json index 96ddfa88a9..2cbbc50f94 100644 --- a/packages/examples/packages/preinstalled/package.json +++ b/packages/examples/packages/preinstalled/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/rollup-plugin/package.json b/packages/examples/packages/rollup-plugin/package.json index 95d6cd9c76..ed24de7aac 100644 --- a/packages/examples/packages/rollup-plugin/package.json +++ b/packages/examples/packages/rollup-plugin/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/send-flow/package.json b/packages/examples/packages/send-flow/package.json index 7551963600..32d89144d2 100644 --- a/packages/examples/packages/send-flow/package.json +++ b/packages/examples/packages/send-flow/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/signature-insights/package.json b/packages/examples/packages/signature-insights/package.json index 907573148f..d26f6d89ae 100644 --- a/packages/examples/packages/signature-insights/package.json +++ b/packages/examples/packages/signature-insights/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/transaction-insights/package.json b/packages/examples/packages/transaction-insights/package.json index 8547e1c57e..d7a1b97826 100644 --- a/packages/examples/packages/transaction-insights/package.json +++ b/packages/examples/packages/transaction-insights/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/wasm/package.json b/packages/examples/packages/wasm/package.json index c25983c0fe..e1c435d415 100644 --- a/packages/examples/packages/wasm/package.json +++ b/packages/examples/packages/wasm/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/examples/packages/webpack-plugin/package.json b/packages/examples/packages/webpack-plugin/package.json index 21147fc3d2..9a98b4d02f 100644 --- a/packages/examples/packages/webpack-plugin/package.json +++ b/packages/examples/packages/webpack-plugin/package.json @@ -19,7 +19,7 @@ "sideEffects": false, "main": "./dist/bundle.js", "files": [ - "dist/", + "dist", "snap.manifest.json" ], "scripts": { diff --git a/packages/snaps-browserify-plugin/package.json b/packages/snaps-browserify-plugin/package.json index b4715f0673..a52a253a1f 100644 --- a/packages/snaps-browserify-plugin/package.json +++ b/packages/snaps-browserify-plugin/package.json @@ -39,7 +39,7 @@ "dist" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-browserify-plugin", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-browserify-plugin", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies", diff --git a/packages/snaps-cli/package.json b/packages/snaps-cli/package.json index 439facaa9d..2432ef7c1b 100644 --- a/packages/snaps-cli/package.json +++ b/packages/snaps-cli/package.json @@ -42,8 +42,9 @@ ".browserslistrc" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references && yarn build:chmod && yarn build:readme", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "build:chmod": "chmod +x ./dist/main.mjs && chmod +x ./dist/main.js", + "build:post": "yarn build:chmod && yarn build:readme", "build:readme": "node ./scripts/updateReadme.js", "build:watch": "tsc-watch --onSuccess 'yarn build:chmod'", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-cli", diff --git a/packages/snaps-controllers/package.json b/packages/snaps-controllers/package.json index dc249a2e7a..23fc30690b 100644 --- a/packages/snaps-controllers/package.json +++ b/packages/snaps-controllers/package.json @@ -59,7 +59,7 @@ "react-native.js" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-controllers", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-controllers", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies", diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index 5ff48e2c49..eaebeb94b7 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -28,12 +28,8 @@ "default": "./dist/index.cjs" } }, - "./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" - }, + "./dist/browserify/node-process/bundle.js": "./dist/browserify/node-process/bundle.js", + "./dist/browserify/node-thread/bundle.js": "./dist/browserify/node-thread/bundle.js", "./package.json": "./package.json" }, "main": "./dist/index.cjs", @@ -44,9 +40,10 @@ ], "scripts": { "auto-changelog-init": "auto-changelog init", - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references && yarn build:lavamoat", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "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", + "build:post": "yarn build:lavamoat", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-execution-environments", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-execution-environments", "clean": "rimraf '*.tsbuildinfo' 'dist' 'src/__GENERATED__/' 'coverage/*' '__test__/*'", diff --git a/packages/snaps-jest/package.json b/packages/snaps-jest/package.json index c201c69ebb..357e2398ae 100644 --- a/packages/snaps-jest/package.json +++ b/packages/snaps-jest/package.json @@ -39,7 +39,7 @@ "jest-preset.js" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-jest", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-jest", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies", diff --git a/packages/snaps-rollup-plugin/package.json b/packages/snaps-rollup-plugin/package.json index 5968756a4f..51e2a7d48f 100644 --- a/packages/snaps-rollup-plugin/package.json +++ b/packages/snaps-rollup-plugin/package.json @@ -39,7 +39,7 @@ "dist" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-rollup-plugin", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-rollup-plugin", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies", diff --git a/packages/snaps-rpc-methods/package.json b/packages/snaps-rpc-methods/package.json index 7ad27332fd..f4d12094b2 100644 --- a/packages/snaps-rpc-methods/package.json +++ b/packages/snaps-rpc-methods/package.json @@ -37,7 +37,7 @@ "dist" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-rpc-methods", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-rpc-methods", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies", diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index a209c433d1..f254665cb3 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -73,7 +73,7 @@ "jsx-runtime.d.ts" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-sdk", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-sdk", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies", diff --git a/packages/snaps-simulation/package.json b/packages/snaps-simulation/package.json index 168918bb9e..bb19ad8b7a 100644 --- a/packages/snaps-simulation/package.json +++ b/packages/snaps-simulation/package.json @@ -24,8 +24,8 @@ "default": "./dist/index.mjs" }, "require": { - "default": "./dist/index.cjs", - "types": "./dist/index.d.cts" + "types": "./dist/index.d.cts", + "default": "./dist/index.cjs" } }, "./package.json": "./package.json" @@ -37,7 +37,7 @@ "dist" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-simulation", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-simulation", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies", diff --git a/packages/snaps-utils/package.json b/packages/snaps-utils/package.json index 60cf5fe32d..eceb32e4ea 100644 --- a/packages/snaps-utils/package.json +++ b/packages/snaps-utils/package.json @@ -57,7 +57,7 @@ "dist" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "build:clean": "yarn clean && yarn build", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-utils", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-utils", diff --git a/packages/snaps-webpack-plugin/package.json b/packages/snaps-webpack-plugin/package.json index 639bff6e65..b982d2e47b 100644 --- a/packages/snaps-webpack-plugin/package.json +++ b/packages/snaps-webpack-plugin/package.json @@ -39,7 +39,7 @@ "dist" ], "scripts": { - "build": "ts-bridge --project tsconfig.build.json --verbose --no-references", + "build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references", "changelog:update": "../../scripts/update-changelog.sh @metamask/snaps-webpack-plugin", "changelog:validate": "../../scripts/validate-changelog.sh @metamask/snaps-webpack-plugin", "lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies", diff --git a/scripts/verify-tsconfig.mjs b/scripts/verify-tsconfig.mjs index 25bb1fa427..e90c2da20a 100644 --- a/scripts/verify-tsconfig.mjs +++ b/scripts/verify-tsconfig.mjs @@ -2,27 +2,37 @@ import { promises as fs } from 'fs'; import pathUtils from 'path'; import { fileURLToPath } from 'url'; -const cwd = pathUtils.dirname(fileURLToPath(import.meta.url)) +const cwd = pathUtils.dirname(fileURLToPath(import.meta.url)); // These are the packages we expect to _not_ be referenced in the root tsconfig. const IGNORE_LIST = new Set(['examples', 'snaps-simulator', 'test-snaps']); // Get reference paths from root tsconfig.json -const rootTsconfig = JSON.parse(await fs.readFile('./tsconfig.json', { encoding: 'utf8' })); -const rootTsconfigReferences = new Set(rootTsconfig.references.map( - ({ path }) => path.split('/').pop() -)) +const rootTsconfig = JSON.parse( + await fs.readFile('./tsconfig.json', { encoding: 'utf8' }), +); + +const rootTsconfigReferences = new Set( + rootTsconfig.references.map(({ path }) => path.split('/').pop()), +); // Get the names of all directories in the packages directory const packagesPath = pathUtils.resolve(cwd, '../packages'); -const packageDirNames = (await fs.readdir(packagesPath, { withFileTypes: true })) +const packageDirNames = ( + await fs.readdir(packagesPath, { withFileTypes: true }) +) .filter((dirent) => dirent.isDirectory()) .map((dirent) => dirent.name); // Any unreferenced package dirs must either be referenced or ignored -const unreferencedPackageDirs = packageDirNames.filter((name) => !rootTsconfigReferences.has(name) && !IGNORE_LIST.has(name)) +const unreferencedPackageDirs = packageDirNames.filter( + (name) => !rootTsconfigReferences.has(name) && !IGNORE_LIST.has(name), +); + if (unreferencedPackageDirs.length > 0) { - throw new Error(`Found unreferenced package directories not in ignore list:\n\n\t${ - unreferencedPackageDirs.join('\n\t') - }\n\nEither reference or ignore the packages to continue.`) + throw new Error( + `Found unreferenced package directories not in ignore list:\n\n\t${unreferencedPackageDirs.join( + '\n\t', + )}\n\nEither reference or ignore the packages to continue.`, + ); } diff --git a/yarn.config.cjs b/yarn.config.cjs new file mode 100644 index 0000000000..b664ba13f6 --- /dev/null +++ b/yarn.config.cjs @@ -0,0 +1,759 @@ +// @ts-check +// This file is used to define, among other configuration, rules that Yarn will +// execute when you run `yarn constraints`. These rules primarily check the +// manifests of each package in the monorepo to ensure they follow a standard +// format, but also check the presence of certain files as well. + +/* eslint-disable jsdoc/valid-types */ + +const { defineConfig } = require('@yarnpkg/types'); +const { readFile } = require('fs/promises'); +const { get } = require('lodash'); +const { basename, resolve, join, relative } = require('path'); +const { inspect } = require('util'); + +const BASE_KEYWORDS = ['MetaMask', 'Snaps', 'Ethereum']; + +/** + * Aliases for the Yarn type definitions, to make the code more readable. + * + * @typedef {import('@yarnpkg/types').Yarn.Constraints.Yarn} Yarn + * @typedef {import('@yarnpkg/types').Yarn.Constraints.Workspace} Workspace + * @typedef {import('@yarnpkg/types').Yarn.Constraints.Dependency} Dependency + * @typedef {import('@yarnpkg/types').Yarn.Constraints.DependencyType} DependencyType + */ + +module.exports = defineConfig({ + async constraints({ Yarn }) { + const rootWorkspace = Yarn.workspace({ cwd: '.' }); + if (rootWorkspace === null) { + throw new Error('Could not find root workspace.'); + } + + const repositoryUri = rootWorkspace.manifest.repository.url.replace( + /\.git$/u, + '', + ); + + for (const workspace of Yarn.workspaces()) { + const workspaceBasename = getWorkspaceBasename(workspace); + const isChildWorkspace = workspace.cwd !== '.'; + const isPrivate = + 'private' in workspace.manifest && workspace.manifest.private === true; + const dependenciesByIdentAndType = getDependenciesByIdentAndType( + Yarn.dependencies({ workspace }), + ); + + const isExample = workspace.cwd.startsWith('packages/examples'); + + // All packages must have a name. + expectWorkspaceField(workspace, 'name'); + + if (isChildWorkspace) { + if (!isExample) { + // All non-root, non-example packages must have a name that matches its + // directory (e.g., a package in a workspace directory called `foo` must + // be called `@metamask/foo`). + expectWorkspaceField( + workspace, + 'name', + `@metamask/${workspaceBasename}`, + ); + } + + // All non-root packages must have a version. + expectWorkspaceField(workspace, 'version'); + + // All non-root packages must have a description that ends in a period. + expectWorkspaceDescription(workspace); + + // All non-root packages must include the same set of NPM keywords. + const customKeywords = get(workspace.manifest, 'keywords').filter( + (keyword) => !BASE_KEYWORDS.includes(keyword), + ); + expectWorkspaceField(workspace, 'keywords', [ + ...BASE_KEYWORDS, + ...customKeywords, + ]); + + // All non-root packages must have a homepage URL that includes its name. + expectWorkspaceField( + workspace, + 'homepage', + `${repositoryUri}/tree/main/${relative( + __dirname, + workspace.cwd, + )}#readme`, + ); + + // All non-root packages must have a URL for reporting bugs that points + // to the Issues page for the repository. + expectWorkspaceField(workspace, 'bugs.url', `${repositoryUri}/issues`); + + // All non-root packages must specify a Git repository within the + // MetaMask GitHub organization. + expectWorkspaceField(workspace, 'repository.type', 'git'); + expectWorkspaceField( + workspace, + 'repository.url', + `${repositoryUri}.git`, + ); + + // All non-root packages must have a license, defaulting to MIT. + await expectWorkspaceLicense(workspace); + + // All non-root packages must not have side effects. + expectWorkspaceField(workspace, 'sideEffects', false); + + if (!isPrivate && !isExample) { + // All non-root, non-example packages must set up ESM- and + // CommonJS-compatible exports correctly. + expectCorrectWorkspaceExports(workspace); + } + + // All non-root, non-example packages must have the same "build" script. + if ( + !isExample && + workspace.cwd !== 'packages/test-snaps' && + workspace.cwd !== 'packages/snaps-simulator' + ) { + expectWorkspaceField( + workspace, + 'scripts.build', + 'ts-bridge --project tsconfig.build.json --verbose --clean --no-references', + ); + } + + if (isPrivate) { + // All private, non-root packages must not have a "publish:preview" + // script. + workspace.unset('scripts.publish:preview'); + } else { + // All non-private, non-root packages must have the same + // "publish:preview" script. + expectWorkspaceField( + workspace, + 'scripts.publish:preview', + 'yarn npm publish --tag preview', + ); + } + + // No non-root packages may have a "prepack" script. + workspace.unset('scripts.prepack'); + + // All non-root package must have valid "changelog:update" and + // "changelog:validate" scripts. + expectWorkspaceField( + workspace, + 'scripts.changelog:validate', + `${getRelativePath(workspace, 'scripts/validate-changelog.sh')} ${ + workspace.manifest.name + }`, + ); + expectWorkspaceField( + workspace, + 'scripts.changelog:validate', + `${getRelativePath(workspace, 'scripts/validate-changelog.sh')} ${ + workspace.manifest.name + }`, + ); + + // All non-root packages must have a valid "since-latest-release" script. + expectWorkspaceField( + workspace, + 'scripts.since-latest-release', + getRelativePath(workspace, 'scripts', 'since-latest-release.sh'), + ); + + if (workspace.cwd !== 'packages/examples') { + // All non-root packages must have the same "test" script. + if (workspace.manifest.scripts['test:browser']) { + expectWorkspaceField( + workspace, + 'scripts.test', + 'jest --reporters=jest-silent-reporter && yarn test:browser', + ); + } else { + expectWorkspaceField( + workspace, + 'scripts.test', + 'jest --reporters=jest-silent-reporter', + ); + } + + // All non-root packages must have the same "test:clean" script. + expectWorkspaceField( + workspace, + 'scripts.test:clean', + 'jest --clearCache', + ); + + // All non-root packages must have the same "test:verbose" script. + expectWorkspaceField( + workspace, + 'scripts.test:verbose', + 'jest --verbose', + ); + + // All non-root packages must have the same "test:watch" script. + expectWorkspaceField(workspace, 'scripts.test:watch', 'jest --watch'); + } + } + + if (isChildWorkspace && !isPrivate) { + // The list of files included in all non-root packages must only include + // files generated during the build process. + expectWorkspaceArrayField(workspace, 'files', 'dist'); + } else { + // The root package must specify an empty set of published files. (This + // is required in order to be able to import anything in + // development-only scripts, as otherwise the + // `node/no-unpublished-require` ESLint rule will disallow it.) + expectWorkspaceField(workspace, 'files', []); + } + + // If one workspace package lists another workspace package within + // `dependencies` or `devDependencies`, the version used within the + // dependency range must match the current version of the dependency. + expectUpToDateWorkspaceDependenciesAndDevDependencies(Yarn, workspace); + + // If one workspace package lists another workspace package within + // `peerDependencies`, the dependency range must satisfy the current + // version of that package. + expectUpToDateWorkspacePeerDependencies(Yarn, workspace); + + // No dependency may be listed under both `dependencies` and + // `devDependencies`. + expectDependenciesNotInBothProdAndDev( + workspace, + dependenciesByIdentAndType, + ); + + // The root workspace (and only the root workspace) must specify the Yarn + // version required for development. + if (isChildWorkspace) { + workspace.unset('packageManager'); + } else { + expectWorkspaceField(workspace, 'packageManager', 'yarn@4.4.1'); + } + + // All packages must specify a minimum Node.js version of 18.18. + expectWorkspaceField(workspace, 'engines.node', '^18.16 || >=20'); + + // All non-root public packages should be published to the NPM registry; + // all non-root private packages should not. + if (isPrivate) { + workspace.unset('publishConfig'); + } else { + expectWorkspaceField(workspace, 'publishConfig.access', 'public'); + expectWorkspaceField( + workspace, + 'publishConfig.registry', + 'https://registry.npmjs.org/', + ); + } + } + + // All version ranges in `dependencies` and `devDependencies` for the same + // dependency across the monorepo must be the same. + expectConsistentDependenciesAndDevDependencies(Yarn); + }, +}); + +/** + * Get the relative path to a file from the workspace root. + * + * @param {Workspace} workspace - The workspace. + * @param {string} path - The path to the file, relative to the workspace + * root. + * @returns {string} The relative path to the script. + */ +function getRelativePath(workspace, ...path) { + return join(relative(workspace.cwd, __dirname), ...path); +} + +/** + * Construct a nested map of dependencies. The inner layer categorizes + * instances of the same dependency by its location in the manifest; the outer + * layer categorizes the inner layer by the name of the dependency. + * + * @param {Dependency[]} dependencies - The list of dependencies to transform. + * @returns {Map>} The resulting map. + */ +function getDependenciesByIdentAndType(dependencies) { + const dependenciesByIdentAndType = new Map(); + + for (const dependency of dependencies) { + const dependenciesForIdent = dependenciesByIdentAndType.get( + dependency.ident, + ); + + if (dependenciesForIdent === undefined) { + dependenciesByIdentAndType.set( + dependency.ident, + new Map([[dependency.type, dependency]]), + ); + } else { + dependenciesForIdent.set(dependency.type, dependency); + } + } + + return dependenciesByIdentAndType; +} + +/** + * Construct a nested map of non-peer dependencies (`dependencies` and + * `devDependencies`). The inner layer categorizes instances of the same + * dependency by the version range specified; the outer layer categorizes the + * inner layer by the name of the dependency itself. + * + * @param {Dependency[]} dependencies - The list of dependencies to transform. + * @returns {Map>} The resulting map. + */ +function getNonPeerDependenciesByIdent(dependencies) { + const nonPeerDependenciesByIdent = new Map(); + + for (const dependency of dependencies) { + if (dependency.type === 'peerDependencies') { + continue; + } + + const dependencyRangesForIdent = nonPeerDependenciesByIdent.get( + dependency.ident, + ); + + if (dependencyRangesForIdent === undefined) { + nonPeerDependenciesByIdent.set( + dependency.ident, + new Map([[dependency.range, [dependency]]]), + ); + } else { + const dependenciesForDependencyRange = dependencyRangesForIdent.get( + dependency.range, + ); + + if (dependenciesForDependencyRange === undefined) { + dependencyRangesForIdent.set(dependency.range, [dependency]); + } else { + dependenciesForDependencyRange.push(dependency); + } + } + } + + return nonPeerDependenciesByIdent; +} + +/** + * Get the basename of the workspace's directory. The workspace directory is + * expected to be in the form `/`, and this function + * will extract ``. + * + * @param {Workspace} workspace - The workspace. + * @returns {string} The name of the workspace. + */ +function getWorkspaceBasename(workspace) { + return basename(workspace.cwd); +} + +/** + * Get the absolute path to a file within the workspace. + * + * @param {Workspace} workspace - The workspace. + * @param {string} path - The path to the file, relative to the workspace root. + * @returns {string} The absolute path to the file. + */ +function getWorkspacePath(workspace, path) { + return resolve(__dirname, workspace.cwd, path); +} + +/** + * Get the contents of a file within the workspace. The file is expected to be + * encoded as UTF-8. + * + * @param {Workspace} workspace - The workspace. + * @param {string} path - The path to the file, relative to the workspace root. + * @returns {Promise} The contents of the file. + */ +async function getWorkspaceFile(workspace, path) { + return await readFile(getWorkspacePath(workspace, path), 'utf8'); +} + +/** + * Attempts to access the given file to know whether the file exists. + * + * @param {Workspace} workspace - The workspace. + * @param {string} path - The path to the file, relative to the workspace root. + * @returns {Promise} True if the file exists, false otherwise. + */ +async function workspaceFileExists(workspace, path) { + try { + await getWorkspaceFile(workspace, path); + } catch (error) { + if ('code' in error && error.code === 'ENOENT') { + return false; + } + throw error; + } + + return true; +} + +/** + * Expect that the workspace has the given field, and that it is a non-null + * value. If the field is not present, or is null, this will log an error, and + * cause the constraint to fail. + * + * If a value is provided, this will also verify that the field is equal to the + * given value. + * + * @param {Workspace} workspace - The workspace to check. + * @param {string} fieldName - The field to check. + * @param {unknown} [expectedValue] - The value to check. + */ +function expectWorkspaceField(workspace, fieldName, expectedValue = undefined) { + const fieldValue = get(workspace.manifest, fieldName); + + if (expectedValue !== undefined && expectedValue !== null) { + workspace.set(fieldName, expectedValue); + } else if (expectedValue === null) { + workspace.unset(fieldName); + } else if ( + expectedValue === undefined && + (fieldValue === undefined || fieldValue === null) + ) { + workspace.error(`Missing required field "${fieldName}".`); + } +} + +/** + * Expect that the workspace has the given field, and that it is an array-like + * property containing the specified value. If the field is not present, is not + * an array, or does not contain the value, this will log an error, and cause + * the constraint to fail. + * + * @param {Workspace} workspace - The workspace to check. + * @param {string} fieldName - The field to check. + * @param {unknown} expectedValue - The value that should be contained in the array. + */ +function expectWorkspaceArrayField( + workspace, + fieldName, + expectedValue = undefined, +) { + let fieldValue = get(workspace.manifest, fieldName); + + if (expectedValue) { + if (!Array.isArray(fieldValue)) { + fieldValue = []; + } + + if (!fieldValue.includes(expectedValue)) { + fieldValue.push(expectedValue); + workspace.set(fieldName, fieldValue); + } + } else if (fieldValue === undefined || fieldValue === null) { + workspace.error(`Missing required field "${fieldName}".`); + } +} + +/** + * Expect that the workspace has a description, and that it is a non-empty + * string. If the description is not present, or is null, this will log an + * error, and cause the constraint to fail. + * + * This will also verify that the description does not end with a period. + * + * @param {Workspace} workspace - The workspace to check. + */ +function expectWorkspaceDescription(workspace) { + expectWorkspaceField(workspace, 'description'); + + const { description } = workspace.manifest; + + if (typeof description !== 'string') { + workspace.error( + `Expected description to be a string, but got ${typeof description}.`, + ); + return; + } + + if (description === '') { + workspace.error(`Expected description not to be an empty string.`); + return; + } + + if (description.endsWith('.')) { + workspace.set('description', description.slice(0, -1)); + } +} + +/** + * Expect that the workspace has a license file, and that the `license` field is + * set. + * + * @param {Workspace} workspace - The workspace to check. + */ +async function expectWorkspaceLicense(workspace) { + if ( + !(await workspaceFileExists(workspace, 'LICENSE')) && + !(await workspaceFileExists(workspace, 'LICENSE.MIT0')) && + !(await workspaceFileExists(workspace, 'LICENSE.APACHE2')) + ) { + workspace.error('Could not find LICENSE file'); + } + + expectWorkspaceField(workspace, 'license'); +} + +/** + * Expect that the workspace has a `types` and `default` field in the `exports` + * object, and that they are in the correct order. + * + * @param {Workspace} workspace - The workspace to check. + * @param {string} exportKey - The key to check. + */ +function expectCorrectWorkspaceExportsOrder(workspace, exportKey) { + const exportValue = get(workspace.manifest, `exports["${exportKey}"]`); + if (typeof exportValue === 'string') { + return; + } + + const importKeys = Object.keys(exportValue.import || {}); + if (importKeys[0] !== 'types') { + workspace.error( + `Expected exports["${exportKey}"].import to specify "types" as first key`, + ); + } + + if (importKeys[1] !== 'default') { + workspace.error( + `Expected exports["${exportKey}"].import to specify "default" as second key`, + ); + } + + const requireKeys = Object.keys(exportValue.require || {}); + if (requireKeys[0] !== 'types') { + workspace.error( + `Expected exports["${exportKey}"].require to specify "types" as first key`, + ); + } + + if (requireKeys[1] !== 'default') { + workspace.error( + `Expected exports["${exportKey}"].require to specify "default" as second key`, + ); + } +} + +/** + * Expect that the workspace has the correct extension for the given export + * field. + * + * @param {Workspace} workspace - The workspace to check. + * @param {string} key - The key to check. + * @param {string} extension - The expected extension. + */ +function expectExportExtension(workspace, key, extension) { + const exportValue = get(workspace.manifest, key); + if (!exportValue.endsWith(extension)) { + workspace.error( + `Expected ${key} to end with ${extension}, but got ${exportValue}`, + ); + } +} + +/** + * Expect that the workspace has exports set up correctly. + * + * @param {Workspace} workspace - The workspace to check. + */ +function expectCorrectWorkspaceExports(workspace) { + const exportKeys = Object.keys(workspace.manifest.exports); + + if (!exportKeys.includes('.')) { + workspace.error('Expected exports to include "."'); + } + + // All non-root packages must provide the location of the ESM-compatible + // JavaScript entrypoint and its matching type declaration file. + expectWorkspaceField( + workspace, + 'exports["."].import.types', + './dist/index.d.mts', + ); + expectWorkspaceField( + workspace, + 'exports["."].import.default', + './dist/index.mjs', + ); + + // All non-root package must provide the location of the CommonJS-compatible + // entrypoint and its matching type declaration file. + expectWorkspaceField( + workspace, + 'exports["."].require.types', + './dist/index.d.cts', + ); + expectWorkspaceField( + workspace, + 'exports["."].require.default', + './dist/index.cjs', + ); + + for (const exportKey of exportKeys) { + const exportValue = get(workspace.manifest, `exports["${exportKey}"]`); + if (typeof exportValue === 'string') { + continue; + } + + expectCorrectWorkspaceExportsOrder(workspace, exportKey); + expectExportExtension( + workspace, + `exports["${exportKey}"].import.types`, + '.mts', + ); + + expectExportExtension( + workspace, + `exports["${exportKey}"].import.default`, + '.mjs', + ); + + expectExportExtension( + workspace, + `exports["${exportKey}"].require.types`, + '.cts', + ); + + expectExportExtension( + workspace, + `exports["${exportKey}"].require.default`, + '.cjs', + ); + + // Types should not be set in the export object directly, but rather in the + // `import` and `require` subfields. + expectWorkspaceField(workspace, `exports["${exportKey}"].types`, null); + } + + expectWorkspaceField(workspace, 'main', './dist/index.cjs'); + expectWorkspaceField(workspace, 'types', './dist/index.d.cts'); + + // All non-root packages must export a `package.json` file. + expectWorkspaceField( + workspace, + 'exports["./package.json"]', + './package.json', + ); +} + +/** + * Expect that if the workspace package lists another workspace package within + * `dependencies` or `devDependencies`, the version used within the dependency + * is `workspace:^`. + * + * @param {Yarn} Yarn - The Yarn "global". + * @param {Workspace} workspace - The workspace to check. + */ +function expectUpToDateWorkspaceDependenciesAndDevDependencies( + Yarn, + workspace, +) { + for (const dependency of Yarn.dependencies({ workspace })) { + const dependencyWorkspace = Yarn.workspace({ ident: dependency.ident }); + + if ( + dependencyWorkspace !== null && + dependency.type !== 'peerDependencies' + ) { + dependency.update('workspace:^'); + } + } +} + +/** + * Expect that if the workspace package lists another workspace package within + * `peerDependencies`, the dependency range satisfies the current version of + * that package. + * + * @param {Yarn} Yarn - The Yarn "global". + * @param {Workspace} workspace - The workspace to check. + */ +function expectUpToDateWorkspacePeerDependencies(Yarn, workspace) { + for (const dependency of Yarn.dependencies({ workspace })) { + const dependencyWorkspace = Yarn.workspace({ ident: dependency.ident }); + + if ( + dependencyWorkspace !== null && + dependency.type === 'peerDependencies' + ) { + expectWorkspaceField( + workspace, + `peerDependencies["${dependency.ident}"]`, + `workspace:^`, + ); + } + } +} + +/** + * Expect that a workspace package does not list a dependency in both + * `dependencies` and `devDependencies`. + * + * @param {Workspace} workspace - The workspace to check. + * @param {Map>} dependenciesByIdentAndType - Map of + * dependency ident to dependency type and dependency. + */ +function expectDependenciesNotInBothProdAndDev( + workspace, + dependenciesByIdentAndType, +) { + for (const [ + dependencyIdent, + dependencyInstancesByType, + ] of dependenciesByIdentAndType.entries()) { + if ( + dependencyInstancesByType.size > 1 && + !dependencyInstancesByType.has('peerDependencies') + ) { + workspace.error( + `\`${dependencyIdent}\` cannot be listed in both \`dependencies\` and \`devDependencies\``, + ); + } + } +} + +/** + * Expect that all version ranges in `dependencies` and `devDependencies` for + * the same dependency across the entire monorepo are the same. As it is + * impossible to compare NPM version ranges, let the user decide if there are + * conflicts. (`peerDependencies` is a special case, and we handle that + * particularly for workspace packages elsewhere). + * + * @param {Yarn} Yarn - The Yarn "global". + */ +function expectConsistentDependenciesAndDevDependencies(Yarn) { + const nonPeerDependenciesByIdent = getNonPeerDependenciesByIdent( + Yarn.dependencies(), + ); + + for (const [ + dependencyIdent, + dependenciesByRange, + ] of nonPeerDependenciesByIdent.entries()) { + const dependencyRanges = [...dependenciesByRange.keys()].sort(); + if (dependenciesByRange.size > 1) { + for (const dependencies of dependenciesByRange.values()) { + for (const dependency of dependencies) { + dependency.error( + `Expected version range for ${dependencyIdent} (in ${ + dependency.type + }) to be consistent across monorepo. Pick one: ${inspect( + dependencyRanges, + )}`, + ); + } + } + } + } +} diff --git a/yarn.lock b/yarn.lock index f87ec261b1..a395001c61 100644 --- a/yarn.lock +++ b/yarn.lock @@ -7889,10 +7889,10 @@ __metadata: languageName: node linkType: hard -"@types/lodash@npm:*": - version: 4.14.194 - resolution: "@types/lodash@npm:4.14.194" - checksum: 10/c075c0d52ddad80013586033f3ef9d04fa385ddd37eee0e7e0d9d0146e89f23d8834fb084f8f0807ca25aaee818f4da7cae94fdce07931c8cae58fcd94c469dd +"@types/lodash@npm:*, @types/lodash@npm:^4": + version: 4.17.7 + resolution: "@types/lodash@npm:4.17.7" + checksum: 10/b8177f19cf962414a66989837481b13f546afc2e98e8d465bec59e6ac03a59c584eb7053ce511cde3a09c5f3096d22a5ae22cfb56b23f3b0da75b0743b6b1a44 languageName: node linkType: hard @@ -8946,6 +8946,15 @@ __metadata: languageName: node linkType: hard +"@yarnpkg/types@npm:^4.0.0": + version: 4.0.0 + resolution: "@yarnpkg/types@npm:4.0.0" + dependencies: + tslib: "npm:^2.4.0" + checksum: 10/f9670e120761a4d17461df2f01aa4b92213fbdd063501a36145d11ea01bd87ba01d44615cba3d6bc8f9bfc39a03a9a6452bf0436c7fb0c9c5311352b975349e6 + languageName: node + linkType: hard + "@zag-js/element-size@npm:0.3.2": version: 0.3.2 resolution: "@zag-js/element-size@npm:0.3.2" @@ -20372,9 +20381,11 @@ __metadata: "@swc/core": "npm:1.3.78" "@ts-bridge/cli": "npm:^0.5.1" "@types/jest": "npm:^27.5.1" + "@types/lodash": "npm:^4" "@types/node": "npm:18.14.2" "@typescript-eslint/eslint-plugin": "npm:^5.42.1" "@typescript-eslint/parser": "npm:^6.21.0" + "@yarnpkg/types": "npm:^4.0.0" chromedriver: "npm:^127.0.0" depcheck: "npm:^1.4.7" eslint: "npm:^8.27.0" @@ -20391,6 +20402,7 @@ __metadata: jest: "npm:^29.0.2" jest-silent-reporter: "npm:^0.6.0" lint-staged: "npm:^12.4.1" + lodash: "npm:^4.17.21" minimatch: "npm:^7.4.1" prettier: "npm:^2.8.8" prettier-plugin-packagejson: "npm:^2.5.2"