@metamask/snaps-cli 6.1.0 → 6.1.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/CHANGELOG.md +7 -1
- package/dist/{chunk-SM2JEXE6.mjs → chunk-4PECTXQ6.mjs} +2 -2
- package/dist/{chunk-VIQIUSXW.mjs → chunk-4XEATCHZ.mjs} +17 -1
- package/dist/{chunk-VIQIUSXW.mjs.map → chunk-4XEATCHZ.mjs.map} +1 -1
- package/dist/{chunk-CQZ2AXMG.js → chunk-5QFM7NO5.js} +3 -3
- package/dist/{chunk-76IQAFYR.mjs → chunk-6NHFRBVV.mjs} +2 -2
- package/dist/{chunk-FQ3HKVHQ.mjs → chunk-6WSQYPAK.mjs} +2 -2
- package/dist/{chunk-BVPROOGE.mjs → chunk-E5DLMFLF.mjs} +2 -2
- package/dist/{chunk-IO6WNNPF.mjs → chunk-FK5MBK5X.mjs} +2 -2
- package/dist/{chunk-RJ6IKKA2.js → chunk-HMRC5KQO.js} +3 -3
- package/dist/{chunk-RM5FN3N5.js → chunk-HQ5CYJ4A.js} +3 -3
- package/dist/{chunk-C2OMV3H5.js → chunk-HXTU3FLE.js} +3 -3
- package/dist/{chunk-BFX2RH3M.js → chunk-IPQIKR4W.js} +17 -1
- package/dist/chunk-IPQIKR4W.js.map +1 -0
- package/dist/{chunk-V4UPOVEH.js → chunk-IQASR5US.js} +3 -3
- package/dist/{chunk-EHJPVBQU.js → chunk-K7BAMTCB.js} +5 -5
- package/dist/{chunk-ZOC4OHGM.js → chunk-L7OOEGTX.js} +3 -3
- package/dist/{chunk-AO724LXX.mjs → chunk-NQF6PKJG.mjs} +2 -2
- package/dist/{chunk-XQGKSVFJ.js → chunk-NQUPDPTF.js} +3 -3
- package/dist/{chunk-T4CLBV7F.mjs → chunk-QXYTF636.mjs} +3 -3
- package/dist/{chunk-WUC7DUXN.mjs → chunk-X3G2RMOM.mjs} +2 -2
- package/dist/commands/build/build.js +5 -5
- package/dist/commands/build/build.mjs +4 -4
- package/dist/commands/build/implementation.js +4 -4
- package/dist/commands/build/implementation.mjs +3 -3
- package/dist/commands/build/index.js +6 -6
- package/dist/commands/build/index.mjs +5 -5
- package/dist/commands/index.js +10 -10
- package/dist/commands/index.mjs +9 -9
- package/dist/commands/serve/index.js +2 -2
- package/dist/commands/serve/index.mjs +2 -2
- package/dist/commands/serve/serve.js +2 -2
- package/dist/commands/serve/serve.mjs +2 -2
- package/dist/commands/watch/implementation.js +4 -4
- package/dist/commands/watch/implementation.mjs +3 -3
- package/dist/commands/watch/index.js +6 -6
- package/dist/commands/watch/index.mjs +5 -5
- package/dist/commands/watch/watch.js +5 -5
- package/dist/commands/watch/watch.mjs +4 -4
- package/dist/index.js +3 -3
- package/dist/index.mjs +2 -2
- package/dist/main.js +10 -10
- package/dist/main.mjs +9 -9
- package/dist/tsconfig.build.tsbuildinfo +1 -1
- package/dist/webpack/compiler.js +3 -3
- package/dist/webpack/compiler.mjs +2 -2
- package/dist/webpack/config.js +2 -2
- package/dist/webpack/config.mjs +1 -1
- package/dist/webpack/index.js +3 -3
- package/dist/webpack/index.mjs +2 -2
- package/package.json +3 -3
- package/dist/chunk-BFX2RH3M.js.map +0 -1
- /package/dist/{chunk-SM2JEXE6.mjs.map → chunk-4PECTXQ6.mjs.map} +0 -0
- /package/dist/{chunk-CQZ2AXMG.js.map → chunk-5QFM7NO5.js.map} +0 -0
- /package/dist/{chunk-76IQAFYR.mjs.map → chunk-6NHFRBVV.mjs.map} +0 -0
- /package/dist/{chunk-FQ3HKVHQ.mjs.map → chunk-6WSQYPAK.mjs.map} +0 -0
- /package/dist/{chunk-BVPROOGE.mjs.map → chunk-E5DLMFLF.mjs.map} +0 -0
- /package/dist/{chunk-IO6WNNPF.mjs.map → chunk-FK5MBK5X.mjs.map} +0 -0
- /package/dist/{chunk-RJ6IKKA2.js.map → chunk-HMRC5KQO.js.map} +0 -0
- /package/dist/{chunk-RM5FN3N5.js.map → chunk-HQ5CYJ4A.js.map} +0 -0
- /package/dist/{chunk-C2OMV3H5.js.map → chunk-HXTU3FLE.js.map} +0 -0
- /package/dist/{chunk-V4UPOVEH.js.map → chunk-IQASR5US.js.map} +0 -0
- /package/dist/{chunk-EHJPVBQU.js.map → chunk-K7BAMTCB.js.map} +0 -0
- /package/dist/{chunk-ZOC4OHGM.js.map → chunk-L7OOEGTX.js.map} +0 -0
- /package/dist/{chunk-AO724LXX.mjs.map → chunk-NQF6PKJG.mjs.map} +0 -0
- /package/dist/{chunk-XQGKSVFJ.js.map → chunk-NQUPDPTF.js.map} +0 -0
- /package/dist/{chunk-T4CLBV7F.mjs.map → chunk-QXYTF636.mjs.map} +0 -0
- /package/dist/{chunk-WUC7DUXN.mjs.map → chunk-X3G2RMOM.mjs.map} +0 -0
package/CHANGELOG.md
CHANGED
|
@@ -6,6 +6,11 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
6
6
|
|
|
7
7
|
## [Unreleased]
|
|
8
8
|
|
|
9
|
+
## [6.1.1]
|
|
10
|
+
### Fixed
|
|
11
|
+
- Disable `topLevelAwait` configuration option ([#2358](https://github.com/MetaMask/snaps/pull/2358))
|
|
12
|
+
- Before this the CLI would produce invalid builds when using top-level await.
|
|
13
|
+
|
|
9
14
|
## [6.1.0]
|
|
10
15
|
### Added
|
|
11
16
|
- Add support for importing SVG, PNG, and JPEG files directly ([#2284](https://github.com/MetaMask/snaps/pull/2284))
|
|
@@ -146,7 +151,8 @@ and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0
|
|
|
146
151
|
- The version of the package no longer needs to match the version of all other
|
|
147
152
|
MetaMask Snaps packages.
|
|
148
153
|
|
|
149
|
-
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.1.
|
|
154
|
+
[Unreleased]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.1.1...HEAD
|
|
155
|
+
[6.1.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.1.0...@metamask/snaps-cli@6.1.1
|
|
150
156
|
[6.1.0]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.0.2...@metamask/snaps-cli@6.1.0
|
|
151
157
|
[6.0.2]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.0.1...@metamask/snaps-cli@6.0.2
|
|
152
158
|
[6.0.1]: https://github.com/MetaMask/snaps/compare/@metamask/snaps-cli@6.0.0...@metamask/snaps-cli@6.0.1
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
build
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6NHFRBVV.mjs";
|
|
4
4
|
import {
|
|
5
5
|
evaluate
|
|
6
6
|
} from "./chunk-3WWFQLH4.mjs";
|
|
@@ -58,4 +58,4 @@ async function buildHandler(config) {
|
|
|
58
58
|
export {
|
|
59
59
|
buildHandler
|
|
60
60
|
};
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-4PECTXQ6.mjs.map
|
|
@@ -294,6 +294,22 @@ async function getDefaultConfiguration(config, options = {
|
|
|
294
294
|
})
|
|
295
295
|
]
|
|
296
296
|
},
|
|
297
|
+
/**
|
|
298
|
+
* The experiments configuration. This configures which Webpack
|
|
299
|
+
* experiments to enable/disable.
|
|
300
|
+
*
|
|
301
|
+
* @see https://webpack.js.org/configuration/experiments
|
|
302
|
+
*/
|
|
303
|
+
experiments: {
|
|
304
|
+
/**
|
|
305
|
+
* Experimental support for top level await.
|
|
306
|
+
*
|
|
307
|
+
* This is unsupported in Snaps and therefore disabled.
|
|
308
|
+
*
|
|
309
|
+
* @see https://webpack.js.org/configuration/experiments/#experimentstoplevelawait
|
|
310
|
+
*/
|
|
311
|
+
topLevelAwait: false
|
|
312
|
+
},
|
|
297
313
|
/**
|
|
298
314
|
* The performance configuration. This tells Webpack how to handle
|
|
299
315
|
* performance hints.
|
|
@@ -328,4 +344,4 @@ async function getDefaultConfiguration(config, options = {
|
|
|
328
344
|
export {
|
|
329
345
|
getDefaultConfiguration
|
|
330
346
|
};
|
|
331
|
-
//# sourceMappingURL=chunk-
|
|
347
|
+
//# sourceMappingURL=chunk-4XEATCHZ.mjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["../src/webpack/config.ts"],"sourcesContent":["import SnapsWebpackPlugin from '@metamask/snaps-webpack-plugin';\nimport type { Ora } from 'ora';\nimport { resolve } from 'path';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport type { Configuration } from 'webpack';\nimport { DefinePlugin, ProgressPlugin, ProvidePlugin } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport { getFunctionLoader, wasm } from './loaders';\nimport {\n SnapsBuiltInResolver,\n SnapsBundleWarningsPlugin,\n SnapsStatsPlugin,\n SnapsWatchPlugin,\n} from './plugins';\nimport {\n BROWSERSLIST_FILE,\n getDefaultLoader,\n getDevTool,\n getEnvironmentVariables,\n getFallbacks,\n getImageSVG,\n getProgressHandler,\n} from './utils';\n\nexport type WebpackOptions = {\n /**\n * Whether to watch for changes.\n */\n watch?: boolean;\n\n /**\n * Whether to evaluate the bundle. If this is set, it will override the\n * `evaluate` option in the config object.\n */\n evaluate?: boolean;\n\n /**\n * The spinner to use for logging.\n */\n spinner?: Ora;\n};\n\n/**\n * Get the default Webpack configuration. This is the configuration that will\n * be used if the user doesn't provide a custom Webpack configuration. The\n * configuration is based on the snap config.\n *\n * The default configuration includes:\n *\n * - `SWC` to transpile TypeScript and JavaScript files.\n * - `TerserPlugin` to minify the bundle.\n * - `SnapsWebpackPlugin` to validate the bundle and update the manifest.\n *\n * It can be customized through the `customizeWebpackConfig` function in the\n * snap config, but in most cases, you shouldn't need to do that.\n *\n * @param config - The processed snap Webpack config.\n * @param options - The Webpack options.\n * @returns The default Webpack configuration.\n */\nexport async function getDefaultConfiguration(\n config: ProcessedWebpackConfig,\n options: WebpackOptions = {\n evaluate: config.evaluate,\n },\n): Promise<Configuration> {\n const spinnerText = options.spinner?.text;\n const builtInResolver =\n config.stats.builtIns &&\n new SnapsBuiltInResolver(config.stats.builtIns, options.spinner);\n\n return {\n /**\n * The target is set to `browserslist` so that Webpack will compile the\n * bundle to support the browsers specified in the `.browserslistrc` file.\n * This Browserslist file contains the browsers that are supported by\n * MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/target/\n */\n target: `browserslist:${BROWSERSLIST_FILE}`,\n\n /**\n * The mode is set to `production` by default, so that Webpack will minify\n * and optimize the bundle.\n *\n * @see https://webpack.js.org/configuration/mode/\n */\n mode: 'production',\n\n /**\n * The entry point is set to the `input` value from the config object.\n *\n * @see https://webpack.js.org/configuration/entry-context/\n */\n entry: config.input,\n\n /**\n * The devtool option controls how source maps are generated. We set it to\n * the `sourceMap` value from the config object.\n *\n * @see https://webpack.js.org/configuration/devtool/\n */\n devtool: getDevTool(config.sourceMap),\n\n /**\n * The stats option controls how much information is printed to the console\n * when Webpack is running. We set it to `none` so that we can control the\n * output ourselves.\n *\n * @see https://webpack.js.org/configuration/stats/\n */\n stats: 'none',\n\n /**\n * The output options.\n *\n * @see https://webpack.js.org/configuration/output/\n */\n output: {\n /**\n * This indicates whether Webpack should clear the output directory\n * before building. We set it to the `clean` value from the config\n * object.\n *\n * @see https://webpack.js.org/configuration/output/#outputclean\n */\n clean: config.output.clean,\n\n /**\n * The filename of the bundle. We set it to the `filename` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputfilename\n */\n filename: config.output.filename,\n\n /**\n * The path to the output directory. We set it to the `path` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputpath\n */\n path: config.output.path,\n\n /**\n * The public path of the bundle. We set it to `/` by default, so that\n * the bundle can be loaded from the root of the server.\n *\n * @see https://webpack.js.org/configuration/output/#outputpublicpath\n */\n publicPath: '/',\n\n /**\n * The library configuration. This tells Webpack how to export the\n * bundle.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrary\n */\n library: {\n /**\n * This tells Webpack to export the bundle as a CommonJS module. This\n * is necessary for MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrarytarget\n */\n type: 'commonjs',\n },\n\n /**\n * The chunk format. This tells Webpack how to export chunks. This is\n * required because we use browserslist to target browsers, but Snaps are\n * not fully compatible with browser APIs (such as `window` and\n * `document`).\n *\n * @see https://webpack.js.org/configuration/output/#outputchunkformat\n */\n chunkFormat: 'commonjs',\n },\n\n /**\n * The module configuration. This is where we tell Webpack how to handle\n * different types of files.\n *\n * @see https://webpack.js.org/configuration/module/\n */\n module: {\n rules: [\n {\n test: /\\.(js|mjs|cjs|ts)$/u,\n exclude: /node_modules/u,\n use: await getDefaultLoader(config),\n },\n\n /**\n * This allows importing modules that uses `.js` and not `.mjs` for the\n * ES build.\n *\n * @see https://webpack.js.org/configuration/module/#resolvefullyspecified\n */\n {\n test: /\\.m?js$/u,\n resolve: {\n fullySpecified: false,\n },\n },\n\n /**\n * This allows importing `.svg` files as a string.\n */\n config.features.images && {\n test: /\\.svg$/u,\n // `asset/source` returns the source as a UTF-8 string.\n type: 'asset/source',\n },\n\n /**\n * This allows importing `.png` files as a data URL.\n */\n config.features.images && {\n test: /\\.png$/u,\n type: 'asset/inline',\n generator: {\n dataUrl: getImageSVG.bind(null, 'image/png'),\n },\n },\n\n /**\n * This allows importing `.jpe?g` files as a data URL.\n */\n config.features.images && {\n test: /\\.jpe?g$/u,\n type: 'asset/inline',\n generator: {\n dataUrl: getImageSVG.bind(null, 'image/jpeg'),\n },\n },\n\n config.experimental.wasm && {\n test: /\\.wasm$/u,\n use: getFunctionLoader(wasm, {}),\n },\n ],\n },\n\n /**\n * The resolve configuration. This tells Webpack how to resolve imports.\n * We set it to resolve `.js` and `.ts` files.\n *\n * @see https://webpack.js.org/configuration/resolve/\n */\n resolve: {\n /**\n * The extensions to resolve. We set it to resolve `.(c|m)?js` and `.ts`\n * files.\n */\n extensions: ['.js', '.mjs', '.cjs', '.ts'],\n\n /**\n * The fallback options. This tells Webpack how to handle imports that\n * aren't resolved. By default, we set Node.js built-ins to `false`, so\n * that they are ignored.\n */\n fallback: getFallbacks(config.polyfills),\n\n /**\n * The plugins to use. We use the {@link SnapsBuiltInResolver} to show\n * warnings about using Node.js built-ins, when no fallback is specified.\n */\n plugins: [builtInResolver],\n },\n\n /**\n * The plugins to use.\n *\n * @see https://webpack.js.org/configuration/plugins/\n */\n plugins: [\n /**\n * The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates\n * the manifest file, and evaluates the bundle in SES. While not strictly\n * required, it's highly recommended to use this plugin.\n */\n new SnapsWebpackPlugin({\n manifestPath: config.manifest.path,\n writeManifest: config.manifest.update,\n eval: !options.watch && options.evaluate,\n }),\n\n /**\n * The `SnapsStatsPlugin` is a Webpack plugin that handles the stats\n * output. It's used to show the stats in the terminal, in a format that\n * is easy to read.\n */\n new SnapsStatsPlugin({ verbose: config.stats.verbose }, options.spinner),\n\n /**\n * The `DefinePlugin` is a Webpack plugin that adds static values to the\n * bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`\n * environment variables, as well as any custom environment\n * variables (as `process.env`).\n */\n new DefinePlugin(getEnvironmentVariables(config.environment)),\n\n /**\n * The `ProgressPlugin` is a Webpack plugin that logs the progress of\n * the build. We set it to log the progress to the spinner.\n */\n new ProgressPlugin({\n handler: getProgressHandler(options.spinner, spinnerText),\n }),\n\n /**\n * The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a\n * warning when the bundle is potentially incompatible with MetaMask\n * Snaps.\n */\n new SnapsBundleWarningsPlugin({\n builtInResolver,\n builtIns: Boolean(config.stats.builtIns),\n buffer: config.stats.buffer,\n }),\n\n /**\n * The `WatchPlugin` is a Webpack plugin that adds extra files to watch\n * for changes. This is useful for rebuilding the bundle when the\n * manifest file changes.\n */\n options.watch &&\n new SnapsWatchPlugin(\n {\n bundle: resolve(config.output.path, config.output.filename),\n evaluate: options.evaluate,\n files: [config.manifest.path],\n },\n options.spinner,\n ),\n\n /**\n * The `ProviderPlugin` is a Webpack plugin that automatically load\n * modules instead of having to import or require them everywhere.\n */\n (config.polyfills === true ||\n (config.polyfills !== false && config.polyfills.buffer)) &&\n new ProvidePlugin({\n Buffer: ['buffer', 'Buffer'],\n }),\n ].filter(Boolean),\n\n /**\n * The optimization configuration. This tells Webpack how to optimize the\n * bundle. Most of the time, you won't need to change this, as the default\n * options set by the `mode` option are sufficient.\n */\n optimization: {\n minimize: config.output.minimize,\n\n /**\n * The minimizer to use. We set it to use the `TerserPlugin`.\n */\n minimizer: [\n new TerserPlugin({\n parallel: true,\n }),\n ],\n },\n\n /**\n * The performance configuration. This tells Webpack how to handle\n * performance hints.\n *\n * @see https://webpack.js.org/configuration/performance/\n */\n performance: {\n /**\n * The hints to show. We set it to `false`, so that we don't get\n * performance hints, as they are not relevant for Snaps.\n *\n * @see https://webpack.js.org/configuration/performance/#performancehints\n */\n hints: false,\n },\n\n /**\n * The infrastructure logging configuration. This tells Webpack how to\n * log messages.\n *\n * @see https://webpack.js.org/configuration/infrastructure-logging\n */\n infrastructureLogging: {\n /**\n * The level of logging to use. We set it to `none`, so that we can\n * control the output ourselves.\n */\n level: 'none',\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,wBAAwB;AAE/B,SAAS,eAAe;AACxB,OAAO,kBAAkB;AAEzB,SAAS,cAAc,gBAAgB,qBAAqB;AAwD5D,eAAsB,wBACpB,QACA,UAA0B;AAAA,EACxB,UAAU,OAAO;AACnB,GACwB;AACxB,QAAM,cAAc,QAAQ,SAAS;AACrC,QAAM,kBACJ,OAAO,MAAM,YACb,IAAI,qBAAqB,OAAO,MAAM,UAAU,QAAQ,OAAO;AAEjE,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASL,QAAQ,gBAAgB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzC,MAAM;AAAA;AAAA;AA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OAAO,MAAM;AAAA,MACvB,CAAC;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOD,QAAQ,SACN,IAAI;AAAA,QACF;AAAA,UACE,QAAQ,QAAQ,OAAO,OAAO,MAAM,OAAO,OAAO,QAAQ;AAAA,UAC1D,UAAU,QAAQ;AAAA,UAClB,OAAO,CAAC,OAAO,SAAS,IAAI;AAAA,QAC9B;AAAA,QACA,QAAQ;AAAA,MACV;AAAA;AAAA;AAAA;AAAA;AAAA,OAMD,OAAO,cAAc,QACnB,OAAO,cAAc,SAAS,OAAO,UAAU,WAChD,IAAI,cAAc;AAAA,QAChB,QAAQ,CAAC,UAAU,QAAQ;AAAA,MAC7B,CAAC;AAAA,IACL,EAAE,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOhB,cAAc;AAAA,MACZ,UAAU,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA,MAKxB,WAAW;AAAA,QACT,IAAI,aAAa;AAAA,UACf,UAAU;AAAA,QACZ,CAAC;AAAA,MACH;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOX,OAAO;AAAA,IACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,MAKrB,OAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
1
|
+
{"version":3,"sources":["../src/webpack/config.ts"],"sourcesContent":["import SnapsWebpackPlugin from '@metamask/snaps-webpack-plugin';\nimport type { Ora } from 'ora';\nimport { resolve } from 'path';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport type { Configuration } from 'webpack';\nimport { DefinePlugin, ProgressPlugin, ProvidePlugin } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport { getFunctionLoader, wasm } from './loaders';\nimport {\n SnapsBuiltInResolver,\n SnapsBundleWarningsPlugin,\n SnapsStatsPlugin,\n SnapsWatchPlugin,\n} from './plugins';\nimport {\n BROWSERSLIST_FILE,\n getDefaultLoader,\n getDevTool,\n getEnvironmentVariables,\n getFallbacks,\n getImageSVG,\n getProgressHandler,\n} from './utils';\n\nexport type WebpackOptions = {\n /**\n * Whether to watch for changes.\n */\n watch?: boolean;\n\n /**\n * Whether to evaluate the bundle. If this is set, it will override the\n * `evaluate` option in the config object.\n */\n evaluate?: boolean;\n\n /**\n * The spinner to use for logging.\n */\n spinner?: Ora;\n};\n\n/**\n * Get the default Webpack configuration. This is the configuration that will\n * be used if the user doesn't provide a custom Webpack configuration. The\n * configuration is based on the snap config.\n *\n * The default configuration includes:\n *\n * - `SWC` to transpile TypeScript and JavaScript files.\n * - `TerserPlugin` to minify the bundle.\n * - `SnapsWebpackPlugin` to validate the bundle and update the manifest.\n *\n * It can be customized through the `customizeWebpackConfig` function in the\n * snap config, but in most cases, you shouldn't need to do that.\n *\n * @param config - The processed snap Webpack config.\n * @param options - The Webpack options.\n * @returns The default Webpack configuration.\n */\nexport async function getDefaultConfiguration(\n config: ProcessedWebpackConfig,\n options: WebpackOptions = {\n evaluate: config.evaluate,\n },\n): Promise<Configuration> {\n const spinnerText = options.spinner?.text;\n const builtInResolver =\n config.stats.builtIns &&\n new SnapsBuiltInResolver(config.stats.builtIns, options.spinner);\n\n return {\n /**\n * The target is set to `browserslist` so that Webpack will compile the\n * bundle to support the browsers specified in the `.browserslistrc` file.\n * This Browserslist file contains the browsers that are supported by\n * MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/target/\n */\n target: `browserslist:${BROWSERSLIST_FILE}`,\n\n /**\n * The mode is set to `production` by default, so that Webpack will minify\n * and optimize the bundle.\n *\n * @see https://webpack.js.org/configuration/mode/\n */\n mode: 'production',\n\n /**\n * The entry point is set to the `input` value from the config object.\n *\n * @see https://webpack.js.org/configuration/entry-context/\n */\n entry: config.input,\n\n /**\n * The devtool option controls how source maps are generated. We set it to\n * the `sourceMap` value from the config object.\n *\n * @see https://webpack.js.org/configuration/devtool/\n */\n devtool: getDevTool(config.sourceMap),\n\n /**\n * The stats option controls how much information is printed to the console\n * when Webpack is running. We set it to `none` so that we can control the\n * output ourselves.\n *\n * @see https://webpack.js.org/configuration/stats/\n */\n stats: 'none',\n\n /**\n * The output options.\n *\n * @see https://webpack.js.org/configuration/output/\n */\n output: {\n /**\n * This indicates whether Webpack should clear the output directory\n * before building. We set it to the `clean` value from the config\n * object.\n *\n * @see https://webpack.js.org/configuration/output/#outputclean\n */\n clean: config.output.clean,\n\n /**\n * The filename of the bundle. We set it to the `filename` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputfilename\n */\n filename: config.output.filename,\n\n /**\n * The path to the output directory. We set it to the `path` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputpath\n */\n path: config.output.path,\n\n /**\n * The public path of the bundle. We set it to `/` by default, so that\n * the bundle can be loaded from the root of the server.\n *\n * @see https://webpack.js.org/configuration/output/#outputpublicpath\n */\n publicPath: '/',\n\n /**\n * The library configuration. This tells Webpack how to export the\n * bundle.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrary\n */\n library: {\n /**\n * This tells Webpack to export the bundle as a CommonJS module. This\n * is necessary for MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrarytarget\n */\n type: 'commonjs',\n },\n\n /**\n * The chunk format. This tells Webpack how to export chunks. This is\n * required because we use browserslist to target browsers, but Snaps are\n * not fully compatible with browser APIs (such as `window` and\n * `document`).\n *\n * @see https://webpack.js.org/configuration/output/#outputchunkformat\n */\n chunkFormat: 'commonjs',\n },\n\n /**\n * The module configuration. This is where we tell Webpack how to handle\n * different types of files.\n *\n * @see https://webpack.js.org/configuration/module/\n */\n module: {\n rules: [\n {\n test: /\\.(js|mjs|cjs|ts)$/u,\n exclude: /node_modules/u,\n use: await getDefaultLoader(config),\n },\n\n /**\n * This allows importing modules that uses `.js` and not `.mjs` for the\n * ES build.\n *\n * @see https://webpack.js.org/configuration/module/#resolvefullyspecified\n */\n {\n test: /\\.m?js$/u,\n resolve: {\n fullySpecified: false,\n },\n },\n\n /**\n * This allows importing `.svg` files as a string.\n */\n config.features.images && {\n test: /\\.svg$/u,\n // `asset/source` returns the source as a UTF-8 string.\n type: 'asset/source',\n },\n\n /**\n * This allows importing `.png` files as a data URL.\n */\n config.features.images && {\n test: /\\.png$/u,\n type: 'asset/inline',\n generator: {\n dataUrl: getImageSVG.bind(null, 'image/png'),\n },\n },\n\n /**\n * This allows importing `.jpe?g` files as a data URL.\n */\n config.features.images && {\n test: /\\.jpe?g$/u,\n type: 'asset/inline',\n generator: {\n dataUrl: getImageSVG.bind(null, 'image/jpeg'),\n },\n },\n\n config.experimental.wasm && {\n test: /\\.wasm$/u,\n use: getFunctionLoader(wasm, {}),\n },\n ],\n },\n\n /**\n * The resolve configuration. This tells Webpack how to resolve imports.\n * We set it to resolve `.js` and `.ts` files.\n *\n * @see https://webpack.js.org/configuration/resolve/\n */\n resolve: {\n /**\n * The extensions to resolve. We set it to resolve `.(c|m)?js` and `.ts`\n * files.\n */\n extensions: ['.js', '.mjs', '.cjs', '.ts'],\n\n /**\n * The fallback options. This tells Webpack how to handle imports that\n * aren't resolved. By default, we set Node.js built-ins to `false`, so\n * that they are ignored.\n */\n fallback: getFallbacks(config.polyfills),\n\n /**\n * The plugins to use. We use the {@link SnapsBuiltInResolver} to show\n * warnings about using Node.js built-ins, when no fallback is specified.\n */\n plugins: [builtInResolver],\n },\n\n /**\n * The plugins to use.\n *\n * @see https://webpack.js.org/configuration/plugins/\n */\n plugins: [\n /**\n * The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates\n * the manifest file, and evaluates the bundle in SES. While not strictly\n * required, it's highly recommended to use this plugin.\n */\n new SnapsWebpackPlugin({\n manifestPath: config.manifest.path,\n writeManifest: config.manifest.update,\n eval: !options.watch && options.evaluate,\n }),\n\n /**\n * The `SnapsStatsPlugin` is a Webpack plugin that handles the stats\n * output. It's used to show the stats in the terminal, in a format that\n * is easy to read.\n */\n new SnapsStatsPlugin({ verbose: config.stats.verbose }, options.spinner),\n\n /**\n * The `DefinePlugin` is a Webpack plugin that adds static values to the\n * bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`\n * environment variables, as well as any custom environment\n * variables (as `process.env`).\n */\n new DefinePlugin(getEnvironmentVariables(config.environment)),\n\n /**\n * The `ProgressPlugin` is a Webpack plugin that logs the progress of\n * the build. We set it to log the progress to the spinner.\n */\n new ProgressPlugin({\n handler: getProgressHandler(options.spinner, spinnerText),\n }),\n\n /**\n * The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a\n * warning when the bundle is potentially incompatible with MetaMask\n * Snaps.\n */\n new SnapsBundleWarningsPlugin({\n builtInResolver,\n builtIns: Boolean(config.stats.builtIns),\n buffer: config.stats.buffer,\n }),\n\n /**\n * The `WatchPlugin` is a Webpack plugin that adds extra files to watch\n * for changes. This is useful for rebuilding the bundle when the\n * manifest file changes.\n */\n options.watch &&\n new SnapsWatchPlugin(\n {\n bundle: resolve(config.output.path, config.output.filename),\n evaluate: options.evaluate,\n files: [config.manifest.path],\n },\n options.spinner,\n ),\n\n /**\n * The `ProviderPlugin` is a Webpack plugin that automatically load\n * modules instead of having to import or require them everywhere.\n */\n (config.polyfills === true ||\n (config.polyfills !== false && config.polyfills.buffer)) &&\n new ProvidePlugin({\n Buffer: ['buffer', 'Buffer'],\n }),\n ].filter(Boolean),\n\n /**\n * The optimization configuration. This tells Webpack how to optimize the\n * bundle. Most of the time, you won't need to change this, as the default\n * options set by the `mode` option are sufficient.\n */\n optimization: {\n minimize: config.output.minimize,\n\n /**\n * The minimizer to use. We set it to use the `TerserPlugin`.\n */\n minimizer: [\n new TerserPlugin({\n parallel: true,\n }),\n ],\n },\n\n /**\n * The experiments configuration. This configures which Webpack\n * experiments to enable/disable.\n *\n * @see https://webpack.js.org/configuration/experiments\n */\n experiments: {\n /**\n * Experimental support for top level await.\n *\n * This is unsupported in Snaps and therefore disabled.\n *\n * @see https://webpack.js.org/configuration/experiments/#experimentstoplevelawait\n */\n topLevelAwait: false,\n },\n\n /**\n * The performance configuration. This tells Webpack how to handle\n * performance hints.\n *\n * @see https://webpack.js.org/configuration/performance/\n */\n performance: {\n /**\n * The hints to show. We set it to `false`, so that we don't get\n * performance hints, as they are not relevant for Snaps.\n *\n * @see https://webpack.js.org/configuration/performance/#performancehints\n */\n hints: false,\n },\n\n /**\n * The infrastructure logging configuration. This tells Webpack how to\n * log messages.\n *\n * @see https://webpack.js.org/configuration/infrastructure-logging\n */\n infrastructureLogging: {\n /**\n * The level of logging to use. We set it to `none`, so that we can\n * control the output ourselves.\n */\n level: 'none',\n },\n };\n}\n"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,wBAAwB;AAE/B,SAAS,eAAe;AACxB,OAAO,kBAAkB;AAEzB,SAAS,cAAc,gBAAgB,qBAAqB;AAwD5D,eAAsB,wBACpB,QACA,UAA0B;AAAA,EACxB,UAAU,OAAO;AACnB,GACwB;AACxB,QAAM,cAAc,QAAQ,SAAS;AACrC,QAAM,kBACJ,OAAO,MAAM,YACb,IAAI,qBAAqB,OAAO,MAAM,UAAU,QAAQ,OAAO;AAEjE,SAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASL,QAAQ,gBAAgB,iBAAiB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQzC,MAAM;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAON,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQd,SAAS,WAAW,OAAO,SAAS;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IASpC,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOP,QAAQ;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQN,OAAO,OAAO,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AAAA;AAAA;AAAA,OAMD,OAAO,cAAc,QACnB,OAAO,cAAc,SAAS,OAAO,UAAU,WAChD,IAAI,cAAc;AAAA,QAChB,QAAQ,CAAC,UAAU,QAAQ;AAAA,MAC7B,CAAC;AAAA,IACL,EAAE,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAOhB,cAAc;AAAA,MACZ,UAAU,OAAO,OAAO;AAAA;AAAA;AAAA;AAAA,MAKxB,WAAW;AAAA,QACT,IAAI,aAAa;AAAA,UACf,UAAU;AAAA,QACZ,CAAC;AAAA,MACH;AAAA,IACF;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAQX,eAAe;AAAA,IACjB;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,aAAa;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,MAOX,OAAO;AAAA,IACT;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA;AAAA,IAQA,uBAAuB;AAAA;AAAA;AAAA;AAAA;AAAA,MAKrB,OAAO;AAAA,IACT;AAAA,EACF;AACF;","names":[]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkNQUPDPTFjs = require('./chunk-NQUPDPTF.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) =>
|
|
15
|
+
handler: async (argv) => _chunkNQUPDPTFjs.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-
|
|
24
|
+
//# sourceMappingURL=chunk-5QFM7NO5.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCompiler
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X3G2RMOM.mjs";
|
|
4
4
|
|
|
5
5
|
// src/commands/build/implementation.ts
|
|
6
6
|
async function build(config, options) {
|
|
@@ -25,4 +25,4 @@ async function build(config, options) {
|
|
|
25
25
|
export {
|
|
26
26
|
build
|
|
27
27
|
};
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-6NHFRBVV.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
watch
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-E5DLMFLF.mjs";
|
|
4
4
|
import {
|
|
5
5
|
getServer
|
|
6
6
|
} from "./chunk-SYRWT2KT.mjs";
|
|
@@ -51,4 +51,4 @@ async function watchHandler(config, options) {
|
|
|
51
51
|
export {
|
|
52
52
|
watchHandler
|
|
53
53
|
};
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-6WSQYPAK.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getCompiler
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-X3G2RMOM.mjs";
|
|
4
4
|
|
|
5
5
|
// src/commands/watch/implementation.ts
|
|
6
6
|
import { basename } from "path";
|
|
@@ -32,4 +32,4 @@ async function watch(config, options) {
|
|
|
32
32
|
export {
|
|
33
33
|
watch
|
|
34
34
|
};
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-E5DLMFLF.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
watchHandler
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-6WSQYPAK.mjs";
|
|
4
4
|
import {
|
|
5
5
|
builders_default
|
|
6
6
|
} from "./chunk-MR44GPM3.mjs";
|
|
@@ -21,4 +21,4 @@ var watch_default = command;
|
|
|
21
21
|
export {
|
|
22
22
|
watch_default
|
|
23
23
|
};
|
|
24
|
-
//# sourceMappingURL=chunk-
|
|
24
|
+
//# sourceMappingURL=chunk-FK5MBK5X.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkL7OOEGTXjs = require('./chunk-L7OOEGTX.js');
|
|
4
4
|
|
|
5
5
|
// src/commands/build/implementation.ts
|
|
6
6
|
async function build(config, options) {
|
|
7
|
-
const compiler = await
|
|
7
|
+
const compiler = await _chunkL7OOEGTXjs.getCompiler.call(void 0, config, options);
|
|
8
8
|
return await new Promise((resolve, reject) => {
|
|
9
9
|
compiler.run((runError) => {
|
|
10
10
|
if (runError) {
|
|
@@ -25,4 +25,4 @@ async function build(config, options) {
|
|
|
25
25
|
|
|
26
26
|
|
|
27
27
|
exports.build = build;
|
|
28
|
-
//# sourceMappingURL=chunk-
|
|
28
|
+
//# sourceMappingURL=chunk-HMRC5KQO.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkL7OOEGTXjs = require('./chunk-L7OOEGTX.js');
|
|
4
4
|
|
|
5
5
|
// src/commands/watch/implementation.ts
|
|
6
6
|
var _path = require('path');
|
|
7
7
|
async function watch(config, options) {
|
|
8
|
-
const compiler = await
|
|
8
|
+
const compiler = await _chunkL7OOEGTXjs.getCompiler.call(void 0, config, {
|
|
9
9
|
evaluate: config.evaluate,
|
|
10
10
|
watch: true,
|
|
11
11
|
spinner: options?.spinner
|
|
@@ -32,4 +32,4 @@ async function watch(config, options) {
|
|
|
32
32
|
|
|
33
33
|
|
|
34
34
|
exports.watch = watch;
|
|
35
|
-
//# sourceMappingURL=chunk-
|
|
35
|
+
//# sourceMappingURL=chunk-HQ5CYJ4A.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHMRC5KQOjs = require('./chunk-HMRC5KQO.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkMUYXNIONjs = require('./chunk-MUYXNION.js');
|
|
@@ -32,7 +32,7 @@ var steps = [
|
|
|
32
32
|
{
|
|
33
33
|
name: "Building the snap bundle.",
|
|
34
34
|
task: async ({ config, spinner }) => {
|
|
35
|
-
return await
|
|
35
|
+
return await _chunkHMRC5KQOjs.build.call(void 0, config, { evaluate: false, spinner });
|
|
36
36
|
}
|
|
37
37
|
},
|
|
38
38
|
{
|
|
@@ -58,4 +58,4 @@ async function buildHandler(config) {
|
|
|
58
58
|
|
|
59
59
|
|
|
60
60
|
exports.buildHandler = buildHandler;
|
|
61
|
-
//# sourceMappingURL=chunk-
|
|
61
|
+
//# sourceMappingURL=chunk-HXTU3FLE.js.map
|
|
@@ -294,6 +294,22 @@ async function getDefaultConfiguration(config, options = {
|
|
|
294
294
|
})
|
|
295
295
|
]
|
|
296
296
|
},
|
|
297
|
+
/**
|
|
298
|
+
* The experiments configuration. This configures which Webpack
|
|
299
|
+
* experiments to enable/disable.
|
|
300
|
+
*
|
|
301
|
+
* @see https://webpack.js.org/configuration/experiments
|
|
302
|
+
*/
|
|
303
|
+
experiments: {
|
|
304
|
+
/**
|
|
305
|
+
* Experimental support for top level await.
|
|
306
|
+
*
|
|
307
|
+
* This is unsupported in Snaps and therefore disabled.
|
|
308
|
+
*
|
|
309
|
+
* @see https://webpack.js.org/configuration/experiments/#experimentstoplevelawait
|
|
310
|
+
*/
|
|
311
|
+
topLevelAwait: false
|
|
312
|
+
},
|
|
297
313
|
/**
|
|
298
314
|
* The performance configuration. This tells Webpack how to handle
|
|
299
315
|
* performance hints.
|
|
@@ -328,4 +344,4 @@ async function getDefaultConfiguration(config, options = {
|
|
|
328
344
|
|
|
329
345
|
|
|
330
346
|
exports.getDefaultConfiguration = getDefaultConfiguration;
|
|
331
|
-
//# sourceMappingURL=chunk-
|
|
347
|
+
//# sourceMappingURL=chunk-IPQIKR4W.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"sources":["../src/webpack/config.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;AAAA,OAAO,wBAAwB;AAE/B,SAAS,eAAe;AACxB,OAAO,kBAAkB;AAEzB,SAAS,cAAc,gBAAgB,qBAAqB;AAwD5D,eAAsB,wBACpB,QACA,UAA0B;AAAA,EACxB,UAAU,OAAO;AACnB,GACwB;AACxB,QAAM,cAAc,QAAQ,SAAS;AACrC,QAAM,kBACJ,OAAO,MAAM,YACb,IAAI,qBAAqB,OAAO,MAA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apsWebpackPlugin from '@metamask/snaps-webpack-plugin';\nimport type { Ora } from 'ora';\nimport { resolve } from 'path';\nimport TerserPlugin from 'terser-webpack-plugin';\nimport type { Configuration } from 'webpack';\nimport { DefinePlugin, ProgressPlugin, ProvidePlugin } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../config';\nimport { getFunctionLoader, wasm } from './loaders';\nimport {\n SnapsBuiltInResolver,\n SnapsBundleWarningsPlugin,\n SnapsStatsPlugin,\n SnapsWatchPlugin,\n} from './plugins';\nimport {\n BROWSERSLIST_FILE,\n getDefaultLoader,\n getDevTool,\n getEnvironmentVariables,\n getFallbacks,\n getImageSVG,\n getProgressHandler,\n} from './utils';\n\nexport type WebpackOptions = {\n /**\n * Whether to watch for changes.\n */\n watch?: boolean;\n\n /**\n * Whether to evaluate the bundle. If this is set, it will override the\n * `evaluate` option in the config object.\n */\n evaluate?: boolean;\n\n /**\n * The spinner to use for logging.\n */\n spinner?: Ora;\n};\n\n/**\n * Get the default Webpack configuration. This is the configuration that will\n * be used if the user doesn't provide a custom Webpack configuration. The\n * configuration is based on the snap config.\n *\n * The default configuration includes:\n *\n * - `SWC` to transpile TypeScript and JavaScript files.\n * - `TerserPlugin` to minify the bundle.\n * - `SnapsWebpackPlugin` to validate the bundle and update the manifest.\n *\n * It can be customized through the `customizeWebpackConfig` function in the\n * snap config, but in most cases, you shouldn't need to do that.\n *\n * @param config - The processed snap Webpack config.\n * @param options - The Webpack options.\n * @returns The default Webpack configuration.\n */\nexport async function getDefaultConfiguration(\n config: ProcessedWebpackConfig,\n options: WebpackOptions = {\n evaluate: config.evaluate,\n },\n): Promise<Configuration> {\n const spinnerText = options.spinner?.text;\n const builtInResolver =\n config.stats.builtIns &&\n new SnapsBuiltInResolver(config.stats.builtIns, options.spinner);\n\n return {\n /**\n * The target is set to `browserslist` so that Webpack will compile the\n * bundle to support the browsers specified in the `.browserslistrc` file.\n * This Browserslist file contains the browsers that are supported by\n * MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/target/\n */\n target: `browserslist:${BROWSERSLIST_FILE}`,\n\n /**\n * The mode is set to `production` by default, so that Webpack will minify\n * and optimize the bundle.\n *\n * @see https://webpack.js.org/configuration/mode/\n */\n mode: 'production',\n\n /**\n * The entry point is set to the `input` value from the config object.\n *\n * @see https://webpack.js.org/configuration/entry-context/\n */\n entry: config.input,\n\n /**\n * The devtool option controls how source maps are generated. We set it to\n * the `sourceMap` value from the config object.\n *\n * @see https://webpack.js.org/configuration/devtool/\n */\n devtool: getDevTool(config.sourceMap),\n\n /**\n * The stats option controls how much information is printed to the console\n * when Webpack is running. We set it to `none` so that we can control the\n * output ourselves.\n *\n * @see https://webpack.js.org/configuration/stats/\n */\n stats: 'none',\n\n /**\n * The output options.\n *\n * @see https://webpack.js.org/configuration/output/\n */\n output: {\n /**\n * This indicates whether Webpack should clear the output directory\n * before building. We set it to the `clean` value from the config\n * object.\n *\n * @see https://webpack.js.org/configuration/output/#outputclean\n */\n clean: config.output.clean,\n\n /**\n * The filename of the bundle. We set it to the `filename` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputfilename\n */\n filename: config.output.filename,\n\n /**\n * The path to the output directory. We set it to the `path` value from\n * the config object.\n *\n * @see https://webpack.js.org/configuration/output/#outputpath\n */\n path: config.output.path,\n\n /**\n * The public path of the bundle. We set it to `/` by default, so that\n * the bundle can be loaded from the root of the server.\n *\n * @see https://webpack.js.org/configuration/output/#outputpublicpath\n */\n publicPath: '/',\n\n /**\n * The library configuration. This tells Webpack how to export the\n * bundle.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrary\n */\n library: {\n /**\n * This tells Webpack to export the bundle as a CommonJS module. This\n * is necessary for MetaMask Snaps.\n *\n * @see https://webpack.js.org/configuration/output/#outputlibrarytarget\n */\n type: 'commonjs',\n },\n\n /**\n * The chunk format. This tells Webpack how to export chunks. This is\n * required because we use browserslist to target browsers, but Snaps are\n * not fully compatible with browser APIs (such as `window` and\n * `document`).\n *\n * @see https://webpack.js.org/configuration/output/#outputchunkformat\n */\n chunkFormat: 'commonjs',\n },\n\n /**\n * The module configuration. This is where we tell Webpack how to handle\n * different types of files.\n *\n * @see https://webpack.js.org/configuration/module/\n */\n module: {\n rules: [\n {\n test: /\\.(js|mjs|cjs|ts)$/u,\n exclude: /node_modules/u,\n use: await getDefaultLoader(config),\n },\n\n /**\n * This allows importing modules that uses `.js` and not `.mjs` for the\n * ES build.\n *\n * @see https://webpack.js.org/configuration/module/#resolvefullyspecified\n */\n {\n test: /\\.m?js$/u,\n resolve: {\n fullySpecified: false,\n },\n },\n\n /**\n * This allows importing `.svg` files as a string.\n */\n config.features.images && {\n test: /\\.svg$/u,\n // `asset/source` returns the source as a UTF-8 string.\n type: 'asset/source',\n },\n\n /**\n * This allows importing `.png` files as a data URL.\n */\n config.features.images && {\n test: /\\.png$/u,\n type: 'asset/inline',\n generator: {\n dataUrl: getImageSVG.bind(null, 'image/png'),\n },\n },\n\n /**\n * This allows importing `.jpe?g` files as a data URL.\n */\n config.features.images && {\n test: /\\.jpe?g$/u,\n type: 'asset/inline',\n generator: {\n dataUrl: getImageSVG.bind(null, 'image/jpeg'),\n },\n },\n\n config.experimental.wasm && {\n test: /\\.wasm$/u,\n use: getFunctionLoader(wasm, {}),\n },\n ],\n },\n\n /**\n * The resolve configuration. This tells Webpack how to resolve imports.\n * We set it to resolve `.js` and `.ts` files.\n *\n * @see https://webpack.js.org/configuration/resolve/\n */\n resolve: {\n /**\n * The extensions to resolve. We set it to resolve `.(c|m)?js` and `.ts`\n * files.\n */\n extensions: ['.js', '.mjs', '.cjs', '.ts'],\n\n /**\n * The fallback options. This tells Webpack how to handle imports that\n * aren't resolved. By default, we set Node.js built-ins to `false`, so\n * that they are ignored.\n */\n fallback: getFallbacks(config.polyfills),\n\n /**\n * The plugins to use. We use the {@link SnapsBuiltInResolver} to show\n * warnings about using Node.js built-ins, when no fallback is specified.\n */\n plugins: [builtInResolver],\n },\n\n /**\n * The plugins to use.\n *\n * @see https://webpack.js.org/configuration/plugins/\n */\n plugins: [\n /**\n * The `SnapsWebpackPlugin` is a Webpack plugin that checks and updates\n * the manifest file, and evaluates the bundle in SES. While not strictly\n * required, it's highly recommended to use this plugin.\n */\n new SnapsWebpackPlugin({\n manifestPath: config.manifest.path,\n writeManifest: config.manifest.update,\n eval: !options.watch && options.evaluate,\n }),\n\n /**\n * The `SnapsStatsPlugin` is a Webpack plugin that handles the stats\n * output. It's used to show the stats in the terminal, in a format that\n * is easy to read.\n */\n new SnapsStatsPlugin({ verbose: config.stats.verbose }, options.spinner),\n\n /**\n * The `DefinePlugin` is a Webpack plugin that adds static values to the\n * bundle. We use it to add the `NODE_DEBUG`, `NODE_ENV`, and `DEBUG`\n * environment variables, as well as any custom environment\n * variables (as `process.env`).\n */\n new DefinePlugin(getEnvironmentVariables(config.environment)),\n\n /**\n * The `ProgressPlugin` is a Webpack plugin that logs the progress of\n * the build. We set it to log the progress to the spinner.\n */\n new ProgressPlugin({\n handler: getProgressHandler(options.spinner, spinnerText),\n }),\n\n /**\n * The `SnapsBundleWarningPlugin` is a Webpack plugin that shows a\n * warning when the bundle is potentially incompatible with MetaMask\n * Snaps.\n */\n new SnapsBundleWarningsPlugin({\n builtInResolver,\n builtIns: Boolean(config.stats.builtIns),\n buffer: config.stats.buffer,\n }),\n\n /**\n * The `WatchPlugin` is a Webpack plugin that adds extra files to watch\n * for changes. This is useful for rebuilding the bundle when the\n * manifest file changes.\n */\n options.watch &&\n new SnapsWatchPlugin(\n {\n bundle: resolve(config.output.path, config.output.filename),\n evaluate: options.evaluate,\n files: [config.manifest.path],\n },\n options.spinner,\n ),\n\n /**\n * The `ProviderPlugin` is a Webpack plugin that automatically load\n * modules instead of having to import or require them everywhere.\n */\n (config.polyfills === true ||\n (config.polyfills !== false && config.polyfills.buffer)) &&\n new ProvidePlugin({\n Buffer: ['buffer', 'Buffer'],\n }),\n ].filter(Boolean),\n\n /**\n * The optimization configuration. This tells Webpack how to optimize the\n * bundle. Most of the time, you won't need to change this, as the default\n * options set by the `mode` option are sufficient.\n */\n optimization: {\n minimize: config.output.minimize,\n\n /**\n * The minimizer to use. We set it to use the `TerserPlugin`.\n */\n minimizer: [\n new TerserPlugin({\n parallel: true,\n }),\n ],\n },\n\n /**\n * The experiments configuration. This configures which Webpack\n * experiments to enable/disable.\n *\n * @see https://webpack.js.org/configuration/experiments\n */\n experiments: {\n /**\n * Experimental support for top level await.\n *\n * This is unsupported in Snaps and therefore disabled.\n *\n * @see https://webpack.js.org/configuration/experiments/#experimentstoplevelawait\n */\n topLevelAwait: false,\n },\n\n /**\n * The performance configuration. This tells Webpack how to handle\n * performance hints.\n *\n * @see https://webpack.js.org/configuration/performance/\n */\n performance: {\n /**\n * The hints to show. We set it to `false`, so that we don't get\n * performance hints, as they are not relevant for Snaps.\n *\n * @see https://webpack.js.org/configuration/performance/#performancehints\n */\n hints: false,\n },\n\n /**\n * The infrastructure logging configuration. This tells Webpack how to\n * log messages.\n *\n * @see https://webpack.js.org/configuration/infrastructure-logging\n */\n infrastructureLogging: {\n /**\n * The level of logging to use. We set it to `none`, so that we can\n * control the output ourselves.\n */\n level: 'none',\n },\n };\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHXTU3FLEjs = require('./chunk-HXTU3FLE.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkS7UP2YYFjs = require('./chunk-S7UP2YYF.js');
|
|
@@ -12,11 +12,11 @@ var command = {
|
|
|
12
12
|
builder: (yarg) => {
|
|
13
13
|
yarg.option("dist", _chunkS7UP2YYFjs.builders_default.dist).option("eval", _chunkS7UP2YYFjs.builders_default.eval).option("manifest", _chunkS7UP2YYFjs.builders_default.manifest).option("outfileName", _chunkS7UP2YYFjs.builders_default.outfileName).option("sourceMaps", _chunkS7UP2YYFjs.builders_default.sourceMaps).option("src", _chunkS7UP2YYFjs.builders_default.src).option("stripComments", _chunkS7UP2YYFjs.builders_default.stripComments).option("transpilationMode", _chunkS7UP2YYFjs.builders_default.transpilationMode).option("depsToTranspile", _chunkS7UP2YYFjs.builders_default.depsToTranspile).option("writeManifest", _chunkS7UP2YYFjs.builders_default.writeManifest).implies("writeManifest", "manifest").implies("depsToTranspile", "transpilationMode");
|
|
14
14
|
},
|
|
15
|
-
handler: async (argv) =>
|
|
15
|
+
handler: async (argv) => _chunkHXTU3FLEjs.buildHandler.call(void 0, argv.context.config)
|
|
16
16
|
};
|
|
17
17
|
var build_default = command;
|
|
18
18
|
|
|
19
19
|
|
|
20
20
|
|
|
21
21
|
exports.build_default = build_default;
|
|
22
|
-
//# sourceMappingURL=chunk-
|
|
22
|
+
//# sourceMappingURL=chunk-IQASR5US.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunk5QFM7NO5js = require('./chunk-5QFM7NO5.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
|
-
var
|
|
6
|
+
var _chunkIQASR5USjs = require('./chunk-IQASR5US.js');
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
var _chunkS76EZ6HYjs = require('./chunk-S76EZ6HY.js');
|
|
@@ -16,15 +16,15 @@ var _chunk6EEZHGF5js = require('./chunk-6EEZHGF5.js');
|
|
|
16
16
|
|
|
17
17
|
// src/commands/index.ts
|
|
18
18
|
var commands = [
|
|
19
|
-
|
|
19
|
+
_chunkIQASR5USjs.build_default,
|
|
20
20
|
_chunk6EEZHGF5js.eval_default,
|
|
21
21
|
_chunkS76EZ6HYjs.manifest_default,
|
|
22
22
|
_chunkU4VFMIGOjs.serve_default,
|
|
23
|
-
|
|
23
|
+
_chunk5QFM7NO5js.watch_default
|
|
24
24
|
];
|
|
25
25
|
var commands_default = commands;
|
|
26
26
|
|
|
27
27
|
|
|
28
28
|
|
|
29
29
|
exports.commands_default = commands_default;
|
|
30
|
-
//# sourceMappingURL=chunk-
|
|
30
|
+
//# sourceMappingURL=chunk-K7BAMTCB.js.map
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkIPQIKR4Wjs = require('./chunk-IPQIKR4W.js');
|
|
4
4
|
|
|
5
5
|
// src/webpack/compiler.ts
|
|
6
6
|
var _webpack = require('webpack');
|
|
7
7
|
async function getCompiler(config, options) {
|
|
8
|
-
const baseWebpackConfig = await
|
|
8
|
+
const baseWebpackConfig = await _chunkIPQIKR4Wjs.getDefaultConfiguration.call(void 0, config, options);
|
|
9
9
|
const webpackConfig = config.customizeWebpackConfig?.(baseWebpackConfig) ?? baseWebpackConfig;
|
|
10
10
|
return _webpack.webpack.call(void 0, webpackConfig);
|
|
11
11
|
}
|
|
@@ -13,4 +13,4 @@ async function getCompiler(config, options) {
|
|
|
13
13
|
|
|
14
14
|
|
|
15
15
|
exports.getCompiler = getCompiler;
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-L7OOEGTX.js.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildHandler
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4PECTXQ6.mjs";
|
|
4
4
|
import {
|
|
5
5
|
builders_default
|
|
6
6
|
} from "./chunk-MR44GPM3.mjs";
|
|
@@ -19,4 +19,4 @@ var build_default = command;
|
|
|
19
19
|
export {
|
|
20
20
|
build_default
|
|
21
21
|
};
|
|
22
|
-
//# sourceMappingURL=chunk-
|
|
22
|
+
//# sourceMappingURL=chunk-NQF6PKJG.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHQ5CYJ4Ajs = require('./chunk-HQ5CYJ4A.js');
|
|
4
4
|
|
|
5
5
|
|
|
6
6
|
var _chunkYGEAZQSCjs = require('./chunk-YGEAZQSC.js');
|
|
@@ -40,7 +40,7 @@ var steps = [
|
|
|
40
40
|
{
|
|
41
41
|
name: "Building the snap bundle.",
|
|
42
42
|
task: async ({ config, spinner }) => {
|
|
43
|
-
await
|
|
43
|
+
await _chunkHQ5CYJ4Ajs.watch.call(void 0, config, { spinner });
|
|
44
44
|
}
|
|
45
45
|
}
|
|
46
46
|
];
|
|
@@ -51,4 +51,4 @@ async function watchHandler(config, options) {
|
|
|
51
51
|
|
|
52
52
|
|
|
53
53
|
exports.watchHandler = watchHandler;
|
|
54
|
-
//# sourceMappingURL=chunk-
|
|
54
|
+
//# sourceMappingURL=chunk-NQUPDPTF.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
watch_default
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-FK5MBK5X.mjs";
|
|
4
4
|
import {
|
|
5
5
|
build_default
|
|
6
|
-
} from "./chunk-
|
|
6
|
+
} from "./chunk-NQF6PKJG.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-
|
|
30
|
+
//# sourceMappingURL=chunk-QXYTF636.mjs.map
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
getDefaultConfiguration
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-4XEATCHZ.mjs";
|
|
4
4
|
|
|
5
5
|
// src/webpack/compiler.ts
|
|
6
6
|
import { webpack } from "webpack";
|
|
@@ -13,4 +13,4 @@ async function getCompiler(config, options) {
|
|
|
13
13
|
export {
|
|
14
14
|
getCompiler
|
|
15
15
|
};
|
|
16
|
-
//# sourceMappingURL=chunk-
|
|
16
|
+
//# sourceMappingURL=chunk-X3G2RMOM.mjs.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var _chunkHXTU3FLEjs = require('../../chunk-HXTU3FLE.js');
|
|
4
|
+
require('../../chunk-HMRC5KQO.js');
|
|
5
5
|
require('../../chunk-VXOV3ZCB.js');
|
|
6
|
-
require('../../chunk-
|
|
7
|
-
require('../../chunk-
|
|
6
|
+
require('../../chunk-L7OOEGTX.js');
|
|
7
|
+
require('../../chunk-IPQIKR4W.js');
|
|
8
8
|
require('../../chunk-HNWSVD35.js');
|
|
9
9
|
require('../../chunk-6EEZHGF5.js');
|
|
10
10
|
require('../../chunk-KLOPX6DO.js');
|
|
@@ -25,5 +25,5 @@ require('../../chunk-BALQOCUO.js');
|
|
|
25
25
|
require('../../chunk-X3D3MHWF.js');
|
|
26
26
|
|
|
27
27
|
|
|
28
|
-
exports.buildHandler =
|
|
28
|
+
exports.buildHandler = _chunkHXTU3FLEjs.buildHandler;
|
|
29
29
|
//# sourceMappingURL=build.js.map
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
buildHandler
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-4PECTXQ6.mjs";
|
|
4
|
+
import "../../chunk-6NHFRBVV.mjs";
|
|
5
5
|
import "../../chunk-45LOTCC4.mjs";
|
|
6
|
-
import "../../chunk-
|
|
7
|
-
import "../../chunk-
|
|
6
|
+
import "../../chunk-X3G2RMOM.mjs";
|
|
7
|
+
import "../../chunk-4XEATCHZ.mjs";
|
|
8
8
|
import "../../chunk-JBSWMUCQ.mjs";
|
|
9
9
|
import "../../chunk-BYNQODL3.mjs";
|
|
10
10
|
import "../../chunk-K26BOY6Z.mjs";
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkHMRC5KQOjs = require('../../chunk-HMRC5KQO.js');
|
|
4
4
|
require('../../chunk-VXOV3ZCB.js');
|
|
5
|
-
require('../../chunk-
|
|
6
|
-
require('../../chunk-
|
|
5
|
+
require('../../chunk-L7OOEGTX.js');
|
|
6
|
+
require('../../chunk-IPQIKR4W.js');
|
|
7
7
|
require('../../chunk-HNWSVD35.js');
|
|
8
8
|
require('../../chunk-6EEZHGF5.js');
|
|
9
9
|
require('../../chunk-KLOPX6DO.js');
|
|
@@ -24,5 +24,5 @@ require('../../chunk-BALQOCUO.js');
|
|
|
24
24
|
require('../../chunk-X3D3MHWF.js');
|
|
25
25
|
|
|
26
26
|
|
|
27
|
-
exports.build =
|
|
27
|
+
exports.build = _chunkHMRC5KQOjs.build;
|
|
28
28
|
//# sourceMappingURL=implementation.js.map
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import {
|
|
2
2
|
build
|
|
3
|
-
} from "../../chunk-
|
|
3
|
+
} from "../../chunk-6NHFRBVV.mjs";
|
|
4
4
|
import "../../chunk-45LOTCC4.mjs";
|
|
5
|
-
import "../../chunk-
|
|
6
|
-
import "../../chunk-
|
|
5
|
+
import "../../chunk-X3G2RMOM.mjs";
|
|
6
|
+
import "../../chunk-4XEATCHZ.mjs";
|
|
7
7
|
import "../../chunk-JBSWMUCQ.mjs";
|
|
8
8
|
import "../../chunk-BYNQODL3.mjs";
|
|
9
9
|
import "../../chunk-K26BOY6Z.mjs";
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
4
|
-
require('../../chunk-
|
|
3
|
+
var _chunkIQASR5USjs = require('../../chunk-IQASR5US.js');
|
|
4
|
+
require('../../chunk-HXTU3FLE.js');
|
|
5
5
|
|
|
6
6
|
|
|
7
|
-
var
|
|
7
|
+
var _chunkHMRC5KQOjs = require('../../chunk-HMRC5KQO.js');
|
|
8
8
|
require('../../chunk-VXOV3ZCB.js');
|
|
9
|
-
require('../../chunk-
|
|
10
|
-
require('../../chunk-
|
|
9
|
+
require('../../chunk-L7OOEGTX.js');
|
|
10
|
+
require('../../chunk-IPQIKR4W.js');
|
|
11
11
|
require('../../chunk-HNWSVD35.js');
|
|
12
12
|
require('../../chunk-6EEZHGF5.js');
|
|
13
13
|
require('../../chunk-KLOPX6DO.js');
|
|
@@ -29,5 +29,5 @@ require('../../chunk-X3D3MHWF.js');
|
|
|
29
29
|
|
|
30
30
|
|
|
31
31
|
|
|
32
|
-
exports.build =
|
|
32
|
+
exports.build = _chunkHMRC5KQOjs.build; exports.default = _chunkIQASR5USjs.build_default;
|
|
33
33
|
//# sourceMappingURL=index.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
import {
|
|
2
2
|
build_default
|
|
3
|
-
} from "../../chunk-
|
|
4
|
-
import "../../chunk-
|
|
3
|
+
} from "../../chunk-NQF6PKJG.mjs";
|
|
4
|
+
import "../../chunk-4PECTXQ6.mjs";
|
|
5
5
|
import {
|
|
6
6
|
build
|
|
7
|
-
} from "../../chunk-
|
|
7
|
+
} from "../../chunk-6NHFRBVV.mjs";
|
|
8
8
|
import "../../chunk-45LOTCC4.mjs";
|
|
9
|
-
import "../../chunk-
|
|
10
|
-
import "../../chunk-
|
|
9
|
+
import "../../chunk-X3G2RMOM.mjs";
|
|
10
|
+
import "../../chunk-4XEATCHZ.mjs";
|
|
11
11
|
import "../../chunk-JBSWMUCQ.mjs";
|
|
12
12
|
import "../../chunk-BYNQODL3.mjs";
|
|
13
13
|
import "../../chunk-K26BOY6Z.mjs";
|