@metamask/snaps-cli 6.7.0 → 7.1.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 +45 -1
- package/README.md +12 -244
- package/dist/builders.cjs +5 -97
- package/dist/builders.cjs.map +1 -1
- package/dist/builders.d.cts +5 -94
- package/dist/builders.d.cts.map +1 -1
- package/dist/builders.d.mts +5 -94
- package/dist/builders.d.mts.map +1 -1
- package/dist/builders.mjs +5 -96
- 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 +15 -11
- package/dist/commands/build/build.cjs.map +1 -1
- package/dist/commands/build/build.d.cts +8 -0
- package/dist/commands/build/build.d.cts.map +1 -1
- package/dist/commands/build/build.d.mts +8 -0
- package/dist/commands/build/build.d.mts.map +1 -1
- package/dist/commands/build/build.mjs +9 -5
- package/dist/commands/build/build.mjs.map +1 -1
- package/dist/commands/build/implementation.cjs.map +1 -1
- package/dist/commands/build/implementation.d.cts +2 -2
- package/dist/commands/build/implementation.d.cts.map +1 -1
- package/dist/commands/build/implementation.d.mts +2 -2
- package/dist/commands/build/implementation.d.mts.map +1 -1
- package/dist/commands/build/implementation.mjs.map +1 -1
- package/dist/commands/build/index.cjs +5 -14
- package/dist/commands/build/index.cjs.map +1 -1
- package/dist/commands/build/index.d.cts +1 -0
- package/dist/commands/build/index.d.cts.map +1 -1
- package/dist/commands/build/index.d.mts +1 -0
- 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/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/index.cjs +2 -0
- package/dist/commands/index.cjs.map +1 -1
- package/dist/commands/index.d.cts.map +1 -1
- package/dist/commands/index.d.mts.map +1 -1
- package/dist/commands/index.mjs +2 -0
- package/dist/commands/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/sandbox/index.cjs +17 -0
- package/dist/commands/sandbox/index.cjs.map +1 -0
- package/dist/commands/sandbox/index.d.cts +10 -0
- package/dist/commands/sandbox/index.d.cts.map +1 -0
- package/dist/commands/sandbox/index.d.mts +10 -0
- package/dist/commands/sandbox/index.d.mts.map +1 -0
- package/dist/commands/sandbox/index.mjs +12 -0
- package/dist/commands/sandbox/index.mjs.map +1 -0
- package/dist/commands/sandbox/sandbox.cjs +33 -0
- package/dist/commands/sandbox/sandbox.cjs.map +1 -0
- package/dist/commands/sandbox/sandbox.d.cts +14 -0
- package/dist/commands/sandbox/sandbox.d.cts.map +1 -0
- package/dist/commands/sandbox/sandbox.d.mts +14 -0
- package/dist/commands/sandbox/sandbox.d.mts.map +1 -0
- package/dist/commands/sandbox/sandbox.mjs +29 -0
- package/dist/commands/sandbox/sandbox.mjs.map +1 -0
- package/dist/commands/sandbox/server.cjs +27 -0
- package/dist/commands/sandbox/server.cjs.map +1 -0
- package/dist/commands/sandbox/server.d.cts +14 -0
- package/dist/commands/sandbox/server.d.cts.map +1 -0
- package/dist/commands/sandbox/server.d.mts +14 -0
- package/dist/commands/sandbox/server.d.mts.map +1 -0
- package/dist/commands/sandbox/server.mjs +25 -0
- package/dist/commands/sandbox/server.mjs.map +1 -0
- 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/steps.cjs.map +1 -1
- package/dist/utils/steps.d.cts +1 -1
- package/dist/utils/steps.d.cts.map +1 -1
- package/dist/utils/steps.d.mts +1 -1
- package/dist/utils/steps.d.mts.map +1 -1
- 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 +1 -2
- package/dist/webpack/config.cjs.map +1 -1
- package/dist/webpack/config.d.cts +2 -2
- package/dist/webpack/config.d.cts.map +1 -1
- package/dist/webpack/config.d.mts +2 -2
- package/dist/webpack/config.d.mts.map +1 -1
- package/dist/webpack/config.mjs +1 -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/server.cjs +83 -72
- package/dist/webpack/server.cjs.map +1 -1
- package/dist/webpack/server.d.cts +6 -1
- package/dist/webpack/server.d.cts.map +1 -1
- package/dist/webpack/server.d.mts +6 -1
- package/dist/webpack/server.d.mts.map +1 -1
- package/dist/webpack/server.mjs +63 -72
- package/dist/webpack/server.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 +16 -40
- 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.d.mts
CHANGED
|
@@ -1,13 +1,13 @@
|
|
|
1
|
-
export declare enum TranspilationModes {
|
|
2
|
-
LocalAndDeps = "localAndDeps",
|
|
3
|
-
LocalOnly = "localOnly",
|
|
4
|
-
None = "none"
|
|
5
|
-
}
|
|
6
1
|
declare const builders: {
|
|
7
2
|
readonly analyze: {
|
|
8
3
|
readonly describe: "Analyze the Snap bundle";
|
|
9
4
|
readonly type: "boolean";
|
|
10
5
|
};
|
|
6
|
+
readonly build: {
|
|
7
|
+
readonly describe: "Build the Snap bundle";
|
|
8
|
+
readonly type: "boolean";
|
|
9
|
+
readonly default: true;
|
|
10
|
+
};
|
|
11
11
|
readonly config: {
|
|
12
12
|
readonly alias: "c";
|
|
13
13
|
readonly describe: "Path to config file";
|
|
@@ -24,100 +24,11 @@ declare const builders: {
|
|
|
24
24
|
readonly type: "string";
|
|
25
25
|
readonly normalize: true;
|
|
26
26
|
};
|
|
27
|
-
readonly bundle: {
|
|
28
|
-
readonly alias: "b";
|
|
29
|
-
readonly describe: "Snap bundle file";
|
|
30
|
-
readonly type: "string";
|
|
31
|
-
readonly normalize: true;
|
|
32
|
-
readonly deprecated: "Use --input instead.";
|
|
33
|
-
};
|
|
34
|
-
readonly dist: {
|
|
35
|
-
readonly alias: "d";
|
|
36
|
-
readonly describe: "Output directory";
|
|
37
|
-
readonly type: "string";
|
|
38
|
-
readonly normalize: true;
|
|
39
|
-
readonly deprecated: true;
|
|
40
|
-
};
|
|
41
|
-
readonly eval: {
|
|
42
|
-
readonly alias: "e";
|
|
43
|
-
readonly describe: "Attempt to evaluate Snap bundle in SES";
|
|
44
|
-
readonly type: "boolean";
|
|
45
|
-
readonly deprecated: true;
|
|
46
|
-
};
|
|
47
|
-
readonly manifest: {
|
|
48
|
-
readonly alias: "m";
|
|
49
|
-
readonly describe: "Validate snap.manifest.json";
|
|
50
|
-
readonly type: "boolean";
|
|
51
|
-
readonly deprecated: true;
|
|
52
|
-
};
|
|
53
27
|
readonly port: {
|
|
54
28
|
readonly alias: "p";
|
|
55
29
|
readonly describe: "Local server port for testing";
|
|
56
30
|
readonly type: "number";
|
|
57
31
|
readonly coerce: (arg: unknown) => number;
|
|
58
|
-
readonly deprecated: true;
|
|
59
|
-
};
|
|
60
|
-
readonly outfileName: {
|
|
61
|
-
readonly alias: "n";
|
|
62
|
-
readonly describe: "Output file name";
|
|
63
|
-
readonly type: "string";
|
|
64
|
-
readonly deprecated: true;
|
|
65
|
-
};
|
|
66
|
-
readonly root: {
|
|
67
|
-
readonly alias: "r";
|
|
68
|
-
readonly describe: "Server root directory";
|
|
69
|
-
readonly type: "string";
|
|
70
|
-
readonly normalize: true;
|
|
71
|
-
readonly deprecated: true;
|
|
72
|
-
};
|
|
73
|
-
readonly sourceMaps: {
|
|
74
|
-
readonly describe: "Whether builds include sourcemaps";
|
|
75
|
-
readonly type: "boolean";
|
|
76
|
-
readonly deprecated: true;
|
|
77
|
-
};
|
|
78
|
-
readonly src: {
|
|
79
|
-
readonly alias: "s";
|
|
80
|
-
readonly describe: "Source file";
|
|
81
|
-
readonly type: "string";
|
|
82
|
-
readonly normalize: true;
|
|
83
|
-
readonly deprecated: true;
|
|
84
|
-
};
|
|
85
|
-
readonly stripComments: {
|
|
86
|
-
readonly alias: "strip";
|
|
87
|
-
readonly describe: "Whether to remove code comments from the build output";
|
|
88
|
-
readonly type: "boolean";
|
|
89
|
-
readonly deprecated: true;
|
|
90
|
-
};
|
|
91
|
-
readonly suppressWarnings: {
|
|
92
|
-
readonly type: "boolean";
|
|
93
|
-
readonly describe: "Whether to suppress warnings";
|
|
94
|
-
readonly deprecated: true;
|
|
95
|
-
};
|
|
96
|
-
readonly transpilationMode: {
|
|
97
|
-
readonly type: "string";
|
|
98
|
-
readonly describe: "Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing";
|
|
99
|
-
readonly choices: TranspilationModes[];
|
|
100
|
-
readonly deprecated: true;
|
|
101
|
-
};
|
|
102
|
-
readonly depsToTranspile: {
|
|
103
|
-
readonly type: "array";
|
|
104
|
-
readonly describe: "Transpile only the listed dependencies.";
|
|
105
|
-
readonly deprecated: true;
|
|
106
|
-
};
|
|
107
|
-
readonly verboseErrors: {
|
|
108
|
-
readonly type: "boolean";
|
|
109
|
-
readonly describe: "Display original errors";
|
|
110
|
-
readonly deprecated: true;
|
|
111
|
-
};
|
|
112
|
-
readonly writeManifest: {
|
|
113
|
-
readonly describe: "Make necessary changes to the snap manifest file";
|
|
114
|
-
readonly type: "boolean";
|
|
115
|
-
readonly deprecated: true;
|
|
116
|
-
};
|
|
117
|
-
readonly serve: {
|
|
118
|
-
readonly describe: "Serve snap file(s) locally for testing";
|
|
119
|
-
readonly type: "boolean";
|
|
120
|
-
readonly deprecated: true;
|
|
121
32
|
};
|
|
122
33
|
};
|
|
123
34
|
export default builders;
|
package/dist/builders.d.mts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"builders.d.mts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAEA,
|
|
1
|
+
{"version":3,"file":"builders.d.mts","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"AAEA,QAAA,MAAM,QAAQ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;+BAmCI,OAAO;;CAS6B,CAAC;AAEvD,eAAe,QAAQ,CAAC"}
|
package/dist/builders.mjs
CHANGED
|
@@ -1,14 +1,13 @@
|
|
|
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: {
|
|
9
3
|
describe: 'Analyze the Snap bundle',
|
|
10
4
|
type: 'boolean',
|
|
11
5
|
},
|
|
6
|
+
build: {
|
|
7
|
+
describe: 'Build the Snap bundle',
|
|
8
|
+
type: 'boolean',
|
|
9
|
+
default: true,
|
|
10
|
+
},
|
|
12
11
|
config: {
|
|
13
12
|
alias: 'c',
|
|
14
13
|
describe: 'Path to config file',
|
|
@@ -25,33 +24,6 @@ const builders = {
|
|
|
25
24
|
type: 'string',
|
|
26
25
|
normalize: true,
|
|
27
26
|
},
|
|
28
|
-
// Deprecated Browserify options.
|
|
29
|
-
bundle: {
|
|
30
|
-
alias: 'b',
|
|
31
|
-
describe: 'Snap bundle file',
|
|
32
|
-
type: 'string',
|
|
33
|
-
normalize: true,
|
|
34
|
-
deprecated: 'Use --input instead.',
|
|
35
|
-
},
|
|
36
|
-
dist: {
|
|
37
|
-
alias: 'd',
|
|
38
|
-
describe: 'Output directory',
|
|
39
|
-
type: 'string',
|
|
40
|
-
normalize: true,
|
|
41
|
-
deprecated: true,
|
|
42
|
-
},
|
|
43
|
-
eval: {
|
|
44
|
-
alias: 'e',
|
|
45
|
-
describe: 'Attempt to evaluate Snap bundle in SES',
|
|
46
|
-
type: 'boolean',
|
|
47
|
-
deprecated: true,
|
|
48
|
-
},
|
|
49
|
-
manifest: {
|
|
50
|
-
alias: 'm',
|
|
51
|
-
describe: 'Validate snap.manifest.json',
|
|
52
|
-
type: 'boolean',
|
|
53
|
-
deprecated: true,
|
|
54
|
-
},
|
|
55
27
|
port: {
|
|
56
28
|
alias: 'p',
|
|
57
29
|
describe: 'Local server port for testing',
|
|
@@ -63,69 +35,6 @@ const builders = {
|
|
|
63
35
|
}
|
|
64
36
|
return port;
|
|
65
37
|
},
|
|
66
|
-
deprecated: true,
|
|
67
|
-
},
|
|
68
|
-
outfileName: {
|
|
69
|
-
alias: 'n',
|
|
70
|
-
describe: 'Output file name',
|
|
71
|
-
type: 'string',
|
|
72
|
-
deprecated: true,
|
|
73
|
-
},
|
|
74
|
-
root: {
|
|
75
|
-
alias: 'r',
|
|
76
|
-
describe: 'Server root directory',
|
|
77
|
-
type: 'string',
|
|
78
|
-
normalize: true,
|
|
79
|
-
deprecated: true,
|
|
80
|
-
},
|
|
81
|
-
sourceMaps: {
|
|
82
|
-
describe: 'Whether builds include sourcemaps',
|
|
83
|
-
type: 'boolean',
|
|
84
|
-
deprecated: true,
|
|
85
|
-
},
|
|
86
|
-
src: {
|
|
87
|
-
alias: 's',
|
|
88
|
-
describe: 'Source file',
|
|
89
|
-
type: 'string',
|
|
90
|
-
normalize: true,
|
|
91
|
-
deprecated: true,
|
|
92
|
-
},
|
|
93
|
-
stripComments: {
|
|
94
|
-
alias: 'strip',
|
|
95
|
-
describe: 'Whether to remove code comments from the build output',
|
|
96
|
-
type: 'boolean',
|
|
97
|
-
deprecated: true,
|
|
98
|
-
},
|
|
99
|
-
suppressWarnings: {
|
|
100
|
-
type: 'boolean',
|
|
101
|
-
describe: 'Whether to suppress warnings',
|
|
102
|
-
deprecated: true,
|
|
103
|
-
},
|
|
104
|
-
transpilationMode: {
|
|
105
|
-
type: 'string',
|
|
106
|
-
describe: 'Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing',
|
|
107
|
-
choices: Object.values(TranspilationModes),
|
|
108
|
-
deprecated: true,
|
|
109
|
-
},
|
|
110
|
-
depsToTranspile: {
|
|
111
|
-
type: 'array',
|
|
112
|
-
describe: 'Transpile only the listed dependencies.',
|
|
113
|
-
deprecated: true,
|
|
114
|
-
},
|
|
115
|
-
verboseErrors: {
|
|
116
|
-
type: 'boolean',
|
|
117
|
-
describe: 'Display original errors',
|
|
118
|
-
deprecated: true,
|
|
119
|
-
},
|
|
120
|
-
writeManifest: {
|
|
121
|
-
describe: 'Make necessary changes to the snap manifest file',
|
|
122
|
-
type: 'boolean',
|
|
123
|
-
deprecated: true,
|
|
124
|
-
},
|
|
125
|
-
serve: {
|
|
126
|
-
describe: 'Serve snap file(s) locally for testing',
|
|
127
|
-
type: 'boolean',
|
|
128
|
-
deprecated: true,
|
|
129
38
|
},
|
|
130
39
|
};
|
|
131
40
|
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,KAAK,EAAE;QACL,QAAQ,EAAE,uBAAuB;QACjC,IAAI,EAAE,SAAS;QACf,OAAO,EAAE,IAAI;KACd;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 build: {\n describe: 'Build the Snap bundle',\n type: 'boolean',\n default: true,\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","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AACA,mCAA+C;AAC/C,kDAA0B;AAC1B,2CAAwC;AAExC,8DAAkC;AAClC,yCAA2C;AAC3C,6CAAsE;AACtE,oFAA2D;AAE3D;;;;;GAKG;AACH,SAAgB,gBAAgB,CAC9B,cAAsB,OAAO,CAAC,OAAO,CAAC,KAAK,CAAC,CAAC,CAAC;IAE9C,MAAM,YAAY,GAAG,sBAAW,CAAC,OAAO,CAAC,IAAI,CAAC;IAC9C,MAAM,cAAc,GAAI,IAAA,mBAAU,EAAC,YAAY,CAAY,CAAC,MAAM,EAAE,CAAC;IAErE,IAAI,CAAC,IAAA,kBAAS,EAAC,WAAW,EAAE,YAAY,CAAC,EAAE,CAAC;QAC1C,IAAA,aAAK,EACH,gBAAgB,WAAW,sCAAsC,cAAc,YAAY,CAC5F,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAZD,4CAYC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,GAAG,CAAC,IAAc,EAAE,QAAa;IACrD,gBAAgB,EAAE,CAAC;IAEnB,MAAM,IAAA,eAAK,EAAC,IAAA,iBAAO,EAAC,IAAI,CAAC,CAAC;SACvB,UAAU,CAAC,SAAS,CAAC;SACrB,KAAK,CAAC,+BAA+B,CAAC;SAEtC,OAAO,CAAC,UAAU,EAAE,8CAA8C,CAAC;SACnE,OAAO,CACN,0CAA0C,EAC1C,2FAA2F,CAC5F;SACA,OAAO,CAAC,mBAAmB,EAAE,6CAA6C,CAAC;SAC3E,OAAO,CACN,sBAAsB,EACtB,4DAA4D,CAC7D;SACA,OAAO,CAAC,sBAAsB,EAAE,oCAAoC,CAAC;SAErE,OAAO,CAAC,QAAQ,CAAC;SAEjB,MAAM,CAAC,QAAQ,EAAE,kBAAQ,CAAC,MAAM,CAAC;SAEjC,MAAM,EAAE;SAER,UAAU,CAAC,KAAK,EAAE,IAAS,EAAE,EAAE;QAC9B,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,sCAAsC,cAAc,YAAY,CAC5F,CAAC;QACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;IAClB,CAAC;AACH,CAAC;AAED;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,GAAG,CAAC,IAAc,EAAE,QAAa;IACrD,gBAAgB,EAAE,CAAC;IAEnB,MAAM,KAAK,CAAC,OAAO,CAAC,IAAI,CAAC,CAAC;SACvB,UAAU,CAAC,SAAS,CAAC;SACrB,KAAK,CAAC,+BAA+B,CAAC;SAEtC,OAAO,CAAC,UAAU,EAAE,8CAA8C,CAAC;SACnE,OAAO,CACN,0CAA0C,EAC1C,2FAA2F,CAC5F;SACA,OAAO,CAAC,mBAAmB,EAAE,6CAA6C,CAAC;SAC3E,OAAO,CACN,sBAAsB,EACtB,4DAA4D,CAC7D;SACA,OAAO,CAAC,sBAAsB,EAAE,oCAAoC,CAAC;SAErE,OAAO,CAAC,QAAQ,CAAC;SAEjB,MAAM,CAAC,QAAQ,EAAE,QAAQ,CAAC,MAAM,CAAC;SAEjC,MAAM,EAAE;SAER,UAAU,CAAC,KAAK,EAAE,IAAS,EAAE,EAAE;QAC9B,kDAAkD;QAClD,IAAI,CAAC,OAAO,GAAG;YACb,MAAM,EAAE,MAAM,eAAe,CAAC,IAAI,CAAC;SACpC,CAAC;QAEF,cAAc,CAAC,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,KAAK,CAAC,oBAAoB,CAAC,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","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"]}
|
|
@@ -1,17 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.buildHandler = void 0;
|
|
3
|
+
exports.buildHandler = exports.steps = void 0;
|
|
4
4
|
const node_1 = require("@metamask/snaps-utils/node");
|
|
5
5
|
const utils_1 = require("@metamask/utils");
|
|
6
6
|
const path_1 = require("path");
|
|
7
|
+
const implementation_1 = require("./implementation.cjs");
|
|
8
|
+
const utils_2 = require("./utils.cjs");
|
|
7
9
|
const errors_1 = require("../../errors.cjs");
|
|
8
|
-
const
|
|
10
|
+
const utils_3 = require("../../utils/index.cjs");
|
|
9
11
|
const eval_1 = require("../eval/index.cjs");
|
|
10
|
-
|
|
11
|
-
const utils_3 = require("./utils.cjs");
|
|
12
|
-
const steps = [
|
|
12
|
+
exports.steps = [
|
|
13
13
|
{
|
|
14
14
|
name: 'Checking the input file.',
|
|
15
|
+
condition: ({ build }) => build,
|
|
15
16
|
task: async ({ config }) => {
|
|
16
17
|
const { input } = config;
|
|
17
18
|
if (!(await (0, node_1.isFile)(input))) {
|
|
@@ -21,7 +22,8 @@ const steps = [
|
|
|
21
22
|
},
|
|
22
23
|
{
|
|
23
24
|
name: 'Building the snap bundle.',
|
|
24
|
-
|
|
25
|
+
condition: ({ build }) => build,
|
|
26
|
+
task: async ({ analyze, build: enableBuild, config, spinner }) => {
|
|
25
27
|
// We don't evaluate the bundle here, because it's done in a separate
|
|
26
28
|
// step.
|
|
27
29
|
const compiler = await (0, implementation_1.build)(config, {
|
|
@@ -32,9 +34,10 @@ const steps = [
|
|
|
32
34
|
if (analyze) {
|
|
33
35
|
return {
|
|
34
36
|
analyze,
|
|
37
|
+
build: enableBuild,
|
|
35
38
|
config,
|
|
36
39
|
spinner,
|
|
37
|
-
port: await (0,
|
|
40
|
+
port: await (0, utils_2.getBundleAnalyzerPort)(compiler),
|
|
38
41
|
};
|
|
39
42
|
}
|
|
40
43
|
return undefined;
|
|
@@ -42,11 +45,11 @@ const steps = [
|
|
|
42
45
|
},
|
|
43
46
|
{
|
|
44
47
|
name: 'Evaluating the snap bundle.',
|
|
45
|
-
condition: ({ config }) => config.evaluate,
|
|
48
|
+
condition: ({ build, config }) => build && config.evaluate,
|
|
46
49
|
task: async ({ config, spinner }) => {
|
|
47
50
|
const path = (0, path_1.resolve)(process.cwd(), config.output.path, config.output.filename);
|
|
48
51
|
await (0, eval_1.evaluate)(path);
|
|
49
|
-
(0,
|
|
52
|
+
(0, utils_3.info)(`Snap bundle evaluated successfully.`, spinner);
|
|
50
53
|
},
|
|
51
54
|
},
|
|
52
55
|
{
|
|
@@ -54,7 +57,7 @@ const steps = [
|
|
|
54
57
|
condition: ({ analyze }) => analyze,
|
|
55
58
|
task: async ({ spinner, port }) => {
|
|
56
59
|
(0, utils_1.assert)(port, 'Port is not defined.');
|
|
57
|
-
(0,
|
|
60
|
+
(0, utils_3.success)(`Bundle analyzer running at http://localhost:${port}.`, spinner);
|
|
58
61
|
spinner.stop();
|
|
59
62
|
},
|
|
60
63
|
},
|
|
@@ -70,7 +73,8 @@ const steps = [
|
|
|
70
73
|
* @returns Nothing.
|
|
71
74
|
*/
|
|
72
75
|
async function buildHandler(config, analyze = false) {
|
|
73
|
-
return await (0,
|
|
76
|
+
return await (0, utils_3.executeSteps)(exports.steps, {
|
|
77
|
+
build: true,
|
|
74
78
|
config,
|
|
75
79
|
analyze,
|
|
76
80
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"build.cjs","sourceRoot":"","sources":["../../../src/commands/build/build.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AACpD,2CAAyC;AACzC,+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;AAStB,QAAA,KAAK,GAAwB;IACxC;QACE,IAAI,EAAE,0BAA0B;QAChC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK;QAC/B,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;YAEzB,IAAI,CAAC,CAAC,MAAM,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,qBAAY,CACpB,0BAA0B,KAAK,qEAAqE,CACrG,CAAC;YACJ,CAAC;QACH,CAAC;KACF;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,EAAE,EAAE,CAAC,KAAK;QAC/B,IAAI,EAAE,KAAK,EAAE,EAAE,OAAO,EAAE,KAAK,EAAE,WAAW,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;YAC/D,qEAAqE;YACrE,QAAQ;YACR,MAAM,QAAQ,GAAG,MAAM,IAAA,sBAAK,EAAC,MAAM,EAAE;gBACnC,OAAO;gBACP,QAAQ,EAAE,KAAK;gBACf,OAAO;aACR,CAAC,CAAC;YAEH,IAAI,OAAO,EAAE,CAAC;gBACZ,OAAO;oBACL,OAAO;oBACP,KAAK,EAAE,WAAW;oBAClB,MAAM;oBACN,OAAO;oBACP,IAAI,EAAE,MAAM,IAAA,6BAAqB,EAAC,QAAQ,CAAC;iBAC5C,CAAC;YACJ,CAAC;YAED,OAAO,SAAS,CAAC;QACnB,CAAC;KACF;IACD;QACE,IAAI,EAAE,6BAA6B;QACnC,SAAS,EAAE,CAAC,EAAE,KAAK,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,KAAK,IAAI,MAAM,CAAC,QAAQ;QAC1D,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;YAClC,MAAM,IAAI,GAAG,IAAA,cAAW,EACtB,OAAO,CAAC,GAAG,EAAE,EACb,MAAM,CAAC,MAAM,CAAC,IAAI,EAClB,MAAM,CAAC,MAAM,CAAC,QAAQ,CACvB,CAAC;YAEF,MAAM,IAAA,eAAQ,EAAC,IAAI,CAAC,CAAC;YAErB,IAAA,YAAI,EAAC,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,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,aAAK,EAAE;QAC/B,KAAK,EAAE,IAAI;QACX,MAAM;QACN,OAAO;KACR,CAAC,CAAC;AACL,CAAC;AATD,oCASC","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\nexport type BuildContext = {\n analyze: boolean;\n build: boolean;\n config: ProcessedConfig;\n port?: number;\n};\n\nexport const steps: Steps<BuildContext> = [\n {\n name: 'Checking the input file.',\n condition: ({ build }) => build,\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 condition: ({ build }) => build,\n task: async ({ analyze, build: enableBuild, 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 build: enableBuild,\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: ({ build, config }) => build && 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 build: true,\n config,\n analyze,\n });\n}\n"]}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { ProcessedConfig } from "../../config.cjs";
|
|
2
|
+
import type { Steps } from "../../utils/index.cjs";
|
|
3
|
+
export type BuildContext = {
|
|
4
|
+
analyze: boolean;
|
|
5
|
+
build: boolean;
|
|
6
|
+
config: ProcessedConfig;
|
|
7
|
+
port?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const steps: Steps<BuildContext>;
|
|
2
10
|
/**
|
|
3
11
|
* Build all files in the given source directory to the given destination
|
|
4
12
|
* directory.
|
|
@@ -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;AAEpD,OAAO,KAAK,EAAE,KAAK,EAAE,8BAAoB;AAIzC,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,YAAY,CAgE5B,CAAC;AAEX;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,EACvB,OAAO,UAAQ,GACd,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -1,4 +1,12 @@
|
|
|
1
1
|
import type { ProcessedConfig } from "../../config.mjs";
|
|
2
|
+
import type { Steps } from "../../utils/index.mjs";
|
|
3
|
+
export type BuildContext = {
|
|
4
|
+
analyze: boolean;
|
|
5
|
+
build: boolean;
|
|
6
|
+
config: ProcessedConfig;
|
|
7
|
+
port?: number;
|
|
8
|
+
};
|
|
9
|
+
export declare const steps: Steps<BuildContext>;
|
|
2
10
|
/**
|
|
3
11
|
* Build all files in the given source directory to the given destination
|
|
4
12
|
* directory.
|
|
@@ -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;AAEpD,OAAO,KAAK,EAAE,KAAK,EAAE,8BAAoB;AAIzC,MAAM,MAAM,YAAY,GAAG;IACzB,OAAO,EAAE,OAAO,CAAC;IACjB,KAAK,EAAE,OAAO,CAAC;IACf,MAAM,EAAE,eAAe,CAAC;IACxB,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAEF,eAAO,MAAM,KAAK,EAAE,KAAK,CAAC,YAAY,CAgE5B,CAAC;AAEX;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,EACvB,OAAO,UAAQ,GACd,OAAO,CAAC,IAAI,CAAC,CAMf"}
|
|
@@ -1,14 +1,15 @@
|
|
|
1
1
|
import { isFile } from "@metamask/snaps-utils/node";
|
|
2
2
|
import { assert } from "@metamask/utils";
|
|
3
3
|
import { resolve as pathResolve } from "path";
|
|
4
|
+
import { build } from "./implementation.mjs";
|
|
5
|
+
import { getBundleAnalyzerPort } from "./utils.mjs";
|
|
4
6
|
import { CommandError } from "../../errors.mjs";
|
|
5
7
|
import { success, executeSteps, info } from "../../utils/index.mjs";
|
|
6
8
|
import { evaluate } from "../eval/index.mjs";
|
|
7
|
-
|
|
8
|
-
import { getBundleAnalyzerPort } from "./utils.mjs";
|
|
9
|
-
const steps = [
|
|
9
|
+
export const steps = [
|
|
10
10
|
{
|
|
11
11
|
name: 'Checking the input file.',
|
|
12
|
+
condition: ({ build }) => build,
|
|
12
13
|
task: async ({ config }) => {
|
|
13
14
|
const { input } = config;
|
|
14
15
|
if (!(await isFile(input))) {
|
|
@@ -18,7 +19,8 @@ const steps = [
|
|
|
18
19
|
},
|
|
19
20
|
{
|
|
20
21
|
name: 'Building the snap bundle.',
|
|
21
|
-
|
|
22
|
+
condition: ({ build }) => build,
|
|
23
|
+
task: async ({ analyze, build: enableBuild, config, spinner }) => {
|
|
22
24
|
// We don't evaluate the bundle here, because it's done in a separate
|
|
23
25
|
// step.
|
|
24
26
|
const compiler = await build(config, {
|
|
@@ -29,6 +31,7 @@ const steps = [
|
|
|
29
31
|
if (analyze) {
|
|
30
32
|
return {
|
|
31
33
|
analyze,
|
|
34
|
+
build: enableBuild,
|
|
32
35
|
config,
|
|
33
36
|
spinner,
|
|
34
37
|
port: await getBundleAnalyzerPort(compiler),
|
|
@@ -39,7 +42,7 @@ const steps = [
|
|
|
39
42
|
},
|
|
40
43
|
{
|
|
41
44
|
name: 'Evaluating the snap bundle.',
|
|
42
|
-
condition: ({ config }) => config.evaluate,
|
|
45
|
+
condition: ({ build, config }) => build && config.evaluate,
|
|
43
46
|
task: async ({ config, spinner }) => {
|
|
44
47
|
const path = pathResolve(process.cwd(), config.output.path, config.output.filename);
|
|
45
48
|
await evaluate(path);
|
|
@@ -68,6 +71,7 @@ const steps = [
|
|
|
68
71
|
*/
|
|
69
72
|
export async function buildHandler(config, analyze = false) {
|
|
70
73
|
return await executeSteps(steps, {
|
|
74
|
+
build: true,
|
|
71
75
|
config,
|
|
72
76
|
analyze,
|
|
73
77
|
});
|