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

chore: bump @metamask/providers to ^17.2.0 #27049

Closed
wants to merge 25 commits into from
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
25 commits
Select commit Hold shift + click to select a range
c2ab0db
bump @metamask/providers to ^17.2.0
jiexi Sep 10, 2024
26c9dae
Fix initializeProvider import
jiexi Sep 10, 2024
79642c4
Update LavaMoat policies
metamaskbot Sep 10, 2024
1374c7f
dedupe
jiexi Sep 10, 2024
03d402f
Merge remote-tracking branch 'origin/jl/bump-provider-17.2.0' into jl…
jiexi Sep 10, 2024
32a30e1
Webpack import assertion support
jiexi Sep 10, 2024
d7c0512
lint
jiexi Sep 10, 2024
cbda740
keepImportAttributes
jiexi Sep 11, 2024
375d390
Merge branch 'develop' into jl/bump-provider-17.2.0
jiexi Sep 11, 2024
48dd437
add emitAssertForImportAttributes
jiexi Sep 11, 2024
dddf498
Update LavaMoat policies
metamaskbot Sep 11, 2024
80dc1e5
see getDetect import default was issue
jiexi Sep 11, 2024
71c801f
Merge remote-tracking branch 'origin/jl/bump-provider-17.2.0' into jl…
jiexi Sep 11, 2024
1c0282a
Merge branch 'develop' into jl/bump-provider-17.2.0
jiexi Sep 11, 2024
17c36d0
fix: work around broken import/export of @metamask/providers
legobeat Oct 24, 2024
9de1ea4
Merge branch 'develop' into jl/bump-provider-17.2.0
legobeat Oct 24, 2024
9d33738
chore: update lavamoat policies
legobeat Oct 24, 2024
77b6e4e
fixup merge
legobeat Oct 24, 2024
dd44d55
chore: update webpack swcLoader snapshot
legobeat Oct 24, 2024
2c4af5d
chore: webpack test fix
legobeat Oct 24, 2024
cf3132e
Merge branch 'develop' into jl/bump-provider-17.2.0
legobeat Oct 25, 2024
640d766
Merge branch 'develop' into jl/bump-provider-17.2.0
legobeat Oct 29, 2024
4062d54
Merge branch 'develop' into jl/bump-provider-17.2.0
jiexi Oct 29, 2024
cac5cf0
yarn
jiexi Oct 29, 2024
ab43fd0
Update LavaMoat policies
metamaskbot Oct 29, 2024
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
11 changes: 11 additions & 0 deletions .yarn/patches/@metamask-providers-npm-17.2.0-cb0cfcdadc.patch
Original file line number Diff line number Diff line change
@@ -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" };
Comment on lines +1 to +11
Copy link
Contributor Author

Choose a reason for hiding this comment

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

without this patch, I get the following from the inpage provider in the dapp web console

createExternalExtensionProvider.mjs:2 Uncaught TypeError: Cannot destructure property 'detect' of 'detect_browser__WEBPACK_IMPORTED_MODULE_0__.default' as it is undefined.
    at 193000 (createExternalExtensionProvider.mjs:2:9)
    at __webpack_require__ (bootstrap:19:1)
    at 701043 (createExternalExtensionProvider.mjs:49:61)
    at __webpack_require__ (bootstrap:19:1)
    at make namespace object:7:1
    at inpage.js:70:1
    at inpage.js:70:1

2 changes: 1 addition & 1 deletion app/scripts/inpage.js
Original file line number Diff line number Diff line change
Expand Up @@ -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';
Copy link
Contributor

Choose a reason for hiding this comment

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

import { initializeProvider } from '@metamask/providers/dist/initializeInpageProvider.cjs';
import shouldInjectProvider from '../../shared/modules/provider-injection';

// contexts
Expand Down
1 change: 1 addition & 0 deletions development/webpack/test/loaders.swcLoader.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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, {
Expand Down
18 changes: 18 additions & 0 deletions development/webpack/utils/loaders/swcLoader.ts
Copy link
Contributor Author

Choose a reason for hiding this comment

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

these changes probably should be moved into a separate PR

Original file line number Diff line number Diff line change
Expand Up @@ -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,
},
Expand Down Expand Up @@ -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`.',
Expand All @@ -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`.',
Expand Down Expand Up @@ -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,
};
Expand Down
4 changes: 3 additions & 1 deletion package.json
Original file line number Diff line number Diff line change
Expand Up @@ -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/[email protected]": "^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",
Expand Down Expand Up @@ -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",
Expand Down
45 changes: 17 additions & 28 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -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"
Expand All @@ -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

Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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"
Expand Down Expand Up @@ -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
Expand Down