@metamask/snaps-cli 0.38.1-flask.1 → 1.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +377 -19
- package/README.md +67 -542
- package/dist/builders.d.ts +27 -0
- package/dist/{esm/builders.js → builders.js} +51 -48
- package/dist/builders.js.map +1 -0
- package/dist/{types/cli.d.ts → cli.d.ts} +1 -1
- package/dist/cli.js +51 -0
- package/dist/cli.js.map +1 -0
- package/dist/cmds/build/buildHandler.d.ts +13 -0
- package/dist/cmds/build/buildHandler.js +37 -0
- package/dist/cmds/build/buildHandler.js.map +1 -0
- package/dist/cmds/build/bundle.d.ts +15 -0
- package/dist/cmds/build/bundle.js +80 -0
- package/dist/cmds/build/bundle.js.map +1 -0
- package/dist/{types/commands/serve → cmds/build}/index.d.ts +4 -4
- package/dist/cmds/build/index.js +29 -0
- package/dist/cmds/build/index.js.map +1 -0
- package/dist/cmds/build/utils.d.ts +56 -0
- package/dist/cmds/build/utils.js +100 -0
- package/dist/cmds/build/utils.js.map +1 -0
- package/dist/cmds/eval/evalHandler.d.ts +9 -0
- package/dist/cmds/eval/evalHandler.js +25 -0
- package/dist/cmds/eval/evalHandler.js.map +1 -0
- package/dist/cmds/eval/index.d.ts +9 -0
- package/dist/cmds/eval/index.js +15 -0
- package/dist/cmds/eval/index.js.map +1 -0
- package/dist/cmds/index.js +14 -0
- package/dist/cmds/index.js.map +1 -0
- package/dist/cmds/init/index.d.ts +9 -0
- package/dist/cmds/init/index.js +34 -0
- package/dist/cmds/init/index.js.map +1 -0
- package/dist/cmds/init/initHandler.d.ts +26 -0
- package/dist/cmds/init/initHandler.js +69 -0
- package/dist/cmds/init/initHandler.js.map +1 -0
- package/dist/cmds/init/initUtils.d.ts +39 -0
- package/dist/cmds/init/initUtils.js +122 -0
- package/dist/cmds/init/initUtils.js.map +1 -0
- package/dist/cmds/manifest/index.d.ts +9 -0
- package/dist/cmds/manifest/index.js +24 -0
- package/dist/cmds/manifest/index.js.map +1 -0
- package/dist/cmds/manifest/manifestHandler.d.ts +10 -0
- package/dist/cmds/manifest/manifestHandler.js +50 -0
- package/dist/cmds/manifest/manifestHandler.js.map +1 -0
- package/dist/cmds/serve/index.d.ts +9 -0
- package/dist/cmds/serve/index.js +15 -0
- package/dist/cmds/serve/index.js.map +1 -0
- package/dist/cmds/serve/serveHandler.d.ts +10 -0
- package/dist/cmds/serve/serveHandler.js +59 -0
- package/dist/cmds/serve/serveHandler.js.map +1 -0
- package/dist/cmds/serve/serveUtils.d.ts +22 -0
- package/dist/cmds/serve/serveUtils.js +39 -0
- package/dist/cmds/serve/serveUtils.js.map +1 -0
- package/dist/cmds/watch/index.d.ts +9 -0
- package/dist/cmds/watch/index.js +32 -0
- package/dist/cmds/watch/index.js.map +1 -0
- package/dist/cmds/watch/watchHandler.d.ts +14 -0
- package/dist/cmds/watch/watchHandler.js +100 -0
- package/dist/cmds/watch/watchHandler.js.map +1 -0
- package/dist/main.js +15 -0
- package/dist/main.js.map +1 -0
- package/dist/utils/index.d.ts +2 -0
- package/dist/utils/index.js +19 -0
- package/dist/utils/index.js.map +1 -0
- package/dist/utils/misc.d.ts +53 -0
- package/dist/utils/misc.js +156 -0
- package/dist/utils/misc.js.map +1 -0
- package/dist/utils/snap-config.d.ts +48 -0
- package/dist/utils/snap-config.js +117 -0
- package/dist/utils/snap-config.js.map +1 -0
- package/package.json +35 -54
- package/.browserslistrc +0 -3
- package/dist/cjs/builders.js +0 -148
- package/dist/cjs/builders.js.map +0 -1
- package/dist/cjs/cli.js +0 -35
- package/dist/cjs/cli.js.map +0 -1
- package/dist/cjs/commands/build/build.js +0 -54
- package/dist/cjs/commands/build/build.js.map +0 -1
- package/dist/cjs/commands/build/implementation.js +0 -31
- package/dist/cjs/commands/build/implementation.js.map +0 -1
- package/dist/cjs/commands/build/index.js +0 -45
- package/dist/cjs/commands/build/index.js.map +0 -1
- package/dist/cjs/commands/eval/eval.js +0 -57
- package/dist/cjs/commands/eval/eval.js.map +0 -1
- package/dist/cjs/commands/eval/implementation.js +0 -27
- package/dist/cjs/commands/eval/implementation.js.map +0 -1
- package/dist/cjs/commands/eval/index.js +0 -50
- package/dist/cjs/commands/eval/index.js.map +0 -1
- package/dist/cjs/commands/index.js +0 -30
- package/dist/cjs/commands/index.js.map +0 -1
- package/dist/cjs/commands/manifest/implementation.js +0 -34
- package/dist/cjs/commands/manifest/implementation.js.map +0 -1
- package/dist/cjs/commands/manifest/index.js +0 -50
- package/dist/cjs/commands/manifest/index.js.map +0 -1
- package/dist/cjs/commands/manifest/manifest.js +0 -55
- package/dist/cjs/commands/manifest/manifest.js.map +0 -1
- package/dist/cjs/commands/serve/index.js +0 -33
- package/dist/cjs/commands/serve/index.js.map +0 -1
- package/dist/cjs/commands/serve/serve.js +0 -21
- package/dist/cjs/commands/serve/serve.js.map +0 -1
- package/dist/cjs/commands/watch/implementation.js +0 -35
- package/dist/cjs/commands/watch/implementation.js.map +0 -1
- package/dist/cjs/commands/watch/index.js +0 -47
- package/dist/cjs/commands/watch/index.js.map +0 -1
- package/dist/cjs/commands/watch/watch.js +0 -51
- package/dist/cjs/commands/watch/watch.js.map +0 -1
- package/dist/cjs/config.js +0 -290
- package/dist/cjs/config.js.map +0 -1
- package/dist/cjs/errors.js +0 -37
- package/dist/cjs/errors.js.map +0 -1
- package/dist/cjs/index.js +0 -77
- package/dist/cjs/index.js.map +0 -1
- package/dist/cjs/main.js +0 -19
- package/dist/cjs/main.js.map +0 -1
- package/dist/cjs/utils/cli.js +0 -61
- package/dist/cjs/utils/cli.js.map +0 -1
- package/dist/cjs/utils/errors.js +0 -42
- package/dist/cjs/utils/errors.js.map +0 -1
- package/dist/cjs/utils/index.js +0 -25
- package/dist/cjs/utils/index.js.map +0 -1
- package/dist/cjs/utils/legacy.js +0 -48
- package/dist/cjs/utils/legacy.js.map +0 -1
- package/dist/cjs/utils/logging.js +0 -46
- package/dist/cjs/utils/logging.js.map +0 -1
- package/dist/cjs/utils/path.js +0 -16
- package/dist/cjs/utils/path.js.map +0 -1
- package/dist/cjs/utils/steps.js +0 -52
- package/dist/cjs/utils/steps.js.map +0 -1
- package/dist/cjs/webpack/compiler.js +0 -96
- package/dist/cjs/webpack/compiler.js.map +0 -1
- package/dist/cjs/webpack/config.js +0 -234
- package/dist/cjs/webpack/config.js.map +0 -1
- package/dist/cjs/webpack/index.js +0 -22
- package/dist/cjs/webpack/index.js.map +0 -1
- package/dist/cjs/webpack/loaders/browserify.js +0 -97
- package/dist/cjs/webpack/loaders/browserify.js.map +0 -1
- package/dist/cjs/webpack/loaders/wasm.js +0 -36
- package/dist/cjs/webpack/loaders/wasm.js.map +0 -1
- package/dist/cjs/webpack/plugins.js +0 -340
- package/dist/cjs/webpack/plugins.js.map +0 -1
- package/dist/cjs/webpack/utils.js +0 -133
- package/dist/cjs/webpack/utils.js.map +0 -1
- package/dist/esm/builders.js.map +0 -1
- package/dist/esm/cli.js +0 -26
- package/dist/esm/cli.js.map +0 -1
- package/dist/esm/commands/build/build.js +0 -51
- package/dist/esm/commands/build/build.js.map +0 -1
- package/dist/esm/commands/build/implementation.js +0 -27
- package/dist/esm/commands/build/implementation.js.map +0 -1
- package/dist/esm/commands/build/index.js +0 -17
- package/dist/esm/commands/build/index.js.map +0 -1
- package/dist/esm/commands/eval/eval.js +0 -54
- package/dist/esm/commands/eval/eval.js.map +0 -1
- package/dist/esm/commands/eval/implementation.js +0 -24
- package/dist/esm/commands/eval/implementation.js.map +0 -1
- package/dist/esm/commands/eval/index.js +0 -22
- package/dist/esm/commands/eval/index.js.map +0 -1
- package/dist/esm/commands/index.js +0 -15
- package/dist/esm/commands/index.js.map +0 -1
- package/dist/esm/commands/manifest/implementation.js +0 -33
- package/dist/esm/commands/manifest/implementation.js.map +0 -1
- package/dist/esm/commands/manifest/index.js +0 -22
- package/dist/esm/commands/manifest/index.js.map +0 -1
- package/dist/esm/commands/manifest/manifest.js +0 -52
- package/dist/esm/commands/manifest/manifest.js.map +0 -1
- package/dist/esm/commands/serve/index.js +0 -18
- package/dist/esm/commands/serve/index.js.map +0 -1
- package/dist/esm/commands/serve/serve.js +0 -17
- package/dist/esm/commands/serve/serve.js.map +0 -1
- package/dist/esm/commands/watch/implementation.js +0 -34
- package/dist/esm/commands/watch/implementation.js.map +0 -1
- package/dist/esm/commands/watch/index.js +0 -19
- package/dist/esm/commands/watch/index.js.map +0 -1
- package/dist/esm/commands/watch/watch.js +0 -50
- package/dist/esm/commands/watch/watch.js.map +0 -1
- package/dist/esm/config.js +0 -294
- package/dist/esm/config.js.map +0 -1
- package/dist/esm/errors.js +0 -30
- package/dist/esm/errors.js.map +0 -1
- package/dist/esm/index.js +0 -6
- package/dist/esm/index.js.map +0 -1
- package/dist/esm/main.js +0 -10
- package/dist/esm/main.js.map +0 -1
- package/dist/esm/utils/cli.js +0 -43
- package/dist/esm/utils/cli.js.map +0 -1
- package/dist/esm/utils/errors.js +0 -43
- package/dist/esm/utils/errors.js.map +0 -1
- package/dist/esm/utils/index.js +0 -8
- package/dist/esm/utils/index.js.map +0 -1
- package/dist/esm/utils/legacy.js +0 -47
- package/dist/esm/utils/legacy.js.map +0 -1
- package/dist/esm/utils/logging.js +0 -40
- package/dist/esm/utils/logging.js.map +0 -1
- package/dist/esm/utils/path.js +0 -13
- package/dist/esm/utils/path.js.map +0 -1
- package/dist/esm/utils/steps.js +0 -43
- package/dist/esm/utils/steps.js.map +0 -1
- package/dist/esm/webpack/compiler.js +0 -89
- package/dist/esm/webpack/compiler.js.map +0 -1
- package/dist/esm/webpack/config.js +0 -236
- package/dist/esm/webpack/config.js.map +0 -1
- package/dist/esm/webpack/index.js +0 -5
- package/dist/esm/webpack/index.js.map +0 -1
- package/dist/esm/webpack/loaders/browserify.js +0 -82
- package/dist/esm/webpack/loaders/browserify.js.map +0 -1
- package/dist/esm/webpack/loaders/wasm.js +0 -26
- package/dist/esm/webpack/loaders/wasm.js.map +0 -1
- package/dist/esm/webpack/plugins.js +0 -343
- package/dist/esm/webpack/plugins.js.map +0 -1
- package/dist/esm/webpack/utils.js +0 -160
- package/dist/esm/webpack/utils.js.map +0 -1
- package/dist/types/__fixtures__/configs/cjs.d.ts +0 -1
- package/dist/types/__fixtures__/configs/esm.d.ts +0 -3
- package/dist/types/__fixtures__/configs/invalid.d.ts +0 -3
- package/dist/types/__fixtures__/configs/javascript/snap.config.d.ts +0 -0
- package/dist/types/__fixtures__/configs/typescript/snap.config.d.ts +0 -3
- package/dist/types/builders.d.ts +0 -8
- package/dist/types/commands/build/build.d.ts +0 -10
- package/dist/types/commands/build/implementation.d.ts +0 -10
- package/dist/types/commands/build/index.d.ts +0 -10
- package/dist/types/commands/eval/__test__/browserify/bad/snap.config.d.ts +0 -3
- package/dist/types/commands/eval/__test__/browserify/good/snap.config.d.ts +0 -3
- package/dist/types/commands/eval/__test__/webpack/bad/snap.config.d.ts +0 -3
- package/dist/types/commands/eval/__test__/webpack/good/snap.config.d.ts +0 -3
- package/dist/types/commands/eval/__test__/webpack/snap.config.d.ts +0 -3
- package/dist/types/commands/eval/eval.d.ts +0 -14
- package/dist/types/commands/eval/implementation.d.ts +0 -9
- package/dist/types/commands/eval/index.d.ts +0 -10
- package/dist/types/commands/manifest/implementation.d.ts +0 -12
- package/dist/types/commands/manifest/index.d.ts +0 -10
- package/dist/types/commands/manifest/manifest.d.ts +0 -14
- package/dist/types/commands/serve/serve.d.ts +0 -16
- package/dist/types/commands/watch/implementation.d.ts +0 -14
- package/dist/types/commands/watch/index.d.ts +0 -10
- package/dist/types/commands/watch/watch.d.ts +0 -19
- package/dist/types/config.d.ts +0 -626
- package/dist/types/errors.d.ts +0 -25
- package/dist/types/index.d.ts +0 -5
- package/dist/types/utils/cli.d.ts +0 -17
- package/dist/types/utils/errors.d.ts +0 -23
- package/dist/types/utils/index.d.ts +0 -6
- package/dist/types/utils/legacy.d.ts +0 -27
- package/dist/types/utils/logging.d.ts +0 -22
- package/dist/types/utils/path.d.ts +0 -9
- package/dist/types/utils/steps.d.ts +0 -17
- package/dist/types/webpack/compiler.d.ts +0 -29
- package/dist/types/webpack/config.d.ts +0 -37
- package/dist/types/webpack/index.d.ts +0 -3
- package/dist/types/webpack/loaders/browserify.d.ts +0 -16
- package/dist/types/webpack/loaders/wasm.d.ts +0 -20
- package/dist/types/webpack/plugins.d.ts +0 -147
- package/dist/types/webpack/utils.d.ts +0 -156
- /package/dist/{types/commands → cmds}/index.d.ts +0 -0
- /package/dist/{types/main.d.ts → main.d.ts} +0 -0
|
@@ -0,0 +1,117 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.applyConfig = exports.loadConfig = exports.isSnapConfig = exports.SnapConfigStruct = void 0;
|
|
7
|
+
const utils_1 = require("@metamask/utils");
|
|
8
|
+
const path_1 = __importDefault(require("path"));
|
|
9
|
+
const superstruct_1 = require("superstruct");
|
|
10
|
+
const yargs_parser_1 = __importDefault(require("yargs-parser"));
|
|
11
|
+
const builders_1 = __importDefault(require("../builders"));
|
|
12
|
+
const misc_1 = require("./misc");
|
|
13
|
+
exports.SnapConfigStruct = (0, superstruct_1.object)({
|
|
14
|
+
cliOptions: (0, superstruct_1.optional)((0, superstruct_1.object)()),
|
|
15
|
+
bundlerCustomizer: (0, superstruct_1.optional)((0, superstruct_1.func)()),
|
|
16
|
+
});
|
|
17
|
+
/**
|
|
18
|
+
* Check if the given value is a {@link SnapConfig} object. Note that this
|
|
19
|
+
* function does not check the validity of the `bundleCustomizer` property, as
|
|
20
|
+
* it is not possible to check the validity of a function in JavaScript.
|
|
21
|
+
*
|
|
22
|
+
* @param value - The value to check.
|
|
23
|
+
* @returns `true` if the value is a valid {@link SnapConfig} object, `false`
|
|
24
|
+
* otherwise.
|
|
25
|
+
*/
|
|
26
|
+
function isSnapConfig(value) {
|
|
27
|
+
return (0, superstruct_1.is)(value, exports.SnapConfigStruct);
|
|
28
|
+
}
|
|
29
|
+
exports.isSnapConfig = isSnapConfig;
|
|
30
|
+
let snapConfigCache;
|
|
31
|
+
/**
|
|
32
|
+
* Attempt to load the snap config file (`snap.config.js`). By default will use
|
|
33
|
+
* the cached config, if it was loaded before, and `cached` is `true`. If the
|
|
34
|
+
* config file is not found, or the config is invalid, this function will kill
|
|
35
|
+
* the process.
|
|
36
|
+
*
|
|
37
|
+
* @param cached - Whether to use the cached config. Defaults to `true`.
|
|
38
|
+
* @returns The snap config.
|
|
39
|
+
*/
|
|
40
|
+
function loadConfig(cached = true) {
|
|
41
|
+
if (snapConfigCache !== undefined && cached) {
|
|
42
|
+
return snapConfigCache;
|
|
43
|
+
}
|
|
44
|
+
let config;
|
|
45
|
+
try {
|
|
46
|
+
// eslint-disable-next-line node/global-require, import/no-dynamic-require, @typescript-eslint/no-require-imports
|
|
47
|
+
config = require(path_1.default.resolve(process.cwd(), misc_1.CONFIG_FILE));
|
|
48
|
+
}
|
|
49
|
+
catch (error) {
|
|
50
|
+
if (error.code === 'MODULE_NOT_FOUND') {
|
|
51
|
+
snapConfigCache = {};
|
|
52
|
+
return snapConfigCache;
|
|
53
|
+
}
|
|
54
|
+
(0, misc_1.logError)(`Error during parsing of ${misc_1.CONFIG_FILE}`, error);
|
|
55
|
+
return process.exit(1);
|
|
56
|
+
}
|
|
57
|
+
if (!isSnapConfig(config)) {
|
|
58
|
+
(0, misc_1.logError)(`Can't validate ${misc_1.CONFIG_FILE}. Ensure it's a proper javascript file and abides with the structure of a snap configuration file`);
|
|
59
|
+
return process.exit(1);
|
|
60
|
+
}
|
|
61
|
+
snapConfigCache = config;
|
|
62
|
+
return config;
|
|
63
|
+
}
|
|
64
|
+
exports.loadConfig = loadConfig;
|
|
65
|
+
// Note that the below function is necessary because yargs' .config() function
|
|
66
|
+
// leaves much to be desired.
|
|
67
|
+
//
|
|
68
|
+
// In particular, it will set all properties included in the config file
|
|
69
|
+
// regardless of the command, which fails during validation.
|
|
70
|
+
/**
|
|
71
|
+
* Attempts to read configuration options for package.json and the config file,
|
|
72
|
+
* and apply them to argv if they weren't already set.
|
|
73
|
+
*
|
|
74
|
+
* Arguments are only set per the snap-cli config file if they were not specified
|
|
75
|
+
* on the command line.
|
|
76
|
+
*
|
|
77
|
+
* @param snapConfig - The snap config.
|
|
78
|
+
* @param processArgv - The command line arguments, i.e., `process.argv`.
|
|
79
|
+
* @param yargsArgv - The processed `yargs` arguments.
|
|
80
|
+
* @param yargsInstance - An instance of `yargs`.
|
|
81
|
+
*/
|
|
82
|
+
function applyConfig(snapConfig, processArgv, yargsArgv, yargsInstance) {
|
|
83
|
+
// Instances of yargs has a number of undocumented functions, including
|
|
84
|
+
// getOptions. This function returns an object with properties "key" and
|
|
85
|
+
// "alias", which specify the options associated with the current command and
|
|
86
|
+
// their aliases, respectively.
|
|
87
|
+
//
|
|
88
|
+
// We leverage this to ensure that the config is only applied to args that are
|
|
89
|
+
// valid for the current command, and that weren't specified by the user on
|
|
90
|
+
// the command line.
|
|
91
|
+
//
|
|
92
|
+
// If we set args that aren't valid for the current command, yargs will error
|
|
93
|
+
// during validation.
|
|
94
|
+
const { alias: aliases, key: options } = yargsInstance.getOptions();
|
|
95
|
+
const parsedProcessArgv = (0, yargs_parser_1.default)(processArgv, {
|
|
96
|
+
alias: aliases,
|
|
97
|
+
});
|
|
98
|
+
delete parsedProcessArgv._; // irrelevant yargs parser artifact
|
|
99
|
+
const commandOptions = new Set(Object.keys(options));
|
|
100
|
+
const shouldSetArg = (key) => {
|
|
101
|
+
return commandOptions.has(key) && !(0, utils_1.hasProperty)(parsedProcessArgv, key);
|
|
102
|
+
};
|
|
103
|
+
const config = snapConfig.cliOptions ?? {};
|
|
104
|
+
for (const key of Object.keys(config)) {
|
|
105
|
+
if ((0, utils_1.hasProperty)(builders_1.default, key)) {
|
|
106
|
+
if (shouldSetArg(key)) {
|
|
107
|
+
yargsArgv[key] = config[key];
|
|
108
|
+
}
|
|
109
|
+
}
|
|
110
|
+
else {
|
|
111
|
+
(0, misc_1.logError)(`Error: Encountered unrecognized config property "options.${key}" in config file "${misc_1.CONFIG_FILE}". Remove the property and try again.`);
|
|
112
|
+
process.exit(1);
|
|
113
|
+
}
|
|
114
|
+
}
|
|
115
|
+
}
|
|
116
|
+
exports.applyConfig = applyConfig;
|
|
117
|
+
//# sourceMappingURL=snap-config.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"snap-config.js","sourceRoot":"","sources":["../../src/utils/snap-config.ts"],"names":[],"mappings":";;;;;;AAAA,2CAA8C;AAE9C,gDAAwB;AACxB,6CAAgE;AAEhE,gEAAsC;AAGtC,2DAAmC;AACnC,iCAA+C;AAIlC,QAAA,gBAAgB,GAAG,IAAA,oBAAM,EAAC;IACrC,UAAU,EAAE,IAAA,sBAAQ,EAAC,IAAA,oBAAM,GAAE,CAAC;IAC9B,iBAAiB,EAAE,IAAA,sBAAQ,EAAC,IAAA,kBAAI,GAAE,CAAC;CACpC,CAAC,CAAC;AASH;;;;;;;;GAQG;AACH,SAAgB,YAAY,CAAC,KAAc;IACzC,OAAO,IAAA,gBAAE,EAAC,KAAK,EAAE,wBAAgB,CAAC,CAAC;AACrC,CAAC;AAFD,oCAEC;AAED,IAAI,eAAuC,CAAC;AAE5C;;;;;;;;GAQG;AACH,SAAgB,UAAU,CAAC,MAAM,GAAG,IAAI;IACtC,IAAI,eAAe,KAAK,SAAS,IAAI,MAAM,EAAE;QAC3C,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,KAAU,EAAE;QACnB,IAAI,KAAK,CAAC,IAAI,KAAK,kBAAkB,EAAE;YACrC,eAAe,GAAG,EAAE,CAAC;YACrB,OAAO,eAAe,CAAC;SACxB;QACD,IAAA,eAAQ,EAAC,2BAA2B,kBAAW,EAAE,EAAE,KAAK,CAAC,CAAC;QAC1D,OAAO,OAAO,CAAC,IAAI,CAAC,CAAC,CAAC,CAAC;KACxB;IAED,IAAI,CAAC,YAAY,CAAC,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,MAAM,GAA4B,UAAU,CAAC,UAAU,IAAI,EAAE,CAAC;IACpE,KAAK,MAAM,GAAG,IAAI,MAAM,CAAC,IAAI,CAAC,MAAM,CAAC,EAAE;QACrC,IAAI,IAAA,mBAAW,EAAC,kBAAQ,EAAE,GAAG,CAAC,EAAE;YAC9B,IAAI,YAAY,CAAC,GAAG,CAAC,EAAE;gBACrB,SAAS,CAAC,GAAG,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,CAAC;aAC9B;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 { hasProperty } from '@metamask/utils';\nimport type browserify from 'browserify';\nimport path from 'path';\nimport { object, optional, func, Infer, is } from 'superstruct';\nimport { Arguments } from 'yargs';\nimport yargsParse from 'yargs-parser';\nimport yargs from 'yargs/yargs';\n\nimport builders from '../builders';\nimport { CONFIG_FILE, logError } from './misc';\n\nexport type BundleCustomizer = (bundler: browserify.BrowserifyObject) => void;\n\nexport const SnapConfigStruct = object({\n cliOptions: optional(object()),\n bundlerCustomizer: optional(func()),\n});\n\nexport type SnapConfig = Omit<\n Infer<typeof SnapConfigStruct>,\n 'bundlerCustomizer'\n> & {\n bundlerCustomizer?: BundleCustomizer;\n};\n\n/**\n * Check if the given value is a {@link SnapConfig} object. Note that this\n * function does not check the validity of the `bundleCustomizer` property, as\n * it is not possible to check the validity of a function in JavaScript.\n *\n * @param value - The value to check.\n * @returns `true` if the value is a valid {@link SnapConfig} object, `false`\n * otherwise.\n */\nexport function isSnapConfig(value: unknown): value is SnapConfig {\n return is(value, SnapConfigStruct);\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) {\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 (error: any) {\n if (error.code === 'MODULE_NOT_FOUND') {\n snapConfigCache = {};\n return snapConfigCache;\n }\n logError(`Error during parsing of ${CONFIG_FILE}`, error);\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 config: Record<string, unknown> = snapConfig.cliOptions ?? {};\n for (const key of Object.keys(config)) {\n if (hasProperty(builders, key)) {\n if (shouldSetArg(key)) {\n yargsArgv[key] = config[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"]}
|
package/package.json
CHANGED
|
@@ -1,100 +1,81 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-cli",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "1.0.0",
|
|
4
4
|
"description": "A CLI for developing MetaMask Snaps.",
|
|
5
5
|
"repository": {
|
|
6
6
|
"type": "git",
|
|
7
7
|
"url": "https://github.com/MetaMask/snaps.git"
|
|
8
8
|
},
|
|
9
9
|
"license": "ISC",
|
|
10
|
-
"sideEffects": false,
|
|
11
|
-
"main": "./dist/cjs/index.js",
|
|
12
|
-
"module": "./dist/esm/index.js",
|
|
13
|
-
"types": "./dist/types/index.d.ts",
|
|
14
10
|
"bin": {
|
|
15
|
-
"mm-snap": "./dist/
|
|
11
|
+
"mm-snap": "./dist/main.js"
|
|
16
12
|
},
|
|
17
13
|
"files": [
|
|
18
|
-
"dist/
|
|
19
|
-
"dist/esm/**",
|
|
20
|
-
"dist/types/**",
|
|
21
|
-
".browserslistrc"
|
|
14
|
+
"dist/"
|
|
22
15
|
],
|
|
23
16
|
"scripts": {
|
|
24
|
-
"
|
|
25
|
-
"build:
|
|
26
|
-
"build:
|
|
27
|
-
"build:esm": "swc src --out-dir dist/esm --config-file ../../.swcrc.build.json --config module.type=es6",
|
|
28
|
-
"build:cjs": "swc src --out-dir dist/cjs --config-file ../../.swcrc.build.json --config module.type=commonjs",
|
|
29
|
-
"build:post-tsc": "yarn build:chmod && yarn build:readme",
|
|
30
|
-
"build:chmod": "chmod +x ./dist/esm/main.js && chmod +x ./dist/cjs/main.js",
|
|
17
|
+
"shasum": "node ./scripts/computeSnapShasum.js",
|
|
18
|
+
"build:tsc": "tsc --project ./tsconfig.build.json",
|
|
19
|
+
"build:chmod": "chmod +x ./dist/main.js",
|
|
31
20
|
"build:readme": "node ./scripts/updateReadme.js",
|
|
21
|
+
"build": "yarn build:tsc && yarn build:post-tsc",
|
|
22
|
+
"build:post-tsc": "yarn build:chmod && yarn build:readme",
|
|
32
23
|
"build:clean": "yarn clean && yarn build",
|
|
33
24
|
"build:watch": "tsc-watch --onSuccess 'yarn build:chmod'",
|
|
34
|
-
"clean": "rimraf '*.tsbuildinfo' 'dist'",
|
|
25
|
+
"clean": "rimraf '*.tsbuildinfo' 'dist/*'",
|
|
35
26
|
"test": "jest --runInBand && yarn posttest",
|
|
36
27
|
"posttest": "jest-it-up",
|
|
37
28
|
"test:watch": "yarn test --watch",
|
|
38
29
|
"test:ci": "yarn test",
|
|
39
|
-
"lint:changelog": "
|
|
40
|
-
"lint:eslint": "eslint . --cache --ext js,ts
|
|
41
|
-
"lint:misc": "prettier
|
|
42
|
-
"lint": "yarn lint:eslint && yarn lint:misc --check
|
|
30
|
+
"lint:changelog": "yarn auto-changelog validate",
|
|
31
|
+
"lint:eslint": "eslint . --cache --ext js,ts",
|
|
32
|
+
"lint:misc": "prettier '**/*.json' '**/*.md' '!CHANGELOG.md' --ignore-path ../../.gitignore",
|
|
33
|
+
"lint": "yarn lint:eslint && yarn lint:misc --check",
|
|
43
34
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
44
35
|
"prepare-manifest:preview": "../../scripts/prepare-preview-manifest.sh",
|
|
45
36
|
"publish:preview": "yarn npm publish --tag preview",
|
|
46
|
-
"
|
|
37
|
+
"publish:package": "../../scripts/publish-package.sh"
|
|
47
38
|
},
|
|
48
39
|
"dependencies": {
|
|
49
|
-
"@babel/core": "^7.
|
|
40
|
+
"@babel/core": "^7.16.7",
|
|
50
41
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
51
|
-
"@babel/plugin-proposal-
|
|
52
|
-
"@babel/plugin-proposal-
|
|
53
|
-
"@babel/plugin-proposal-
|
|
42
|
+
"@babel/plugin-proposal-nullish-coalescing-operator": "^7.16.7",
|
|
43
|
+
"@babel/plugin-proposal-object-rest-spread": "^7.16.7",
|
|
44
|
+
"@babel/plugin-proposal-optional-chaining": "^7.16.7",
|
|
54
45
|
"@babel/plugin-transform-runtime": "^7.16.7",
|
|
55
|
-
"@babel/preset-env": "^7.
|
|
56
|
-
"@babel/preset-typescript": "^7.
|
|
57
|
-
"@metamask/snaps-browserify-plugin": "^0.
|
|
58
|
-
"@metamask/snaps-utils": "^0.
|
|
59
|
-
"@metamask/snaps-webpack-plugin": "^0.37.2-flask.1",
|
|
46
|
+
"@babel/preset-env": "^7.16.7",
|
|
47
|
+
"@babel/preset-typescript": "^7.16.7",
|
|
48
|
+
"@metamask/snaps-browserify-plugin": "^1.0.0",
|
|
49
|
+
"@metamask/snaps-utils": "^1.0.0",
|
|
60
50
|
"@metamask/utils": "^6.0.1",
|
|
61
|
-
"@swc/core": "^1.3.66",
|
|
62
51
|
"babelify": "^10.0.0",
|
|
63
52
|
"browserify": "^17.0.0",
|
|
64
|
-
"chalk": "^4.1.2",
|
|
65
53
|
"chokidar": "^3.5.2",
|
|
66
54
|
"is-url": "^1.2.4",
|
|
67
|
-
"ora": "^5.4.1",
|
|
68
55
|
"serve-handler": "^6.1.5",
|
|
69
56
|
"ses": "^0.18.1",
|
|
70
57
|
"superstruct": "^1.0.3",
|
|
71
|
-
"
|
|
72
|
-
"terser-webpack-plugin": "^5.3.9",
|
|
73
|
-
"webpack": "^5.88.0",
|
|
74
|
-
"webpack-dev-server": "^4.15.1",
|
|
75
|
-
"webpack-merge": "^5.9.0",
|
|
76
|
-
"yargs": "^17.7.1",
|
|
58
|
+
"yargs": "^16.2.0",
|
|
77
59
|
"yargs-parser": "^20.2.2"
|
|
78
60
|
},
|
|
79
61
|
"devDependencies": {
|
|
80
|
-
"@lavamoat/allow-scripts": "^2.3
|
|
62
|
+
"@lavamoat/allow-scripts": "^2.0.3",
|
|
81
63
|
"@metamask/auto-changelog": "^3.1.0",
|
|
82
|
-
"@metamask/eslint-config": "^
|
|
83
|
-
"@metamask/eslint-config-jest": "^
|
|
84
|
-
"@metamask/eslint-config-nodejs": "^
|
|
85
|
-
"@metamask/eslint-config-typescript": "^
|
|
86
|
-
"@
|
|
87
|
-
"@swc/jest": "^0.2.26",
|
|
88
|
-
"@types/browserify": "^12.0.37",
|
|
64
|
+
"@metamask/eslint-config": "^11.0.0",
|
|
65
|
+
"@metamask/eslint-config-jest": "^11.0.0",
|
|
66
|
+
"@metamask/eslint-config-nodejs": "^11.0.1",
|
|
67
|
+
"@metamask/eslint-config-typescript": "^11.0.0",
|
|
68
|
+
"@types/browserify": "^12.0.36",
|
|
89
69
|
"@types/is-url": "^1.2.28",
|
|
90
70
|
"@types/jest": "^27.5.1",
|
|
91
71
|
"@types/node": "^20.3.1",
|
|
92
72
|
"@types/rimraf": "^3.0.0",
|
|
93
73
|
"@types/serve-handler": "^6.1.0",
|
|
94
|
-
"@types/yargs": "^
|
|
74
|
+
"@types/yargs": "^15.0.12",
|
|
95
75
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
96
76
|
"@typescript-eslint/parser": "^5.42.1",
|
|
97
77
|
"babel-jest": "^29.5.0",
|
|
78
|
+
"clet": "^1.0.1",
|
|
98
79
|
"cross-fetch": "^3.1.5",
|
|
99
80
|
"deepmerge": "^4.2.2",
|
|
100
81
|
"eslint": "^8.27.0",
|
|
@@ -102,16 +83,16 @@
|
|
|
102
83
|
"eslint-plugin-import": "^2.26.0",
|
|
103
84
|
"eslint-plugin-jest": "^27.1.5",
|
|
104
85
|
"eslint-plugin-jsdoc": "^39.6.2",
|
|
105
|
-
"eslint-plugin-
|
|
86
|
+
"eslint-plugin-node": "^11.1.0",
|
|
106
87
|
"eslint-plugin-prettier": "^4.2.1",
|
|
107
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
108
88
|
"execa": "^5.1.1",
|
|
109
89
|
"jest": "^29.0.2",
|
|
110
90
|
"jest-it-up": "^2.0.0",
|
|
111
|
-
"memfs": "^3.4.
|
|
91
|
+
"memfs": "^3.4.10",
|
|
112
92
|
"prettier": "^2.7.1",
|
|
113
93
|
"prettier-plugin-packagejson": "^2.2.11",
|
|
114
|
-
"rimraf": "^
|
|
94
|
+
"rimraf": "^3.0.2",
|
|
95
|
+
"ts-jest": "^29.0.0",
|
|
115
96
|
"ts-node": "^10.9.1",
|
|
116
97
|
"tsc-watch": "^4.5.0",
|
|
117
98
|
"typescript": "~4.8.4"
|
package/.browserslistrc
DELETED
package/dist/cjs/builders.js
DELETED
|
@@ -1,148 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
function _export(target, all) {
|
|
6
|
-
for(var name in all)Object.defineProperty(target, name, {
|
|
7
|
-
enumerable: true,
|
|
8
|
-
get: all[name]
|
|
9
|
-
});
|
|
10
|
-
}
|
|
11
|
-
_export(exports, {
|
|
12
|
-
TranspilationModes: function() {
|
|
13
|
-
return TranspilationModes;
|
|
14
|
-
},
|
|
15
|
-
default: function() {
|
|
16
|
-
return _default;
|
|
17
|
-
}
|
|
18
|
-
});
|
|
19
|
-
var TranspilationModes;
|
|
20
|
-
(function(TranspilationModes) {
|
|
21
|
-
TranspilationModes["LocalAndDeps"] = 'localAndDeps';
|
|
22
|
-
TranspilationModes["LocalOnly"] = 'localOnly';
|
|
23
|
-
TranspilationModes["None"] = 'none';
|
|
24
|
-
})(TranspilationModes || (TranspilationModes = {}));
|
|
25
|
-
const builders = {
|
|
26
|
-
// eslint-disable-next-line @typescript-eslint/naming-convention
|
|
27
|
-
config: {
|
|
28
|
-
alias: 'c',
|
|
29
|
-
describe: 'Path to config file',
|
|
30
|
-
type: 'string',
|
|
31
|
-
normalize: true
|
|
32
|
-
},
|
|
33
|
-
fix: {
|
|
34
|
-
describe: 'Attempt to fix snap.manifest.json',
|
|
35
|
-
type: 'boolean'
|
|
36
|
-
},
|
|
37
|
-
input: {
|
|
38
|
-
alias: 'i',
|
|
39
|
-
describe: 'Snap bundle file to evaluate',
|
|
40
|
-
type: 'string',
|
|
41
|
-
normalize: true
|
|
42
|
-
},
|
|
43
|
-
// Deprecated Browserify options.
|
|
44
|
-
bundle: {
|
|
45
|
-
alias: 'b',
|
|
46
|
-
describe: 'Snap bundle file',
|
|
47
|
-
type: 'string',
|
|
48
|
-
normalize: true,
|
|
49
|
-
deprecated: 'Use --input instead.'
|
|
50
|
-
},
|
|
51
|
-
dist: {
|
|
52
|
-
alias: 'd',
|
|
53
|
-
describe: 'Output directory',
|
|
54
|
-
type: 'string',
|
|
55
|
-
normalize: true,
|
|
56
|
-
deprecated: true
|
|
57
|
-
},
|
|
58
|
-
eval: {
|
|
59
|
-
alias: 'e',
|
|
60
|
-
describe: 'Attempt to evaluate Snap bundle in SES',
|
|
61
|
-
type: 'boolean',
|
|
62
|
-
deprecated: true
|
|
63
|
-
},
|
|
64
|
-
manifest: {
|
|
65
|
-
alias: 'm',
|
|
66
|
-
describe: 'Validate snap.manifest.json',
|
|
67
|
-
type: 'boolean',
|
|
68
|
-
deprecated: true
|
|
69
|
-
},
|
|
70
|
-
port: {
|
|
71
|
-
alias: 'p',
|
|
72
|
-
describe: 'Local server port for testing',
|
|
73
|
-
type: 'number',
|
|
74
|
-
coerce: (arg)=>{
|
|
75
|
-
const port = Number.parseInt(String(arg), 10);
|
|
76
|
-
if (Number.isNaN(port)) {
|
|
77
|
-
throw new Error(`Invalid port: "${String(arg)}".`);
|
|
78
|
-
}
|
|
79
|
-
return port;
|
|
80
|
-
},
|
|
81
|
-
deprecated: true
|
|
82
|
-
},
|
|
83
|
-
outfileName: {
|
|
84
|
-
alias: 'n',
|
|
85
|
-
describe: 'Output file name',
|
|
86
|
-
type: 'string',
|
|
87
|
-
deprecated: true
|
|
88
|
-
},
|
|
89
|
-
root: {
|
|
90
|
-
alias: 'r',
|
|
91
|
-
describe: 'Server root directory',
|
|
92
|
-
type: 'string',
|
|
93
|
-
normalize: true,
|
|
94
|
-
deprecated: true
|
|
95
|
-
},
|
|
96
|
-
sourceMaps: {
|
|
97
|
-
describe: 'Whether builds include sourcemaps',
|
|
98
|
-
type: 'boolean',
|
|
99
|
-
deprecated: true
|
|
100
|
-
},
|
|
101
|
-
src: {
|
|
102
|
-
alias: 's',
|
|
103
|
-
describe: 'Source file',
|
|
104
|
-
type: 'string',
|
|
105
|
-
normalize: true,
|
|
106
|
-
deprecated: true
|
|
107
|
-
},
|
|
108
|
-
stripComments: {
|
|
109
|
-
alias: 'strip',
|
|
110
|
-
describe: 'Whether to remove code comments from the build output',
|
|
111
|
-
type: 'boolean',
|
|
112
|
-
deprecated: true
|
|
113
|
-
},
|
|
114
|
-
suppressWarnings: {
|
|
115
|
-
type: 'boolean',
|
|
116
|
-
describe: 'Whether to suppress warnings',
|
|
117
|
-
deprecated: true
|
|
118
|
-
},
|
|
119
|
-
transpilationMode: {
|
|
120
|
-
type: 'string',
|
|
121
|
-
describe: 'Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing',
|
|
122
|
-
choices: Object.values(TranspilationModes),
|
|
123
|
-
deprecated: true
|
|
124
|
-
},
|
|
125
|
-
depsToTranspile: {
|
|
126
|
-
type: 'array',
|
|
127
|
-
describe: 'Transpile only the listed dependencies.',
|
|
128
|
-
deprecated: true
|
|
129
|
-
},
|
|
130
|
-
verboseErrors: {
|
|
131
|
-
type: 'boolean',
|
|
132
|
-
describe: 'Display original errors',
|
|
133
|
-
deprecated: true
|
|
134
|
-
},
|
|
135
|
-
writeManifest: {
|
|
136
|
-
describe: 'Make necessary changes to the snap manifest file',
|
|
137
|
-
type: 'boolean',
|
|
138
|
-
deprecated: true
|
|
139
|
-
},
|
|
140
|
-
serve: {
|
|
141
|
-
describe: 'Serve snap file(s) locally for testing',
|
|
142
|
-
type: 'boolean',
|
|
143
|
-
deprecated: true
|
|
144
|
-
}
|
|
145
|
-
};
|
|
146
|
-
const _default = builders;
|
|
147
|
-
|
|
148
|
-
//# sourceMappingURL=builders.js.map
|
package/dist/cjs/builders.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/builders.ts"],"sourcesContent":["import type { Options } from 'yargs';\n\nexport enum TranspilationModes {\n LocalAndDeps = 'localAndDeps',\n LocalOnly = 'localOnly',\n None = 'none',\n}\n\nconst builders: Record<string, Readonly<Options>> = {\n // eslint-disable-next-line @typescript-eslint/naming-convention\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 // Deprecated Browserify options.\n bundle: {\n alias: 'b',\n describe: 'Snap bundle file',\n type: 'string',\n normalize: true,\n deprecated: 'Use --input instead.',\n },\n\n dist: {\n alias: 'd',\n describe: 'Output directory',\n type: 'string',\n normalize: true,\n deprecated: true,\n },\n\n eval: {\n alias: 'e',\n describe: 'Attempt to evaluate Snap bundle in SES',\n type: 'boolean',\n deprecated: true,\n },\n\n manifest: {\n alias: 'm',\n describe: 'Validate snap.manifest.json',\n type: 'boolean',\n deprecated: 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 deprecated: true,\n },\n\n outfileName: {\n alias: 'n',\n describe: 'Output file name',\n type: 'string',\n deprecated: true,\n },\n\n root: {\n alias: 'r',\n describe: 'Server root directory',\n type: 'string',\n normalize: true,\n deprecated: true,\n },\n\n sourceMaps: {\n describe: 'Whether builds include sourcemaps',\n type: 'boolean',\n deprecated: true,\n },\n\n src: {\n alias: 's',\n describe: 'Source file',\n type: 'string',\n normalize: true,\n deprecated: true,\n },\n\n stripComments: {\n alias: 'strip',\n describe: 'Whether to remove code comments from the build output',\n type: 'boolean',\n deprecated: true,\n },\n\n suppressWarnings: {\n type: 'boolean',\n describe: 'Whether to suppress warnings',\n deprecated: true,\n },\n\n transpilationMode: {\n type: 'string',\n describe:\n 'Whether to use Babel to transpile all source code (including dependencies), local source code only, or nothing',\n choices: Object.values(TranspilationModes),\n deprecated: true,\n },\n\n depsToTranspile: {\n type: 'array',\n describe: 'Transpile only the listed dependencies.',\n deprecated: true,\n },\n\n verboseErrors: {\n type: 'boolean',\n describe: 'Display original errors',\n deprecated: true,\n },\n\n writeManifest: {\n describe: 'Make necessary changes to the snap manifest file',\n type: 'boolean',\n deprecated: true,\n },\n\n serve: {\n describe: 'Serve snap file(s) locally for testing',\n type: 'boolean',\n deprecated: true,\n },\n};\n\nexport default builders;\n"],"names":["TranspilationModes","LocalAndDeps","LocalOnly","None","builders","config","alias","describe","type","normalize","fix","input","bundle","deprecated","dist","eval","manifest","port","coerce","arg","Number","parseInt","String","isNaN","Error","outfileName","root","sourceMaps","src","stripComments","suppressWarnings","transpilationMode","choices","Object","values","depsToTranspile","verboseErrors","writeManifest","serve"],"mappings":";;;;;;;;;;;;;;IAsJA,OAAwB;eAAxB;;;IApJO;UAAKA,kBAAkB;IAAlBA,mBACVC,kBAAe;IADLD,mBAEVE,eAAY;IAFFF,mBAGVG,UAAO;GAHGH,uBAAAA;AAMZ,MAAMI,WAA8C;IAClD,gEAAgE;IAChEC,QAAQ;QACNC,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;IACb;IAEAC,KAAK;QACHH,UAAU;QACVC,MAAM;IACR;IAEAG,OAAO;QACLL,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;IACb;IAEA,iCAAiC;IACjCG,QAAQ;QACNN,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;QACXI,YAAY;IACd;IAEAC,MAAM;QACJR,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;QACXI,YAAY;IACd;IAEAE,MAAM;QACJT,OAAO;QACPC,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAG,UAAU;QACRV,OAAO;QACPC,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAI,MAAM;QACJX,OAAO;QACPC,UAAU;QACVC,MAAM;QACNU,QAAQ,CAACC;YACP,MAAMF,OAAOG,OAAOC,QAAQ,CAACC,OAAOH,MAAM;YAC1C,IAAIC,OAAOG,KAAK,CAACN,OAAO;gBACtB,MAAM,IAAIO,MAAM,CAAC,eAAe,EAAEF,OAAOH,KAAK,EAAE,CAAC;YACnD;YAEA,OAAOF;QACT;QACAJ,YAAY;IACd;IAEAY,aAAa;QACXnB,OAAO;QACPC,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAa,MAAM;QACJpB,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;QACXI,YAAY;IACd;IAEAc,YAAY;QACVpB,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAe,KAAK;QACHtB,OAAO;QACPC,UAAU;QACVC,MAAM;QACNC,WAAW;QACXI,YAAY;IACd;IAEAgB,eAAe;QACbvB,OAAO;QACPC,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAiB,kBAAkB;QAChBtB,MAAM;QACND,UAAU;QACVM,YAAY;IACd;IAEAkB,mBAAmB;QACjBvB,MAAM;QACND,UACE;QACFyB,SAASC,OAAOC,MAAM,CAAClC;QACvBa,YAAY;IACd;IAEAsB,iBAAiB;QACf3B,MAAM;QACND,UAAU;QACVM,YAAY;IACd;IAEAuB,eAAe;QACb5B,MAAM;QACND,UAAU;QACVM,YAAY;IACd;IAEAwB,eAAe;QACb9B,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;IAEAyB,OAAO;QACL/B,UAAU;QACVC,MAAM;QACNK,YAAY;IACd;AACF;MAEA,WAAeT"}
|
package/dist/cjs/cli.js
DELETED
|
@@ -1,35 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "cli", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return cli;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _yargs = /*#__PURE__*/ _interop_require_default(require("yargs"));
|
|
12
|
-
const _helpers = require("yargs/helpers");
|
|
13
|
-
const _builders = /*#__PURE__*/ _interop_require_default(require("./builders"));
|
|
14
|
-
const _config = require("./config");
|
|
15
|
-
const _utils = require("./utils");
|
|
16
|
-
function _interop_require_default(obj) {
|
|
17
|
-
return obj && obj.__esModule ? obj : {
|
|
18
|
-
default: obj
|
|
19
|
-
};
|
|
20
|
-
}
|
|
21
|
-
async function cli(argv, commands) {
|
|
22
|
-
await (0, _yargs.default)((0, _helpers.hideBin)(argv)).scriptName('mm-snap').usage('Usage: $0 <command> [options]').example('$0 build', `Build './src/index.js' as './dist/bundle.js'`).example('$0 build --config ./snap.config.build.ts', `Build './src/index.js' as './dist/bundle.js' using the config in './snap.config.build.ts'`).example('$0 manifest --fix', `Check the snap manifest, and fix any errors`).example('$0 watch --port 8000', `The snap input file for changes, and serve it on port 8000`).example('$0 serve --port 8000', `Serve the snap bundle on port 8000`).command(commands).option('config', _builders.default.config).option('verboseErrors', _builders.default.verboseErrors).option('suppressWarnings', _builders.default.suppressWarnings).strict().middleware(async (args)=>{
|
|
23
|
-
// eslint-disable-next-line require-atomic-updates
|
|
24
|
-
args.context = {
|
|
25
|
-
config: await (0, _config.getConfigByArgv)(args)
|
|
26
|
-
};
|
|
27
|
-
(0, _utils.sanitizeInputs)(args);
|
|
28
|
-
}, false).demandCommand(1, 'You must specify at least one command.').fail((message, failure)=>{
|
|
29
|
-
(0, _utils.error)((0, _utils.getYargsErrorMessage)(message, failure));
|
|
30
|
-
// eslint-disable-next-line n/no-process-exit
|
|
31
|
-
process.exit(1);
|
|
32
|
-
}).help().alias('help', 'h').parseAsync();
|
|
33
|
-
}
|
|
34
|
-
|
|
35
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/cjs/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../src/cli.ts"],"sourcesContent":["import yargs from 'yargs';\nimport { hideBin } from 'yargs/helpers';\n\nimport builders from './builders';\nimport { getConfigByArgv } from './config';\nimport { error, getYargsErrorMessage, sanitizeInputs } from './utils';\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 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 .option('verboseErrors', builders.verboseErrors)\n .option('suppressWarnings', builders.suppressWarnings)\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 // eslint-disable-next-line n/no-process-exit\n process.exit(1);\n })\n\n .help()\n .alias('help', 'h')\n .parseAsync();\n}\n"],"names":["cli","argv","commands","yargs","hideBin","scriptName","usage","example","command","option","builders","config","verboseErrors","suppressWarnings","strict","middleware","args","context","getConfigByArgv","sanitizeInputs","demandCommand","fail","message","failure","error","getYargsErrorMessage","process","exit","help","alias","parseAsync"],"mappings":";;;;+BAcsBA;;;eAAAA;;;8DAdJ;yBACM;iEAEH;wBACW;uBAC4B;;;;;;AASrD,eAAeA,IAAIC,IAAc,EAAEC,QAAa;IACrD,MAAMC,IAAAA,cAAK,EAACC,IAAAA,gBAAO,EAACH,OACjBI,UAAU,CAAC,WACXC,KAAK,CAAC,iCAENC,OAAO,CAAC,YAAY,CAAC,4CAA4C,CAAC,EAClEA,OAAO,CACN,4CACA,CAAC,yFAAyF,CAAC,EAE5FA,OAAO,CAAC,qBAAqB,CAAC,2CAA2C,CAAC,EAC1EA,OAAO,CACN,wBACA,CAAC,0DAA0D,CAAC,EAE7DA,OAAO,CAAC,wBAAwB,CAAC,kCAAkC,CAAC,EAEpEC,OAAO,CAACN,UAERO,MAAM,CAAC,UAAUC,iBAAQ,CAACC,MAAM,EAChCF,MAAM,CAAC,iBAAiBC,iBAAQ,CAACE,aAAa,EAC9CH,MAAM,CAAC,oBAAoBC,iBAAQ,CAACG,gBAAgB,EAEpDC,MAAM,GAENC,UAAU,CAAC,OAAOC;QACjB,kDAAkD;QAClDA,KAAKC,OAAO,GAAG;YACbN,QAAQ,MAAMO,IAAAA,uBAAe,EAACF;QAChC;QAEAG,IAAAA,qBAAc,EAACH;IACjB,GAAG,OAEFI,aAAa,CAAC,GAAG,0CAEjBC,IAAI,CAAC,CAACC,SAASC;QACdC,IAAAA,YAAK,EAACC,IAAAA,2BAAoB,EAACH,SAASC;QACpC,6CAA6C;QAC7CG,QAAQC,IAAI,CAAC;IACf,GAECC,IAAI,GACJC,KAAK,CAAC,QAAQ,KACdC,UAAU;AACf"}
|
|
@@ -1,54 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "buildHandler", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return buildHandler;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _snapsutils = require("@metamask/snaps-utils");
|
|
12
|
-
const _path = require("path");
|
|
13
|
-
const _errors = require("../../errors");
|
|
14
|
-
const _utils = require("../../utils");
|
|
15
|
-
const _eval = require("../eval");
|
|
16
|
-
const _implementation = require("./implementation");
|
|
17
|
-
const steps = [
|
|
18
|
-
{
|
|
19
|
-
name: 'Checking the input file.',
|
|
20
|
-
task: async ({ config })=>{
|
|
21
|
-
const { input } = config;
|
|
22
|
-
if (!await (0, _snapsutils.isFile)(input)) {
|
|
23
|
-
throw new _errors.CommandError(`Input file not found: "${input}". Make sure that the "input" field in your snap config is correct.`);
|
|
24
|
-
}
|
|
25
|
-
}
|
|
26
|
-
},
|
|
27
|
-
{
|
|
28
|
-
name: 'Building the snap bundle.',
|
|
29
|
-
task: async ({ config, spinner })=>{
|
|
30
|
-
// We don't evaluate the bundle here, because it's done in a separate
|
|
31
|
-
// step.
|
|
32
|
-
return await (0, _implementation.build)(config, {
|
|
33
|
-
evaluate: false,
|
|
34
|
-
spinner
|
|
35
|
-
});
|
|
36
|
-
}
|
|
37
|
-
},
|
|
38
|
-
{
|
|
39
|
-
name: 'Evaluating the snap bundle.',
|
|
40
|
-
condition: ({ config })=>config.evaluate,
|
|
41
|
-
task: async ({ config, spinner })=>{
|
|
42
|
-
const path = (0, _path.resolve)(process.cwd(), config.output.path, config.output.filename);
|
|
43
|
-
await (0, _eval.evaluate)(path);
|
|
44
|
-
(0, _utils.info)(`Snap bundle evaluated successfully.`, spinner);
|
|
45
|
-
}
|
|
46
|
-
}
|
|
47
|
-
];
|
|
48
|
-
async function buildHandler(config) {
|
|
49
|
-
return await (0, _utils.executeSteps)(steps, {
|
|
50
|
-
config
|
|
51
|
-
});
|
|
52
|
-
}
|
|
53
|
-
|
|
54
|
-
//# sourceMappingURL=build.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/build/build.ts"],"sourcesContent":["import { isFile } from '@metamask/snaps-utils';\nimport { resolve as pathResolve } from 'path';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { evaluate } from '../eval';\nimport { build } from './implementation';\n\ntype BuildContext = {\n config: ProcessedWebpackConfig;\n};\n\nconst steps: Steps<BuildContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n // We don't evaluate the bundle here, because it's done in a separate\n // step.\n return await build(config, { evaluate: false, spinner });\n },\n },\n {\n name: 'Evaluating the snap bundle.',\n condition: ({ config }) => config.evaluate,\n task: async ({ config, spinner }) => {\n const path = pathResolve(\n process.cwd(),\n config.output.path,\n config.output.filename,\n );\n\n await evaluate(path);\n\n info(`Snap bundle evaluated successfully.`, spinner);\n },\n },\n] 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 */\nexport async function buildHandler(config: ProcessedConfig): Promise<void> {\n return await executeSteps(steps, {\n config,\n });\n}\n"],"names":["buildHandler","steps","name","task","config","input","isFile","CommandError","spinner","build","evaluate","condition","path","pathResolve","process","cwd","output","filename","info","executeSteps"],"mappings":";;;;+BA4DsBA;;;eAAAA;;;4BA5DC;sBACgB;wBAGV;uBAEM;sBACV;gCACH;AAMtB,MAAMC,QAA6B;IACjC;QACEC,MAAM;QACNC,MAAM,OAAO,EAAEC,MAAM,EAAE;YACrB,MAAM,EAAEC,KAAK,EAAE,GAAGD;YAElB,IAAI,CAAE,MAAME,IAAAA,kBAAM,EAACD,QAAS;gBAC1B,MAAM,IAAIE,oBAAY,CACpB,CAAC,uBAAuB,EAAEF,MAAM,mEAAmE,CAAC;YAExG;QACF;IACF;IACA;QACEH,MAAM;QACNC,MAAM,OAAO,EAAEC,MAAM,EAAEI,OAAO,EAAE;YAC9B,qEAAqE;YACrE,QAAQ;YACR,OAAO,MAAMC,IAAAA,qBAAK,EAACL,QAAQ;gBAAEM,UAAU;gBAAOF;YAAQ;QACxD;IACF;IACA;QACEN,MAAM;QACNS,WAAW,CAAC,EAAEP,MAAM,EAAE,GAAKA,OAAOM,QAAQ;QAC1CP,MAAM,OAAO,EAAEC,MAAM,EAAEI,OAAO,EAAE;YAC9B,MAAMI,OAAOC,IAAAA,aAAW,EACtBC,QAAQC,GAAG,IACXX,OAAOY,MAAM,CAACJ,IAAI,EAClBR,OAAOY,MAAM,CAACC,QAAQ;YAGxB,MAAMP,IAAAA,cAAQ,EAACE;YAEfM,IAAAA,WAAI,EAAC,CAAC,mCAAmC,CAAC,EAAEV;QAC9C;IACF;CACD;AAUM,eAAeR,aAAaI,MAAuB;IACxD,OAAO,MAAMe,IAAAA,mBAAY,EAAClB,OAAO;QAC/BG;IACF;AACF"}
|
|
@@ -1,31 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "build", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return build;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _webpack = require("../../webpack");
|
|
12
|
-
async function build(config, options) {
|
|
13
|
-
const compiler = await (0, _webpack.getCompiler)(config, options);
|
|
14
|
-
return await new Promise((resolve, reject)=>{
|
|
15
|
-
compiler.run((runError)=>{
|
|
16
|
-
if (runError) {
|
|
17
|
-
reject(runError);
|
|
18
|
-
return;
|
|
19
|
-
}
|
|
20
|
-
compiler.close((closeError)=>{
|
|
21
|
-
if (closeError) {
|
|
22
|
-
reject(closeError);
|
|
23
|
-
return;
|
|
24
|
-
}
|
|
25
|
-
resolve();
|
|
26
|
-
});
|
|
27
|
-
});
|
|
28
|
-
});
|
|
29
|
-
}
|
|
30
|
-
|
|
31
|
-
//# sourceMappingURL=implementation.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"sources":["../../../../src/commands/build/implementation.ts"],"sourcesContent":["import type { ProcessedWebpackConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle. This uses Webpack to build the bundle.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns A promise that resolves when the bundle is built.\n */\nexport async function build(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, options);\n return await new Promise<void>((resolve, reject) => {\n compiler.run((runError) => {\n if (runError) {\n reject(runError);\n return;\n }\n\n compiler.close((closeError) => {\n if (closeError) {\n reject(closeError);\n return;\n }\n\n resolve();\n });\n });\n });\n}\n"],"names":["build","config","options","compiler","getCompiler","Promise","resolve","reject","run","runError","close","closeError"],"mappings":";;;;+BAWsBA;;;eAAAA;;;yBATM;AASrB,eAAeA,MACpBC,MAA8B,EAC9BC,OAAwB;IAExB,MAAMC,WAAW,MAAMC,IAAAA,oBAAW,EAACH,QAAQC;IAC3C,OAAO,MAAM,IAAIG,QAAc,CAACC,SAASC;QACvCJ,SAASK,GAAG,CAAC,CAACC;YACZ,IAAIA,UAAU;gBACZF,OAAOE;gBACP;YACF;YAEAN,SAASO,KAAK,CAAC,CAACC;gBACd,IAAIA,YAAY;oBACdJ,OAAOI;oBACP;gBACF;gBAEAL;YACF;QACF;IACF;AACF"}
|
|
@@ -1,45 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", {
|
|
3
|
-
value: true
|
|
4
|
-
});
|
|
5
|
-
Object.defineProperty(exports, "default", {
|
|
6
|
-
enumerable: true,
|
|
7
|
-
get: function() {
|
|
8
|
-
return _default;
|
|
9
|
-
}
|
|
10
|
-
});
|
|
11
|
-
const _builders = /*#__PURE__*/ _interop_require_default(require("../../builders"));
|
|
12
|
-
const _build = require("./build");
|
|
13
|
-
_export_star(require("./implementation"), exports);
|
|
14
|
-
function _export_star(from, to) {
|
|
15
|
-
Object.keys(from).forEach(function(k) {
|
|
16
|
-
if (k !== "default" && !Object.prototype.hasOwnProperty.call(to, k)) {
|
|
17
|
-
Object.defineProperty(to, k, {
|
|
18
|
-
enumerable: true,
|
|
19
|
-
get: function() {
|
|
20
|
-
return from[k];
|
|
21
|
-
}
|
|
22
|
-
});
|
|
23
|
-
}
|
|
24
|
-
});
|
|
25
|
-
return from;
|
|
26
|
-
}
|
|
27
|
-
function _interop_require_default(obj) {
|
|
28
|
-
return obj && obj.__esModule ? obj : {
|
|
29
|
-
default: obj
|
|
30
|
-
};
|
|
31
|
-
}
|
|
32
|
-
const command = {
|
|
33
|
-
command: [
|
|
34
|
-
'build',
|
|
35
|
-
'b'
|
|
36
|
-
],
|
|
37
|
-
desc: 'Build snap from source',
|
|
38
|
-
builder: (yarg)=>{
|
|
39
|
-
yarg.option('dist', _builders.default.dist).option('eval', _builders.default.eval).option('manifest', _builders.default.manifest).option('outfileName', _builders.default.outfileName).option('sourceMaps', _builders.default.sourceMaps).option('src', _builders.default.src).option('stripComments', _builders.default.stripComments).option('transpilationMode', _builders.default.transpilationMode).option('depsToTranspile', _builders.default.depsToTranspile).option('writeManifest', _builders.default.writeManifest).implies('writeManifest', 'manifest').implies('depsToTranspile', 'transpilationMode');
|
|
40
|
-
},
|
|
41
|
-
handler: async (argv)=>(0, _build.buildHandler)(argv.context.config)
|
|
42
|
-
};
|
|
43
|
-
const _default = command;
|
|
44
|
-
|
|
45
|
-
//# sourceMappingURL=index.js.map
|