@metamask/snaps-cli 6.6.1 → 7.0.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +39 -1
- package/README.md +11 -244
- package/dist/builders.cjs +4 -98
- package/dist/builders.cjs.map +1 -1
- package/dist/builders.d.cts +28 -7
- package/dist/builders.d.cts.map +1 -1
- package/dist/builders.d.mts +28 -7
- package/dist/builders.d.mts.map +1 -1
- package/dist/builders.mjs +4 -97
- package/dist/builders.mjs.map +1 -1
- package/dist/cli.cjs +4 -9
- package/dist/cli.cjs.map +1 -1
- package/dist/cli.d.cts.map +1 -1
- package/dist/cli.d.mts.map +1 -1
- package/dist/cli.mjs +4 -16
- package/dist/cli.mjs.map +1 -1
- package/dist/commands/build/build.cjs +33 -7
- package/dist/commands/build/build.cjs.map +1 -1
- package/dist/commands/build/build.d.cts +2 -1
- package/dist/commands/build/build.d.cts.map +1 -1
- package/dist/commands/build/build.d.mts +2 -1
- package/dist/commands/build/build.d.mts.map +1 -1
- package/dist/commands/build/build.mjs +31 -5
- package/dist/commands/build/build.mjs.map +1 -1
- package/dist/commands/build/implementation.cjs +1 -1
- package/dist/commands/build/implementation.cjs.map +1 -1
- package/dist/commands/build/implementation.d.cts +3 -2
- package/dist/commands/build/implementation.d.cts.map +1 -1
- package/dist/commands/build/implementation.d.mts +3 -2
- package/dist/commands/build/implementation.d.mts.map +1 -1
- package/dist/commands/build/implementation.mjs +1 -1
- package/dist/commands/build/implementation.mjs.map +1 -1
- package/dist/commands/build/index.cjs +3 -14
- package/dist/commands/build/index.cjs.map +1 -1
- package/dist/commands/build/index.d.cts.map +1 -1
- package/dist/commands/build/index.d.mts.map +1 -1
- package/dist/commands/build/index.mjs +3 -14
- package/dist/commands/build/index.mjs.map +1 -1
- package/dist/commands/build/utils.cjs +25 -0
- package/dist/commands/build/utils.cjs.map +1 -0
- package/dist/commands/build/utils.d.cts +9 -0
- package/dist/commands/build/utils.d.cts.map +1 -0
- package/dist/commands/build/utils.d.mts +9 -0
- package/dist/commands/build/utils.d.mts.map +1 -0
- package/dist/commands/build/utils.mjs +21 -0
- package/dist/commands/build/utils.mjs.map +1 -0
- package/dist/commands/eval/__test__/webpack/bad/snap.config.cjs +0 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.cjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.d.cts.map +1 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.d.mts.map +1 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.mjs +0 -1
- package/dist/commands/eval/__test__/webpack/bad/snap.config.mjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.cjs +0 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.cjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.d.cts.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.d.mts.map +1 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.mjs +0 -1
- package/dist/commands/eval/__test__/webpack/good/snap.config.mjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.cjs +0 -1
- package/dist/commands/eval/__test__/webpack/snap.config.cjs.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.d.cts.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.d.mts.map +1 -1
- package/dist/commands/eval/__test__/webpack/snap.config.mjs +0 -1
- package/dist/commands/eval/__test__/webpack/snap.config.mjs.map +1 -1
- package/dist/commands/eval/eval.cjs +1 -1
- package/dist/commands/eval/eval.cjs.map +1 -1
- package/dist/commands/eval/eval.d.cts.map +1 -1
- package/dist/commands/eval/eval.d.mts.map +1 -1
- package/dist/commands/eval/eval.mjs +1 -1
- package/dist/commands/eval/eval.mjs.map +1 -1
- package/dist/commands/eval/index.cjs +1 -4
- package/dist/commands/eval/index.cjs.map +1 -1
- package/dist/commands/eval/index.d.cts.map +1 -1
- package/dist/commands/eval/index.d.mts.map +1 -1
- package/dist/commands/eval/index.mjs +1 -4
- package/dist/commands/eval/index.mjs.map +1 -1
- package/dist/commands/manifest/index.cjs +1 -4
- package/dist/commands/manifest/index.cjs.map +1 -1
- package/dist/commands/manifest/index.d.cts.map +1 -1
- package/dist/commands/manifest/index.d.mts.map +1 -1
- package/dist/commands/manifest/index.mjs +1 -4
- package/dist/commands/manifest/index.mjs.map +1 -1
- package/dist/commands/manifest/manifest.cjs +5 -6
- package/dist/commands/manifest/manifest.cjs.map +1 -1
- package/dist/commands/manifest/manifest.d.cts.map +1 -1
- package/dist/commands/manifest/manifest.d.mts.map +1 -1
- package/dist/commands/manifest/manifest.mjs +5 -6
- package/dist/commands/manifest/manifest.mjs.map +1 -1
- package/dist/commands/serve/index.cjs +2 -2
- package/dist/commands/serve/index.cjs.map +1 -1
- package/dist/commands/serve/index.d.cts.map +1 -1
- package/dist/commands/serve/index.d.mts.map +1 -1
- package/dist/commands/serve/index.mjs +2 -2
- package/dist/commands/serve/index.mjs.map +1 -1
- package/dist/commands/watch/implementation.cjs +2 -0
- package/dist/commands/watch/implementation.cjs.map +1 -1
- package/dist/commands/watch/implementation.d.cts +2 -2
- package/dist/commands/watch/implementation.d.cts.map +1 -1
- package/dist/commands/watch/implementation.d.mts +2 -2
- package/dist/commands/watch/implementation.d.mts.map +1 -1
- package/dist/commands/watch/implementation.mjs +2 -0
- package/dist/commands/watch/implementation.mjs.map +1 -1
- package/dist/commands/watch/index.cjs +2 -17
- package/dist/commands/watch/index.cjs.map +1 -1
- package/dist/commands/watch/index.d.cts.map +1 -1
- package/dist/commands/watch/index.d.mts.map +1 -1
- package/dist/commands/watch/index.mjs +2 -17
- package/dist/commands/watch/index.mjs.map +1 -1
- package/dist/commands/watch/watch.cjs +1 -1
- package/dist/commands/watch/watch.cjs.map +1 -1
- package/dist/commands/watch/watch.d.cts.map +1 -1
- package/dist/commands/watch/watch.d.mts.map +1 -1
- package/dist/commands/watch/watch.mjs +1 -1
- package/dist/commands/watch/watch.mjs.map +1 -1
- package/dist/config.cjs +11 -155
- package/dist/config.cjs.map +1 -1
- package/dist/config.d.cts +216 -314
- package/dist/config.d.cts.map +1 -1
- package/dist/config.d.mts +216 -314
- package/dist/config.d.mts.map +1 -1
- package/dist/config.mjs +13 -155
- package/dist/config.mjs.map +1 -1
- package/dist/main.cjs +0 -1
- package/dist/main.cjs.map +1 -1
- package/dist/main.mjs +0 -1
- package/dist/main.mjs.map +1 -1
- package/dist/utils/index.cjs +0 -1
- package/dist/utils/index.cjs.map +1 -1
- package/dist/utils/index.d.cts +0 -1
- package/dist/utils/index.d.cts.map +1 -1
- package/dist/utils/index.d.mts +0 -1
- package/dist/utils/index.d.mts.map +1 -1
- package/dist/utils/index.mjs +0 -1
- package/dist/utils/index.mjs.map +1 -1
- package/dist/utils/logging.cjs +16 -2
- package/dist/utils/logging.cjs.map +1 -1
- package/dist/utils/logging.d.cts +8 -1
- package/dist/utils/logging.d.cts.map +1 -1
- package/dist/utils/logging.d.mts +8 -1
- package/dist/utils/logging.d.mts.map +1 -1
- package/dist/utils/logging.mjs +15 -2
- package/dist/utils/logging.mjs.map +1 -1
- package/dist/utils/steps.cjs +11 -6
- package/dist/utils/steps.cjs.map +1 -1
- package/dist/utils/steps.d.cts +2 -2
- package/dist/utils/steps.d.cts.map +1 -1
- package/dist/utils/steps.d.mts +2 -2
- package/dist/utils/steps.d.mts.map +1 -1
- package/dist/utils/steps.mjs +11 -6
- package/dist/utils/steps.mjs.map +1 -1
- package/dist/webpack/compiler.cjs.map +1 -1
- package/dist/webpack/compiler.d.cts +2 -2
- package/dist/webpack/compiler.d.cts.map +1 -1
- package/dist/webpack/compiler.d.mts +2 -2
- package/dist/webpack/compiler.d.mts.map +1 -1
- package/dist/webpack/compiler.mjs.map +1 -1
- package/dist/webpack/config.cjs +8 -2
- package/dist/webpack/config.cjs.map +1 -1
- package/dist/webpack/config.d.cts +6 -2
- package/dist/webpack/config.d.cts.map +1 -1
- package/dist/webpack/config.d.mts +6 -2
- package/dist/webpack/config.d.mts.map +1 -1
- package/dist/webpack/config.mjs +8 -2
- package/dist/webpack/config.mjs.map +1 -1
- package/dist/webpack/loaders/function.cjs +7 -10
- package/dist/webpack/loaders/function.cjs.map +1 -1
- package/dist/webpack/loaders/function.d.cts +1 -0
- package/dist/webpack/loaders/function.d.cts.map +1 -1
- package/dist/webpack/loaders/function.d.mts +1 -0
- package/dist/webpack/loaders/function.d.mts.map +1 -1
- package/dist/webpack/loaders/function.mjs +6 -9
- package/dist/webpack/loaders/function.mjs.map +1 -1
- package/dist/webpack/loaders/index.cjs +1 -3
- package/dist/webpack/loaders/index.cjs.map +1 -1
- package/dist/webpack/loaders/index.d.cts +0 -1
- package/dist/webpack/loaders/index.d.cts.map +1 -1
- package/dist/webpack/loaders/index.d.mts +0 -1
- package/dist/webpack/loaders/index.d.mts.map +1 -1
- package/dist/webpack/loaders/index.mjs +0 -1
- package/dist/webpack/loaders/index.mjs.map +1 -1
- package/dist/webpack/loaders/wasm.cjs +0 -2
- package/dist/webpack/loaders/wasm.cjs.map +1 -1
- package/dist/webpack/loaders/wasm.d.cts.map +1 -1
- package/dist/webpack/loaders/wasm.d.mts.map +1 -1
- package/dist/webpack/loaders/wasm.mjs +0 -2
- package/dist/webpack/loaders/wasm.mjs.map +1 -1
- package/dist/webpack/plugins.cjs +15 -20
- package/dist/webpack/plugins.cjs.map +1 -1
- package/dist/webpack/plugins.d.cts +13 -3
- package/dist/webpack/plugins.d.cts.map +1 -1
- package/dist/webpack/plugins.d.mts +13 -3
- package/dist/webpack/plugins.d.mts.map +1 -1
- package/dist/webpack/plugins.mjs +4 -9
- package/dist/webpack/plugins.mjs.map +1 -1
- package/dist/webpack/utils.cjs +5 -21
- package/dist/webpack/utils.cjs.map +1 -1
- package/dist/webpack/utils.d.cts +6 -36
- package/dist/webpack/utils.d.cts.map +1 -1
- package/dist/webpack/utils.d.mts +6 -36
- package/dist/webpack/utils.d.mts.map +1 -1
- package/dist/webpack/utils.mjs +4 -18
- package/dist/webpack/utils.mjs.map +1 -1
- package/package.json +14 -38
- package/dist/commands/eval/__test__/browserify/bad/snap.config.cjs +0 -10
- package/dist/commands/eval/__test__/browserify/bad/snap.config.cjs.map +0 -1
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.cts +0 -4
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.cts.map +0 -1
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.mts +0 -4
- package/dist/commands/eval/__test__/browserify/bad/snap.config.d.mts.map +0 -1
- package/dist/commands/eval/__test__/browserify/bad/snap.config.mjs +0 -8
- package/dist/commands/eval/__test__/browserify/bad/snap.config.mjs.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.cjs +0 -10
- package/dist/commands/eval/__test__/browserify/good/snap.config.cjs.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.cts +0 -4
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.cts.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.mts +0 -4
- package/dist/commands/eval/__test__/browserify/good/snap.config.d.mts.map +0 -1
- package/dist/commands/eval/__test__/browserify/good/snap.config.mjs +0 -8
- package/dist/commands/eval/__test__/browserify/good/snap.config.mjs.map +0 -1
- package/dist/utils/legacy.cjs +0 -53
- package/dist/utils/legacy.cjs.map +0 -1
- package/dist/utils/legacy.d.cts +0 -28
- package/dist/utils/legacy.d.cts.map +0 -1
- package/dist/utils/legacy.d.mts +0 -28
- package/dist/utils/legacy.d.mts.map +0 -1
- package/dist/utils/legacy.mjs +0 -47
- package/dist/utils/legacy.mjs.map +0 -1
- package/dist/webpack/loaders/browserify.cjs +0 -84
- package/dist/webpack/loaders/browserify.cjs.map +0 -1
- package/dist/webpack/loaders/browserify.d.cts +0 -18
- package/dist/webpack/loaders/browserify.d.cts.map +0 -1
- package/dist/webpack/loaders/browserify.d.mts +0 -18
- package/dist/webpack/loaders/browserify.d.mts.map +0 -1
- package/dist/webpack/loaders/browserify.mjs +0 -88
- package/dist/webpack/loaders/browserify.mjs.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@metamask/snaps-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "7.0.0",
|
|
4
4
|
"description": "A CLI for developing MetaMask Snaps",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"MetaMask",
|
|
@@ -35,7 +35,7 @@
|
|
|
35
35
|
"module": "./dist/index.mjs",
|
|
36
36
|
"types": "./dist/index.d.cts",
|
|
37
37
|
"bin": {
|
|
38
|
-
"mm-snap": "./dist/main.
|
|
38
|
+
"mm-snap": "./dist/main.mjs"
|
|
39
39
|
},
|
|
40
40
|
"files": [
|
|
41
41
|
"dist",
|
|
@@ -43,7 +43,7 @@
|
|
|
43
43
|
],
|
|
44
44
|
"scripts": {
|
|
45
45
|
"build": "ts-bridge --project tsconfig.build.json --verbose --clean --no-references",
|
|
46
|
-
"build:chmod": "chmod +x ./dist/main.mjs && chmod +x ./dist/main.
|
|
46
|
+
"build:chmod": "chmod +x ./dist/main.mjs && chmod +x ./dist/main.cjs",
|
|
47
47
|
"build:post": "yarn build:chmod && yarn build:readme",
|
|
48
48
|
"build:readme": "node ./scripts/updateReadme.js",
|
|
49
49
|
"build:watch": "tsc-watch --onSuccess 'yarn build:chmod'",
|
|
@@ -52,9 +52,9 @@
|
|
|
52
52
|
"lint": "yarn lint:eslint && yarn lint:misc --check && yarn changelog:validate && yarn lint:dependencies",
|
|
53
53
|
"lint:ci": "yarn lint",
|
|
54
54
|
"lint:dependencies": "depcheck",
|
|
55
|
-
"lint:eslint": "eslint . --cache
|
|
55
|
+
"lint:eslint": "eslint . --cache",
|
|
56
56
|
"lint:fix": "yarn lint:eslint --fix && yarn lint:misc --write",
|
|
57
|
-
"lint:misc": "prettier --no-error-on-unmatched-pattern --
|
|
57
|
+
"lint:misc": "prettier --no-error-on-unmatched-pattern --log-level warn \"**/*.json\" \"**/*.md\" \"**/*.html\" \"!CHANGELOG.md\" --ignore-path ../../.gitignore",
|
|
58
58
|
"publish:preview": "yarn npm publish --tag preview",
|
|
59
59
|
"since-latest-release": "../../scripts/since-latest-release.sh",
|
|
60
60
|
"test": "jest --reporters=jest-silent-reporter",
|
|
@@ -64,23 +64,13 @@
|
|
|
64
64
|
"test:watch": "jest --watch"
|
|
65
65
|
},
|
|
66
66
|
"dependencies": {
|
|
67
|
-
"@
|
|
68
|
-
"@
|
|
69
|
-
"@babel/plugin-transform-class-static-block": "^7.22.11",
|
|
70
|
-
"@babel/plugin-transform-private-methods": "^7.22.5",
|
|
71
|
-
"@babel/plugin-transform-private-property-in-object": "^7.22.11",
|
|
72
|
-
"@babel/plugin-transform-runtime": "^7.13.2",
|
|
73
|
-
"@babel/preset-env": "^7.23.2",
|
|
74
|
-
"@babel/preset-typescript": "^7.23.2",
|
|
75
|
-
"@metamask/snaps-sdk": "^6.15.0",
|
|
76
|
-
"@metamask/snaps-utils": "^8.8.0",
|
|
67
|
+
"@metamask/snaps-sdk": "^6.22.0",
|
|
68
|
+
"@metamask/snaps-utils": "^9.2.0",
|
|
77
69
|
"@metamask/snaps-webpack-plugin": "^4.2.1",
|
|
78
|
-
"@metamask/superstruct": "^3.1
|
|
79
|
-
"@metamask/utils": "^11.0
|
|
70
|
+
"@metamask/superstruct": "^3.2.1",
|
|
71
|
+
"@metamask/utils": "^11.2.0",
|
|
80
72
|
"@swc/core": "1.3.78",
|
|
81
73
|
"assert": "^2.0.0",
|
|
82
|
-
"babelify": "^10.0.0",
|
|
83
|
-
"browserify": "^17.0.0",
|
|
84
74
|
"browserify-zlib": "^0.2.0",
|
|
85
75
|
"buffer": "^6.0.3",
|
|
86
76
|
"chalk": "^4.1.2",
|
|
@@ -111,44 +101,30 @@
|
|
|
111
101
|
"url": "^0.11.1",
|
|
112
102
|
"util": "^0.12.5",
|
|
113
103
|
"vm-browserify": "^1.1.2",
|
|
114
|
-
"webpack": "^5.
|
|
104
|
+
"webpack": "^5.97.1",
|
|
105
|
+
"webpack-bundle-analyzer": "^4.10.2",
|
|
115
106
|
"webpack-merge": "^5.9.0",
|
|
116
107
|
"yargs": "^17.7.1"
|
|
117
108
|
},
|
|
118
109
|
"devDependencies": {
|
|
119
110
|
"@lavamoat/allow-scripts": "^3.0.4",
|
|
120
|
-
"@metamask/auto-changelog": "^
|
|
121
|
-
"@metamask/eslint-config": "^12.1.0",
|
|
122
|
-
"@metamask/eslint-config-jest": "^12.1.0",
|
|
123
|
-
"@metamask/eslint-config-nodejs": "^12.1.0",
|
|
124
|
-
"@metamask/eslint-config-typescript": "^12.1.0",
|
|
111
|
+
"@metamask/auto-changelog": "^5.0.1",
|
|
125
112
|
"@swc/jest": "^0.2.26",
|
|
126
113
|
"@ts-bridge/cli": "^0.6.1",
|
|
127
|
-
"@types/browserify": "^12.0.37",
|
|
128
114
|
"@types/jest": "^27.5.1",
|
|
129
115
|
"@types/node": "18.14.2",
|
|
130
116
|
"@types/serve-handler": "^6.1.0",
|
|
131
117
|
"@types/yargs": "^17.0.24",
|
|
132
|
-
"@typescript-eslint/eslint-plugin": "^5.42.1",
|
|
133
|
-
"@typescript-eslint/parser": "^6.21.0",
|
|
134
118
|
"cross-fetch": "^3.1.5",
|
|
135
119
|
"deepmerge": "^4.2.2",
|
|
136
120
|
"depcheck": "^1.4.7",
|
|
137
|
-
"eslint": "^
|
|
138
|
-
"eslint-config-prettier": "^8.5.0",
|
|
139
|
-
"eslint-plugin-import": "^2.26.0",
|
|
140
|
-
"eslint-plugin-jest": "^27.1.5",
|
|
141
|
-
"eslint-plugin-jsdoc": "^41.1.2",
|
|
142
|
-
"eslint-plugin-n": "^15.7.0",
|
|
143
|
-
"eslint-plugin-prettier": "^4.2.1",
|
|
144
|
-
"eslint-plugin-promise": "^6.1.1",
|
|
121
|
+
"eslint": "^9.11.0",
|
|
145
122
|
"execa": "^5.1.1",
|
|
146
123
|
"jest": "^29.0.2",
|
|
147
124
|
"jest-it-up": "^2.0.0",
|
|
148
125
|
"jest-silent-reporter": "^0.6.0",
|
|
149
126
|
"memfs": "^3.4.13",
|
|
150
|
-
"prettier": "^
|
|
151
|
-
"prettier-plugin-packagejson": "^2.5.2",
|
|
127
|
+
"prettier": "^3.3.3",
|
|
152
128
|
"ts-node": "^10.9.1",
|
|
153
129
|
"tsc-watch": "^4.5.0",
|
|
154
130
|
"typescript": "~5.3.3"
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snap.config.cjs","sourceRoot":"","sources":["../../../../../../src/commands/eval/__test__/browserify/bad/snap.config.ts"],"names":[],"mappings":";;AAEA,MAAM,MAAM,GAAe;IACzB,OAAO,EAAE,YAAY;IACrB,UAAU,EAAE;QACV,MAAM,EAAE,WAAW;KACpB;CACF,CAAC;AAEF,kBAAe,MAAM,CAAC","sourcesContent":["import type { SnapConfig } from '../../../../../config';\n\nconst config: SnapConfig = {\n bundler: 'browserify',\n cliOptions: {\n bundle: './eval.js',\n },\n};\n\nexport default config;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snap.config.d.cts","sourceRoot":"","sources":["../../../../../../src/commands/eval/__test__/browserify/bad/snap.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kCAA8B;AAExD,QAAA,MAAM,MAAM,EAAE,UAKb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snap.config.d.mts","sourceRoot":"","sources":["../../../../../../src/commands/eval/__test__/browserify/bad/snap.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kCAA8B;AAExD,QAAA,MAAM,MAAM,EAAE,UAKb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snap.config.mjs","sourceRoot":"","sources":["../../../../../../src/commands/eval/__test__/browserify/bad/snap.config.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAe;IACzB,OAAO,EAAE,YAAY;IACrB,UAAU,EAAE;QACV,MAAM,EAAE,WAAW;KACpB;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import type { SnapConfig } from '../../../../../config';\n\nconst config: SnapConfig = {\n bundler: 'browserify',\n cliOptions: {\n bundle: './eval.js',\n },\n};\n\nexport default config;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snap.config.cjs","sourceRoot":"","sources":["../../../../../../src/commands/eval/__test__/browserify/good/snap.config.ts"],"names":[],"mappings":";;AAEA,MAAM,MAAM,GAAe;IACzB,OAAO,EAAE,YAAY;IACrB,UAAU,EAAE;QACV,MAAM,EAAE,WAAW;KACpB;CACF,CAAC;AAEF,kBAAe,MAAM,CAAC","sourcesContent":["import type { SnapConfig } from '../../../../../config';\n\nconst config: SnapConfig = {\n bundler: 'browserify',\n cliOptions: {\n bundle: './eval.js',\n },\n};\n\nexport default config;\n"]}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snap.config.d.cts","sourceRoot":"","sources":["../../../../../../src/commands/eval/__test__/browserify/good/snap.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kCAA8B;AAExD,QAAA,MAAM,MAAM,EAAE,UAKb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snap.config.d.mts","sourceRoot":"","sources":["../../../../../../src/commands/eval/__test__/browserify/good/snap.config.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,UAAU,EAAE,kCAA8B;AAExD,QAAA,MAAM,MAAM,EAAE,UAKb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"snap.config.mjs","sourceRoot":"","sources":["../../../../../../src/commands/eval/__test__/browserify/good/snap.config.ts"],"names":[],"mappings":"AAEA,MAAM,MAAM,GAAe;IACzB,OAAO,EAAE,YAAY;IACrB,UAAU,EAAE;QACV,MAAM,EAAE,WAAW;KACpB;CACF,CAAC;AAEF,eAAe,MAAM,CAAC","sourcesContent":["import type { SnapConfig } from '../../../../../config';\n\nconst config: SnapConfig = {\n bundler: 'browserify',\n cliOptions: {\n bundle: './eval.js',\n },\n};\n\nexport default config;\n"]}
|
package/dist/utils/legacy.cjs
DELETED
|
@@ -1,53 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.sanitizeDependencyPaths = exports.getDependencyRegExp = exports.processDependencies = void 0;
|
|
4
|
-
const builders_1 = require("../builders.cjs");
|
|
5
|
-
/**
|
|
6
|
-
* Get the dependencies to transpile, as well as the regular input file.
|
|
7
|
-
*
|
|
8
|
-
* If `transpilationMode` is not set to `localAndDeps`, this will return an
|
|
9
|
-
* empty array.
|
|
10
|
-
*
|
|
11
|
-
* @param config - The config object.
|
|
12
|
-
* @returns An array with regular expressions of dependencies that should be
|
|
13
|
-
* transpiled.
|
|
14
|
-
*/
|
|
15
|
-
function processDependencies(config) {
|
|
16
|
-
const { depsToTranspile, transpilationMode } = config;
|
|
17
|
-
if (transpilationMode === builders_1.TranspilationModes.LocalAndDeps) {
|
|
18
|
-
const regex = getDependencyRegExp(depsToTranspile);
|
|
19
|
-
if (regex !== null) {
|
|
20
|
-
return [regex];
|
|
21
|
-
}
|
|
22
|
-
}
|
|
23
|
-
return [];
|
|
24
|
-
}
|
|
25
|
-
exports.processDependencies = processDependencies;
|
|
26
|
-
/**
|
|
27
|
-
* Processes a string of space delimited dependencies into one RegExp string.
|
|
28
|
-
*
|
|
29
|
-
* @param dependencies - An array of dependencies to add to the RegExp.
|
|
30
|
-
* @returns A RegExp object.
|
|
31
|
-
*/
|
|
32
|
-
function getDependencyRegExp(dependencies) {
|
|
33
|
-
if (!dependencies || dependencies.includes('.') || !dependencies.length) {
|
|
34
|
-
return null;
|
|
35
|
-
}
|
|
36
|
-
const paths = sanitizeDependencyPaths(dependencies);
|
|
37
|
-
return RegExp(`/node_modules/(?!${paths.join('|')})`, 'u');
|
|
38
|
-
}
|
|
39
|
-
exports.getDependencyRegExp = getDependencyRegExp;
|
|
40
|
-
/**
|
|
41
|
-
* Helper function to remove any leading and trailing slashes from dependency
|
|
42
|
-
* list.
|
|
43
|
-
*
|
|
44
|
-
* @param dependencies - An array of dependencies to sanitize.
|
|
45
|
-
* @returns An array of sanitized paths.
|
|
46
|
-
*/
|
|
47
|
-
function sanitizeDependencyPaths(dependencies) {
|
|
48
|
-
return dependencies.map((dependency) => {
|
|
49
|
-
return dependency.replace(/^[/\\]+/u, '').replace(/[/\\]+$/u, '');
|
|
50
|
-
});
|
|
51
|
-
}
|
|
52
|
-
exports.sanitizeDependencyPaths = sanitizeDependencyPaths;
|
|
53
|
-
//# sourceMappingURL=legacy.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.cjs","sourceRoot":"","sources":["../../src/utils/legacy.ts"],"names":[],"mappings":";;;AAAA,8CAAiD;AAGjD;;;;;;;;;GASG;AACH,SAAgB,mBAAmB,CAAC,MAAqB;IACvD,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAAC;IACtD,IAAI,iBAAiB,KAAK,6BAAkB,CAAC,YAAY,EAAE,CAAC;QAC1D,MAAM,KAAK,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAVD,kDAUC;AAED;;;;;GAKG;AACH,SAAgB,mBAAmB,CAAC,YAAsB;IACxD,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,KAAK,GAAa,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAC9D,OAAO,MAAM,CAAC,oBAAoB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC7D,CAAC;AAPD,kDAOC;AAED;;;;;;GAMG;AACH,SAAgB,uBAAuB,CAAC,YAAsB;IAC5D,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QACrC,OAAO,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC;AAJD,0DAIC","sourcesContent":["import { TranspilationModes } from '../builders';\nimport type { LegacyOptions } from '../config';\n\n/**\n * Get the dependencies to transpile, as well as the regular input file.\n *\n * If `transpilationMode` is not set to `localAndDeps`, this will return an\n * empty array.\n *\n * @param config - The config object.\n * @returns An array with regular expressions of dependencies that should be\n * transpiled.\n */\nexport function processDependencies(config: LegacyOptions) {\n const { depsToTranspile, transpilationMode } = config;\n if (transpilationMode === TranspilationModes.LocalAndDeps) {\n const regex = getDependencyRegExp(depsToTranspile);\n if (regex !== null) {\n return [regex];\n }\n }\n\n return [];\n}\n\n/**\n * Processes a string of space delimited dependencies into one RegExp string.\n *\n * @param dependencies - An array of dependencies to add to the RegExp.\n * @returns A RegExp object.\n */\nexport function getDependencyRegExp(dependencies: string[]): RegExp | null {\n if (!dependencies || dependencies.includes('.') || !dependencies.length) {\n return null;\n }\n\n const paths: string[] = sanitizeDependencyPaths(dependencies);\n return RegExp(`/node_modules/(?!${paths.join('|')})`, 'u');\n}\n\n/**\n * Helper function to remove any leading and trailing slashes from dependency\n * list.\n *\n * @param dependencies - An array of dependencies to sanitize.\n * @returns An array of sanitized paths.\n */\nexport function sanitizeDependencyPaths(dependencies: string[]): string[] {\n return dependencies.map((dependency) => {\n return dependency.replace(/^[/\\\\]+/u, '').replace(/[/\\\\]+$/u, '');\n });\n}\n"]}
|
package/dist/utils/legacy.d.cts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { LegacyOptions } from "../config.cjs";
|
|
2
|
-
/**
|
|
3
|
-
* Get the dependencies to transpile, as well as the regular input file.
|
|
4
|
-
*
|
|
5
|
-
* If `transpilationMode` is not set to `localAndDeps`, this will return an
|
|
6
|
-
* empty array.
|
|
7
|
-
*
|
|
8
|
-
* @param config - The config object.
|
|
9
|
-
* @returns An array with regular expressions of dependencies that should be
|
|
10
|
-
* transpiled.
|
|
11
|
-
*/
|
|
12
|
-
export declare function processDependencies(config: LegacyOptions): RegExp[];
|
|
13
|
-
/**
|
|
14
|
-
* Processes a string of space delimited dependencies into one RegExp string.
|
|
15
|
-
*
|
|
16
|
-
* @param dependencies - An array of dependencies to add to the RegExp.
|
|
17
|
-
* @returns A RegExp object.
|
|
18
|
-
*/
|
|
19
|
-
export declare function getDependencyRegExp(dependencies: string[]): RegExp | null;
|
|
20
|
-
/**
|
|
21
|
-
* Helper function to remove any leading and trailing slashes from dependency
|
|
22
|
-
* list.
|
|
23
|
-
*
|
|
24
|
-
* @param dependencies - An array of dependencies to sanitize.
|
|
25
|
-
* @returns An array of sanitized paths.
|
|
26
|
-
*/
|
|
27
|
-
export declare function sanitizeDependencyPaths(dependencies: string[]): string[];
|
|
28
|
-
//# sourceMappingURL=legacy.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.d.cts","sourceRoot":"","sources":["../../src/utils/legacy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAkB;AAE/C;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,YAUxD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAOzE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAIxE"}
|
package/dist/utils/legacy.d.mts
DELETED
|
@@ -1,28 +0,0 @@
|
|
|
1
|
-
import type { LegacyOptions } from "../config.mjs";
|
|
2
|
-
/**
|
|
3
|
-
* Get the dependencies to transpile, as well as the regular input file.
|
|
4
|
-
*
|
|
5
|
-
* If `transpilationMode` is not set to `localAndDeps`, this will return an
|
|
6
|
-
* empty array.
|
|
7
|
-
*
|
|
8
|
-
* @param config - The config object.
|
|
9
|
-
* @returns An array with regular expressions of dependencies that should be
|
|
10
|
-
* transpiled.
|
|
11
|
-
*/
|
|
12
|
-
export declare function processDependencies(config: LegacyOptions): RegExp[];
|
|
13
|
-
/**
|
|
14
|
-
* Processes a string of space delimited dependencies into one RegExp string.
|
|
15
|
-
*
|
|
16
|
-
* @param dependencies - An array of dependencies to add to the RegExp.
|
|
17
|
-
* @returns A RegExp object.
|
|
18
|
-
*/
|
|
19
|
-
export declare function getDependencyRegExp(dependencies: string[]): RegExp | null;
|
|
20
|
-
/**
|
|
21
|
-
* Helper function to remove any leading and trailing slashes from dependency
|
|
22
|
-
* list.
|
|
23
|
-
*
|
|
24
|
-
* @param dependencies - An array of dependencies to sanitize.
|
|
25
|
-
* @returns An array of sanitized paths.
|
|
26
|
-
*/
|
|
27
|
-
export declare function sanitizeDependencyPaths(dependencies: string[]): string[];
|
|
28
|
-
//# sourceMappingURL=legacy.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.d.mts","sourceRoot":"","sources":["../../src/utils/legacy.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,aAAa,EAAE,sBAAkB;AAE/C;;;;;;;;;GASG;AACH,wBAAgB,mBAAmB,CAAC,MAAM,EAAE,aAAa,YAUxD;AAED;;;;;GAKG;AACH,wBAAgB,mBAAmB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,GAAG,IAAI,CAOzE;AAED;;;;;;GAMG;AACH,wBAAgB,uBAAuB,CAAC,YAAY,EAAE,MAAM,EAAE,GAAG,MAAM,EAAE,CAIxE"}
|
package/dist/utils/legacy.mjs
DELETED
|
@@ -1,47 +0,0 @@
|
|
|
1
|
-
import { TranspilationModes } from "../builders.mjs";
|
|
2
|
-
/**
|
|
3
|
-
* Get the dependencies to transpile, as well as the regular input file.
|
|
4
|
-
*
|
|
5
|
-
* If `transpilationMode` is not set to `localAndDeps`, this will return an
|
|
6
|
-
* empty array.
|
|
7
|
-
*
|
|
8
|
-
* @param config - The config object.
|
|
9
|
-
* @returns An array with regular expressions of dependencies that should be
|
|
10
|
-
* transpiled.
|
|
11
|
-
*/
|
|
12
|
-
export function processDependencies(config) {
|
|
13
|
-
const { depsToTranspile, transpilationMode } = config;
|
|
14
|
-
if (transpilationMode === TranspilationModes.LocalAndDeps) {
|
|
15
|
-
const regex = getDependencyRegExp(depsToTranspile);
|
|
16
|
-
if (regex !== null) {
|
|
17
|
-
return [regex];
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
return [];
|
|
21
|
-
}
|
|
22
|
-
/**
|
|
23
|
-
* Processes a string of space delimited dependencies into one RegExp string.
|
|
24
|
-
*
|
|
25
|
-
* @param dependencies - An array of dependencies to add to the RegExp.
|
|
26
|
-
* @returns A RegExp object.
|
|
27
|
-
*/
|
|
28
|
-
export function getDependencyRegExp(dependencies) {
|
|
29
|
-
if (!dependencies || dependencies.includes('.') || !dependencies.length) {
|
|
30
|
-
return null;
|
|
31
|
-
}
|
|
32
|
-
const paths = sanitizeDependencyPaths(dependencies);
|
|
33
|
-
return RegExp(`/node_modules/(?!${paths.join('|')})`, 'u');
|
|
34
|
-
}
|
|
35
|
-
/**
|
|
36
|
-
* Helper function to remove any leading and trailing slashes from dependency
|
|
37
|
-
* list.
|
|
38
|
-
*
|
|
39
|
-
* @param dependencies - An array of dependencies to sanitize.
|
|
40
|
-
* @returns An array of sanitized paths.
|
|
41
|
-
*/
|
|
42
|
-
export function sanitizeDependencyPaths(dependencies) {
|
|
43
|
-
return dependencies.map((dependency) => {
|
|
44
|
-
return dependency.replace(/^[/\\]+/u, '').replace(/[/\\]+$/u, '');
|
|
45
|
-
});
|
|
46
|
-
}
|
|
47
|
-
//# sourceMappingURL=legacy.mjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"legacy.mjs","sourceRoot":"","sources":["../../src/utils/legacy.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,kBAAkB,EAAE,wBAAoB;AAGjD;;;;;;;;;GASG;AACH,MAAM,UAAU,mBAAmB,CAAC,MAAqB;IACvD,MAAM,EAAE,eAAe,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAAC;IACtD,IAAI,iBAAiB,KAAK,kBAAkB,CAAC,YAAY,EAAE,CAAC;QAC1D,MAAM,KAAK,GAAG,mBAAmB,CAAC,eAAe,CAAC,CAAC;QACnD,IAAI,KAAK,KAAK,IAAI,EAAE,CAAC;YACnB,OAAO,CAAC,KAAK,CAAC,CAAC;QACjB,CAAC;IACH,CAAC;IAED,OAAO,EAAE,CAAC;AACZ,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,mBAAmB,CAAC,YAAsB;IACxD,IAAI,CAAC,YAAY,IAAI,YAAY,CAAC,QAAQ,CAAC,GAAG,CAAC,IAAI,CAAC,YAAY,CAAC,MAAM,EAAE,CAAC;QACxE,OAAO,IAAI,CAAC;IACd,CAAC;IAED,MAAM,KAAK,GAAa,uBAAuB,CAAC,YAAY,CAAC,CAAC;IAC9D,OAAO,MAAM,CAAC,oBAAoB,KAAK,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,GAAG,CAAC,CAAC;AAC7D,CAAC;AAED;;;;;;GAMG;AACH,MAAM,UAAU,uBAAuB,CAAC,YAAsB;IAC5D,OAAO,YAAY,CAAC,GAAG,CAAC,CAAC,UAAU,EAAE,EAAE;QACrC,OAAO,UAAU,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC,OAAO,CAAC,UAAU,EAAE,EAAE,CAAC,CAAC;IACpE,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { TranspilationModes } from '../builders';\nimport type { LegacyOptions } from '../config';\n\n/**\n * Get the dependencies to transpile, as well as the regular input file.\n *\n * If `transpilationMode` is not set to `localAndDeps`, this will return an\n * empty array.\n *\n * @param config - The config object.\n * @returns An array with regular expressions of dependencies that should be\n * transpiled.\n */\nexport function processDependencies(config: LegacyOptions) {\n const { depsToTranspile, transpilationMode } = config;\n if (transpilationMode === TranspilationModes.LocalAndDeps) {\n const regex = getDependencyRegExp(depsToTranspile);\n if (regex !== null) {\n return [regex];\n }\n }\n\n return [];\n}\n\n/**\n * Processes a string of space delimited dependencies into one RegExp string.\n *\n * @param dependencies - An array of dependencies to add to the RegExp.\n * @returns A RegExp object.\n */\nexport function getDependencyRegExp(dependencies: string[]): RegExp | null {\n if (!dependencies || dependencies.includes('.') || !dependencies.length) {\n return null;\n }\n\n const paths: string[] = sanitizeDependencyPaths(dependencies);\n return RegExp(`/node_modules/(?!${paths.join('|')})`, 'u');\n}\n\n/**\n * Helper function to remove any leading and trailing slashes from dependency\n * list.\n *\n * @param dependencies - An array of dependencies to sanitize.\n * @returns An array of sanitized paths.\n */\nexport function sanitizeDependencyPaths(dependencies: string[]): string[] {\n return dependencies.map((dependency) => {\n return dependency.replace(/^[/\\\\]+/u, '').replace(/[/\\\\]+$/u, '');\n });\n}\n"]}
|
|
@@ -1,84 +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
|
-
const browserify_1 = __importDefault(require("browserify"));
|
|
7
|
-
const readable_stream_1 = require("readable-stream");
|
|
8
|
-
const builders_1 = require("../../builders.cjs");
|
|
9
|
-
const utils_1 = require("../../utils/index.cjs");
|
|
10
|
-
const utils_2 = require("../utils.cjs");
|
|
11
|
-
/**
|
|
12
|
-
* A Browserify loader for Webpack. This exists for backwards compatibility with
|
|
13
|
-
* the legacy configuration format, in order to support the `bundlerCustomizer`
|
|
14
|
-
* function.
|
|
15
|
-
*
|
|
16
|
-
* When this loader is used, the input file will be processed by Browserify, and
|
|
17
|
-
* written to disk by Webpack. Most processing will be handled by Browserify, so
|
|
18
|
-
* there are no benefits like tree-shaking.
|
|
19
|
-
*
|
|
20
|
-
* @param content - The input file contents as a string.
|
|
21
|
-
* @param sourceMap - The source map of the input file.
|
|
22
|
-
* @returns The Browserify loader.
|
|
23
|
-
*/
|
|
24
|
-
const loader = async function (content, sourceMap) {
|
|
25
|
-
const config = this.getOptions();
|
|
26
|
-
const { transpilationMode } = config;
|
|
27
|
-
const bundler = (0, browserify_1.default)({
|
|
28
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
29
|
-
debug: Boolean(sourceMap),
|
|
30
|
-
standalone: '<snap>',
|
|
31
|
-
});
|
|
32
|
-
if (transpilationMode !== builders_1.TranspilationModes.None) {
|
|
33
|
-
const babelifyOptions = (0, utils_1.processDependencies)(config);
|
|
34
|
-
// We need to statically import all Browserify transforms, and all Babel
|
|
35
|
-
// presets and plugins, and calling `require` is the sanest way to do that.
|
|
36
|
-
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */
|
|
37
|
-
bundler.transform(require("babelify/index.js"), {
|
|
38
|
-
global: transpilationMode === builders_1.TranspilationModes.LocalAndDeps,
|
|
39
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
40
|
-
presets: [
|
|
41
|
-
require("@babel/preset-typescript"),
|
|
42
|
-
[
|
|
43
|
-
require("@babel/preset-env"),
|
|
44
|
-
{
|
|
45
|
-
targets: {
|
|
46
|
-
browsers: await (0, utils_2.getBrowserslistTargets)(),
|
|
47
|
-
},
|
|
48
|
-
},
|
|
49
|
-
],
|
|
50
|
-
],
|
|
51
|
-
plugins: [
|
|
52
|
-
require("@babel/plugin-transform-runtime"),
|
|
53
|
-
require("@babel/plugin-transform-class-properties"),
|
|
54
|
-
require("@babel/plugin-transform-private-methods"),
|
|
55
|
-
require("@babel/plugin-transform-class-static-block"),
|
|
56
|
-
require("@babel/plugin-transform-private-property-in-object"),
|
|
57
|
-
],
|
|
58
|
-
...babelifyOptions,
|
|
59
|
-
});
|
|
60
|
-
/* eslint-enable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */
|
|
61
|
-
}
|
|
62
|
-
config.bundlerCustomizer?.(bundler);
|
|
63
|
-
// Browserify doesn't accept a string as an entry point, so we need to convert
|
|
64
|
-
// it to a stream.
|
|
65
|
-
const stream = new readable_stream_1.Readable();
|
|
66
|
-
stream.push(content);
|
|
67
|
-
stream.push(null);
|
|
68
|
-
bundler.add(stream, {
|
|
69
|
-
file: this.resourcePath,
|
|
70
|
-
});
|
|
71
|
-
return new Promise((resolve, reject) => {
|
|
72
|
-
bundler.bundle((bundleError, buffer) => {
|
|
73
|
-
if (bundleError) {
|
|
74
|
-
reject(bundleError);
|
|
75
|
-
return;
|
|
76
|
-
}
|
|
77
|
-
// Browserify inlines the source map, so we just pass the output buffer back
|
|
78
|
-
// to Webpack.
|
|
79
|
-
resolve(buffer);
|
|
80
|
-
});
|
|
81
|
-
});
|
|
82
|
-
};
|
|
83
|
-
exports.default = loader;
|
|
84
|
-
//# sourceMappingURL=browserify.cjs.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browserify.cjs","sourceRoot":"","sources":["../../../src/webpack/loaders/browserify.ts"],"names":[],"mappings":";;;;;AAAA,4DAAoC;AACpC,qDAA2C;AAG3C,iDAAoD;AAEpD,iDAAkD;AAClD,wCAAkD;AAElD;;;;;;;;;;;;GAYG;AACH,MAAM,MAAM,GAA4C,KAAK,WAC3D,OAAO,EACP,SAAS;IAET,MAAM,MAAM,GAAG,IAAI,CAAC,UAAU,EAAE,CAAC;IAEjC,MAAM,EAAE,iBAAiB,EAAE,GAAG,MAAM,CAAC;IAErC,MAAM,OAAO,GAAG,IAAA,oBAAU,EAAC;QACzB,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;QAC1C,KAAK,EAAE,OAAO,CAAC,SAAS,CAAC;QACzB,UAAU,EAAE,QAAQ;KACrB,CAAC,CAAC;IAEH,IAAI,iBAAiB,KAAK,6BAAkB,CAAC,IAAI,EAAE,CAAC;QAClD,MAAM,eAAe,GAAG,IAAA,2BAAmB,EAAC,MAAM,CAAC,CAAC;QAEpD,wEAAwE;QACxE,2EAA2E;QAC3E,gHAAgH;QAChH,OAAO,CAAC,SAAS,CAAC,OAAO,qBAAY,EAAE;YACrC,MAAM,EAAE,iBAAiB,KAAK,6BAAkB,CAAC,YAAY;YAC7D,UAAU,EAAE,CAAC,KAAK,EAAE,MAAM,EAAE,KAAK,EAAE,MAAM,CAAC;YAC1C,OAAO,EAAE;gBACP,OAAO,4BAA4B;gBACnC;oBACE,OAAO,qBAAqB;oBAC5B;wBACE,OAAO,EAAE;4BACP,QAAQ,EAAE,MAAM,IAAA,8BAAsB,GAAE;yBACzC;qBACF;iBACF;aACF;YACD,OAAO,EAAE;gBACP,OAAO,mCAAmC;gBAC1C,OAAO,4CAA4C;gBACnD,OAAO,2CAA2C;gBAClD,OAAO,8CAA8C;gBACrD,OAAO,sDAAsD;aAC9D;YACD,GAAI,eAAuB;SAC5B,CAAC,CAAC;QACH,+GAA+G;IACjH,CAAC;IAED,MAAM,CAAC,iBAAiB,EAAE,CAAC,OAAO,CAAC,CAAC;IAEpC,8EAA8E;IAC9E,kBAAkB;IAClB,MAAM,MAAM,GAAG,IAAI,0BAAQ,EAAE,CAAC;IAC9B,MAAM,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;IACrB,MAAM,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;IAElB,OAAO,CAAC,GAAG,CAAC,MAAM,EAAE;QAClB,IAAI,EAAE,IAAI,CAAC,YAAY;KACxB,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAS,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC7C,OAAO,CAAC,MAAM,CAAC,CAAC,WAAW,EAAE,MAAc,EAAE,EAAE;YAC7C,IAAI,WAAW,EAAE,CAAC;gBAChB,MAAM,CAAC,WAAW,CAAC,CAAC;gBACpB,OAAO;YACT,CAAC;YAED,4EAA4E;YAC5E,cAAc;YACd,OAAO,CAAC,MAAM,CAAC,CAAC;QAClB,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC,CAAC;AAEF,kBAAe,MAAM,CAAC","sourcesContent":["import browserify from 'browserify';\nimport { Readable } from 'readable-stream';\nimport type { LoaderDefinitionFunction } from 'webpack';\n\nimport { TranspilationModes } from '../../builders';\nimport type { LegacyOptions } from '../../config';\nimport { processDependencies } from '../../utils';\nimport { getBrowserslistTargets } from '../utils';\n\n/**\n * A Browserify loader for Webpack. This exists for backwards compatibility with\n * the legacy configuration format, in order to support the `bundlerCustomizer`\n * function.\n *\n * When this loader is used, the input file will be processed by Browserify, and\n * written to disk by Webpack. Most processing will be handled by Browserify, so\n * there are no benefits like tree-shaking.\n *\n * @param content - The input file contents as a string.\n * @param sourceMap - The source map of the input file.\n * @returns The Browserify loader.\n */\nconst loader: LoaderDefinitionFunction<LegacyOptions> = async function (\n content,\n sourceMap,\n) {\n const config = this.getOptions();\n\n const { transpilationMode } = config;\n\n const bundler = browserify({\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n debug: Boolean(sourceMap),\n standalone: '<snap>',\n });\n\n if (transpilationMode !== TranspilationModes.None) {\n const babelifyOptions = processDependencies(config);\n\n // We need to statically import all Browserify transforms, and all Babel\n // presets 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, n/global-require */\n bundler.transform(require('babelify'), {\n global: transpilationMode === TranspilationModes.LocalAndDeps,\n extensions: ['.js', '.jsx', '.ts', '.tsx'],\n presets: [\n require('@babel/preset-typescript'),\n [\n require('@babel/preset-env'),\n {\n targets: {\n browsers: await getBrowserslistTargets(),\n },\n },\n ],\n ],\n plugins: [\n require('@babel/plugin-transform-runtime'),\n require('@babel/plugin-transform-class-properties'),\n require('@babel/plugin-transform-private-methods'),\n require('@babel/plugin-transform-class-static-block'),\n require('@babel/plugin-transform-private-property-in-object'),\n ],\n ...(babelifyOptions as any),\n });\n /* eslint-enable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */\n }\n\n config.bundlerCustomizer?.(bundler);\n\n // Browserify doesn't accept a string as an entry point, so we need to convert\n // it to a stream.\n const stream = new Readable();\n stream.push(content);\n stream.push(null);\n\n bundler.add(stream, {\n file: this.resourcePath,\n });\n\n return new Promise<Buffer>((resolve, reject) => {\n bundler.bundle((bundleError, buffer: Buffer) => {\n if (bundleError) {\n reject(bundleError);\n return;\n }\n\n // Browserify inlines the source map, so we just pass the output buffer back\n // to Webpack.\n resolve(buffer);\n });\n });\n};\n\nexport default loader;\n"]}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { LoaderDefinitionFunction } from "webpack";
|
|
2
|
-
import type { LegacyOptions } from "../../config.cjs";
|
|
3
|
-
/**
|
|
4
|
-
* A Browserify loader for Webpack. This exists for backwards compatibility with
|
|
5
|
-
* the legacy configuration format, in order to support the `bundlerCustomizer`
|
|
6
|
-
* function.
|
|
7
|
-
*
|
|
8
|
-
* When this loader is used, the input file will be processed by Browserify, and
|
|
9
|
-
* written to disk by Webpack. Most processing will be handled by Browserify, so
|
|
10
|
-
* there are no benefits like tree-shaking.
|
|
11
|
-
*
|
|
12
|
-
* @param content - The input file contents as a string.
|
|
13
|
-
* @param sourceMap - The source map of the input file.
|
|
14
|
-
* @returns The Browserify loader.
|
|
15
|
-
*/
|
|
16
|
-
declare const loader: LoaderDefinitionFunction<LegacyOptions>;
|
|
17
|
-
export default loader;
|
|
18
|
-
//# sourceMappingURL=browserify.d.cts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browserify.d.cts","sourceRoot":"","sources":["../../../src/webpack/loaders/browserify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB;AAGxD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAqB;AAIlD;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,MAAM,EAAE,wBAAwB,CAAC,aAAa,CAsEnD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,18 +0,0 @@
|
|
|
1
|
-
import type { LoaderDefinitionFunction } from "webpack";
|
|
2
|
-
import type { LegacyOptions } from "../../config.mjs";
|
|
3
|
-
/**
|
|
4
|
-
* A Browserify loader for Webpack. This exists for backwards compatibility with
|
|
5
|
-
* the legacy configuration format, in order to support the `bundlerCustomizer`
|
|
6
|
-
* function.
|
|
7
|
-
*
|
|
8
|
-
* When this loader is used, the input file will be processed by Browserify, and
|
|
9
|
-
* written to disk by Webpack. Most processing will be handled by Browserify, so
|
|
10
|
-
* there are no benefits like tree-shaking.
|
|
11
|
-
*
|
|
12
|
-
* @param content - The input file contents as a string.
|
|
13
|
-
* @param sourceMap - The source map of the input file.
|
|
14
|
-
* @returns The Browserify loader.
|
|
15
|
-
*/
|
|
16
|
-
declare const loader: LoaderDefinitionFunction<LegacyOptions>;
|
|
17
|
-
export default loader;
|
|
18
|
-
//# sourceMappingURL=browserify.d.mts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"browserify.d.mts","sourceRoot":"","sources":["../../../src/webpack/loaders/browserify.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,wBAAwB,EAAE,gBAAgB;AAGxD,OAAO,KAAK,EAAE,aAAa,EAAE,yBAAqB;AAIlD;;;;;;;;;;;;GAYG;AACH,QAAA,MAAM,MAAM,EAAE,wBAAwB,CAAC,aAAa,CAsEnD,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { createRequire as $createRequire } from "module";
|
|
2
|
-
const $require = $createRequire(import.meta.url);
|
|
3
|
-
function $importDefault(module) {
|
|
4
|
-
if (module?.__esModule) {
|
|
5
|
-
return module.default;
|
|
6
|
-
}
|
|
7
|
-
return module;
|
|
8
|
-
}
|
|
9
|
-
import $browserify from "browserify";
|
|
10
|
-
const browserify = $importDefault($browserify);
|
|
11
|
-
import { Readable } from "readable-stream";
|
|
12
|
-
import { TranspilationModes } from "../../builders.mjs";
|
|
13
|
-
import { processDependencies } from "../../utils/index.mjs";
|
|
14
|
-
import { getBrowserslistTargets } from "../utils.mjs";
|
|
15
|
-
/**
|
|
16
|
-
* A Browserify loader for Webpack. This exists for backwards compatibility with
|
|
17
|
-
* the legacy configuration format, in order to support the `bundlerCustomizer`
|
|
18
|
-
* function.
|
|
19
|
-
*
|
|
20
|
-
* When this loader is used, the input file will be processed by Browserify, and
|
|
21
|
-
* written to disk by Webpack. Most processing will be handled by Browserify, so
|
|
22
|
-
* there are no benefits like tree-shaking.
|
|
23
|
-
*
|
|
24
|
-
* @param content - The input file contents as a string.
|
|
25
|
-
* @param sourceMap - The source map of the input file.
|
|
26
|
-
* @returns The Browserify loader.
|
|
27
|
-
*/
|
|
28
|
-
const loader = async function (content, sourceMap) {
|
|
29
|
-
const config = this.getOptions();
|
|
30
|
-
const { transpilationMode } = config;
|
|
31
|
-
const bundler = browserify({
|
|
32
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
33
|
-
debug: Boolean(sourceMap),
|
|
34
|
-
standalone: '<snap>',
|
|
35
|
-
});
|
|
36
|
-
if (transpilationMode !== TranspilationModes.None) {
|
|
37
|
-
const babelifyOptions = processDependencies(config);
|
|
38
|
-
// We need to statically import all Browserify transforms, and all Babel
|
|
39
|
-
// presets and plugins, and calling `require` is the sanest way to do that.
|
|
40
|
-
/* eslint-disable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */
|
|
41
|
-
bundler.transform($require("babelify/index.js"), {
|
|
42
|
-
global: transpilationMode === TranspilationModes.LocalAndDeps,
|
|
43
|
-
extensions: ['.js', '.jsx', '.ts', '.tsx'],
|
|
44
|
-
presets: [
|
|
45
|
-
$require("@babel/preset-typescript"),
|
|
46
|
-
[
|
|
47
|
-
$require("@babel/preset-env"),
|
|
48
|
-
{
|
|
49
|
-
targets: {
|
|
50
|
-
browsers: await getBrowserslistTargets(),
|
|
51
|
-
},
|
|
52
|
-
},
|
|
53
|
-
],
|
|
54
|
-
],
|
|
55
|
-
plugins: [
|
|
56
|
-
$require("@babel/plugin-transform-runtime"),
|
|
57
|
-
$require("@babel/plugin-transform-class-properties"),
|
|
58
|
-
$require("@babel/plugin-transform-private-methods"),
|
|
59
|
-
$require("@babel/plugin-transform-class-static-block"),
|
|
60
|
-
$require("@babel/plugin-transform-private-property-in-object"),
|
|
61
|
-
],
|
|
62
|
-
...babelifyOptions,
|
|
63
|
-
});
|
|
64
|
-
/* eslint-enable @typescript-eslint/no-require-imports, @typescript-eslint/no-var-requires, n/global-require */
|
|
65
|
-
}
|
|
66
|
-
config.bundlerCustomizer?.(bundler);
|
|
67
|
-
// Browserify doesn't accept a string as an entry point, so we need to convert
|
|
68
|
-
// it to a stream.
|
|
69
|
-
const stream = new Readable();
|
|
70
|
-
stream.push(content);
|
|
71
|
-
stream.push(null);
|
|
72
|
-
bundler.add(stream, {
|
|
73
|
-
file: this.resourcePath,
|
|
74
|
-
});
|
|
75
|
-
return new Promise((resolve, reject) => {
|
|
76
|
-
bundler.bundle((bundleError, buffer) => {
|
|
77
|
-
if (bundleError) {
|
|
78
|
-
reject(bundleError);
|
|
79
|
-
return;
|
|
80
|
-
}
|
|
81
|
-
// Browserify inlines the source map, so we just pass the output buffer back
|
|
82
|
-
// to Webpack.
|
|
83
|
-
resolve(buffer);
|
|
84
|
-
});
|
|
85
|
-
});
|
|
86
|
-
};
|
|
87
|
-
export default loader;
|
|
88
|
-
//# sourceMappingURL=browserify.mjs.map
|