From 28731b21af7733f57ad48457c0e04bfbf2408cab Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Tue, 23 Jul 2024 13:20:54 +0200 Subject: [PATCH 1/4] Bump `@metamask/providers` to `^17.1.1` --- .../snaps-execution-environments/package.json | 2 +- packages/snaps-sdk/package.json | 2 +- packages/test-snaps/package.json | 2 +- yarn.lock | 60 +++++++------------ 4 files changed, 24 insertions(+), 42 deletions(-) diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index dfb10fd99e..1c2771aa8c 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -54,7 +54,7 @@ "@metamask/json-rpc-engine": "^9.0.2", "@metamask/object-multiplex": "^2.0.0", "@metamask/post-message-stream": "^8.1.0", - "@metamask/providers": "17.0.0", + "@metamask/providers": "^17.1.1", "@metamask/rpc-errors": "^6.3.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index 72f95bc4dc..cc4baf09b3 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -60,7 +60,7 @@ }, "dependencies": { "@metamask/key-tree": "^9.1.2", - "@metamask/providers": "17.0.0", + "@metamask/providers": "^17.1.1", "@metamask/rpc-errors": "^6.3.1", "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^9.1.0" diff --git a/packages/test-snaps/package.json b/packages/test-snaps/package.json index 7139eead37..d3640dc0ad 100644 --- a/packages/test-snaps/package.json +++ b/packages/test-snaps/package.json @@ -71,7 +71,7 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@metamask/providers": "17.0.0", + "@metamask/providers": "^17.1.1", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", diff --git a/yarn.lock b/yarn.lock index fd6b8ff602..3e4c8d6a90 100644 --- a/yarn.lock +++ b/yarn.lock @@ -4877,7 +4877,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/json-rpc-engine@npm:^8.0.1, @metamask/json-rpc-engine@npm:^8.0.2": +"@metamask/json-rpc-engine@npm:^8.0.2": version: 8.0.2 resolution: "@metamask/json-rpc-engine@npm:8.0.2" dependencies: @@ -4888,7 +4888,7 @@ __metadata: languageName: node linkType: hard -"@metamask/json-rpc-engine@npm:^9.0.2": +"@metamask/json-rpc-engine@npm:^9.0.1, @metamask/json-rpc-engine@npm:^9.0.2": version: 9.0.2 resolution: "@metamask/json-rpc-engine@npm:9.0.2" dependencies: @@ -4935,19 +4935,7 @@ __metadata: languageName: unknown linkType: soft -"@metamask/json-rpc-middleware-stream@npm:^7.0.1": - version: 7.0.1 - resolution: "@metamask/json-rpc-middleware-stream@npm:7.0.1" - dependencies: - "@metamask/json-rpc-engine": ^8.0.1 - "@metamask/safe-event-emitter": ^3.0.0 - "@metamask/utils": ^8.3.0 - readable-stream: ^3.6.2 - checksum: aacf571a906c3c1d5376e9b1f78d47510b568cc64af26f432dfaa6c6d5480d86e0f8af36855c57a0de95c017313d7ff19bfc396c648aa6ee79f689092154d46b - languageName: node - linkType: hard - -"@metamask/json-rpc-middleware-stream@npm:^8.0.2": +"@metamask/json-rpc-middleware-stream@npm:^8.0.1, @metamask/json-rpc-middleware-stream@npm:^8.0.2": version: 8.0.2 resolution: "@metamask/json-rpc-middleware-stream@npm:8.0.2" dependencies: @@ -5291,24 +5279,24 @@ __metadata: languageName: node linkType: hard -"@metamask/providers@npm:17.0.0": - version: 17.0.0 - resolution: "@metamask/providers@npm:17.0.0" +"@metamask/providers@npm:^17.1.1": + version: 17.1.1 + resolution: "@metamask/providers@npm:17.1.1" dependencies: - "@metamask/json-rpc-engine": ^8.0.1 - "@metamask/json-rpc-middleware-stream": ^7.0.1 + "@metamask/json-rpc-engine": ^9.0.1 + "@metamask/json-rpc-middleware-stream": ^8.0.1 "@metamask/object-multiplex": ^2.0.0 - "@metamask/rpc-errors": ^6.2.1 + "@metamask/rpc-errors": ^6.3.1 "@metamask/safe-event-emitter": ^3.1.1 - "@metamask/utils": ^8.3.0 + "@metamask/utils": ^9.0.0 detect-browser: ^5.2.0 - extension-port-stream: ^3.0.0 + extension-port-stream: ^4.1.0 fast-deep-equal: ^3.1.3 is-stream: ^2.0.0 readable-stream: ^3.6.2 peerDependencies: webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 330e369458edc68d743d87b8b2597cdacac58df01b5fc31f565ae5dacee2390ee23693fb10fa451c6146665e87475a4c8f54163407eb05fceeb698900e34f9e6 + checksum: d5e3f8acff2bb172c836ecbaaac1f3f41ebc74dfd3ef5b71c59891ac724c5c68d48f8fd576aaf96d5a663d4019ea069fee7d07e79f75cb359abbc06001a4bb06 languageName: node linkType: hard @@ -5677,7 +5665,7 @@ __metadata: "@metamask/json-rpc-engine": ^9.0.2 "@metamask/object-multiplex": ^2.0.0 "@metamask/post-message-stream": ^8.1.0 - "@metamask/providers": 17.0.0 + "@metamask/providers": ^17.1.1 "@metamask/rpc-errors": ^6.3.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" @@ -5907,7 +5895,7 @@ __metadata: "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/key-tree": ^9.1.2 - "@metamask/providers": 17.0.0 + "@metamask/providers": ^17.1.1 "@metamask/rpc-errors": ^6.3.1 "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^9.1.0 @@ -6220,7 +6208,7 @@ __metadata: "@metamask/name-lookup-example-snap": "workspace:^" "@metamask/network-example-snap": "workspace:^" "@metamask/notification-example-snap": "workspace:^" - "@metamask/providers": 17.0.0 + "@metamask/providers": ^17.1.1 "@metamask/signature-insights-example-snap": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/utils": ^9.1.0 @@ -13263,13 +13251,14 @@ __metadata: languageName: node linkType: hard -"extension-port-stream@npm:^3.0.0": - version: 3.0.0 - resolution: "extension-port-stream@npm:3.0.0" +"extension-port-stream@npm:^4.1.0": + version: 4.2.0 + resolution: "extension-port-stream@npm:4.2.0" dependencies: readable-stream: ^3.6.2 || ^4.4.2 - webextension-polyfill: ">=0.10.0 <1.0" - checksum: 4f51d2258a96154c2d916a8a5425636a2b0817763e9277f7dc378d08b6f050c90d185dbde4313d27cf66ad99d4b3116479f9f699c40358c64cccfa524d2b55bf + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: 85559c82e3f3aa21462e234b30b7d53872708893664cd03f2f848af556cf0730cf2243b089efc9d40bbe9a4f73bd8fd19684db5a985329b0c4402b4f2fe26358 languageName: node linkType: hard @@ -22929,13 +22918,6 @@ __metadata: languageName: node linkType: hard -"webextension-polyfill@npm:>=0.10.0 <1.0": - version: 0.10.0 - resolution: "webextension-polyfill@npm:0.10.0" - checksum: 4a59036bda571360c2c0b2fb03fe1dc244f233946bcf9a6766f677956c40fd14d270aaa69cdba95e4ac521014afbe4008bfa5959d0ac39f91c990eb206587f91 - languageName: node - linkType: hard - "webidl-conversions@npm:^3.0.0": version: 3.0.1 resolution: "webidl-conversions@npm:3.0.1" From 6a2a62a972b45857dd06235b4a805ffe3a663886 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Tue, 23 Jul 2024 13:24:53 +0200 Subject: [PATCH 2/4] Add patch --- ...mask-providers-npm-17.1.1-d31d9bc479.patch | 20 ++++++++++++++++ package.json | 1 + .../lavamoat/browserify/iframe/policy.json | 10 ++------ .../browserify/node-process/policy.json | 10 ++------ .../browserify/node-thread/policy.json | 10 ++------ .../browserify/worker-executor/policy.json | 10 ++------ .../src/common/BaseSnapExecutor.ts | 2 +- .../src/types/vendor/providers.d.ts | 2 +- yarn.lock | 23 ++++++++++++++++++- 9 files changed, 53 insertions(+), 35 deletions(-) create mode 100644 .yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch diff --git a/.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch b/.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch new file mode 100644 index 0000000000..3a1d4d8aa7 --- /dev/null +++ b/.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch @@ -0,0 +1,20 @@ +diff --git a/StreamProvider.js b/StreamProvider.js +new file mode 100644 +index 0000000000000000000000000000000000000000..5b7d2b1ae6b7065db6ebd851b2311c09fd9be2cb +--- /dev/null ++++ b/StreamProvider.js +@@ -0,0 +1 @@ ++module.exports = require('./dist/StreamProvider.cjs'); +diff --git a/package.json b/package.json +index 51472a01e6dd9a77d82457370115ca9eba9c1b29..76fbfb8dded54d4bd22605a2d2e4679e79bab7e2 100644 +--- a/package.json ++++ b/package.json +@@ -29,7 +29,7 @@ + "default": "./dist/index.cjs" + } + }, +- "./dist/StreamProvider": { ++ "./StreamProvider": { + "import": { + "types": "./dist/StreamProvider.d.mts", + "default": "./dist/StreamProvider.mjs" diff --git a/package.json b/package.json index 3f4d4da597..2e1648d8f0 100644 --- a/package.json +++ b/package.json @@ -50,6 +50,7 @@ "@babel/core": "patch:@babel/core@npm%3A7.23.2#./.yarn/patches/@babel-core-npm-7.23.2-b93f586907.patch", "@esbuild-plugins/node-modules-polyfill@^0.2.2": "patch:@esbuild-plugins/node-modules-polyfill@npm%3A0.2.2#./.yarn/patches/@esbuild-plugins-node-modules-polyfill-npm-0.2.2-f612681798.patch", "@lavamoat/lavapack@^6.1.1": "patch:@lavamoat/lavapack@npm%3A6.1.1#./.yarn/patches/@lavamoat-lavapack-npm-6.1.1-b81af21193.patch", + "@metamask/providers@^17.1.1": "patch:@metamask/providers@npm%3A17.1.1#./.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch", "@metamask/utils": "9.1.0", "@puppeteer/browsers@1.4.6": "patch:@puppeteer/browsers@npm%3A1.7.0#./.yarn/patches/@puppeteer-browsers-npm-1.7.0-203cb4f44b.patch", "@puppeteer/browsers@^1.6.0": "patch:@puppeteer/browsers@npm%3A1.7.0#./.yarn/patches/@puppeteer-browsers-npm-1.7.0-203cb4f44b.patch", diff --git a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json index b251904ff1..dae83f8c30 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/iframe/policy.json @@ -42,8 +42,8 @@ "console": true }, "packages": { + "@metamask/json-rpc-engine": true, "@metamask/object-multiplex": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, "@metamask/providers>@metamask/safe-event-emitter": true, "@metamask/providers>is-stream": true, @@ -52,13 +52,6 @@ "readable-stream": true } }, - "@metamask/providers>@metamask/json-rpc-engine": { - "packages": { - "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true - } - }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { "globals": { "console.warn": true, @@ -66,6 +59,7 @@ }, "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/utils": true, "readable-stream": true } }, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json index 760ede1af5..c448fad6ed 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-process/policy.json @@ -49,8 +49,8 @@ "console": true }, "packages": { + "@metamask/json-rpc-engine": true, "@metamask/object-multiplex": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, "@metamask/providers>@metamask/safe-event-emitter": true, "@metamask/providers>is-stream": true, @@ -59,13 +59,6 @@ "readable-stream": true } }, - "@metamask/providers>@metamask/json-rpc-engine": { - "packages": { - "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true - } - }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { "globals": { "console.warn": true, @@ -73,6 +66,7 @@ }, "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/utils": true, "readable-stream": true } }, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json index 760ede1af5..c448fad6ed 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/node-thread/policy.json @@ -49,8 +49,8 @@ "console": true }, "packages": { + "@metamask/json-rpc-engine": true, "@metamask/object-multiplex": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, "@metamask/providers>@metamask/safe-event-emitter": true, "@metamask/providers>is-stream": true, @@ -59,13 +59,6 @@ "readable-stream": true } }, - "@metamask/providers>@metamask/json-rpc-engine": { - "packages": { - "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true - } - }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { "globals": { "console.warn": true, @@ -73,6 +66,7 @@ }, "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/utils": true, "readable-stream": true } }, diff --git a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json index b251904ff1..dae83f8c30 100644 --- a/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json +++ b/packages/snaps-execution-environments/lavamoat/browserify/worker-executor/policy.json @@ -42,8 +42,8 @@ "console": true }, "packages": { + "@metamask/json-rpc-engine": true, "@metamask/object-multiplex": true, - "@metamask/providers>@metamask/json-rpc-engine": true, "@metamask/providers>@metamask/json-rpc-middleware-stream": true, "@metamask/providers>@metamask/safe-event-emitter": true, "@metamask/providers>is-stream": true, @@ -52,13 +52,6 @@ "readable-stream": true } }, - "@metamask/providers>@metamask/json-rpc-engine": { - "packages": { - "@metamask/providers>@metamask/safe-event-emitter": true, - "@metamask/rpc-errors": true, - "@metamask/utils": true - } - }, "@metamask/providers>@metamask/json-rpc-middleware-stream": { "globals": { "console.warn": true, @@ -66,6 +59,7 @@ }, "packages": { "@metamask/providers>@metamask/safe-event-emitter": true, + "@metamask/utils": true, "readable-stream": true } }, diff --git a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts index cabd40c57d..6a7e9d8b56 100644 --- a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts +++ b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts @@ -2,7 +2,7 @@ /// import { createIdRemapMiddleware } from '@metamask/json-rpc-engine'; import type { RequestArguments } from '@metamask/providers'; -import { StreamProvider } from '@metamask/providers/dist/StreamProvider'; +import { StreamProvider } from '@metamask/providers/StreamProvider'; import { errorCodes, rpcErrors, serializeError } from '@metamask/rpc-errors'; import type { SnapsProvider } from '@metamask/snaps-sdk'; import { getErrorData } from '@metamask/snaps-sdk'; diff --git a/packages/snaps-execution-environments/src/types/vendor/providers.d.ts b/packages/snaps-execution-environments/src/types/vendor/providers.d.ts index ee47bdc797..0d71c93d8c 100644 --- a/packages/snaps-execution-environments/src/types/vendor/providers.d.ts +++ b/packages/snaps-execution-environments/src/types/vendor/providers.d.ts @@ -1,7 +1,7 @@ // TODO: Remove this file once we switch to `Node16` module resolution in // `tsconfig.json`. // eslint-disable-next-line import/unambiguous -declare module '@metamask/providers/dist/StreamProvider' { +declare module '@metamask/providers/StreamProvider' { import { StreamProvider } from '@metamask/providers'; export { StreamProvider }; diff --git a/yarn.lock b/yarn.lock index 3e4c8d6a90..a4ab7b2ccc 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5279,7 +5279,7 @@ __metadata: languageName: node linkType: hard -"@metamask/providers@npm:^17.1.1": +"@metamask/providers@npm:17.1.1": version: 17.1.1 resolution: "@metamask/providers@npm:17.1.1" dependencies: @@ -5300,6 +5300,27 @@ __metadata: languageName: node linkType: hard +"@metamask/providers@patch:@metamask/providers@npm%3A17.1.1#./.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch::locator=root%40workspace%3A.": + version: 17.1.1 + resolution: "@metamask/providers@patch:@metamask/providers@npm%3A17.1.1#./.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch::version=17.1.1&hash=544512&locator=root%40workspace%3A." + dependencies: + "@metamask/json-rpc-engine": ^9.0.1 + "@metamask/json-rpc-middleware-stream": ^8.0.1 + "@metamask/object-multiplex": ^2.0.0 + "@metamask/rpc-errors": ^6.3.1 + "@metamask/safe-event-emitter": ^3.1.1 + "@metamask/utils": ^9.0.0 + detect-browser: ^5.2.0 + extension-port-stream: ^4.1.0 + fast-deep-equal: ^3.1.3 + is-stream: ^2.0.0 + readable-stream: ^3.6.2 + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: aeaf4b80fb286b0b0ca82489d12bd3056b889b99b6bc40f24cf3635597c51b08be615fe6475f6b49efb03f661cd51e84d70c14c085ede92d92d742d36a381c59 + languageName: node + linkType: hard + "@metamask/rollup-plugin-example-snap@workspace:packages/examples/packages/rollup-plugin": version: 0.0.0-use.local resolution: "@metamask/rollup-plugin-example-snap@workspace:packages/examples/packages/rollup-plugin" From d616d53918870693cfa2dd50d25dd509fe6ed3b5 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Tue, 23 Jul 2024 14:19:45 +0200 Subject: [PATCH 3/4] Fix tests --- package.json | 6 ++++-- .../src/common/test-utils/endowments.ts | 6 +++--- packages/snaps-execution-environments/wdio.config.js | 1 + yarn.lock | 1 + 4 files changed, 9 insertions(+), 5 deletions(-) diff --git a/package.json b/package.json index 2e1648d8f0..068f6fdde1 100644 --- a/package.json +++ b/package.json @@ -107,7 +107,8 @@ "simple-git-hooks": "^2.7.0", "ts-node": "^10.9.1", "tsup": "^8.0.1", - "typescript": "~4.8.4" + "typescript": "~4.8.4", + "vite": "^4.3.9" }, "engines": { "node": "^18.16 || >=20" @@ -123,7 +124,8 @@ "ts-node>@swc/core": true, "@swc/core": true, "favicons>sharp": true, - "tsup>esbuild": true + "tsup>esbuild": true, + "vite>esbuild": true } }, "packageManager": "yarn@3.6.0" diff --git a/packages/snaps-execution-environments/src/common/test-utils/endowments.ts b/packages/snaps-execution-environments/src/common/test-utils/endowments.ts index 63baeb8379..1e97f2fa1d 100644 --- a/packages/snaps-execution-environments/src/common/test-utils/endowments.ts +++ b/packages/snaps-execution-environments/src/common/test-utils/endowments.ts @@ -2,8 +2,8 @@ import { walk } from '@lavamoat/lavatube'; import { createIdRemapMiddleware } from '@metamask/json-rpc-engine'; import ObjectMultiplex from '@metamask/object-multiplex'; -import { StreamProvider } from '@metamask/providers'; -import type { RequestArguments } from '@metamask/providers/dist/BaseProvider'; +import type { RequestArguments } from '@metamask/providers'; +import { StreamProvider } from '@metamask/providers/StreamProvider'; import { SNAP_STREAM_NAMES } from '@metamask/snaps-utils'; import { @@ -59,5 +59,5 @@ export function getMockedStreamProvider() { return await withTeardown(originalRequest(args), { lastTeardown: 0 }); }; - return proxyStreamProvider(provider, request); + return proxyStreamProvider(request); } diff --git a/packages/snaps-execution-environments/wdio.config.js b/packages/snaps-execution-environments/wdio.config.js index d809967292..e672b4a137 100644 --- a/packages/snaps-execution-environments/wdio.config.js +++ b/packages/snaps-execution-environments/wdio.config.js @@ -22,6 +22,7 @@ const config = { viteConfig: { plugins: [tsconfigPaths()], optimizeDeps: { + include: ['@metamask/providers/StreamProvider'], esbuildOptions: { plugins: [ NodeModulesPolyfillPlugin(), diff --git a/yarn.lock b/yarn.lock index a4ab7b2ccc..072e05228a 100644 --- a/yarn.lock +++ b/yarn.lock @@ -20341,6 +20341,7 @@ __metadata: ts-node: ^10.9.1 tsup: ^8.0.1 typescript: ~4.8.4 + vite: ^4.3.9 languageName: unknown linkType: soft From 52f6868273b379f5a8a9e79592d01e29d979bbc2 Mon Sep 17 00:00:00 2001 From: Maarten Zuidhoorn Date: Tue, 23 Jul 2024 15:05:01 +0200 Subject: [PATCH 4/4] Bump `@metamask/providers` to `^17.1.2` --- ...mask-providers-npm-17.1.1-d31d9bc479.patch | 20 ----------- package.json | 1 - .../snaps-execution-environments/package.json | 2 +- .../src/common/BaseSnapExecutor.ts | 2 +- .../src/common/test-utils/endowments.ts | 2 +- .../src/types/vendor/providers.d.ts | 2 +- .../wdio.config.js | 2 +- packages/snaps-sdk/package.json | 2 +- packages/test-snaps/package.json | 2 +- yarn.lock | 35 ++++--------------- 10 files changed, 14 insertions(+), 56 deletions(-) delete mode 100644 .yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch diff --git a/.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch b/.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch deleted file mode 100644 index 3a1d4d8aa7..0000000000 --- a/.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch +++ /dev/null @@ -1,20 +0,0 @@ -diff --git a/StreamProvider.js b/StreamProvider.js -new file mode 100644 -index 0000000000000000000000000000000000000000..5b7d2b1ae6b7065db6ebd851b2311c09fd9be2cb ---- /dev/null -+++ b/StreamProvider.js -@@ -0,0 +1 @@ -+module.exports = require('./dist/StreamProvider.cjs'); -diff --git a/package.json b/package.json -index 51472a01e6dd9a77d82457370115ca9eba9c1b29..76fbfb8dded54d4bd22605a2d2e4679e79bab7e2 100644 ---- a/package.json -+++ b/package.json -@@ -29,7 +29,7 @@ - "default": "./dist/index.cjs" - } - }, -- "./dist/StreamProvider": { -+ "./StreamProvider": { - "import": { - "types": "./dist/StreamProvider.d.mts", - "default": "./dist/StreamProvider.mjs" diff --git a/package.json b/package.json index 068f6fdde1..c70793675d 100644 --- a/package.json +++ b/package.json @@ -50,7 +50,6 @@ "@babel/core": "patch:@babel/core@npm%3A7.23.2#./.yarn/patches/@babel-core-npm-7.23.2-b93f586907.patch", "@esbuild-plugins/node-modules-polyfill@^0.2.2": "patch:@esbuild-plugins/node-modules-polyfill@npm%3A0.2.2#./.yarn/patches/@esbuild-plugins-node-modules-polyfill-npm-0.2.2-f612681798.patch", "@lavamoat/lavapack@^6.1.1": "patch:@lavamoat/lavapack@npm%3A6.1.1#./.yarn/patches/@lavamoat-lavapack-npm-6.1.1-b81af21193.patch", - "@metamask/providers@^17.1.1": "patch:@metamask/providers@npm%3A17.1.1#./.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch", "@metamask/utils": "9.1.0", "@puppeteer/browsers@1.4.6": "patch:@puppeteer/browsers@npm%3A1.7.0#./.yarn/patches/@puppeteer-browsers-npm-1.7.0-203cb4f44b.patch", "@puppeteer/browsers@^1.6.0": "patch:@puppeteer/browsers@npm%3A1.7.0#./.yarn/patches/@puppeteer-browsers-npm-1.7.0-203cb4f44b.patch", diff --git a/packages/snaps-execution-environments/package.json b/packages/snaps-execution-environments/package.json index 1c2771aa8c..53b2b11981 100644 --- a/packages/snaps-execution-environments/package.json +++ b/packages/snaps-execution-environments/package.json @@ -54,7 +54,7 @@ "@metamask/json-rpc-engine": "^9.0.2", "@metamask/object-multiplex": "^2.0.0", "@metamask/post-message-stream": "^8.1.0", - "@metamask/providers": "^17.1.1", + "@metamask/providers": "^17.1.2", "@metamask/rpc-errors": "^6.3.1", "@metamask/snaps-sdk": "workspace:^", "@metamask/snaps-utils": "workspace:^", diff --git a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts index 6a7e9d8b56..a6de058aa9 100644 --- a/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts +++ b/packages/snaps-execution-environments/src/common/BaseSnapExecutor.ts @@ -2,7 +2,7 @@ /// import { createIdRemapMiddleware } from '@metamask/json-rpc-engine'; import type { RequestArguments } from '@metamask/providers'; -import { StreamProvider } from '@metamask/providers/StreamProvider'; +import { StreamProvider } from '@metamask/providers/stream-provider'; import { errorCodes, rpcErrors, serializeError } from '@metamask/rpc-errors'; import type { SnapsProvider } from '@metamask/snaps-sdk'; import { getErrorData } from '@metamask/snaps-sdk'; diff --git a/packages/snaps-execution-environments/src/common/test-utils/endowments.ts b/packages/snaps-execution-environments/src/common/test-utils/endowments.ts index 1e97f2fa1d..39b2639453 100644 --- a/packages/snaps-execution-environments/src/common/test-utils/endowments.ts +++ b/packages/snaps-execution-environments/src/common/test-utils/endowments.ts @@ -3,7 +3,7 @@ import { walk } from '@lavamoat/lavatube'; import { createIdRemapMiddleware } from '@metamask/json-rpc-engine'; import ObjectMultiplex from '@metamask/object-multiplex'; import type { RequestArguments } from '@metamask/providers'; -import { StreamProvider } from '@metamask/providers/StreamProvider'; +import { StreamProvider } from '@metamask/providers/stream-provider'; import { SNAP_STREAM_NAMES } from '@metamask/snaps-utils'; import { diff --git a/packages/snaps-execution-environments/src/types/vendor/providers.d.ts b/packages/snaps-execution-environments/src/types/vendor/providers.d.ts index 0d71c93d8c..6321c07f2a 100644 --- a/packages/snaps-execution-environments/src/types/vendor/providers.d.ts +++ b/packages/snaps-execution-environments/src/types/vendor/providers.d.ts @@ -1,7 +1,7 @@ // TODO: Remove this file once we switch to `Node16` module resolution in // `tsconfig.json`. // eslint-disable-next-line import/unambiguous -declare module '@metamask/providers/StreamProvider' { +declare module '@metamask/providers/stream-provider' { import { StreamProvider } from '@metamask/providers'; export { StreamProvider }; diff --git a/packages/snaps-execution-environments/wdio.config.js b/packages/snaps-execution-environments/wdio.config.js index e672b4a137..00ad65ccf7 100644 --- a/packages/snaps-execution-environments/wdio.config.js +++ b/packages/snaps-execution-environments/wdio.config.js @@ -22,7 +22,7 @@ const config = { viteConfig: { plugins: [tsconfigPaths()], optimizeDeps: { - include: ['@metamask/providers/StreamProvider'], + include: ['@metamask/providers/stream-provider'], esbuildOptions: { plugins: [ NodeModulesPolyfillPlugin(), diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index cc4baf09b3..64dce992bc 100644 --- a/packages/snaps-sdk/package.json +++ b/packages/snaps-sdk/package.json @@ -60,7 +60,7 @@ }, "dependencies": { "@metamask/key-tree": "^9.1.2", - "@metamask/providers": "^17.1.1", + "@metamask/providers": "^17.1.2", "@metamask/rpc-errors": "^6.3.1", "@metamask/superstruct": "^3.1.0", "@metamask/utils": "^9.1.0" diff --git a/packages/test-snaps/package.json b/packages/test-snaps/package.json index d3640dc0ad..5caea653a1 100644 --- a/packages/test-snaps/package.json +++ b/packages/test-snaps/package.json @@ -71,7 +71,7 @@ "@metamask/eslint-config-jest": "^12.1.0", "@metamask/eslint-config-nodejs": "^12.1.0", "@metamask/eslint-config-typescript": "^12.1.0", - "@metamask/providers": "^17.1.1", + "@metamask/providers": "^17.1.2", "@pmmmwh/react-refresh-webpack-plugin": "^0.5.10", "@swc/core": "1.3.78", "@swc/jest": "^0.2.26", diff --git a/yarn.lock b/yarn.lock index 072e05228a..62ab4642e7 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5279,9 +5279,9 @@ __metadata: languageName: node linkType: hard -"@metamask/providers@npm:17.1.1": - version: 17.1.1 - resolution: "@metamask/providers@npm:17.1.1" +"@metamask/providers@npm:^17.1.2": + version: 17.1.2 + resolution: "@metamask/providers@npm:17.1.2" dependencies: "@metamask/json-rpc-engine": ^9.0.1 "@metamask/json-rpc-middleware-stream": ^8.0.1 @@ -5296,28 +5296,7 @@ __metadata: readable-stream: ^3.6.2 peerDependencies: webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: d5e3f8acff2bb172c836ecbaaac1f3f41ebc74dfd3ef5b71c59891ac724c5c68d48f8fd576aaf96d5a663d4019ea069fee7d07e79f75cb359abbc06001a4bb06 - languageName: node - linkType: hard - -"@metamask/providers@patch:@metamask/providers@npm%3A17.1.1#./.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch::locator=root%40workspace%3A.": - version: 17.1.1 - resolution: "@metamask/providers@patch:@metamask/providers@npm%3A17.1.1#./.yarn/patches/@metamask-providers-npm-17.1.1-d31d9bc479.patch::version=17.1.1&hash=544512&locator=root%40workspace%3A." - dependencies: - "@metamask/json-rpc-engine": ^9.0.1 - "@metamask/json-rpc-middleware-stream": ^8.0.1 - "@metamask/object-multiplex": ^2.0.0 - "@metamask/rpc-errors": ^6.3.1 - "@metamask/safe-event-emitter": ^3.1.1 - "@metamask/utils": ^9.0.0 - detect-browser: ^5.2.0 - extension-port-stream: ^4.1.0 - fast-deep-equal: ^3.1.3 - is-stream: ^2.0.0 - readable-stream: ^3.6.2 - peerDependencies: - webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: aeaf4b80fb286b0b0ca82489d12bd3056b889b99b6bc40f24cf3635597c51b08be615fe6475f6b49efb03f661cd51e84d70c14c085ede92d92d742d36a381c59 + checksum: 4cfe612649120049abd5d496e02facd86d0851c10e810a3e1289629857da027d77524e6cb8706d38b993bc5fd696bce6f1d33c93bb7d15169b6422e063f205ea languageName: node linkType: hard @@ -5686,7 +5665,7 @@ __metadata: "@metamask/json-rpc-engine": ^9.0.2 "@metamask/object-multiplex": ^2.0.0 "@metamask/post-message-stream": ^8.1.0 - "@metamask/providers": ^17.1.1 + "@metamask/providers": ^17.1.2 "@metamask/rpc-errors": ^6.3.1 "@metamask/snaps-sdk": "workspace:^" "@metamask/snaps-utils": "workspace:^" @@ -5916,7 +5895,7 @@ __metadata: "@metamask/eslint-config-nodejs": ^12.1.0 "@metamask/eslint-config-typescript": ^12.1.0 "@metamask/key-tree": ^9.1.2 - "@metamask/providers": ^17.1.1 + "@metamask/providers": ^17.1.2 "@metamask/rpc-errors": ^6.3.1 "@metamask/superstruct": ^3.1.0 "@metamask/utils": ^9.1.0 @@ -6229,7 +6208,7 @@ __metadata: "@metamask/name-lookup-example-snap": "workspace:^" "@metamask/network-example-snap": "workspace:^" "@metamask/notification-example-snap": "workspace:^" - "@metamask/providers": ^17.1.1 + "@metamask/providers": ^17.1.2 "@metamask/signature-insights-example-snap": "workspace:^" "@metamask/snaps-utils": "workspace:^" "@metamask/utils": ^9.1.0