Skip to content

Commit

Permalink
Use Webpack for Node.js bundles
Browse files Browse the repository at this point in the history
  • Loading branch information
FrederikBolding committed Oct 31, 2024
1 parent b65288b commit 6653e4b
Show file tree
Hide file tree
Showing 11 changed files with 662 additions and 284 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class NodeProcessExecutionService extends AbstractExecutionService<ChildP
}> {
const worker = fork(
require.resolve(
'@metamask/snaps-execution-environments/dist/browserify/node-process/bundle.js',
'@metamask/snaps-execution-environments/dist/webpack/node-process/bundle.js',
),
{
stdio: 'pipe',
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ export class NodeThreadExecutionService extends AbstractExecutionService<Worker>
}> {
const worker = new Worker(
require.resolve(
'@metamask/snaps-execution-environments/dist/browserify/node-thread/bundle.js',
'@metamask/snaps-execution-environments/dist/webpack/node-thread/bundle.js',
),
{
stdout: true,
Expand Down
2 changes: 1 addition & 1 deletion packages/snaps-controllers/wdio.config.js
Original file line number Diff line number Diff line change
Expand Up @@ -82,7 +82,7 @@ const config = {
mount: '/',
path: resolve(
__dirname,
'../snaps-execution-environments/dist/browserify/iframe',
'../snaps-execution-environments/dist/webpack/iframe',
),
},

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -33,25 +33,51 @@
"removeEventListener": true
},
"packages": {
"@metamask/utils": true,
"@metamask/post-message-stream>@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/post-message-stream>@metamask/utils": {
"globals": {
"Buffer": true,
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/superstruct": true,
"@metamask/utils>@noble/hashes": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"depcheck>semver": true,
"tsup>debug": true
}
},
"@metamask/providers": {
"globals": {
"console": true
},
"packages": {
"@metamask/json-rpc-engine": true,
"@metamask/object-multiplex": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/providers>is-stream": true,
"@metamask/providers>json-rpc-middleware-stream": true,
"@metamask/rpc-errors": true,
"eslint>fast-deep-equal": true,
"readable-stream": true
}
},
"@metamask/providers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/providers>@metamask/safe-event-emitter": {
"globals": {
"setTimeout": true
Expand All @@ -69,16 +95,6 @@
"browserify>buffer>ieee754": true
}
},
"@metamask/providers>json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/providers>@metamask/safe-event-emitter": true,
"readable-stream": true
}
},
"@metamask/rpc-errors": {
"packages": {
"@metamask/rpc-errors>fast-safe-stringify": true,
Expand All @@ -87,18 +103,8 @@
},
"@metamask/snaps-sdk": {
"packages": {
"@metamask/snaps-sdk>fast-xml-parser": true,
"@metamask/utils": true,
"superstruct": true
}
},
"@metamask/snaps-sdk>fast-xml-parser": {
"globals": {
"entityName": true,
"val": true
},
"packages": {
"@metamask/snaps-sdk>fast-xml-parser>strnum": true
"@metamask/superstruct": true,
"@metamask/utils": true
}
},
"@metamask/snaps-utils": {
Expand All @@ -111,22 +117,19 @@
"packages": {
"@metamask/rpc-errors": true,
"@metamask/snaps-sdk": true,
"@metamask/utils": true,
"superstruct": true
"@metamask/superstruct": true,
"@metamask/utils": true
}
},
"@metamask/utils": {
"globals": {
"Buffer": true,
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/superstruct": true,
"@metamask/utils>@noble/hashes": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"depcheck>semver": true,
"superstruct": true,
"tsup>debug": true
}
},
Expand Down Expand Up @@ -195,11 +198,6 @@
"localStorage": true
}
},
"superstruct": {
"globals": {
"console.warn": true
}
},
"tsup>debug": {
"globals": {
"console": true,
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,238 @@
{
"resources": {
"@metamask/json-rpc-engine": {
"packages": {
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/rpc-errors": true,
"@metamask/utils": true
}
},
"@metamask/object-multiplex": {
"globals": {
"console.warn": true
},
"packages": {
"@metamask/object-multiplex>once": true,
"readable-stream": true
}
},
"@metamask/object-multiplex>once": {
"packages": {
"@metamask/object-multiplex>once>wrappy": true
}
},
"@metamask/post-message-stream": {
"builtin": {
"worker_threads.parentPort": true
},
"globals": {
"MessageEvent.prototype": true,
"WorkerGlobalScope": true,
"addEventListener": true,
"browser": true,
"chrome": true,
"location.origin": true,
"postMessage": true,
"process.on": true,
"process.removeListener": true,
"process.send": true,
"removeEventListener": true
},
"packages": {
"@metamask/post-message-stream>@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/post-message-stream>@metamask/utils": {
"globals": {
"Buffer": true,
"TextDecoder": true,
"TextEncoder": true
},
"packages": {
"@metamask/superstruct": true,
"@metamask/utils>@noble/hashes": true,
"@metamask/utils>@scure/base": true,
"@metamask/utils>pony-cause": true,
"depcheck>semver": true,
"tsup>debug": true
}
},
"@metamask/providers": {
"globals": {
"console": true
},
"packages": {
"@metamask/json-rpc-engine": true,
"@metamask/object-multiplex": true,
"@metamask/providers>@metamask/json-rpc-middleware-stream": true,
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/providers>is-stream": true,
"@metamask/rpc-errors": true,
"eslint>fast-deep-equal": true,
"readable-stream": true
}
},
"@metamask/providers>@metamask/json-rpc-middleware-stream": {
"globals": {
"console.warn": true,
"setTimeout": true
},
"packages": {
"@metamask/providers>@metamask/safe-event-emitter": true,
"@metamask/utils": true,
"readable-stream": true
}
},
"@metamask/providers>@metamask/safe-event-emitter": {
"builtin": {
"events": true
},
"globals": {
"setTimeout": true
}
},
"@metamask/rpc-errors": {
"packages": {
"@metamask/rpc-errors>fast-safe-stringify": true,
"@metamask/utils": true
}
},
"@metamask/snaps-sdk": {
"packages": {
"@metamask/superstruct": true,
"@metamask/utils": true
}
},
"@metamask/snaps-utils": {
"globals": {
"URL": true,
"console.error": true,
"console.log": true,
"console.warn": true
},
"packages": {
"@metamask/rpc-errors": true,
"@metamask/snaps-sdk": true,
"@metamask/superstruct": true,
"@metamask/utils": true
}
},
"@metamask/utils": {
"globals": {
"TextEncoder": true
},
"packages": {
"@metamask/superstruct": true,
"@metamask/utils>@noble/hashes": true,
"@metamask/utils>pony-cause": true,
"depcheck>semver": true,
"tsup>debug": true
}
},
"@metamask/utils>@noble/hashes": {
"builtin": {
"node:crypto": true
},
"globals": {
"TextEncoder": true
}
},
"@metamask/utils>@scure/base": {
"globals": {
"TextDecoder": true,
"TextEncoder": true
}
},
"@wdio/mocha-framework>mocha>supports-color": {
"builtin": {
"os.release": true,
"tty.isatty": true
},
"globals": {
"process.env": true,
"process.platform": true
},
"packages": {
"istanbul-lib-report>supports-color>has-flag": true
}
},
"browserify>browser-pack>safe-buffer": {
"builtin": {
"buffer": true
}
},
"browserify>inherits": {
"builtin": {
"util.inherits": true
}
},
"browserify>string_decoder": {
"packages": {
"browserify>browser-pack>safe-buffer": true
}
},
"depcheck>semver": {
"globals": {
"console.error": true,
"process": true
},
"packages": {
"depcheck>semver>lru-cache": true
}
},
"depcheck>semver>lru-cache": {
"packages": {
"depcheck>semver>lru-cache>yallist": true
}
},
"istanbul-lib-report>supports-color>has-flag": {
"globals": {
"process.argv": true
}
},
"readable-stream": {
"builtin": {
"buffer.Buffer": true,
"events.EventEmitter": true,
"stream": true,
"util": true
},
"globals": {
"process.env.READABLE_STREAM": true,
"process.nextTick": true,
"process.stderr": true,
"process.stdout": true
},
"packages": {
"browserify>inherits": true,
"browserify>string_decoder": true,
"readable-stream>util-deprecate": true
}
},
"readable-stream>util-deprecate": {
"builtin": {
"util.deprecate": true
}
},
"tsup>debug": {
"builtin": {
"tty.isatty": true,
"util.deprecate": true,
"util.format": true,
"util.inspect": true
},
"globals": {
"console": true,
"document": true,
"localStorage": true,
"navigator": true,
"process": true
},
"packages": {
"@wdio/mocha-framework>mocha>supports-color": true,
"tsup>debug>ms": true
}
}
}
}
Loading

0 comments on commit 6653e4b

Please sign in to comment.