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 15 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
27 changes: 27 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 @@ -110,6 +110,10 @@ const schema = {
default: false,
type: 'boolean',
},
importAssertions: {
default: false,
type: 'boolean',
},
},
additionalProperties: false,
required: ['syntax'],
Expand All @@ -123,12 +127,30 @@ const schema = {
default: false,
type: 'boolean',
},
importAssertions: {
default: false,
type: 'boolean',
},
},
additionalProperties: false,
required: ['syntax'],
},
],
},
experimental: {
description: 'TODO',
Copy link
Contributor Author

Choose a reason for hiding this comment

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

fix this

type: 'object',
properties: {
keepImportAttributes: {
type: 'boolean',
default: false,
},
emitAssertForImportAttributes: {
type: 'boolean',
default: false,
},
},
},
},
additionalProperties: false,
},
Expand Down Expand Up @@ -201,6 +223,11 @@ export function getSwcLoader(
parser: {
syntax,
[syntax === 'typescript' ? 'tsx' : 'jsx']: enableJsx,
importAssertions: true,
},
experimental: {
keepImportAttributes: true,
emitAssertForImportAttributes: true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

unsure if all three or only some are needed, but definitely something needs to be set to deal with the import assertion

Copy link
Contributor Author

@jiexi jiexi Sep 11, 2024

Choose a reason for hiding this comment

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

If these are all false, I get the following from yarn webpack

ERROR in ../node_modules/@metamask/providers/dist/extension-provider/createExternalExtensionProvider.mjs
Module build failed (from ../development/webpack/utils/loaders/swcLoader.ts):
Error: 
  × Expected ';', got 'assert'
   ╭─[/Users/jiexi/Projects/metamask-extension/node_modules/@metamask/providers/dist/extension-provider/createExternalExtensionProvider.mjs:1:1]
 1 │ import { detect } from "detect-browser";
 2 │ import $extensionportstream from "extension-port-stream";
 3 │ const { PortDuplexStream: PortStream } = $extensionportstream;
 4 │ import config from "./external-extension-config.json" assert { type: "json" };
   ·                                                       ──────
 5 │ import { MetaMaskInpageProviderStreamName } from "../MetaMaskInpageProvider.mjs";
 6 │ import { StreamProvider } from "../StreamProvider.mjs";
 7 │ import { getDefaultExternalMiddleware } from "../utils.mjs";
   ╰────

},
},
} as const satisfies SwcLoaderOptions,
Expand Down
60 changes: 30 additions & 30 deletions lavamoat/browserify/beta/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,8 @@
"@metamask/eth-json-rpc-middleware>klona": true,
"@metamask/eth-json-rpc-middleware>safe-stable-stringify": true,
"@metamask/eth-sig-util": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/utils": true
}
},
Expand Down Expand Up @@ -1758,8 +1758,8 @@
"@metamask/network-controller>@metamask/eth-json-rpc-middleware": true,
"@metamask/network-controller>@metamask/eth-json-rpc-provider": true,
"@metamask/network-controller>@metamask/swappable-obj-proxy": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/utils": true,
"browserify>assert": true,
"uuid": true
Expand Down Expand Up @@ -1853,9 +1853,9 @@
},
"@metamask/network-controller>@metamask/eth-json-rpc-provider": {
"packages": {
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/safe-event-emitter": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"uuid": true
}
},
Expand Down Expand Up @@ -2070,8 +2070,8 @@
"@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/permission-controller>@metamask/utils": true,
"@metamask/permission-controller>nanoid": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"deep-freeze-strict": true,
"immer": true
}
Expand Down Expand Up @@ -2343,13 +2343,31 @@
"@metamask/profile-sync-controller>siwe>@stablelib/random>@stablelib/binary>@stablelib/int": true
}
},
"@metamask/providers>@metamask/json-rpc-engine": {
"packages": {
"@metamask/rpc-errors": true,
"@metamask/safe-event-emitter": true,
"@metamask/utils": true
}
},
"@metamask/providers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/queued-request-controller": {
"packages": {
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/queued-request-controller>@metamask/base-controller": true,
"@metamask/queued-request-controller>@metamask/utils": true,
"@metamask/rpc-errors": true,
"@metamask/selected-network-controller": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true
"@metamask/selected-network-controller": true
}
},
"@metamask/queued-request-controller>@metamask/base-controller": {
Expand Down Expand Up @@ -2715,10 +2733,10 @@
"packages": {
"@metamask/object-multiplex": true,
"@metamask/post-message-stream": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/base-controller": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": true,
"@metamask/snaps-controllers>@metamask/permission-controller": true,
"@metamask/snaps-controllers>@xstate/fsm": true,
"@metamask/snaps-controllers>concat-stream": true,
Expand Down Expand Up @@ -2749,33 +2767,15 @@
"immer": true
}
},
"@metamask/snaps-controllers>@metamask/json-rpc-engine": {
"packages": {
"@metamask/rpc-errors": true,
"@metamask/safe-event-emitter": true,
"@metamask/utils": true
}
},
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/snaps-controllers>@metamask/permission-controller": {
"globals": {
"console.error": true
},
"packages": {
"@metamask/controller-utils": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/base-controller": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-controllers>nanoid": true,
"@metamask/utils": true,
"deep-freeze-strict": true,
Expand Down Expand Up @@ -2887,8 +2887,8 @@
},
"packages": {
"@metamask/controller-utils": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/base-controller": true,
"@metamask/snaps-execution-environments>nanoid": true,
"@metamask/utils": true,
Expand Down Expand Up @@ -2919,8 +2919,8 @@
},
"packages": {
"@metamask/controller-utils": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/snaps-rpc-methods>@metamask/permission-controller>nanoid": true,
"@metamask/utils": true,
Expand Down Expand Up @@ -3009,8 +3009,8 @@
},
"packages": {
"@metamask/controller-utils": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-utils>@metamask/base-controller": true,
"@metamask/snaps-utils>@metamask/permission-controller>nanoid": true,
"@metamask/utils": true,
Expand Down
60 changes: 30 additions & 30 deletions lavamoat/browserify/flask/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -1079,8 +1079,8 @@
"@metamask/eth-json-rpc-middleware>klona": true,
"@metamask/eth-json-rpc-middleware>safe-stable-stringify": true,
"@metamask/eth-sig-util": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/utils": true
}
},
Expand Down Expand Up @@ -1758,8 +1758,8 @@
"@metamask/network-controller>@metamask/eth-json-rpc-middleware": true,
"@metamask/network-controller>@metamask/eth-json-rpc-provider": true,
"@metamask/network-controller>@metamask/swappable-obj-proxy": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/utils": true,
"browserify>assert": true,
"uuid": true
Expand Down Expand Up @@ -1853,9 +1853,9 @@
},
"@metamask/network-controller>@metamask/eth-json-rpc-provider": {
"packages": {
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/safe-event-emitter": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"uuid": true
}
},
Expand Down Expand Up @@ -2070,8 +2070,8 @@
"@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/permission-controller>@metamask/utils": true,
"@metamask/permission-controller>nanoid": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"deep-freeze-strict": true,
"immer": true
}
Expand Down Expand Up @@ -2343,13 +2343,31 @@
"@metamask/profile-sync-controller>siwe>@stablelib/random>@stablelib/binary>@stablelib/int": true
}
},
"@metamask/providers>@metamask/json-rpc-engine": {
"packages": {
"@metamask/rpc-errors": true,
"@metamask/safe-event-emitter": true,
"@metamask/utils": true
}
},
"@metamask/providers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/queued-request-controller": {
"packages": {
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/queued-request-controller>@metamask/base-controller": true,
"@metamask/queued-request-controller>@metamask/utils": true,
"@metamask/rpc-errors": true,
"@metamask/selected-network-controller": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true
"@metamask/selected-network-controller": true
}
},
"@metamask/queued-request-controller>@metamask/base-controller": {
Expand Down Expand Up @@ -2715,10 +2733,10 @@
"packages": {
"@metamask/object-multiplex": true,
"@metamask/post-message-stream": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/base-controller": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": true,
"@metamask/snaps-controllers>@metamask/permission-controller": true,
"@metamask/snaps-controllers>@xstate/fsm": true,
"@metamask/snaps-controllers>concat-stream": true,
Expand Down Expand Up @@ -2749,33 +2767,15 @@
"immer": true
}
},
"@metamask/snaps-controllers>@metamask/json-rpc-engine": {
"packages": {
"@metamask/rpc-errors": true,
"@metamask/safe-event-emitter": true,
"@metamask/utils": true
}
},
"@metamask/snaps-controllers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/snaps-controllers>@metamask/permission-controller": {
"globals": {
"console.error": true
},
"packages": {
"@metamask/controller-utils": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/base-controller": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-controllers>nanoid": true,
"@metamask/utils": true,
"deep-freeze-strict": true,
Expand Down Expand Up @@ -2887,8 +2887,8 @@
},
"packages": {
"@metamask/controller-utils": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-execution-environments>@metamask/snaps-utils>@metamask/base-controller": true,
"@metamask/snaps-execution-environments>nanoid": true,
"@metamask/utils": true,
Expand Down Expand Up @@ -2919,8 +2919,8 @@
},
"packages": {
"@metamask/controller-utils": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-rpc-methods>@metamask/permission-controller>@metamask/base-controller": true,
"@metamask/snaps-rpc-methods>@metamask/permission-controller>nanoid": true,
"@metamask/utils": true,
Expand Down Expand Up @@ -3009,8 +3009,8 @@
},
"packages": {
"@metamask/controller-utils": true,
"@metamask/providers>@metamask/json-rpc-engine": true,
"@metamask/rpc-errors": true,
"@metamask/snaps-controllers>@metamask/json-rpc-engine": true,
"@metamask/snaps-utils>@metamask/base-controller": true,
"@metamask/snaps-utils>@metamask/permission-controller>nanoid": true,
"@metamask/utils": true,
Expand Down
Loading