@metamask/snaps-cli 1.0.2 → 2.0.1
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/.browserslistrc +3 -0
- package/CHANGELOG.md +35 -375
- package/README.md +548 -69
- package/dist/cjs/builders.js +148 -0
- package/dist/cjs/builders.js.map +1 -0
- package/dist/cjs/cli.js +35 -0
- package/dist/cjs/cli.js.map +1 -0
- package/dist/cjs/commands/build/build.js +54 -0
- package/dist/cjs/commands/build/build.js.map +1 -0
- package/dist/cjs/commands/build/implementation.js +31 -0
- package/dist/cjs/commands/build/implementation.js.map +1 -0
- package/dist/cjs/commands/build/index.js +45 -0
- package/dist/cjs/commands/build/index.js.map +1 -0
- package/dist/cjs/commands/eval/eval.js +57 -0
- package/dist/cjs/commands/eval/eval.js.map +1 -0
- package/dist/cjs/commands/eval/implementation.js +27 -0
- package/dist/cjs/commands/eval/implementation.js.map +1 -0
- package/dist/cjs/commands/eval/index.js +50 -0
- package/dist/cjs/commands/eval/index.js.map +1 -0
- package/dist/cjs/commands/index.js +30 -0
- package/dist/cjs/commands/index.js.map +1 -0
- package/dist/cjs/commands/manifest/implementation.js +34 -0
- package/dist/cjs/commands/manifest/implementation.js.map +1 -0
- package/dist/cjs/commands/manifest/index.js +50 -0
- package/dist/cjs/commands/manifest/index.js.map +1 -0
- package/dist/cjs/commands/manifest/manifest.js +55 -0
- package/dist/cjs/commands/manifest/manifest.js.map +1 -0
- package/dist/cjs/commands/serve/index.js +33 -0
- package/dist/cjs/commands/serve/index.js.map +1 -0
- package/dist/cjs/commands/serve/serve.js +21 -0
- package/dist/cjs/commands/serve/serve.js.map +1 -0
- package/dist/cjs/commands/watch/implementation.js +35 -0
- package/dist/cjs/commands/watch/implementation.js.map +1 -0
- package/dist/cjs/commands/watch/index.js +47 -0
- package/dist/cjs/commands/watch/index.js.map +1 -0
- package/dist/cjs/commands/watch/watch.js +51 -0
- package/dist/cjs/commands/watch/watch.js.map +1 -0
- package/dist/cjs/config.js +323 -0
- package/dist/cjs/config.js.map +1 -0
- package/dist/cjs/errors.js +37 -0
- package/dist/cjs/errors.js.map +1 -0
- package/dist/cjs/index.js +77 -0
- package/dist/cjs/index.js.map +1 -0
- package/dist/cjs/main.js +19 -0
- package/dist/cjs/main.js.map +1 -0
- package/dist/cjs/utils/cli.js +61 -0
- package/dist/cjs/utils/cli.js.map +1 -0
- package/dist/cjs/utils/errors.js +42 -0
- package/dist/cjs/utils/errors.js.map +1 -0
- package/dist/cjs/utils/index.js +25 -0
- package/dist/cjs/utils/index.js.map +1 -0
- package/dist/cjs/utils/legacy.js +48 -0
- package/dist/cjs/utils/legacy.js.map +1 -0
- package/dist/cjs/utils/logging.js +46 -0
- package/dist/cjs/utils/logging.js.map +1 -0
- package/dist/cjs/utils/path.js +16 -0
- package/dist/cjs/utils/path.js.map +1 -0
- package/dist/cjs/utils/steps.js +52 -0
- package/dist/cjs/utils/steps.js.map +1 -0
- package/dist/cjs/webpack/compiler.js +96 -0
- package/dist/cjs/webpack/compiler.js.map +1 -0
- package/dist/cjs/webpack/config.js +250 -0
- package/dist/cjs/webpack/config.js.map +1 -0
- package/dist/cjs/webpack/index.js +22 -0
- package/dist/cjs/webpack/index.js.map +1 -0
- package/dist/cjs/webpack/loaders/browserify.js +97 -0
- package/dist/cjs/webpack/loaders/browserify.js.map +1 -0
- package/dist/cjs/webpack/loaders/wasm.js +36 -0
- package/dist/cjs/webpack/loaders/wasm.js.map +1 -0
- package/dist/cjs/webpack/plugins.js +340 -0
- package/dist/cjs/webpack/plugins.js.map +1 -0
- package/dist/cjs/webpack/utils.js +181 -0
- package/dist/cjs/webpack/utils.js.map +1 -0
- package/dist/{builders.js → esm/builders.js} +48 -51
- package/dist/esm/builders.js.map +1 -0
- package/dist/esm/cli.js +26 -0
- package/dist/esm/cli.js.map +1 -0
- package/dist/esm/commands/build/build.js +51 -0
- package/dist/esm/commands/build/build.js.map +1 -0
- package/dist/esm/commands/build/implementation.js +27 -0
- package/dist/esm/commands/build/implementation.js.map +1 -0
- package/dist/esm/commands/build/index.js +17 -0
- package/dist/esm/commands/build/index.js.map +1 -0
- package/dist/esm/commands/eval/eval.js +54 -0
- package/dist/esm/commands/eval/eval.js.map +1 -0
- package/dist/esm/commands/eval/implementation.js +24 -0
- package/dist/esm/commands/eval/implementation.js.map +1 -0
- package/dist/esm/commands/eval/index.js +22 -0
- package/dist/esm/commands/eval/index.js.map +1 -0
- package/dist/esm/commands/index.js +15 -0
- package/dist/esm/commands/index.js.map +1 -0
- package/dist/esm/commands/manifest/implementation.js +33 -0
- package/dist/esm/commands/manifest/implementation.js.map +1 -0
- package/dist/esm/commands/manifest/index.js +22 -0
- package/dist/esm/commands/manifest/index.js.map +1 -0
- package/dist/esm/commands/manifest/manifest.js +52 -0
- package/dist/esm/commands/manifest/manifest.js.map +1 -0
- package/dist/esm/commands/serve/index.js +18 -0
- package/dist/esm/commands/serve/index.js.map +1 -0
- package/dist/esm/commands/serve/serve.js +17 -0
- package/dist/esm/commands/serve/serve.js.map +1 -0
- package/dist/esm/commands/watch/implementation.js +34 -0
- package/dist/esm/commands/watch/implementation.js.map +1 -0
- package/dist/esm/commands/watch/index.js +19 -0
- package/dist/esm/commands/watch/index.js.map +1 -0
- package/dist/esm/commands/watch/watch.js +50 -0
- package/dist/esm/commands/watch/watch.js.map +1 -0
- package/dist/esm/config.js +327 -0
- package/dist/esm/config.js.map +1 -0
- package/dist/esm/errors.js +30 -0
- package/dist/esm/errors.js.map +1 -0
- package/dist/esm/index.js +6 -0
- package/dist/esm/index.js.map +1 -0
- package/dist/esm/main.js +10 -0
- package/dist/esm/main.js.map +1 -0
- package/dist/esm/utils/cli.js +43 -0
- package/dist/esm/utils/cli.js.map +1 -0
- package/dist/esm/utils/errors.js +43 -0
- package/dist/esm/utils/errors.js.map +1 -0
- package/dist/esm/utils/index.js +8 -0
- package/dist/esm/utils/index.js.map +1 -0
- package/dist/esm/utils/legacy.js +47 -0
- package/dist/esm/utils/legacy.js.map +1 -0
- package/dist/esm/utils/logging.js +40 -0
- package/dist/esm/utils/logging.js.map +1 -0
- package/dist/esm/utils/path.js +13 -0
- package/dist/esm/utils/path.js.map +1 -0
- package/dist/esm/utils/steps.js +43 -0
- package/dist/esm/utils/steps.js.map +1 -0
- package/dist/esm/webpack/compiler.js +89 -0
- package/dist/esm/webpack/compiler.js.map +1 -0
- package/dist/esm/webpack/config.js +252 -0
- package/dist/esm/webpack/config.js.map +1 -0
- package/dist/esm/webpack/index.js +5 -0
- package/dist/esm/webpack/index.js.map +1 -0
- package/dist/esm/webpack/loaders/browserify.js +82 -0
- package/dist/esm/webpack/loaders/browserify.js.map +1 -0
- package/dist/esm/webpack/loaders/wasm.js +26 -0
- package/dist/esm/webpack/loaders/wasm.js.map +1 -0
- package/dist/esm/webpack/plugins.js +343 -0
- package/dist/esm/webpack/plugins.js.map +1 -0
- package/dist/esm/webpack/utils.js +208 -0
- package/dist/esm/webpack/utils.js.map +1 -0
- package/dist/types/__fixtures__/configs/cjs.d.ts +1 -0
- package/dist/types/__fixtures__/configs/esm.d.ts +3 -0
- package/dist/types/__fixtures__/configs/invalid.d.ts +3 -0
- package/dist/types/__fixtures__/configs/javascript/snap.config.d.ts +0 -0
- package/dist/types/__fixtures__/configs/typescript/snap.config.d.ts +3 -0
- package/dist/types/builders.d.ts +8 -0
- package/dist/{cli.d.ts → types/cli.d.ts} +1 -1
- package/dist/types/commands/build/build.d.ts +10 -0
- package/dist/types/commands/build/implementation.d.ts +10 -0
- package/dist/types/commands/build/index.d.ts +10 -0
- package/dist/types/commands/eval/__test__/browserify/bad/snap.config.d.ts +3 -0
- package/dist/types/commands/eval/__test__/browserify/good/snap.config.d.ts +3 -0
- package/dist/types/commands/eval/__test__/webpack/bad/snap.config.d.ts +3 -0
- package/dist/types/commands/eval/__test__/webpack/good/snap.config.d.ts +3 -0
- package/dist/types/commands/eval/__test__/webpack/snap.config.d.ts +3 -0
- package/dist/types/commands/eval/eval.d.ts +14 -0
- package/dist/types/commands/eval/implementation.d.ts +9 -0
- package/dist/types/commands/eval/index.d.ts +10 -0
- package/dist/types/commands/manifest/implementation.d.ts +12 -0
- package/dist/types/commands/manifest/index.d.ts +10 -0
- package/dist/types/commands/manifest/manifest.d.ts +14 -0
- package/dist/{cmds/build → types/commands/serve}/index.d.ts +4 -4
- package/dist/types/commands/serve/serve.d.ts +16 -0
- package/dist/types/commands/watch/implementation.d.ts +14 -0
- package/dist/types/commands/watch/index.d.ts +10 -0
- package/dist/types/commands/watch/watch.d.ts +19 -0
- package/dist/types/config.d.ts +792 -0
- package/dist/types/errors.d.ts +25 -0
- package/dist/types/index.d.ts +5 -0
- package/dist/types/utils/cli.d.ts +17 -0
- package/dist/types/utils/errors.d.ts +23 -0
- package/dist/types/utils/index.d.ts +6 -0
- package/dist/types/utils/legacy.d.ts +27 -0
- package/dist/types/utils/logging.d.ts +22 -0
- package/dist/types/utils/path.d.ts +9 -0
- package/dist/types/utils/steps.d.ts +17 -0
- package/dist/types/webpack/compiler.d.ts +29 -0
- package/dist/types/webpack/config.d.ts +37 -0
- package/dist/types/webpack/index.d.ts +3 -0
- package/dist/types/webpack/loaders/browserify.d.ts +16 -0
- package/dist/types/webpack/loaders/wasm.d.ts +20 -0
- package/dist/types/webpack/plugins.d.ts +147 -0
- package/dist/types/webpack/utils.d.ts +188 -0
- package/package.json +83 -43
- package/dist/builders.d.ts +0 -27
- package/dist/builders.js.map +0 -1
- package/dist/cli.js +0 -51
- package/dist/cli.js.map +0 -1
- package/dist/cmds/build/buildHandler.d.ts +0 -13
- package/dist/cmds/build/buildHandler.js +0 -37
- package/dist/cmds/build/buildHandler.js.map +0 -1
- package/dist/cmds/build/bundle.d.ts +0 -15
- package/dist/cmds/build/bundle.js +0 -80
- package/dist/cmds/build/bundle.js.map +0 -1
- package/dist/cmds/build/index.js +0 -29
- package/dist/cmds/build/index.js.map +0 -1
- package/dist/cmds/build/utils.d.ts +0 -56
- package/dist/cmds/build/utils.js +0 -100
- package/dist/cmds/build/utils.js.map +0 -1
- package/dist/cmds/eval/evalHandler.d.ts +0 -9
- package/dist/cmds/eval/evalHandler.js +0 -25
- package/dist/cmds/eval/evalHandler.js.map +0 -1
- package/dist/cmds/eval/index.d.ts +0 -9
- package/dist/cmds/eval/index.js +0 -15
- package/dist/cmds/eval/index.js.map +0 -1
- package/dist/cmds/index.js +0 -14
- package/dist/cmds/index.js.map +0 -1
- package/dist/cmds/init/index.d.ts +0 -9
- package/dist/cmds/init/index.js +0 -34
- package/dist/cmds/init/index.js.map +0 -1
- package/dist/cmds/init/initHandler.d.ts +0 -26
- package/dist/cmds/init/initHandler.js +0 -69
- package/dist/cmds/init/initHandler.js.map +0 -1
- package/dist/cmds/init/initUtils.d.ts +0 -39
- package/dist/cmds/init/initUtils.js +0 -122
- package/dist/cmds/init/initUtils.js.map +0 -1
- package/dist/cmds/manifest/index.d.ts +0 -9
- package/dist/cmds/manifest/index.js +0 -24
- package/dist/cmds/manifest/index.js.map +0 -1
- package/dist/cmds/manifest/manifestHandler.d.ts +0 -10
- package/dist/cmds/manifest/manifestHandler.js +0 -50
- package/dist/cmds/manifest/manifestHandler.js.map +0 -1
- package/dist/cmds/serve/index.d.ts +0 -9
- package/dist/cmds/serve/index.js +0 -15
- package/dist/cmds/serve/index.js.map +0 -1
- package/dist/cmds/serve/serveHandler.d.ts +0 -10
- package/dist/cmds/serve/serveHandler.js +0 -59
- package/dist/cmds/serve/serveHandler.js.map +0 -1
- package/dist/cmds/serve/serveUtils.d.ts +0 -22
- package/dist/cmds/serve/serveUtils.js +0 -39
- package/dist/cmds/serve/serveUtils.js.map +0 -1
- package/dist/cmds/watch/index.d.ts +0 -9
- package/dist/cmds/watch/index.js +0 -32
- package/dist/cmds/watch/index.js.map +0 -1
- package/dist/cmds/watch/watchHandler.d.ts +0 -14
- package/dist/cmds/watch/watchHandler.js +0 -100
- package/dist/cmds/watch/watchHandler.js.map +0 -1
- package/dist/main.js +0 -15
- package/dist/main.js.map +0 -1
- package/dist/utils/index.d.ts +0 -2
- package/dist/utils/index.js +0 -19
- package/dist/utils/index.js.map +0 -1
- package/dist/utils/misc.d.ts +0 -53
- package/dist/utils/misc.js +0 -156
- package/dist/utils/misc.js.map +0 -1
- package/dist/utils/snap-config.d.ts +0 -48
- package/dist/utils/snap-config.js +0 -117
- package/dist/utils/snap-config.js.map +0 -1
- /package/dist/{cmds → types/commands}/index.d.ts +0 -0
- /package/dist/{main.d.ts → types/main.d.ts} +0 -0
package/package.json
CHANGED
|
@@ -1,98 +1,135 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "2.0.1",
|
|
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",
|
|
10
14
|
"bin": {
|
|
11
|
-
"mm-snap": "./dist/main.js"
|
|
15
|
+
"mm-snap": "./dist/cjs/main.js"
|
|
12
16
|
},
|
|
13
17
|
"files": [
|
|
14
|
-
"dist/"
|
|
18
|
+
"dist/cjs/**",
|
|
19
|
+
"dist/esm/**",
|
|
20
|
+
"dist/types/**",
|
|
21
|
+
".browserslistrc"
|
|
15
22
|
],
|
|
16
23
|
"scripts": {
|
|
17
|
-
"
|
|
18
|
-
"build:
|
|
19
|
-
"build:
|
|
20
|
-
"build:
|
|
21
|
-
"build": "
|
|
24
|
+
"build": "yarn build:source && yarn build:types",
|
|
25
|
+
"build:source": "yarn build:esm && yarn build:cjs",
|
|
26
|
+
"build:types": "tsc --project tsconfig.build.json",
|
|
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",
|
|
22
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",
|
|
31
|
+
"build:readme": "node ./scripts/updateReadme.js",
|
|
23
32
|
"build:clean": "yarn clean && yarn build",
|
|
24
33
|
"build:watch": "tsc-watch --onSuccess 'yarn build:chmod'",
|
|
25
|
-
"clean": "rimraf '*.tsbuildinfo' 'dist
|
|
34
|
+
"clean": "rimraf '*.tsbuildinfo' 'dist'",
|
|
26
35
|
"test": "jest --runInBand && yarn posttest",
|
|
27
36
|
"posttest": "jest-it-up",
|
|
28
37
|
"test:watch": "yarn test --watch",
|
|
29
38
|
"test:ci": "yarn test",
|
|
30
|
-
"lint:changelog": "
|
|
31
|
-
"lint:eslint": "eslint . --cache --ext js,ts",
|
|
32
|
-
"lint:misc": "prettier
|
|
33
|
-
"lint": "yarn lint:eslint && yarn lint:misc --check",
|
|
39
|
+
"lint:changelog": "../../scripts/validate-changelog.sh @metamask/snaps-cli",
|
|
40
|
+
"lint:eslint": "eslint . --cache --ext js,ts,jsx,tsx",
|
|
41
|
+
"lint:misc": "prettier --no-error-on-unmatched-pattern --loglevel warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
|
|
42
|
+
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn lint:changelog && yarn lint:dependencies",
|
|
34
43
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
35
44
|
"prepare-manifest:preview": "../../scripts/prepare-preview-manifest.sh",
|
|
36
45
|
"publish:preview": "yarn npm publish --tag preview",
|
|
37
|
-
"
|
|
46
|
+
"lint:ci": "yarn lint",
|
|
47
|
+
"lint:dependencies": "depcheck"
|
|
38
48
|
},
|
|
39
49
|
"dependencies": {
|
|
40
|
-
"@babel/core": "^7.
|
|
50
|
+
"@babel/core": "^7.20.12",
|
|
41
51
|
"@babel/plugin-proposal-class-properties": "^7.16.7",
|
|
42
|
-
"@babel/plugin-proposal-
|
|
43
|
-
"@babel/plugin-proposal-
|
|
44
|
-
"@babel/plugin-proposal-
|
|
52
|
+
"@babel/plugin-proposal-class-static-block": "^7.21.0",
|
|
53
|
+
"@babel/plugin-proposal-private-methods": "^7.18.6",
|
|
54
|
+
"@babel/plugin-proposal-private-property-in-object": "^7.21.0",
|
|
45
55
|
"@babel/plugin-transform-runtime": "^7.16.7",
|
|
46
|
-
"@babel/preset-env": "^7.
|
|
47
|
-
"@babel/preset-typescript": "^7.
|
|
48
|
-
"@metamask/snaps-
|
|
49
|
-
"@metamask/snaps-
|
|
50
|
-
"@metamask/utils": "^
|
|
56
|
+
"@babel/preset-env": "^7.20.12",
|
|
57
|
+
"@babel/preset-typescript": "^7.20.12",
|
|
58
|
+
"@metamask/snaps-utils": "^2.0.1",
|
|
59
|
+
"@metamask/snaps-webpack-plugin": "^2.0.0",
|
|
60
|
+
"@metamask/utils": "^8.1.0",
|
|
61
|
+
"@swc/core": "1.3.78",
|
|
62
|
+
"assert": "^2.0.0",
|
|
51
63
|
"babelify": "^10.0.0",
|
|
52
64
|
"browserify": "^17.0.0",
|
|
65
|
+
"browserify-zlib": "^0.2.0",
|
|
66
|
+
"buffer": "^6.0.3",
|
|
67
|
+
"chalk": "^4.1.2",
|
|
53
68
|
"chokidar": "^3.5.2",
|
|
54
|
-
"
|
|
69
|
+
"console-browserify": "^1.2.0",
|
|
70
|
+
"constants-browserify": "^1.0.0",
|
|
71
|
+
"crypto-browserify": "^3.12.0",
|
|
72
|
+
"domain-browser": "^4.22.0",
|
|
73
|
+
"events": "^3.3.0",
|
|
74
|
+
"https-browserify": "^1.0.0",
|
|
75
|
+
"ora": "^5.4.1",
|
|
76
|
+
"os-browserify": "^0.3.0",
|
|
77
|
+
"path-browserify": "^1.0.1",
|
|
78
|
+
"process": "^0.11.10",
|
|
79
|
+
"punycode": "^2.3.0",
|
|
80
|
+
"querystring-es3": "^0.2.1",
|
|
81
|
+
"readable-stream": "^3.6.2",
|
|
55
82
|
"serve-handler": "^6.1.5",
|
|
56
|
-
"
|
|
83
|
+
"stream-browserify": "^3.0.0",
|
|
84
|
+
"stream-http": "^3.2.0",
|
|
85
|
+
"string_decoder": "^1.3.0",
|
|
57
86
|
"superstruct": "^1.0.3",
|
|
58
|
-
"
|
|
59
|
-
"
|
|
87
|
+
"swc-loader": "^0.2.3",
|
|
88
|
+
"terser-webpack-plugin": "^5.3.9",
|
|
89
|
+
"timers-browserify": "^2.0.12",
|
|
90
|
+
"tty-browserify": "^0.0.1",
|
|
91
|
+
"url": "^0.11.1",
|
|
92
|
+
"util": "^0.12.5",
|
|
93
|
+
"vm-browserify": "^1.1.2",
|
|
94
|
+
"webpack": "^5.88.0",
|
|
95
|
+
"webpack-merge": "^5.9.0",
|
|
96
|
+
"yargs": "^17.7.1"
|
|
60
97
|
},
|
|
61
98
|
"devDependencies": {
|
|
62
|
-
"@lavamoat/allow-scripts": "^2.
|
|
99
|
+
"@lavamoat/allow-scripts": "^2.5.1",
|
|
63
100
|
"@metamask/auto-changelog": "^3.1.0",
|
|
64
|
-
"@metamask/eslint-config": "^
|
|
65
|
-
"@metamask/eslint-config-jest": "^
|
|
66
|
-
"@metamask/eslint-config-nodejs": "^
|
|
67
|
-
"@metamask/eslint-config-typescript": "^
|
|
68
|
-
"@
|
|
69
|
-
"@
|
|
101
|
+
"@metamask/eslint-config": "^12.1.0",
|
|
102
|
+
"@metamask/eslint-config-jest": "^12.1.0",
|
|
103
|
+
"@metamask/eslint-config-nodejs": "^12.1.0",
|
|
104
|
+
"@metamask/eslint-config-typescript": "^12.1.0",
|
|
105
|
+
"@swc/cli": "^0.1.62",
|
|
106
|
+
"@swc/jest": "^0.2.26",
|
|
107
|
+
"@types/browserify": "^12.0.37",
|
|
70
108
|
"@types/jest": "^27.5.1",
|
|
71
|
-
"@types/node": "
|
|
109
|
+
"@types/node": "18.14.2",
|
|
72
110
|
"@types/rimraf": "^3.0.0",
|
|
73
111
|
"@types/serve-handler": "^6.1.0",
|
|
74
|
-
"@types/yargs": "^
|
|
112
|
+
"@types/yargs": "^17.0.24",
|
|
75
113
|
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
76
114
|
"@typescript-eslint/parser": "^5.42.1",
|
|
77
|
-
"babel-jest": "^29.5.0",
|
|
78
|
-
"clet": "^1.0.1",
|
|
79
115
|
"cross-fetch": "^3.1.5",
|
|
80
116
|
"deepmerge": "^4.2.2",
|
|
117
|
+
"depcheck": "^1.4.5",
|
|
81
118
|
"eslint": "^8.27.0",
|
|
82
119
|
"eslint-config-prettier": "^8.5.0",
|
|
83
120
|
"eslint-plugin-import": "^2.26.0",
|
|
84
121
|
"eslint-plugin-jest": "^27.1.5",
|
|
85
122
|
"eslint-plugin-jsdoc": "^39.6.2",
|
|
86
|
-
"eslint-plugin-
|
|
123
|
+
"eslint-plugin-n": "^15.7.0",
|
|
87
124
|
"eslint-plugin-prettier": "^4.2.1",
|
|
125
|
+
"eslint-plugin-promise": "^6.1.1",
|
|
88
126
|
"execa": "^5.1.1",
|
|
89
127
|
"jest": "^29.0.2",
|
|
90
128
|
"jest-it-up": "^2.0.0",
|
|
91
|
-
"memfs": "^3.4.
|
|
129
|
+
"memfs": "^3.4.13",
|
|
92
130
|
"prettier": "^2.7.1",
|
|
93
131
|
"prettier-plugin-packagejson": "^2.2.11",
|
|
94
|
-
"rimraf": "^
|
|
95
|
-
"ts-jest": "^29.0.0",
|
|
132
|
+
"rimraf": "^4.1.2",
|
|
96
133
|
"ts-node": "^10.9.1",
|
|
97
134
|
"tsc-watch": "^4.5.0",
|
|
98
135
|
"typescript": "~4.8.4"
|
|
@@ -106,7 +143,10 @@
|
|
|
106
143
|
},
|
|
107
144
|
"lavamoat": {
|
|
108
145
|
"allowScripts": {
|
|
109
|
-
"@lavamoat/preinstall-always-fail": false
|
|
146
|
+
"@lavamoat/preinstall-always-fail": false,
|
|
147
|
+
"@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils>ethereumjs-util>ethereum-cryptography>keccak": false,
|
|
148
|
+
"@metamask/snaps-utils>@metamask/permission-controller>@metamask/controller-utils>ethereumjs-util>ethereum-cryptography>secp256k1": false,
|
|
149
|
+
"@swc/core": false
|
|
110
150
|
}
|
|
111
151
|
}
|
|
112
152
|
}
|
package/dist/builders.d.ts
DELETED
|
@@ -1,27 +0,0 @@
|
|
|
1
|
-
import { Options, PositionalOptions } from 'yargs';
|
|
2
|
-
export declare type SnapsCliBuilders = {
|
|
3
|
-
readonly bundle: Readonly<Options>;
|
|
4
|
-
readonly dist: Readonly<Options>;
|
|
5
|
-
readonly eval: Readonly<Options>;
|
|
6
|
-
readonly manifest: Readonly<Options>;
|
|
7
|
-
readonly outfileName: Readonly<Options>;
|
|
8
|
-
readonly port: Readonly<Options>;
|
|
9
|
-
readonly root: Readonly<Options>;
|
|
10
|
-
readonly sourceMaps: Readonly<Options>;
|
|
11
|
-
readonly src: Readonly<Options>;
|
|
12
|
-
readonly stripComments: Readonly<Options>;
|
|
13
|
-
readonly suppressWarnings: Readonly<Options>;
|
|
14
|
-
readonly transpilationMode: Readonly<Options>;
|
|
15
|
-
readonly depsToTranspile: Readonly<Options>;
|
|
16
|
-
readonly verboseErrors: Readonly<Options>;
|
|
17
|
-
readonly writeManifest: Readonly<Options>;
|
|
18
|
-
readonly serve: Readonly<Options>;
|
|
19
|
-
readonly directory: Readonly<PositionalOptions>;
|
|
20
|
-
};
|
|
21
|
-
export declare enum TranspilationModes {
|
|
22
|
-
LocalAndDeps = "localAndDeps",
|
|
23
|
-
LocalOnly = "localOnly",
|
|
24
|
-
None = "none"
|
|
25
|
-
}
|
|
26
|
-
declare const builders: SnapsCliBuilders;
|
|
27
|
-
export default builders;
|
package/dist/builders.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"builders.js","sourceRoot":"","sources":["../src/builders.ts"],"names":[],"mappings":"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","sourcesContent":["import { Options, PositionalOptions } from 'yargs';\n\nexport type SnapsCliBuilders = {\n readonly bundle: Readonly<Options>;\n readonly dist: Readonly<Options>;\n readonly eval: Readonly<Options>;\n readonly manifest: Readonly<Options>;\n readonly outfileName: Readonly<Options>;\n readonly port: Readonly<Options>;\n readonly root: Readonly<Options>;\n readonly sourceMaps: Readonly<Options>;\n readonly src: Readonly<Options>;\n readonly stripComments: Readonly<Options>;\n readonly suppressWarnings: Readonly<Options>;\n readonly transpilationMode: Readonly<Options>;\n readonly depsToTranspile: Readonly<Options>;\n readonly verboseErrors: Readonly<Options>;\n readonly writeManifest: Readonly<Options>;\n readonly serve: Readonly<Options>;\n readonly directory: Readonly<PositionalOptions>;\n};\n\nexport enum TranspilationModes {\n LocalAndDeps = 'localAndDeps',\n LocalOnly = 'localOnly',\n None = 'none',\n}\n\nconst builders: SnapsCliBuilders = {\n bundle: {\n alias: 'b',\n describe: 'Snap bundle file',\n type: 'string',\n demandOption: true,\n normalize: true,\n default: 'dist/bundle.js',\n },\n\n dist: {\n alias: 'd',\n describe: 'Output directory',\n type: 'string',\n demandOption: true,\n normalize: true,\n default: 'dist',\n },\n\n eval: {\n alias: 'e',\n describe: 'Attempt to evaluate Snap bundle in SES',\n type: 'boolean',\n demandOption: false,\n default: true,\n },\n\n manifest: {\n alias: 'm',\n describe: 'Validate snap.manifest.json',\n type: 'boolean',\n demandOption: false,\n default: true,\n },\n\n port: {\n alias: 'p',\n describe: 'Local server port for testing',\n type: 'number',\n demandOption: true,\n default: 8081,\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 return port;\n },\n },\n\n outfileName: {\n alias: 'n',\n describe: 'Output file name',\n type: 'string',\n demandOption: false,\n default: 'bundle.js',\n },\n\n root: {\n alias: 'r',\n describe: 'Server root directory',\n type: 'string',\n demandOption: true,\n normalize: true,\n default: '.',\n },\n\n sourceMaps: {\n describe: 'Whether builds include sourcemaps',\n type: 'boolean',\n demandOption: false,\n default: false,\n },\n\n src: {\n alias: 's',\n describe: 'Source file',\n type: 'string',\n demandOption: true,\n normalize: true,\n default: 'src/index.js',\n },\n\n stripComments: {\n alias: 'strip',\n describe: 'Whether to remove code comments from the build output',\n type: 'boolean',\n demandOption: false,\n default: true,\n },\n\n suppressWarnings: {\n type: 'boolean',\n describe: 'Whether to suppress warnings',\n demandOption: false,\n default: false,\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 demandOption: false,\n default: TranspilationModes.LocalOnly,\n choices: Object.values(TranspilationModes),\n },\n\n depsToTranspile: {\n type: 'array',\n describe: 'Transpile only the listed dependencies.',\n demandOption: false,\n },\n\n verboseErrors: {\n type: 'boolean',\n describe: 'Display original errors',\n demandOption: false,\n default: true,\n },\n\n writeManifest: {\n describe: 'Make necessary changes to the Snap manifest file',\n type: 'boolean',\n demandOption: false,\n default: true,\n },\n\n serve: {\n describe: 'Serve Snap file(s) locally for testing',\n type: 'boolean',\n demandOption: false,\n default: true,\n },\n\n directory: {\n describe: 'the directory to use',\n type: 'string',\n },\n};\n\nexport default builders;\n"]}
|
package/dist/cli.js
DELETED
|
@@ -1,51 +0,0 @@
|
|
|
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.cli = void 0;
|
|
7
|
-
const yargs_1 = __importDefault(require("yargs"));
|
|
8
|
-
const builders_1 = __importDefault(require("./builders"));
|
|
9
|
-
const utils_1 = require("./utils");
|
|
10
|
-
/**
|
|
11
|
-
* The main CLI entry point function. This processes the command line args, and
|
|
12
|
-
* runs the appropriate function.
|
|
13
|
-
*
|
|
14
|
-
* @param argv - The raw command line arguments, i.e., `process.argv`.
|
|
15
|
-
* @param commands - The list of commands to use.
|
|
16
|
-
*/
|
|
17
|
-
function cli(argv, commands) {
|
|
18
|
-
const rawArgv = argv.slice(2);
|
|
19
|
-
// eslint-disable-next-line @typescript-eslint/no-unused-expressions
|
|
20
|
-
(0, yargs_1.default)(rawArgv)
|
|
21
|
-
.scriptName('mm-snap')
|
|
22
|
-
.usage('Usage: $0 <command> [options]')
|
|
23
|
-
.example('$0 init', `\tInitialize a snap project in the current directory`)
|
|
24
|
-
.example('$0 init my-snap', `\tInitialize a snap project in the 'my-snap' directory`)
|
|
25
|
-
.example('$0 build -s src/index.js -d out', `\tBuild 'src/index.js' as './out/bundle.js'`)
|
|
26
|
-
.example('$0 build -s src/index.js -d out -n snap.js', `\tBuild 'src/index.js' as './out/snap.js'`)
|
|
27
|
-
.example('$0 serve -r out', `\tServe files in './out' on port 8080`)
|
|
28
|
-
.example('$0 serve -r out -p 9000', `\tServe files in './out' on port 9000`)
|
|
29
|
-
.example('$0 watch -s src/index.js -d out', `\tRebuild './out/bundle.js' on changes to files in 'src/index.js' parent and child directories`)
|
|
30
|
-
.command(commands)
|
|
31
|
-
.option('verboseErrors', builders_1.default.verboseErrors)
|
|
32
|
-
.option('suppressWarnings', builders_1.default.suppressWarnings)
|
|
33
|
-
.strict()
|
|
34
|
-
// Typecast: The @types/yargs type for .middleware is incorrect.
|
|
35
|
-
// yargs middleware functions receive the yargs instance as a second parameter.
|
|
36
|
-
// ref: https://yargs.js.org/docs/#api-reference-middlewarecallbacks-applybeforevalidation
|
|
37
|
-
.middleware(((yargsArgv, yargsInstance) => {
|
|
38
|
-
(0, utils_1.applyConfig)((0, utils_1.loadConfig)(), rawArgv, yargsArgv, yargsInstance);
|
|
39
|
-
(0, utils_1.setSnapGlobals)(yargsArgv);
|
|
40
|
-
(0, utils_1.sanitizeInputs)(yargsArgv);
|
|
41
|
-
}), true)
|
|
42
|
-
.fail((message, error, _yargs) => {
|
|
43
|
-
(0, utils_1.logError)(message, error);
|
|
44
|
-
process.exitCode = 1;
|
|
45
|
-
})
|
|
46
|
-
.demandCommand(1, 'You must specify at least one command.')
|
|
47
|
-
.help()
|
|
48
|
-
.alias('help', 'h').argv;
|
|
49
|
-
}
|
|
50
|
-
exports.cli = cli;
|
|
51
|
-
//# sourceMappingURL=cli.js.map
|
package/dist/cli.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"cli.js","sourceRoot":"","sources":["../src/cli.ts"],"names":[],"mappings":";;;;;;AAAA,kDAAyC;AAGzC,0DAAkC;AAClC,mCAMiB;AAEjB;;;;;;GAMG;AACH,SAAgB,GAAG,CAAC,IAAc,EAAE,QAAa;IAC/C,MAAM,OAAO,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,CAAC,CAAC;IAC9B,oEAAoE;IACpE,IAAA,eAAK,EAAC,OAAO,CAAC;SACX,UAAU,CAAC,SAAS,CAAC;SACrB,KAAK,CAAC,+BAA+B,CAAC;SAEtC,OAAO,CAAC,SAAS,EAAE,sDAAsD,CAAC;SAC1E,OAAO,CACN,iBAAiB,EACjB,wDAAwD,CACzD;SACA,OAAO,CACN,iCAAiC,EACjC,6CAA6C,CAC9C;SACA,OAAO,CACN,4CAA4C,EAC5C,2CAA2C,CAC5C;SACA,OAAO,CAAC,iBAAiB,EAAE,uCAAuC,CAAC;SACnE,OAAO,CAAC,yBAAyB,EAAE,uCAAuC,CAAC;SAC3E,OAAO,CACN,iCAAiC,EACjC,gGAAgG,CACjG;SAEA,OAAO,CAAC,QAAQ,CAAC;SAEjB,MAAM,CAAC,eAAe,EAAE,kBAAQ,CAAC,aAAa,CAAC;SAE/C,MAAM,CAAC,kBAAkB,EAAE,kBAAQ,CAAC,gBAAgB,CAAC;SAErD,MAAM,EAAE;QAET,gEAAgE;QAChE,+EAA+E;QAC/E,0FAA0F;SACzF,UAAU,CACT,CAAC,CAAC,SAAoB,EAAE,aAA+B,EAAE,EAAE;QACzD,IAAA,mBAAW,EAAC,IAAA,kBAAU,GAAE,EAAE,OAAO,EAAE,SAAS,EAAE,aAAa,CAAC,CAAC;QAC7D,IAAA,sBAAc,EAAC,SAAS,CAAC,CAAC;QAC1B,IAAA,sBAAc,EAAC,SAAS,CAAC,CAAC;IAC5B,CAAC,CAAQ,EACT,IAAI,CACL;SAEA,IAAI,CAAC,CAAC,OAAe,EAAE,KAAY,EAAE,MAAM,EAAE,EAAE;QAC9C,IAAA,gBAAQ,EAAC,OAAO,EAAE,KAAK,CAAC,CAAC;QACzB,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC,CAAC;SAED,aAAa,CAAC,CAAC,EAAE,wCAAwC,CAAC;SAE1D,IAAI,EAAE;SACN,KAAK,CAAC,MAAM,EAAE,GAAG,CAAC,CAAC,IAAI,CAAC;AAC7B,CAAC;AAxDD,kBAwDC","sourcesContent":["import yargs, { Arguments } from 'yargs';\nimport yargsType from 'yargs/yargs';\n\nimport builders from './builders';\nimport {\n applyConfig,\n loadConfig,\n sanitizeInputs,\n setSnapGlobals,\n logError,\n} 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 function cli(argv: string[], commands: any): void {\n const rawArgv = argv.slice(2);\n // eslint-disable-next-line @typescript-eslint/no-unused-expressions\n yargs(rawArgv)\n .scriptName('mm-snap')\n .usage('Usage: $0 <command> [options]')\n\n .example('$0 init', `\\tInitialize a snap project in the current directory`)\n .example(\n '$0 init my-snap',\n `\\tInitialize a snap project in the 'my-snap' directory`,\n )\n .example(\n '$0 build -s src/index.js -d out',\n `\\tBuild 'src/index.js' as './out/bundle.js'`,\n )\n .example(\n '$0 build -s src/index.js -d out -n snap.js',\n `\\tBuild 'src/index.js' as './out/snap.js'`,\n )\n .example('$0 serve -r out', `\\tServe files in './out' on port 8080`)\n .example('$0 serve -r out -p 9000', `\\tServe files in './out' on port 9000`)\n .example(\n '$0 watch -s src/index.js -d out',\n `\\tRebuild './out/bundle.js' on changes to files in 'src/index.js' parent and child directories`,\n )\n\n .command(commands)\n\n .option('verboseErrors', builders.verboseErrors)\n\n .option('suppressWarnings', builders.suppressWarnings)\n\n .strict()\n\n // Typecast: The @types/yargs type for .middleware is incorrect.\n // yargs middleware functions receive the yargs instance as a second parameter.\n // ref: https://yargs.js.org/docs/#api-reference-middlewarecallbacks-applybeforevalidation\n .middleware(\n ((yargsArgv: Arguments, yargsInstance: typeof yargsType) => {\n applyConfig(loadConfig(), rawArgv, yargsArgv, yargsInstance);\n setSnapGlobals(yargsArgv);\n sanitizeInputs(yargsArgv);\n }) as any,\n true,\n )\n\n .fail((message: string, error: Error, _yargs) => {\n logError(message, error);\n process.exitCode = 1;\n })\n\n .demandCommand(1, 'You must specify at least one command.')\n\n .help()\n .alias('help', 'h').argv;\n}\n"]}
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import { YargsArgs } from '../../types/yargs';
|
|
2
|
-
/**
|
|
3
|
-
* Builds all files in the given source directory to the given destination
|
|
4
|
-
* directory.
|
|
5
|
-
*
|
|
6
|
-
* Creates destination directory if it doesn't exist.
|
|
7
|
-
*
|
|
8
|
-
* @param argv - Argv from Yargs.
|
|
9
|
-
* @param argv.src - The source file path.
|
|
10
|
-
* @param argv.dist - The output directory path.
|
|
11
|
-
* @param argv.outfileName - The output file name.
|
|
12
|
-
*/
|
|
13
|
-
export declare function build(argv: YargsArgs): Promise<void>;
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.build = void 0;
|
|
4
|
-
const snaps_utils_1 = require("@metamask/snaps-utils");
|
|
5
|
-
const utils_1 = require("../../utils");
|
|
6
|
-
const evalHandler_1 = require("../eval/evalHandler");
|
|
7
|
-
const manifestHandler_1 = require("../manifest/manifestHandler");
|
|
8
|
-
const bundle_1 = require("./bundle");
|
|
9
|
-
/**
|
|
10
|
-
* Builds all files in the given source directory to the given destination
|
|
11
|
-
* directory.
|
|
12
|
-
*
|
|
13
|
-
* Creates destination directory if it doesn't exist.
|
|
14
|
-
*
|
|
15
|
-
* @param argv - Argv from Yargs.
|
|
16
|
-
* @param argv.src - The source file path.
|
|
17
|
-
* @param argv.dist - The output directory path.
|
|
18
|
-
* @param argv.outfileName - The output file name.
|
|
19
|
-
*/
|
|
20
|
-
async function build(argv) {
|
|
21
|
-
const { src, dist, outfileName } = argv;
|
|
22
|
-
if (outfileName) {
|
|
23
|
-
(0, snaps_utils_1.validateOutfileName)(outfileName);
|
|
24
|
-
}
|
|
25
|
-
await (0, snaps_utils_1.validateFilePath)(src);
|
|
26
|
-
await (0, snaps_utils_1.validateDirPath)(dist, true);
|
|
27
|
-
const outfilePath = (0, snaps_utils_1.getOutfilePath)(dist, outfileName);
|
|
28
|
-
const result = await (0, bundle_1.bundle)(src, outfilePath, argv, (0, utils_1.loadConfig)().bundlerCustomizer);
|
|
29
|
-
if (result && argv.eval) {
|
|
30
|
-
await (0, evalHandler_1.evalHandler)({ ...argv, bundle: outfilePath });
|
|
31
|
-
}
|
|
32
|
-
if (argv.manifest) {
|
|
33
|
-
await (0, manifestHandler_1.manifestHandler)(argv);
|
|
34
|
-
}
|
|
35
|
-
}
|
|
36
|
-
exports.build = build;
|
|
37
|
-
//# sourceMappingURL=buildHandler.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"buildHandler.js","sourceRoot":"","sources":["../../../src/cmds/build/buildHandler.ts"],"names":[],"mappings":";;;AAAA,uDAK+B;AAG/B,uCAAyC;AACzC,qDAAkD;AAClD,iEAA8D;AAC9D,qCAAkC;AAElC;;;;;;;;;;GAUG;AACI,KAAK,UAAU,KAAK,CAAC,IAAe;IACzC,MAAM,EAAE,GAAG,EAAE,IAAI,EAAE,WAAW,EAAE,GAAG,IAAI,CAAC;IACxC,IAAI,WAAW,EAAE;QACf,IAAA,iCAAmB,EAAC,WAAW,CAAC,CAAC;KAClC;IACD,MAAM,IAAA,8BAAgB,EAAC,GAAG,CAAC,CAAC;IAC5B,MAAM,IAAA,6BAAe,EAAC,IAAI,EAAE,IAAI,CAAC,CAAC;IAElC,MAAM,WAAW,GAAG,IAAA,4BAAc,EAAC,IAAI,EAAE,WAAW,CAAC,CAAC;IACtD,MAAM,MAAM,GAAG,MAAM,IAAA,eAAM,EACzB,GAAG,EACH,WAAW,EACX,IAAI,EACJ,IAAA,kBAAU,GAAE,CAAC,iBAAiB,CAC/B,CAAC;IACF,IAAI,MAAM,IAAI,IAAI,CAAC,IAAI,EAAE;QACvB,MAAM,IAAA,yBAAW,EAAC,EAAE,GAAG,IAAI,EAAE,MAAM,EAAE,WAAW,EAAE,CAAC,CAAC;KACrD;IAED,IAAI,IAAI,CAAC,QAAQ,EAAE;QACjB,MAAM,IAAA,iCAAe,EAAC,IAAI,CAAC,CAAC;KAC7B;AACH,CAAC;AAtBD,sBAsBC","sourcesContent":["import {\n getOutfilePath,\n validateDirPath,\n validateFilePath,\n validateOutfileName,\n} from '@metamask/snaps-utils';\n\nimport { YargsArgs } from '../../types/yargs';\nimport { loadConfig } from '../../utils';\nimport { evalHandler } from '../eval/evalHandler';\nimport { manifestHandler } from '../manifest/manifestHandler';\nimport { bundle } from './bundle';\n\n/**\n * Builds all files in the given source directory to the given destination\n * directory.\n *\n * Creates destination directory if it doesn't exist.\n *\n * @param argv - Argv from Yargs.\n * @param argv.src - The source file path.\n * @param argv.dist - The output directory path.\n * @param argv.outfileName - The output file name.\n */\nexport async function build(argv: YargsArgs): Promise<void> {\n const { src, dist, outfileName } = argv;\n if (outfileName) {\n validateOutfileName(outfileName);\n }\n await validateFilePath(src);\n await validateDirPath(dist, true);\n\n const outfilePath = getOutfilePath(dist, outfileName);\n const result = await bundle(\n src,\n outfilePath,\n argv,\n loadConfig().bundlerCustomizer,\n );\n if (result && argv.eval) {\n await evalHandler({ ...argv, bundle: outfilePath });\n }\n\n if (argv.manifest) {\n await manifestHandler(argv);\n }\n}\n"]}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { BrowserifyObject } from 'browserify';
|
|
2
|
-
import { YargsArgs } from '../../types/yargs';
|
|
3
|
-
/**
|
|
4
|
-
* Builds a Snap bundle JS file from its JavaScript source.
|
|
5
|
-
*
|
|
6
|
-
* @param src - The source file path.
|
|
7
|
-
* @param dest - The destination file path.
|
|
8
|
-
* @param argv - Arguments as an object generated by `yargs`.
|
|
9
|
-
* @param argv.sourceMaps - Whether to output sourcemaps.
|
|
10
|
-
* @param argv.stripComments - Whether to remove comments from code.
|
|
11
|
-
* @param argv.transpilationMode - The Babel transpilation mode.
|
|
12
|
-
* @param bundlerTransform - An optional function which can be used to transform
|
|
13
|
-
* the Browserify instance, e.g., adding a custom transform or plugin.
|
|
14
|
-
*/
|
|
15
|
-
export declare function bundle(src: string, dest: string, argv: YargsArgs, bundlerTransform?: (bundler: BrowserifyObject) => void): Promise<boolean>;
|
|
@@ -1,80 +0,0 @@
|
|
|
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.bundle = void 0;
|
|
7
|
-
const snaps_browserify_plugin_1 = __importDefault(require("@metamask/snaps-browserify-plugin"));
|
|
8
|
-
const browserify_1 = __importDefault(require("browserify"));
|
|
9
|
-
const builders_1 = require("../../builders");
|
|
10
|
-
const utils_1 = require("./utils");
|
|
11
|
-
// We need to statically import all Browserify transforms and all Babel presets
|
|
12
|
-
// and plugins, and calling `require` is the sanest way to do that.
|
|
13
|
-
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, node/global-require */
|
|
14
|
-
/**
|
|
15
|
-
* Builds a Snap bundle JS file from its JavaScript source.
|
|
16
|
-
*
|
|
17
|
-
* @param src - The source file path.
|
|
18
|
-
* @param dest - The destination file path.
|
|
19
|
-
* @param argv - Arguments as an object generated by `yargs`.
|
|
20
|
-
* @param argv.sourceMaps - Whether to output sourcemaps.
|
|
21
|
-
* @param argv.stripComments - Whether to remove comments from code.
|
|
22
|
-
* @param argv.transpilationMode - The Babel transpilation mode.
|
|
23
|
-
* @param bundlerTransform - An optional function which can be used to transform
|
|
24
|
-
* the Browserify instance, e.g., adding a custom transform or plugin.
|
|
25
|
-
*/
|
|
26
|
-
async function bundle(src, dest, argv, bundlerTransform) {
|
|
27
|
-
const { sourceMaps: debug, transpilationMode } = argv;
|
|
28
|
-
const babelifyOptions = (0, utils_1.processDependencies)(argv);
|
|
29
|
-
return new Promise((resolve, _reject) => {
|
|
30
|
-
const bundler = (0, browserify_1.default)(src, {
|
|
31
|
-
debug,
|
|
32
|
-
extensions: ['.js', '.ts'],
|
|
33
|
-
// Standalone is required to properly support Snaps using module.exports
|
|
34
|
-
standalone: '<snap>',
|
|
35
|
-
});
|
|
36
|
-
if (transpilationMode !== builders_1.TranspilationModes.None) {
|
|
37
|
-
bundler.transform(require('babelify'), {
|
|
38
|
-
global: transpilationMode === builders_1.TranspilationModes.LocalAndDeps,
|
|
39
|
-
extensions: ['.js', '.ts'],
|
|
40
|
-
presets: [
|
|
41
|
-
require('@babel/preset-typescript'),
|
|
42
|
-
[
|
|
43
|
-
require('@babel/preset-env'),
|
|
44
|
-
{
|
|
45
|
-
targets: {
|
|
46
|
-
browsers: ['chrome >= 66', 'firefox >= 68'],
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
],
|
|
51
|
-
plugins: [
|
|
52
|
-
require('@babel/plugin-transform-runtime'),
|
|
53
|
-
require('@babel/plugin-proposal-class-properties'),
|
|
54
|
-
require('@babel/plugin-proposal-object-rest-spread'),
|
|
55
|
-
require('@babel/plugin-proposal-optional-chaining'),
|
|
56
|
-
require('@babel/plugin-proposal-nullish-coalescing-operator'),
|
|
57
|
-
],
|
|
58
|
-
parserOpts: {
|
|
59
|
-
attachComment: !argv.stripComments,
|
|
60
|
-
},
|
|
61
|
-
...babelifyOptions,
|
|
62
|
-
});
|
|
63
|
-
}
|
|
64
|
-
bundlerTransform?.(bundler);
|
|
65
|
-
bundler.plugin(snaps_browserify_plugin_1.default, {
|
|
66
|
-
stripComments: argv.stripComments,
|
|
67
|
-
manifestPath: undefined,
|
|
68
|
-
eval: false,
|
|
69
|
-
});
|
|
70
|
-
bundler.bundle(async (bundleError, bundleBuffer) => await (0, utils_1.writeBundleFile)({
|
|
71
|
-
bundleError,
|
|
72
|
-
bundleBuffer,
|
|
73
|
-
src,
|
|
74
|
-
dest,
|
|
75
|
-
resolve,
|
|
76
|
-
}));
|
|
77
|
-
});
|
|
78
|
-
}
|
|
79
|
-
exports.bundle = bundle;
|
|
80
|
-
//# sourceMappingURL=bundle.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"bundle.js","sourceRoot":"","sources":["../../../src/cmds/build/bundle.ts"],"names":[],"mappings":";;;;;;AAAA,gGAAoE;AACpE,4DAA0D;AAE1D,6CAAoD;AAEpD,mCAA+D;AAE/D,+EAA+E;AAC/E,mEAAmE;AACnE,mHAAmH;AAEnH;;;;;;;;;;;GAWG;AACI,KAAK,UAAU,MAAM,CAC1B,GAAW,EACX,IAAY,EACZ,IAAe,EACf,gBAAsD;IAEtD,MAAM,EAAE,UAAU,EAAE,KAAK,EAAE,iBAAiB,EAAE,GAAG,IAAI,CAAC;IACtD,MAAM,eAAe,GAAG,IAAA,2BAAmB,EAAC,IAAW,CAAC,CAAC;IACzD,OAAO,IAAI,OAAO,CAAC,CAAC,OAAO,EAAE,OAAO,EAAE,EAAE;QACtC,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC,GAAG,EAAE;YAC9B,KAAK;YACL,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;YAC1B,wEAAwE;YACxE,UAAU,EAAE,QAAQ;SACrB,CAAC,CAAC;QAEH,IAAI,iBAAiB,KAAK,6BAAkB,CAAC,IAAI,EAAE;YACjD,OAAO,CAAC,SAAS,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;gBACrC,MAAM,EAAE,iBAAiB,KAAK,6BAAkB,CAAC,YAAY;gBAC7D,UAAU,EAAE,CAAC,KAAK,EAAE,KAAK,CAAC;gBAC1B,OAAO,EAAE;oBACP,OAAO,CAAC,0BAA0B,CAAC;oBACnC;wBACE,OAAO,CAAC,mBAAmB,CAAC;wBAC5B;4BACE,OAAO,EAAE;gCACP,QAAQ,EAAE,CAAC,cAAc,EAAE,eAAe,CAAC;6BAC5C;yBACF;qBACF;iBACF;gBACD,OAAO,EAAE;oBACP,OAAO,CAAC,iCAAiC,CAAC;oBAC1C,OAAO,CAAC,yCAAyC,CAAC;oBAClD,OAAO,CAAC,2CAA2C,CAAC;oBACpD,OAAO,CAAC,0CAA0C,CAAC;oBACnD,OAAO,CAAC,oDAAoD,CAAC;iBAC9D;gBACD,UAAU,EAAE;oBACV,aAAa,EAAE,CAAC,IAAI,CAAC,aAAa;iBACnC;gBACD,GAAI,eAAuB;aAC5B,CAAC,CAAC;SACJ;QAED,gBAAgB,EAAE,CAAC,OAAO,CAAC,CAAC;QAE5B,OAAO,CAAC,MAAM,CAAU,iCAAM,EAAE;YAC9B,aAAa,EAAE,IAAI,CAAC,aAAa;YACjC,YAAY,EAAE,SAAS;YACvB,IAAI,EAAE,KAAK;SACZ,CAAC,CAAC;QAEH,OAAO,CAAC,MAAM,CACZ,KAAK,EAAE,WAAW,EAAE,YAAoB,EAAE,EAAE,CAC1C,MAAM,IAAA,uBAAe,EAAC;YACpB,WAAW;YACX,YAAY;YACZ,GAAG;YACH,IAAI;YACJ,OAAO;SACR,CAAC,CACL,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AAhED,wBAgEC","sourcesContent":["import plugin, { Options } from '@metamask/snaps-browserify-plugin';\nimport browserify, { BrowserifyObject } from 'browserify';\n\nimport { TranspilationModes } from '../../builders';\nimport { YargsArgs } from '../../types/yargs';\nimport { processDependencies, writeBundleFile } from './utils';\n\n// We need to statically import all Browserify transforms and all Babel presets\n// and plugins, and calling `require` is the sanest way to do that.\n/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, node/global-require */\n\n/**\n * Builds a Snap bundle JS file from its JavaScript source.\n *\n * @param src - The source file path.\n * @param dest - The destination file path.\n * @param argv - Arguments as an object generated by `yargs`.\n * @param argv.sourceMaps - Whether to output sourcemaps.\n * @param argv.stripComments - Whether to remove comments from code.\n * @param argv.transpilationMode - The Babel transpilation mode.\n * @param bundlerTransform - An optional function which can be used to transform\n * the Browserify instance, e.g., adding a custom transform or plugin.\n */\nexport async function bundle(\n src: string,\n dest: string,\n argv: YargsArgs,\n bundlerTransform?: (bundler: BrowserifyObject) => void,\n): Promise<boolean> {\n const { sourceMaps: debug, transpilationMode } = argv;\n const babelifyOptions = processDependencies(argv as any);\n return new Promise((resolve, _reject) => {\n const bundler = browserify(src, {\n debug,\n extensions: ['.js', '.ts'],\n // Standalone is required to properly support Snaps using module.exports\n standalone: '<snap>',\n });\n\n if (transpilationMode !== TranspilationModes.None) {\n bundler.transform(require('babelify'), {\n global: transpilationMode === TranspilationModes.LocalAndDeps,\n extensions: ['.js', '.ts'],\n presets: [\n require('@babel/preset-typescript'),\n [\n require('@babel/preset-env'),\n {\n targets: {\n browsers: ['chrome >= 66', 'firefox >= 68'],\n },\n },\n ],\n ],\n plugins: [\n require('@babel/plugin-transform-runtime'),\n require('@babel/plugin-proposal-class-properties'),\n require('@babel/plugin-proposal-object-rest-spread'),\n require('@babel/plugin-proposal-optional-chaining'),\n require('@babel/plugin-proposal-nullish-coalescing-operator'),\n ],\n parserOpts: {\n attachComment: !argv.stripComments,\n },\n ...(babelifyOptions as any),\n });\n }\n\n bundlerTransform?.(bundler);\n\n bundler.plugin<Options>(plugin, {\n stripComments: argv.stripComments,\n manifestPath: undefined,\n eval: false,\n });\n\n bundler.bundle(\n async (bundleError, bundleBuffer: Buffer) =>\n await writeBundleFile({\n bundleError,\n bundleBuffer,\n src,\n dest,\n resolve,\n }),\n );\n });\n}\n"]}
|
package/dist/cmds/build/index.js
DELETED
|
@@ -1,29 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
|
-
const builders_1 = __importDefault(require("../../builders"));
|
|
6
|
-
const buildHandler_1 = require("./buildHandler");
|
|
7
|
-
const utils_1 = require("./utils");
|
|
8
|
-
module.exports = {
|
|
9
|
-
command: ['build', 'b'],
|
|
10
|
-
desc: 'Build Snap from source',
|
|
11
|
-
builder: (yarg) => {
|
|
12
|
-
yarg
|
|
13
|
-
.option('dist', builders_1.default.dist)
|
|
14
|
-
.option('eval', builders_1.default.eval)
|
|
15
|
-
.option('manifest', builders_1.default.manifest)
|
|
16
|
-
.option('outfileName', builders_1.default.outfileName)
|
|
17
|
-
.option('sourceMaps', builders_1.default.sourceMaps)
|
|
18
|
-
.option('src', builders_1.default.src)
|
|
19
|
-
.option('stripComments', builders_1.default.stripComments)
|
|
20
|
-
.option('transpilationMode', builders_1.default.transpilationMode)
|
|
21
|
-
.option('depsToTranspile', builders_1.default.depsToTranspile)
|
|
22
|
-
.option('writeManifest', builders_1.default.writeManifest)
|
|
23
|
-
.implies('writeManifest', 'manifest')
|
|
24
|
-
.implies('depsToTranspile', 'transpilationMode')
|
|
25
|
-
.middleware((argv) => (0, utils_1.processInvalidTranspilation)(argv));
|
|
26
|
-
},
|
|
27
|
-
handler: async (argv) => (0, buildHandler_1.build)(argv),
|
|
28
|
-
};
|
|
29
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/cmds/build/index.ts"],"names":[],"mappings":";;;;AAEA,8DAAsC;AAEtC,iDAAuC;AACvC,mCAAsD;AAEtD,iBAAS;IACP,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI;aACD,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,UAAU,EAAE,kBAAQ,CAAC,QAAQ,CAAC;aACrC,MAAM,CAAC,aAAa,EAAE,kBAAQ,CAAC,WAAW,CAAC;aAC3C,MAAM,CAAC,YAAY,EAAE,kBAAQ,CAAC,UAAU,CAAC;aACzC,MAAM,CAAC,KAAK,EAAE,kBAAQ,CAAC,GAAG,CAAC;aAC3B,MAAM,CAAC,eAAe,EAAE,kBAAQ,CAAC,aAAa,CAAC;aAC/C,MAAM,CAAC,mBAAmB,EAAE,kBAAQ,CAAC,iBAAiB,CAAC;aACvD,MAAM,CAAC,iBAAiB,EAAE,kBAAQ,CAAC,eAAe,CAAC;aACnD,MAAM,CAAC,eAAe,EAAE,kBAAQ,CAAC,aAAa,CAAC;aAC/C,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC;aACpC,OAAO,CAAC,iBAAiB,EAAE,mBAAmB,CAAC;aAC/C,UAAU,CAAC,CAAC,IAAI,EAAE,EAAE,CAAC,IAAA,mCAA2B,EAAC,IAAW,CAAC,CAAC,CAAC;IACpE,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CAAC,IAAA,oBAAK,EAAC,IAAI,CAAC;CAChD,CAAC","sourcesContent":["import yargs from 'yargs';\n\nimport builders from '../../builders';\nimport { YargsArgs } from '../../types/yargs';\nimport { build } from './buildHandler';\nimport { processInvalidTranspilation } from './utils';\n\nexport = {\n command: ['build', 'b'],\n desc: 'Build Snap from source',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('dist', builders.dist)\n .option('eval', builders.eval)\n .option('manifest', builders.manifest)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('src', builders.src)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('writeManifest', builders.writeManifest)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode')\n .middleware((argv) => processInvalidTranspilation(argv as any));\n },\n handler: async (argv: YargsArgs) => build(argv),\n};\n"]}
|
|
@@ -1,56 +0,0 @@
|
|
|
1
|
-
/// <reference types="node" />
|
|
2
|
-
import { YargsArgs } from '../../types/yargs';
|
|
3
|
-
declare type WriteBundleFileArgs = {
|
|
4
|
-
bundleError: Error;
|
|
5
|
-
bundleBuffer: Buffer;
|
|
6
|
-
src: string;
|
|
7
|
-
dest: string;
|
|
8
|
-
resolve: (value: boolean) => void;
|
|
9
|
-
};
|
|
10
|
-
/**
|
|
11
|
-
* Performs postprocessing on the bundle contents and writes them to disk.
|
|
12
|
-
* Intended to be used in the callback passed to the Browserify `.bundle()`
|
|
13
|
-
* call.
|
|
14
|
-
*
|
|
15
|
-
* @param options - Options bag.
|
|
16
|
-
* @param options.bundleError - Any error received from Browserify.
|
|
17
|
-
* @param options.bundleBuffer - The {@link Buffer} with the bundle contents
|
|
18
|
-
* from Browserify.
|
|
19
|
-
* @param options.src - The source file path.
|
|
20
|
-
* @param options.dest - The destination file path.
|
|
21
|
-
* @param options.resolve - A {@link Promise} resolution function, so that we
|
|
22
|
-
* can use promises and `async`/`await` even though Browserify uses callbacks.
|
|
23
|
-
*/
|
|
24
|
-
export declare function writeBundleFile({ bundleError, bundleBuffer, src, dest, resolve, }: WriteBundleFileArgs): Promise<void>;
|
|
25
|
-
/**
|
|
26
|
-
* Processes dependencies and updates `argv` with an options object.
|
|
27
|
-
*
|
|
28
|
-
* @param argv - The Yargs arguments object.
|
|
29
|
-
* @returns An object with options that can be passed to Babelify.
|
|
30
|
-
*/
|
|
31
|
-
export declare function processDependencies(argv: YargsArgs): Record<string, any>;
|
|
32
|
-
/**
|
|
33
|
-
* Processes a string of space delimited dependencies into one RegExp string.
|
|
34
|
-
*
|
|
35
|
-
* @param dependencies - An array of dependencies to add to the RegExp.
|
|
36
|
-
* @returns A RegExp object.
|
|
37
|
-
*/
|
|
38
|
-
export declare function getDependencyRegExp(dependencies: string[]): RegExp | null;
|
|
39
|
-
/**
|
|
40
|
-
* Helper function remove any leading and trailing slashes from dependency list.
|
|
41
|
-
*
|
|
42
|
-
* @param dependencies - An array of dependencies to sanitize.
|
|
43
|
-
* @returns An array of sanitized paths.
|
|
44
|
-
*/
|
|
45
|
-
export declare function sanitizeDependencyPaths(dependencies: string[]): string[];
|
|
46
|
-
/**
|
|
47
|
-
* Check the Yargs argv object, to see if the provided options are valid. The
|
|
48
|
-
* options are invalid if both `depsToTranspile` are provided, and
|
|
49
|
-
* `transpilationMode` is not set to `localAndDeps`.
|
|
50
|
-
*
|
|
51
|
-
* @param argv - The Yargs arguments object.
|
|
52
|
-
* @throws If the `depsToTranspile` is set, and `transpilationMode` is not set
|
|
53
|
-
* to `localAndDeps`.
|
|
54
|
-
*/
|
|
55
|
-
export declare function processInvalidTranspilation(argv: YargsArgs): void;
|
|
56
|
-
export {};
|