@metamask/snaps-cli 6.6.0 → 6.7.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 (64) hide show
  1. package/CHANGELOG.md +20 -1
  2. package/dist/builders.cjs +4 -1
  3. package/dist/builders.cjs.map +1 -1
  4. package/dist/builders.d.cts +117 -2
  5. package/dist/builders.d.cts.map +1 -1
  6. package/dist/builders.d.mts +117 -2
  7. package/dist/builders.d.mts.map +1 -1
  8. package/dist/builders.mjs +4 -1
  9. package/dist/builders.mjs.map +1 -1
  10. package/dist/commands/build/build.cjs +32 -6
  11. package/dist/commands/build/build.cjs.map +1 -1
  12. package/dist/commands/build/build.d.cts +2 -1
  13. package/dist/commands/build/build.d.cts.map +1 -1
  14. package/dist/commands/build/build.d.mts +2 -1
  15. package/dist/commands/build/build.d.mts.map +1 -1
  16. package/dist/commands/build/build.mjs +30 -4
  17. package/dist/commands/build/build.mjs.map +1 -1
  18. package/dist/commands/build/implementation.cjs +1 -1
  19. package/dist/commands/build/implementation.cjs.map +1 -1
  20. package/dist/commands/build/implementation.d.cts +2 -1
  21. package/dist/commands/build/implementation.d.cts.map +1 -1
  22. package/dist/commands/build/implementation.d.mts +2 -1
  23. package/dist/commands/build/implementation.d.mts.map +1 -1
  24. package/dist/commands/build/implementation.mjs +1 -1
  25. package/dist/commands/build/implementation.mjs.map +1 -1
  26. package/dist/commands/build/index.cjs +2 -1
  27. package/dist/commands/build/index.cjs.map +1 -1
  28. package/dist/commands/build/index.d.cts.map +1 -1
  29. package/dist/commands/build/index.d.mts.map +1 -1
  30. package/dist/commands/build/index.mjs +2 -1
  31. package/dist/commands/build/index.mjs.map +1 -1
  32. package/dist/commands/build/utils.cjs +25 -0
  33. package/dist/commands/build/utils.cjs.map +1 -0
  34. package/dist/commands/build/utils.d.cts +9 -0
  35. package/dist/commands/build/utils.d.cts.map +1 -0
  36. package/dist/commands/build/utils.d.mts +9 -0
  37. package/dist/commands/build/utils.d.mts.map +1 -0
  38. package/dist/commands/build/utils.mjs +21 -0
  39. package/dist/commands/build/utils.mjs.map +1 -0
  40. package/dist/utils/logging.cjs +16 -2
  41. package/dist/utils/logging.cjs.map +1 -1
  42. package/dist/utils/logging.d.cts +8 -1
  43. package/dist/utils/logging.d.cts.map +1 -1
  44. package/dist/utils/logging.d.mts +8 -1
  45. package/dist/utils/logging.d.mts.map +1 -1
  46. package/dist/utils/logging.mjs +15 -2
  47. package/dist/utils/logging.mjs.map +1 -1
  48. package/dist/utils/steps.cjs +11 -6
  49. package/dist/utils/steps.cjs.map +1 -1
  50. package/dist/utils/steps.d.cts +1 -1
  51. package/dist/utils/steps.d.cts.map +1 -1
  52. package/dist/utils/steps.d.mts +1 -1
  53. package/dist/utils/steps.d.mts.map +1 -1
  54. package/dist/utils/steps.mjs +11 -6
  55. package/dist/utils/steps.mjs.map +1 -1
  56. package/dist/webpack/config.cjs +12 -0
  57. package/dist/webpack/config.cjs.map +1 -1
  58. package/dist/webpack/config.d.cts +4 -0
  59. package/dist/webpack/config.d.cts.map +1 -1
  60. package/dist/webpack/config.d.mts +4 -0
  61. package/dist/webpack/config.d.mts.map +1 -1
  62. package/dist/webpack/config.mjs +12 -0
  63. package/dist/webpack/config.mjs.map +1 -1
  64. package/package.json +6 -5
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.d.cts","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAqB;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAsB;AAGpD;;;;;;GAMG;AACH,wBAAsB,KAAK,CACzB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,iBAoBzB"}
1
+ {"version":3,"file":"implementation.d.cts","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAqB;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAsB;AAGpD;;;;;;GAMG;AACH,wBAAsB,KAAK,CACzB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,qBAoBzB"}
@@ -1,3 +1,4 @@
1
+ import type { Compiler } from "webpack";
1
2
  import type { ProcessedWebpackConfig } from "../../config.mjs";
2
3
  import type { WebpackOptions } from "../../webpack/index.mjs";
3
4
  /**
@@ -7,5 +8,5 @@ import type { WebpackOptions } from "../../webpack/index.mjs";
7
8
  * @param options - The Webpack options.
8
9
  * @returns A promise that resolves when the bundle is built.
9
10
  */
10
- export declare function build(config: ProcessedWebpackConfig, options?: WebpackOptions): Promise<void>;
11
+ export declare function build(config: ProcessedWebpackConfig, options?: WebpackOptions): Promise<Compiler>;
11
12
  //# sourceMappingURL=implementation.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.d.mts","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAqB;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAsB;AAGpD;;;;;;GAMG;AACH,wBAAsB,KAAK,CACzB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,iBAoBzB"}
1
+ {"version":3,"file":"implementation.d.mts","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAqB;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAsB;AAGpD;;;;;;GAMG;AACH,wBAAsB,KAAK,CACzB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,qBAoBzB"}
@@ -19,7 +19,7 @@ export async function build(config, options) {
19
19
  reject(closeError);
20
20
  return;
21
21
  }
22
- resolve();
22
+ resolve(compiler);
23
23
  });
24
24
  });
