@metamask/snaps-cli 0.16.0 → 0.17.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/README.md +2 -0
- package/dist/builders.d.ts +6 -0
- package/dist/builders.js +20 -1
- package/dist/builders.js.map +1 -1
- package/dist/cli.d.ts +7 -0
- package/dist/cli.js +8 -0
- package/dist/cli.js.map +1 -1
- package/dist/cmds/build/buildHandler.d.ts +4 -4
- package/dist/cmds/build/buildHandler.js +4 -4
- package/dist/cmds/build/buildHandler.js.map +1 -1
- package/dist/cmds/build/bundle.d.ts +3 -2
- package/dist/cmds/build/bundle.js +3 -2
- package/dist/cmds/build/bundle.js.map +1 -1
- package/dist/cmds/build/utils.d.ts +21 -8
- package/dist/cmds/build/utils.js +21 -8
- package/dist/cmds/build/utils.js.map +1 -1
- package/dist/cmds/eval/eval-worker.js +18 -16
- package/dist/cmds/eval/eval-worker.js.map +1 -1
- package/dist/cmds/eval/evalHandler.d.ts +7 -0
- package/dist/cmds/eval/evalHandler.js +7 -0
- package/dist/cmds/eval/evalHandler.js.map +1 -1
- package/dist/cmds/eval/mock.d.ts +11 -0
- package/dist/cmds/eval/mock.js +36 -0
- package/dist/cmds/eval/mock.js.map +1 -1
- package/dist/cmds/eval/workerEval.d.ts +7 -0
- package/dist/cmds/eval/workerEval.js +11 -6
- package/dist/cmds/eval/workerEval.js.map +1 -1
- package/dist/cmds/init/index.js +13 -1
- package/dist/cmds/init/index.js.map +1 -1
- package/dist/cmds/init/init-template.json +5 -1
- package/dist/cmds/init/initHandler.d.ts +11 -0
- package/dist/cmds/init/initHandler.js +38 -3
- package/dist/cmds/init/initHandler.js.map +1 -1
- package/dist/cmds/init/initUtils.d.ts +21 -4
- package/dist/cmds/init/initUtils.js +55 -7
- package/dist/cmds/init/initUtils.js.map +1 -1
- package/dist/cmds/manifest/manifestHandler.d.ts +1 -0
- package/dist/cmds/manifest/manifestHandler.js +6 -0
- package/dist/cmds/manifest/manifestHandler.js.map +1 -1
- package/dist/cmds/serve/index.js +2 -44
- package/dist/cmds/serve/index.js.map +1 -1
- package/dist/cmds/serve/serveHandler.d.ts +10 -0
- package/dist/cmds/serve/serveHandler.js +51 -0
- package/dist/cmds/serve/serveHandler.js.map +1 -0
- package/dist/cmds/serve/serveUtils.d.ts +17 -0
- package/dist/cmds/serve/serveUtils.js +17 -0
- package/dist/cmds/serve/serveUtils.js.map +1 -1
- package/dist/cmds/watch/index.js +3 -0
- package/dist/cmds/watch/index.js.map +1 -1
- package/dist/cmds/watch/watchHandler.d.ts +4 -4
- package/dist/cmds/watch/watchHandler.js +12 -6
- package/dist/cmds/watch/watchHandler.js.map +1 -1
- package/dist/utils/fs.d.ts +5 -5
- package/dist/utils/fs.js +5 -5
- package/dist/utils/fs.js.map +1 -1
- package/dist/utils/misc.d.ts +16 -13
- package/dist/utils/misc.js +16 -13
- package/dist/utils/misc.js.map +1 -1
- package/dist/utils/readline.d.ts +25 -0
- package/dist/utils/readline.js +25 -0
- package/dist/utils/readline.js.map +1 -1
- package/dist/utils/snap-config.d.ts +14 -0
- package/dist/utils/snap-config.js +15 -1
- package/dist/utils/snap-config.js.map +1 -1
- package/dist/utils/validate-fs.d.ts +19 -18
- package/dist/utils/validate-fs.js +21 -20
- package/dist/utils/validate-fs.js.map +1 -1
- package/package.json +11 -11
- package/CHANGELOG.md +0 -227
package/dist/utils/readline.js
CHANGED
|
@@ -6,6 +6,10 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
6
6
|
exports.closePrompt = exports.prompt = exports.openPrompt = void 0;
|
|
7
7
|
const readline_1 = __importDefault(require("readline"));
|
|
8
8
|
let singletonReadlineInterface;
|
|
9
|
+
/**
|
|
10
|
+
* Open a readline interface, to prompt for user input. Avoid using this
|
|
11
|
+
* function directly. Use the {@link prompt} function instead.
|
|
12
|
+
*/
|
|
9
13
|
function openPrompt() {
|
|
10
14
|
singletonReadlineInterface = readline_1.default.createInterface({
|
|
11
15
|
input: process.stdin,
|
|
@@ -13,6 +17,19 @@ function openPrompt() {
|
|
|
13
17
|
});
|
|
14
18
|
}
|
|
15
19
|
exports.openPrompt = openPrompt;
|
|
20
|
+
/**
|
|
21
|
+
* Prompt for user input on the command line. If the prompt isn't open, it will
|
|
22
|
+
* be opened.
|
|
23
|
+
*
|
|
24
|
+
* @param args - The prompt arguments.
|
|
25
|
+
* @param args.question - The question to ask.
|
|
26
|
+
* @param args.defaultValue - The default value to use, if no answer is provided.
|
|
27
|
+
* @param args.shouldClose - Whether to close the readline interface after
|
|
28
|
+
* prompting.
|
|
29
|
+
* @param args.readlineInterface - The readline interface to use. Uses the
|
|
30
|
+
* global readline interface if none provided.
|
|
31
|
+
* @returns The user's input, or the default value if none provided.
|
|
32
|
+
*/
|
|
16
33
|
function prompt({ question, defaultValue, shouldClose, readlineInterface = singletonReadlineInterface, }) {
|
|
17
34
|
let _readlineInterface = readlineInterface;
|
|
18
35
|
if (!_readlineInterface) {
|
|
@@ -38,6 +55,14 @@ function prompt({ question, defaultValue, shouldClose, readlineInterface = singl
|
|
|
38
55
|
});
|
|
39
56
|
}
|
|
40
57
|
exports.prompt = prompt;
|
|
58
|
+
/**
|
|
59
|
+
* Close the readline interface.
|
|
60
|
+
*
|
|
61
|
+
* @param readlineInterface - The readline interface to close. Uses the global
|
|
62
|
+
* readline interface if none provided.
|
|
63
|
+
* @throws If no readline interface is provided, and the global interface isn't
|
|
64
|
+
* open.
|
|
65
|
+
*/
|
|
41
66
|
function closePrompt(readlineInterface = singletonReadlineInterface) {
|
|
42
67
|
if (readlineInterface) {
|
|
43
68
|
readlineInterface.close();
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"readline.js","sourceRoot":"","sources":["../../src/utils/readline.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAEhC,IAAI,0BAA8C,CAAC;AASnD,SAAgB,UAAU;IACxB,0BAA0B,GAAG,kBAAQ,CAAC,eAAe,CAAC;QACpD,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;AACL,CAAC;AALD,gCAKC;AAED,SAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,iBAAiB,GAAG,0BAA0B,GACnC;IACX,IAAI,kBAAkB,GAAG,iBAAiB,CAAC;IAC3C,IAAI,CAAC,kBAAkB,EAAE;QACvB,UAAU,EAAE,CAAC;QACb,kBAAkB,GAAG,0BAA0B,CAAC;KACjD;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QACtC,IAAI,WAAW,GAAG,GAAG,QAAQ,GAAG,CAAC;QACjC,IAAI,YAAY,EAAE;YAChB,WAAW,IAAI,IAAI,YAAY,IAAI,CAAC;SACrC;QAED,kBAAkB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,MAAc,EAAE,EAAE;YAC1D,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;gBAC7B,IAAI,YAAY,KAAK,SAAS,EAAE;oBAC9B,OAAO,CAAC,YAAY,CAAC,CAAC;iBACvB;aACF;YACD,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACvB,IAAI,WAAW,EAAE;gBACf,kBAAkB,CAAC,KAAK,EAAE,CAAC;aAC5B;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA9BD,wBA8BC;AAED,SAAgB,WAAW,CACzB,iBAAiB,GAAG,0BAA0B;IAE9C,IAAI,iBAAiB,EAAE;QACrB,iBAAiB,CAAC,KAAK,EAAE,CAAC;KAC3B;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;KACvE;AACH,CAAC;AARD,kCAQC","sourcesContent":["import readline from 'readline';\n\nlet singletonReadlineInterface: readline.Interface;\n\ntype PromptArgs = {\n question: string;\n defaultValue?: string;\n shouldClose?: boolean;\n readlineInterface?: readline.Interface;\n};\n\nexport function openPrompt(): void {\n singletonReadlineInterface = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n}\n\nexport function prompt({\n question,\n defaultValue,\n shouldClose,\n readlineInterface = singletonReadlineInterface,\n}: PromptArgs): Promise<string> {\n let _readlineInterface = readlineInterface;\n if (!_readlineInterface) {\n openPrompt();\n _readlineInterface = singletonReadlineInterface;\n }\n\n return new Promise((resolve, _reject) => {\n let queryString = `${question} `;\n if (defaultValue) {\n queryString += `(${defaultValue}) `;\n }\n\n _readlineInterface.question(queryString, (answer: string) => {\n if (!answer || !answer.trim()) {\n if (defaultValue !== undefined) {\n resolve(defaultValue);\n }\n }\n resolve(answer.trim());\n if (shouldClose) {\n _readlineInterface.close();\n }\n });\n });\n}\n\nexport function closePrompt(\n readlineInterface = singletonReadlineInterface,\n): void {\n if (readlineInterface) {\n readlineInterface.close();\n } else {\n throw new Error('You are attempting to close a non existent prompt.');\n }\n}\n"]}
|
|
1
|
+
{"version":3,"file":"readline.js","sourceRoot":"","sources":["../../src/utils/readline.ts"],"names":[],"mappings":";;;;;;AAAA,wDAAgC;AAEhC,IAAI,0BAA8C,CAAC;AASnD;;;GAGG;AACH,SAAgB,UAAU;IACxB,0BAA0B,GAAG,kBAAQ,CAAC,eAAe,CAAC;QACpD,KAAK,EAAE,OAAO,CAAC,KAAK;QACpB,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;AACL,CAAC;AALD,gCAKC;AAED;;;;;;;;;;;;GAYG;AACH,SAAgB,MAAM,CAAC,EACrB,QAAQ,EACR,YAAY,EACZ,WAAW,EACX,iBAAiB,GAAG,0BAA0B,GACnC;IACX,IAAI,kBAAkB,GAAG,iBAAiB,CAAC;IAC3C,IAAI,CAAC,kBAAkB,EAAE;QACvB,UAAU,EAAE,CAAC;QACb,kBAAkB,GAAG,0BAA0B,CAAC;KACjD;IAED,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QACtC,IAAI,WAAW,GAAG,GAAG,QAAQ,GAAG,CAAC;QACjC,IAAI,YAAY,EAAE;YAChB,WAAW,IAAI,IAAI,YAAY,IAAI,CAAC;SACrC;QAED,kBAAkB,CAAC,QAAQ,CAAC,WAAW,EAAE,CAAC,MAAc,EAAE,EAAE;YAC1D,IAAI,CAAC,MAAM,IAAI,CAAC,MAAM,CAAC,IAAI,EAAE,EAAE;gBAC7B,IAAI,YAAY,KAAK,SAAS,EAAE;oBAC9B,OAAO,CAAC,YAAY,CAAC,CAAC;iBACvB;aACF;YACD,OAAO,CAAC,MAAM,CAAC,IAAI,EAAE,CAAC,CAAC;YACvB,IAAI,WAAW,EAAE;gBACf,kBAAkB,CAAC,KAAK,EAAE,CAAC;aAC5B;QACH,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC;AA9BD,wBA8BC;AAED;;;;;;;GAOG;AACH,SAAgB,WAAW,CACzB,iBAAiB,GAAG,0BAA0B;IAE9C,IAAI,iBAAiB,EAAE;QACrB,iBAAiB,CAAC,KAAK,EAAE,CAAC;KAC3B;SAAM;QACL,MAAM,IAAI,KAAK,CAAC,oDAAoD,CAAC,CAAC;KACvE;AACH,CAAC;AARD,kCAQC","sourcesContent":["import readline from 'readline';\n\nlet singletonReadlineInterface: readline.Interface;\n\ntype PromptArgs = {\n question: string;\n defaultValue?: string;\n shouldClose?: boolean;\n readlineInterface?: readline.Interface;\n};\n\n/**\n * Open a readline interface, to prompt for user input. Avoid using this\n * function directly. Use the {@link prompt} function instead.\n */\nexport function openPrompt(): void {\n singletonReadlineInterface = readline.createInterface({\n input: process.stdin,\n output: process.stdout,\n });\n}\n\n/**\n * Prompt for user input on the command line. If the prompt isn't open, it will\n * be opened.\n *\n * @param args - The prompt arguments.\n * @param args.question - The question to ask.\n * @param args.defaultValue - The default value to use, if no answer is provided.\n * @param args.shouldClose - Whether to close the readline interface after\n * prompting.\n * @param args.readlineInterface - The readline interface to use. Uses the\n * global readline interface if none provided.\n * @returns The user's input, or the default value if none provided.\n */\nexport function prompt({\n question,\n defaultValue,\n shouldClose,\n readlineInterface = singletonReadlineInterface,\n}: PromptArgs): Promise<string> {\n let _readlineInterface = readlineInterface;\n if (!_readlineInterface) {\n openPrompt();\n _readlineInterface = singletonReadlineInterface;\n }\n\n return new Promise((resolve, _reject) => {\n let queryString = `${question} `;\n if (defaultValue) {\n queryString += `(${defaultValue}) `;\n }\n\n _readlineInterface.question(queryString, (answer: string) => {\n if (!answer || !answer.trim()) {\n if (defaultValue !== undefined) {\n resolve(defaultValue);\n }\n }\n resolve(answer.trim());\n if (shouldClose) {\n _readlineInterface.close();\n }\n });\n });\n}\n\n/**\n * Close the readline interface.\n *\n * @param readlineInterface - The readline interface to close. Uses the global\n * readline interface if none provided.\n * @throws If no readline interface is provided, and the global interface isn't\n * open.\n */\nexport function closePrompt(\n readlineInterface = singletonReadlineInterface,\n): void {\n if (readlineInterface) {\n readlineInterface.close();\n } else {\n throw new Error('You are attempting to close a non existent prompt.');\n }\n}\n"]}
|
|
@@ -7,6 +7,15 @@ export declare type SnapConfig = {
|
|
|
7
7
|
cliOptions?: Record<string, unknown>;
|
|
8
8
|
bundlerCustomizer?: (bundler: browserify.BrowserifyObject) => void;
|
|
9
9
|
};
|
|
10
|
+
/**
|
|
11
|
+
* Attempt to load the snap config file (`snap.config.js`). By default will use
|
|
12
|
+
* the cached config, if it was loaded before, and `cached` is `true`. If the
|
|
13
|
+
* config file is not found, or the config is invalid, this function will kill
|
|
14
|
+
* the process.
|
|
15
|
+
*
|
|
16
|
+
* @param cached - Whether to use the cached config. Defaults to `true`.
|
|
17
|
+
* @returns The snap config.
|
|
18
|
+
*/
|
|
10
19
|
export declare function loadConfig(cached?: boolean): SnapConfig;
|
|
11
20
|
/**
|
|
12
21
|
* Attempts to read configuration options for package.json and the config file,
|
|
@@ -14,5 +23,10 @@ export declare function loadConfig(cached?: boolean): SnapConfig;
|
|
|
14
23
|
*
|
|
15
24
|
* Arguments are only set per the snap-cli config file if they were not specified
|
|
16
25
|
* on the command line.
|
|
26
|
+
*
|
|
27
|
+
* @param snapConfig - The snap config.
|
|
28
|
+
* @param processArgv - The command line arguments, i.e., `process.argv`.
|
|
29
|
+
* @param yargsArgv - The processed `yargs` arguments.
|
|
30
|
+
* @param yargsInstance - An instance of `yargs`.
|
|
17
31
|
*/
|
|
18
32
|
export declare function applyConfig(snapConfig: SnapConfig, processArgv: string[], yargsArgv: Arguments, yargsInstance: typeof yargs): void;
|
|
@@ -11,6 +11,15 @@ const builders_1 = __importDefault(require("../builders"));
|
|
|
11
11
|
const misc_1 = require("./misc");
|
|
12
12
|
const snap_config___GENERATED__1 = require("./snap-config.__GENERATED__");
|
|
13
13
|
let snapConfigCache;
|
|
14
|
+
/**
|
|
15
|
+
* Attempt to load the snap config file (`snap.config.js`). By default will use
|
|
16
|
+
* the cached config, if it was loaded before, and `cached` is `true`. If the
|
|
17
|
+
* config file is not found, or the config is invalid, this function will kill
|
|
18
|
+
* the process.
|
|
19
|
+
*
|
|
20
|
+
* @param cached - Whether to use the cached config. Defaults to `true`.
|
|
21
|
+
* @returns The snap config.
|
|
22
|
+
*/
|
|
14
23
|
function loadConfig(cached = true) {
|
|
15
24
|
if (snapConfigCache !== undefined && cached === true) {
|
|
16
25
|
return snapConfigCache;
|
|
@@ -36,7 +45,7 @@ function loadConfig(cached = true) {
|
|
|
36
45
|
return config;
|
|
37
46
|
}
|
|
38
47
|
exports.loadConfig = loadConfig;
|
|
39
|
-
// Note that the below function is necessary because
|
|
48
|
+
// Note that the below function is necessary because yargs' .config() function
|
|
40
49
|
// leaves much to be desired.
|
|
41
50
|
//
|
|
42
51
|
// In particular, it will set all properties included in the config file
|
|
@@ -47,6 +56,11 @@ exports.loadConfig = loadConfig;
|
|
|
47
56
|
*
|
|
48
57
|
* Arguments are only set per the snap-cli config file if they were not specified
|
|
49
58
|
* on the command line.
|
|
59
|
+
*
|
|
60
|
+
* @param snapConfig - The snap config.
|
|
61
|
+
* @param processArgv - The command line arguments, i.e., `process.argv`.
|
|
62
|
+
* @param yargsArgv - The processed `yargs` arguments.
|
|
63
|
+
* @param yargsInstance - An instance of `yargs`.
|
|
50
64
|
*/
|
|
51
65
|
function applyConfig(snapConfig, processArgv, yargsArgv, yargsInstance) {
|
|
52
66
|
// Instances of yargs has a number of undocumented functions, including
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"snap-config.js","sourceRoot":"","sources":["../../src/utils/snap-config.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,2CAA8C;AAG9C,gEAAsC;AAEtC,2DAAmC;AACnC,iCAA+C;AAC/C,0EAA2D;AAQ3D,IAAI,eAAuC,CAAC;AAE5C,SAAgB,UAAU,CAAC,MAAM,GAAG,IAAI;IACtC,IAAI,eAAe,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE;QACpD,OAAO,eAAe,CAAC;KACxB;IAED,IAAI,MAAW,CAAC;IAChB,IAAI;QACF,iHAAiH;QACjH,MAAM,GAAG,OAAO,CAAC,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAW,CAAC,CAAC,CAAC;KAC5D;IAAC,OAAO,GAAQ,EAAE;QACjB,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB,EAAE;YACnC,eAAe,GAAG,EAAE,CAAC;YACrB,OAAO,eAAe,CAAC;SACxB;QACD,IAAA,eAAQ,EAAC,2BAA2B,kBAAW,EAAE,EAAE,GAAG,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACxB;IAED,IAAI,CAAC,IAAA,uCAAY,EAAC,MAAM,CAAC,EAAE;QACzB,IAAA,eAAQ,EACN,kBAAkB,kBAAW,mGAAmG,CACjI,CAAC;QACF,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACxB;IACD,eAAe,GAAG,MAAM,CAAC;IACzB,OAAO,MAAM,CAAC;AAChB,CAAC;AA1BD,gCA0BC;AAED,8EAA8E;AAC9E,6BAA6B;AAC7B,EAAE;AACF,wEAAwE;AACxE,4DAA4D;AAE5D
|
|
1
|
+
{"version":3,"file":"snap-config.js","sourceRoot":"","sources":["../../src/utils/snap-config.ts"],"names":[],"mappings":";;;;;;AAAA,gDAAwB;AACxB,2CAA8C;AAG9C,gEAAsC;AAEtC,2DAAmC;AACnC,iCAA+C;AAC/C,0EAA2D;AAQ3D,IAAI,eAAuC,CAAC;AAE5C;;;;;;;;GAQG;AACH,SAAgB,UAAU,CAAC,MAAM,GAAG,IAAI;IACtC,IAAI,eAAe,KAAK,SAAS,IAAI,MAAM,KAAK,IAAI,EAAE;QACpD,OAAO,eAAe,CAAC;KACxB;IAED,IAAI,MAAW,CAAC;IAChB,IAAI;QACF,iHAAiH;QACjH,MAAM,GAAG,OAAO,CAAC,cAAI,CAAC,OAAO,CAAC,OAAO,CAAC,GAAG,EAAE,EAAE,kBAAW,CAAC,CAAC,CAAC;KAC5D;IAAC,OAAO,GAAQ,EAAE;QACjB,IAAI,GAAG,CAAC,IAAI,KAAK,kBAAkB,EAAE;YACnC,eAAe,GAAG,EAAE,CAAC;YACrB,OAAO,eAAe,CAAC;SACxB;QACD,IAAA,eAAQ,EAAC,2BAA2B,kBAAW,EAAE,EAAE,GAAG,CAAC,CAAC;QACxD,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACxB;IAED,IAAI,CAAC,IAAA,uCAAY,EAAC,MAAM,CAAC,EAAE;QACzB,IAAA,eAAQ,EACN,kBAAkB,kBAAW,mGAAmG,CACjI,CAAC;QACF,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACxB;IACD,eAAe,GAAG,MAAM,CAAC;IACzB,OAAO,MAAM,CAAC;AAChB,CAAC;AA1BD,gCA0BC;AAED,8EAA8E;AAC9E,6BAA6B;AAC7B,EAAE;AACF,wEAAwE;AACxE,4DAA4D;AAE5D;;;;;;;;;;;GAWG;AACH,SAAgB,WAAW,CACzB,UAAsB,EACtB,WAAqB,EACrB,SAAoB,EACpB,aAA2B;IAE3B,uEAAuE;IACvE,wEAAwE;IACxE,6EAA6E;IAC7E,+BAA+B;IAC/B,EAAE;IACF,8EAA8E;IAC9E,2EAA2E;IAC3E,oBAAoB;IACpB,EAAE;IACF,6EAA6E;IAC7E,qBAAqB;IACrB,MAAM,EAAE,KAAK,EAAE,OAAO,EAAE,GAAG,EAAE,OAAO,EAAE,GACpC,aACD,CAAC,UAAU,EAGX,CAAC;IAEF,MAAM,iBAAiB,GAAG,IAAA,sBAAU,EAAC,WAAW,EAAE;QAChD,KAAK,EAAE,OAAO;KACf,CAA4B,CAAC;IAC9B,OAAO,iBAAiB,CAAC,CAAC,CAAC,CAAC,mCAAmC;IAE/D,MAAM,cAAc,GAAG,IAAI,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC,CAAC;IAErD,MAAM,YAAY,GAAG,CAAC,GAAW,EAAW,EAAE;QAC5C,OAAO,cAAc,CAAC,GAAG,CAAC,GAAG,CAAC,IAAI,CAAC,IAAA,mBAAW,EAAC,iBAAiB,EAAE,GAAG,CAAC,CAAC;IACzE,CAAC,CAAC;IAEF,MAAM,GAAG,GAA4B,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;IACjE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,GAAG,CAAC,EAAE;QAClC,IAAI,IAAA,mBAAW,EAAC,kBAAQ,EAAE,GAAG,CAAC,EAAE;YAC9B,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;gBACrB,SAAS,CAAC,GAAG,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,CAAC;aAC3B;SACF;aAAM;YACL,IAAA,eAAQ,EACN,4DAA4D,GAAG,qBAAqB,kBAAW,uCAAuC,CACvI,CAAC;YACF,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;SACjB;KACF;AACH,CAAC;AAhDD,kCAgDC","sourcesContent":["import path from 'path';\nimport { hasProperty } from '@metamask/utils';\nimport type browserify from 'browserify';\nimport { Arguments } from 'yargs';\nimport yargsParse from 'yargs-parser';\nimport yargs from 'yargs/yargs';\nimport builders from '../builders';\nimport { CONFIG_FILE, logError } from './misc';\nimport { isSnapConfig } from './snap-config.__GENERATED__';\n\n/** @see {isSnapConfig} ts-auto-guard:type-guard */\nexport type SnapConfig = {\n cliOptions?: Record<string, unknown>;\n bundlerCustomizer?: (bundler: browserify.BrowserifyObject) => void;\n};\n\nlet snapConfigCache: SnapConfig | undefined;\n\n/**\n * Attempt to load the snap config file (`snap.config.js`). By default will use\n * the cached config, if it was loaded before, and `cached` is `true`. If the\n * config file is not found, or the config is invalid, this function will kill\n * the process.\n *\n * @param cached - Whether to use the cached config. Defaults to `true`.\n * @returns The snap config.\n */\nexport function loadConfig(cached = true): SnapConfig {\n if (snapConfigCache !== undefined && cached === true) {\n return snapConfigCache;\n }\n\n let config: any;\n try {\n // eslint-disable-next-line node/global-require, import/no-dynamic-require, @typescript-eslint/no-require-imports\n config = require(path.resolve(process.cwd(), CONFIG_FILE));\n } catch (err: any) {\n if (err.code === 'MODULE_NOT_FOUND') {\n snapConfigCache = {};\n return snapConfigCache;\n }\n logError(`Error during parsing of ${CONFIG_FILE}`, err);\n return process.exit(1);\n }\n\n if (!isSnapConfig(config)) {\n logError(\n `Can't validate ${CONFIG_FILE}. Ensure it's a proper javascript file and abides with the structure of a snap configuration file`,\n );\n return process.exit(1);\n }\n snapConfigCache = config;\n return config;\n}\n\n// Note that the below function is necessary because yargs' .config() function\n// leaves much to be desired.\n//\n// In particular, it will set all properties included in the config file\n// regardless of the command, which fails during validation.\n\n/**\n * Attempts to read configuration options for package.json and the config file,\n * and apply them to argv if they weren't already set.\n *\n * Arguments are only set per the snap-cli config file if they were not specified\n * on the command line.\n *\n * @param snapConfig - The snap config.\n * @param processArgv - The command line arguments, i.e., `process.argv`.\n * @param yargsArgv - The processed `yargs` arguments.\n * @param yargsInstance - An instance of `yargs`.\n */\nexport function applyConfig(\n snapConfig: SnapConfig,\n processArgv: string[],\n yargsArgv: Arguments,\n yargsInstance: typeof yargs,\n): void {\n // Instances of yargs has a number of undocumented functions, including\n // getOptions. This function returns an object with properties \"key\" and\n // \"alias\", which specify the options associated with the current command and\n // their aliases, respectively.\n //\n // We leverage this to ensure that the config is only applied to args that are\n // valid for the current command, and that weren't specified by the user on\n // the command line.\n //\n // If we set args that aren't valid for the current command, yargs will error\n // during validation.\n const { alias: aliases, key: options } = (\n yargsInstance as any\n ).getOptions() as {\n alias: Record<string, string[]>;\n key: Record<string, unknown>;\n };\n\n const parsedProcessArgv = yargsParse(processArgv, {\n alias: aliases,\n }) as Record<string, unknown>;\n delete parsedProcessArgv._; // irrelevant yargs parser artifact\n\n const commandOptions = new Set(Object.keys(options));\n\n const shouldSetArg = (key: string): boolean => {\n return commandOptions.has(key) && !hasProperty(parsedProcessArgv, key);\n };\n\n const cfg: Record<string, unknown> = snapConfig.cliOptions || {};\n for (const key of Object.keys(cfg)) {\n if (hasProperty(builders, key)) {\n if (shouldSetArg(key)) {\n yargsArgv[key] = cfg[key];\n }\n } else {\n logError(\n `Error: Encountered unrecognized config property \"options.${key}\" in config file \"${CONFIG_FILE}\". Remove the property and try again.`,\n );\n process.exit(1);\n }\n }\n}\n"]}
|
|
@@ -1,34 +1,35 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Gets the complete out file path from
|
|
2
|
+
* Gets the complete out file path from an output file name and parent
|
|
3
3
|
* directory path.
|
|
4
4
|
*
|
|
5
|
-
* @param
|
|
6
|
-
* @param
|
|
7
|
-
* @returns
|
|
5
|
+
* @param outDir - The path to the out file's parent directory.
|
|
6
|
+
* @param outFileName - The out file's name.
|
|
7
|
+
* @returns The complete path to the out file.
|
|
8
8
|
*/
|
|
9
9
|
export declare function getOutfilePath(outDir: string, outFileName: string): string;
|
|
10
10
|
/**
|
|
11
|
-
* Ensures that the outfile name is just a js file name.
|
|
12
|
-
* Throws on validation failure
|
|
11
|
+
* Ensures that the outfile name is just a `.js` file name.
|
|
12
|
+
* Throws on validation failure.
|
|
13
13
|
*
|
|
14
|
-
* @param filename - The file name to validate
|
|
15
|
-
* @returns
|
|
14
|
+
* @param filename - The file name to validate.
|
|
15
|
+
* @returns `true` if validation succeeded.
|
|
16
|
+
* @throws If the file name is invalid.
|
|
16
17
|
*/
|
|
17
18
|
export declare function validateOutfileName(filename: string): boolean;
|
|
18
19
|
/**
|
|
19
|
-
* Validates a file path.
|
|
20
|
-
* Throws on validation failure
|
|
20
|
+
* Validates a file path. Throws on validation failure.
|
|
21
21
|
*
|
|
22
|
-
* @param filePath - The file path to validate
|
|
23
|
-
* @returns
|
|
22
|
+
* @param filePath - The file path to validate.
|
|
23
|
+
* @returns `true` if validation succeeded.
|
|
24
|
+
* @throws If the path does not resolve to a file.
|
|
24
25
|
*/
|
|
25
26
|
export declare function validateFilePath(filePath: string): Promise<boolean>;
|
|
26
27
|
/**
|
|
27
|
-
* Validates a directory path.
|
|
28
|
-
* Throws on validation failure.
|
|
28
|
+
* Validates a directory path. Throws on validation failure.
|
|
29
29
|
*
|
|
30
|
-
* @param dirPath - The directory path to validate
|
|
31
|
-
* @param createDir - Whether to create the directory if it doesn't exist
|
|
32
|
-
* @returns
|
|
30
|
+
* @param dirPath - The directory path to validate.
|
|
31
|
+
* @param createDir - Whether to create the directory if it doesn't exist.
|
|
32
|
+
* @returns `true` if validation succeeded or the directory was created.
|
|
33
|
+
* @throws If the directory does not exist or could not be created.
|
|
33
34
|
*/
|
|
34
|
-
export declare function validateDirPath(
|
|
35
|
+
export declare function validateDirPath(dirPath: string, createDir: boolean): Promise<boolean>;
|
|
@@ -7,23 +7,24 @@ exports.validateDirPath = exports.validateFilePath = exports.validateOutfileName
|
|
|
7
7
|
const path_1 = __importDefault(require("path"));
|
|
8
8
|
const fs_1 = require("./fs");
|
|
9
9
|
/**
|
|
10
|
-
* Gets the complete out file path from
|
|
10
|
+
* Gets the complete out file path from an output file name and parent
|
|
11
11
|
* directory path.
|
|
12
12
|
*
|
|
13
|
-
* @param
|
|
14
|
-
* @param
|
|
15
|
-
* @returns
|
|
13
|
+
* @param outDir - The path to the out file's parent directory.
|
|
14
|
+
* @param outFileName - The out file's name.
|
|
15
|
+
* @returns The complete path to the out file.
|
|
16
16
|
*/
|
|
17
17
|
function getOutfilePath(outDir, outFileName) {
|
|
18
18
|
return path_1.default.join(outDir, outFileName || 'bundle.js');
|
|
19
19
|
}
|
|
20
20
|
exports.getOutfilePath = getOutfilePath;
|
|
21
21
|
/**
|
|
22
|
-
* Ensures that the outfile name is just a js file name.
|
|
23
|
-
* Throws on validation failure
|
|
22
|
+
* Ensures that the outfile name is just a `.js` file name.
|
|
23
|
+
* Throws on validation failure.
|
|
24
24
|
*
|
|
25
|
-
* @param filename - The file name to validate
|
|
26
|
-
* @returns
|
|
25
|
+
* @param filename - The file name to validate.
|
|
26
|
+
* @returns `true` if validation succeeded.
|
|
27
|
+
* @throws If the file name is invalid.
|
|
27
28
|
*/
|
|
28
29
|
function validateOutfileName(filename) {
|
|
29
30
|
if (!filename.endsWith('.js') ||
|
|
@@ -35,11 +36,11 @@ function validateOutfileName(filename) {
|
|
|
35
36
|
}
|
|
36
37
|
exports.validateOutfileName = validateOutfileName;
|
|
37
38
|
/**
|
|
38
|
-
* Validates a file path.
|
|
39
|
-
* Throws on validation failure
|
|
39
|
+
* Validates a file path. Throws on validation failure.
|
|
40
40
|
*
|
|
41
|
-
* @param filePath - The file path to validate
|
|
42
|
-
* @returns
|
|
41
|
+
* @param filePath - The file path to validate.
|
|
42
|
+
* @returns `true` if validation succeeded.
|
|
43
|
+
* @throws If the path does not resolve to a file.
|
|
43
44
|
*/
|
|
44
45
|
async function validateFilePath(filePath) {
|
|
45
46
|
const exists = await (0, fs_1.isFile)(filePath);
|
|
@@ -50,17 +51,17 @@ async function validateFilePath(filePath) {
|
|
|
50
51
|
}
|
|
51
52
|
exports.validateFilePath = validateFilePath;
|
|
52
53
|
/**
|
|
53
|
-
* Validates a directory path.
|
|
54
|
-
* Throws on validation failure.
|
|
54
|
+
* Validates a directory path. Throws on validation failure.
|
|
55
55
|
*
|
|
56
|
-
* @param dirPath - The directory path to validate
|
|
57
|
-
* @param createDir - Whether to create the directory if it doesn't exist
|
|
58
|
-
* @returns
|
|
56
|
+
* @param dirPath - The directory path to validate.
|
|
57
|
+
* @param createDir - Whether to create the directory if it doesn't exist.
|
|
58
|
+
* @returns `true` if validation succeeded or the directory was created.
|
|
59
|
+
* @throws If the directory does not exist or could not be created.
|
|
59
60
|
*/
|
|
60
|
-
async function validateDirPath(
|
|
61
|
-
const exists = await (0, fs_1.isDirectory)(
|
|
61
|
+
async function validateDirPath(dirPath, createDir) {
|
|
62
|
+
const exists = await (0, fs_1.isDirectory)(dirPath, createDir);
|
|
62
63
|
if (!exists) {
|
|
63
|
-
throw new Error(`Invalid params: '${
|
|
64
|
+
throw new Error(`Invalid params: '${dirPath}' is not a directory or could not be created.`);
|
|
64
65
|
}
|
|
65
66
|
return true;
|
|
66
67
|
}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"validate-fs.js","sourceRoot":"","sources":["../../src/utils/validate-fs.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA6B;AAC7B,6BAA2C;AAE3C;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,MAAc,EAAE,WAAmB;IAChE,OAAO,cAAS,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,IAAI,WAAW,CAAC,CAAC;AAC5D,CAAC;AAFD,wCAEC;AAED
|
|
1
|
+
{"version":3,"file":"validate-fs.js","sourceRoot":"","sources":["../../src/utils/validate-fs.ts"],"names":[],"mappings":";;;;;;AAAA,gDAA6B;AAC7B,6BAA2C;AAE3C;;;;;;;GAOG;AACH,SAAgB,cAAc,CAAC,MAAc,EAAE,WAAmB;IAChE,OAAO,cAAS,CAAC,IAAI,CAAC,MAAM,EAAE,WAAW,IAAI,WAAW,CAAC,CAAC;AAC5D,CAAC;AAFD,wCAEC;AAED;;;;;;;GAOG;AACH,SAAgB,mBAAmB,CAAC,QAAgB;IAClD,IACE,CAAC,QAAQ,CAAC,QAAQ,CAAC,KAAK,CAAC;QACzB,QAAQ,KAAK,KAAK;QAClB,QAAQ,CAAC,OAAO,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAC5B;QACA,MAAM,IAAI,KAAK,CAAC,yBAAyB,QAAQ,sBAAsB,CAAC,CAAC;KAC1E;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AATD,kDASC;AAED;;;;;;GAMG;AACI,KAAK,UAAU,gBAAgB,CAAC,QAAgB;IACrD,MAAM,MAAM,GAAG,MAAM,IAAA,WAAM,EAAC,QAAQ,CAAC,CAAC;IACtC,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CACb,oBAAoB,QAAQ,oCAAoC,CACjE,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AARD,4CAQC;AAED;;;;;;;GAOG;AACI,KAAK,UAAU,eAAe,CACnC,OAAe,EACf,SAAkB;IAElB,MAAM,MAAM,GAAG,MAAM,IAAA,gBAAW,EAAC,OAAO,EAAE,SAAS,CAAC,CAAC;IACrD,IAAI,CAAC,MAAM,EAAE;QACX,MAAM,IAAI,KAAK,CACb,oBAAoB,OAAO,+CAA+C,CAC3E,CAAC;KACH;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAXD,0CAWC","sourcesContent":["import pathUtils from 'path';\nimport { isFile, isDirectory } from './fs';\n\n/**\n * Gets the complete out file path from an output file name and parent\n * directory path.\n *\n * @param outDir - The path to the out file's parent directory.\n * @param outFileName - The out file's name.\n * @returns The complete path to the out file.\n */\nexport function getOutfilePath(outDir: string, outFileName: string): string {\n return pathUtils.join(outDir, outFileName || 'bundle.js');\n}\n\n/**\n * Ensures that the outfile name is just a `.js` file name.\n * Throws on validation failure.\n *\n * @param filename - The file name to validate.\n * @returns `true` if validation succeeded.\n * @throws If the file name is invalid.\n */\nexport function validateOutfileName(filename: string): boolean {\n if (\n !filename.endsWith('.js') ||\n filename === '.js' ||\n filename.indexOf('/') !== -1\n ) {\n throw new Error(`Invalid outfile name: ${filename}. Must be a .js file`);\n }\n return true;\n}\n\n/**\n * Validates a file path. Throws on validation failure.\n *\n * @param filePath - The file path to validate.\n * @returns `true` if validation succeeded.\n * @throws If the path does not resolve to a file.\n */\nexport async function validateFilePath(filePath: string): Promise<boolean> {\n const exists = await isFile(filePath);\n if (!exists) {\n throw new Error(\n `Invalid params: '${filePath}' is not a file or does not exist.`,\n );\n }\n return true;\n}\n\n/**\n * Validates a directory path. Throws on validation failure.\n *\n * @param dirPath - The directory path to validate.\n * @param createDir - Whether to create the directory if it doesn't exist.\n * @returns `true` if validation succeeded or the directory was created.\n * @throws If the directory does not exist or could not be created.\n */\nexport async function validateDirPath(\n dirPath: string,\n createDir: boolean,\n): Promise<boolean> {\n const exists = await isDirectory(dirPath, createDir);\n if (!exists) {\n throw new Error(\n `Invalid params: '${dirPath}' is not a directory or could not be created.`,\n );\n }\n return true;\n}\n"]}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.17.0",
|
|
4
4
|
"description": "A CLI for developing MetaMask Snaps.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
@@ -14,7 +14,6 @@
|
|
|
14
14
|
"dist/"
|
|
15
15
|
],
|
|
16
16
|
"scripts": {
|
|
17
|
-
"setup": "yarn install && yarn allow-scripts",
|
|
18
17
|
"shasum": "node ./scripts/computeSnapShasum.js",
|
|
19
18
|
"build:init-template": "node ./scripts/createInitTemplate.js && yarn prettier --check src/cmds/init/init-template.json",
|
|
20
19
|
"build:guards": "ts-auto-guard --guard-file-name=__GENERATED__ ./src/utils/snap-config.ts",
|
|
@@ -36,7 +35,7 @@
|
|
|
36
35
|
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore",
|
|
37
36
|
"lint": "yarn lint:eslint && yarn lint:misc --check",
|
|
38
37
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
39
|
-
"publish": "../../scripts/publish-package.sh"
|
|
38
|
+
"publish:package": "../../scripts/publish-package.sh"
|
|
40
39
|
},
|
|
41
40
|
"dependencies": {
|
|
42
41
|
"@babel/core": "^7.16.7",
|
|
@@ -47,12 +46,12 @@
|
|
|
47
46
|
"@babel/plugin-transform-runtime": "^7.16.7",
|
|
48
47
|
"@babel/preset-env": "^7.16.7",
|
|
49
48
|
"@babel/preset-typescript": "^7.16.7",
|
|
50
|
-
"@metamask/snap-controllers": "^0.
|
|
51
|
-
"@metamask/snaps-browserify-plugin": "^0.
|
|
49
|
+
"@metamask/snap-controllers": "^0.17.0",
|
|
50
|
+
"@metamask/snaps-browserify-plugin": "^0.17.0",
|
|
52
51
|
"@metamask/utils": "^2.0.0",
|
|
53
52
|
"babelify": "^10.0.0",
|
|
54
53
|
"browserify": "^17.0.0",
|
|
55
|
-
"chokidar": "^3.
|
|
54
|
+
"chokidar": "^3.5.2",
|
|
56
55
|
"init-package-json": "^1.10.3",
|
|
57
56
|
"is-url": "^1.2.4",
|
|
58
57
|
"mkdirp": "^1.0.4",
|
|
@@ -66,10 +65,10 @@
|
|
|
66
65
|
"devDependencies": {
|
|
67
66
|
"@lavamoat/allow-scripts": "^2.0.3",
|
|
68
67
|
"@metamask/auto-changelog": "^2.6.0",
|
|
69
|
-
"@metamask/eslint-config": "^
|
|
70
|
-
"@metamask/eslint-config-jest": "^
|
|
71
|
-
"@metamask/eslint-config-nodejs": "^
|
|
72
|
-
"@metamask/eslint-config-typescript": "^
|
|
68
|
+
"@metamask/eslint-config": "^9.0.0",
|
|
69
|
+
"@metamask/eslint-config-jest": "^9.0.0",
|
|
70
|
+
"@metamask/eslint-config-nodejs": "^9.0.0",
|
|
71
|
+
"@metamask/eslint-config-typescript": "^9.0.1",
|
|
73
72
|
"@types/browserify": "^12.0.36",
|
|
74
73
|
"@types/init-package-json": "^1.10.0",
|
|
75
74
|
"@types/is-url": "^1.2.28",
|
|
@@ -86,6 +85,7 @@
|
|
|
86
85
|
"eslint-config-prettier": "^8.3.0",
|
|
87
86
|
"eslint-plugin-import": "^2.23.4",
|
|
88
87
|
"eslint-plugin-jest": "^24.4.0",
|
|
88
|
+
"eslint-plugin-jsdoc": "^36.1.0",
|
|
89
89
|
"eslint-plugin-node": "^11.1.0",
|
|
90
90
|
"eslint-plugin-prettier": "^3.4.0",
|
|
91
91
|
"execa": "^5.1.1",
|
|
@@ -102,7 +102,7 @@
|
|
|
102
102
|
"typescript": "^4.4.0"
|
|
103
103
|
},
|
|
104
104
|
"engines": {
|
|
105
|
-
"node": ">=
|
|
105
|
+
"node": ">=16.0.0"
|
|
106
106
|
},
|
|
107
107
|
"publishConfig": {
|
|
108
108
|
"access": "public",
|
package/CHANGELOG.md
DELETED
|
@@ -1,227 +0,0 @@
|
|
|
1
|
-
# Changelog
|
|
2
|
-
All notable changes to this project will be documented in this file.
|
|
3
|
-
|
|
4
|
-
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
|
|
5
|
-
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
|
|
6
|
-
|
|
7
|
-
## [Unreleased]
|
|
8
|
-
|
|
9
|
-
## [0.16.0]
|
|
10
|
-
### Changed
|
|
11
|
-
- **BREAKING:** Snaps are now required to export `onRpcRequest` to receive RPC requests ([#481](https://github.com/MetaMask/snaps-skunkworks/pull/481), [#533](https://github.com/MetaMask/snaps-skunkworks/pull/533), [#538](https://github.com/MetaMask/snaps-skunkworks/pull/538), [#541](https://github.com/MetaMask/snaps-skunkworks/pull/541), [#544](https://github.com/MetaMask/snaps-skunkworks/pull/544))
|
|
12
|
-
- The type of the function is available in `@metamask/snap-types` as `OnRpcRequestHandler`.
|
|
13
|
-
|
|
14
|
-
### Fixed
|
|
15
|
-
- Fix importing local files in TypeScript Snaps ([#527](https://github.com/MetaMask/snaps-skunkworks/pull/527))
|
|
16
|
-
- Fix `build` command when the CLI is installed globally ([#542](https://github.com/MetaMask/snaps-skunkworks/pull/542))
|
|
17
|
-
|
|
18
|
-
## [0.15.0]
|
|
19
|
-
### Added
|
|
20
|
-
- Add support for building TypeScript Snaps ([#443](https://github.com/MetaMask/snaps-skunkworks/pull/443))
|
|
21
|
-
|
|
22
|
-
### Fixed
|
|
23
|
-
- Fix an issue where comment stripping would break for large files ([#468](https://github.com/MetaMask/snaps-skunkworks/pull/468))
|
|
24
|
-
|
|
25
|
-
## [0.14.0]
|
|
26
|
-
### Changed
|
|
27
|
-
- **BREAKING:** Increase TypeScript compilation target to ES2020 ([#449](https://github.com/MetaMask/snaps-skunkworks/pull/449))
|
|
28
|
-
- This should not be breaking for consumers on any non-deprecated browser or Node.js version.
|
|
29
|
-
|
|
30
|
-
## [0.13.0]
|
|
31
|
-
### Changed
|
|
32
|
-
- No changes this release.
|
|
33
|
-
|
|
34
|
-
## [0.12.0]
|
|
35
|
-
### Changed
|
|
36
|
-
- No changes this release.
|
|
37
|
-
|
|
38
|
-
## [0.11.1]
|
|
39
|
-
### Changed
|
|
40
|
-
- No changes this release.
|
|
41
|
-
|
|
42
|
-
## [0.11.0]
|
|
43
|
-
### Added
|
|
44
|
-
- Add self to mock endowments ([#341](https://github.com/MetaMask/snaps-skunkworks/pull/341))
|
|
45
|
-
|
|
46
|
-
### Changed
|
|
47
|
-
- Bump `ses` to `0.15.15` ([#396](https://github.com/MetaMask/snaps-skunkworks/pull/396))
|
|
48
|
-
- Upgraded TypeScript version to minimum 4.4 ([#360](https://github.com/MetaMask/snaps-skunkworks/pull/360))
|
|
49
|
-
- Update template files ([#350](https://github.com/MetaMask/snaps-skunkworks/pull/350))
|
|
50
|
-
|
|
51
|
-
## [0.10.7]
|
|
52
|
-
### Changed
|
|
53
|
-
- **BREAKING:** Bump minimum Node version from 12 to 14 ([#331](https://github.com/MetaMask/snaps-skunkworks/pull/331))
|
|
54
|
-
- Update `mm-snap init` template files ([#330](https://github.com/MetaMask/snaps-skunkworks/pull/330))
|
|
55
|
-
|
|
56
|
-
### Fixed
|
|
57
|
-
- Fix issue where comment stripping would create invalid bundles ([#336](https://github.com/MetaMask/snaps-skunkworks/pull/336))
|
|
58
|
-
|
|
59
|
-
## [0.10.6]
|
|
60
|
-
### Fixed
|
|
61
|
-
- Fix endowment mocking during `mm-snap eval` ([#311](https://github.com/MetaMask/snaps-skunkworks/pull/311))
|
|
62
|
-
|
|
63
|
-
## [0.10.5]
|
|
64
|
-
### Changed
|
|
65
|
-
- No changes this release.
|
|
66
|
-
|
|
67
|
-
## [0.10.3]
|
|
68
|
-
### Fixed
|
|
69
|
-
- Improve dynamic mocking ([#262](https://github.com/MetaMask/snaps-skunkworks/pull/262))
|
|
70
|
-
|
|
71
|
-
## [0.10.2]
|
|
72
|
-
### Fixed
|
|
73
|
-
- Installation failure ([#279](https://github.com/MetaMask/snaps-skunkworks/pull/279))
|
|
74
|
-
- A faulty installation script in a dependency caused the installation of this package to fail.
|
|
75
|
-
|
|
76
|
-
## [0.10.1]
|
|
77
|
-
### Fixed
|
|
78
|
-
- Comment stripping will no longer remove empty block comments in strings ([#276](https://github.com/MetaMask/snaps-skunkworks/pull/276))
|
|
79
|
-
|
|
80
|
-
## [0.10.0]
|
|
81
|
-
### Added
|
|
82
|
-
- **BREAKING:** Transform HTML comments by default ([#237](https://github.com/MetaMask/snaps-skunkworks/pull/237))
|
|
83
|
-
- The strings `<!--` and `-->` will be transformed into `< !--` and `-- >` respectively by default. If these strings appear as operands in an expression or in a string literal, this transform will change the behavior of your program. This behavior was added because these strings are rejected by SES. The behavior can be toggled using the `--transformHtmlComments` option.
|
|
84
|
-
- `--transpiledDeps` flag to `build` and `watch` commands ([#221](https://github.com/MetaMask/snaps-skunkworks/pull/221))
|
|
85
|
-
- This flag allows the user to specify which dependencies will be transpiled at build time if the `--transpilationMode` is `--localAndDeps`.
|
|
86
|
-
- Add CLI usage instructions to readme ([#228](https://github.com/MetaMask/snaps-skunkworks/pull/228))
|
|
87
|
-
- Build process customization ([#251](https://github.com/MetaMask/snaps-skunkworks/pull/251))
|
|
88
|
-
- Builds can now be customized by adding a `bundlerCustomizer` function to `snap.config.js`. See the README for details.
|
|
89
|
-
|
|
90
|
-
### Changed
|
|
91
|
-
- **BREAKING:** Change Snap config file format ([#251](https://github.com/MetaMask/snaps-skunkworks/pull/251))
|
|
92
|
-
- The CLI now expects a file `snap.config.js` instead of `snap.config.json`, with a different structure. See the README for details.
|
|
93
|
-
- **BREAKING:** Strip comments in source code by default ([#243](https://github.com/MetaMask/snaps-skunkworks/pull/243))
|
|
94
|
-
- All comments will now be stripped from snap source code (including dependencies) by default.
|
|
95
|
-
- Enable `--verboseErrors` by default ([#249](https://github.com/MetaMask/snaps-skunkworks/pull/249))
|
|
96
|
-
|
|
97
|
-
### Fixed
|
|
98
|
-
- Comment stripping bug ([#270](https://github.com/MetaMask/snaps-skunkworks/pull/270))
|
|
99
|
-
- Prior to this change, if the `--strip-comments` option was provided to `mm-snap build` and an empty block comment of the form `/**/` appeared anywhere in the source code (including dependencies), the remainder of the string after the empty block comment would be truncated. This was resolved by removing all instances of the string `/**/` from the raw bundle string.
|
|
100
|
-
- In an upcoming release, the string `/**/` will only be removed if it is in fact an empty block comment, and not if it e.g. appears in a string literal.
|
|
101
|
-
- `watch` command parity with `build` command ([#241](https://github.com/MetaMask/snaps-skunkworks/pull/241))
|
|
102
|
-
- The `build` command had received a number of options that were not made available to the `watch` command. They now have the same options.
|
|
103
|
-
- Update dead link in readme ([#240](https://github.com/MetaMask/snaps-skunkworks/pull/240))
|
|
104
|
-
|
|
105
|
-
## [0.9.0]
|
|
106
|
-
### Added
|
|
107
|
-
- Transpilation configuration ([#213](https://github.com/MetaMask/snaps-skunkworks/pull/213))
|
|
108
|
-
- `mm-snap build` now takes a `--transpilationMode` argument which determines what will be transpiled by Babel during building: all source code (including dependencies), local source code only, or nothing.
|
|
109
|
-
|
|
110
|
-
### Fixed
|
|
111
|
-
- `mm-snap build` command when CLI is installed globally ([#216](https://github.com/MetaMask/snaps-skunkworks/pull/216))
|
|
112
|
-
- Update installation command in readme ([#205](https://github.com/MetaMask/snaps-skunkworks/pull/205))
|
|
113
|
-
|
|
114
|
-
## [0.8.0]
|
|
115
|
-
### Changed
|
|
116
|
-
- Update template snap created by `mm-snap init` ([#195](https://github.com/MetaMask/snaps-skunkworks/pull/195))
|
|
117
|
-
- Exit by throwing errors instead of calling `process.exit` ([#190](https://github.com/MetaMask/snaps-skunkworks/pull/190))
|
|
118
|
-
|
|
119
|
-
## [0.7.0]
|
|
120
|
-
### Added
|
|
121
|
-
- ESM support for `mm-snap build` ([#185](https://github.com/MetaMask/snaps-skunkworks/pull/185))
|
|
122
|
-
- The `build` command can now handle snap source code that includes ESM import / export statements. They will be transpiled to their CommonJS equivalents via Babel.
|
|
123
|
-
|
|
124
|
-
### Fixed
|
|
125
|
-
- Fix `mm-snap init` `src` default value ([#186](https://github.com/MetaMask/snaps-skunkworks/pull/186))
|
|
126
|
-
- It now correctly defaults to `src/index.js` instead of just `index.js`.
|
|
127
|
-
- Fix comment stripping ([#189](https://github.com/MetaMask/snaps-skunkworks/pull/189))
|
|
128
|
-
- Comments wouldn't be stripped under certain circumstances due to a RegEx error, details [here](https://github.com/jonschlinkert/strip-comments/pull/49).
|
|
129
|
-
|
|
130
|
-
## [0.6.3]
|
|
131
|
-
### Changed
|
|
132
|
-
- No changes this release.
|
|
133
|
-
|
|
134
|
-
## [0.6.2]
|
|
135
|
-
### Changed
|
|
136
|
-
- No changes this release.
|
|
137
|
-
|
|
138
|
-
## [0.6.1]
|
|
139
|
-
### Fixed
|
|
140
|
-
- `mm-snap init` Snap `snap_confirm` call ([#168](https://github.com/MetaMask/snaps-skunkworks/pull/168))
|
|
141
|
-
- The generated Snap was passing invalid parameters to the method.
|
|
142
|
-
|
|
143
|
-
## [0.6.0]
|
|
144
|
-
### Added
|
|
145
|
-
- Snap SVG icon support ([#163](https://github.com/MetaMask/snaps-skunkworks/pull/163))
|
|
146
|
-
|
|
147
|
-
### Changed
|
|
148
|
-
- **BREAKING:** Support the new Snaps publishing specification ([#140](https://github.com/MetaMask/snaps-skunkworks/pull/140), [#160](https://github.com/MetaMask/snaps-skunkworks/pull/160))
|
|
149
|
-
- This introduces several breaking changes to how Snaps are developed, hosted, and represented at runtime. See [the specification](https://github.com/MetaMask/specifications/blob/d4a5bf5d6990bb5b02a98bd3f95a24ffb28c701c/snaps/publishing.md) and the referenced pull requests for details.
|
|
150
|
-
- **BREAKING:** Rename Snap `name` property to `id` ([#147](https://github.com/MetaMask/snaps-skunkworks/pull/147))
|
|
151
|
-
- **BREAKING:** Update `ses` to version `^0.15.3` ([#159](https://github.com/MetaMask/snaps-skunkworks/pull/159))
|
|
152
|
-
- This will cause behavioral changes for code executed under SES, and may require modifications to code that previously executed without issues.
|
|
153
|
-
|
|
154
|
-
## [0.5.0]
|
|
155
|
-
### Changed
|
|
156
|
-
- **BREAKING:** Convert all TypeScript `interface` declarations to `type` equivalents ([#143](https://github.com/MetaMask/snaps-skunkworks/pull/143))
|
|
157
|
-
|
|
158
|
-
## [0.4.0]
|
|
159
|
-
### Fixed
|
|
160
|
-
- Make Windows-compatible ([#131](https://github.com/MetaMask/snaps-skunkworks/pull/131))
|
|
161
|
-
|
|
162
|
-
## [0.3.1]
|
|
163
|
-
### Changed
|
|
164
|
-
- No changes this release.
|
|
165
|
-
|
|
166
|
-
## [0.3.0]
|
|
167
|
-
### Changed
|
|
168
|
-
- **BREAKING:** Enforce consistent naming for Snaps-related functionality ([#119](https://github.com/MetaMask/snaps-skunkworks/pull/119))
|
|
169
|
-
|
|
170
|
-
## [0.2.2]
|
|
171
|
-
### Fixed
|
|
172
|
-
- Package script issues ([#97](https://github.com/MetaMask/snaps-skunkworks/pull/97), [#98](https://github.com/MetaMask/snaps-skunkworks/pull/98))
|
|
173
|
-
|
|
174
|
-
## [0.2.1]
|
|
175
|
-
### Fixed
|
|
176
|
-
- Snap produced by `mm-snap init` ([#94](https://github.com/MetaMask/snaps-skunkworks/pull/94))
|
|
177
|
-
- The template used to create the "Hello, world!" snap had become outdated due to a build-time bug.
|
|
178
|
-
|
|
179
|
-
## [0.2.0]
|
|
180
|
-
### Changed
|
|
181
|
-
- Update publish scripts ([#92](https://github.com/MetaMask/snaps-skunkworks/pull/92))
|
|
182
|
-
|
|
183
|
-
## [0.1.1]
|
|
184
|
-
### Added
|
|
185
|
-
- Missing publish scripts to new packages
|
|
186
|
-
|
|
187
|
-
## [0.1.0]
|
|
188
|
-
### Changed
|
|
189
|
-
- **BREAKING:** Rename package to `@metamask/snaps-cli` ([#72](https://github.com/MetaMask/snaps-skunkworks/pull/72))
|
|
190
|
-
- This package was previously named [`snaps-cli`](https://npmjs.com/package/snaps-cli).
|
|
191
|
-
- As part of the renaming, and due to the scope of the changes to both this package and MetaMask Snaps generally, its versioning and changelog have been reset. The original changelog can be found [here](https://github.com/MetaMask/snaps-cli/blob/main/CHANGELOG.md).
|
|
192
|
-
|
|
193
|
-
### Removed
|
|
194
|
-
- Example snaps ([#72](https://github.com/MetaMask/snaps-skunkworks/pull/72))
|
|
195
|
-
- The examples now live in their own package, [`@metamask/snap-examples`](https://npmjs.com/package/@metamask/snap-examples).
|
|
196
|
-
|
|
197
|
-
[Unreleased]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.16.0...HEAD
|
|
198
|
-
[0.16.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.15.0...v0.16.0
|
|
199
|
-
[0.15.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.14.0...v0.15.0
|
|
200
|
-
[0.14.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.13.0...v0.14.0
|
|
201
|
-
[0.13.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.12.0...v0.13.0
|
|
202
|
-
[0.12.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.11.1...v0.12.0
|
|
203
|
-
[0.11.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.11.0...v0.11.1
|
|
204
|
-
[0.11.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.7...v0.11.0
|
|
205
|
-
[0.10.7]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.6...v0.10.7
|
|
206
|
-
[0.10.6]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.5...v0.10.6
|
|
207
|
-
[0.10.5]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.3...v0.10.5
|
|
208
|
-
[0.10.3]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.2...v0.10.3
|
|
209
|
-
[0.10.2]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.1...v0.10.2
|
|
210
|
-
[0.10.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.10.0...v0.10.1
|
|
211
|
-
[0.10.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.9.0...v0.10.0
|
|
212
|
-
[0.9.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.8.0...v0.9.0
|
|
213
|
-
[0.8.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.7.0...v0.8.0
|
|
214
|
-
[0.7.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.3...v0.7.0
|
|
215
|
-
[0.6.3]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.2...v0.6.3
|
|
216
|
-
[0.6.2]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.1...v0.6.2
|
|
217
|
-
[0.6.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.6.0...v0.6.1
|
|
218
|
-
[0.6.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.5.0...v0.6.0
|
|
219
|
-
[0.5.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.4.0...v0.5.0
|
|
220
|
-
[0.4.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.3.1...v0.4.0
|
|
221
|
-
[0.3.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.3.0...v0.3.1
|
|
222
|
-
[0.3.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.2.2...v0.3.0
|
|
223
|
-
[0.2.2]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.2.1...v0.2.2
|
|
224
|
-
[0.2.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.2.0...v0.2.1
|
|
225
|
-
[0.2.0]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.1.1...v0.2.0
|
|
226
|
-
[0.1.1]: https://github.com/MetaMask/snaps-skunkworks/compare/v0.1.0...v0.1.1
|
|
227
|
-
[0.1.0]: https://github.com/MetaMask/snaps-skunkworks/releases/tag/v0.1.0
|