diff --git a/.yarn/patches/@metamask-providers-npm-17.2.0-cb0cfcdadc.patch b/.yarn/patches/@metamask-providers-npm-17.2.0-cb0cfcdadc.patch new file mode 100644 index 000000000000..3a0ec60d6f25 --- /dev/null +++ b/.yarn/patches/@metamask-providers-npm-17.2.0-cb0cfcdadc.patch @@ -0,0 +1,11 @@ +diff --git a/dist/extension-provider/createExternalExtensionProvider.mjs b/dist/extension-provider/createExternalExtensionProvider.mjs +index f2aa9285d84cd5e25c20f5202437c476cdacc326..121a9099e456d3444d8aae79574ba9c53e7f2699 100644 +--- a/dist/extension-provider/createExternalExtensionProvider.mjs ++++ b/dist/extension-provider/createExternalExtensionProvider.mjs +@@ -1,5 +1,4 @@ +-import $detectbrowser from "detect-browser"; +-const { detect } = $detectbrowser; ++import { detect } from "detect-browser"; + import $extensionportstream from "extension-port-stream"; + const { PortDuplexStream: PortStream } = $extensionportstream; + import config from "./external-extension-config.json" assert { type: "json" }; diff --git a/app/scripts/inpage.js b/app/scripts/inpage.js index d00a0542db03..ad42364af826 100644 --- a/app/scripts/inpage.js +++ b/app/scripts/inpage.js @@ -34,7 +34,7 @@ cleanContextForImports(); import log from 'loglevel'; import { v4 as uuid } from 'uuid'; import { WindowPostMessageStream } from '@metamask/post-message-stream'; -import { initializeProvider } from '@metamask/providers/dist/initializeInpageProvider'; +import { initializeProvider } from '@metamask/providers/dist/initializeInpageProvider.cjs'; import shouldInjectProvider from '../../shared/modules/provider-injection'; // contexts diff --git a/development/webpack/test/loaders.swcLoader.test.ts b/development/webpack/test/loaders.swcLoader.test.ts index b5dd1b7dcc20..eb894951d7ff 100644 --- a/development/webpack/test/loaders.swcLoader.test.ts +++ b/development/webpack/test/loaders.swcLoader.test.ts @@ -121,6 +121,7 @@ describe('swcLoader', () => { assert.deepStrictEqual(loader.options.jsc.parser, { syntax, [syntax === 'typescript' ? 'tsx' : 'jsx']: enableJsx, + importAssertions: true, importAttributes: true, }); assert.deepStrictEqual(loader.options.jsc.transform.react, { diff --git a/development/webpack/utils/loaders/swcLoader.ts b/development/webpack/utils/loaders/swcLoader.ts index 524aca4e31ab..1c4663b6d8e5 100644 --- a/development/webpack/utils/loaders/swcLoader.ts +++ b/development/webpack/utils/loaders/swcLoader.ts @@ -30,12 +30,17 @@ const schema = { default: false, }, experimental: { + description: 'TODO', type: 'object', properties: { keepImportAttributes: { type: 'boolean', default: false, }, + emitAssertForImportAttributes: { + type: 'boolean', + default: false, + }, }, additionalProperties: false, }, @@ -120,6 +125,10 @@ const schema = { default: false, type: 'boolean', }, + importAssertions: { + default: false, + type: 'boolean', + }, importAttributes: { description: 'Enable parsing of import attributes. Defaults to `false`.', @@ -139,6 +148,10 @@ const schema = { default: false, type: 'boolean', }, + importAssertions: { + default: false, + type: 'boolean', + }, importAttributes: { description: 'Enable parsing of import attributes. Defaults to `false`.', @@ -223,8 +236,13 @@ export function getSwcLoader( parser: { syntax, [syntax === 'typescript' ? 'tsx' : 'jsx']: enableJsx, + importAssertions: true, importAttributes: true, }, + experimental: { + keepImportAttributes: true, + emitAssertForImportAttributes: true, + }, }, } as const satisfies SwcLoaderOptions, }; diff --git a/package.json b/package.json index b97a1bdf5a9a..6cfa1d6f8c89 100644 --- a/package.json +++ b/package.json @@ -234,6 +234,8 @@ "@trezor/schema-utils@npm:1.0.2": "patch:@trezor/schema-utils@npm%3A1.0.2#~/.yarn/patches/@trezor-schema-utils-npm-1.0.2-7dd48689b2.patch", "lavamoat-core@npm:^15.1.1": "patch:lavamoat-core@npm%3A15.1.1#~/.yarn/patches/lavamoat-core-npm-15.1.1-51fbe39988.patch", "@metamask/snaps-sdk": "^6.9.0", + "@metamask/providers@npm:^17.1.2": "patch:@metamask/providers@npm%3A17.2.0#~/.yarn/patches/@metamask-providers-npm-17.2.0-cb0cfcdadc.patch", + "@metamask/providers@npm:^15.0.0": "patch:@metamask/providers@npm%3A17.2.0#~/.yarn/patches/@metamask-providers-npm-17.2.0-cb0cfcdadc.patch", "@swc/types@0.1.5": "^0.1.6", "@babel/core": "patch:@babel/core@npm%3A7.25.9#~/.yarn/patches/@babel-core-npm-7.25.9-4ae3bff7f3.patch", "@babel/runtime": "patch:@babel/runtime@npm%3A7.25.9#~/.yarn/patches/@babel-runtime-npm-7.25.9-fe8c62510a.patch", @@ -331,7 +333,7 @@ "@metamask/ppom-validator": "0.35.1", "@metamask/preinstalled-example-snap": "^0.2.0", "@metamask/profile-sync-controller": "^0.9.7", - "@metamask/providers": "^14.0.2", + "@metamask/providers": "patch:@metamask/providers@npm%3A17.2.0#~/.yarn/patches/@metamask-providers-npm-17.2.0-cb0cfcdadc.patch", "@metamask/queued-request-controller": "^2.0.0", "@metamask/rate-limit-controller": "^6.0.0", "@metamask/rpc-errors": "^7.0.0", diff --git a/yarn.lock b/yarn.lock index a8024a521207..ac545139ba74 100644 --- a/yarn.lock +++ b/yarn.lock @@ -5980,29 +5980,30 @@ __metadata: languageName: node linkType: hard -"@metamask/providers@npm:^14.0.2": - version: 14.0.2 - resolution: "@metamask/providers@npm:14.0.2" +"@metamask/providers@npm:17.2.0": + version: 17.2.0 + resolution: "@metamask/providers@npm:17.2.0" dependencies: - "@metamask/json-rpc-engine": "npm:^7.1.1" + "@metamask/json-rpc-engine": "npm:^9.0.1" + "@metamask/json-rpc-middleware-stream": "npm:^8.0.1" "@metamask/object-multiplex": "npm:^2.0.0" - "@metamask/rpc-errors": "npm:^6.0.0" - "@metamask/safe-event-emitter": "npm:^3.0.0" - "@metamask/utils": "npm:^8.1.0" + "@metamask/rpc-errors": "npm:^6.3.1" + "@metamask/safe-event-emitter": "npm:^3.1.1" + "@metamask/utils": "npm:^9.0.0" detect-browser: "npm:^5.2.0" - extension-port-stream: "npm:^3.0.0" + extension-port-stream: "npm:^4.1.0" fast-deep-equal: "npm:^3.1.3" is-stream: "npm:^2.0.0" - json-rpc-middleware-stream: "npm:^5.0.1" readable-stream: "npm:^3.6.2" - webextension-polyfill: "npm:^0.10.0" - checksum: 10/e5ad5d4261f7629df0fd2a7a60e5fbd5a0d39b54ab5b5917ddfc16f741e122625769d65d323c5a97d7dbe95be987e3d5cf1c2ca4fc28ed9f68dc369c9e3209f1 + peerDependencies: + webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 + checksum: 10/b2fc93cdc059528bfeb14a61d6153f9a5f2679e5c6640648c16cd4e5067f758a67c2c6abab962615e878e6b9d7f1bbcd3632584ad7e57ec9df8c16f47b13e608 languageName: node linkType: hard -"@metamask/providers@npm:^17.1.2": +"@metamask/providers@patch:@metamask/providers@npm%3A17.2.0#~/.yarn/patches/@metamask-providers-npm-17.2.0-cb0cfcdadc.patch": version: 17.2.0 - resolution: "@metamask/providers@npm:17.2.0" + resolution: "@metamask/providers@patch:@metamask/providers@npm%3A17.2.0#~/.yarn/patches/@metamask-providers-npm-17.2.0-cb0cfcdadc.patch::version=17.2.0&hash=25d614" dependencies: "@metamask/json-rpc-engine": "npm:^9.0.1" "@metamask/json-rpc-middleware-stream": "npm:^8.0.1" @@ -6017,7 +6018,7 @@ __metadata: readable-stream: "npm:^3.6.2" peerDependencies: webextension-polyfill: ^0.10.0 || ^0.11.0 || ^0.12.0 - checksum: 10/b2fc93cdc059528bfeb14a61d6153f9a5f2679e5c6640648c16cd4e5067f758a67c2c6abab962615e878e6b9d7f1bbcd3632584ad7e57ec9df8c16f47b13e608 + checksum: 10/afdc350c8ad8f1d481ca576f956fa9ba738e0a786803613c75b65ee94ef9f929ac0a716723243506643a953491465634794a7b1e166b28449b95d357e606bfa1 languageName: node linkType: hard @@ -23968,18 +23969,6 @@ __metadata: languageName: node linkType: hard -"json-rpc-middleware-stream@npm:^5.0.1": - version: 5.0.1 - resolution: "json-rpc-middleware-stream@npm:5.0.1" - dependencies: - "@metamask/json-rpc-engine": "npm:^7.1.1" - "@metamask/safe-event-emitter": "npm:^3.0.0" - "@metamask/utils": "npm:^8.1.0" - readable-stream: "npm:^3.6.2" - checksum: 10/b5e9b2ae21cc93586f1f4d8c6543634406575bf9cb6e909a4b5d47359b44519f37192a0262279291e5cde0876a67928d26d7e420d9e2aaf7992083e2c1f97a37 - languageName: node - linkType: hard - "json-rpc-random-id@npm:^1.0.0, json-rpc-random-id@npm:^1.0.1": version: 1.0.1 resolution: "json-rpc-random-id@npm:1.0.1" @@ -25942,7 +25931,7 @@ __metadata: "@metamask/preferences-controller": "npm:^13.0.2" "@metamask/preinstalled-example-snap": "npm:^0.2.0" "@metamask/profile-sync-controller": "npm:^0.9.7" - "@metamask/providers": "npm:^14.0.2" + "@metamask/providers": "patch:@metamask/providers@npm%3A17.2.0#~/.yarn/patches/@metamask-providers-npm-17.2.0-cb0cfcdadc.patch" "@metamask/queued-request-controller": "npm:^2.0.0" "@metamask/rate-limit-controller": "npm:^6.0.0" "@metamask/rpc-errors": "npm:^7.0.0" @@ -36452,7 +36441,7 @@ __metadata: languageName: node linkType: hard -"webextension-polyfill@npm:>=0.10.0 <1.0, webextension-polyfill@npm:^0.10.0": +"webextension-polyfill@npm:>=0.10.0 <1.0": version: 0.10.0 resolution: "webextension-polyfill@npm:0.10.0" checksum: 10/51ff30ebed4b1aa802b7f0347f05021b2fe492078bb1a597223d43995fcee96e2da8f914a2f6e36f988c1877ed5ab36ca7077f2f3ab828955151a59e4c01bf7e