25
25
  });
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.mjs","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,WAAW,EAAE,gCAAsB;AAE5C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,MAA8B,EAC9B,OAAwB;IAExB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,MAAM,IAAI,OAAO,CAAO,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACjD,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YACxB,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACjB,OAAO;YACT,CAAC;YAED,QAAQ,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE;gBAC5B,IAAI,UAAU,EAAE,CAAC;oBACf,MAAM,CAAC,UAAU,CAAC,CAAC;oBACnB,OAAO;gBACT,CAAC;gBAED,OAAO,EAAE,CAAC;YACZ,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { ProcessedWebpackConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle. This uses Webpack to build the bundle.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns A promise that resolves when the bundle is built.\n */\nexport async function build(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, options);\n return await new Promise<void>((resolve, reject) => {\n compiler.run((runError) => {\n if (runError) {\n reject(runError);\n return;\n }\n\n compiler.close((closeError) => {\n if (closeError) {\n reject(closeError);\n return;\n }\n\n resolve();\n });\n });\n });\n}\n"]}
1
+ {"version":3,"file":"implementation.mjs","sourceRoot":"","sources":["../../../src/commands/build/implementation.ts"],"names":[],"mappings":"AAIA,OAAO,EAAE,WAAW,EAAE,gCAAsB;AAE5C;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,MAA8B,EAC9B,OAAwB;IAExB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;IACpD,OAAO,MAAM,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QACrD,QAAQ,CAAC,GAAG,CAAC,CAAC,QAAQ,EAAE,EAAE;YACxB,IAAI,QAAQ,EAAE,CAAC;gBACb,MAAM,CAAC,QAAQ,CAAC,CAAC;gBACjB,OAAO;YACT,CAAC;YAED,QAAQ,CAAC,KAAK,CAAC,CAAC,UAAU,EAAE,EAAE;gBAC5B,IAAI,UAAU,EAAE,CAAC;oBACf,MAAM,CAAC,UAAU,CAAC,CAAC;oBACnB,OAAO;gBACT,CAAC;gBAED,OAAO,CAAC,QAAQ,CAAC,CAAC;YACpB,CAAC,CAAC,CAAC;QACL,CAAC,CAAC,CAAC;IACL,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import type { Compiler } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle. This uses Webpack to build the bundle.\n *\n * @param config - The config object.\n * @param options - The Webpack options.\n * @returns A promise that resolves when the bundle is built.\n */\nexport async function build(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, options);\n return await new Promise<Compiler>((resolve, reject) => {\n compiler.run((runError) => {\n if (runError) {\n reject(runError);\n return;\n }\n\n compiler.close((closeError) => {\n if (closeError) {\n reject(closeError);\n return;\n }\n\n resolve(compiler);\n });\n });\n });\n}\n"]}
@@ -24,6 +24,7 @@ const command = {
24
24
  desc: 'Build snap from source',
25
25
  builder: (yarg) => {
26
26
  yarg
27
+ .option('analyze', builders_1.default.analyze)
27
28
  .option('dist', builders_1.default.dist)
28
29
  .option('eval', builders_1.default.eval)
29
30
  .option('manifest', builders_1.default.manifest)
@@ -37,7 +38,7 @@ const command = {
37
38
  .implies('writeManifest', 'manifest')
38
39
  .implies('depsToTranspile', 'transpilationMode');
39
40
  },
40
- handler: async (argv) => (0, build_1.buildHandler)(argv.context.config),
41
+ handler: async (argv) => (0, build_1.buildHandler)(argv.context.config, argv.analyze),
41
42
  };
42
43
  __exportStar(require("./implementation.cjs"), exports);
43
44
  exports.default = command;
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/commands/build/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAEA,kEAAsC;AAEtC,uCAAuC;AAEvC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI;aACD,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,UAAU,EAAE,kBAAQ,CAAC,QAAQ,CAAC;aACrC,MAAM,CAAC,aAAa,EAAE,kBAAQ,CAAC,WAAW,CAAC;aAC3C,MAAM,CAAC,YAAY,EAAE,kBAAQ,CAAC,UAAU,CAAC;aACzC,MAAM,CAAC,KAAK,EAAE,kBAAQ,CAAC,GAAG,CAAC;aAC3B,MAAM,CAAC,eAAe,EAAE,kBAAQ,CAAC,aAAa,CAAC;aAC/C,MAAM,CAAC,mBAAmB,EAAE,kBAAQ,CAAC,iBAAiB,CAAC;aACvD,MAAM,CAAC,iBAAiB,EAAE,kBAAQ,CAAC,eAAe,CAAC;aACnD,MAAM,CAAC,eAAe,EAAE,kBAAQ,CAAC,aAAa,CAAC;aAC/C,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC;aACpC,OAAO,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CAAC,IAAA,oBAAY,EAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;CACtE,CAAC;AAEF,uDAAiC;AACjC,kBAAe,OAAO,CAAC","sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { buildHandler } from './build';\n\nconst command = {\n command: ['build', 'b'],\n desc: 'Build snap from source',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('dist', builders.dist)\n .option('eval', builders.eval)\n .option('manifest', builders.manifest)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('src', builders.src)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('writeManifest', builders.writeManifest)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode');\n },\n handler: async (argv: YargsArgs) => buildHandler(argv.context.config),\n};\n\nexport * from './implementation';\nexport default command;\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/commands/build/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAEA,kEAAsC;AAEtC,uCAAuC;AAEvC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI;aACD,MAAM,CAAC,SAAS,EAAE,kBAAQ,CAAC,OAAO,CAAC;aACnC,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,UAAU,EAAE,kBAAQ,CAAC,QAAQ,CAAC;aACrC,MAAM,CAAC,aAAa,EAAE,kBAAQ,CAAC,WAAW,CAAC;aAC3C,MAAM,CAAC,YAAY,EAAE,kBAAQ,CAAC,UAAU,CAAC;aACzC,MAAM,CAAC,KAAK,EAAE,kBAAQ,CAAC,GAAG,CAAC;aAC3B,MAAM,CAAC,eAAe,EAAE,kBAAQ,CAAC,aAAa,CAAC;aAC/C,MAAM,CAAC,mBAAmB,EAAE,kBAAQ,CAAC,iBAAiB,CAAC;aACvD,MAAM,CAAC,iBAAiB,EAAE,kBAAQ,CAAC,eAAe,CAAC;aACnD,MAAM,CAAC,eAAe,EAAE,kBAAQ,CAAC,aAAa,CAAC;aAC/C,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC;aACpC,OAAO,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CACjC,IAAA,oBAAY,EAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;CAClD,CAAC;AAEF,uDAAiC;AACjC,kBAAe,OAAO,CAAC","sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { buildHandler } from './build';\n\nconst command = {\n command: ['build', 'b'],\n desc: 'Build snap from source',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('analyze', builders.analyze)\n .option('dist', builders.dist)\n .option('eval', builders.eval)\n .option('manifest', builders.manifest)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('src', builders.src)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('writeManifest', builders.writeManifest)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode');\n },\n handler: async (argv: YargsArgs) =>\n buildHandler(argv.context.config, argv.analyze),\n};\n\nexport * from './implementation';\nexport default command;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/commands/build/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAGnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAeJ,SAAS;CAChC,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/commands/build/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAGnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAgBJ,SAAS;CAEhC,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/commands/build/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAGnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAeJ,SAAS;CAChC,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/commands/build/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAGnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAgBJ,SAAS;CAEhC,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC"}
@@ -5,6 +5,7 @@ const command = {
5
5
  desc: 'Build snap from source',
6
6
  builder: (yarg) => {
7
7
  yarg
8
+ .option('analyze', builders.analyze)
8
9
  .option('dist', builders.dist)
9
10
  .option('eval', builders.eval)
10
11
  .option('manifest', builders.manifest)
@@ -18,7 +19,7 @@ const command = {
18
19
  .implies('writeManifest', 'manifest')
19
20
  .implies('depsToTranspile', 'transpilationMode');
20
21
  },
21
- handler: async (argv) => buildHandler(argv.context.config),
22
+ handler: async (argv) => buildHandler(argv.context.config, argv.analyze),
22
23
  };
23
24
  export * from "./implementation.mjs";
24
25
  export default command;
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/commands/build/index.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,2BAAuB;AAEtC,OAAO,EAAE,YAAY,EAAE,oBAAgB;AAEvC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI;aACD,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC;aACrC,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,WAAW,CAAC;aAC3C,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC;aACzC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;aAC3B,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,aAAa,CAAC;aAC/C,MAAM,CAAC,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,CAAC;aACvD,MAAM,CAAC,iBAAiB,EAAE,QAAQ,CAAC,eAAe,CAAC;aACnD,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,aAAa,CAAC;aAC/C,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC;aACpC,OAAO,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CAAC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC;CACtE,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC","sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { buildHandler } from './build';\n\nconst command = {\n command: ['build', 'b'],\n desc: 'Build snap from source',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('dist', builders.dist)\n .option('eval', builders.eval)\n .option('manifest', builders.manifest)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('src', builders.src)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('writeManifest', builders.writeManifest)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode');\n },\n handler: async (argv: YargsArgs) => buildHandler(argv.context.config),\n};\n\nexport * from './implementation';\nexport default command;\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/commands/build/index.ts"],"names":[],"mappings":"AAEA,OAAO,QAAQ,2BAAuB;AAEtC,OAAO,EAAE,YAAY,EAAE,oBAAgB;AAEvC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,wBAAwB;IAC9B,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI;aACD,MAAM,CAAC,SAAS,EAAE,QAAQ,CAAC,OAAO,CAAC;aACnC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC;aACrC,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,WAAW,CAAC;aAC3C,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC;aACzC,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;aAC3B,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,aAAa,CAAC;aAC/C,MAAM,CAAC,mBAAmB,EAAE,QAAQ,CAAC,iBAAiB,CAAC;aACvD,MAAM,CAAC,iBAAiB,EAAE,QAAQ,CAAC,eAAe,CAAC;aACnD,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,aAAa,CAAC;aAC/C,OAAO,CAAC,eAAe,EAAE,UAAU,CAAC;aACpC,OAAO,CAAC,iBAAiB,EAAE,mBAAmB,CAAC,CAAC;IACrD,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CACjC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE,IAAI,CAAC,OAAO,CAAC;CAClD,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC","sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { buildHandler } from './build';\n\nconst command = {\n command: ['build', 'b'],\n desc: 'Build snap from source',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('analyze', builders.analyze)\n .option('dist', builders.dist)\n .option('eval', builders.eval)\n .option('manifest', builders.manifest)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('src', builders.src)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('writeManifest', builders.writeManifest)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode');\n },\n handler: async (argv: YargsArgs) =>\n buildHandler(argv.context.config, argv.analyze),\n};\n\nexport * from './implementation';\nexport default command;\n"]}
@@ -0,0 +1,25 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.getBundleAnalyzerPort = void 0;
4
+ const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
5
+ /**
6
+ * Get the port of the bundle analyzer server.
7
+ *
8
+ * @param compiler - The Webpack compiler.
9
+ * @returns The port of the bundle analyzer server.
10
+ */
11
+ async function getBundleAnalyzerPort(compiler) {
12
+ const analyzerPlugin = compiler.options.plugins.find((plugin) => plugin instanceof webpack_bundle_analyzer_1.BundleAnalyzerPlugin);
13
+ if (analyzerPlugin?.server) {
14
+ const { http } = await analyzerPlugin.server;
15
+ const address = http.address();
16
+ if (typeof address === 'string') {
17
+ const { port } = new URL(address);
18
+ return parseInt(port, 10);
19
+ }
20
+ return address?.port;
21
+ }
22
+ return undefined;
23
+ }
24
+ exports.getBundleAnalyzerPort = getBundleAnalyzerPort;
25
+ //# sourceMappingURL=utils.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.cjs","sourceRoot":"","sources":["../../../src/commands/build/utils.ts"],"names":[],"mappings":";;;AACA,qEAA+D;AAE/D;;;;;GAKG;AACI,KAAK,UAAU,qBAAqB,CAAC,QAAkB;IAC5D,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAClD,CAAC,MAAM,EAAkC,EAAE,CACzC,MAAM,YAAY,8CAAoB,CACzC,CAAC;IAEF,IAAI,cAAc,EAAE,MAAM,EAAE,CAAC;QAC3B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC;QAE7C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;YAClC,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,OAAO,EAAE,IAAI,CAAC;IACvB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC;AAnBD,sDAmBC","sourcesContent":["import type { Compiler } from 'webpack';\nimport { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';\n\n/**\n * Get the port of the bundle analyzer server.\n *\n * @param compiler - The Webpack compiler.\n * @returns The port of the bundle analyzer server.\n */\nexport async function getBundleAnalyzerPort(compiler: Compiler) {\n const analyzerPlugin = compiler.options.plugins.find(\n (plugin): plugin is BundleAnalyzerPlugin =>\n plugin instanceof BundleAnalyzerPlugin,\n );\n\n if (analyzerPlugin?.server) {\n const { http } = await analyzerPlugin.server;\n\n const address = http.address();\n if (typeof address === 'string') {\n const { port } = new URL(address);\n return parseInt(port, 10);\n }\n\n return address?.port;\n }\n\n return undefined;\n}\n"]}
@@ -0,0 +1,9 @@
1
+ import type { Compiler } from "webpack";
2
+ /**
3
+ * Get the port of the bundle analyzer server.
4
+ *
5
+ * @param compiler - The Webpack compiler.
6
+ * @returns The port of the bundle analyzer server.
7
+ */
8
+ export declare function getBundleAnalyzerPort(compiler: Compiler): Promise<number | undefined>;
9
+ //# sourceMappingURL=utils.d.cts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.cts","sourceRoot":"","sources":["../../../src/commands/build/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAGxC;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,+BAmB7D"}
@@ -0,0 +1,9 @@
1
+ import type { Compiler } from "webpack";
2
+ /**
3
+ * Get the port of the bundle analyzer server.
4
+ *
5
+ * @param compiler - The Webpack compiler.
6
+ * @returns The port of the bundle analyzer server.
7
+ */
8
+ export declare function getBundleAnalyzerPort(compiler: Compiler): Promise<number | undefined>;
9
+ //# sourceMappingURL=utils.d.mts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.d.mts","sourceRoot":"","sources":["../../../src/commands/build/utils.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAGxC;;;;;GAKG;AACH,wBAAsB,qBAAqB,CAAC,QAAQ,EAAE,QAAQ,+BAmB7D"}
@@ -0,0 +1,21 @@
1
+ import { BundleAnalyzerPlugin } from "webpack-bundle-analyzer";
2
+ /**
3
+ * Get the port of the bundle analyzer server.
4
+ *
5
+ * @param compiler - The Webpack compiler.
6
+ * @returns The port of the bundle analyzer server.
7
+ */
8
+ export async function getBundleAnalyzerPort(compiler) {
9
+ const analyzerPlugin = compiler.options.plugins.find((plugin) => plugin instanceof BundleAnalyzerPlugin);
10
+ if (analyzerPlugin?.server) {
11
+ const { http } = await analyzerPlugin.server;
12
+ const address = http.address();
13
+ if (typeof address === 'string') {
14
+ const { port } = new URL(address);
15
+ return parseInt(port, 10);
16
+ }
17
+ return address?.port;
18
+ }
19
+ return undefined;
20
+ }
21
+ //# sourceMappingURL=utils.mjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"utils.mjs","sourceRoot":"","sources":["../../../src/commands/build/utils.ts"],"names":[],"mappings":"AACA,OAAO,EAAE,oBAAoB,EAAE,gCAAgC;AAE/D;;;;;GAKG;AACH,MAAM,CAAC,KAAK,UAAU,qBAAqB,CAAC,QAAkB;IAC5D,MAAM,cAAc,GAAG,QAAQ,CAAC,OAAO,CAAC,OAAO,CAAC,IAAI,CAClD,CAAC,MAAM,EAAkC,EAAE,CACzC,MAAM,YAAY,oBAAoB,CACzC,CAAC;IAEF,IAAI,cAAc,EAAE,MAAM,EAAE,CAAC;QAC3B,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,cAAc,CAAC,MAAM,CAAC;QAE7C,MAAM,OAAO,GAAG,IAAI,CAAC,OAAO,EAAE,CAAC;QAC/B,IAAI,OAAO,OAAO,KAAK,QAAQ,EAAE,CAAC;YAChC,MAAM,EAAE,IAAI,EAAE,GAAG,IAAI,GAAG,CAAC,OAAO,CAAC,CAAC;YAClC,OAAO,QAAQ,CAAC,IAAI,EAAE,EAAE,CAAC,CAAC;QAC5B,CAAC;QAED,OAAO,OAAO,EAAE,IAAI,CAAC;IACvB,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC","sourcesContent":["import type { Compiler } from 'webpack';\nimport { BundleAnalyzerPlugin } from 'webpack-bundle-analyzer';\n\n/**\n * Get the port of the bundle analyzer server.\n *\n * @param compiler - The Webpack compiler.\n * @returns The port of the bundle analyzer server.\n */\nexport async function getBundleAnalyzerPort(compiler: Compiler) {\n const analyzerPlugin = compiler.options.plugins.find(\n (plugin): plugin is BundleAnalyzerPlugin =>\n plugin instanceof BundleAnalyzerPlugin,\n );\n\n if (analyzerPlugin?.server) {\n const { http } = await analyzerPlugin.server;\n\n const address = http.address();\n if (typeof address === 'string') {\n const { port } = new URL(address);\n return parseInt(port, 10);\n }\n\n return address?.port;\n }\n\n return undefined;\n}\n"]}
@@ -1,10 +1,24 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.error = exports.info = exports.warn = void 0;
3
+ exports.error = exports.info = exports.warn = exports.success = void 0;
4
4
  const snaps_utils_1 = require("@metamask/snaps-utils");
