@metamask/snaps-cli 6.1.0 → 6.2.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.
Files changed (89) hide show
  1. package/CHANGELOG.md +14 -1
  2. package/dist/{chunk-RJ6IKKA2.js → chunk-2ZBAKBVW.js} +3 -3
  3. package/dist/{chunk-C2OMV3H5.js → chunk-4JEJ7WKR.js} +3 -3
  4. package/dist/{chunk-WUC7DUXN.mjs → chunk-6ABGZTV7.mjs} +2 -2
  5. package/dist/{chunk-V4UPOVEH.js → chunk-7H5FH7RY.js} +3 -3
  6. package/dist/{chunk-IO6WNNPF.mjs → chunk-AQSQ7YYP.mjs} +2 -2
  7. package/dist/{chunk-BVPROOGE.mjs → chunk-BAEGXYL7.mjs} +2 -2
  8. package/dist/{chunk-76IQAFYR.mjs → chunk-CZRGAFVI.mjs} +2 -2
  9. package/dist/{chunk-EHJPVBQU.js → chunk-H6BLS7BI.js} +5 -5
  10. package/dist/{chunk-XQGKSVFJ.js → chunk-HLQEI6DV.js} +3 -3
  11. package/dist/{chunk-JBSWMUCQ.mjs → chunk-HOVEQTF3.mjs} +2 -2
  12. package/dist/{chunk-AO724LXX.mjs → chunk-KWHAT6UJ.mjs} +2 -2
  13. package/dist/{chunk-RM5FN3N5.js → chunk-MECBOP7G.js} +3 -3
  14. package/dist/{chunk-FQ3HKVHQ.mjs → chunk-MR5TAGOG.mjs} +2 -2
  15. package/dist/{chunk-BFX2RH3M.js → chunk-MXOKUCLH.js} +35 -19
  16. package/dist/chunk-MXOKUCLH.js.map +1 -0
  17. package/dist/{chunk-SM2JEXE6.mjs → chunk-NOBUMOYX.mjs} +2 -2
  18. package/dist/{chunk-ZOC4OHGM.js → chunk-QMB2ZRWW.js} +3 -3
  19. package/dist/{chunk-VIQIUSXW.mjs → chunk-QRW2GKA3.mjs} +23 -7
  20. package/dist/chunk-QRW2GKA3.mjs.map +1 -0
  21. package/dist/{chunk-CQZ2AXMG.js → chunk-RANTKN66.js} +3 -3
  22. package/dist/{chunk-T4CLBV7F.mjs → chunk-SK5KZWVS.mjs} +3 -3
  23. package/dist/{chunk-JEMJNDZO.js → chunk-SQXMNT7M.js} +37 -4
  24. package/dist/chunk-SQXMNT7M.js.map +1 -0
  25. package/dist/{chunk-OGGTU5W6.mjs → chunk-V6SYDSWM.mjs} +37 -4
  26. package/dist/chunk-V6SYDSWM.mjs.map +1 -0
  27. package/dist/{chunk-HNWSVD35.js → chunk-YCOC4VEP.js} +10 -10
  28. package/dist/commands/build/build.js +7 -7
  29. package/dist/commands/build/build.mjs +6 -6
  30. package/dist/commands/build/implementation.js +6 -6
  31. package/dist/commands/build/implementation.mjs +5 -5
  32. package/dist/commands/build/index.js +8 -8
  33. package/dist/commands/build/index.mjs +7 -7
  34. package/dist/commands/index.js +12 -12
  35. package/dist/commands/index.mjs +11 -11
  36. package/dist/commands/serve/index.js +4 -4
  37. package/dist/commands/serve/index.mjs +4 -4
  38. package/dist/commands/serve/serve.js +4 -4
  39. package/dist/commands/serve/serve.mjs +4 -4
  40. package/dist/commands/watch/implementation.js +6 -6
  41. package/dist/commands/watch/implementation.mjs +5 -5
  42. package/dist/commands/watch/index.js +8 -8
  43. package/dist/commands/watch/index.mjs +7 -7
  44. package/dist/commands/watch/watch.js +7 -7
  45. package/dist/commands/watch/watch.mjs +6 -6
  46. package/dist/index.js +5 -5
  47. package/dist/index.mjs +4 -4
  48. package/dist/main.js +12 -12
  49. package/dist/main.mjs +11 -11
  50. package/dist/tsconfig.build.tsbuildinfo +1 -1
  51. package/dist/types/config.d.ts +16 -16
  52. package/dist/types/webpack/utils.d.ts +33 -0
  53. package/dist/webpack/compiler.js +5 -5
  54. package/dist/webpack/compiler.mjs +4 -4
  55. package/dist/webpack/config.js +4 -4
  56. package/dist/webpack/config.mjs +3 -3
  57. package/dist/webpack/index.js +5 -5
  58. package/dist/webpack/index.mjs +4 -4
  59. package/dist/webpack/loaders/browserify.js +2 -2
  60. package/dist/webpack/loaders/browserify.mjs +1 -1
  61. package/dist/webpack/loaders/index.js +2 -2
  62. package/dist/webpack/loaders/index.mjs +1 -1
  63. package/dist/webpack/plugins.js +3 -3
  64. package/dist/webpack/plugins.mjs +2 -2
  65. package/dist/webpack/utils.js +2 -2
  66. package/dist/webpack/utils.mjs +1 -1
  67. package/package.json +3 -3
  68. package/dist/chunk-BFX2RH3M.js.map +0 -1
  69. package/dist/chunk-JEMJNDZO.js.map +0 -1
  70. package/dist/chunk-OGGTU5W6.mjs.map +0 -1
  71. package/dist/chunk-VIQIUSXW.mjs.map +0 -1
  72. /package/dist/{chunk-RJ6IKKA2.js.map → chunk-2ZBAKBVW.js.map} +0 -0
  73. /package/dist/{chunk-C2OMV3H5.js.map → chunk-4JEJ7WKR.js.map} +0 -0
  74. /package/dist/{chunk-WUC7DUXN.mjs.map → chunk-6ABGZTV7.mjs.map} +0 -0
  75. /package/dist/{chunk-V4UPOVEH.js.map → chunk-7H5FH7RY.js.map} +0 -0
  76. /package/dist/{chunk-IO6WNNPF.mjs.map → chunk-AQSQ7YYP.mjs.map} +0 -0
  77. /package/dist/{chunk-BVPROOGE.mjs.map → chunk-BAEGXYL7.mjs.map} +0 -0
  78. /package/dist/{chunk-76IQAFYR.mjs.map → chunk-CZRGAFVI.mjs.map} +0 -0
  79. /package/dist/{chunk-EHJPVBQU.js.map → chunk-H6BLS7BI.js.map} +0 -0
  80. /package/dist/{chunk-XQGKSVFJ.js.map → chunk-HLQEI6DV.js.map} +0 -0
  81. /package/dist/{chunk-JBSWMUCQ.mjs.map → chunk-HOVEQTF3.mjs.map} +0 -0
  82. /package/dist/{chunk-AO724LXX.mjs.map → chunk-KWHAT6UJ.mjs.map} +0 -0
  83. /package/dist/{chunk-RM5FN3N5.js.map → chunk-MECBOP7G.js.map} +0 -0
  84. /package/dist/{chunk-FQ3HKVHQ.mjs.map → chunk-MR5TAGOG.mjs.map} +0 -0
  85. /package/dist/{chunk-SM2JEXE6.mjs.map → chunk-NOBUMOYX.mjs.map} +0 -0
  86. /package/dist/{chunk-ZOC4OHGM.js.map → chunk-QMB2ZRWW.js.map} +0 -0
  87. /package/dist/{chunk-CQZ2AXMG.js.map → chunk-RANTKN66.js.map} +0 -0
  88. /package/dist/{chunk-T4CLBV7F.mjs.map → chunk-SK5KZWVS.mjs.map} +0 -0
  89. /package/dist/{chunk-HNWSVD35.js.map → chunk-YCOC4VEP.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkXQGKSVFJjs = require('./chunk-XQGKSVFJ.js');
3
+ var _chunkHLQEI6DVjs = require('./chunk-HLQEI6DV.js');
4
4
 
5
5
 
6
6
  var _chunkS7UP2YYFjs = require('./chunk-S7UP2YYF.js');
@@ -12,7 +12,7 @@ var command = {
12
12
  builder: (yarg) => {
13
13
  yarg.option("src", _chunkS7UP2YYFjs.builders_default.src).option("eval", _chunkS7UP2YYFjs.builders_default.eval).option("dist", _chunkS7UP2YYFjs.builders_default.dist).option("outfileName", _chunkS7UP2YYFjs.builders_default.outfileName).option("sourceMaps", _chunkS7UP2YYFjs.builders_default.sourceMaps).option("stripComments", _chunkS7UP2YYFjs.builders_default.stripComments).option("transpilationMode", _chunkS7UP2YYFjs.builders_default.transpilationMode).option("depsToTranspile", _chunkS7UP2YYFjs.builders_default.depsToTranspile).option("manifest", _chunkS7UP2YYFjs.builders_default.manifest).option("writeManifest", _chunkS7UP2YYFjs.builders_default.writeManifest).option("serve", _chunkS7UP2YYFjs.builders_default.serve).option("root", _chunkS7UP2YYFjs.builders_default.root).option("port", _chunkS7UP2YYFjs.builders_default.port).implies("writeManifest", "manifest").implies("depsToTranspile", "transpilationMode");
14
14
  },
15
- handler: async (argv) => _chunkXQGKSVFJjs.watchHandler.call(void 0, argv.context.config, {
15
+ handler: async (argv) => _chunkHLQEI6DVjs.watchHandler.call(void 0, argv.context.config, {
16
16
  port: argv.port
17
17
  })
18
18
  };
@@ -21,4 +21,4 @@ var watch_default = command;
21
21
 
22
22
 
23
23
  exports.watch_default = watch_default;
24
- //# sourceMappingURL=chunk-CQZ2AXMG.js.map
24
+ //# sourceMappingURL=chunk-RANTKN66.js.map
@@ -1,9 +1,9 @@
1
1
  import {
2
2
  watch_default
3
- } from "./chunk-IO6WNNPF.mjs";
3
+ } from "./chunk-AQSQ7YYP.mjs";
4
4
  import {
5
5
  build_default
6
- } from "./chunk-AO724LXX.mjs";
6
+ } from "./chunk-KWHAT6UJ.mjs";
7
7
  import {
8
8
  manifest_default
9
9
  } from "./chunk-G3COWLG5.mjs";
@@ -27,4 +27,4 @@ var commands_default = commands;
27
27
  export {
28
28
  commands_default
29
29
  };
30
- //# sourceMappingURL=chunk-T4CLBV7F.mjs.map
30
+ //# sourceMappingURL=chunk-SK5KZWVS.mjs.map
@@ -23,7 +23,7 @@ var loader = async function(content, sourceMap) {
23
23
  const config = this.getOptions();
24
24
  const { transpilationMode } = config;
25
25
  const bundler = _browserify2.default.call(void 0, {
26
- extensions: [".js", ".ts"],
26
+ extensions: [".js", ".jsx", ".ts", ".tsx"],
27
27
  debug: Boolean(sourceMap),
28
28
  standalone: "<snap>"
29
29
  });
@@ -31,7 +31,7 @@ var loader = async function(content, sourceMap) {
31
31
  const babelifyOptions = _chunkPDYQXXLPjs.processDependencies.call(void 0, config);
32
32
  bundler.transform(_chunkX3D3MHWFjs.__require.call(void 0, "babelify"), {
33
33
  global: transpilationMode === "localAndDeps" /* LocalAndDeps */,
34
- extensions: [".js", ".ts"],
34
+ extensions: [".js", ".jsx", ".ts", ".tsx"],
35
35
  presets: [
36
36
  _chunkX3D3MHWFjs.__require.call(void 0, "@babel/preset-typescript"),
37
37
  [
@@ -154,7 +154,40 @@ async function getDefaultLoader({
154
154
  *
155
155
  * @see https://swc.rs/docs/configuration/compilation#jscparser
156
156
  */
157
- syntax: "typescript"
157
+ syntax: "typescript",
158
+ /**
159
+ * This tells the parser to transpile JSX.
160
+ *
161
+ * @see https://swc.rs/docs/configuration/compilation#jscparser
162
+ * @see https://swc.rs/docs/configuration/compilation#jscparserjsx
163
+ */
164
+ tsx: true
165
+ },
166
+ transform: {
167
+ react: {
168
+ /**
169
+ * This tells SWC to use the JSX runtime, instead of the
170
+ * `createElement` function.
171
+ *
172
+ * @see https://swc.rs/docs/configuration/compilation#jsctransformreact
173
+ */
174
+ runtime: "automatic",
175
+ /**
176
+ * This tells SWC to import the JSX runtime from the
177
+ * `@metamask/snaps-sdk` package, instead of the default React
178
+ * package.
179
+ *
180
+ * @see https://swc.rs/docs/configuration/compilation#jsctransformreact
181
+ */
182
+ importSource: "@metamask/snaps-sdk",
183
+ /**
184
+ * This tells SWC to use `Object.assign` and `Object.create` for
185
+ * JSX spread attributes, instead of the default behavior.
186
+ *
187
+ * @see https://swc.rs/docs/configuration/compilation#jsctransformreact
188
+ */
189
+ useBuiltins: true
190
+ }
158
191
  }
159
192
  },
160
193
  /**
@@ -290,4 +323,4 @@ function getImageSVG(mimeType, bytes) {
290
323
 
291
324
 
292
325
  exports.BROWSERSLIST_FILE = BROWSERSLIST_FILE; exports.WEBPACK_FALLBACKS = WEBPACK_FALLBACKS; exports.getDefaultLoader = getDefaultLoader; exports.getDevTool = getDevTool; exports.getProgressHandler = getProgressHandler; exports.getBrowserslistTargets = getBrowserslistTargets; exports.pluralize = pluralize; exports.getFallbacks = getFallbacks; exports.getEnvironmentVariables = getEnvironmentVariables; exports.formatText = formatText; exports.getImageSVG = getImageSVG; exports.browserify_default = browserify_default;
293
- //# sourceMappingURL=chunk-JEMJNDZO.js.map
326
+ //# sourceMappingURL=chunk-SQXMNT7M.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/webpack/utils.ts","../src/webpack/loaders/browserify.ts"],"names":["resolve"],"mappings":";;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,WAAW;AACpB,SAAS,YAAY,UAAU;AAC/B,SAAS,sBAAsB;AAE/B,SAAS,SAAS,eAAe;AACjC,OAAO,eAAe;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from 'fs';\nimport { builtinModules } from 'module';\nimport type { Ora } from 'ora';\nimport { dirname, resolve } from 'path';\nimport stripAnsi from 'strip-ansi';\nimport type { Configuration } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport { browserify, getFunctionLoader } from './loaders';\n\nexport const BROWSERSLIST_FILE = resolve(\n dirname(\n // eslint-disable-next-line n/no-extraneous-require\n require.resolve('@metamask/snaps-cli/package.json'),\n ),\n '.browserslistrc',\n);\n\nexport const WEBPACK_FALLBACKS = {\n assert: require.resolve('assert/'),\n buffer: require.resolve('buffer/'),\n console: require.resolve('console-browserify'),\n constants: require.resolve('constants-browserify'),\n crypto: require.resolve('crypto-browserify'),\n domain: require.resolve('domain-browser'),\n events: require.resolve('events/'),\n http: require.resolve('stream-http'),\n https: require.resolve('https-browserify'),\n os: require.resolve('os-browserify/browser'),\n path: require.resolve('path-browserify'),\n punycode: require.resolve('punycode/'),\n process: require.resolve('process/browser'),\n querystring: require.resolve('querystring-es3'),\n stream: require.resolve('stream-browserify'),\n /* eslint-disable @typescript-eslint/naming-convention */\n _stream_duplex: require.resolve('readable-stream/lib/_stream_duplex'),\n _stream_passthrough: require.resolve(\n 'readable-stream/lib/_stream_passthrough',\n ),\n _stream_readable: require.resolve('readable-stream/lib/_stream_readable'),\n _stream_transform: require.resolve('readable-stream/lib/_stream_transform'),\n _stream_writable: require.resolve('readable-stream/lib/_stream_writable'),\n string_decoder: require.resolve('string_decoder/'),\n /* eslint-enable @typescript-eslint/naming-convention */\n sys: require.resolve('util/'),\n timers: require.resolve('timers-browserify'),\n tty: require.resolve('tty-browserify'),\n url: require.resolve('url/'),\n util: require.resolve('util/'),\n vm: require.resolve('vm-browserify'),\n zlib: require.resolve('browserify-zlib'),\n};\n\n/**\n * Get the default loader for JavaScript and TypeScript files, based on the\n * config object.\n *\n * - If the `legacy` option is set, we use the custom `browserify` loader. This\n * uses the legacy Browserify config to transpile the code.\n * - Otherwise, we use the `swc-loader`. This is a Webpack loader that uses the\n * `SWC` compiler, which is a much faster alternative to Babel and TypeScript's\n * own compiler.\n *\n * @param config - The processed snap Webpack config.\n * @param config.legacy - The legacy config object, if any.\n * @param config.sourceMap - Whether to generate source maps.\n * @see https://swc.rs/docs/usage/swc-loader\n * @returns The default loader.\n */\nexport async function getDefaultLoader({\n legacy,\n sourceMap,\n}: ProcessedWebpackConfig) {\n if (legacy) {\n /**\n * If the snap uses the legacy config, we use the custom `browserify`\n * loader. This uses the legacy Browserify config to transpile the code.\n * This is necessary for backwards compatibility with the\n * `bundlerCustomizer` function.\n */\n return getFunctionLoader(browserify, legacy);\n }\n\n const targets = await getBrowserslistTargets();\n return {\n /**\n * We use the `swc-loader` to transpile TypeScript and JavaScript files.\n * This is a Webpack loader that uses the `SWC` compiler, which is a much\n * faster alternative to Babel and TypeScript's own compiler.\n */\n loader: require.resolve('swc-loader'),\n\n /**\n * The options for the `swc-loader`. These can be overridden in the\n * `.swcrc` file.\n *\n * @see https://swc.rs/docs/configuration/swcrc\n */\n options: {\n sync: false,\n\n /**\n * This tells SWC to generate source maps. We set it to the\n * `sourceMap` value from the config object.\n *\n * This must be enabled if source maps are enabled in the config.\n */\n sourceMaps: Boolean(getDevTool(sourceMap)),\n\n jsc: {\n parser: {\n /**\n * This tells the parser to parse TypeScript files. If you\n * don't need to support TypeScript, you can set this to\n * `ecmascript` instead, but there's no harm in leaving it\n * as `typescript`.\n *\n * @see https://swc.rs/docs/configuration/compilation#jscparser\n */\n syntax: 'typescript',\n\n /**\n * This tells the parser to transpile JSX.\n *\n * @see https://swc.rs/docs/configuration/compilation#jscparser\n * @see https://swc.rs/docs/configuration/compilation#jscparserjsx\n */\n tsx: true,\n },\n\n transform: {\n react: {\n /**\n * This tells SWC to use the JSX runtime, instead of the\n * `createElement` function.\n *\n * @see https://swc.rs/docs/configuration/compilation#jsctransformreact\n */\n runtime: 'automatic',\n\n /**\n * This tells SWC to import the JSX runtime from the\n * `@metamask/snaps-sdk` package, instead of the default React\n * package.\n *\n * @see https://swc.rs/docs/configuration/compilation#jsctransformreact\n */\n importSource: '@metamask/snaps-sdk',\n\n /**\n * This tells SWC to use `Object.assign` and `Object.create` for\n * JSX spread attributes, instead of the default behavior.\n *\n * @see https://swc.rs/docs/configuration/compilation#jsctransformreact\n */\n useBuiltins: true,\n },\n },\n },\n\n /**\n * The module configuration. This tells SWC how to output the\n * transpiled code.\n *\n * @see https://swc.rs/docs/configuration/modules\n */\n module: {\n /**\n * This tells SWC to output ES6 modules. This will allow Webpack to\n * optimize the output code better. Snaps don't support ES6 however, so\n * the output code will be transpiled to CommonJS by Webpack later in\n * the build process.\n *\n * @see https://swc.rs/docs/configuration/modules#es6\n */\n type: 'es6',\n },\n\n env: {\n targets: targets.join(', '),\n },\n },\n };\n}\n\n/**\n * Get the Webpack devtool configuration based on the given snap config.\n *\n * - If `sourceMap` is `inline`, return `inline-source-map`.\n * - If `sourceMap` is `true`, return `source-map`.\n * - Otherwise, return `false`.\n *\n * @param sourceMap - The `sourceMap` value from the snap config.\n * @returns The Webpack devtool configuration.\n */\nexport function getDevTool(\n sourceMap: ProcessedWebpackConfig['sourceMap'],\n): Configuration['devtool'] {\n if (sourceMap === 'inline') {\n return 'inline-source-map';\n }\n\n if (sourceMap === true) {\n return 'source-map';\n }\n\n return false;\n}\n\n/**\n * Get a function that can be used as handler function for Webpack's\n * `ProgressPlugin`.\n *\n * @param spinner - The spinner to update.\n * @param spinnerText - The initial spinner text. This will be prepended to the\n * percentage.\n * @returns A function that can be used as handler function for Webpack's\n * `ProgressPlugin`.\n */\n// Note: This is extracted for testing purposes.\nexport function getProgressHandler(spinner?: Ora, spinnerText?: string) {\n return (percentage: number) => {\n if (spinner && spinnerText) {\n spinner.text = `${spinnerText} ${dim(\n `(${Math.round(percentage * 100)}%)`,\n )}`;\n }\n };\n}\n\n/**\n * Get the targets from the `.browserslistrc` file.\n *\n * @returns The browser targets as an array of strings.\n */\nexport async function getBrowserslistTargets() {\n const contents = await fs.readFile(BROWSERSLIST_FILE, 'utf8');\n return contents\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line && !line.startsWith('#'));\n}\n\n/**\n * Get a singular or plural string based on the given count. This is useful for\n * generating messages like \"1 error\" or \"2 errors\". By default, the plural\n * string is the singular string with an \"s\" appended to it.\n *\n * This assumes that the text is in English, and likely won't work for some\n * other languages.\n *\n * @param count - The count.\n * @param singular - The singular string.\n * @param plural - The plural string.\n * @returns The singular or plural string.\n * @example\n * ```typescript\n * pluralize(1, 'error'); // => 'error'\n * pluralize(2, 'error'); // => 'errors'\n * pluralize(1, 'error', 'problem'); // => 'error'\n * pluralize(2, 'error', 'problems'); // => 'problems'\n * ```\n */\nexport function pluralize(\n count: number,\n singular: string,\n plural = `${singular}s`,\n) {\n return count === 1 ? singular : plural;\n}\n\n/**\n * Get an object that can be used as fallback config for Webpack's\n * `fallback` config.\n *\n * @param polyfills - The polyfill object from the snap config.\n * @returns The webpack fallback config.\n */\nexport function getFallbacks(polyfills: ProcessedWebpackConfig['polyfills']): {\n [index: string]: string | false;\n} {\n if (polyfills === true) {\n return Object.fromEntries(\n builtinModules.map((name) => [\n name,\n WEBPACK_FALLBACKS[name as keyof typeof WEBPACK_FALLBACKS] ?? false,\n ]),\n );\n }\n\n if (polyfills === false) {\n return Object.fromEntries(builtinModules.map((name) => [name, false]));\n }\n\n return Object.fromEntries(\n builtinModules.map((name) => [\n name,\n polyfills[name as keyof ProcessedWebpackConfig['polyfills']]\n ? WEBPACK_FALLBACKS[name as keyof typeof WEBPACK_FALLBACKS]\n : false,\n ]),\n );\n}\n\n/**\n * Get an object that can be used as environment variables for Webpack's\n * `DefinePlugin`.\n *\n * @param environment - The environment object from the Snap config.\n * @param defaults - The default environment variables.\n * @returns The Webpack environment variables.\n */\nexport function getEnvironmentVariables(\n environment: Record<string, unknown>,\n defaults = {\n NODE_DEBUG: 'false',\n NODE_ENV: 'production',\n DEBUG: 'false',\n },\n) {\n return Object.fromEntries(\n Object.entries({\n ...defaults,\n ...environment,\n }).map(([key, value]) => [`process.env.${key}`, JSON.stringify(value)]),\n );\n}\n\n/**\n * Format the given line to fit within the terminal width.\n *\n * @param line - The line to format.\n * @param indent - The indentation to use.\n * @param initialIndent - The initial indentation to use, i.e., the indentation\n * for the first line.\n * @returns The formatted line.\n */\nfunction formatLine(line: string, indent: number, initialIndent: number) {\n const terminalWidth = process.stdout.columns;\n if (!terminalWidth) {\n return `${' '.repeat(initialIndent)}${line}`;\n }\n\n return line.split(' ').reduce(\n ({ formattedText, currentLineLength }, word, index) => {\n // `chalk` adds ANSI escape codes to the text, which are not visible\n // characters. We need to strip them to get the visible length of the\n // text.\n const visibleWord = stripAnsi(word);\n\n // Determine if a space should be added before the word.\n const spaceBeforeWord = index > 0 ? ' ' : '';\n const wordLengthWithSpace = visibleWord.length + spaceBeforeWord.length;\n\n // If the word would exceed the terminal width, start a new line.\n if (currentLineLength + wordLengthWithSpace > terminalWidth) {\n return {\n formattedText: `${formattedText}\\n${' '.repeat(indent)}${word}`,\n currentLineLength: indent + visibleWord.length,\n };\n }\n\n // Otherwise, add the word to the current line.\n return {\n formattedText: formattedText + spaceBeforeWord + word,\n currentLineLength: currentLineLength + wordLengthWithSpace,\n };\n },\n {\n formattedText: ' '.repeat(initialIndent),\n currentLineLength: initialIndent,\n },\n ).formattedText;\n}\n\n/**\n * Format the given text to fit within the terminal width.\n *\n * @param text - The text to format.\n * @param indent - The indentation to use.\n * @param initialIndent - The initial indentation to use, i.e., the indentation\n * for the first line.\n * @returns The formatted text.\n */\nexport function formatText(\n text: string,\n indent: number,\n initialIndent = indent,\n) {\n const lines = text.split('\\n');\n\n // Apply formatting to each line separately and then join them.\n return lines\n .map((line, index) => {\n const lineIndent = index === 0 ? initialIndent : indent;\n return formatLine(line, indent, lineIndent);\n })\n .join('\\n');\n}\n\n/**\n * Get an SVG from the given bytes and mime type.\n *\n * @param mimeType - The mime type of the image.\n * @param bytes - The image bytes.\n * @returns The SVG.\n */\nexport function getImageSVG(mimeType: string, bytes: Uint8Array) {\n const dataUrl = `data:${mimeType};base64,${bytesToBase64(bytes)}`;\n return `<svg xmlns=\"http://www.w3.org/2000/svg\"><image href=\"${dataUrl}\" /></svg>`;\n}\n","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 */\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"]}
@@ -23,7 +23,7 @@ var loader = async function(content, sourceMap) {
23
23
  const config = this.getOptions();
24
24
  const { transpilationMode } = config;
25
25
  const bundler = browserify({
26
- extensions: [".js", ".ts"],
26
+ extensions: [".js", ".jsx", ".ts", ".tsx"],
27
27
  debug: Boolean(sourceMap),
28
28
  standalone: "<snap>"
29
29
  });
@@ -31,7 +31,7 @@ var loader = async function(content, sourceMap) {
31
31
  const babelifyOptions = processDependencies(config);
32
32
  bundler.transform(__require("babelify"), {
33
33
  global: transpilationMode === "localAndDeps" /* LocalAndDeps */,
34
- extensions: [".js", ".ts"],
34
+ extensions: [".js", ".jsx", ".ts", ".tsx"],
35
35
  presets: [
36
36
  __require("@babel/preset-typescript"),
37
37
  [
@@ -154,7 +154,40 @@ async function getDefaultLoader({
154
154
  *
155
155
  * @see https://swc.rs/docs/configuration/compilation#jscparser
156
156
  */
157
- syntax: "typescript"
157
+ syntax: "typescript",
158
+ /**
159
+ * This tells the parser to transpile JSX.
160
+ *
161
+ * @see https://swc.rs/docs/configuration/compilation#jscparser
162
+ * @see https://swc.rs/docs/configuration/compilation#jscparserjsx
163
+ */
164
+ tsx: true
165
+ },
166
+ transform: {
167
+ react: {
168
+ /**
169
+ * This tells SWC to use the JSX runtime, instead of the
170
+ * `createElement` function.
171
+ *
172
+ * @see https://swc.rs/docs/configuration/compilation#jsctransformreact
173
+ */
174
+ runtime: "automatic",
175
+ /**
176
+ * This tells SWC to import the JSX runtime from the
177
+ * `@metamask/snaps-sdk` package, instead of the default React
178
+ * package.
179
+ *
180
+ * @see https://swc.rs/docs/configuration/compilation#jsctransformreact
181
+ */
182
+ importSource: "@metamask/snaps-sdk",
183
+ /**
184
+ * This tells SWC to use `Object.assign` and `Object.create` for
185
+ * JSX spread attributes, instead of the default behavior.
186
+ *
187
+ * @see https://swc.rs/docs/configuration/compilation#jsctransformreact
188
+ */
189
+ useBuiltins: true
190
+ }
158
191
  }
159
192
  },
160
193
  /**
@@ -290,4 +323,4 @@ export {
290
323
  getImageSVG,
291
324
  browserify_default
292
325
  };
293
- //# sourceMappingURL=chunk-OGGTU5W6.mjs.map
326
+ //# sourceMappingURL=chunk-V6SYDSWM.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/webpack/utils.ts","../src/webpack/loaders/browserify.ts"],"sourcesContent":["import { bytesToBase64 } from '@metamask/utils';\nimport { dim } from 'chalk';\nimport { promises as fs } from 'fs';\nimport { builtinModules } from 'module';\nimport type { Ora } from 'ora';\nimport { dirname, resolve } from 'path';\nimport stripAnsi from 'strip-ansi';\nimport type { Configuration } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport { browserify, getFunctionLoader } from './loaders';\n\nexport const BROWSERSLIST_FILE = resolve(\n dirname(\n // eslint-disable-next-line n/no-extraneous-require\n require.resolve('@metamask/snaps-cli/package.json'),\n ),\n '.browserslistrc',\n);\n\nexport const WEBPACK_FALLBACKS = {\n assert: require.resolve('assert/'),\n buffer: require.resolve('buffer/'),\n console: require.resolve('console-browserify'),\n constants: require.resolve('constants-browserify'),\n crypto: require.resolve('crypto-browserify'),\n domain: require.resolve('domain-browser'),\n events: require.resolve('events/'),\n http: require.resolve('stream-http'),\n https: require.resolve('https-browserify'),\n os: require.resolve('os-browserify/browser'),\n path: require.resolve('path-browserify'),\n punycode: require.resolve('punycode/'),\n process: require.resolve('process/browser'),\n querystring: require.resolve('querystring-es3'),\n stream: require.resolve('stream-browserify'),\n /* eslint-disable @typescript-eslint/naming-convention */\n _stream_duplex: require.resolve('readable-stream/lib/_stream_duplex'),\n _stream_passthrough: require.resolve(\n 'readable-stream/lib/_stream_passthrough',\n ),\n _stream_readable: require.resolve('readable-stream/lib/_stream_readable'),\n _stream_transform: require.resolve('readable-stream/lib/_stream_transform'),\n _stream_writable: require.resolve('readable-stream/lib/_stream_writable'),\n string_decoder: require.resolve('string_decoder/'),\n /* eslint-enable @typescript-eslint/naming-convention */\n sys: require.resolve('util/'),\n timers: require.resolve('timers-browserify'),\n tty: require.resolve('tty-browserify'),\n url: require.resolve('url/'),\n util: require.resolve('util/'),\n vm: require.resolve('vm-browserify'),\n zlib: require.resolve('browserify-zlib'),\n};\n\n/**\n * Get the default loader for JavaScript and TypeScript files, based on the\n * config object.\n *\n * - If the `legacy` option is set, we use the custom `browserify` loader. This\n * uses the legacy Browserify config to transpile the code.\n * - Otherwise, we use the `swc-loader`. This is a Webpack loader that uses the\n * `SWC` compiler, which is a much faster alternative to Babel and TypeScript's\n * own compiler.\n *\n * @param config - The processed snap Webpack config.\n * @param config.legacy - The legacy config object, if any.\n * @param config.sourceMap - Whether to generate source maps.\n * @see https://swc.rs/docs/usage/swc-loader\n * @returns The default loader.\n */\nexport async function getDefaultLoader({\n legacy,\n sourceMap,\n}: ProcessedWebpackConfig) {\n if (legacy) {\n /**\n * If the snap uses the legacy config, we use the custom `browserify`\n * loader. This uses the legacy Browserify config to transpile the code.\n * This is necessary for backwards compatibility with the\n * `bundlerCustomizer` function.\n */\n return getFunctionLoader(browserify, legacy);\n }\n\n const targets = await getBrowserslistTargets();\n return {\n /**\n * We use the `swc-loader` to transpile TypeScript and JavaScript files.\n * This is a Webpack loader that uses the `SWC` compiler, which is a much\n * faster alternative to Babel and TypeScript's own compiler.\n */\n loader: require.resolve('swc-loader'),\n\n /**\n * The options for the `swc-loader`. These can be overridden in the\n * `.swcrc` file.\n *\n * @see https://swc.rs/docs/configuration/swcrc\n */\n options: {\n sync: false,\n\n /**\n * This tells SWC to generate source maps. We set it to the\n * `sourceMap` value from the config object.\n *\n * This must be enabled if source maps are enabled in the config.\n */\n sourceMaps: Boolean(getDevTool(sourceMap)),\n\n jsc: {\n parser: {\n /**\n * This tells the parser to parse TypeScript files. If you\n * don't need to support TypeScript, you can set this to\n * `ecmascript` instead, but there's no harm in leaving it\n * as `typescript`.\n *\n * @see https://swc.rs/docs/configuration/compilation#jscparser\n */\n syntax: 'typescript',\n\n /**\n * This tells the parser to transpile JSX.\n *\n * @see https://swc.rs/docs/configuration/compilation#jscparser\n * @see https://swc.rs/docs/configuration/compilation#jscparserjsx\n */\n tsx: true,\n },\n\n transform: {\n react: {\n /**\n * This tells SWC to use the JSX runtime, instead of the\n * `createElement` function.\n *\n * @see https://swc.rs/docs/configuration/compilation#jsctransformreact\n */\n runtime: 'automatic',\n\n /**\n * This tells SWC to import the JSX runtime from the\n * `@metamask/snaps-sdk` package, instead of the default React\n * package.\n *\n * @see https://swc.rs/docs/configuration/compilation#jsctransformreact\n */\n importSource: '@metamask/snaps-sdk',\n\n /**\n * This tells SWC to use `Object.assign` and `Object.create` for\n * JSX spread attributes, instead of the default behavior.\n *\n * @see https://swc.rs/docs/configuration/compilation#jsctransformreact\n */\n useBuiltins: true,\n },\n },\n },\n\n /**\n * The module configuration. This tells SWC how to output the\n * transpiled code.\n *\n * @see https://swc.rs/docs/configuration/modules\n */\n module: {\n /**\n * This tells SWC to output ES6 modules. This will allow Webpack to\n * optimize the output code better. Snaps don't support ES6 however, so\n * the output code will be transpiled to CommonJS by Webpack later in\n * the build process.\n *\n * @see https://swc.rs/docs/configuration/modules#es6\n */\n type: 'es6',\n },\n\n env: {\n targets: targets.join(', '),\n },\n },\n };\n}\n\n/**\n * Get the Webpack devtool configuration based on the given snap config.\n *\n * - If `sourceMap` is `inline`, return `inline-source-map`.\n * - If `sourceMap` is `true`, return `source-map`.\n * - Otherwise, return `false`.\n *\n * @param sourceMap - The `sourceMap` value from the snap config.\n * @returns The Webpack devtool configuration.\n */\nexport function getDevTool(\n sourceMap: ProcessedWebpackConfig['sourceMap'],\n): Configuration['devtool'] {\n if (sourceMap === 'inline') {\n return 'inline-source-map';\n }\n\n if (sourceMap === true) {\n return 'source-map';\n }\n\n return false;\n}\n\n/**\n * Get a function that can be used as handler function for Webpack's\n * `ProgressPlugin`.\n *\n * @param spinner - The spinner to update.\n * @param spinnerText - The initial spinner text. This will be prepended to the\n * percentage.\n * @returns A function that can be used as handler function for Webpack's\n * `ProgressPlugin`.\n */\n// Note: This is extracted for testing purposes.\nexport function getProgressHandler(spinner?: Ora, spinnerText?: string) {\n return (percentage: number) => {\n if (spinner && spinnerText) {\n spinner.text = `${spinnerText} ${dim(\n `(${Math.round(percentage * 100)}%)`,\n )}`;\n }\n };\n}\n\n/**\n * Get the targets from the `.browserslistrc` file.\n *\n * @returns The browser targets as an array of strings.\n */\nexport async function getBrowserslistTargets() {\n const contents = await fs.readFile(BROWSERSLIST_FILE, 'utf8');\n return contents\n .split('\\n')\n .map((line) => line.trim())\n .filter((line) => line && !line.startsWith('#'));\n}\n\n/**\n * Get a singular or plural string based on the given count. This is useful for\n * generating messages like \"1 error\" or \"2 errors\". By default, the plural\n * string is the singular string with an \"s\" appended to it.\n *\n * This assumes that the text is in English, and likely won't work for some\n * other languages.\n *\n * @param count - The count.\n * @param singular - The singular string.\n * @param plural - The plural string.\n * @returns The singular or plural string.\n * @example\n * ```typescript\n * pluralize(1, 'error'); // => 'error'\n * pluralize(2, 'error'); // => 'errors'\n * pluralize(1, 'error', 'problem'); // => 'error'\n * pluralize(2, 'error', 'problems'); // => 'problems'\n * ```\n */\nexport function pluralize(\n count: number,\n singular: string,\n plural = `${singular}s`,\n) {\n return count === 1 ? singular : plural;\n}\n\n/**\n * Get an object that can be used as fallback config for Webpack's\n * `fallback` config.\n *\n * @param polyfills - The polyfill object from the snap config.\n * @returns The webpack fallback config.\n */\nexport function getFallbacks(polyfills: ProcessedWebpackConfig['polyfills']): {\n [index: string]: string | false;\n} {\n if (polyfills === true) {\n return Object.fromEntries(\n builtinModules.map((name) => [\n name,\n WEBPACK_FALLBACKS[name as keyof typeof WEBPACK_FALLBACKS] ?? false,\n ]),\n );\n }\n\n if (polyfills === false) {\n return Object.fromEntries(builtinModules.map((name) => [name, false]));\n }\n\n return Object.fromEntries(\n builtinModules.map((name) => [\n name,\n polyfills[name as keyof ProcessedWebpackConfig['polyfills']]\n ? WEBPACK_FALLBACKS[name as keyof typeof WEBPACK_FALLBACKS]\n : false,\n ]),\n );\n}\n\n/**\n * Get an object that can be used as environment variables for Webpack's\n * `DefinePlugin`.\n *\n * @param environment - The environment object from the Snap config.\n * @param defaults - The default environment variables.\n * @returns The Webpack environment variables.\n */\nexport function getEnvironmentVariables(\n environment: Record<string, unknown>,\n defaults = {\n NODE_DEBUG: 'false',\n NODE_ENV: 'production',\n DEBUG: 'false',\n },\n) {\n return Object.fromEntries(\n Object.entries({\n ...defaults,\n ...environment,\n }).map(([key, value]) => [`process.env.${key}`, JSON.stringify(value)]),\n );\n}\n\n/**\n * Format the given line to fit within the terminal width.\n *\n * @param line - The line to format.\n * @param indent - The indentation to use.\n * @param initialIndent - The initial indentation to use, i.e., the indentation\n * for the first line.\n * @returns The formatted line.\n */\nfunction formatLine(line: string, indent: number, initialIndent: number) {\n const terminalWidth = process.stdout.columns;\n if (!terminalWidth) {\n return `${' '.repeat(initialIndent)}${line}`;\n }\n\n return line.split(' ').reduce(\n ({ formattedText, currentLineLength }, word, index) => {\n // `chalk` adds ANSI escape codes to the text, which are not visible\n // characters. We need to strip them to get the visible length of the\n // text.\n const visibleWord = stripAnsi(word);\n\n // Determine if a space should be added before the word.\n const spaceBeforeWord = index > 0 ? ' ' : '';\n const wordLengthWithSpace = visibleWord.length + spaceBeforeWord.length;\n\n // If the word would exceed the terminal width, start a new line.\n if (currentLineLength + wordLengthWithSpace > terminalWidth) {\n return {\n formattedText: `${formattedText}\\n${' '.repeat(indent)}${word}`,\n currentLineLength: indent + visibleWord.length,\n };\n }\n\n // Otherwise, add the word to the current line.\n return {\n formattedText: formattedText + spaceBeforeWord + word,\n currentLineLength: currentLineLength + wordLengthWithSpace,\n };\n },\n {\n formattedText: ' '.repeat(initialIndent),\n currentLineLength: initialIndent,\n },\n ).formattedText;\n}\n\n/**\n * Format the given text to fit within the terminal width.\n *\n * @param text - The text to format.\n * @param indent - The indentation to use.\n * @param initialIndent - The initial indentation to use, i.e., the indentation\n * for the first line.\n * @returns The formatted text.\n */\nexport function formatText(\n text: string,\n indent: number,\n initialIndent = indent,\n) {\n const lines = text.split('\\n');\n\n // Apply formatting to each line separately and then join them.\n return lines\n .map((line, index) => {\n const lineIndent = index === 0 ? initialIndent : indent;\n return formatLine(line, indent, lineIndent);\n })\n .join('\\n');\n}\n\n/**\n * Get an SVG from the given bytes and mime type.\n *\n * @param mimeType - The mime type of the image.\n * @param bytes - The image bytes.\n * @returns The SVG.\n */\nexport function getImageSVG(mimeType: string, bytes: Uint8Array) {\n const dataUrl = `data:${mimeType};base64,${bytesToBase64(bytes)}`;\n return `<svg xmlns=\"http://www.w3.org/2000/svg\"><image href=\"${dataUrl}\" /></svg>`;\n}\n","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 */\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"],"mappings":";;;;;;;;;;;AAAA,SAAS,qBAAqB;AAC9B,SAAS,WAAW;AACpB,SAAS,YAAY,UAAU;AAC/B,SAAS,sBAAsB;AAE/B,SAAS,SAAS,eAAe;AACjC,OAAO,eAAe;;;ACNtB,OAAO,gBAAgB;AACvB,SAAS,gBAAgB;AAoBzB,IAAM,SAAkD,eACtD,SACA,WACA;AACA,QAAM,SAAS,KAAK,WAAW;AAE/B,QAA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
8
 
9
9
 
10
10
  var _chunkB3NNVTA6js = require('./chunk-B3NNVTA6.js');
@@ -61,10 +61,10 @@ var SnapsStatsPlugin = class {
61
61
  if (errors?.length) {
62
62
  const formattedErrors = errors.map((statsError) => _chunkX3D3MHWFjs.__privateMethod.call(void 0, this, _getStatsErrorMessage, getStatsErrorMessage_fn).call(this, statsError)).join("\n\n");
63
63
  _chunkTJ2F3J6Xjs.error.call(void 0,
64
- `Compiled ${modules.length} ${_chunkJEMJNDZOjs.pluralize.call(void 0,
64
+ `Compiled ${modules.length} ${_chunkSQXMNT7Mjs.pluralize.call(void 0,
65
65
  modules.length,
66
66
  "file"
67
- )} in ${time}ms with ${errors.length} ${_chunkJEMJNDZOjs.pluralize.call(void 0,
67
+ )} in ${time}ms with ${errors.length} ${_chunkSQXMNT7Mjs.pluralize.call(void 0,
68
68
  errors.length,
69
69
  "error"
70
70
  )}.
@@ -82,10 +82,10 @@ ${formattedErrors}
82
82
  (statsWarning) => _chunkX3D3MHWFjs.__privateMethod.call(void 0, this, _getStatsErrorMessage, getStatsErrorMessage_fn).call(this, statsWarning, _chalk.yellow)
83
83
  ).join("\n\n");
84
84
  _chunkTJ2F3J6Xjs.warn.call(void 0,
85
- `Compiled ${modules.length} ${_chunkJEMJNDZOjs.pluralize.call(void 0,
85
+ `Compiled ${modules.length} ${_chunkSQXMNT7Mjs.pluralize.call(void 0,
86
86
  modules.length,
87
87
  "file"
88
- )} in ${time}ms with ${warnings.length} ${_chunkJEMJNDZOjs.pluralize.call(void 0,
88
+ )} in ${time}ms with ${warnings.length} ${_chunkSQXMNT7Mjs.pluralize.call(void 0,
89
89
  warnings.length,
90
90
  "warning"
91
91
  )}.
@@ -96,7 +96,7 @@ ${formattedWarnings}
96
96
  );
97
97
  } else {
98
98
  _chunkTJ2F3J6Xjs.info.call(void 0,
99
- `Compiled ${modules.length} ${_chunkJEMJNDZOjs.pluralize.call(void 0,
99
+ `Compiled ${modules.length} ${_chunkSQXMNT7Mjs.pluralize.call(void 0,
100
100
  modules.length,
101
101
  "file"
102
102
  )} in ${time}ms.`,
@@ -115,10 +115,10 @@ getStatsErrorMessage_fn = function(statsError, color = _chalk.red) {
115
115
  const baseMessage = this.options.verbose ? _chunkB3NNVTA6js.getErrorMessage.call(void 0, statsError) : statsError.message;
116
116
  const [first, ...rest] = baseMessage.split("\n");
117
117
  return [
118
- color(_chunkJEMJNDZOjs.formatText.call(void 0, `\u2022 ${first}`, 4, 2)),
119
- ...rest.map((message) => _chunkJEMJNDZOjs.formatText.call(void 0, color(message), 4)),
118
+ color(_chunkSQXMNT7Mjs.formatText.call(void 0, `\u2022 ${first}`, 4, 2)),
119
+ ...rest.map((message) => _chunkSQXMNT7Mjs.formatText.call(void 0, color(message), 4)),
120
120
  statsError.details && `
121
- ${_chunkJEMJNDZOjs.formatText.call(void 0, _chalk.dim.call(void 0, statsError.details), 6)}`
121
+ ${_chunkSQXMNT7Mjs.formatText.call(void 0, _chalk.dim.call(void 0, statsError.details), 6)}`
122
122
  ].filter(Boolean).join("\n");
123
123
  };
124
124
  var _spinner2, _safeEvaluate, safeEvaluate_fn;
@@ -343,4 +343,4 @@ checkBuffer_fn = function(compiler) {
343
343
 
344
344
 
345
345
  exports.SnapsStatsPlugin = SnapsStatsPlugin; exports.SnapsWatchPlugin = SnapsWatchPlugin; exports.SnapsBuiltInResolver = SnapsBuiltInResolver; exports.SnapsBundleWarningsPlugin = SnapsBundleWarningsPlugin;
346
- //# sourceMappingURL=chunk-HNWSVD35.js.map
346
+ //# sourceMappingURL=chunk-YCOC4VEP.js.map
@@ -1,16 +1,16 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkC2OMV3H5js = require('../../chunk-C2OMV3H5.js');
4
- require('../../chunk-RJ6IKKA2.js');
3
+ var _chunk4JEJ7WKRjs = require('../../chunk-4JEJ7WKR.js');
4
+ require('../../chunk-2ZBAKBVW.js');
5
5
  require('../../chunk-VXOV3ZCB.js');
6
- require('../../chunk-ZOC4OHGM.js');
7
- require('../../chunk-BFX2RH3M.js');
8
- require('../../chunk-HNWSVD35.js');
6
+ require('../../chunk-QMB2ZRWW.js');
7
+ require('../../chunk-MXOKUCLH.js');
8
+ require('../../chunk-YCOC4VEP.js');
9
9
  require('../../chunk-6EEZHGF5.js');
10
10
  require('../../chunk-KLOPX6DO.js');
11
11
  require('../../chunk-MUYXNION.js');
12
12
  require('../../chunk-YGEAZQSC.js');
13
- require('../../chunk-JEMJNDZO.js');
13
+ require('../../chunk-SQXMNT7M.js');
14
14
  require('../../chunk-QHCKVO3P.js');
15
15
  require('../../chunk-YQ2E7NEA.js');
16
16
  require('../../chunk-4QUVE3EK.js');
@@ -25,5 +25,5 @@ require('../../chunk-BALQOCUO.js');
25
25
  require('../../chunk-X3D3MHWF.js');
26
26
 
27
27
 
28
- exports.buildHandler = _chunkC2OMV3H5js.buildHandler;
28
+ exports.buildHandler = _chunk4JEJ7WKRjs.buildHandler;
29
29
  //# sourceMappingURL=build.js.map
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  buildHandler
3
- } from "../../chunk-SM2JEXE6.mjs";
4
- import "../../chunk-76IQAFYR.mjs";
3
+ } from "../../chunk-NOBUMOYX.mjs";
4
+ import "../../chunk-CZRGAFVI.mjs";
5
5
  import "../../chunk-45LOTCC4.mjs";
6
- import "../../chunk-WUC7DUXN.mjs";
7
- import "../../chunk-VIQIUSXW.mjs";
8
- import "../../chunk-JBSWMUCQ.mjs";
6
+ import "../../chunk-6ABGZTV7.mjs";
7
+ import "../../chunk-QRW2GKA3.mjs";
8
+ import "../../chunk-HOVEQTF3.mjs";
9
9
  import "../../chunk-BYNQODL3.mjs";
10
10
  import "../../chunk-K26BOY6Z.mjs";
11
11
  import "../../chunk-3WWFQLH4.mjs";
12
12
  import "../../chunk-SYRWT2KT.mjs";
13
- import "../../chunk-OGGTU5W6.mjs";
13
+ import "../../chunk-V6SYDSWM.mjs";
14
14
  import "../../chunk-AZMQTZXZ.mjs";
15
15
  import "../../chunk-ERSRIVYH.mjs";
16
16
  import "../../chunk-JL3URCHO.mjs";
@@ -1,15 +1,15 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkRJ6IKKA2js = require('../../chunk-RJ6IKKA2.js');
3
+ var _chunk2ZBAKBVWjs = require('../../chunk-2ZBAKBVW.js');
4
4
  require('../../chunk-VXOV3ZCB.js');
5
- require('../../chunk-ZOC4OHGM.js');
6
- require('../../chunk-BFX2RH3M.js');
7
- require('../../chunk-HNWSVD35.js');
5
+ require('../../chunk-QMB2ZRWW.js');
6
+ require('../../chunk-MXOKUCLH.js');
7
+ require('../../chunk-YCOC4VEP.js');
8
8
  require('../../chunk-6EEZHGF5.js');
9
9
  require('../../chunk-KLOPX6DO.js');
10
10
  require('../../chunk-MUYXNION.js');
11
11
  require('../../chunk-YGEAZQSC.js');
12
- require('../../chunk-JEMJNDZO.js');
12
+ require('../../chunk-SQXMNT7M.js');
13
13
  require('../../chunk-QHCKVO3P.js');
14
14
  require('../../chunk-YQ2E7NEA.js');
15
15
  require('../../chunk-4QUVE3EK.js');
@@ -24,5 +24,5 @@ require('../../chunk-BALQOCUO.js');
24
24
  require('../../chunk-X3D3MHWF.js');
25
25
 
26
26
 
27
- exports.build = _chunkRJ6IKKA2js.build;
27
+ exports.build = _chunk2ZBAKBVWjs.build;
28
28
  //# sourceMappingURL=implementation.js.map
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  build
3
- } from "../../chunk-76IQAFYR.mjs";
3
+ } from "../../chunk-CZRGAFVI.mjs";
4
4
  import "../../chunk-45LOTCC4.mjs";
5
- import "../../chunk-WUC7DUXN.mjs";
6
- import "../../chunk-VIQIUSXW.mjs";
7
- import "../../chunk-JBSWMUCQ.mjs";
5
+ import "../../chunk-6ABGZTV7.mjs";
6
+ import "../../chunk-QRW2GKA3.mjs";
7
+ import "../../chunk-HOVEQTF3.mjs";
8
8
  import "../../chunk-BYNQODL3.mjs";
9
9
  import "../../chunk-K26BOY6Z.mjs";
10
10
  import "../../chunk-3WWFQLH4.mjs";
11
11
  import "../../chunk-SYRWT2KT.mjs";
12
- import "../../chunk-OGGTU5W6.mjs";
12
+ import "../../chunk-V6SYDSWM.mjs";
13
13
  import "../../chunk-AZMQTZXZ.mjs";
14
14
  import "../../chunk-ERSRIVYH.mjs";
15
15
  import "../../chunk-JL3URCHO.mjs";
@@ -1,19 +1,19 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkV4UPOVEHjs = require('../../chunk-V4UPOVEH.js');
4
- require('../../chunk-C2OMV3H5.js');
3
+ var _chunk7H5FH7RYjs = require('../../chunk-7H5FH7RY.js');
4
+ require('../../chunk-4JEJ7WKR.js');
5
5
 
6
6
 
7
- var _chunkRJ6IKKA2js = require('../../chunk-RJ6IKKA2.js');
7
+ var _chunk2ZBAKBVWjs = require('../../chunk-2ZBAKBVW.js');
8
8
  require('../../chunk-VXOV3ZCB.js');
9
- require('../../chunk-ZOC4OHGM.js');
10
- require('../../chunk-BFX2RH3M.js');
11
- require('../../chunk-HNWSVD35.js');
9
+ require('../../chunk-QMB2ZRWW.js');
10
+ require('../../chunk-MXOKUCLH.js');
11
+ require('../../chunk-YCOC4VEP.js');
12
12
  require('../../chunk-6EEZHGF5.js');
13
13
  require('../../chunk-KLOPX6DO.js');
14
14
  require('../../chunk-MUYXNION.js');
15
15
  require('../../chunk-YGEAZQSC.js');
16
- require('../../chunk-JEMJNDZO.js');
16
+ require('../../chunk-SQXMNT7M.js');
17
17
  require('../../chunk-QHCKVO3P.js');
18
18
  require('../../chunk-YQ2E7NEA.js');
19
19
  require('../../chunk-4QUVE3EK.js');
@@ -29,5 +29,5 @@ require('../../chunk-X3D3MHWF.js');
29
29
 
30
30
 
31
31
 
32
- exports.build = _chunkRJ6IKKA2js.build; exports.default = _chunkV4UPOVEHjs.build_default;
32
+ exports.build = _chunk2ZBAKBVWjs.build; exports.default = _chunk7H5FH7RYjs.build_default;
33
33
  //# sourceMappingURL=index.js.map
@@ -1,19 +1,19 @@
1
1
  import {
2
2
  build_default
3
- } from "../../chunk-AO724LXX.mjs";
4
- import "../../chunk-SM2JEXE6.mjs";
3
+ } from "../../chunk-KWHAT6UJ.mjs";
4
+ import "../../chunk-NOBUMOYX.mjs";
5
5
  import {
6
6
  build
7
- } from "../../chunk-76IQAFYR.mjs";
7
+ } from "../../chunk-CZRGAFVI.mjs";
8
8
  import "../../chunk-45LOTCC4.mjs";
9
- import "../../chunk-WUC7DUXN.mjs";
10
- import "../../chunk-VIQIUSXW.mjs";
11
- import "../../chunk-JBSWMUCQ.mjs";
9
+ import "../../chunk-6ABGZTV7.mjs";
10
+ import "../../chunk-QRW2GKA3.mjs";
11
+ import "../../chunk-HOVEQTF3.mjs";
12
12
  import "../../chunk-BYNQODL3.mjs";
13
13
  import "../../chunk-K26BOY6Z.mjs";
14
14
  import "../../chunk-3WWFQLH4.mjs";
15
15
  import "../../chunk-SYRWT2KT.mjs";
16
- import "../../chunk-OGGTU5W6.mjs";
16
+ import "../../chunk-V6SYDSWM.mjs";
17
17
  import "../../chunk-AZMQTZXZ.mjs";
18
18
  import "../../chunk-ERSRIVYH.mjs";
19
19
  import "../../chunk-JL3URCHO.mjs";
@@ -1,26 +1,26 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkEHJPVBQUjs = require('../chunk-EHJPVBQU.js');
4
- require('../chunk-CQZ2AXMG.js');
5
- require('../chunk-XQGKSVFJ.js');
6
- require('../chunk-RM5FN3N5.js');
7
- require('../chunk-V4UPOVEH.js');
3
+ var _chunkH6BLS7BIjs = require('../chunk-H6BLS7BI.js');
4
+ require('../chunk-RANTKN66.js');
5
+ require('../chunk-HLQEI6DV.js');
6
+ require('../chunk-MECBOP7G.js');
7
+ require('../chunk-7H5FH7RY.js');
8
8
  require('../chunk-S76EZ6HY.js');
9
9
  require('../chunk-QFK7JVP3.js');
10
10
  require('../chunk-WP2N4NCO.js');
11
11
  require('../chunk-U4VFMIGO.js');
12
12
  require('../chunk-C44RRX3H.js');
13
- require('../chunk-C2OMV3H5.js');
14
- require('../chunk-RJ6IKKA2.js');
13
+ require('../chunk-4JEJ7WKR.js');
14
+ require('../chunk-2ZBAKBVW.js');
15
15
  require('../chunk-VXOV3ZCB.js');
16
- require('../chunk-ZOC4OHGM.js');
17
- require('../chunk-BFX2RH3M.js');
18
- require('../chunk-HNWSVD35.js');
16
+ require('../chunk-QMB2ZRWW.js');
17
+ require('../chunk-MXOKUCLH.js');
18
+ require('../chunk-YCOC4VEP.js');
19
19
  require('../chunk-6EEZHGF5.js');
20
20
  require('../chunk-KLOPX6DO.js');
21
21
  require('../chunk-MUYXNION.js');
22
22
  require('../chunk-YGEAZQSC.js');
23
- require('../chunk-JEMJNDZO.js');
23
+ require('../chunk-SQXMNT7M.js');
24
24
  require('../chunk-QHCKVO3P.js');
25
25
  require('../chunk-YQ2E7NEA.js');
26
26
  require('../chunk-4QUVE3EK.js');
@@ -35,5 +35,5 @@ require('../chunk-BALQOCUO.js');
35
35
  require('../chunk-X3D3MHWF.js');
36
36
 
37
37
 
38
- exports.default = _chunkEHJPVBQUjs.commands_default;
38
+ exports.default = _chunkH6BLS7BIjs.commands_default;
39
39
  //# sourceMappingURL=index.js.map
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  commands_default
3
- } from "../chunk-T4CLBV7F.mjs";
4
- import "../chunk-IO6WNNPF.mjs";
5
- import "../chunk-FQ3HKVHQ.mjs";
6
- import "../chunk-BVPROOGE.mjs";
7
- import "../chunk-AO724LXX.mjs";
3
+ } from "../chunk-SK5KZWVS.mjs";
4
+ import "../chunk-AQSQ7YYP.mjs";
5
+ import "../chunk-MR5TAGOG.mjs";
6
+ import "../chunk-BAEGXYL7.mjs";
7
+ import "../chunk-KWHAT6UJ.mjs";
8
8
  import "../chunk-G3COWLG5.mjs";
9
9
  import "../chunk-PFB25A2Q.mjs";
10
10
  import "../chunk-2SUDRRT6.mjs";
11
11
  import "../chunk-JCVSYVPD.mjs";
12
12
  import "../chunk-JAHNVVLT.mjs";
13
- import "../chunk-SM2JEXE6.mjs";
14
- import "../chunk-76IQAFYR.mjs";
13
+ import "../chunk-NOBUMOYX.mjs";
14
+ import "../chunk-CZRGAFVI.mjs";
15
15
  import "../chunk-45LOTCC4.mjs";
16
- import "../chunk-WUC7DUXN.mjs";
17
- import "../chunk-VIQIUSXW.mjs";
18
- import "../chunk-JBSWMUCQ.mjs";
16
+ import "../chunk-6ABGZTV7.mjs";
17
+ import "../chunk-QRW2GKA3.mjs";
18
+ import "../chunk-HOVEQTF3.mjs";
19
19
  import "../chunk-BYNQODL3.mjs";
20
20
  import "../chunk-K26BOY6Z.mjs";
21
21
  import "../chunk-3WWFQLH4.mjs";
22
22
  import "../chunk-SYRWT2KT.mjs";
23
- import "../chunk-OGGTU5W6.mjs";
23
+ import "../chunk-V6SYDSWM.mjs";
24
24
  import "../chunk-AZMQTZXZ.mjs";
25
25
  import "../chunk-ERSRIVYH.mjs";
26
26
  import "../chunk-JL3URCHO.mjs";
@@ -3,14 +3,14 @@
3
3
  var _chunkU4VFMIGOjs = require('../../chunk-U4VFMIGO.js');
4
4
  require('../../chunk-C44RRX3H.js');
5
5
  require('../../chunk-VXOV3ZCB.js');
6
- require('../../chunk-ZOC4OHGM.js');
7
- require('../../chunk-BFX2RH3M.js');
8
- require('../../chunk-HNWSVD35.js');
6
+ require('../../chunk-QMB2ZRWW.js');
7
+ require('../../chunk-MXOKUCLH.js');
8
+ require('../../chunk-YCOC4VEP.js');
9
9
  require('../../chunk-6EEZHGF5.js');
10
10
  require('../../chunk-KLOPX6DO.js');
11
11
  require('../../chunk-MUYXNION.js');
12
12
  require('../../chunk-YGEAZQSC.js');
13
- require('../../chunk-JEMJNDZO.js');
13
+ require('../../chunk-SQXMNT7M.js');
14
14
  require('../../chunk-QHCKVO3P.js');
15
15
  require('../../chunk-YQ2E7NEA.js');
16
16
  require('../../chunk-4QUVE3EK.js');