diff --git a/package.json b/package.json index 3f4d4da597..c70793675d 100644 --- a/package.json +++ b/package.json @@ -106,7 +106,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" @@ -122,7 +123,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/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/package.json b/packages/snaps-execution-environments/package.json index dfb10fd99e..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.0.0", + "@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 cabd40c57d..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/dist/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 63baeb8379..39b2639453 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/stream-provider'; 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/src/types/vendor/providers.d.ts b/packages/snaps-execution-environments/src/types/vendor/providers.d.ts index ee47bdc797..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/dist/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 d809967292..00ad65ccf7 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/stream-provider'], esbuildOptions: { plugins: [ NodeModulesPolyfillPlugin(), diff --git a/packages/snaps-sdk/package.json b/packages/snaps-sdk/package.json index 72f95bc4dc..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.0.0", + "@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 7139eead37..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.0.0", + "@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 fd6b8ff602..62ab4642e7 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.2": + version: 17.1.2 + resolution: "@metamask/providers@npm:17.1.2" 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: 4cfe612649120049abd5d496e02facd86d0851c10e810a3e1289629857da027d77524e6cb8706d38b993bc5fd696bce6f1d33c93bb7d15169b6422e063f205ea 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.2 "@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.2 "@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.2 "@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 @@ -20331,6 +20320,7 @@ __metadata: ts-node: ^10.9.1 tsup: ^8.0.1 typescript: ~4.8.4 + vite: ^4.3.9 languageName: unknown linkType: soft @@ -22929,13 +22919,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"