5
5
  const chalk_1 = require("chalk");
6
6
  /**
7
- * Log a warning message. The message is prefixed with "Warning:".
7
+ * Log a success message. The message is prefixed with a green checkmark.
8
+ *
9
+ * @param message - The message to log.
10
+ * @param spinner - The spinner to clear.
11
+ */
12
+ function success(message, spinner) {
13
+ if (spinner) {
14
+ spinner.clear();
15
+ spinner.frame();
16
+ }
17
+ (0, snaps_utils_1.logInfo)(`${(0, chalk_1.green)('✔')} ${message}`);
18
+ }
19
+ exports.success = success;
20
+ /**
21
+ * Log a warning message. The message is prefixed with a yellow warning sign.
8
22
  *
9
23
  * @param message - The message to log.
10
24
  * @param spinner - The spinner to clear.
@@ -1 +1 @@
1
- {"version":3,"file":"logging.cjs","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":";;;AAAA,uDAAsE;AACtE,iCAA+C;AAG/C;;;;;GAKG;AACH,SAAgB,IAAI,CAAC,OAAe,EAAE,OAAa;IACjD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,IAAA,wBAAU,EAAC,GAAG,IAAA,cAAM,EAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AAC1C,CAAC;AAPD,oBAOC;AAED;;;;;GAKG;AACH,SAAgB,IAAI,CAAC,OAAe,EAAE,OAAa;IACjD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,IAAA,qBAAO,EAAC,GAAG,IAAA,YAAI,EAAC,GAAG,CAAC,IAAI,IAAA,WAAG,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAPD,oBAOC;AAED;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,OAAe,EAAE,OAAa;IAClD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,IAAA,sBAAQ,EAAC,GAAG,IAAA,WAAG,EAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AACrC,CAAC;AAPD,sBAOC","sourcesContent":["import { logError, logInfo, logWarning } from '@metamask/snaps-utils';\nimport { blue, dim, red, yellow } from 'chalk';\nimport type { Ora } from 'ora';\n\n/**\n * Log a warning message. The message is prefixed with \"Warning:\".\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function warn(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logWarning(`${yellow('⚠')} ${message}`);\n}\n\n/**\n * Log an info message.\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function info(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logInfo(`${blue('ℹ')} ${dim(message)}`);\n}\n\n/**\n * Log an error message. The message is prefixed with \"Error:\".\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function error(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logError(`${red('✖')} ${message}`);\n}\n"]}
1
+ {"version":3,"file":"logging.cjs","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":";;;AAAA,uDAAsE;AACtE,iCAAsD;AAGtD;;;;;GAKG;AACH,SAAgB,OAAO,CAAC,OAAe,EAAE,OAAa;IACpD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,IAAA,qBAAO,EAAC,GAAG,IAAA,aAAK,EAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AACtC,CAAC;AAPD,0BAOC;AAED;;;;;GAKG;AACH,SAAgB,IAAI,CAAC,OAAe,EAAE,OAAa;IACjD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,IAAA,wBAAU,EAAC,GAAG,IAAA,cAAM,EAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AAC1C,CAAC;AAPD,oBAOC;AAED;;;;;GAKG;AACH,SAAgB,IAAI,CAAC,OAAe,EAAE,OAAa;IACjD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,IAAA,qBAAO,EAAC,GAAG,IAAA,YAAI,EAAC,GAAG,CAAC,IAAI,IAAA,WAAG,EAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAPD,oBAOC;AAED;;;;;GAKG;AACH,SAAgB,KAAK,CAAC,OAAe,EAAE,OAAa;IAClD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,IAAA,sBAAQ,EAAC,GAAG,IAAA,WAAG,EAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AACrC,CAAC;AAPD,sBAOC","sourcesContent":["import { logError, logInfo, logWarning } from '@metamask/snaps-utils';\nimport { blue, dim, green, red, yellow } from 'chalk';\nimport type { Ora } from 'ora';\n\n/**\n * Log a success message. The message is prefixed with a green checkmark.\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function success(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logInfo(`${green('✔')} ${message}`);\n}\n\n/**\n * Log a warning message. The message is prefixed with a yellow warning sign.\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function warn(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logWarning(`${yellow('⚠')} ${message}`);\n}\n\n/**\n * Log an info message.\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function info(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logInfo(`${blue('ℹ')} ${dim(message)}`);\n}\n\n/**\n * Log an error message. The message is prefixed with \"Error:\".\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function error(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logError(`${red('✖')} ${message}`);\n}\n"]}
@@ -1,6 +1,13 @@
1
1
  import type { Ora } from "ora/index.js";
2
2
  /**
3
- * Log a warning message. The message is prefixed with "Warning:".
3
+ * Log a success message. The message is prefixed with a green checkmark.
4
+ *
5
+ * @param message - The message to log.
6
+ * @param spinner - The spinner to clear.
7
+ */
8
+ export declare function success(message: string, spinner?: Ora): void;
9
+ /**
10
+ * Log a warning message. The message is prefixed with a yellow warning sign.
4
11
  *
5
12
  * @param message - The message to log.
6
13
  * @param spinner - The spinner to clear.
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.cts","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAE/B;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOlD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOlD;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOnD"}
1
+ {"version":3,"file":"logging.d.cts","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAE/B;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOrD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOlD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOlD;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOnD"}
@@ -1,6 +1,13 @@
1
1
  import type { Ora } from "ora/index.js";
2
2
  /**
3
- * Log a warning message. The message is prefixed with "Warning:".
3
+ * Log a success message. The message is prefixed with a green checkmark.
4
+ *
5
+ * @param message - The message to log.
6
+ * @param spinner - The spinner to clear.
7
+ */
8
+ export declare function success(message: string, spinner?: Ora): void;
9
+ /**
10
+ * Log a warning message. The message is prefixed with a yellow warning sign.
4
11
  *
5
12
  * @param message - The message to log.
6
13
  * @param spinner - The spinner to clear.
@@ -1 +1 @@
1
- {"version":3,"file":"logging.d.mts","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAE/B;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOlD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOlD;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOnD"}
1
+ {"version":3,"file":"logging.d.mts","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAE/B;;;;;GAKG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOrD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOlD;AAED;;;;;GAKG;AACH,wBAAgB,IAAI,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOlD;AAED;;;;;GAKG;AACH,wBAAgB,KAAK,CAAC,OAAO,EAAE,MAAM,EAAE,OAAO,CAAC,EAAE,GAAG,QAOnD"}
@@ -1,8 +1,21 @@
1
1
  import { logError, logInfo, logWarning } from "@metamask/snaps-utils";
2
2
  import $chalk from "chalk";
3
- const { blue, dim, red, yellow } = $chalk;
3
+ const { blue, dim, green, red, yellow } = $chalk;
4
4
  /**
5
- * Log a warning message. The message is prefixed with "Warning:".
5
+ * Log a success message. The message is prefixed with a green checkmark.
6
+ *
7
+ * @param message - The message to log.
8
+ * @param spinner - The spinner to clear.
9
+ */
10
+ export function success(message, spinner) {
11
+ if (spinner) {
12
+ spinner.clear();
13
+ spinner.frame();
14
+ }
15
+ logInfo(`${green('✔')} ${message}`);
16
+ }
17
+ /**
18
+ * Log a warning message. The message is prefixed with a yellow warning sign.
6
19
  *
7
20
  * @param message - The message to log.
8
21
  * @param spinner - The spinner to clear.
@@ -1 +1 @@
1
- {"version":3,"file":"logging.mjs","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,8BAA8B;;;AAItE;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe,EAAE,OAAa;IACjD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,UAAU,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe,EAAE,OAAa;IACjD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,OAAe,EAAE,OAAa;IAClD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import { logError, logInfo, logWarning } from '@metamask/snaps-utils';\nimport { blue, dim, red, yellow } from 'chalk';\nimport type { Ora } from 'ora';\n\n/**\n * Log a warning message. The message is prefixed with \"Warning:\".\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function warn(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logWarning(`${yellow('⚠')} ${message}`);\n}\n\n/**\n * Log an info message.\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function info(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logInfo(`${blue('ℹ')} ${dim(message)}`);\n}\n\n/**\n * Log an error message. The message is prefixed with \"Error:\".\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function error(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logError(`${red('✖')} ${message}`);\n}\n"]}
1
+ {"version":3,"file":"logging.mjs","sourceRoot":"","sources":["../../src/utils/logging.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,OAAO,EAAE,UAAU,EAAE,8BAA8B;;;AAItE;;;;;GAKG;AACH,MAAM,UAAU,OAAO,CAAC,OAAe,EAAE,OAAa;IACpD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,KAAK,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AACtC,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe,EAAE,OAAa;IACjD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,UAAU,CAAC,GAAG,MAAM,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,IAAI,CAAC,OAAe,EAAE,OAAa;IACjD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,OAAO,CAAC,GAAG,IAAI,CAAC,GAAG,CAAC,IAAI,GAAG,CAAC,OAAO,CAAC,EAAE,CAAC,CAAC;AAC1C,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,KAAK,CAAC,OAAe,EAAE,OAAa;IAClD,IAAI,OAAO,EAAE,CAAC;QACZ,OAAO,CAAC,KAAK,EAAE,CAAC;QAChB,OAAO,CAAC,KAAK,EAAE,CAAC;IAClB,CAAC;IAED,QAAQ,CAAC,GAAG,GAAG,CAAC,GAAG,CAAC,IAAI,OAAO,EAAE,CAAC,CAAC;AACrC,CAAC","sourcesContent":["import { logError, logInfo, logWarning } from '@metamask/snaps-utils';\nimport { blue, dim, green, red, yellow } from 'chalk';\nimport type { Ora } from 'ora';\n\n/**\n * Log a success message. The message is prefixed with a green checkmark.\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function success(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logInfo(`${green('✔')} ${message}`);\n}\n\n/**\n * Log a warning message. The message is prefixed with a yellow warning sign.\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function warn(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logWarning(`${yellow('⚠')} ${message}`);\n}\n\n/**\n * Log an info message.\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function info(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logInfo(`${blue('ℹ')} ${dim(message)}`);\n}\n\n/**\n * Log an error message. The message is prefixed with \"Error:\".\n *\n * @param message - The message to log.\n * @param spinner - The spinner to clear.\n */\nexport function error(message: string, spinner?: Ora) {\n if (spinner) {\n spinner.clear();\n spinner.frame();\n }\n\n logError(`${red('✖')} ${message}`);\n}\n"]}
@@ -22,19 +22,23 @@ async function executeSteps(steps, context) {
22
22
  });
