Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Update packages to be browser-first and use separate export for Node.js #2211

Merged
merged 13 commits into from
Feb 23, 2024
13 changes: 13 additions & 0 deletions .yarn/patches/tsconfig-paths-npm-3.14.2-90ce75420d.patch
Original file line number Diff line number Diff line change
@@ -0,0 +1,13 @@
diff --git a/lib/try-path.js b/lib/try-path.js
index de11ccbf9090658eb0ee61bdba1984ee21bcb3b7..2e75f72483aa7b05bf0a2cde06b3c009eb2103e8 100644
--- a/lib/try-path.js
+++ b/lib/try-path.js
@@ -85,6 +85,6 @@ function matchStar(pattern, search) {
if (search.substr(search.length - part2.length) !== part2) {
return undefined;
}
- return search.substr(star, search.length - part2.length);
+ return search.substr(star, search.length - part2.length - part1.length);
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I'm not sure if this is a bug or not, but the previous behaviour was unexpected (and I'm not sure how this worked before). Basically when checking a tsconfig.json path with a wildcard, this function returns the replacement for the path.

  • Pattern: @metamask/*/node
    Input: @metamask/snaps-utils/node
    Result: snaps-utils
  • Pattern: @metamask/*
    Input: @metamask/snaps-controllers
    Result: snaps-controllers

And so on. Before this change however, it would return:

  • Pattern: @metamask/*/node
    Input: @metamask/snaps-utils/node
    Result: snaps-utils/node

Meaning that it would resolve to packages/snaps-utils/node/src/... and some other invalid paths. This causes it to fall back to Node.js' default resolver, which would look at the package.json of snaps-utils and try to load packages/snaps-utils/dist/node.js, but we can't do that since the file may not be built yet.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need to try and upstream this. Also we need to determine if it is a bug before merging 😓

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

There's a ~3.5 year old issue and PR open in tsconfig-paths to fix this. It does appear to be a bug.

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Can we try opening a well-reasoned PR with tests etc that is an easy merge for the maintainers?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Sure, but do you think that should block merging this?

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

