@metamask/snaps-cli 6.6.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -1
- package/README.md +11 -244
- package/dist/builders.cjs +4 -98
- package/dist/builders.cjs.map +1 -1
- package/dist/builders.d.cts +28 -7
- package/dist/builders.d.cts.map +1 -1
- package/dist/builders.d.mts +28 -7
- package/dist/builders.d.mts.map +1 -1
- package/dist/builders.mjs +4 -97
- package/dist/builders.mjs.map +1 -1
- package/dist/cli.cjs +4 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts.map +1 -1
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +4 -16
- package/dist/cli.mjs.map +1 -1
- package/dist/commands/build/build.cjs +33 -7
- package/dist/commands/build/build.cjs.map +1 -1
- package/dist/commands/build/build.d.cts +2 -1
- package/dist/commands/build/build.d.cts.map +1 -1
- package/dist/commands/build/build.d.mts +2 -1
- package/dist/commands/build/build.d.mts.map +1 -1
- package/dist/commands/build/build.mjs +31 -5
- package/dist/commands/build/build.mjs.map +1 -1
- package/dist/commands/build/implementation.cjs +1 -1
- package/dist/commands/build/implementation.cjs.map +1 -1
- package/dist/commands/build/implementation.d.cts +3 -2
- package/dist/commands/build/implementation.d.cts.map +1 -1
- package/dist/commands/build/implementation.d.mts +3 -2
- package/dist/commands/build/implementation.d.mts.map +1 -1
- package/dist/commands/build/implementation.mjs +1 -1
- package/dist/commands/build/implementation.mjs.map +1 -1
- package/dist/commands/build/index.cjs +3 -14
- package/dist/commands/build/index.cjs.map +1 -1
- package/dist/commands/build/index.d.cts.map +1 -1
- package/dist/commands/build/index.d.mts.map +1 -1
- package/dist/commands/build/index.mjs +3 -14
- package/dist/commands/build/index.mjs.map +1 -1
- package/dist/commands/build/utils.cjs +25 -0
- package/dist/commands/build/utils.cjs.map +1 -0
- package/dist/commands/build/utils.d.cts +9 -0
- package/dist/commands/build/utils.d.cts.map +1 -0
- package/dist/commands/build/utils.d.mts +9 -0
- package/dist/commands/build/utils.d.mts.map +1 -0
- package/dist/commands/build/utils.mjs +21 -0
- package/dist/commands/build/utils.mjs.map +1 -0
- package/dist/commands/eval/__test__/webpack/bad/snap.config.cjs +0 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.cjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.d.cts.map +1 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.d.mts.map +1 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.mjs +0 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.mjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.cjs +0 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.cjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.d.cts.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.d.mts.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.mjs +0 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.mjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.cjs +0 -1
- package/dist/commands/eval/__test__/webpack/snap.config.cjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.d.cts.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.d.mts.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.mjs +0 -1
- package/dist/commands/eval/__test__/webpack/snap.config.mjs.map +1 -1
- package/dist/commands/eval/eval.cjs +1 -1
- package/dist/commands/eval/eval.cjs.map +1 -1
- package/dist/commands/eval/eval.d.cts.map +1 -1
- package/dist/commands/eval/eval.d.mts.map +1 -1
- package/dist/commands/eval/eval.mjs +1 -1
- package/dist/commands/eval/eval.mjs.map +1 -1
- package/dist/commands/eval/index.cjs +1 -4
- package/dist/commands/eval/index.cjs.map +1 -1
- package/dist/commands/eval/index.d.cts.map +1 -1
- package/dist/commands/eval/index.d.mts.map +1 -1
- package/dist/commands/eval/index.mjs +1 -4
- package/dist/commands/eval/index.mjs.map +1 -1
- package/dist/commands/manifest/index.cjs +1 -4
- package/dist/commands/manifest/index.cjs.map +1 -1
- package/dist/commands/manifest/index.d.cts.map +1 -1
- package/dist/commands/manifest/index.d.mts.map +1 -1
- package/dist/commands/manifest/index.mjs +1 -4
- package/dist/commands/manifest/index.mjs.map +1 -1
- package/dist/commands/manifest/manifest.cjs +5 -6
- package/dist/commands/manifest/manifest.cjs.map +1 -1
- package/dist/commands/manifest/manifest.d.cts.map +1 -1
- package/dist/commands/manifest/manifest.d.mts.map +1 -1
- package/dist/commands/manifest/manifest.mjs +5 -6
- package/dist/commands/manifest/manifest.mjs.map +1 -1
- package/dist/commands/serve/index.cjs +2 -2
- package/dist/commands/serve/index.cjs.map +1 -1
- package/dist/commands/serve/index.d.cts.map +1 -1
- package/dist/commands/serve/index.d.mts.map +1 -1
- package/dist/commands/serve/index.mjs +2 -2
- package/dist/commands/serve/index.mjs.map +1 -1
- package/dist/commands/watch/implementation.cjs +2 -0
- package/dist/commands/watch/implementation.cjs.map +1 -1
- package/dist/commands/watch/implementation.d.cts +2 -2
- package/dist/commands/watch/implementation.d.cts.map +1 -1
- package/dist/commands/watch/implementation.d.mts +2 -2
- package/dist/commands/watch/implementation.d.mts.map +1 -1
- package/dist/commands/watch/implementation.mjs +2 -0
- package/dist/commands/watch/implementation.mjs.map +1 -1
- package/dist/commands/watch/index.cjs +2 -17
- package/dist/commands/watch/index.cjs.map +1 -1
- package/dist/commands/watch/index.d.cts.map +1 -1
- package/dist/commands/watch/index.d.mts.map +1 -1
- package/dist/commands/watch/index.mjs +2 -17
- package/dist/commands/watch/index.mjs.map +1 -1
- package/dist/commands/watch/watch.cjs +1 -1
- package/dist/commands/watch/watch.cjs.map +1 -1
- package/dist/commands/watch/watch.d.cts.map +1 -1
- package/dist/commands/watch/watch.d.mts.map +1 -1
- package/dist/commands/watch/watch.mjs +1 -1
- package/dist/commands/watch/watch.mjs.map +1 -1
- package/dist/config.cjs +11 -155
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +216 -314
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +216 -314
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +13 -155
- package/dist/config.mjs.map +1 -1
- package/dist/main.cjs +0 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +0 -1
- package/dist/main.mjs.map +1 -1
- package/dist/utils/index.cjs +0 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +0 -1
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +0 -1
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +0 -1
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/logging.cjs +16 -2
- package/dist/utils/logging.cjs.map +1 -1
- package/dist/utils/logging.d.cts +8 -1
- package/dist/utils/logging.d.cts.map +1 -1
- package/dist/utils/logging.d.mts +8 -1
- package/dist/utils/logging.d.mts.map +1 -1
- package/dist/utils/logging.mjs +15 -2
- package/dist/utils/logging.mjs.map +1 -1
- package/dist/utils/steps.cjs +11 -6
- package/dist/utils/steps.cjs.map +1 -1
- package/dist/utils/steps.d.cts +2 -2
- package/dist/utils/steps.d.cts.map +1 -1
- package/dist/utils/steps.d.mts +2 -2
- package/dist/utils/steps.d.mts.map +1 -1
- package/dist/utils/steps.mjs +11 -6
- package/dist/utils/steps.mjs.map +1 -1
- package/dist/webpack/compiler.cjs.map +1 -1
- package/dist/webpack/compiler.d.cts +2 -2
- package/dist/webpack/compiler.d.cts.map +1 -1
- package/dist/webpack/compiler.d.mts +2 -2
- package/dist/webpack/compiler.d.mts.map +1 -1
- package/dist/webpack/compiler.mjs.map +1 -1
- package/dist/webpack/config.cjs +8 -2
- package/dist/webpack/config.cjs.map +1 -1
- package/dist/webpack/config.d.cts +6 -2
- package/dist/webpack/config.d.cts.map +1 -1
- package/dist/webpack/config.d.mts +6 -2
- package/dist/webpack/config.d.mts.map +1 -1
- package/dist/webpack/config.mjs +8 -2
- package/dist/webpack/config.mjs.map +1 -1
- package/dist/webpack/loaders/function.cjs +7 -10
- package/dist/webpack/loaders/function.cjs.map +1 -1
- package/dist/webpack/loaders/function.d.cts +1 -0
- package/dist/webpack/loaders/function.d.cts.map +1 -1
- package/dist/webpack/loaders/function.d.mts +1 -0
- package/dist/webpack/loaders/function.d.mts.map +1 -1
- package/dist/webpack/loaders/function.mjs +6 -9
- package/dist/webpack/loaders/function.mjs.map +1 -1
- package/dist/webpack/loaders/index.cjs +1 -3
- package/dist/webpack/loaders/index.cjs.map +1 -1
- package/dist/webpack/loaders/index.d.cts +0 -1
- package/dist/webpack/loaders/index.d.cts.map +1 -1
- package/dist/webpack/loaders/index.d.mts +0 -1
- package/dist/webpack/loaders/index.d.mts.map +1 -1
- package/dist/webpack/loaders/index.mjs +0 -1
- package/dist/webpack/loaders/index.mjs.map +1 -1
- package/dist/webpack/loaders/wasm.cjs +0 -2
- package/dist/webpack/loaders/wasm.cjs.map +1 -1
- package/dist/webpack/loaders/wasm.d.cts.map +1 -1
- package/dist/webpack/loaders/wasm.d.mts.map +1 -1
- package/dist/webpack/loaders/wasm.mjs +0 -2
- package/dist/webpack/loaders/wasm.mjs.map +1 -1
- package/dist/webpack/plugins.cjs +15 -20
- package/dist/webpack/plugins.cjs.map +1 -1
- package/dist/webpack/plugins.d.cts +13 -3
- package/dist/webpack/plugins.d.cts.map +1 -1
- package/dist/webpack/plugins.d.mts +13 -3
- package/dist/webpack/plugins.d.mts.map +1 -1
- package/dist/webpack/plugins.mjs +4 -9
- package/dist/webpack/plugins.mjs.map +1 -1
- package/dist/webpack/utils.cjs +5 -21
- package/dist/webpack/utils.cjs.map +1 -1
- package/dist/webpack/utils.d.cts +6 -36
- package/dist/webpack/utils.d.cts.map +1 -1
- package/dist/webpack/utils.d.mts +6 -36
- package/dist/webpack/utils.d.mts.map +1 -1
- package/dist/webpack/utils.mjs +4 -18
- package/dist/webpack/utils.mjs.map +1 -1
- package/package.json +14 -38
- package/dist/commands/eval/__test__/browserify/bad/snap.config.cjs +0 -10
- package/dist/commands/eval/__test__/browserify/bad/snap.config.cjs.map +0 -1
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.cts +0 -4
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.cts.map +0 -1
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.mts +0 -4
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.mts.map +0 -1
- package/dist/commands/eval/__test__/browserify/bad/snap.config.mjs +0 -8
- package/dist/commands/eval/__test__/browserify/bad/snap.config.mjs.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.cjs +0 -10
- package/dist/commands/eval/__test__/browserify/good/snap.config.cjs.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.cts +0 -4
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.cts.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.mts +0 -4
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.mts.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.mjs +0 -8
- package/dist/commands/eval/__test__/browserify/good/snap.config.mjs.map +0 -1
- package/dist/utils/legacy.cjs +0 -53
- package/dist/utils/legacy.cjs.map +0 -1
- package/dist/utils/legacy.d.cts +0 -28
- package/dist/utils/legacy.d.cts.map +0 -1
- package/dist/utils/legacy.d.mts +0 -28
- package/dist/utils/legacy.d.mts.map +0 -1
- package/dist/utils/legacy.mjs +0 -47
- package/dist/utils/legacy.mjs.map +0 -1
- package/dist/webpack/loaders/browserify.cjs +0 -84
- package/dist/webpack/loaders/browserify.cjs.map +0 -1
- package/dist/webpack/loaders/browserify.d.cts +0 -18
- package/dist/webpack/loaders/browserify.d.cts.map +0 -1
- package/dist/webpack/loaders/browserify.d.mts +0 -18
- package/dist/webpack/loaders/browserify.d.mts.map +0 -1
- package/dist/webpack/loaders/browserify.mjs +0 -88
- package/dist/webpack/loaders/browserify.mjs.map +0 -1
package/dist/builders.mjs
CHANGED
|
@@ -1,11 +1,8 @@
|
|
|
1
|
-
export var TranspilationModes;
|
|
2
|
-
(function (TranspilationModes) {
|
|
3
|
-
TranspilationModes["LocalAndDeps"] = "localAndDeps";
|
|
4
|
-
TranspilationModes["LocalOnly"] = "localOnly";
|
|
5
|
-
TranspilationModes["None"] = "none";
|
|
6
|
-
})(TranspilationModes || (TranspilationModes = {}));
|
|
7
1
|
const builders = {
|
|
8
|
-
|
|
2
|
+
analyze: {
|
|
3
|
+
describe: 'Analyze the Snap bundle',
|
|
4
|
+
type: 'boolean',
|
|
5
|
+
},
|
|
9
6
|
config: {
|
|
10
7
|
alias: 'c',
|
|
11
8
|
describe: 'Path to config file',
|
|
@@ -22,33 +19,6 @@ const builders = {
|
|
|
22
19
|
type: 'string',
|
|
23
20
|
normalize: true,
|
|
24
21
|
},
|
|
25
|
-
// Deprecated Browserify options.
|
|
26
|
-
bundle: {
|
|
27
|
-
alias: 'b',
|
|
28
|
-
describe: 'Snap bundle file',
|
|
29
|
-
type: 'string',
|
|
30
|
-
normalize: true,
|
|
31
|
-
deprecated: 'Use --input instead.',
|
|
32
|
-
},
|
|
33
|
-
dist: {
|
|
34
|
-
alias: 'd',
|
|
35
|
-
describe: 'Output directory',
|
|
36
|
-
type: 'string',
|
|
37
|
-
normalize: true,
|
|
38
|
-
deprecated: true,
|
|
39
|
-
},
|
|
40
|
-
eval: {
|
|
41
|
-
alias: 'e',
|
|
42
|
-
describe: 'Attempt to evaluate Snap bundle in SES',
|
|
43
|
-
type: 'boolean',
|
|
44
|
-
deprecated: true,
|
|
45
|
-
},
|
|
46
|
-
manifest: {
|
|
47
|
-
alias: 'm',
|
|
48
|
-
describe: 'Validate snap.manifest.json',
|
|
49
|
-
type: 'boolean',
|
|
50
|
-
deprecated: true,
|
|
51
|
-
},
|
|
52
22
|
port: {
|
|
53
23
|
alias: 'p',
|
|
54
24
|
describe: 'Local server port for testing',
|
|
@@ -60,69 +30,6 @@ const builders = {
|
|
|
60
30
|
}
|
|
61
31
|
return port;
|
|
62
32
|
},
|
|
63
|
-
deprecated: true,
|
|
64
|
-
},
|
|
65
|
-
outfileName: {
|
|
66
|
-
alias: 'n',
|
|
67
|
-
describe: 'Output file name',
|
|
68
|
-
type: 'string',
|
|
69
|
-
deprecated: true,
|
|
70
|
-
},
|
|
71
|
-
root: {
|
|
72
|
-
alias: 'r',
|
|
73
|
-
describe: 'Server root directory',
|
|
74
|
-
type: 'string',
|
|
75
|
-
normalize: true,
|
|
76
|
-
deprecated: true,
|
|
77
|
-
},
|
|
78
|
-
sourceMaps: {
|
|
79
|
-
describe: 'Whether builds include sourcemaps',
|
|
80
|
-
type: 'boolean',
|
|
81
|
-
deprecated: true,
|
|
82
|
-
},
|
|
83
|
-
src: {
|
|
84
|
-
alias: 's',
|
|
85
|
-
describe: 'Source file',
|
|
86
|
-
type: 'string',
|
|
87
|
-
normalize: true,
|
|
88
|
-
deprecated: true,
|
|
89
|
-
},
|
|
90
|
-
stripComments: {
|
|
91
|
-
alias: 'strip',
|
|
92
|
-
describe: 'Whether to remove code comments from the build output',
|
|
93
|
-
type: 'boolean',
|
|
94
|
-
deprecated: true,
|
|
95
|
-
},
|
|
96
|
-
suppressWarnings: {
|
|
97
|
-
type: 'boolean',
|
|
98
|
-
describe: 'Whether to suppress warnings',
|
|
99
|
-
deprecated: true,
|
|
100
|
-
},
|
|
101
|
-
transpilationMode: {
|
|
102
|
-
type: 'string',
|
|
103
|
-
describe: 'Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing',
|
|
104
|
-
choices: Object.values(TranspilationModes),
|
|
105
|
-
deprecated: true,
|
|
106
|
-
},
|
|
107
|
-
depsToTranspile: {
|
|
108
|
-
type: 'array',
|
|
109
|
-
describe: 'Transpile only the listed dependencies.',
|
|
110
|
-
deprecated: true,
|
|
111
|
-
},
|
|
112
|
-
verboseErrors: {
|
|
113
|
-
type: 'boolean',
|
|
114
|
-
describe: 'Display original errors',
|
|
115
|
-
deprecated: true,
|
|
116
|
-
},
|
|
117
|
-
writeManifest: {
|
|
118
|
-
describe: 'Make necessary changes to the snap manifest file',
|
|
119
|
-
type: 'boolean',
|
|
120
|
-
deprecated: true,
|
|
121
|
-
},
|
|
122
|
-
serve: {
|
|
123
|
-
describe: 'Serve snap file(s) locally for testing',
|
|
124
|
-
type: 'boolean',
|
|
125
|
-
deprecated: true,
|
|
126
33
|
},
|
|
127
34
|
};
|
|
128
35
|
export default builders;
|
package/dist/builders.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.mjs","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAEA,MAAM,
|
|
1
|
+
{"version":3,"file":"builders.mjs","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAEA,MAAM,QAAQ,GAAG;IACf,OAAO,EAAE;QACP,QAAQ,EAAE,yBAAyB;QACnC,IAAI,EAAE,SAAS;KAChB;IAED,MAAM,EAAE;QACN,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,qBAAqB;QAC/B,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,IAAI;KAChB;IAED,GAAG,EAAE;QACH,QAAQ,EAAE,mCAAmC;QAC7C,IAAI,EAAE,SAAS;KAChB;IAED,KAAK,EAAE;QACL,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,8BAA8B;QACxC,IAAI,EAAE,QAAQ;QACd,SAAS,EAAE,IAAI;KAChB;IAED,IAAI,EAAE;QACJ,KAAK,EAAE,GAAG;QACV,QAAQ,EAAE,+BAA+B;QACzC,IAAI,EAAE,QAAQ;QACd,MAAM,EAAE,CAAC,GAAY,EAAE,EAAE;YACvB,MAAM,IAAI,GAAG,MAAM,CAAC,QAAQ,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAAC,CAAC;YAC9C,IAAI,MAAM,CAAC,KAAK,CAAC,IAAI,CAAC,EAAE,CAAC;gBACvB,MAAM,IAAI,KAAK,CAAC,kBAAkB,MAAM,CAAC,GAAG,CAAC,IAAI,CAAC,CAAC;YACrD,CAAC;YAED,OAAO,IAAI,CAAC;QACd,CAAC;KACF;CACmD,CAAC;AAEvD,eAAe,QAAQ,CAAC","sourcesContent":["import type { Options } from 'yargs';\n\nconst builders = {\n analyze: {\n describe: 'Analyze the Snap bundle',\n type: 'boolean',\n },\n\n config: {\n alias: 'c',\n describe: 'Path to config file',\n type: 'string',\n normalize: true,\n },\n\n fix: {\n describe: 'Attempt to fix snap.manifest.json',\n type: 'boolean',\n },\n\n input: {\n alias: 'i',\n describe: 'Snap bundle file to evaluate',\n type: 'string',\n normalize: true,\n },\n\n port: {\n alias: 'p',\n describe: 'Local server port for testing',\n type: 'number',\n coerce: (arg: unknown) => {\n const port = Number.parseInt(String(arg), 10);\n if (Number.isNaN(port)) {\n throw new Error(`Invalid port: \"${String(arg)}\".`);\n }\n\n return port;\n },\n },\n} as const satisfies Record<string, Readonly<Options>>;\n\nexport default builders;\n"]}
|
package/dist/cli.cjs
CHANGED
|
@@ -4,14 +4,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.cli = exports.checkNodeVersion = void 0;
|
|
7
|
-
|
|
8
|
-
const package_json_1 = __importDefault(require("@metamask/snaps-cli/package.json"));
|
|
9
|
-
const semver_1 = __importDefault(require("semver"));
|
|
7
|
+
const semver_1 = require("semver");
|
|
10
8
|
const yargs_1 = __importDefault(require("yargs"));
|
|
11
9
|
const helpers_1 = require("yargs/helpers");
|
|
12
10
|
const builders_1 = __importDefault(require("./builders.cjs"));
|
|
13
11
|
const config_1 = require("./config.cjs");
|
|
14
12
|
const utils_1 = require("./utils/index.cjs");
|
|
13
|
+
const package_json_1 = __importDefault(require("@metamask/snaps-cli/package.json"));
|
|
15
14
|
/**
|
|
16
15
|
* Check the Node version. If the Node version is less than the minimum required
|
|
17
16
|
* version, this logs an error and exits the process.
|
|
@@ -20,10 +19,9 @@ const utils_1 = require("./utils/index.cjs");
|
|
|
20
19
|
*/
|
|
21
20
|
function checkNodeVersion(nodeVersion = process.version.slice(1)) {
|
|
22
21
|
const versionRange = package_json_1.default.engines.node;
|
|
23
|
-
const minimumVersion = semver_1.
|
|
24
|
-
if (!semver_1.
|
|
22
|
+
const minimumVersion = (0, semver_1.minVersion)(versionRange).format();
|
|
23
|
+
if (!(0, semver_1.satisfies)(nodeVersion, versionRange)) {
|
|
25
24
|
(0, utils_1.error)(`Node version ${nodeVersion} is not supported. Please use Node ${minimumVersion} or later.`);
|
|
26
|
-
// eslint-disable-next-line n/no-process-exit
|
|
27
25
|
process.exit(1);
|
|
28
26
|
}
|
|
29
27
|
}
|
|
@@ -47,8 +45,6 @@ async function cli(argv, commands) {
|
|
|
47
45
|
.example('$0 serve --port 8000', `Serve the snap bundle on port 8000`)
|
|
48
46
|
.command(commands)
|
|
49
47
|
.option('config', builders_1.default.config)
|
|
50
|
-
.option('verboseErrors', builders_1.default.verboseErrors)
|
|
51
|
-
.option('suppressWarnings', builders_1.default.suppressWarnings)
|
|
52
48
|
.strict()
|
|
53
49
|
.middleware(async (args) => {
|
|
54
50
|
// eslint-disable-next-line require-atomic-updates
|
|
@@ -60,7 +56,6 @@ async function cli(argv, commands) {
|
|
|
60
56
|
.demandCommand(1, 'You must specify at least one command.')
|
|
61
57
|
.fail((message, failure) => {
|
|
62
58
|
(0, utils_1.error)((0, utils_1.getYargsErrorMessage)(message, failure));
|
|
63
|
-
// eslint-disable-next-line n/no-process-exit
|
|
64
59
|
process.exit(1);
|
|
65
60
|
})
|
|
66
61
|
.help()
|
package/dist/cli.cjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.cjs","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;
|
|
1
|
+
{"version":3,"file":"cli.cjs","source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AC9B,kDAAkD;QAClD,IAAI,CAAC,OAAO,GAAG;YACb,MAAM,EAAE,MAAM,IAAA,wBAAe,EAAC,IAAI,CAAC;SACpC,CAAC;QAEF,IAAA,sBAAc,EAAC,IAAI,CAAC,CAAC;IACvB,CAAC,EAAE,KAAK,CAAC;SAER,aAAa,CAAC,CAAC,EAAE,wCAAwC,CAAC;SAE1D,IAAI,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QACzB,IAAA,aAAK,EAAC,IAAA,4BAAoB,EAAC,OAAO,EAAE,OAAO,CAAC,CAAC,CAAC;QAC9C,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC,CAAC;SAED,IAAI,EAAE;SACN,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC;SAClB,UAAU,EAAE,CAAC;AAClB,CAAC;AA5CD,kBA4CC","sourcesContent":["import type { SemVer } from 'semver';\nimport { minVersion, satisfies } from 'semver';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport builders from './builders';\nimport { getConfigByArgv } from './config';\nimport { error, getYargsErrorMessage, sanitizeInputs } from './utils';\nimport packageJson from '@metamask/snaps-cli/package.json';\n\n/**\n * Check the Node version. If the Node version is less than the minimum required\n * version, this logs an error and exits the process.\n *\n * @param nodeVersion - The Node version to check.\n */\nexport function checkNodeVersion(\n nodeVersion: string = process.version.slice(1),\n) {\n const versionRange = packageJson.engines.node;\n const minimumVersion = (minVersion(versionRange) as SemVer).format();\n\n if (!satisfies(nodeVersion, versionRange)) {\n error(\n `Node version ${nodeVersion} is not supported. Please use Node ${minimumVersion} or later.`,\n );\n process.exit(1);\n }\n}\n\n/**\n * The main CLI entry point function. This processes the command line args, and\n * runs the appropriate function.\n *\n * @param argv - The raw command line arguments, i.e., `process.argv`.\n * @param commands - The list of commands to use.\n */\nexport async function cli(argv: string[], commands: any) {\n checkNodeVersion();\n\n await yargs(hideBin(argv))\n .scriptName('mm-snap')\n .usage('Usage: $0 <command> [options]')\n\n .example('$0 build', `Build './src/index.js' as './dist/bundle.js'`)\n .example(\n '$0 build --config ./snap.config.build.ts',\n `Build './src/index.js' as './dist/bundle.js' using the config in './snap.config.build.ts'`,\n )\n .example('$0 manifest --fix', `Check the snap manifest, and fix any errors`)\n .example(\n '$0 watch --port 8000',\n `The snap input file for changes, and serve it on port 8000`,\n )\n .example('$0 serve --port 8000', `Serve the snap bundle on port 8000`)\n\n .command(commands)\n\n .option('config', builders.config)\n\n .strict()\n\n .middleware(async (args: any) => {\n // eslint-disable-next-line require-atomic-updates\n args.context = {\n config: await getConfigByArgv(args),\n };\n\n sanitizeInputs(args);\n }, false)\n\n .demandCommand(1, 'You must specify at least one command.')\n\n .fail((message, failure) => {\n error(getYargsErrorMessage(message, failure));\n process.exit(1);\n })\n\n .help()\n .alias('help', 'h')\n .parseAsync();\n}\n"]}
|
package/dist/cli.d.cts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.cts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.cts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,GAAE,MAAiC,QAW/C;AAED;;;;;;GAMG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG,iBA4CtD"}
|
package/dist/cli.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.d.mts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.d.mts","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AAUA;;;;;GAKG;AACH,wBAAgB,gBAAgB,CAC9B,WAAW,GAAE,MAAiC,QAW/C;AAED;;;;;;GAMG;AACH,wBAAsB,GAAG,CAAC,IAAI,EAAE,MAAM,EAAE,EAAE,QAAQ,EAAE,GAAG,iBA4CtD"}
|
package/dist/cli.mjs
CHANGED
|
@@ -1,18 +1,10 @@
|
|
|
1
|
-
|
|
2
|
-
if (module?.__esModule) {
|
|
3
|
-
return module.default;
|
|
4
|
-
}
|
|
5
|
-
return module;
|
|
6
|
-
}
|
|
7
|
-
// eslint-disable-next-line import/no-extraneous-dependencies
|
|
8
|
-
import packageJson from "@metamask/snaps-cli/package.json" with { type: "json" };
|
|
9
|
-
import $semver from "semver";
|
|
10
|
-
const semver = $importDefault($semver);
|
|
1
|
+
import { minVersion, satisfies } from "semver";
|
|
11
2
|
import yargs from "yargs";
|
|
12
3
|
import { hideBin } from "yargs/helpers";
|
|
13
4
|
import builders from "./builders.mjs";
|
|
14
5
|
import { getConfigByArgv } from "./config.mjs";
|
|
15
6
|
import { error, getYargsErrorMessage, sanitizeInputs } from "./utils/index.mjs";
|
|
7
|
+
import packageJson from "@metamask/snaps-cli/package.json" with { type: "json" };
|
|
16
8
|
/**
|
|
17
9
|
* Check the Node version. If the Node version is less than the minimum required
|
|
18
10
|
* version, this logs an error and exits the process.
|
|
@@ -21,10 +13,9 @@ import { error, getYargsErrorMessage, sanitizeInputs } from "./utils/index.mjs";
|
|
|
21
13
|
*/
|
|
22
14
|
export function checkNodeVersion(nodeVersion = process.version.slice(1)) {
|
|
23
15
|
const versionRange = packageJson.engines.node;
|
|
24
|
-
const minimumVersion =
|
|
25
|
-
if (!
|
|
16
|
+
const minimumVersion = minVersion(versionRange).format();
|
|
17
|
+
if (!satisfies(nodeVersion, versionRange)) {
|
|
26
18
|
error(`Node version ${nodeVersion} is not supported. Please use Node ${minimumVersion} or later.`);
|
|
27
|
-
// eslint-disable-next-line n/no-process-exit
|
|
28
19
|
process.exit(1);
|
|
29
20
|
}
|
|
30
21
|
}
|
|
@@ -47,8 +38,6 @@ export async function cli(argv, commands) {
|
|
|
47
38
|
.example('$0 serve --port 8000', `Serve the snap bundle on port 8000`)
|
|
48
39
|
.command(commands)
|
|
49
40
|
.option('config', builders.config)
|
|
50
|
-
.option('verboseErrors', builders.verboseErrors)
|
|
51
|
-
.option('suppressWarnings', builders.suppressWarnings)
|
|
52
41
|
.strict()
|
|
53
42
|
.middleware(async (args) => {
|
|
54
43
|
// eslint-disable-next-line require-atomic-updates
|
|
@@ -60,7 +49,6 @@ export async function cli(argv, commands) {
|
|
|
60
49
|
.demandCommand(1, 'You must specify at least one command.')
|
|
61
50
|
.fail((message, failure) => {
|
|
62
51
|
error(getYargsErrorMessage(message, failure));
|
|
63
|
-
// eslint-disable-next-line n/no-process-exit
|
|
64
52
|
process.exit(1);
|
|
65
53
|
})
|
|
66
54
|
.help()
|
package/dist/cli.mjs.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"cli.mjs","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"cli.mjs","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,UAAU,EAAE,SAAS,EAAE,eAAe;AAC/C,OAAO,KAAK,cAAc;AAC1B,OAAO,EAAE,OAAO,EAAE,sBAAsB;AAExC,OAAO,QAAQ,uBAAmB;AAClC,OAAO,EAAE,eAAe,EAAE,qBAAiB;AAC3C,OAAO,EAAE,KAAK,EAAE,oBAAoB,EAAE,cAAc,EAAE,0BAAgB;AACtE,OAAO,WAAW,+DAAyC;AAE3D;;;;;GAKG;AACH,MAAM,UAAU,gBAAgB,CAC9B,cAAsB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9C,MAAM,YAAY,GAAG,WAAW,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9C,MAAM,cAAc,GAAI,UAAU,CAAC,YAAY,CAAY,CAAC,MAAM,EAAE,CAAC;IAErE,IAAI,CAAC,SAAS,CAAC,WAAW,EAAE,YAAY,CAAC,EAAE,CAAC;QAC1C,KAAK,CACH,gBAAgB,WAAW,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 'semver';\nimport { minVersion, satisfies } from 'semver';\nimport yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport builders from './builders';\nimport { getConfigByArgv } from './config';\nimport { error, getYargsErrorMessage, sanitizeInputs } from './utils';\nimport packageJson from '@metamask/snaps-cli/package.json';\n\n/**\n * Check the Node version. If the Node version is less than the minimum required\n * version, this logs an error and exits the process.\n *\n * @param nodeVersion - The Node version to check.\n */\nexport function checkNodeVersion(\n nodeVersion: string = process.version.slice(1),\n) {\n const versionRange = packageJson.engines.node;\n const minimumVersion = (minVersion(versionRange) as SemVer).format();\n\n if (!satisfies(nodeVersion, versionRange)) {\n error(\n `Node version ${nodeVersion} is not supported. Please use Node ${minimumVersion} or later.`,\n );\n process.exit(1);\n }\n}\n\n/**\n * The main CLI entry point function. This processes the command line args, and\n * runs the appropriate function.\n *\n * @param argv - The raw command line arguments, i.e., `process.argv`.\n * @param commands - The list of commands to use.\n */\nexport async function cli(argv: string[], commands: any) {\n checkNodeVersion();\n\n await yargs(hideBin(argv))\n .scriptName('mm-snap')\n .usage('Usage: $0 <command> [options]')\n\n .example('$0 build', `Build './src/index.js' as './dist/bundle.js'`)\n .example(\n '$0 build --config ./snap.config.build.ts',\n `Build './src/index.js' as './dist/bundle.js' using the config in './snap.config.build.ts'`,\n )\n .example('$0 manifest --fix', `Check the snap manifest, and fix any errors`)\n .example(\n '$0 watch --port 8000',\n `The snap input file for changes, and serve it on port 8000`,\n )\n .example('$0 serve --port 8000', `Serve the snap bundle on port 8000`)\n\n .command(commands)\n\n .option('config', builders.config)\n\n .strict()\n\n .middleware(async (args: any) => {\n // eslint-disable-next-line require-atomic-updates\n args.context = {\n config: await getConfigByArgv(args),\n };\n\n sanitizeInputs(args);\n }, false)\n\n .demandCommand(1, 'You must specify at least one command.')\n\n .fail((message, failure) => {\n error(getYargsErrorMessage(message, failure));\n process.exit(1);\n })\n\n .help()\n .alias('help', 'h')\n .parseAsync();\n}\n"]}
|
|
@@ -2,11 +2,13 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.buildHandler = void 0;
|
|
4
4
|
const node_1 = require("@metamask/snaps-utils/node");
|
|
5
|
+
const utils_1 = require("@metamask/utils");
|
|
5
6
|
const path_1 = require("path");
|
|
7
|
+
const implementation_1 = require("./implementation.cjs");
|
|
8
|
+
const utils_2 = require("./utils.cjs");
|
|
6
9
|
const errors_1 = require("../../errors.cjs");
|
|
7
|
-
const
|
|
10
|
+
const utils_3 = require("../../utils/index.cjs");
|
|
8
11
|
const eval_1 = require("../eval/index.cjs");
|
|
9
|
-
const implementation_1 = require("./implementation.cjs");
|
|
10
12
|
const steps = [
|
|
11
13
|
{
|
|
12
14
|
name: 'Checking the input file.',
|
|
@@ -19,10 +21,23 @@ const steps = [
|
|
|
19
21
|
},
|
|
20
22
|
{
|
|
21
23
|
name: 'Building the snap bundle.',
|
|
22
|
-
task: async ({ config, spinner }) => {
|
|
24
|
+
task: async ({ analyze, config, spinner }) => {
|
|
23
25
|
// We don't evaluate the bundle here, because it's done in a separate
|
|
24
26
|
// step.
|
|
25
|
-
|
|
27
|
+
const compiler = await (0, implementation_1.build)(config, {
|
|
28
|
+
analyze,
|
|
29
|
+
evaluate: false,
|
|
30
|
+
spinner,
|
|
31
|
+
});
|
|
32
|
+
if (analyze) {
|
|
33
|
+
return {
|
|
34
|
+
analyze,
|
|
35
|
+
config,
|
|
36
|
+
spinner,
|
|
37
|
+
port: await (0, utils_2.getBundleAnalyzerPort)(compiler),
|
|
38
|
+
};
|
|
39
|
+
}
|
|
40
|
+
return undefined;
|
|
26
41
|
},
|
|
27
42
|
},
|
|
28
43
|
{
|
|
@@ -31,7 +46,16 @@ const steps = [
|
|
|
31
46
|
task: async ({ config, spinner }) => {
|
|
32
47
|
const path = (0, path_1.resolve)(process.cwd(), config.output.path, config.output.filename);
|
|
33
48
|
await (0, eval_1.evaluate)(path);
|
|
34
|
-
(0,
|
|
49
|
+
(0, utils_3.info)(`Snap bundle evaluated successfully.`, spinner);
|
|
50
|
+
},
|
|
51
|
+
},
|
|
52
|
+
{
|
|
53
|
+
name: 'Running analyser.',
|
|
54
|
+
condition: ({ analyze }) => analyze,
|
|
55
|
+
task: async ({ spinner, port }) => {
|
|
56
|
+
(0, utils_1.assert)(port, 'Port is not defined.');
|
|
57
|
+
(0, utils_3.success)(`Bundle analyzer running at http://localhost:${port}.`, spinner);
|
|
58
|
+
spinner.stop();
|
|
35
59
|
},
|
|
36
60
|
},
|
|
37
61
|
];
|
|
@@ -42,11 +66,13 @@ const steps = [
|
|
|
42
66
|
* This creates the destination directory if it doesn't exist.
|
|
43
67
|
*
|
|
44
68
|
* @param config - The config object.
|
|
69
|
+
* @param analyze - Whether to analyze the bundle.
|
|
45
70
|
* @returns Nothing.
|
|
46
71
|
*/
|
|
47
|
-
async function buildHandler(config) {
|
|
48
|
-
return await (0,
|
|
72
|
+
async function buildHandler(config, analyze = false) {
|
|
73
|
+
return await (0, utils_3.executeSteps)(steps, {
|
|
49
74
|
config,
|
|
75
|
+
analyze,
|
|
50
76
|
});
|
|
51
77
|
}
|
|
52
78
|
exports.buildHandler = buildHandler;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.cjs","sourceRoot":"","sources":["../../../src/commands/build/build.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AACpD,+BAA8C;
|
|
1
|
+
{"version":3,"file":"build.cjs","sourceRoot":"","sources":["../../../src/commands/build/build.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AACpD,2CAAyC;AACzC,+BAA8C;AAE9C,yDAAyC;AACzC,uCAAgD;AAEhD,6CAA4C;AAE5C,iDAA0D;AAC1D,4CAAmC;AAQnC,MAAM,KAAK,GAAwB;IACjC;QACE,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;YAEzB,IAAI,C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AAE,IAAI,EAAE,EAAE,EAAE;YAChC,IAAA,cAAM,EAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;YACrC,IAAA,eAAO,EAAC,+CAA+C,IAAI,GAAG,EAAE,OAAO,CAAC,CAAC;YAEzE,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC;KACF;CACO,CAAC;AAEX;;;;;;;;;GASG;AACI,KAAK,UAAU,YAAY,CAChC,MAAuB,EACvB,OAAO,GAAG,KAAK;IAEf,OAAO,MAAM,IAAA,oBAAY,EAAC,KAAK,EAAE;QAC/B,MAAM;QACN,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AARD,oCAQC","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\nimport { assert } from '@metamask/utils';\nimport { resolve as pathResolve } from 'path';\n\nimport { build } from './implementation';\nimport { getBundleAnalyzerPort } from './utils';\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { success, executeSteps, info } from '../../utils';\nimport { evaluate } from '../eval';\n\ntype BuildContext = {\n analyze: boolean;\n config: ProcessedConfig;\n port?: number;\n};\n\nconst steps: Steps<BuildContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ analyze, config, spinner }) => {\n // We don't evaluate the bundle here, because it's done in a separate\n // step.\n const compiler = await build(config, {\n analyze,\n evaluate: false,\n spinner,\n });\n\n if (analyze) {\n return {\n analyze,\n config,\n spinner,\n port: await getBundleAnalyzerPort(compiler),\n };\n }\n\n return undefined;\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n condition: ({ config }) => config.evaluate,\n task: async ({ config, spinner }) => {\n const path = pathResolve(\n process.cwd(),\n config.output.path,\n config.output.filename,\n );\n\n await evaluate(path);\n\n info(`Snap bundle evaluated successfully.`, spinner);\n },\n },\n {\n name: 'Running analyser.',\n condition: ({ analyze }) => analyze,\n task: async ({ spinner, port }) => {\n assert(port, 'Port is not defined.');\n success(`Bundle analyzer running at http://localhost:${port}.`, spinner);\n\n spinner.stop();\n },\n },\n] as const;\n\n/**\n * Build all files in the given source directory to the given destination\n * directory.\n *\n * This creates the destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param analyze - Whether to analyze the bundle.\n * @returns Nothing.\n */\nexport async function buildHandler(\n config: ProcessedConfig,\n analyze = false,\n): Promise<void> {\n return await executeSteps(steps, {\n config,\n analyze,\n });\n}\n"]}
|
|
@@ -6,7 +6,8 @@ import type { ProcessedConfig } from "../../config.cjs";
|
|
|
6
6
|
* This creates the destination directory if it doesn't exist.
|
|
7
7
|
*
|
|
8
8
|
* @param config - The config object.
|
|
9
|
+
* @param analyze - Whether to analyze the bundle.
|
|
9
10
|
* @returns Nothing.
|
|
10
11
|
*/
|
|
11
|
-
export declare function buildHandler(config: ProcessedConfig): Promise<void>;
|
|
12
|
+
export declare function buildHandler(config: ProcessedConfig, analyze?: boolean): Promise<void>;
|
|
12
13
|
//# sourceMappingURL=build.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.cts","sourceRoot":"","sources":["../../../src/commands/build/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.cts","sourceRoot":"","sources":["../../../src/commands/build/build.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AA2EpD;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,EACvB,OAAO,UAAQ,GACd,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -6,7 +6,8 @@ import type { ProcessedConfig } from "../../config.mjs";
|
|
|
6
6
|
* This creates the destination directory if it doesn't exist.
|
|
7
7
|
*
|
|
8
8
|
* @param config - The config object.
|
|
9
|
+
* @param analyze - Whether to analyze the bundle.
|
|
9
10
|
* @returns Nothing.
|
|
10
11
|
*/
|
|
11
|
-
export declare function buildHandler(config: ProcessedConfig): Promise<void>;
|
|
12
|
+
export declare function buildHandler(config: ProcessedConfig, analyze?: boolean): Promise<void>;
|
|
12
13
|
//# sourceMappingURL=build.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.d.mts","sourceRoot":"","sources":["../../../src/commands/build/build.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"build.d.mts","sourceRoot":"","sources":["../../../src/commands/build/build.ts"],"names":[],"mappings":"AAMA,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AA2EpD;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,EACvB,OAAO,UAAQ,GACd,OAAO,CAAC,IAAI,CAAC,CAKf"}
|
|
@@ -1,9 +1,11 @@
|
|
|
1
1
|
import { isFile } from "@metamask/snaps-utils/node";
|
|
2
|
+
import { assert } from "@metamask/utils";
|
|
2
3
|
import { resolve as pathResolve } from "path";
|
|
4
|
+
import { build } from "./implementation.mjs";
|
|
5
|
+
import { getBundleAnalyzerPort } from "./utils.mjs";
|
|
3
6
|
import { CommandError } from "../../errors.mjs";
|
|
4
|
-
import { executeSteps, info } from "../../utils/index.mjs";
|
|
7
|
+
import { success, executeSteps, info } from "../../utils/index.mjs";
|
|
5
8
|
import { evaluate } from "../eval/index.mjs";
|
|
6
|
-
import { build } from "./implementation.mjs";
|
|
7
9
|
const steps = [
|
|
8
10
|
{
|
|
9
11
|
name: 'Checking the input file.',
|
|
@@ -16,10 +18,23 @@ const steps = [
|
|
|
16
18
|
},
|
|
17
19
|
{
|
|
18
20
|
name: 'Building the snap bundle.',
|
|
19
|
-
task: async ({ config, spinner }) => {
|
|
21
|
+
task: async ({ analyze, config, spinner }) => {
|
|
20
22
|
// We don't evaluate the bundle here, because it's done in a separate
|
|
21
23
|
// step.
|
|
22
|
-
|
|
24
|
+
const compiler = await build(config, {
|
|
25
|
+
analyze,
|
|
26
|
+
evaluate: false,
|
|
27
|
+
spinner,
|
|
28
|
+
});
|
|
29
|
+
if (analyze) {
|
|
30
|
+
return {
|
|
31
|
+
analyze,
|
|
32
|
+
config,
|
|
33
|
+
spinner,
|
|
34
|
+
port: await getBundleAnalyzerPort(compiler),
|
|
35
|
+
};
|
|
36
|
+
}
|
|
37
|
+
return undefined;
|
|
23
38
|
},
|
|
24
39
|
},
|
|
25
40
|
{
|
|
@@ -31,6 +46,15 @@ const steps = [
|
|
|
31
46
|
info(`Snap bundle evaluated successfully.`, spinner);
|
|
32
47
|
},
|
|
33
48
|
},
|
|
49
|
+
{
|
|
50
|
+
name: 'Running analyser.',
|
|
51
|
+
condition: ({ analyze }) => analyze,
|
|
52
|
+
task: async ({ spinner, port }) => {
|
|
53
|
+
assert(port, 'Port is not defined.');
|
|
54
|
+
success(`Bundle analyzer running at http://localhost:${port}.`, spinner);
|
|
55
|
+
spinner.stop();
|
|
56
|
+
},
|
|
57
|
+
},
|
|
34
58
|
];
|
|
35
59
|
/**
|
|
36
60
|
* Build all files in the given source directory to the given destination
|
|
@@ -39,11 +63,13 @@ const steps = [
|
|
|
39
63
|
* This creates the destination directory if it doesn't exist.
|
|
40
64
|
*
|
|
41
65
|
* @param config - The config object.
|
|
66
|
+
* @param analyze - Whether to analyze the bundle.
|
|
42
67
|
* @returns Nothing.
|
|
43
68
|
*/
|
|
44
|
-
export async function buildHandler(config) {
|
|
69
|
+
export async function buildHandler(config, analyze = false) {
|
|
45
70
|
return await executeSteps(steps, {
|
|
46
71
|
config,
|
|
72
|
+
analyze,
|
|
47
73
|
});
|
|
48
74
|
}
|
|
49
75
|
//# sourceMappingURL=build.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.mjs","sourceRoot":"","sources":["../../../src/commands/build/build.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,mCAAmC;AAC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;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;KACF;IACD;QACE,IAAI,EAAE,6BAA6B;QACnC,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,QAAQ;QAC1C,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;YAClC,MAAM,IAAI,GAAG,WAAW,CACtB,OAAO,CAAC,GAAG,EAAE,EACb,MAAM,CAAC,MAAM,CAAC,IAAI,EAClB,MAAM,CAAC,MAAM,CAAC,QAAQ,CACvB,CAAC;YAEF,MAAM,QAAQ,CAAC,IAAI,CAAC,CAAC;YAErB,IAAI,CAAC,qCAAqC,EAAE,OAAO,CAAC,CAAC;QACvD,CAAC;KACF;IACD;QACE,IAAI,EAAE,mBAAmB;QACzB,SAAS,EAAE,CAAC,EAAE,OAAO,EAAE,EAAE,EAAE,CAAC,OAAO;QACnC,IAAI,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,IAAI,EAAE,EAAE,EAAE;YAChC,MAAM,CAAC,IAAI,EAAE,sBAAsB,CAAC,CAAC;YACrC,OAAO,CAAC,+CAA+C,IAAI,GAAG,EAAE,OAAO,CAAC,CAAC;YAEzE,OAAO,CAAC,IAAI,EAAE,CAAC;QACjB,CAAC;KACF;CACO,CAAC;AAEX;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAuB,EACvB,OAAO,GAAG,KAAK;IAEf,OAAO,MAAM,YAAY,CAAC,KAAK,EAAE;QAC/B,MAAM;QACN,OAAO;KACR,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\nimport { assert } from '@metamask/utils';\nimport { resolve as pathResolve } from 'path';\n\nimport { build } from './implementation';\nimport { getBundleAnalyzerPort } from './utils';\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { success, executeSteps, info } from '../../utils';\nimport { evaluate } from '../eval';\n\ntype BuildContext = {\n analyze: boolean;\n config: ProcessedConfig;\n port?: number;\n};\n\nconst steps: Steps<BuildContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ analyze, config, spinner }) => {\n // We don't evaluate the bundle here, because it's done in a separate\n // step.\n const compiler = await build(config, {\n analyze,\n evaluate: false,\n spinner,\n });\n\n if (analyze) {\n return {\n analyze,\n config,\n spinner,\n port: await getBundleAnalyzerPort(compiler),\n };\n }\n\n return undefined;\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n condition: ({ config }) => config.evaluate,\n task: async ({ config, spinner }) => {\n const path = pathResolve(\n process.cwd(),\n config.output.path,\n config.output.filename,\n );\n\n await evaluate(path);\n\n info(`Snap bundle evaluated successfully.`, spinner);\n },\n },\n {\n name: 'Running analyser.',\n condition: ({ analyze }) => analyze,\n task: async ({ spinner, port }) => {\n assert(port, 'Port is not defined.');\n success(`Bundle analyzer running at http://localhost:${port}.`, spinner);\n\n spinner.stop();\n },\n },\n] as const;\n\n/**\n * Build all files in the given source directory to the given destination\n * directory.\n *\n * This creates the destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param analyze - Whether to analyze the bundle.\n * @returns Nothing.\n */\nexport async function buildHandler(\n config: ProcessedConfig,\n analyze = false,\n): Promise<void> {\n return await executeSteps(steps, {\n config,\n analyze,\n });\n}\n"]}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.cjs","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":";;;
|
|
1
|
+
{"version":3,"file":"implementation.cjs","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":";;;AAIA,qDAA4C;AAE5C;;;;;;GAMG;AACI,KAAK,UAAU,KAAK,CACzB,MAAuB,EACvB,OAAwB;IAExB,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAW,EAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,MAAM,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YACxB,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACjB,OAAO;YACT,CAAC;YAED,QAAQ,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE;gBAC5B,IAAI,UAAU,EAAE,CAAC;oBACf,MAAM,CAAC,UAAU,CAAC,CAAC;oBACnB,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AAtBD,sBAsBC","sourcesContent":["import type { Compiler } from 'webpack';\n\nimport type { ProcessedConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle. This uses Webpack to build the bundle.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns A promise that resolves when the bundle is built.\n */\nexport async function build(\n config: ProcessedConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, options);\n return await new Promise<Compiler>((resolve, reject) => {\n compiler.run((runError) => {\n if (runError) {\n reject(runError);\n return;\n }\n\n compiler.close((closeError) => {\n if (closeError) {\n reject(closeError);\n return;\n }\n\n resolve(compiler);\n });\n });\n });\n}\n"]}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Compiler } from "webpack";
|
|
2
|
+
import type { ProcessedConfig } from "../../config.cjs";
|
|
2
3
|
import type { WebpackOptions } from "../../webpack/index.cjs";
|
|
3
4
|
/**
|
|
4
5
|
* Build the snap bundle. This uses Webpack to build the bundle.
|
|
@@ -7,5 +8,5 @@ import type { WebpackOptions } from "../../webpack/index.cjs";
|
|
|
7
8
|
* @param options - The Webpack options.
|
|
8
9
|
* @returns A promise that resolves when the bundle is built.
|
|
9
10
|
*/
|
|
10
|
-
export declare function build(config:
|
|
11
|
+
export declare function build(config: ProcessedConfig, options?: WebpackOptions): Promise<Compiler>;
|
|
11
12
|
//# sourceMappingURL=implementation.d.cts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.cts","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"implementation.d.cts","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAsB;AAGpD;;;;;;GAMG;AACH,wBAAsB,KAAK,CACzB,MAAM,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,cAAc,qBAoBzB"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
|
-
import type {
|
|
1
|
+
import type { Compiler } from "webpack";
|
|
2
|
+
import type { ProcessedConfig } from "../../config.mjs";
|
|
2
3
|
import type { WebpackOptions } from "../../webpack/index.mjs";
|
|
3
4
|
/**
|
|
4
5
|
* Build the snap bundle. This uses Webpack to build the bundle.
|
|
@@ -7,5 +8,5 @@ import type { WebpackOptions } from "../../webpack/index.mjs";
|
|
|
7
8
|
* @param options - The Webpack options.
|
|
8
9
|
* @returns A promise that resolves when the bundle is built.
|
|
9
10
|
*/
|
|
10
|
-
export declare function build(config:
|
|
11
|
+
export declare function build(config: ProcessedConfig, options?: WebpackOptions): Promise<Compiler>;
|
|
11
12
|
//# sourceMappingURL=implementation.d.mts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.d.mts","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,
|
|
1
|
+
{"version":3,"file":"implementation.d.mts","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAsB;AAGpD;;;;;;GAMG;AACH,wBAAsB,KAAK,CACzB,MAAM,EAAE,eAAe,EACvB,OAAO,CAAC,EAAE,cAAc,qBAoBzB"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"implementation.mjs","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"implementation.mjs","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,gCAAsB;AAE5C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,MAAuB,EACvB,OAAwB;IAExB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,MAAM,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YACxB,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACjB,OAAO;YACT,CAAC;YAED,QAAQ,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE;gBAC5B,IAAI,UAAU,EAAE,CAAC;oBACf,MAAM,CAAC,UAAU,CAAC,CAAC;oBACnB,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Compiler } from 'webpack';\n\nimport type { ProcessedConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle. This uses Webpack to build the bundle.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns A promise that resolves when the bundle is built.\n */\nexport async function build(\n config: ProcessedConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, options);\n return await new Promise<Compiler>((resolve, reject) => {\n compiler.run((runError) => {\n if (runError) {\n reject(runError);\n return;\n }\n\n compiler.close((closeError) => {\n if (closeError) {\n reject(closeError);\n return;\n }\n\n resolve(compiler);\n });\n });\n });\n}\n"]}
|