23
23
  spinner.start();
24
24
  try {
25
- for (const step of steps) {
25
+ await steps.reduce(async (contextPromise, step) => {
26
+ const currentContext = await contextPromise;
26
27
  // If the step has a condition, and it returns false, we skip the step.
27
- if (step.condition && !step.condition(context)) {
28
- continue;
28
+ if (step.condition && !step.condition(currentContext)) {
29
+ return currentContext;
29
30
  }
30
31
  // Calling `start` here instead of setting `spinner.text` seems to work
31
32
  // better when the process doesn't have a TTY.
32
33
  spinner.start((0, chalk_1.dim)(step.name));
33
- await step.task({
34
- ...context,
34
+ const newContext = await step.task({
35
+ ...currentContext,
35
36
  spinner,
36
37
  });
37
- }
38
+ // If the task returns a new context, we use it. Otherwise, we keep the
39
+ // current context.
40
+ return newContext ?? currentContext;
41
+ }, Promise.resolve(context));
38
42
  // The spinner may have been stopped by a step, so we only succeed if it's
39
43
  // still spinning.
40
44
  if (spinner.isSpinning) {
@@ -44,6 +48,7 @@ async function executeSteps(steps, context) {
44
48
  catch (_error) {
45
49
  (0, logging_1.error)((0, errors_1.getErrorMessage)(_error), spinner);
46
50
  spinner.stop();
51
+ // eslint-disable-next-line require-atomic-updates
47
52
  process.exitCode = 1;
48
53
  }
49
54
  }
@@ -1 +1 @@
1
- {"version":3,"file":"steps.cjs","sourceRoot":"","sources":["../../src/utils/steps.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA4B;AAE5B,uDAAgC;AAEhC,yCAA2C;AAC3C,2CAAkC;AAYlC;;;;;;GAMG;AACI,KAAK,UAAU,YAAY,CAChC,KAAqB,EACrB,OAAgB;IAEhB,MAAM,OAAO,GAAG,IAAA,aAAa,EAAC;QAC5B,6CAA6C;QAC7C,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,EAAE,CAAC;IAEhB,IAAI,CAAC;QACH,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,uEAAuE;YACvE,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/C,SAAS;YACX,CAAC;YAED,uEAAuE;YACvE,8CAA8C;YAC9C,OAAO,CAAC,KAAK,CAAC,IAAA,WAAG,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAE9B,MAAM,IAAI,CAAC,IAAI,CAAC;gBACd,GAAG,OAAO;gBACV,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QAED,0EAA0E;QAC1E,kBAAkB;QAClB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,IAAA,eAAK,EAAC,IAAA,wBAAe,EAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AAtCD,oCAsCC","sourcesContent":["import { dim } from 'chalk';\nimport type { Ora } from 'ora';\nimport createSpinner from 'ora';\n\nimport { getErrorMessage } from './errors';\nimport { error } from './logging';\n\nexport type Step<Context extends Record<string, unknown>> = {\n name: string;\n condition?: (context: Context) => boolean;\n task: (context: Context & { spinner: Ora }) => Promise<void>;\n};\n\nexport type Steps<Context extends Record<string, unknown>> = Readonly<\n Step<Context>[]\n>;\n\n/**\n * Execute a list of steps in series. Each step receives the context object and\n * a spinner instance.\n *\n * @param steps - The steps to execute.\n * @param context - The context object that will be passed to each step.\n */\nexport async function executeSteps<Context extends Record<string, unknown>>(\n steps: Steps<Context>,\n context: Context,\n) {\n const spinner = createSpinner({\n // Ora writes to `process.stderr` by default.\n stream: process.stdout,\n });\n\n spinner.start();\n\n try {\n for (const step of steps) {\n // If the step has a condition, and it returns false, we skip the step.\n if (step.condition && !step.condition(context)) {\n continue;\n }\n\n // Calling `start` here instead of setting `spinner.text` seems to work\n // better when the process doesn't have a TTY.\n spinner.start(dim(step.name));\n\n await step.task({\n ...context,\n spinner,\n });\n }\n\n // The spinner may have been stopped by a step, so we only succeed if it's\n // still spinning.\n if (spinner.isSpinning) {\n spinner.succeed('Done!');\n }\n } catch (_error) {\n error(getErrorMessage(_error), spinner);\n spinner.stop();\n process.exitCode = 1;\n }\n}\n"]}
1
+ {"version":3,"file":"steps.cjs","sourceRoot":"","sources":["../../src/utils/steps.ts"],"names":[],"mappings":";;;;;;AAAA,iCAA4B;AAE5B,uDAAgC;AAEhC,yCAA2C;AAC3C,2CAAkC;AAYlC;;;;;;GAMG;AACI,KAAK,UAAU,YAAY,CAChC,KAAqB,EACrB,OAAgB;IAEhB,MAAM,OAAO,GAAG,IAAA,aAAa,EAAC;QAC5B,6CAA6C;QAC7C,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,EAAE,CAAC;IAEhB,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,MAAM,CAAmB,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE;YAClE,MAAM,cAAc,GAAG,MAAM,cAAc,CAAC;YAE5C,uEAAuE;YACvE,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtD,OAAO,cAAc,CAAC;YACxB,CAAC;YAED,uEAAuE;YACvE,8CAA8C;YAC9C,OAAO,CAAC,KAAK,CAAC,IAAA,WAAG,EAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAE9B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;gBACjC,GAAG,cAAc;gBACjB,OAAO;aACR,CAAC,CAAC;YAEH,uEAAuE;YACvE,mBAAmB;YACnB,OAAO,UAAU,IAAI,cAAc,CAAC;QACtC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAE7B,0EAA0E;QAC1E,kBAAkB;QAClB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,IAAA,eAAK,EAAC,IAAA,wBAAe,EAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,EAAE,CAAC;QAEf,kDAAkD;QAClD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC;AA9CD,oCA8CC","sourcesContent":["import { dim } from 'chalk';\nimport type { Ora } from 'ora';\nimport createSpinner from 'ora';\n\nimport { getErrorMessage } from './errors';\nimport { error } from './logging';\n\nexport type Step<Context extends Record<string, unknown>> = {\n name: string;\n condition?: (context: Context) => boolean;\n task: (context: Context & { spinner: Ora }) => Promise<Context | void>;\n};\n\nexport type Steps<Context extends Record<string, unknown>> = Readonly<\n Step<Context>[]\n>;\n\n/**\n * Execute a list of steps in series. Each step receives the context object and\n * a spinner instance.\n *\n * @param steps - The steps to execute.\n * @param context - The context object that will be passed to each step.\n */\nexport async function executeSteps<Context extends Record<string, unknown>>(\n steps: Steps<Context>,\n context: Context,\n) {\n const spinner = createSpinner({\n // Ora writes to `process.stderr` by default.\n stream: process.stdout,\n });\n\n spinner.start();\n\n try {\n await steps.reduce<Promise<Context>>(async (contextPromise, step) => {\n const currentContext = await contextPromise;\n\n // If the step has a condition, and it returns false, we skip the step.\n if (step.condition && !step.condition(currentContext)) {\n return currentContext;\n }\n\n // Calling `start` here instead of setting `spinner.text` seems to work\n // better when the process doesn't have a TTY.\n spinner.start(dim(step.name));\n\n const newContext = await step.task({\n ...currentContext,\n spinner,\n });\n\n // If the task returns a new context, we use it. Otherwise, we keep the\n // current context.\n return newContext ?? currentContext;\n }, Promise.resolve(context));\n\n // The spinner may have been stopped by a step, so we only succeed if it's\n // still spinning.\n if (spinner.isSpinning) {\n spinner.succeed('Done!');\n }\n } catch (_error) {\n error(getErrorMessage(_error), spinner);\n spinner.stop();\n\n // eslint-disable-next-line require-atomic-updates\n process.exitCode = 1;\n }\n}\n"]}
@@ -4,7 +4,7 @@ export type Step<Context extends Record<string, unknown>> = {
4
4
  condition?: (context: Context) => boolean;
5
5
  task: (context: Context & {
6
6
  spinner: Ora;
7
- }) => Promise<void>;
7
+ }) => Promise<Context | void>;
8
8
  };
9
9
  export type Steps<Context extends Record<string, unknown>> = Readonly<Step<Context>[]>;
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"steps.d.cts","sourceRoot":"","sources":["../../src/utils/steps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAM/B,MAAM,MAAM,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;IAC1C,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,KAAK,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,QAAQ,CACnE,IAAI,CAAC,OAAO,CAAC,EAAE,CAChB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EACrB,OAAO,EAAE,OAAO,iBAoCjB"}
1
+ {"version":3,"file":"steps.d.cts","sourceRoot":"","sources":["../../src/utils/steps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAM/B,MAAM,MAAM,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;IAC1C,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CACxE,CAAC;AAEF,MAAM,MAAM,KAAK,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,QAAQ,CACnE,IAAI,CAAC,OAAO,CAAC,EAAE,CAChB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EACrB,OAAO,EAAE,OAAO,iBA4CjB"}
@@ -4,7 +4,7 @@ export type Step<Context extends Record<string, unknown>> = {
4
4
  condition?: (context: Context) => boolean;
5
5
  task: (context: Context & {
6
6
  spinner: Ora;
7
- }) => Promise<void>;
7
+ }) => Promise<Context | void>;
8
8
  };
9
9
  export type Steps<Context extends Record<string, unknown>> = Readonly<Step<Context>[]>;
10
10
  /**
@@ -1 +1 @@
1
- {"version":3,"file":"steps.d.mts","sourceRoot":"","sources":["../../src/utils/steps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAM/B,MAAM,MAAM,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;IAC1C,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,KAAK,OAAO,CAAC,IAAI,CAAC,CAAC;CAC9D,CAAC;AAEF,MAAM,MAAM,KAAK,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,QAAQ,CACnE,IAAI,CAAC,OAAO,CAAC,EAAE,CAChB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EACrB,OAAO,EAAE,OAAO,iBAoCjB"}
1
+ {"version":3,"file":"steps.d.mts","sourceRoot":"","sources":["../../src/utils/steps.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,GAAG,EAAE,qBAAY;AAM/B,MAAM,MAAM,IAAI,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI;IAC1D,IAAI,EAAE,MAAM,CAAC;IACb,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,OAAO,KAAK,OAAO,CAAC;IAC1C,IAAI,EAAE,CAAC,OAAO,EAAE,OAAO,GAAG;QAAE,OAAO,EAAE,GAAG,CAAA;KAAE,KAAK,OAAO,CAAC,OAAO,GAAG,IAAI,CAAC,CAAC;CACxE,CAAC;AAEF,MAAM,MAAM,KAAK,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,IAAI,QAAQ,CACnE,IAAI,CAAC,OAAO,CAAC,EAAE,CAChB,CAAC;AAEF;;;;;;GAMG;AACH,wBAAsB,YAAY,CAAC,OAAO,SAAS,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACxE,KAAK,EAAE,KAAK,CAAC,OAAO,CAAC,EACrB,OAAO,EAAE,OAAO,iBA4CjB"}
@@ -24,19 +24,23 @@ export async function executeSteps(steps, context) {
24
24
  });
25
25
  spinner.start();
26
26
  try {
27
- for (const step of steps) {
27
+ await steps.reduce(async (contextPromise, step) => {
28
+ const currentContext = await contextPromise;
28
29
  // If the step has a condition, and it returns false, we skip the step.
29
- if (step.condition && !step.condition(context)) {
30
- continue;
30
+ if (step.condition && !step.condition(currentContext)) {
31
+ return currentContext;
31
32
  }
32
33
  // Calling `start` here instead of setting `spinner.text` seems to work
33
34
  // better when the process doesn't have a TTY.
34
35
  spinner.start(dim(step.name));
35
- await step.task({
36
- ...context,
36
+ const newContext = await step.task({
37
+ ...currentContext,
37
38
  spinner,
38
39
  });
39
- }
40
+ // If the task returns a new context, we use it. Otherwise, we keep the
41
+ // current context.
42
+ return newContext ?? currentContext;
43
+ }, Promise.resolve(context));
40
44
  // The spinner may have been stopped by a step, so we only succeed if it's
41
45
  // still spinning.
42
46
  if (spinner.isSpinning) {
@@ -46,6 +50,7 @@ export async function executeSteps(steps, context) {
46
50
  catch (_error) {
47
51
  error(getErrorMessage(_error), spinner);
48
52
  spinner.stop();
53
+ // eslint-disable-next-line require-atomic-updates
49
54
  process.exitCode = 1;
50
55
  }
51
56
  }
@@ -1 +1 @@
1
- {"version":3,"file":"steps.mjs","sourceRoot":"","sources":["../../src/utils/steps.ts"],"names":[],"mappings":";;;;;;;;AAEA,OAAO,cAAa,qBAAY;;AAEhC,OAAO,EAAE,eAAe,EAAE,qBAAiB;AAC3C,OAAO,EAAE,KAAK,EAAE,sBAAkB;AAYlC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAqB,EACrB,OAAgB;IAEhB,MAAM,OAAO,GAAG,aAAa,CAAC;QAC5B,6CAA6C;QAC7C,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,EAAE,CAAC;IAEhB,IAAI,CAAC;QACH,KAAK,MAAM,IAAI,IAAI,KAAK,EAAE,CAAC;YACzB,uEAAuE;YACvE,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,OAAO,CAAC,EAAE,CAAC;gBAC/C,SAAS;YACX,CAAC;YAED,uEAAuE;YACvE,8CAA8C;YAC9C,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAE9B,MAAM,IAAI,CAAC,IAAI,CAAC;gBACd,GAAG,OAAO;gBACV,OAAO;aACR,CAAC,CAAC;QACL,CAAC;QAED,0EAA0E;QAC1E,kBAAkB;QAClB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,EAAE,CAAC;QACf,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC","sourcesContent":["import { dim } from 'chalk';\nimport type { Ora } from 'ora';\nimport createSpinner from 'ora';\n\nimport { getErrorMessage } from './errors';\nimport { error } from './logging';\n\nexport type Step<Context extends Record<string, unknown>> = {\n name: string;\n condition?: (context: Context) => boolean;\n task: (context: Context & { spinner: Ora }) => Promise<void>;\n};\n\nexport type Steps<Context extends Record<string, unknown>> = Readonly<\n Step<Context>[]\n>;\n\n/**\n * Execute a list of steps in series. Each step receives the context object and\n * a spinner instance.\n *\n * @param steps - The steps to execute.\n * @param context - The context object that will be passed to each step.\n */\nexport async function executeSteps<Context extends Record<string, unknown>>(\n steps: Steps<Context>,\n context: Context,\n) {\n const spinner = createSpinner({\n // Ora writes to `process.stderr` by default.\n stream: process.stdout,\n });\n\n spinner.start();\n\n try {\n for (const step of steps) {\n // If the step has a condition, and it returns false, we skip the step.\n if (step.condition && !step.condition(context)) {\n continue;\n }\n\n // Calling `start` here instead of setting `spinner.text` seems to work\n // better when the process doesn't have a TTY.\n spinner.start(dim(step.name));\n\n await step.task({\n ...context,\n spinner,\n });\n }\n\n // The spinner may have been stopped by a step, so we only succeed if it's\n // still spinning.\n if (spinner.isSpinning) {\n spinner.succeed('Done!');\n }\n } catch (_error) {\n error(getErrorMessage(_error), spinner);\n spinner.stop();\n process.exitCode = 1;\n }\n}\n"]}
1
+ {"version":3,"file":"steps.mjs","sourceRoot":"","sources":["../../src/utils/steps.ts"],"names":[],"mappings":";;;;;;;;AAEA,OAAO,cAAa,qBAAY;;AAEhC,OAAO,EAAE,eAAe,EAAE,qBAAiB;AAC3C,OAAO,EAAE,KAAK,EAAE,sBAAkB;AAYlC;;;;;;GAMG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,KAAqB,EACrB,OAAgB;IAEhB,MAAM,OAAO,GAAG,aAAa,CAAC;QAC5B,6CAA6C;QAC7C,MAAM,EAAE,OAAO,CAAC,MAAM;KACvB,CAAC,CAAC;IAEH,OAAO,CAAC,KAAK,EAAE,CAAC;IAEhB,IAAI,CAAC;QACH,MAAM,KAAK,CAAC,MAAM,CAAmB,KAAK,EAAE,cAAc,EAAE,IAAI,EAAE,EAAE;YAClE,MAAM,cAAc,GAAG,MAAM,cAAc,CAAC;YAE5C,uEAAuE;YACvE,IAAI,IAAI,CAAC,SAAS,IAAI,CAAC,IAAI,CAAC,SAAS,CAAC,cAAc,CAAC,EAAE,CAAC;gBACtD,OAAO,cAAc,CAAC;YACxB,CAAC;YAED,uEAAuE;YACvE,8CAA8C;YAC9C,OAAO,CAAC,KAAK,CAAC,GAAG,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC,CAAC;YAE9B,MAAM,UAAU,GAAG,MAAM,IAAI,CAAC,IAAI,CAAC;gBACjC,GAAG,cAAc;gBACjB,OAAO;aACR,CAAC,CAAC;YAEH,uEAAuE;YACvE,mBAAmB;YACnB,OAAO,UAAU,IAAI,cAAc,CAAC;QACtC,CAAC,EAAE,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC,CAAC;QAE7B,0EAA0E;QAC1E,kBAAkB;QAClB,IAAI,OAAO,CAAC,UAAU,EAAE,CAAC;YACvB,OAAO,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;QAC3B,CAAC;IACH,CAAC;IAAC,OAAO,MAAM,EAAE,CAAC;QAChB,KAAK,CAAC,eAAe,CAAC,MAAM,CAAC,EAAE,OAAO,CAAC,CAAC;QACxC,OAAO,CAAC,IAAI,EAAE,CAAC;QAEf,kDAAkD;QAClD,OAAO,CAAC,QAAQ,GAAG,CAAC,CAAC;IACvB,CAAC;AACH,CAAC","sourcesContent":["import { dim } from 'chalk';\nimport type { Ora } from 'ora';\nimport createSpinner from 'ora';\n\nimport { getErrorMessage } from './errors';\nimport { error } from './logging';\n\nexport type Step<Context extends Record<string, unknown>> = {\n name: string;\n condition?: (context: Context) => boolean;\n task: (context: Context & { spinner: Ora }) => Promise<Context | void>;\n};\n\nexport type Steps<Context extends Record<string, unknown>> = Readonly<\n Step<Context>[]\n>;\n\n/**\n * Execute a list of steps in series. Each step receives the context object and\n * a spinner instance.\n *\n * @param steps - The steps to execute.\n * @param context - The context object that will be passed to each step.\n */\nexport async function executeSteps<Context extends Record<string, unknown>>(\n steps: Steps<Context>,\n context: Context,\n) {\n const spinner = createSpinner({\n // Ora writes to `process.stderr` by default.\n stream: process.stdout,\n });\n\n spinner.start();\n\n try {\n await steps.reduce<Promise<Context>>(async (contextPromise, step) => {\n const currentContext = await contextPromise;\n\n // If the step has a condition, and it returns false, we skip the step.\n if (step.condition && !step.condition(currentContext)) {\n return currentContext;\n }\n\n // Calling `start` here instead of setting `spinner.text` seems to work\n // better when the process doesn't have a TTY.\n spinner.start(dim(step.name));\n\n const newContext = await step.task({\n ...currentContext,\n spinner,\n });\n\n // If the task returns a new context, we use it. Otherwise, we keep the\n // current context.\n return newContext ?? currentContext;\n }, Promise.resolve(context));\n\n // The spinner may have been stopped by a step, so we only succeed if it's\n // still spinning.\n if (spinner.isSpinning) {\n spinner.succeed('Done!');\n }\n } catch (_error) {\n error(getErrorMessage(_error), spinner);\n spinner.stop();\n\n // eslint-disable-next-line require-atomic-updates\n process.exitCode = 1;\n }\n}\n"]}
@@ -9,6 +9,7 @@ const fork_ts_checker_webpack_plugin_1 = __importDefault(require("fork-ts-checke
9
9
  const path_1 = require("path");
10
10
  const terser_webpack_plugin_1 = __importDefault(require("terser-webpack-plugin"));
11
11
  const webpack_1 = require("webpack");
12
+ const webpack_bundle_analyzer_1 = require("webpack-bundle-analyzer");
12
13
  const loaders_1 = require("./loaders/index.cjs");
13
14
  const plugins_1 = require("./plugins.cjs");
14
15
  const utils_1 = require("./utils.cjs");
@@ -289,6 +290,12 @@ async function getDefaultConfiguration(config, options = {
289
290
  evaluate: options.evaluate,
290
291
  files: [config.manifest.path],
291
292
  }, options.spinner),
293
+ options.analyze &&
294
+ new webpack_bundle_analyzer_1.BundleAnalyzerPlugin({
295
+ analyzerPort: 0,
296
+ logLevel: 'silent',
297
+ openAnalyzer: false,
298
+ }),
292
299
  /**
293
300
  * The `ProviderPlugin` is a Webpack plugin that automatically load
294
301
  * modules instead of having to import or require them everywhere.
@@ -306,6 +313,11 @@ async function getDefaultConfiguration(config, options = {
306
313
  */
307
314
  optimization: {
308
315
  minimize: config.output.minimize,
316
+ /**
317
+ * We disable the nodeEnv optimization as we already add process.NODE_ENV
318
+ * via the DefinePlugin in the section above this.
319
+ */
320
+ nodeEnv: false,
309
321
  /**
310
322
  * The minimizer to use. We set it to use the `TerserPlugin`.
311
323
  */