It would be nice to get confirmation that it's a bug, but probably not blocking

}
//# sourceMappingURL=try-path.js.map
\ No newline at end of file
5 changes: 3 additions & 2 deletions constraints.pro
Original file line number Diff line number Diff line change
Expand Up @@ -204,8 +204,9 @@ gen_enforced_field(WorkspaceCwd, 'scripts.build', 'tsup --clean && yarn build:ty
\+ 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') :-
WorkspaceCwd \= 'packages/snaps-cli',
WorkspaceCwd \= 'packages/snaps-execution-environments'.
FrederikBolding marked this conversation as resolved.
Show resolved Hide resolved
gen_enforced_field(WorkspaceCwd, 'scripts.build:types', 'tsc --project tsconfig.build.json') :-
\+ is_example(WorkspaceCwd),
\+ workspace_field(WorkspaceCwd, 'private', true),
WorkspaceCwd \= '.'.
Expand Down
1 change: 1 addition & 0 deletions jest.config.base.js
Original file line number Diff line number Diff line change
Expand Up @@ -95,6 +95,7 @@ module.exports = {
// A map from regular expressions to module names or to arrays of module names that allow to stub out resources with a single module
moduleNameMapper: {
'^@metamask/(.+)/test-utils$': ['<rootDir>/../$1/src/test-utils'],
'^@metamask/(.+)/node$': ['<rootDir>/../$1/src/node'],
'^@metamask/(.+)$': [
'<rootDir>/../$1/src',
'<rootDir>/../../node_modules/@metamask/$1',
Expand Down
5 changes: 4 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,10 @@
"jest-util@^29.5.0": "patch:jest-util@npm%3A29.6.3#./.yarn/patches/jest-util-npm-29.6.3-6ffdea2c1c.patch",
"jest-util@^29.6.3": "patch:jest-util@npm%3A29.6.3#./.yarn/patches/jest-util-npm-29.6.3-6ffdea2c1c.patch",
"lavamoat-browserify@^17.0.4": "patch:lavamoat-browserify@npm%3A17.0.4#./.yarn/patches/lavamoat-browserify-npm-17.0.4-5df88049cf.patch",
"luxon@^3.2.1": "patch:luxon@npm%3A3.3.0#./.yarn/patches/luxon-npm-3.3.0-bdbae9bfd5.patch"
"luxon@^3.2.1": "patch:luxon@npm%3A3.3.0#./.yarn/patches/luxon-npm-3.3.0-bdbae9bfd5.patch",
"tsconfig-paths@^3.11.0": "patch:tsconfig-paths@npm%3A3.14.2#./.yarn/patches/tsconfig-paths-npm-3.14.2-90ce75420d.patch",
"tsconfig-paths@^3.14.1": "patch:tsconfig-paths@npm%3A3.14.2#./.yarn/patches/tsconfig-paths-npm-3.14.2-90ce75420d.patch",
"tsconfig-paths@^4.1.2": "patch:tsconfig-paths@npm%3A3.14.2#./.yarn/patches/tsconfig-paths-npm-3.14.2-90ce75420d.patch"
},
"devDependencies": {
"@lavamoat/allow-scripts": "^3.0.2",
Expand Down
2 changes: 1 addition & 1 deletion packages/create-snap/src/cmds/init/initHandler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@ import {
readJsonFile,
createSnapManifest,
logInfo,
} from '@metamask/snaps-utils';
} from '@metamask/snaps-utils/node';
import type { SemVerRange, SemVerVersion } from '@metamask/utils';
import { satisfiesVersionRange } from '@metamask/utils';
import { promises as fs } from 'fs';
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/bip32/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip32/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "AaLbshZePKcSV2NORnmd5AjzkX5vNQToD3PaE4YpUUQ=",
"shasum": "Gd22Ra/FTR8V9vvsBZIWjDZG5z1NfmbzvX5j6/hYAyA=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/bip44/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/bip44/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "q5WeZJXrE5mgP2Z6Fo/aJrVuspPsQgsUn3/SmHuwsGY=",
"shasum": "/kHhPnMUYOkC3E1CuB5ngM8Mnou4PkjimKqCmpK2Gck=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/browserify-plugin/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/browserify/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
1 change: 1 addition & 0 deletions packages/examples/packages/browserify/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@
"resolveJsonModule": true,
"baseUrl": "./",
"paths": {
"@metamask/*/node": ["../../../*/src/node"],
"@metamask/*": ["../../../*/src"]
}
},
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/client-status/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/cronjobs/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/cronjobs/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "wXAAi/QR4BT1Gp6OiSqCpq+3U7pyRtMQ/LP9LeWwEPk=",
"shasum": "zHa2vgQgfBfSIXT3QqDKVL4YfpxwDonbdZkILpwGPO8=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/dialogs/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/dialogs/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "EepV6igtZ0ZCX579Ws6f9u0/kYnp65+6OK1SgzCm9Dg=",
"shasum": "Wftu6BGjaYT+DXL/Cn8Gck1QXoBwB38MCj2yB63WWuk=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/errors/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/ethereum-provider/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/ethers-js/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/ethers-js/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "AjzlrjmJQTKwGM77EXcpEzjF9bsKK7up36BSA4qhasU=",
"shasum": "XmL7EjQCPlW0awlEn4xSV9KRP/bilZUtkKVug0XkfHs=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/get-entropy/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/get-entropy/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "9jRaEw4/0RCp3b3oAI+PK2zcgwupdOnBhaL4zX4pKRg=",
"shasum": "sJ3r94HPmIlla/608eE3rfQIynwqld8hNuFlB1ql6+8=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/get-file/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/home-page/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/home-page/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "4LSF+30bmPlizM/wYBrq4dp72wkcca9rwYyqkz7ZPvY=",
"shasum": "mHYTfsz7m1KBUGY1ea3oyzKMlkALE+1LuapH8lHQgkg=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/images/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
2 changes: 1 addition & 1 deletion packages/examples/packages/images/snap.manifest.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "v2cJ3d1fomwpUzSR+XZCLF88e5k0NOm5aVo8dftKKSU=",
"shasum": "BP1QxFZ4M09F0DquuEgBisM2RX4kejUUzzRyh2+Rxzw=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/interactive-ui/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "sKqHlIDCKGyzDhV7wlJTv7RR6m6lrJF4KgyoTacwYao=",
"shasum": "+2kLtnz+tutH+k4Q3Zl4mBwsDCQ3i91pbSpJ07l/S8w=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../../../$1/src/node',
'<rootDir>/../../../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../../../$1/src',
'<rootDir>/../../../../../../node_modules/@metamask/$1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../../../$1/src/node',
'<rootDir>/../../../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../../../$1/src',
'<rootDir>/../../../../../../node_modules/@metamask/$1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "ojUZu1+nqCNBVoWHAaDkNRqWx+JVQfaKTOcyGDFD2Wg=",
"shasum": "/NEqj3PPnJcIbd89StkOwZiS6IftZWX/vnb0ffIeOfw=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/json-rpc/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
1 change: 1 addition & 0 deletions packages/examples/packages/json-rpc/tsconfig.json
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@
"compilerOptions": {
"baseUrl": "./",
"paths": {
"@metamask/*/node": ["../../../*/src/node"],
"@metamask/*": ["../../../*/src"]
}
},
Expand Down
5 changes: 5 additions & 0 deletions packages/examples/packages/lifecycle-hooks/jest.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,11 @@ module.exports = deepmerge(baseConfig, {
// This is required for the tests to run inside the `MetaMask/snaps`
// repository. You don't need this in your own project.
moduleNameMapper: {
'^@metamask/(.+)/node$': [
'<rootDir>/../../../$1/src/node',
'<rootDir>/../../../../node_modules/@metamask/$1/node',
'<rootDir>/node_modules/@metamask/$1/node',
],
'^@metamask/(.+)$': [
'<rootDir>/../../../$1/src',
'<rootDir>/../../../../node_modules/@metamask/$1',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"url": "https://github.com/MetaMask/snaps.git"
},
"source": {
"shasum": "cyr+aslb2DLAQOj2fs5pBwp3l1WKZU6muxrmhsbAtks=",
"shasum": "9bi/uW6gAhAeO+I8KTcTWhAHyX9kKKvC3Cmr6IiTerY=",
"location": {
"npm": {
"filePath": "dist/bundle.js",
Expand Down
Loading
Loading