@metamask/snaps-cli 6.6.1 → 7.0.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (235) hide show
  1. package/CHANGELOG.md +39 -1
  2. package/README.md +11 -244
  3. package/dist/builders.cjs +4 -98
  4. package/dist/builders.cjs.map +1 -1
  5. package/dist/builders.d.cts +28 -7
  6. package/dist/builders.d.cts.map +1 -1
  7. package/dist/builders.d.mts +28 -7
  8. package/dist/builders.d.mts.map +1 -1
  9. package/dist/builders.mjs +4 -97
  10. package/dist/builders.mjs.map +1 -1
  11. package/dist/cli.cjs +4 -9
  12. package/dist/cli.cjs.map +1 -1
  13. package/dist/cli.d.cts.map +1 -1
  14. package/dist/cli.d.mts.map +1 -1
  15. package/dist/cli.mjs +4 -16
  16. package/dist/cli.mjs.map +1 -1
  17. package/dist/commands/build/build.cjs +33 -7
  18. package/dist/commands/build/build.cjs.map +1 -1
  19. package/dist/commands/build/build.d.cts +2 -1
  20. package/dist/commands/build/build.d.cts.map +1 -1
  21. package/dist/commands/build/build.d.mts +2 -1
  22. package/dist/commands/build/build.d.mts.map +1 -1
  23. package/dist/commands/build/build.mjs +31 -5
  24. package/dist/commands/build/build.mjs.map +1 -1
  25. package/dist/commands/build/implementation.cjs +1 -1
  26. package/dist/commands/build/implementation.cjs.map +1 -1
  27. package/dist/commands/build/implementation.d.cts +3 -2
  28. package/dist/commands/build/implementation.d.cts.map +1 -1
  29. package/dist/commands/build/implementation.d.mts +3 -2
  30. package/dist/commands/build/implementation.d.mts.map +1 -1
  31. package/dist/commands/build/implementation.mjs +1 -1
  32. package/dist/commands/build/implementation.mjs.map +1 -1
  33. package/dist/commands/build/index.cjs +3 -14
  34. package/dist/commands/build/index.cjs.map +1 -1
  35. package/dist/commands/build/index.d.cts.map +1 -1
  36. package/dist/commands/build/index.d.mts.map +1 -1
  37. package/dist/commands/build/index.mjs +3 -14
  38. package/dist/commands/build/index.mjs.map +1 -1
  39. package/dist/commands/build/utils.cjs +25 -0
  40. package/dist/commands/build/utils.cjs.map +1 -0
  41. package/dist/commands/build/utils.d.cts +9 -0
  42. package/dist/commands/build/utils.d.cts.map +1 -0
  43. package/dist/commands/build/utils.d.mts +9 -0
  44. package/dist/commands/build/utils.d.mts.map +1 -0
  45. package/dist/commands/build/utils.mjs +21 -0
  46. package/dist/commands/build/utils.mjs.map +1 -0
  47. package/dist/commands/eval/__test__/webpack/bad/snap.config.cjs +0 -1
  48. package/dist/commands/eval/__test__/webpack/bad/snap.config.cjs.map +1 -1
  49. package/dist/commands/eval/__test__/webpack/bad/snap.config.d.cts.map +1 -1
  50. package/dist/commands/eval/__test__/webpack/bad/snap.config.d.mts.map +1 -1
  51. package/dist/commands/eval/__test__/webpack/bad/snap.config.mjs +0 -1
  52. package/dist/commands/eval/__test__/webpack/bad/snap.config.mjs.map +1 -1
  53. package/dist/commands/eval/__test__/webpack/good/snap.config.cjs +0 -1
  54. package/dist/commands/eval/__test__/webpack/good/snap.config.cjs.map +1 -1
  55. package/dist/commands/eval/__test__/webpack/good/snap.config.d.cts.map +1 -1
  56. package/dist/commands/eval/__test__/webpack/good/snap.config.d.mts.map +1 -1
  57. package/dist/commands/eval/__test__/webpack/good/snap.config.mjs +0 -1
  58. package/dist/commands/eval/__test__/webpack/good/snap.config.mjs.map +1 -1
  59. package/dist/commands/eval/__test__/webpack/snap.config.cjs +0 -1
  60. package/dist/commands/eval/__test__/webpack/snap.config.cjs.map +1 -1
  61. package/dist/commands/eval/__test__/webpack/snap.config.d.cts.map +1 -1
  62. package/dist/commands/eval/__test__/webpack/snap.config.d.mts.map +1 -1
  63. package/dist/commands/eval/__test__/webpack/snap.config.mjs +0 -1
  64. package/dist/commands/eval/__test__/webpack/snap.config.mjs.map +1 -1
  65. package/dist/commands/eval/eval.cjs +1 -1
  66. package/dist/commands/eval/eval.cjs.map +1 -1
  67. package/dist/commands/eval/eval.d.cts.map +1 -1
  68. package/dist/commands/eval/eval.d.mts.map +1 -1
  69. package/dist/commands/eval/eval.mjs +1 -1
  70. package/dist/commands/eval/eval.mjs.map +1 -1
  71. package/dist/commands/eval/index.cjs +1 -4
  72. package/dist/commands/eval/index.cjs.map +1 -1
  73. package/dist/commands/eval/index.d.cts.map +1 -1
  74. package/dist/commands/eval/index.d.mts.map +1 -1
  75. package/dist/commands/eval/index.mjs +1 -4
  76. package/dist/commands/eval/index.mjs.map +1 -1
  77. package/dist/commands/manifest/index.cjs +1 -4
  78. package/dist/commands/manifest/index.cjs.map +1 -1
  79. package/dist/commands/manifest/index.d.cts.map +1 -1
  80. package/dist/commands/manifest/index.d.mts.map +1 -1
  81. package/dist/commands/manifest/index.mjs +1 -4
  82. package/dist/commands/manifest/index.mjs.map +1 -1
  83. package/dist/commands/manifest/manifest.cjs +5 -6
  84. package/dist/commands/manifest/manifest.cjs.map +1 -1
  85. package/dist/commands/manifest/manifest.d.cts.map +1 -1
  86. package/dist/commands/manifest/manifest.d.mts.map +1 -1
  87. package/dist/commands/manifest/manifest.mjs +5 -6
  88. package/dist/commands/manifest/manifest.mjs.map +1 -1
  89. package/dist/commands/serve/index.cjs +2 -2
  90. package/dist/commands/serve/index.cjs.map +1 -1
  91. package/dist/commands/serve/index.d.cts.map +1 -1
  92. package/dist/commands/serve/index.d.mts.map +1 -1
  93. package/dist/commands/serve/index.mjs +2 -2
  94. package/dist/commands/serve/index.mjs.map +1 -1
  95. package/dist/commands/watch/implementation.cjs +2 -0
  96. package/dist/commands/watch/implementation.cjs.map +1 -1
  97. package/dist/commands/watch/implementation.d.cts +2 -2
  98. package/dist/commands/watch/implementation.d.cts.map +1 -1
  99. package/dist/commands/watch/implementation.d.mts +2 -2
  100. package/dist/commands/watch/implementation.d.mts.map +1 -1
  101. package/dist/commands/watch/implementation.mjs +2 -0
  102. package/dist/commands/watch/implementation.mjs.map +1 -1
  103. package/dist/commands/watch/index.cjs +2 -17
  104. package/dist/commands/watch/index.cjs.map +1 -1
  105. package/dist/commands/watch/index.d.cts.map +1 -1
  106. package/dist/commands/watch/index.d.mts.map +1 -1
  107. package/dist/commands/watch/index.mjs +2 -17
  108. package/dist/commands/watch/index.mjs.map +1 -1
  109. package/dist/commands/watch/watch.cjs +1 -1
  110. package/dist/commands/watch/watch.cjs.map +1 -1
  111. package/dist/commands/watch/watch.d.cts.map +1 -1
  112. package/dist/commands/watch/watch.d.mts.map +1 -1
  113. package/dist/commands/watch/watch.mjs +1 -1
  114. package/dist/commands/watch/watch.mjs.map +1 -1
  115. package/dist/config.cjs +11 -155
  116. package/dist/config.cjs.map +1 -1
  117. package/dist/config.d.cts +216 -314
  118. package/dist/config.d.cts.map +1 -1
  119. package/dist/config.d.mts +216 -314
  120. package/dist/config.d.mts.map +1 -1
  121. package/dist/config.mjs +13 -155
  122. package/dist/config.mjs.map +1 -1
  123. package/dist/main.cjs +0 -1
  124. package/dist/main.cjs.map +1 -1
  125. package/dist/main.mjs +0 -1
  126. package/dist/main.mjs.map +1 -1
  127. package/dist/utils/index.cjs +0 -1
  128. package/dist/utils/index.cjs.map +1 -1
  129. package/dist/utils/index.d.cts +0 -1
  130. package/dist/utils/index.d.cts.map +1 -1
  131. package/dist/utils/index.d.mts +0 -1
  132. package/dist/utils/index.d.mts.map +1 -1
  133. package/dist/utils/index.mjs +0 -1
  134. package/dist/utils/index.mjs.map +1 -1
  135. package/dist/utils/logging.cjs +16 -2
  136. package/dist/utils/logging.cjs.map +1 -1
  137. package/dist/utils/logging.d.cts +8 -1
  138. package/dist/utils/logging.d.cts.map +1 -1
  139. package/dist/utils/logging.d.mts +8 -1
  140. package/dist/utils/logging.d.mts.map +1 -1
  141. package/dist/utils/logging.mjs +15 -2
  142. package/dist/utils/logging.mjs.map +1 -1
  143. package/dist/utils/steps.cjs +11 -6
  144. package/dist/utils/steps.cjs.map +1 -1
  145. package/dist/utils/steps.d.cts +2 -2
  146. package/dist/utils/steps.d.cts.map +1 -1
  147. package/dist/utils/steps.d.mts +2 -2
  148. package/dist/utils/steps.d.mts.map +1 -1
  149. package/dist/utils/steps.mjs +11 -6
  150. package/dist/utils/steps.mjs.map +1 -1
  151. package/dist/webpack/compiler.cjs.map +1 -1
  152. package/dist/webpack/compiler.d.cts +2 -2
  153. package/dist/webpack/compiler.d.cts.map +1 -1
  154. package/dist/webpack/compiler.d.mts +2 -2
  155. package/dist/webpack/compiler.d.mts.map +1 -1
  156. package/dist/webpack/compiler.mjs.map +1 -1
  157. package/dist/webpack/config.cjs +8 -2
  158. package/dist/webpack/config.cjs.map +1 -1
  159. package/dist/webpack/config.d.cts +6 -2
  160. package/dist/webpack/config.d.cts.map +1 -1
  161. package/dist/webpack/config.d.mts +6 -2
  162. package/dist/webpack/config.d.mts.map +1 -1
  163. package/dist/webpack/config.mjs +8 -2
  164. package/dist/webpack/config.mjs.map +1 -1
  165. package/dist/webpack/loaders/function.cjs +7 -10
  166. package/dist/webpack/loaders/function.cjs.map +1 -1
  167. package/dist/webpack/loaders/function.d.cts +1 -0
  168. package/dist/webpack/loaders/function.d.cts.map +1 -1
  169. package/dist/webpack/loaders/function.d.mts +1 -0
  170. package/dist/webpack/loaders/function.d.mts.map +1 -1
  171. package/dist/webpack/loaders/function.mjs +6 -9
  172. package/dist/webpack/loaders/function.mjs.map +1 -1
  173. package/dist/webpack/loaders/index.cjs +1 -3
  174. package/dist/webpack/loaders/index.cjs.map +1 -1
  175. package/dist/webpack/loaders/index.d.cts +0 -1
  176. package/dist/webpack/loaders/index.d.cts.map +1 -1
  177. package/dist/webpack/loaders/index.d.mts +0 -1
  178. package/dist/webpack/loaders/index.d.mts.map +1 -1
  179. package/dist/webpack/loaders/index.mjs +0 -1
  180. package/dist/webpack/loaders/index.mjs.map +1 -1
  181. package/dist/webpack/loaders/wasm.cjs +0 -2
  182. package/dist/webpack/loaders/wasm.cjs.map +1 -1
  183. package/dist/webpack/loaders/wasm.d.cts.map +1 -1
  184. package/dist/webpack/loaders/wasm.d.mts.map +1 -1
  185. package/dist/webpack/loaders/wasm.mjs +0 -2
  186. package/dist/webpack/loaders/wasm.mjs.map +1 -1
  187. package/dist/webpack/plugins.cjs +15 -20
  188. package/dist/webpack/plugins.cjs.map +1 -1
  189. package/dist/webpack/plugins.d.cts +13 -3
  190. package/dist/webpack/plugins.d.cts.map +1 -1
  191. package/dist/webpack/plugins.d.mts +13 -3
  192. package/dist/webpack/plugins.d.mts.map +1 -1
  193. package/dist/webpack/plugins.mjs +4 -9
  194. package/dist/webpack/plugins.mjs.map +1 -1
  195. package/dist/webpack/utils.cjs +5 -21
  196. package/dist/webpack/utils.cjs.map +1 -1
  197. package/dist/webpack/utils.d.cts +6 -36
  198. package/dist/webpack/utils.d.cts.map +1 -1
  199. package/dist/webpack/utils.d.mts +6 -36
  200. package/dist/webpack/utils.d.mts.map +1 -1
  201. package/dist/webpack/utils.mjs +4 -18
  202. package/dist/webpack/utils.mjs.map +1 -1
  203. package/package.json +14 -38
  204. package/dist/commands/eval/__test__/browserify/bad/snap.config.cjs +0 -10
  205. package/dist/commands/eval/__test__/browserify/bad/snap.config.cjs.map +0 -1
  206. package/dist/commands/eval/__test__/browserify/bad/snap.config.d.cts +0 -4
  207. package/dist/commands/eval/__test__/browserify/bad/snap.config.d.cts.map +0 -1
  208. package/dist/commands/eval/__test__/browserify/bad/snap.config.d.mts +0 -4
  209. package/dist/commands/eval/__test__/browserify/bad/snap.config.d.mts.map +0 -1
  210. package/dist/commands/eval/__test__/browserify/bad/snap.config.mjs +0 -8
  211. package/dist/commands/eval/__test__/browserify/bad/snap.config.mjs.map +0 -1
  212. package/dist/commands/eval/__test__/browserify/good/snap.config.cjs +0 -10
  213. package/dist/commands/eval/__test__/browserify/good/snap.config.cjs.map +0 -1
  214. package/dist/commands/eval/__test__/browserify/good/snap.config.d.cts +0 -4
  215. package/dist/commands/eval/__test__/browserify/good/snap.config.d.cts.map +0 -1
  216. package/dist/commands/eval/__test__/browserify/good/snap.config.d.mts +0 -4
  217. package/dist/commands/eval/__test__/browserify/good/snap.config.d.mts.map +0 -1
  218. package/dist/commands/eval/__test__/browserify/good/snap.config.mjs +0 -8
  219. package/dist/commands/eval/__test__/browserify/good/snap.config.mjs.map +0 -1
  220. package/dist/utils/legacy.cjs +0 -53
  221. package/dist/utils/legacy.cjs.map +0 -1
  222. package/dist/utils/legacy.d.cts +0 -28
  223. package/dist/utils/legacy.d.cts.map +0 -1
  224. package/dist/utils/legacy.d.mts +0 -28
  225. package/dist/utils/legacy.d.mts.map +0 -1
  226. package/dist/utils/legacy.mjs +0 -47
  227. package/dist/utils/legacy.mjs.map +0 -1
  228. package/dist/webpack/loaders/browserify.cjs +0 -84
  229. package/dist/webpack/loaders/browserify.cjs.map +0 -1
  230. package/dist/webpack/loaders/browserify.d.cts +0 -18
  231. package/dist/webpack/loaders/browserify.d.cts.map +0 -1
  232. package/dist/webpack/loaders/browserify.d.mts +0 -18
  233. package/dist/webpack/loaders/browserify.d.mts.map +0 -1
  234. package/dist/webpack/loaders/browserify.mjs +0 -88
  235. package/dist/webpack/loaders/browserify.mjs.map +0 -1
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.d.mts","sourceRoot":"","sources":["../../../src/commands/manifest/manifest.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AAMpD,KAAK,eAAe,GAAG;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AA+CF;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,iBAOzB"}
1
+ {"version":3,"file":"manifest.d.mts","sourceRoot":"","sources":["../../../src/commands/manifest/manifest.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AAKpD,KAAK,eAAe,GAAG;IACrB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf,CAAC;AA8CF;;;;;;;GAOG;AACH,wBAAsB,eAAe,CACnC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,eAAe,iBAOzB"}
@@ -1,7 +1,7 @@
1
1
  import { isFile } from "@metamask/snaps-utils/node";
2
+ import { manifest } from "./implementation.mjs";
2
3
  import { CommandError } from "../../errors.mjs";
3
4
  import { executeSteps } from "../../utils/index.mjs";
4
- import { manifest } from "./implementation.mjs";
5
5
  const steps = [
6
6
  {
7
7
  name: 'Checking the input file.',
@@ -13,8 +13,8 @@ const steps = [
13
13
  },
14
14
  {
15
15
  name: 'Validating the snap manifest.',
16
- task: async ({ input, config, options, spinner }) => {
17
- const write = getWriteManifest(config, options);
16
+ task: async ({ input, options, spinner }) => {
17
+ const write = getWriteManifest(options);
18
18
  const valid = await manifest(input, write, spinner);
19
19
  if (valid) {
20
20
  spinner.succeed('The snap manifest file is valid.');
@@ -25,15 +25,14 @@ const steps = [
25
25
  /**
26
26
  * Get whether to write the manifest to disk.
27
27
  *
28
- * @param config - The config object.
29
28
  * @param options - The options object.
30
29
  * @returns Whether to write the manifest to disk.
31
30
  */
32
- function getWriteManifest(config, options) {
31
+ function getWriteManifest(options) {
33
32
  if (typeof options.fix === 'boolean') {
34
33
  return options.fix;
35
34
  }
36
- return config.legacy?.writeManifest ?? false;
35
+ return false;
37
36
  }
38
37
  /**
39
38
  * Validates a snap.manifest.json file. Attempts to fix the manifest and write
@@ -1 +1 @@
1
- {"version":3,"file":"manifest.mjs","sourceRoot":"","sources":["../../../src/commands/manifest/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,mCAAmC;AAGpD,OAAO,EAAE,YAAY,EAAE,yBAAqB;AAE5C,OAAO,EAAE,YAAY,EAAE,8BAAoB;AAC3C,OAAO,EAAE,QAAQ,EAAE,6BAAyB;AAY5C,MAAM,KAAK,GAA2B;IACpC;QACE,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;YACxB,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,YAAY,CACpB,6BAA6B,KAAK,2DAA2D,CAC9F,CAAC;YACJ,CAAC;QACH,CAAC;KACF;IACD;QACE,IAAI,EAAE,+BAA+B;QACrC,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YAClD,MAAM,KAAK,GAAG,gBAAgB,CAAC,MAAM,EAAE,OAAO,CAAC,CAAC;YAChD,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YAEpD,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;KACF;CACF,CAAC;AAEF;;;;;;GAMG;AACH,SAAS,gBAAgB,CAAC,MAAuB,EAAE,OAAwB;IACzE,IAAI,OAAO,OAAO,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC,GAAG,CAAC;IACrB,CAAC;IAED,OAAO,MAAM,CAAC,MAAM,EAAE,aAAa,IAAI,KAAK,CAAC;AAC/C,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAuB,EACvB,OAAwB;IAExB,MAAM,YAAY,CAAC,KAAK,EAAE;QACxB,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;QAC3B,MAAM;QACN,OAAO;KACR,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps } from '../../utils';\nimport { manifest } from './implementation';\n\ntype ManifestOptions = {\n fix?: boolean;\n};\n\ntype ManifestContext = {\n input: string;\n config: ProcessedConfig;\n options: ManifestOptions;\n};\n\nconst steps: Steps<ManifestContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ input }) => {\n if (!(await isFile(input))) {\n throw new CommandError(\n `Manifest file not found: \"${input}\". Make sure that the \\`snap.manifest.json\\` file exists.`,\n );\n }\n },\n },\n {\n name: 'Validating the snap manifest.',\n task: async ({ input, config, options, spinner }) => {\n const write = getWriteManifest(config, options);\n const valid = await manifest(input, write, spinner);\n\n if (valid) {\n spinner.succeed('The snap manifest file is valid.');\n }\n },\n },\n];\n\n/**\n * Get whether to write the manifest to disk.\n *\n * @param config - The config object.\n * @param options - The options object.\n * @returns Whether to write the manifest to disk.\n */\nfunction getWriteManifest(config: ProcessedConfig, options: ManifestOptions) {\n if (typeof options.fix === 'boolean') {\n return options.fix;\n }\n\n return config.legacy?.writeManifest ?? false;\n}\n\n/**\n * Validates a snap.manifest.json file. Attempts to fix the manifest and write\n * the fixed version to disk if `writeManifest` is true. Throws if validation\n * fails.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function manifestHandler(\n config: ProcessedConfig,\n options: ManifestOptions,\n) {\n await executeSteps(steps, {\n input: config.manifest.path,\n config,\n options,\n });\n}\n"]}
1
+ {"version":3,"file":"manifest.mjs","sourceRoot":"","sources":["../../../src/commands/manifest/manifest.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,mCAAmC;AAEpD,OAAO,EAAE,QAAQ,EAAE,6BAAyB;AAE5C,OAAO,EAAE,YAAY,EAAE,yBAAqB;AAE5C,OAAO,EAAE,YAAY,EAAE,8BAAoB;AAY3C,MAAM,KAAK,GAA2B;IACpC;QACE,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,EAAE,EAAE;YACxB,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,YAAY,CACpB,6BAA6B,KAAK,2DAA2D,CAC9F,CAAC;YACJ,CAAC;QACH,CAAC;KACF;IACD;QACE,IAAI,EAAE,+BAA+B;QACrC,IAAI,EAAE,KAAK,EAAE,EAAE,KAAK,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YAC1C,MAAM,KAAK,GAAG,gBAAgB,CAAC,OAAO,CAAC,CAAC;YACxC,MAAM,KAAK,GAAG,MAAM,QAAQ,CAAC,KAAK,EAAE,KAAK,EAAE,OAAO,CAAC,CAAC;YAEpD,IAAI,KAAK,EAAE,CAAC;gBACV,OAAO,CAAC,OAAO,CAAC,kCAAkC,CAAC,CAAC;YACtD,CAAC;QACH,CAAC;KACF;CACF,CAAC;AAEF;;;;;GAKG;AACH,SAAS,gBAAgB,CAAC,OAAwB;IAChD,IAAI,OAAO,OAAO,CAAC,GAAG,KAAK,SAAS,EAAE,CAAC;QACrC,OAAO,OAAO,CAAC,GAAG,CAAC;IACrB,CAAC;IAED,OAAO,KAAK,CAAC;AACf,CAAC;AAED;;;;;;;GAOG;AACH,MAAM,CAAC,KAAK,UAAU,eAAe,CACnC,MAAuB,EACvB,OAAwB;IAExB,MAAM,YAAY,CAAC,KAAK,EAAE;QACxB,KAAK,EAAE,MAAM,CAAC,QAAQ,CAAC,IAAI;QAC3B,MAAM;QACN,OAAO;KACR,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport { manifest } from './implementation';\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps } from '../../utils';\n\ntype ManifestOptions = {\n fix?: boolean;\n};\n\ntype ManifestContext = {\n input: string;\n config: ProcessedConfig;\n options: ManifestOptions;\n};\n\nconst steps: Steps<ManifestContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ input }) => {\n if (!(await isFile(input))) {\n throw new CommandError(\n `Manifest file not found: \"${input}\". Make sure that the \\`snap.manifest.json\\` file exists.`,\n );\n }\n },\n },\n {\n name: 'Validating the snap manifest.',\n task: async ({ input, options, spinner }) => {\n const write = getWriteManifest(options);\n const valid = await manifest(input, write, spinner);\n\n if (valid) {\n spinner.succeed('The snap manifest file is valid.');\n }\n },\n },\n];\n\n/**\n * Get whether to write the manifest to disk.\n *\n * @param options - The options object.\n * @returns Whether to write the manifest to disk.\n */\nfunction getWriteManifest(options: ManifestOptions) {\n if (typeof options.fix === 'boolean') {\n return options.fix;\n }\n\n return false;\n}\n\n/**\n * Validates a snap.manifest.json file. Attempts to fix the manifest and write\n * the fixed version to disk if `writeManifest` is true. Throws if validation\n * fails.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function manifestHandler(\n config: ProcessedConfig,\n options: ManifestOptions,\n) {\n await executeSteps(steps, {\n input: config.manifest.path,\n config,\n options,\n });\n}\n"]}
@@ -3,13 +3,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- const builders_1 = __importDefault(require("../../builders.cjs"));
7
6
  const serve_1 = require("./serve.cjs");
7
+ const builders_1 = __importDefault(require("../../builders.cjs"));
8
8
  const command = {
9
9
  command: ['serve', 's'],
10
10
  desc: 'Locally serve Snap file(s) for testing',
11
11
  builder: (yarg) => {
12
- yarg.option('root', builders_1.default.root).option('port', builders_1.default.port);
12
+ yarg.option('port', builders_1.default.port);
13
13
  },
14
14
  handler: async (argv) => (0, serve_1.serveHandler)(argv.context.config, {
15
15
  port: argv.port ?? argv.context.config.server.port,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":";;;;;AAEA,kEAAsC;AAEtC,uCAAuC;AAEvC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,wCAAwC;IAC9C,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CACjC,IAAA,oBAAY,EAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QAChC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI;KACnD,CAAC;CACL,CAAC;AAEF,kBAAe,OAAO,CAAC","sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { serveHandler } from './serve';\n\nconst command = {\n command: ['serve', 's'],\n desc: 'Locally serve Snap file(s) for testing',\n builder: (yarg: yargs.Argv) => {\n yarg.option('root', builders.root).option('port', builders.port);\n },\n handler: async (argv: YargsArgs) =>\n serveHandler(argv.context.config, {\n port: argv.port ?? argv.context.config.server.port,\n }),\n};\n\nexport default command;\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":";;;;;AAEA,uCAAuC;AACvC,kEAAsC;AAGtC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,wCAAwC;IAC9C,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CACjC,IAAA,oBAAY,EAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QAChC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI;KACnD,CAAC;CACL,CAAC;AAEF,kBAAe,OAAO,CAAC","sourcesContent":["import type yargs from 'yargs';\n\nimport { serveHandler } from './serve';\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\n\nconst command = {\n command: ['serve', 's'],\n desc: 'Locally serve Snap file(s) for testing',\n builder: (yarg: yargs.Argv) => {\n yarg.option('port', builders.port);\n },\n handler: async (argv: YargsArgs) =>\n serveHandler(argv.context.config, {\n port: argv.port ?? argv.context.config.server.port,\n }),\n};\n\nexport default command;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAGnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAGJ,SAAS;CAIhC,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAI/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAEnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAGJ,SAAS;CAIhC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAGnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAGJ,SAAS;CAIhC,CAAC;AAEF,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAI/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAEnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAGJ,SAAS;CAIhC,CAAC;AAEF,eAAe,OAAO,CAAC"}
@@ -1,10 +1,10 @@
1
- import builders from "../../builders.mjs";
2
1
  import { serveHandler } from "./serve.mjs";
2
+ import builders from "../../builders.mjs";
3
3
  const command = {
4
4
  command: ['serve', 's'],
5
5
  desc: 'Locally serve Snap file(s) for testing',
6
6
  builder: (yarg) => {
7
- yarg.option('root', builders.root).option('port', builders.port);
7
+ yarg.option('port', builders.port);
8
8
  },
9
9
  handler: async (argv) => serveHandler(argv.context.config, {
10
10
  port: argv.port ?? argv.context.config.server.port,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/commands/serve/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,wCAAwC;IAC9C,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACnE,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CACjC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QAChC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI;KACnD,CAAC;CACL,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import type yargs from 'yargs';\n\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\nimport { serveHandler } from './serve';\n\nconst command = {\n command: ['serve', 's'],\n desc: 'Locally serve Snap file(s) for testing',\n builder: (yarg: yargs.Argv) => {\n yarg.option('root', builders.root).option('port', builders.port);\n },\n handler: async (argv: YargsArgs) =>\n serveHandler(argv.context.config, {\n port: argv.port ?? argv.context.config.server.port,\n }),\n};\n\nexport default command;\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/commands/serve/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,oBAAgB;AACvC,OAAO,QAAQ,2BAAuB;AAGtC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,wCAAwC;IAC9C,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CACjC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QAChC,IAAI,EAAE,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI;KACnD,CAAC;CACL,CAAC;AAEF,eAAe,OAAO,CAAC","sourcesContent":["import type yargs from 'yargs';\n\nimport { serveHandler } from './serve';\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\n\nconst command = {\n command: ['serve', 's'],\n desc: 'Locally serve Snap file(s) for testing',\n builder: (yarg: yargs.Argv) => {\n yarg.option('port', builders.port);\n },\n handler: async (argv: YargsArgs) =>\n serveHandler(argv.context.config, {\n port: argv.port ?? argv.context.config.server.port,\n }),\n};\n\nexport default command;\n"]}
@@ -1,6 +1,7 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.watch = void 0;
4
+ const utils_1 = require("@metamask/utils");
4
5
  const path_1 = require("path");
5
6
  const webpack_1 = require("../../webpack/index.cjs");
6
7
  /**
@@ -30,6 +31,7 @@ async function watch(config, options) {
30
31
  reject(watchError);
31
32
  return;
32
33
  }
34
+ (0, utils_1.assert)(compiler.watching, 'Expected `compiler.watching` to be set.');
33
35
  resolve(compiler.watching);
34
36
  });
35
37
  });
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.cjs","sourceRoot":"","sources":["../../../src/commands/watch/implementation.ts"],"names":[],"mappings":";;;AAAA,+BAAgC;AAKhC,qDAA4C;AAE5C;;;;;;;;;GASG;AACI,KAAK,UAAU,KAAK,CACzB,MAA8B,EAC9B,OAAwB;IAExB,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAW,EAAC,MAAM,EAAE;QACzC,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,OAAO,EAAE,OAAO;KAC1B,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC/C,QAAQ,CAAC,KAAK,CACZ;YACE,OAAO,EAAE;gBACP,sBAAsB;gBACtB,MAAM,IAAA,eAAQ,EAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;aAC1C;SACF,EACD,CAAC,UAAU,EAAE,EAAE;YACb,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,CAAC,UAAU,CAAC,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AA5BD,sBA4BC","sourcesContent":["import { basename } from 'path';\nimport type { Watching } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle and watch for changes. This uses Webpack to build the\n * 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 for the first time.\n * The promise resolves with a Webpack watching instance that can be used to\n * close the watcher.\n */\nexport async function watch(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, {\n evaluate: config.evaluate,\n watch: true,\n spinner: options?.spinner,\n });\n\n return new Promise<Watching>((resolve, reject) => {\n compiler.watch(\n {\n ignored: [\n '**/node_modules/**/*',\n `**/${basename(config.output.path)}/**/*`,\n ],\n },\n (watchError) => {\n if (watchError) {\n reject(watchError);\n return;\n }\n\n resolve(compiler.watching);\n },\n );\n });\n}\n"]}
1
+ {"version":3,"file":"implementation.cjs","sourceRoot":"","sources":["../../../src/commands/watch/implementation.ts"],"names":[],"mappings":";;;AAAA,2CAAyC;AACzC,+BAAgC;AAKhC,qDAA4C;AAE5C;;;;;;;;;GASG;AACI,KAAK,UAAU,KAAK,CAAC,MAAuB,EAAE,OAAwB;IAC3E,MAAM,QAAQ,GAAG,MAAM,IAAA,qBAAW,EAAC,MAAM,EAAE;QACzC,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,OAAO,EAAE,OAAO;KAC1B,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC/C,QAAQ,CAAC,KAAK,CACZ;YACE,OAAO,EAAE;gBACP,sBAAsB;gBACtB,MAAM,IAAA,eAAQ,EAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;aAC1C;SACF,EACD,CAAC,UAAU,EAAE,EAAE;YACb,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,CAAC,UAAU,CAAC,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,IAAA,cAAM,EAAC,QAAQ,CAAC,QAAQ,EAAE,yCAAyC,CAAC,CAAC;YACrE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC;AA1BD,sBA0BC","sourcesContent":["import { assert } from '@metamask/utils';\nimport { basename } from 'path';\nimport type { Watching } from 'webpack';\n\nimport type { ProcessedConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle and watch for changes. This uses Webpack to build the\n * 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 for the first time.\n * The promise resolves with a Webpack watching instance that can be used to\n * close the watcher.\n */\nexport async function watch(config: ProcessedConfig, options?: WebpackOptions) {\n const compiler = await getCompiler(config, {\n evaluate: config.evaluate,\n watch: true,\n spinner: options?.spinner,\n });\n\n return new Promise<Watching>((resolve, reject) => {\n compiler.watch(\n {\n ignored: [\n '**/node_modules/**/*',\n `**/${basename(config.output.path)}/**/*`,\n ],\n },\n (watchError) => {\n if (watchError) {\n reject(watchError);\n return;\n }\n\n assert(compiler.watching, 'Expected `compiler.watching` to be set.');\n resolve(compiler.watching);\n },\n );\n });\n}\n"]}
@@ -1,5 +1,5 @@
1
1
  import type { Watching } from "webpack";
2
- import type { ProcessedWebpackConfig } from "../../config.cjs";
2
+ import type { ProcessedConfig } from "../../config.cjs";
3
3
  import type { WebpackOptions } from "../../webpack/index.cjs";
4
4
  /**
5
5
  * Build the snap bundle and watch for changes. This uses Webpack to build the
@@ -11,5 +11,5 @@ import type { WebpackOptions } from "../../webpack/index.cjs";
11
11
  * The promise resolves with a Webpack watching instance that can be used to
12
12
  * close the watcher.
13
13
  */
14
- export declare function watch(config: ProcessedWebpackConfig, options?: WebpackOptions): Promise<Watching>;
14
+ export declare function watch(config: ProcessedConfig, options?: WebpackOptions): Promise<Watching>;
15
15
  //# sourceMappingURL=implementation.d.cts.map
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.d.cts","sourceRoot":"","sources":["../../../src/commands/watch/implementation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAqB;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAsB;AAGpD;;;;;;;;;GASG;AACH,wBAAsB,KAAK,CACzB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,qBA0BzB"}
1
+ {"version":3,"file":"implementation.d.cts","sourceRoot":"","sources":["../../../src/commands/watch/implementation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAsB;AAGpD;;;;;;;;;GASG;AACH,wBAAsB,KAAK,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,qBA0B5E"}
@@ -1,5 +1,5 @@
1
1
  import type { Watching } from "webpack";
2
- import type { ProcessedWebpackConfig } from "../../config.mjs";
2
+ import type { ProcessedConfig } from "../../config.mjs";
3
3
  import type { WebpackOptions } from "../../webpack/index.mjs";
4
4
  /**
5
5
  * Build the snap bundle and watch for changes. This uses Webpack to build the
@@ -11,5 +11,5 @@ import type { WebpackOptions } from "../../webpack/index.mjs";
11
11
  * The promise resolves with a Webpack watching instance that can be used to
12
12
  * close the watcher.
13
13
  */
14
- export declare function watch(config: ProcessedWebpackConfig, options?: WebpackOptions): Promise<Watching>;
14
+ export declare function watch(config: ProcessedConfig, options?: WebpackOptions): Promise<Watching>;
15
15
  //# sourceMappingURL=implementation.d.mts.map
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.d.mts","sourceRoot":"","sources":["../../../src/commands/watch/implementation.ts"],"names":[],"mappings":"AACA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAExC,OAAO,KAAK,EAAE,sBAAsB,EAAE,yBAAqB;AAC3D,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAsB;AAGpD;;;;;;;;;GASG;AACH,wBAAsB,KAAK,CACzB,MAAM,EAAE,sBAAsB,EAC9B,OAAO,CAAC,EAAE,cAAc,qBA0BzB"}
1
+ {"version":3,"file":"implementation.d.mts","sourceRoot":"","sources":["../../../src/commands/watch/implementation.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,QAAQ,EAAE,gBAAgB;AAExC,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AACpD,OAAO,KAAK,EAAE,cAAc,EAAE,gCAAsB;AAGpD;;;;;;;;;GASG;AACH,wBAAsB,KAAK,CAAC,MAAM,EAAE,eAAe,EAAE,OAAO,CAAC,EAAE,cAAc,qBA0B5E"}
@@ -1,3 +1,4 @@
1
+ import { assert } from "@metamask/utils";
1
2
  import { basename } from "path";
2
3
  import { getCompiler } from "../../webpack/index.mjs";
3
4
  /**
@@ -27,6 +28,7 @@ export async function watch(config, options) {
27
28
  reject(watchError);
28
29
  return;
29
30
  }
31
+ assert(compiler.watching, 'Expected `compiler.watching` to be set.');
30
32
  resolve(compiler.watching);
31
33
  });
32
34
  });
@@ -1 +1 @@
1
- {"version":3,"file":"implementation.mjs","sourceRoot":"","sources":["../../../src/commands/watch/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,QAAQ,EAAE,aAAa;AAKhC,OAAO,EAAE,WAAW,EAAE,gCAAsB;AAE5C;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CACzB,MAA8B,EAC9B,OAAwB;IAExB,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE;QACzC,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,OAAO,EAAE,OAAO;KAC1B,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC/C,QAAQ,CAAC,KAAK,CACZ;YACE,OAAO,EAAE;gBACP,sBAAsB;gBACtB,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;aAC1C;SACF,EACD,CAAC,UAAU,EAAE,EAAE;YACb,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,CAAC,UAAU,CAAC,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { basename } from 'path';\nimport type { Watching } from 'webpack';\n\nimport type { ProcessedWebpackConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle and watch for changes. This uses Webpack to build the\n * 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 for the first time.\n * The promise resolves with a Webpack watching instance that can be used to\n * close the watcher.\n */\nexport async function watch(\n config: ProcessedWebpackConfig,\n options?: WebpackOptions,\n) {\n const compiler = await getCompiler(config, {\n evaluate: config.evaluate,\n watch: true,\n spinner: options?.spinner,\n });\n\n return new Promise<Watching>((resolve, reject) => {\n compiler.watch(\n {\n ignored: [\n '**/node_modules/**/*',\n `**/${basename(config.output.path)}/**/*`,\n ],\n },\n (watchError) => {\n if (watchError) {\n reject(watchError);\n return;\n }\n\n resolve(compiler.watching);\n },\n );\n });\n}\n"]}
1
+ {"version":3,"file":"implementation.mjs","sourceRoot":"","sources":["../../../src/commands/watch/implementation.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,wBAAwB;AACzC,OAAO,EAAE,QAAQ,EAAE,aAAa;AAKhC,OAAO,EAAE,WAAW,EAAE,gCAAsB;AAE5C;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,KAAK,CAAC,MAAuB,EAAE,OAAwB;IAC3E,MAAM,QAAQ,GAAG,MAAM,WAAW,CAAC,MAAM,EAAE;QACzC,QAAQ,EAAE,MAAM,CAAC,QAAQ;QACzB,KAAK,EAAE,IAAI;QACX,OAAO,EAAE,OAAO,EAAE,OAAO;KAC1B,CAAC,CAAC;IAEH,OAAO,IAAI,OAAO,CAAW,CAAC,OAAO,EAAE,MAAM,EAAE,EAAE;QAC/C,QAAQ,CAAC,KAAK,CACZ;YACE,OAAO,EAAE;gBACP,sBAAsB;gBACtB,MAAM,QAAQ,CAAC,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,OAAO;aAC1C;SACF,EACD,CAAC,UAAU,EAAE,EAAE;YACb,IAAI,UAAU,EAAE,CAAC;gBACf,MAAM,CAAC,UAAU,CAAC,CAAC;gBACnB,OAAO;YACT,CAAC;YAED,MAAM,CAAC,QAAQ,CAAC,QAAQ,EAAE,yCAAyC,CAAC,CAAC;YACrE,OAAO,CAAC,QAAQ,CAAC,QAAQ,CAAC,CAAC;QAC7B,CAAC,CACF,CAAC;IACJ,CAAC,CAAC,CAAC;AACL,CAAC","sourcesContent":["import { assert } from '@metamask/utils';\nimport { basename } from 'path';\nimport type { Watching } from 'webpack';\n\nimport type { ProcessedConfig } from '../../config';\nimport type { WebpackOptions } from '../../webpack';\nimport { getCompiler } from '../../webpack';\n\n/**\n * Build the snap bundle and watch for changes. This uses Webpack to build the\n * 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 for the first time.\n * The promise resolves with a Webpack watching instance that can be used to\n * close the watcher.\n */\nexport async function watch(config: ProcessedConfig, options?: WebpackOptions) {\n const compiler = await getCompiler(config, {\n evaluate: config.evaluate,\n watch: true,\n spinner: options?.spinner,\n });\n\n return new Promise<Watching>((resolve, reject) => {\n compiler.watch(\n {\n ignored: [\n '**/node_modules/**/*',\n `**/${basename(config.output.path)}/**/*`,\n ],\n },\n (watchError) => {\n if (watchError) {\n reject(watchError);\n return;\n }\n\n assert(compiler.watching, 'Expected `compiler.watching` to be set.');\n resolve(compiler.watching);\n },\n );\n });\n}\n"]}
@@ -17,28 +17,13 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
17
17
  return (mod && mod.__esModule) ? mod : { "default": mod };
18
18
  };
19
19
  Object.defineProperty(exports, "__esModule", { value: true });
20
- const builders_1 = __importDefault(require("../../builders.cjs"));
21
20
  const watch_1 = require("./watch.cjs");
21
+ const builders_1 = __importDefault(require("../../builders.cjs"));
22
22
  const command = {
23
23
  command: ['watch', 'w'],
24
24
  desc: 'Build Snap on change',
25
25
  builder: (yarg) => {
26
- yarg
27
- .option('src', builders_1.default.src)
28
- .option('eval', builders_1.default.eval)
29
- .option('dist', builders_1.default.dist)
30
- .option('outfileName', builders_1.default.outfileName)
31
- .option('sourceMaps', builders_1.default.sourceMaps)
32
- .option('stripComments', builders_1.default.stripComments)
33
- .option('transpilationMode', builders_1.default.transpilationMode)
34
- .option('depsToTranspile', builders_1.default.depsToTranspile)
35
- .option('manifest', builders_1.default.manifest)
36
- .option('writeManifest', builders_1.default.writeManifest)
37
- .option('serve', builders_1.default.serve)
38
- .option('root', builders_1.default.root)
39
- .option('port', builders_1.default.port)
40
- .implies('writeManifest', 'manifest')
41
- .implies('depsToTranspile', 'transpilationMode');
26
+ yarg.option('port', builders_1.default.port);
42
27
  },
43
28
  handler: async (argv) => (0, watch_1.watchHandler)(argv.context.config, {
44
29
  port: argv.port,
@@ -1 +1 @@
1
- {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/commands/watch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAEA,kEAAsC;AAEtC,uCAAuC;AAEvC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI;aACD,MAAM,CAAC,KAAK,EAAE,kBAAQ,CAAC,GAAG,CAAC;aAC3B,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,aAAa,EAAE,kBAAQ,CAAC,WAAW,CAAC;aAC3C,MAAM,CAAC,YAAY,EAAE,kBAAQ,CAAC,UAAU,CAAC;aACzC,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,UAAU,EAAE,kBAAQ,CAAC,QAAQ,CAAC;aACrC,MAAM,CAAC,eAAe,EAAE,kBAAQ,CAAC,aAAa,CAAC;aAC/C,MAAM,CAAC,OAAO,EAAE,kBAAQ,CAAC,KAAK,CAAC;aAC/B,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC;aAC7B,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;QAChC,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;CACL,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 { watchHandler } from './watch';\n\nconst command = {\n command: ['watch', 'w'],\n desc: 'Build Snap on change',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('src', builders.src)\n .option('eval', builders.eval)\n .option('dist', builders.dist)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('manifest', builders.manifest)\n .option('writeManifest', builders.writeManifest)\n .option('serve', builders.serve)\n .option('root', builders.root)\n .option('port', builders.port)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode');\n },\n handler: async (argv: YargsArgs) =>\n watchHandler(argv.context.config, {\n port: argv.port,\n }),\n};\n\nexport * from './implementation';\nexport default command;\n"]}
1
+ {"version":3,"file":"index.cjs","sourceRoot":"","sources":["../../../src/commands/watch/index.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;AAEA,uCAAuC;AACvC,kEAAsC;AAGtC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,kBAAQ,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CACjC,IAAA,oBAAY,EAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QAChC,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;CACL,CAAC;AAEF,uDAAiC;AACjC,kBAAe,OAAO,CAAC","sourcesContent":["import type yargs from 'yargs';\n\nimport { watchHandler } from './watch';\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\n\nconst command = {\n command: ['watch', 'w'],\n desc: 'Build Snap on change',\n builder: (yarg: yargs.Argv) => {\n yarg.option('port', builders.port);\n },\n handler: async (argv: YargsArgs) =>\n watchHandler(argv.context.config, {\n port: argv.port,\n }),\n};\n\nexport * from './implementation';\nexport default command;\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/commands/watch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAGnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAkBJ,SAAS;CAIhC,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.cts","sourceRoot":"","sources":["../../../src/commands/watch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAI/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAEnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAGJ,SAAS;CAIhC,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC"}
@@ -1 +1 @@
1
- {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/commands/watch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAG/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAGnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAkBJ,SAAS;CAIhC,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC"}
1
+ {"version":3,"file":"index.d.mts","sourceRoot":"","sources":["../../../src/commands/watch/index.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,KAAK,cAAc;AAI/B,OAAO,KAAK,EAAE,SAAS,EAAE,gCAA0B;AAEnD,QAAA,MAAM,OAAO;;;oBAGK,MAAM,IAAI;oBAGJ,SAAS;CAIhC,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC"}
@@ -1,25 +1,10 @@
1
- import builders from "../../builders.mjs";
2
1
  import { watchHandler } from "./watch.mjs";
2
+ import builders from "../../builders.mjs";
3
3
  const command = {
4
4
  command: ['watch', 'w'],
5
5
  desc: 'Build Snap on change',
6
6
  builder: (yarg) => {
7
- yarg
8
- .option('src', builders.src)
9
- .option('eval', builders.eval)
10
- .option('dist', builders.dist)
11
- .option('outfileName', builders.outfileName)
12
- .option('sourceMaps', builders.sourceMaps)
13
- .option('stripComments', builders.stripComments)
14
- .option('transpilationMode', builders.transpilationMode)
15
- .option('depsToTranspile', builders.depsToTranspile)
16
- .option('manifest', builders.manifest)
17
- .option('writeManifest', builders.writeManifest)
18
- .option('serve', builders.serve)
19
- .option('root', builders.root)
20
- .option('port', builders.port)
21
- .implies('writeManifest', 'manifest')
22
- .implies('depsToTranspile', 'transpilationMode');
7
+ yarg.option('port', builders.port);
23
8
  },
24
9
  handler: async (argv) => watchHandler(argv.context.config, {
25
10
  port: argv.port,
@@ -1 +1 @@
1
- {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/commands/watch/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,sBAAsB;IAC5B,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI;aACD,MAAM,CAAC,KAAK,EAAE,QAAQ,CAAC,GAAG,CAAC;aAC3B,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,aAAa,EAAE,QAAQ,CAAC,WAAW,CAAC;aAC3C,MAAM,CAAC,YAAY,EAAE,QAAQ,CAAC,UAAU,CAAC;aACzC,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,UAAU,EAAE,QAAQ,CAAC,QAAQ,CAAC;aACrC,MAAM,CAAC,eAAe,EAAE,QAAQ,CAAC,aAAa,CAAC;aAC/C,MAAM,CAAC,OAAO,EAAE,QAAQ,CAAC,KAAK,CAAC;aAC/B,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;aAC7B,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC;aAC7B,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;QAChC,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;CACL,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 { watchHandler } from './watch';\n\nconst command = {\n command: ['watch', 'w'],\n desc: 'Build Snap on change',\n builder: (yarg: yargs.Argv) => {\n yarg\n .option('src', builders.src)\n .option('eval', builders.eval)\n .option('dist', builders.dist)\n .option('outfileName', builders.outfileName)\n .option('sourceMaps', builders.sourceMaps)\n .option('stripComments', builders.stripComments)\n .option('transpilationMode', builders.transpilationMode)\n .option('depsToTranspile', builders.depsToTranspile)\n .option('manifest', builders.manifest)\n .option('writeManifest', builders.writeManifest)\n .option('serve', builders.serve)\n .option('root', builders.root)\n .option('port', builders.port)\n .implies('writeManifest', 'manifest')\n .implies('depsToTranspile', 'transpilationMode');\n },\n handler: async (argv: YargsArgs) =>\n watchHandler(argv.context.config, {\n port: argv.port,\n }),\n};\n\nexport * from './implementation';\nexport default command;\n"]}
1
+ {"version":3,"file":"index.mjs","sourceRoot":"","sources":["../../../src/commands/watch/index.ts"],"names":[],"mappings":"AAEA,OAAO,EAAE,YAAY,EAAE,oBAAgB;AACvC,OAAO,QAAQ,2BAAuB;AAGtC,MAAM,OAAO,GAAG;IACd,OAAO,EAAE,CAAC,OAAO,EAAE,GAAG,CAAC;IACvB,IAAI,EAAE,sBAAsB;IAC5B,OAAO,EAAE,CAAC,IAAgB,EAAE,EAAE;QAC5B,IAAI,CAAC,MAAM,CAAC,MAAM,EAAE,QAAQ,CAAC,IAAI,CAAC,CAAC;IACrC,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,IAAe,EAAE,EAAE,CACjC,YAAY,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,EAAE;QAChC,IAAI,EAAE,IAAI,CAAC,IAAI;KAChB,CAAC;CACL,CAAC;AAEF,qCAAiC;AACjC,eAAe,OAAO,CAAC","sourcesContent":["import type yargs from 'yargs';\n\nimport { watchHandler } from './watch';\nimport builders from '../../builders';\nimport type { YargsArgs } from '../../types/yargs';\n\nconst command = {\n command: ['watch', 'w'],\n desc: 'Build Snap on change',\n builder: (yarg: yargs.Argv) => {\n yarg.option('port', builders.port);\n },\n handler: async (argv: YargsArgs) =>\n watchHandler(argv.context.config, {\n port: argv.port,\n }),\n};\n\nexport * from './implementation';\nexport default command;\n"]}
@@ -2,10 +2,10 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.watchHandler = void 0;
4
4
  const node_1 = require("@metamask/snaps-utils/node");
5
+ const implementation_1 = require("./implementation.cjs");
5
6
  const errors_1 = require("../../errors.cjs");
6
7
  const utils_1 = require("../../utils/index.cjs");
7
8
  const webpack_1 = require("../../webpack/index.cjs");
8
- const implementation_1 = require("./implementation.cjs");
9
9
  const steps = [
10
10
  {
11
11
  name: 'Checking the input file.',
@@ -1 +1 @@
1
- {"version":3,"file":"watch.cjs","sourceRoot":"","sources":["../../../src/commands/watch/watch.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAGpD,6CAA4C;AAE5C,iDAAiD;AACjD,qDAA0C;AAC1C,yDAAyC;AAczC,MAAM,KAAK,GAAwB;IACjC;QACE,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;YAEzB,IAAI,CAAC,CAAC,MAAM,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,qBAAY,CACpB,0BAA0B,KAAK,qEAAqE,CACrG,CAAC;YACJ,CAAC;QACH,CAAC;KACF;IACD;QACE,IAAI,EAAE,kCAAkC;QACxC,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO;QAChD,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YAC3C,MAAM,MAAM,GAAG,IAAA,mBAAS,EAAC,MAAM,CAAC,CAAC;YACjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAEzE,IAAA,YAAI,EAAC,+CAA+C,IAAI,GAAG,EAAE,OAAO,CAAC,CAAC;QACxE,CAAC;KACF;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;YAClC,MAAM,IAAA,sBAAK,EAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACnC,CAAC;KACF;CACF,CAAC;AAEF;;;;;;;;;GASG;AACI,KAAK,UAAU,YAAY,CAChC,MAAuB,EACvB,OAAqB;IAErB,MAAM,IAAA,oBAAY,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AACjD,CAAC;AALD,oCAKC","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { getServer } from '../../webpack';\nimport { watch } from './implementation';\n\ntype WatchOptions = {\n /**\n * The port to listen on.\n */\n port?: number;\n};\n\ntype WatchContext = {\n config: ProcessedWebpackConfig;\n options: WatchOptions;\n};\n\nconst steps: Steps<WatchContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Starting the development server.',\n condition: ({ config }) => config.server.enabled,\n task: async ({ config, options, spinner }) => {\n const server = getServer(config);\n const { port } = await server.listen(options.port ?? config.server.port);\n\n info(`The server is listening on http://localhost:${port}.`, spinner);\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n await watch(config, { spinner });\n },\n },\n];\n\n/**\n * Watch a directory and its subdirectories for changes, and build when files\n * are added or changed.\n *\n * Ignores 'node_modules' and dotfiles.\n * Creates destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function watchHandler(\n config: ProcessedConfig,\n options: WatchOptions,\n): Promise<void> {\n await executeSteps(steps, { config, options });\n}\n"]}
1
+ {"version":3,"file":"watch.cjs","sourceRoot":"","sources":["../../../src/commands/watch/watch.ts"],"names":[],"mappings":";;;AAAA,qDAAoD;AAEpD,yDAAyC;AAEzC,6CAA4C;AAE5C,iDAAiD;AACjD,qDAA0C;AAc1C,MAAM,KAAK,GAAwB;IACjC;QACE,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;YAEzB,IAAI,CAAC,CAAC,MAAM,IAAA,aAAM,EAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,qBAAY,CACpB,0BAA0B,KAAK,qEAAqE,CACrG,CAAC;YACJ,CAAC;QACH,CAAC;KACF;IACD;QACE,IAAI,EAAE,kCAAkC;QACxC,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO;QAChD,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YAC3C,MAAM,MAAM,GAAG,IAAA,mBAAS,EAAC,MAAM,CAAC,CAAC;YACjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAEzE,IAAA,YAAI,EAAC,+CAA+C,IAAI,GAAG,EAAE,OAAO,CAAC,CAAC;QACxE,CAAC;KACF;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;YAClC,MAAM,IAAA,sBAAK,EAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACnC,CAAC;KACF;CACF,CAAC;AAEF;;;;;;;;;GASG;AACI,KAAK,UAAU,YAAY,CAChC,MAAuB,EACvB,OAAqB;IAErB,MAAM,IAAA,oBAAY,EAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AACjD,CAAC;AALD,oCAKC","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport { watch } from './implementation';\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { getServer } from '../../webpack';\n\ntype WatchOptions = {\n /**\n * The port to listen on.\n */\n port?: number;\n};\n\ntype WatchContext = {\n config: ProcessedConfig;\n options: WatchOptions;\n};\n\nconst steps: Steps<WatchContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Starting the development server.',\n condition: ({ config }) => config.server.enabled,\n task: async ({ config, options, spinner }) => {\n const server = getServer(config);\n const { port } = await server.listen(options.port ?? config.server.port);\n\n info(`The server is listening on http://localhost:${port}.`, spinner);\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n await watch(config, { spinner });\n },\n },\n];\n\n/**\n * Watch a directory and its subdirectories for changes, and build when files\n * are added or changed.\n *\n * Ignores 'node_modules' and dotfiles.\n * Creates destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function watchHandler(\n config: ProcessedConfig,\n options: WatchOptions,\n): Promise<void> {\n await executeSteps(steps, { config, options });\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.cts","sourceRoot":"","sources":["../../../src/commands/watch/watch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAA0B,yBAAqB;AAO5E,KAAK,YAAY,GAAG;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAsCF;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAEf"}
1
+ {"version":3,"file":"watch.d.cts","sourceRoot":"","sources":["../../../src/commands/watch/watch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AAMpD,KAAK,YAAY,GAAG;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAsCF;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAEf"}
@@ -1 +1 @@
1
- {"version":3,"file":"watch.d.mts","sourceRoot":"","sources":["../../../src/commands/watch/watch.ts"],"names":[],"mappings":"AAEA,OAAO,KAAK,EAAE,eAAe,EAA0B,yBAAqB;AAO5E,KAAK,YAAY,GAAG;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAsCF;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAEf"}
1
+ {"version":3,"file":"watch.d.mts","sourceRoot":"","sources":["../../../src/commands/watch/watch.ts"],"names":[],"mappings":"AAGA,OAAO,KAAK,EAAE,eAAe,EAAE,yBAAqB;AAMpD,KAAK,YAAY,GAAG;IAClB;;OAEG;IACH,IAAI,CAAC,EAAE,MAAM,CAAC;CACf,CAAC;AAsCF;;;;;;;;;GASG;AACH,wBAAsB,YAAY,CAChC,MAAM,EAAE,eAAe,EACvB,OAAO,EAAE,YAAY,GACpB,OAAO,CAAC,IAAI,CAAC,CAEf"}
@@ -1,8 +1,8 @@
1
1
  import { isFile } from "@metamask/snaps-utils/node";
2
+ import { watch } from "./implementation.mjs";
2
3
  import { CommandError } from "../../errors.mjs";
3
4
  import { executeSteps, info } from "../../utils/index.mjs";
4
5
  import { getServer } from "../../webpack/index.mjs";
5
- import { watch } from "./implementation.mjs";
6
6
  const steps = [
7
7
  {
8
8
  name: 'Checking the input file.',
@@ -1 +1 @@
1
- {"version":3,"file":"watch.mjs","sourceRoot":"","sources":["../../../src/commands/watch/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,mCAAmC;AAGpD,OAAO,EAAE,YAAY,EAAE,yBAAqB;AAE5C,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,8BAAoB;AACjD,OAAO,EAAE,SAAS,EAAE,gCAAsB;AAC1C,OAAO,EAAE,KAAK,EAAE,6BAAyB;AAczC,MAAM,KAAK,GAAwB;IACjC;QACE,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;YAEzB,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,YAAY,CACpB,0BAA0B,KAAK,qEAAqE,CACrG,CAAC;YACJ,CAAC;QACH,CAAC;KACF;IACD;QACE,IAAI,EAAE,kCAAkC;QACxC,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO;QAChD,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YAC3C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;YACjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAEzE,IAAI,CAAC,+CAA+C,IAAI,GAAG,EAAE,OAAO,CAAC,CAAC;QACxE,CAAC;KACF;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;YAClC,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACnC,CAAC;KACF;CACF,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAuB,EACvB,OAAqB;IAErB,MAAM,YAAY,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport type { ProcessedConfig, ProcessedWebpackConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { getServer } from '../../webpack';\nimport { watch } from './implementation';\n\ntype WatchOptions = {\n /**\n * The port to listen on.\n */\n port?: number;\n};\n\ntype WatchContext = {\n config: ProcessedWebpackConfig;\n options: WatchOptions;\n};\n\nconst steps: Steps<WatchContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Starting the development server.',\n condition: ({ config }) => config.server.enabled,\n task: async ({ config, options, spinner }) => {\n const server = getServer(config);\n const { port } = await server.listen(options.port ?? config.server.port);\n\n info(`The server is listening on http://localhost:${port}.`, spinner);\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n await watch(config, { spinner });\n },\n },\n];\n\n/**\n * Watch a directory and its subdirectories for changes, and build when files\n * are added or changed.\n *\n * Ignores 'node_modules' and dotfiles.\n * Creates destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function watchHandler(\n config: ProcessedConfig,\n options: WatchOptions,\n): Promise<void> {\n await executeSteps(steps, { config, options });\n}\n"]}
1
+ {"version":3,"file":"watch.mjs","sourceRoot":"","sources":["../../../src/commands/watch/watch.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,MAAM,EAAE,mCAAmC;AAEpD,OAAO,EAAE,KAAK,EAAE,6BAAyB;AAEzC,OAAO,EAAE,YAAY,EAAE,yBAAqB;AAE5C,OAAO,EAAE,YAAY,EAAE,IAAI,EAAE,8BAAoB;AACjD,OAAO,EAAE,SAAS,EAAE,gCAAsB;AAc1C,MAAM,KAAK,GAAwB;IACjC;QACE,IAAI,EAAE,0BAA0B;QAChC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,EAAE,EAAE;YACzB,MAAM,EAAE,KAAK,EAAE,GAAG,MAAM,CAAC;YAEzB,IAAI,CAAC,CAAC,MAAM,MAAM,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC;gBAC3B,MAAM,IAAI,YAAY,CACpB,0BAA0B,KAAK,qEAAqE,CACrG,CAAC;YACJ,CAAC;QACH,CAAC;KACF;IACD;QACE,IAAI,EAAE,kCAAkC;QACxC,SAAS,EAAE,CAAC,EAAE,MAAM,EAAE,EAAE,EAAE,CAAC,MAAM,CAAC,MAAM,CAAC,OAAO;QAChD,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,OAAO,EAAE,EAAE,EAAE;YAC3C,MAAM,MAAM,GAAG,SAAS,CAAC,MAAM,CAAC,CAAC;YACjC,MAAM,EAAE,IAAI,EAAE,GAAG,MAAM,MAAM,CAAC,MAAM,CAAC,OAAO,CAAC,IAAI,IAAI,MAAM,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;YAEzE,IAAI,CAAC,+CAA+C,IAAI,GAAG,EAAE,OAAO,CAAC,CAAC;QACxE,CAAC;KACF;IACD;QACE,IAAI,EAAE,2BAA2B;QACjC,IAAI,EAAE,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,EAAE,EAAE;YAClC,MAAM,KAAK,CAAC,MAAM,EAAE,EAAE,OAAO,EAAE,CAAC,CAAC;QACnC,CAAC;KACF;CACF,CAAC;AAEF;;;;;;;;;GASG;AACH,MAAM,CAAC,KAAK,UAAU,YAAY,CAChC,MAAuB,EACvB,OAAqB;IAErB,MAAM,YAAY,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,OAAO,EAAE,CAAC,CAAC;AACjD,CAAC","sourcesContent":["import { isFile } from '@metamask/snaps-utils/node';\n\nimport { watch } from './implementation';\nimport type { ProcessedConfig } from '../../config';\nimport { CommandError } from '../../errors';\nimport type { Steps } from '../../utils';\nimport { executeSteps, info } from '../../utils';\nimport { getServer } from '../../webpack';\n\ntype WatchOptions = {\n /**\n * The port to listen on.\n */\n port?: number;\n};\n\ntype WatchContext = {\n config: ProcessedConfig;\n options: WatchOptions;\n};\n\nconst steps: Steps<WatchContext> = [\n {\n name: 'Checking the input file.',\n task: async ({ config }) => {\n const { input } = config;\n\n if (!(await isFile(input))) {\n throw new CommandError(\n `Input file not found: \"${input}\". Make sure that the \"input\" field in your snap config is correct.`,\n );\n }\n },\n },\n {\n name: 'Starting the development server.',\n condition: ({ config }) => config.server.enabled,\n task: async ({ config, options, spinner }) => {\n const server = getServer(config);\n const { port } = await server.listen(options.port ?? config.server.port);\n\n info(`The server is listening on http://localhost:${port}.`, spinner);\n },\n },\n {\n name: 'Building the snap bundle.',\n task: async ({ config, spinner }) => {\n await watch(config, { spinner });\n },\n },\n];\n\n/**\n * Watch a directory and its subdirectories for changes, and build when files\n * are added or changed.\n *\n * Ignores 'node_modules' and dotfiles.\n * Creates destination directory if it doesn't exist.\n *\n * @param config - The config object.\n * @param options - The options object.\n */\nexport async function watchHandler(\n config: ProcessedConfig,\n options: WatchOptions,\n): Promise<void> {\n await executeSteps(steps, { config, options });\n}\n"]}