mockaton 13.7.0 → 13.9.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 (288) hide show
  1. package/README.md +27 -8
  2. package/package.json +5 -3
  3. package/src/client/ApiConstants.js +0 -2
  4. package/src/client/Filename.js +2 -2
  5. package/src/client/app-payload-viewer.js +4 -2
  6. package/src/client/dir/groupByFolder.js +16 -14
  7. package/src/server/MockBroker.js +7 -2
  8. package/src/server/MockDispatcher.js +3 -2
  9. package/src/server/Mockaton.js +10 -12
  10. package/src/server/Mockaton.test.js +42 -0
  11. package/src/server/cli.js +9 -8
  12. package/src/server/importResolver.js +35 -0
  13. package/src/server/utils/logger.js +2 -4
  14. package/src/server/utils/openInBrowser.js +1 -1
  15. package/vite-plugin/README.md +29 -0
  16. package/vite-plugin/index.ts +21 -0
  17. package/vite-plugin/node_modules/.package-lock.json +356 -0
  18. package/vite-plugin/node_modules/@oxc-project/types/LICENSE +22 -0
  19. package/vite-plugin/node_modules/@oxc-project/types/README.md +3 -0
  20. package/vite-plugin/node_modules/@oxc-project/types/package.json +26 -0
  21. package/vite-plugin/node_modules/@oxc-project/types/types.d.ts +1912 -0
  22. package/vite-plugin/node_modules/@rolldown/binding-darwin-arm64/README.md +3 -0
  23. package/vite-plugin/node_modules/@rolldown/binding-darwin-arm64/package.json +37 -0
  24. package/vite-plugin/node_modules/@rolldown/binding-darwin-arm64/rolldown-binding.darwin-arm64.node +0 -0
  25. package/vite-plugin/node_modules/@rolldown/pluginutils/LICENSE +25 -0
  26. package/vite-plugin/node_modules/@rolldown/pluginutils/README.md +83 -0
  27. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.d.ts +90 -0
  28. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/composable-filters.js +256 -0
  29. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/filter-vite-plugins.d.ts +28 -0
  30. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/filter-vite-plugins.js +75 -0
  31. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/index.d.ts +3 -0
  32. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/index.js +3 -0
  33. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/simple-filters.d.ts +71 -0
  34. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/filter/simple-filters.js +70 -0
  35. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/index.d.ts +1 -0
  36. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/index.js +1 -0
  37. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/utils.d.ts +2 -0
  38. package/vite-plugin/node_modules/@rolldown/pluginutils/dist/utils.js +17 -0
  39. package/vite-plugin/node_modules/@rolldown/pluginutils/package.json +37 -0
  40. package/vite-plugin/node_modules/detect-libc/LICENSE +201 -0
  41. package/vite-plugin/node_modules/detect-libc/README.md +163 -0
  42. package/vite-plugin/node_modules/detect-libc/index.d.ts +14 -0
  43. package/vite-plugin/node_modules/detect-libc/lib/detect-libc.js +313 -0
  44. package/vite-plugin/node_modules/detect-libc/lib/elf.js +39 -0
  45. package/vite-plugin/node_modules/detect-libc/lib/filesystem.js +51 -0
  46. package/vite-plugin/node_modules/detect-libc/lib/process.js +24 -0
  47. package/vite-plugin/node_modules/detect-libc/package.json +44 -0
  48. package/vite-plugin/node_modules/fdir/LICENSE +7 -0
  49. package/vite-plugin/node_modules/fdir/README.md +91 -0
  50. package/vite-plugin/node_modules/fdir/dist/index.cjs +588 -0
  51. package/vite-plugin/node_modules/fdir/dist/index.d.cts +155 -0
  52. package/vite-plugin/node_modules/fdir/dist/index.d.mts +155 -0
  53. package/vite-plugin/node_modules/fdir/dist/index.mjs +570 -0
  54. package/vite-plugin/node_modules/fdir/package.json +103 -0
  55. package/vite-plugin/node_modules/fsevents/LICENSE +22 -0
  56. package/vite-plugin/node_modules/fsevents/README.md +89 -0
  57. package/vite-plugin/node_modules/fsevents/fsevents.d.ts +46 -0
  58. package/vite-plugin/node_modules/fsevents/fsevents.js +83 -0
  59. package/vite-plugin/node_modules/fsevents/fsevents.node +0 -0
  60. package/vite-plugin/node_modules/fsevents/package.json +62 -0
  61. package/vite-plugin/node_modules/lightningcss/LICENSE +373 -0
  62. package/vite-plugin/node_modules/lightningcss/README.md +105 -0
  63. package/vite-plugin/node_modules/lightningcss/node/ast.d.ts +9892 -0
  64. package/vite-plugin/node_modules/lightningcss/node/ast.js.flow +10539 -0
  65. package/vite-plugin/node_modules/lightningcss/node/browserslistToTargets.js +48 -0
  66. package/vite-plugin/node_modules/lightningcss/node/composeVisitors.js +450 -0
  67. package/vite-plugin/node_modules/lightningcss/node/flags.js +28 -0
  68. package/vite-plugin/node_modules/lightningcss/node/index.d.ts +494 -0
  69. package/vite-plugin/node_modules/lightningcss/node/index.js +59 -0
  70. package/vite-plugin/node_modules/lightningcss/node/index.js.flow +843 -0
  71. package/vite-plugin/node_modules/lightningcss/node/index.mjs +4 -0
  72. package/vite-plugin/node_modules/lightningcss/node/targets.d.ts +40 -0
  73. package/vite-plugin/node_modules/lightningcss/node/targets.js.flow +39 -0
  74. package/vite-plugin/node_modules/lightningcss/package.json +110 -0
  75. package/vite-plugin/node_modules/lightningcss-darwin-arm64/LICENSE +373 -0
  76. package/vite-plugin/node_modules/lightningcss-darwin-arm64/README.md +1 -0
  77. package/vite-plugin/node_modules/lightningcss-darwin-arm64/lightningcss.darwin-arm64.node +0 -0
  78. package/vite-plugin/node_modules/lightningcss-darwin-arm64/package.json +34 -0
  79. package/vite-plugin/node_modules/nanoid/LICENSE +20 -0
  80. package/vite-plugin/node_modules/nanoid/README.md +39 -0
  81. package/vite-plugin/node_modules/nanoid/async/index.browser.cjs +69 -0
  82. package/vite-plugin/node_modules/nanoid/async/index.browser.js +34 -0
  83. package/vite-plugin/node_modules/nanoid/async/index.cjs +71 -0
  84. package/vite-plugin/node_modules/nanoid/async/index.d.ts +56 -0
  85. package/vite-plugin/node_modules/nanoid/async/index.js +35 -0
  86. package/vite-plugin/node_modules/nanoid/async/index.native.js +26 -0
  87. package/vite-plugin/node_modules/nanoid/async/package.json +12 -0
  88. package/vite-plugin/node_modules/nanoid/bin/nanoid.cjs +55 -0
  89. package/vite-plugin/node_modules/nanoid/index.browser.cjs +72 -0
  90. package/vite-plugin/node_modules/nanoid/index.browser.js +34 -0
  91. package/vite-plugin/node_modules/nanoid/index.cjs +85 -0
  92. package/vite-plugin/node_modules/nanoid/index.d.cts +91 -0
  93. package/vite-plugin/node_modules/nanoid/index.d.ts +91 -0
  94. package/vite-plugin/node_modules/nanoid/index.js +45 -0
  95. package/vite-plugin/node_modules/nanoid/nanoid.js +1 -0
  96. package/vite-plugin/node_modules/nanoid/non-secure/index.cjs +34 -0
  97. package/vite-plugin/node_modules/nanoid/non-secure/index.d.ts +33 -0
  98. package/vite-plugin/node_modules/nanoid/non-secure/index.js +21 -0
  99. package/vite-plugin/node_modules/nanoid/non-secure/package.json +6 -0
  100. package/vite-plugin/node_modules/nanoid/package.json +89 -0
  101. package/vite-plugin/node_modules/nanoid/url-alphabet/index.cjs +7 -0
  102. package/vite-plugin/node_modules/nanoid/url-alphabet/index.js +3 -0
  103. package/vite-plugin/node_modules/nanoid/url-alphabet/package.json +6 -0
  104. package/vite-plugin/node_modules/picocolors/LICENSE +15 -0
  105. package/vite-plugin/node_modules/picocolors/README.md +21 -0
  106. package/vite-plugin/node_modules/picocolors/package.json +25 -0
  107. package/vite-plugin/node_modules/picocolors/picocolors.browser.js +4 -0
  108. package/vite-plugin/node_modules/picocolors/picocolors.d.ts +5 -0
  109. package/vite-plugin/node_modules/picocolors/picocolors.js +75 -0
  110. package/vite-plugin/node_modules/picocolors/types.d.ts +51 -0
  111. package/vite-plugin/node_modules/picomatch/LICENSE +21 -0
  112. package/vite-plugin/node_modules/picomatch/README.md +749 -0
  113. package/vite-plugin/node_modules/picomatch/index.js +17 -0
  114. package/vite-plugin/node_modules/picomatch/lib/constants.js +184 -0
  115. package/vite-plugin/node_modules/picomatch/lib/parse.js +1386 -0
  116. package/vite-plugin/node_modules/picomatch/lib/picomatch.js +349 -0
  117. package/vite-plugin/node_modules/picomatch/lib/scan.js +391 -0
  118. package/vite-plugin/node_modules/picomatch/lib/utils.js +72 -0
  119. package/vite-plugin/node_modules/picomatch/package.json +82 -0
  120. package/vite-plugin/node_modules/picomatch/posix.js +3 -0
  121. package/vite-plugin/node_modules/postcss/LICENSE +20 -0
  122. package/vite-plugin/node_modules/postcss/README.md +28 -0
  123. package/vite-plugin/node_modules/postcss/lib/at-rule.d.ts +139 -0
  124. package/vite-plugin/node_modules/postcss/lib/at-rule.js +25 -0
  125. package/vite-plugin/node_modules/postcss/lib/comment.d.ts +67 -0
  126. package/vite-plugin/node_modules/postcss/lib/comment.js +13 -0
  127. package/vite-plugin/node_modules/postcss/lib/container.d.ts +478 -0
  128. package/vite-plugin/node_modules/postcss/lib/container.js +447 -0
  129. package/vite-plugin/node_modules/postcss/lib/css-syntax-error.d.ts +247 -0
  130. package/vite-plugin/node_modules/postcss/lib/css-syntax-error.js +133 -0
  131. package/vite-plugin/node_modules/postcss/lib/declaration.d.ts +150 -0
  132. package/vite-plugin/node_modules/postcss/lib/declaration.js +24 -0
  133. package/vite-plugin/node_modules/postcss/lib/document.d.ts +68 -0
  134. package/vite-plugin/node_modules/postcss/lib/document.js +33 -0
  135. package/vite-plugin/node_modules/postcss/lib/fromJSON.d.ts +9 -0
  136. package/vite-plugin/node_modules/postcss/lib/fromJSON.js +54 -0
  137. package/vite-plugin/node_modules/postcss/lib/input.d.ts +226 -0
  138. package/vite-plugin/node_modules/postcss/lib/input.js +273 -0
  139. package/vite-plugin/node_modules/postcss/lib/lazy-result.d.ts +189 -0
  140. package/vite-plugin/node_modules/postcss/lib/lazy-result.js +550 -0
  141. package/vite-plugin/node_modules/postcss/lib/list.d.ts +60 -0
  142. package/vite-plugin/node_modules/postcss/lib/list.js +58 -0
  143. package/vite-plugin/node_modules/postcss/lib/map-generator.js +376 -0
  144. package/vite-plugin/node_modules/postcss/lib/no-work-result.d.ts +45 -0
  145. package/vite-plugin/node_modules/postcss/lib/no-work-result.js +137 -0
  146. package/vite-plugin/node_modules/postcss/lib/node.d.ts +555 -0
  147. package/vite-plugin/node_modules/postcss/lib/node.js +449 -0
  148. package/vite-plugin/node_modules/postcss/lib/parse.d.ts +9 -0
  149. package/vite-plugin/node_modules/postcss/lib/parse.js +42 -0
  150. package/vite-plugin/node_modules/postcss/lib/parser.js +611 -0
  151. package/vite-plugin/node_modules/postcss/lib/postcss.d.mts +66 -0
  152. package/vite-plugin/node_modules/postcss/lib/postcss.d.ts +456 -0
  153. package/vite-plugin/node_modules/postcss/lib/postcss.js +101 -0
  154. package/vite-plugin/node_modules/postcss/lib/postcss.mjs +30 -0
  155. package/vite-plugin/node_modules/postcss/lib/previous-map.d.ts +80 -0
  156. package/vite-plugin/node_modules/postcss/lib/previous-map.js +145 -0
  157. package/vite-plugin/node_modules/postcss/lib/processor.d.ts +114 -0
  158. package/vite-plugin/node_modules/postcss/lib/processor.js +67 -0
  159. package/vite-plugin/node_modules/postcss/lib/result.d.ts +204 -0
  160. package/vite-plugin/node_modules/postcss/lib/result.js +42 -0
  161. package/vite-plugin/node_modules/postcss/lib/root.d.ts +86 -0
  162. package/vite-plugin/node_modules/postcss/lib/root.js +61 -0
  163. package/vite-plugin/node_modules/postcss/lib/rule.d.ts +126 -0
  164. package/vite-plugin/node_modules/postcss/lib/rule.js +27 -0
  165. package/vite-plugin/node_modules/postcss/lib/stringifier.d.ts +45 -0
  166. package/vite-plugin/node_modules/postcss/lib/stringifier.js +370 -0
  167. package/vite-plugin/node_modules/postcss/lib/stringify.d.ts +9 -0
  168. package/vite-plugin/node_modules/postcss/lib/stringify.js +11 -0
  169. package/vite-plugin/node_modules/postcss/lib/symbols.js +5 -0
  170. package/vite-plugin/node_modules/postcss/lib/terminal-highlight.js +70 -0
  171. package/vite-plugin/node_modules/postcss/lib/tokenize.js +266 -0
  172. package/vite-plugin/node_modules/postcss/lib/warn-once.js +13 -0
  173. package/vite-plugin/node_modules/postcss/lib/warning.d.ts +146 -0
  174. package/vite-plugin/node_modules/postcss/lib/warning.js +37 -0
  175. package/vite-plugin/node_modules/postcss/package.json +88 -0
  176. package/vite-plugin/node_modules/rolldown/LICENSE +25 -0
  177. package/vite-plugin/node_modules/rolldown/README.md +11 -0
  178. package/vite-plugin/node_modules/rolldown/bin/cli.mjs +2 -0
  179. package/vite-plugin/node_modules/rolldown/dist/cli.d.mts +1 -0
  180. package/vite-plugin/node_modules/rolldown/dist/cli.mjs +1191 -0
  181. package/vite-plugin/node_modules/rolldown/dist/config.d.mts +14 -0
  182. package/vite-plugin/node_modules/rolldown/dist/config.mjs +4 -0
  183. package/vite-plugin/node_modules/rolldown/dist/experimental-index.d.mts +253 -0
  184. package/vite-plugin/node_modules/rolldown/dist/experimental-index.mjs +320 -0
  185. package/vite-plugin/node_modules/rolldown/dist/experimental-runtime-types.d.ts +98 -0
  186. package/vite-plugin/node_modules/rolldown/dist/filter-index.d.mts +196 -0
  187. package/vite-plugin/node_modules/rolldown/dist/filter-index.mjs +386 -0
  188. package/vite-plugin/node_modules/rolldown/dist/get-log-filter.d.mts +3 -0
  189. package/vite-plugin/node_modules/rolldown/dist/get-log-filter.mjs +68 -0
  190. package/vite-plugin/node_modules/rolldown/dist/index.d.mts +4 -0
  191. package/vite-plugin/node_modules/rolldown/dist/index.mjs +50 -0
  192. package/vite-plugin/node_modules/rolldown/dist/parallel-plugin-worker.d.mts +1 -0
  193. package/vite-plugin/node_modules/rolldown/dist/parallel-plugin-worker.mjs +28 -0
  194. package/vite-plugin/node_modules/rolldown/dist/parallel-plugin.d.mts +13 -0
  195. package/vite-plugin/node_modules/rolldown/dist/parallel-plugin.mjs +6 -0
  196. package/vite-plugin/node_modules/rolldown/dist/parse-ast-index.d.mts +32 -0
  197. package/vite-plugin/node_modules/rolldown/dist/parse-ast-index.mjs +60 -0
  198. package/vite-plugin/node_modules/rolldown/dist/plugins-index.d.mts +33 -0
  199. package/vite-plugin/node_modules/rolldown/dist/plugins-index.mjs +40 -0
  200. package/vite-plugin/node_modules/rolldown/dist/shared/binding-BeU_1iEk.mjs +582 -0
  201. package/vite-plugin/node_modules/rolldown/dist/shared/binding-zH1vcmbM.d.mts +1899 -0
  202. package/vite-plugin/node_modules/rolldown/dist/shared/bindingify-input-options-DbbBhzky.mjs +2211 -0
  203. package/vite-plugin/node_modules/rolldown/dist/shared/constructors-C2EWPKW3.mjs +68 -0
  204. package/vite-plugin/node_modules/rolldown/dist/shared/constructors-D0W3rNfA.d.mts +37 -0
  205. package/vite-plugin/node_modules/rolldown/dist/shared/define-config-5HJ1b9vG.d.mts +3829 -0
  206. package/vite-plugin/node_modules/rolldown/dist/shared/define-config-DJOr6Iwt.mjs +6 -0
  207. package/vite-plugin/node_modules/rolldown/dist/shared/error-DL-e8-oE.mjs +85 -0
  208. package/vite-plugin/node_modules/rolldown/dist/shared/get-log-filter-semyr3Lj.d.mts +35 -0
  209. package/vite-plugin/node_modules/rolldown/dist/shared/load-config-BoVO31Un.mjs +120 -0
  210. package/vite-plugin/node_modules/rolldown/dist/shared/logging-C6h4g8dA.d.mts +50 -0
  211. package/vite-plugin/node_modules/rolldown/dist/shared/logs-D80CXhvg.mjs +180 -0
  212. package/vite-plugin/node_modules/rolldown/dist/shared/misc-DJYbNKZX.mjs +21 -0
  213. package/vite-plugin/node_modules/rolldown/dist/shared/normalize-string-or-regex-CbQQ69gT.mjs +66 -0
  214. package/vite-plugin/node_modules/rolldown/dist/shared/parse-B_ZnWxLZ.mjs +74 -0
  215. package/vite-plugin/node_modules/rolldown/dist/shared/prompt-U5ajztzG.mjs +847 -0
  216. package/vite-plugin/node_modules/rolldown/dist/shared/resolve-tsconfig-CfYpGzid.mjs +113 -0
  217. package/vite-plugin/node_modules/rolldown/dist/shared/rolldown-D3JZ9rMt.mjs +40 -0
  218. package/vite-plugin/node_modules/rolldown/dist/shared/rolldown-build-DSxL8qiP.mjs +3325 -0
  219. package/vite-plugin/node_modules/rolldown/dist/shared/transform-DgZ3paSD.d.mts +149 -0
  220. package/vite-plugin/node_modules/rolldown/dist/shared/watch-Bd8v9ewv.mjs +374 -0
  221. package/vite-plugin/node_modules/rolldown/dist/utils-index.d.mts +376 -0
  222. package/vite-plugin/node_modules/rolldown/dist/utils-index.mjs +2414 -0
  223. package/vite-plugin/node_modules/rolldown/package.json +153 -0
  224. package/vite-plugin/node_modules/source-map-js/LICENSE +28 -0
  225. package/vite-plugin/node_modules/source-map-js/README.md +765 -0
  226. package/vite-plugin/node_modules/source-map-js/lib/array-set.js +121 -0
  227. package/vite-plugin/node_modules/source-map-js/lib/base64-vlq.js +140 -0
  228. package/vite-plugin/node_modules/source-map-js/lib/base64.js +67 -0
  229. package/vite-plugin/node_modules/source-map-js/lib/binary-search.js +111 -0
  230. package/vite-plugin/node_modules/source-map-js/lib/mapping-list.js +79 -0
  231. package/vite-plugin/node_modules/source-map-js/lib/quick-sort.js +132 -0
  232. package/vite-plugin/node_modules/source-map-js/lib/source-map-consumer.d.ts +1 -0
  233. package/vite-plugin/node_modules/source-map-js/lib/source-map-consumer.js +1188 -0
  234. package/vite-plugin/node_modules/source-map-js/lib/source-map-generator.d.ts +1 -0
  235. package/vite-plugin/node_modules/source-map-js/lib/source-map-generator.js +444 -0
  236. package/vite-plugin/node_modules/source-map-js/lib/source-node.d.ts +1 -0
  237. package/vite-plugin/node_modules/source-map-js/lib/source-node.js +413 -0
  238. package/vite-plugin/node_modules/source-map-js/lib/util.js +594 -0
  239. package/vite-plugin/node_modules/source-map-js/package.json +71 -0
  240. package/vite-plugin/node_modules/source-map-js/source-map.d.ts +104 -0
  241. package/vite-plugin/node_modules/source-map-js/source-map.js +8 -0
  242. package/vite-plugin/node_modules/tinyglobby/LICENSE +21 -0
  243. package/vite-plugin/node_modules/tinyglobby/README.md +25 -0
  244. package/vite-plugin/node_modules/tinyglobby/dist/index.cjs +334 -0
  245. package/vite-plugin/node_modules/tinyglobby/dist/index.d.cts +148 -0
  246. package/vite-plugin/node_modules/tinyglobby/dist/index.d.mts +148 -0
  247. package/vite-plugin/node_modules/tinyglobby/dist/index.mjs +306 -0
  248. package/vite-plugin/node_modules/tinyglobby/package.json +73 -0
  249. package/vite-plugin/node_modules/vite/LICENSE.md +2230 -0
  250. package/vite-plugin/node_modules/vite/README.md +20 -0
  251. package/vite-plugin/node_modules/vite/bin/openChrome.js +68 -0
  252. package/vite-plugin/node_modules/vite/bin/vite.js +79 -0
  253. package/vite-plugin/node_modules/vite/client.d.ts +282 -0
  254. package/vite-plugin/node_modules/vite/dist/client/client.mjs +1237 -0
  255. package/vite-plugin/node_modules/vite/dist/client/env.mjs +18 -0
  256. package/vite-plugin/node_modules/vite/dist/node/chunks/build.js +5381 -0
  257. package/vite-plugin/node_modules/vite/dist/node/chunks/chunk.js +37 -0
  258. package/vite-plugin/node_modules/vite/dist/node/chunks/dist.js +6784 -0
  259. package/vite-plugin/node_modules/vite/dist/node/chunks/lib.js +371 -0
  260. package/vite-plugin/node_modules/vite/dist/node/chunks/logger.js +322 -0
  261. package/vite-plugin/node_modules/vite/dist/node/chunks/moduleRunnerTransport.d.ts +96 -0
  262. package/vite-plugin/node_modules/vite/dist/node/chunks/node.js +34874 -0
  263. package/vite-plugin/node_modules/vite/dist/node/chunks/postcss-import.js +467 -0
  264. package/vite-plugin/node_modules/vite/dist/node/cli.js +837 -0
  265. package/vite-plugin/node_modules/vite/dist/node/index.d.ts +3867 -0
  266. package/vite-plugin/node_modules/vite/dist/node/index.js +3 -0
  267. package/vite-plugin/node_modules/vite/dist/node/internal.d.ts +2 -0
  268. package/vite-plugin/node_modules/vite/dist/node/internal.js +2 -0
  269. package/vite-plugin/node_modules/vite/dist/node/module-runner.d.ts +315 -0
  270. package/vite-plugin/node_modules/vite/dist/node/module-runner.js +1262 -0
  271. package/vite-plugin/node_modules/vite/misc/false.js +1 -0
  272. package/vite-plugin/node_modules/vite/misc/true.js +1 -0
  273. package/vite-plugin/node_modules/vite/package.json +192 -0
  274. package/vite-plugin/node_modules/vite/types/customEvent.d.ts +79 -0
  275. package/vite-plugin/node_modules/vite/types/hmrPayload.d.ts +80 -0
  276. package/vite-plugin/node_modules/vite/types/hot.d.ts +39 -0
  277. package/vite-plugin/node_modules/vite/types/import-meta.d.ts +5 -0
  278. package/vite-plugin/node_modules/vite/types/importGlob.d.ts +89 -0
  279. package/vite-plugin/node_modules/vite/types/importMeta.d.ts +30 -0
  280. package/vite-plugin/node_modules/vite/types/internal/cssPreprocessorOptions.d.ts +44 -0
  281. package/vite-plugin/node_modules/vite/types/internal/esbuildOptions.d.ts +28 -0
  282. package/vite-plugin/node_modules/vite/types/internal/lightningcssOptions.d.ts +18 -0
  283. package/vite-plugin/node_modules/vite/types/internal/rollupTypeCompat.d.ts +24 -0
  284. package/vite-plugin/node_modules/vite/types/internal/terserOptions.d.ts +11 -0
  285. package/vite-plugin/node_modules/vite/types/metadata.d.ts +47 -0
  286. package/vite-plugin/package.json +14 -0
  287. package/www/src/{assets → .well-known/agent-skills/mockaton}/SKILLS.md +21 -9
  288. package/src/server/cacheBustResolver.js +0 -19
@@ -0,0 +1,837 @@
1
+ import { o as __toESM } from "./chunks/chunk.js";
2
+ import { N as VERSION, R as require_picocolors, n as createLogger } from "./chunks/logger.js";
3
+ import fs from "node:fs";
4
+ import path from "node:path";
5
+ import { inspect } from "node:util";
6
+ import { performance } from "node:perf_hooks";
7
+ //#region ../../node_modules/.pnpm/cac@7.0.0/node_modules/cac/dist/index.js
8
+ function toArr(any) {
9
+ return any == null ? [] : Array.isArray(any) ? any : [any];
10
+ }
11
+ function toVal(out, key, val, opts) {
12
+ var x, old = out[key], nxt = !!~opts.string.indexOf(key) ? val == null || val === true ? "" : String(val) : typeof val === "boolean" ? val : !!~opts.boolean.indexOf(key) ? val === "false" ? false : val === "true" || (out._.push((x = +val, x * 0 === 0) ? x : val), !!val) : (x = +val, x * 0 === 0) ? x : val;
13
+ out[key] = old == null ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
14
+ }
15
+ function lib_default(args, opts) {
16
+ args = args || [];
17
+ opts = opts || {};
18
+ var k, arr, arg, name, val, out = { _: [] };
19
+ var i = 0, j = 0, idx = 0, len = args.length;
20
+ const alibi = opts.alias !== void 0;
21
+ const strict = opts.unknown !== void 0;
22
+ const defaults = opts.default !== void 0;
23
+ opts.alias = opts.alias || {};
24
+ opts.string = toArr(opts.string);
25
+ opts.boolean = toArr(opts.boolean);
26
+ if (alibi) for (k in opts.alias) {
27
+ arr = opts.alias[k] = toArr(opts.alias[k]);
28
+ for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
29
+ }
30
+ for (i = opts.boolean.length; i-- > 0;) {
31
+ arr = opts.alias[opts.boolean[i]] || [];
32
+ for (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);
33
+ }
34
+ for (i = opts.string.length; i-- > 0;) {
35
+ arr = opts.alias[opts.string[i]] || [];
36
+ for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
37
+ }
38
+ if (defaults) for (k in opts.default) {
39
+ name = typeof opts.default[k];
40
+ arr = opts.alias[k] = opts.alias[k] || [];
41
+ if (opts[name] !== void 0) {
42
+ opts[name].push(k);
43
+ for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
44
+ }
45
+ }
46
+ const keys = strict ? Object.keys(opts.alias) : [];
47
+ for (i = 0; i < len; i++) {
48
+ arg = args[i];
49
+ if (arg === "--") {
50
+ out._ = out._.concat(args.slice(++i));
51
+ break;
52
+ }
53
+ for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
54
+ if (j === 0) out._.push(arg);
55
+ else if (arg.substring(j, j + 3) === "no-") {
56
+ name = arg.substring(j + 3);
57
+ if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
58
+ out[name] = false;
59
+ } else {
60
+ for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
61
+ name = arg.substring(j, idx);
62
+ val = arg.substring(++idx) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
63
+ arr = j === 2 ? [name] : name;
64
+ for (idx = 0; idx < arr.length; idx++) {
65
+ name = arr[idx];
66
+ if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
67
+ toVal(out, name, idx + 1 < arr.length || val, opts);
68
+ }
69
+ }
70
+ }
71
+ if (defaults) {
72
+ for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
73
+ }
74
+ if (alibi) for (k in out) {
75
+ arr = opts.alias[k] || [];
76
+ while (arr.length > 0) out[arr.shift()] = out[k];
77
+ }
78
+ return out;
79
+ }
80
+ function removeBrackets(v) {
81
+ return v.replace(/[<[].+/, "").trim();
82
+ }
83
+ function findAllBrackets(v) {
84
+ const ANGLED_BRACKET_RE_GLOBAL = /<([^>]+)>/g;
85
+ const SQUARE_BRACKET_RE_GLOBAL = /\[([^\]]+)\]/g;
86
+ const res = [];
87
+ const parse = (match) => {
88
+ let variadic = false;
89
+ let value = match[1];
90
+ if (value.startsWith("...")) {
91
+ value = value.slice(3);
92
+ variadic = true;
93
+ }
94
+ return {
95
+ required: match[0].startsWith("<"),
96
+ value,
97
+ variadic
98
+ };
99
+ };
100
+ let angledMatch;
101
+ while (angledMatch = ANGLED_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(angledMatch));
102
+ let squareMatch;
103
+ while (squareMatch = SQUARE_BRACKET_RE_GLOBAL.exec(v)) res.push(parse(squareMatch));
104
+ return res;
105
+ }
106
+ function getMriOptions(options) {
107
+ const result = {
108
+ alias: {},
109
+ boolean: []
110
+ };
111
+ for (const [index, option] of options.entries()) {
112
+ if (option.names.length > 1) result.alias[option.names[0]] = option.names.slice(1);
113
+ if (option.isBoolean) if (option.negated) {
114
+ if (!options.some((o, i) => {
115
+ return i !== index && o.names.some((name) => option.names.includes(name)) && typeof o.required === "boolean";
116
+ })) result.boolean.push(option.names[0]);
117
+ } else result.boolean.push(option.names[0]);
118
+ }
119
+ return result;
120
+ }
121
+ function findLongest(arr) {
122
+ return arr.sort((a, b) => {
123
+ return a.length > b.length ? -1 : 1;
124
+ })[0];
125
+ }
126
+ function padRight(str, length) {
127
+ return str.length >= length ? str : `${str}${" ".repeat(length - str.length)}`;
128
+ }
129
+ function camelcase(input) {
130
+ return input.replaceAll(/([a-z])-([a-z])/g, (_, p1, p2) => {
131
+ return p1 + p2.toUpperCase();
132
+ });
133
+ }
134
+ function setDotProp(obj, keys, val) {
135
+ let current = obj;
136
+ for (let i = 0; i < keys.length; i++) {
137
+ const key = keys[i];
138
+ if (i === keys.length - 1) {
139
+ current[key] = val;
140
+ return;
141
+ }
142
+ if (current[key] == null) {
143
+ const nextKeyIsArrayIndex = +keys[i + 1] > -1;
144
+ current[key] = nextKeyIsArrayIndex ? [] : {};
145
+ }
146
+ current = current[key];
147
+ }
148
+ }
149
+ function setByType(obj, transforms) {
150
+ for (const key of Object.keys(transforms)) {
151
+ const transform = transforms[key];
152
+ if (transform.shouldTransform) {
153
+ obj[key] = [obj[key]].flat();
154
+ if (typeof transform.transformFunction === "function") obj[key] = obj[key].map(transform.transformFunction);
155
+ }
156
+ }
157
+ }
158
+ function getFileName(input) {
159
+ const m = /([^\\/]+)$/.exec(input);
160
+ return m ? m[1] : "";
161
+ }
162
+ function camelcaseOptionName(name) {
163
+ return name.split(".").map((v, i) => {
164
+ return i === 0 ? camelcase(v) : v;
165
+ }).join(".");
166
+ }
167
+ var CACError = class extends Error {
168
+ constructor(message) {
169
+ super(message);
170
+ this.name = "CACError";
171
+ if (typeof Error.captureStackTrace !== "function") this.stack = new Error(message).stack;
172
+ }
173
+ };
174
+ var Option = class {
175
+ rawName;
176
+ description;
177
+ /** Option name */
178
+ name;
179
+ /** Option name and aliases */
180
+ names;
181
+ isBoolean;
182
+ required;
183
+ config;
184
+ negated;
185
+ constructor(rawName, description, config) {
186
+ this.rawName = rawName;
187
+ this.description = description;
188
+ this.config = Object.assign({}, config);
189
+ rawName = rawName.replaceAll(".*", "");
190
+ this.negated = false;
191
+ this.names = removeBrackets(rawName).split(",").map((v) => {
192
+ let name = v.trim().replace(/^-{1,2}/, "");
193
+ if (name.startsWith("no-")) {
194
+ this.negated = true;
195
+ name = name.replace(/^no-/, "");
196
+ }
197
+ return camelcaseOptionName(name);
198
+ }).sort((a, b) => a.length > b.length ? 1 : -1);
199
+ this.name = this.names.at(-1);
200
+ if (this.negated && this.config.default == null) this.config.default = true;
201
+ if (rawName.includes("<")) this.required = true;
202
+ else if (rawName.includes("[")) this.required = false;
203
+ else this.isBoolean = true;
204
+ }
205
+ };
206
+ let runtimeProcessArgs;
207
+ let runtimeInfo;
208
+ if (typeof process !== "undefined") {
209
+ let runtimeName;
210
+ if (typeof Deno !== "undefined" && typeof Deno.version?.deno === "string") runtimeName = "deno";
211
+ else if (typeof Bun !== "undefined" && typeof Bun.version === "string") runtimeName = "bun";
212
+ else runtimeName = "node";
213
+ runtimeInfo = `${process.platform}-${process.arch} ${runtimeName}-${process.version}`;
214
+ runtimeProcessArgs = process.argv;
215
+ } else if (typeof navigator === "undefined") runtimeInfo = `unknown`;
216
+ else runtimeInfo = `${navigator.platform} ${navigator.userAgent}`;
217
+ var Command = class {
218
+ rawName;
219
+ description;
220
+ config;
221
+ cli;
222
+ options;
223
+ aliasNames;
224
+ name;
225
+ args;
226
+ commandAction;
227
+ usageText;
228
+ versionNumber;
229
+ examples;
230
+ helpCallback;
231
+ globalCommand;
232
+ constructor(rawName, description, config = {}, cli) {
233
+ this.rawName = rawName;
234
+ this.description = description;
235
+ this.config = config;
236
+ this.cli = cli;
237
+ this.options = [];
238
+ this.aliasNames = [];
239
+ this.name = removeBrackets(rawName);
240
+ this.args = findAllBrackets(rawName);
241
+ this.examples = [];
242
+ }
243
+ usage(text) {
244
+ this.usageText = text;
245
+ return this;
246
+ }
247
+ allowUnknownOptions() {
248
+ this.config.allowUnknownOptions = true;
249
+ return this;
250
+ }
251
+ ignoreOptionDefaultValue() {
252
+ this.config.ignoreOptionDefaultValue = true;
253
+ return this;
254
+ }
255
+ version(version, customFlags = "-v, --version") {
256
+ this.versionNumber = version;
257
+ this.option(customFlags, "Display version number");
258
+ return this;
259
+ }
260
+ example(example) {
261
+ this.examples.push(example);
262
+ return this;
263
+ }
264
+ /**
265
+ * Add a option for this command
266
+ * @param rawName Raw option name(s)
267
+ * @param description Option description
268
+ * @param config Option config
269
+ */
270
+ option(rawName, description, config) {
271
+ const option = new Option(rawName, description, config);
272
+ this.options.push(option);
273
+ return this;
274
+ }
275
+ alias(name) {
276
+ this.aliasNames.push(name);
277
+ return this;
278
+ }
279
+ action(callback) {
280
+ this.commandAction = callback;
281
+ return this;
282
+ }
283
+ /**
284
+ * Check if a command name is matched by this command
285
+ * @param name Command name
286
+ */
287
+ isMatched(name) {
288
+ return this.name === name || this.aliasNames.includes(name);
289
+ }
290
+ get isDefaultCommand() {
291
+ return this.name === "" || this.aliasNames.includes("!");
292
+ }
293
+ get isGlobalCommand() {
294
+ return this instanceof GlobalCommand;
295
+ }
296
+ /**
297
+ * Check if an option is registered in this command
298
+ * @param name Option name
299
+ */
300
+ hasOption(name) {
301
+ name = name.split(".")[0];
302
+ return this.options.find((option) => {
303
+ return option.names.includes(name);
304
+ });
305
+ }
306
+ outputHelp() {
307
+ const { name, commands } = this.cli;
308
+ const { versionNumber, options: globalOptions, helpCallback } = this.cli.globalCommand;
309
+ let sections = [{ body: `${name}${versionNumber ? `/${versionNumber}` : ""}` }];
310
+ sections.push({
311
+ title: "Usage",
312
+ body: ` $ ${name} ${this.usageText || this.rawName}`
313
+ });
314
+ if ((this.isGlobalCommand || this.isDefaultCommand) && commands.length > 0) {
315
+ const longestCommandName = findLongest(commands.map((command) => command.rawName));
316
+ sections.push({
317
+ title: "Commands",
318
+ body: commands.map((command) => {
319
+ return ` ${padRight(command.rawName, longestCommandName.length)} ${command.description}`;
320
+ }).join("\n")
321
+ }, {
322
+ title: `For more info, run any command with the \`--help\` flag`,
323
+ body: commands.map((command) => ` $ ${name}${command.name === "" ? "" : ` ${command.name}`} --help`).join("\n")
324
+ });
325
+ }
326
+ let options = this.isGlobalCommand ? globalOptions : [...this.options, ...globalOptions || []];
327
+ if (!this.isGlobalCommand && !this.isDefaultCommand) options = options.filter((option) => option.name !== "version");
328
+ if (options.length > 0) {
329
+ const longestOptionName = findLongest(options.map((option) => option.rawName));
330
+ sections.push({
331
+ title: "Options",
332
+ body: options.map((option) => {
333
+ return ` ${padRight(option.rawName, longestOptionName.length)} ${option.description} ${option.config.default === void 0 ? "" : `(default: ${option.config.default})`}`;
334
+ }).join("\n")
335
+ });
336
+ }
337
+ if (this.examples.length > 0) sections.push({
338
+ title: "Examples",
339
+ body: this.examples.map((example) => {
340
+ if (typeof example === "function") return example(name);
341
+ return example;
342
+ }).join("\n")
343
+ });
344
+ if (helpCallback) sections = helpCallback(sections) || sections;
345
+ console.info(sections.map((section) => {
346
+ return section.title ? `${section.title}:\n${section.body}` : section.body;
347
+ }).join("\n\n"));
348
+ }
349
+ outputVersion() {
350
+ const { name } = this.cli;
351
+ const { versionNumber } = this.cli.globalCommand;
352
+ if (versionNumber) console.info(`${name}/${versionNumber} ${runtimeInfo}`);
353
+ }
354
+ checkRequiredArgs() {
355
+ const minimalArgsCount = this.args.filter((arg) => arg.required).length;
356
+ if (this.cli.args.length < minimalArgsCount) throw new CACError(`missing required args for command \`${this.rawName}\``);
357
+ }
358
+ /**
359
+ * Check if the parsed options contain any unknown options
360
+ *
361
+ * Exit and output error when true
362
+ */
363
+ checkUnknownOptions() {
364
+ const { options, globalCommand } = this.cli;
365
+ if (!this.config.allowUnknownOptions) {
366
+ for (const name of Object.keys(options)) if (name !== "--" && !this.hasOption(name) && !globalCommand.hasOption(name)) throw new CACError(`Unknown option \`${name.length > 1 ? `--${name}` : `-${name}`}\``);
367
+ }
368
+ }
369
+ /**
370
+ * Check if the required string-type options exist
371
+ */
372
+ checkOptionValue() {
373
+ const { options: parsedOptions, globalCommand } = this.cli;
374
+ const options = [...globalCommand.options, ...this.options];
375
+ for (const option of options) {
376
+ const value = parsedOptions[option.name.split(".")[0]];
377
+ if (option.required) {
378
+ const hasNegated = options.some((o) => o.negated && o.names.includes(option.name));
379
+ if (value === true || value === false && !hasNegated) throw new CACError(`option \`${option.rawName}\` value is missing`);
380
+ }
381
+ }
382
+ }
383
+ /**
384
+ * Check if the number of args is more than expected
385
+ */
386
+ checkUnusedArgs() {
387
+ const maximumArgsCount = this.args.some((arg) => arg.variadic) ? Infinity : this.args.length;
388
+ if (maximumArgsCount < this.cli.args.length) throw new CACError(`Unused args: ${this.cli.args.slice(maximumArgsCount).map((arg) => `\`${arg}\``).join(", ")}`);
389
+ }
390
+ };
391
+ var GlobalCommand = class extends Command {
392
+ constructor(cli) {
393
+ super("@@global@@", "", {}, cli);
394
+ }
395
+ };
396
+ var CAC = class extends EventTarget {
397
+ /** The program name to display in help and version message */
398
+ name;
399
+ commands;
400
+ globalCommand;
401
+ matchedCommand;
402
+ matchedCommandName;
403
+ /**
404
+ * Raw CLI arguments
405
+ */
406
+ rawArgs;
407
+ /**
408
+ * Parsed CLI arguments
409
+ */
410
+ args;
411
+ /**
412
+ * Parsed CLI options, camelCased
413
+ */
414
+ options;
415
+ showHelpOnExit;
416
+ showVersionOnExit;
417
+ /**
418
+ * @param name The program name to display in help and version message
419
+ */
420
+ constructor(name = "") {
421
+ super();
422
+ this.name = name;
423
+ this.commands = [];
424
+ this.rawArgs = [];
425
+ this.args = [];
426
+ this.options = {};
427
+ this.globalCommand = new GlobalCommand(this);
428
+ this.globalCommand.usage("<command> [options]");
429
+ }
430
+ /**
431
+ * Add a global usage text.
432
+ *
433
+ * This is not used by sub-commands.
434
+ */
435
+ usage(text) {
436
+ this.globalCommand.usage(text);
437
+ return this;
438
+ }
439
+ /**
440
+ * Add a sub-command
441
+ */
442
+ command(rawName, description, config) {
443
+ const command = new Command(rawName, description || "", config, this);
444
+ command.globalCommand = this.globalCommand;
445
+ this.commands.push(command);
446
+ return command;
447
+ }
448
+ /**
449
+ * Add a global CLI option.
450
+ *
451
+ * Which is also applied to sub-commands.
452
+ */
453
+ option(rawName, description, config) {
454
+ this.globalCommand.option(rawName, description, config);
455
+ return this;
456
+ }
457
+ /**
458
+ * Show help message when `-h, --help` flags appear.
459
+ *
460
+ */
461
+ help(callback) {
462
+ this.globalCommand.option("-h, --help", "Display this message");
463
+ this.globalCommand.helpCallback = callback;
464
+ this.showHelpOnExit = true;
465
+ return this;
466
+ }
467
+ /**
468
+ * Show version number when `-v, --version` flags appear.
469
+ *
470
+ */
471
+ version(version, customFlags = "-v, --version") {
472
+ this.globalCommand.version(version, customFlags);
473
+ this.showVersionOnExit = true;
474
+ return this;
475
+ }
476
+ /**
477
+ * Add a global example.
478
+ *
479
+ * This example added here will not be used by sub-commands.
480
+ */
481
+ example(example) {
482
+ this.globalCommand.example(example);
483
+ return this;
484
+ }
485
+ /**
486
+ * Output the corresponding help message
487
+ * When a sub-command is matched, output the help message for the command
488
+ * Otherwise output the global one.
489
+ *
490
+ */
491
+ outputHelp() {
492
+ if (this.matchedCommand) this.matchedCommand.outputHelp();
493
+ else this.globalCommand.outputHelp();
494
+ }
495
+ /**
496
+ * Output the version number.
497
+ *
498
+ */
499
+ outputVersion() {
500
+ this.globalCommand.outputVersion();
501
+ }
502
+ setParsedInfo({ args, options }, matchedCommand, matchedCommandName) {
503
+ this.args = args;
504
+ this.options = options;
505
+ if (matchedCommand) this.matchedCommand = matchedCommand;
506
+ if (matchedCommandName) this.matchedCommandName = matchedCommandName;
507
+ return this;
508
+ }
509
+ unsetMatchedCommand() {
510
+ this.matchedCommand = void 0;
511
+ this.matchedCommandName = void 0;
512
+ }
513
+ /**
514
+ * Parse argv
515
+ */
516
+ parse(argv, { run = true } = {}) {
517
+ if (!argv) {
518
+ if (!runtimeProcessArgs) throw new Error("No argv provided and runtime process argv is not available.");
519
+ argv = runtimeProcessArgs;
520
+ }
521
+ this.rawArgs = argv;
522
+ if (!this.name) this.name = argv[1] ? getFileName(argv[1]) : "cli";
523
+ let shouldParse = true;
524
+ for (const command of this.commands) {
525
+ const parsed = this.mri(argv.slice(2), command);
526
+ const commandName = parsed.args[0];
527
+ if (command.isMatched(commandName)) {
528
+ shouldParse = false;
529
+ const parsedInfo = {
530
+ ...parsed,
531
+ args: parsed.args.slice(1)
532
+ };
533
+ this.setParsedInfo(parsedInfo, command, commandName);
534
+ this.dispatchEvent(new CustomEvent(`command:${commandName}`, { detail: command }));
535
+ }
536
+ }
537
+ if (shouldParse) {
538
+ for (const command of this.commands) if (command.isDefaultCommand) {
539
+ shouldParse = false;
540
+ const parsed = this.mri(argv.slice(2), command);
541
+ this.setParsedInfo(parsed, command);
542
+ this.dispatchEvent(new CustomEvent("command:!", { detail: command }));
543
+ }
544
+ }
545
+ if (shouldParse) {
546
+ const parsed = this.mri(argv.slice(2));
547
+ this.setParsedInfo(parsed);
548
+ }
549
+ if (this.options.help && this.showHelpOnExit) {
550
+ this.outputHelp();
551
+ run = false;
552
+ this.unsetMatchedCommand();
553
+ }
554
+ if (this.options.version && this.showVersionOnExit && this.matchedCommandName == null) {
555
+ this.outputVersion();
556
+ run = false;
557
+ this.unsetMatchedCommand();
558
+ }
559
+ const parsedArgv = {
560
+ args: this.args,
561
+ options: this.options
562
+ };
563
+ if (run) this.runMatchedCommand();
564
+ if (!this.matchedCommand && this.args[0]) this.dispatchEvent(new CustomEvent("command:*", { detail: this.args[0] }));
565
+ return parsedArgv;
566
+ }
567
+ mri(argv, command) {
568
+ const cliOptions = [...this.globalCommand.options, ...command ? command.options : []];
569
+ const mriOptions = getMriOptions(cliOptions);
570
+ let argsAfterDoubleDashes = [];
571
+ const doubleDashesIndex = argv.indexOf("--");
572
+ if (doubleDashesIndex !== -1) {
573
+ argsAfterDoubleDashes = argv.slice(doubleDashesIndex + 1);
574
+ argv = argv.slice(0, doubleDashesIndex);
575
+ }
576
+ let parsed = lib_default(argv, mriOptions);
577
+ parsed = Object.keys(parsed).reduce((res, name) => {
578
+ return {
579
+ ...res,
580
+ [camelcaseOptionName(name)]: parsed[name]
581
+ };
582
+ }, { _: [] });
583
+ const args = parsed._;
584
+ const options = { "--": argsAfterDoubleDashes };
585
+ const ignoreDefault = command && command.config.ignoreOptionDefaultValue ? command.config.ignoreOptionDefaultValue : this.globalCommand.config.ignoreOptionDefaultValue;
586
+ const transforms = Object.create(null);
587
+ for (const cliOption of cliOptions) {
588
+ if (!ignoreDefault && cliOption.config.default !== void 0) for (const name of cliOption.names) options[name] = cliOption.config.default;
589
+ if (Array.isArray(cliOption.config.type) && transforms[cliOption.name] === void 0) {
590
+ transforms[cliOption.name] = Object.create(null);
591
+ transforms[cliOption.name].shouldTransform = true;
592
+ transforms[cliOption.name].transformFunction = cliOption.config.type[0];
593
+ }
594
+ }
595
+ for (const key of Object.keys(parsed)) if (key !== "_") {
596
+ setDotProp(options, key.split("."), parsed[key]);
597
+ setByType(options, transforms);
598
+ }
599
+ return {
600
+ args,
601
+ options
602
+ };
603
+ }
604
+ runMatchedCommand() {
605
+ const { args, options, matchedCommand: command } = this;
606
+ if (!command || !command.commandAction) return;
607
+ command.checkUnknownOptions();
608
+ command.checkOptionValue();
609
+ command.checkRequiredArgs();
610
+ command.checkUnusedArgs();
611
+ const actionArgs = [];
612
+ command.args.forEach((arg, index) => {
613
+ if (arg.variadic) actionArgs.push(args.slice(index));
614
+ else actionArgs.push(args[index]);
615
+ });
616
+ actionArgs.push(options);
617
+ return command.commandAction.apply(this, actionArgs);
618
+ }
619
+ };
620
+ /**
621
+ * @param name The program name to display in help and version message
622
+ */
623
+ const cac = (name = "") => new CAC(name);
624
+ //#endregion
625
+ //#region src/node/cli.ts
626
+ var import_picocolors = /* @__PURE__ */ __toESM(require_picocolors(), 1);
627
+ function checkNodeVersion(nodeVersion) {
628
+ const currentVersion = nodeVersion.split(".");
629
+ const major = parseInt(currentVersion[0], 10);
630
+ const minor = parseInt(currentVersion[1], 10);
631
+ return major === 20 && minor >= 19 || major === 22 && minor >= 12 || major > 22;
632
+ }
633
+ if (!checkNodeVersion(process.versions.node)) console.warn(import_picocolors.default.yellow(`You are using Node.js ${process.versions.node}. Vite requires Node.js version 20.19+ or 22.12+. Please upgrade your Node.js version.`));
634
+ const cli = cac("vite");
635
+ let profileSession = global.__vite_profile_session;
636
+ let profileCount = 0;
637
+ const stopProfiler = (log) => {
638
+ if (!profileSession) return;
639
+ return new Promise((res, rej) => {
640
+ profileSession.post("Profiler.stop", (err, { profile }) => {
641
+ if (!err) {
642
+ const outPath = path.resolve(`./vite-profile-${profileCount++}.cpuprofile`);
643
+ fs.writeFileSync(outPath, JSON.stringify(profile));
644
+ log(import_picocolors.default.yellow(`CPU profile written to ${import_picocolors.default.white(import_picocolors.default.dim(outPath))}`));
645
+ profileSession = void 0;
646
+ res();
647
+ } else rej(err);
648
+ });
649
+ });
650
+ };
651
+ const filterDuplicateOptions = (options) => {
652
+ for (const [key, value] of Object.entries(options)) if (Array.isArray(value)) options[key] = value[value.length - 1];
653
+ };
654
+ /**
655
+ * removing global flags before passing as command specific sub-configs
656
+ */
657
+ function cleanGlobalCLIOptions(options) {
658
+ const ret = { ...options };
659
+ delete ret["--"];
660
+ delete ret.c;
661
+ delete ret.config;
662
+ delete ret.base;
663
+ delete ret.l;
664
+ delete ret.logLevel;
665
+ delete ret.clearScreen;
666
+ delete ret.configLoader;
667
+ delete ret.d;
668
+ delete ret.debug;
669
+ delete ret.f;
670
+ delete ret.filter;
671
+ delete ret.m;
672
+ delete ret.mode;
673
+ delete ret.force;
674
+ delete ret.w;
675
+ if ("sourcemap" in ret) {
676
+ const sourcemap = ret.sourcemap;
677
+ ret.sourcemap = sourcemap === "true" ? true : sourcemap === "false" ? false : ret.sourcemap;
678
+ }
679
+ if ("watch" in ret) ret.watch = ret.watch ? {} : void 0;
680
+ return ret;
681
+ }
682
+ /**
683
+ * removing builder flags before passing as command specific sub-configs
684
+ */
685
+ function cleanBuilderCLIOptions(options) {
686
+ const ret = { ...options };
687
+ delete ret.app;
688
+ return ret;
689
+ }
690
+ /**
691
+ * host may be a number (like 0), should convert to string
692
+ */
693
+ const convertHost = (v) => {
694
+ if (typeof v === "number") return String(v);
695
+ return v;
696
+ };
697
+ /**
698
+ * base may be a number (like 0), should convert to empty string
699
+ */
700
+ const convertBase = (v) => {
701
+ if (v === 0) return "";
702
+ return v;
703
+ };
704
+ cli.option("-c, --config <file>", `[string] use specified config file`).option("--base <path>", `[string] public base path (default: /)`, { type: [convertBase] }).option("-l, --logLevel <level>", `[string] info | warn | error | silent`).option("--clearScreen", `[boolean] allow/disable clear screen when logging`).option("--configLoader <loader>", `[string] use 'bundle' to bundle the config with Rolldown, or 'runner' (experimental) to process it on the fly, or 'native' (experimental) to load using the native runtime (default: bundle)`).option("-d, --debug [feat]", `[string | boolean] show debug logs`).option("-f, --filter <filter>", `[string] filter debug logs`).option("-m, --mode <mode>", `[string] set env mode`);
705
+ cli.command("[root]", "start dev server").alias("serve").alias("dev").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--open [path]", `[boolean | string] open browser on startup`).option("--cors", `[boolean] enable CORS`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).option("--experimentalBundle", `[boolean] use experimental full bundle mode (this is highly experimental)`).action(async (root, options) => {
706
+ filterDuplicateOptions(options);
707
+ const { createServer } = await import("./chunks/node.js").then((n) => n.A);
708
+ try {
709
+ const server = await createServer({
710
+ root,
711
+ base: options.base,
712
+ mode: options.mode,
713
+ configFile: options.config,
714
+ configLoader: options.configLoader,
715
+ logLevel: options.logLevel,
716
+ clearScreen: options.clearScreen,
717
+ server: cleanGlobalCLIOptions(options),
718
+ forceOptimizeDeps: options.force,
719
+ experimental: { bundledDev: options.experimentalBundle }
720
+ });
721
+ if (!server.httpServer) throw new Error("HTTP server not available");
722
+ await server.listen();
723
+ const info = server.config.logger.info;
724
+ const modeString = options.mode && options.mode !== "development" ? ` ${import_picocolors.default.bgGreen(` ${import_picocolors.default.bold(options.mode)} `)}` : "";
725
+ const viteStartTime = global.__vite_start_time ?? false;
726
+ const startupDurationString = viteStartTime ? import_picocolors.default.dim(`ready in ${import_picocolors.default.reset(import_picocolors.default.bold(Math.ceil(performance.now() - viteStartTime)))} ms`) : "";
727
+ const hasExistingLogs = process.stdout.bytesWritten > 0 || process.stderr.bytesWritten > 0;
728
+ info(`\n ${import_picocolors.default.green(`${import_picocolors.default.bold("VITE")} v${VERSION}`)}${modeString} ${startupDurationString}\n`, { clear: !hasExistingLogs });
729
+ server.printUrls();
730
+ const customShortcuts = [];
731
+ if (profileSession) customShortcuts.push({
732
+ key: "p",
733
+ description: "start/stop the profiler",
734
+ async action(server) {
735
+ if (profileSession) await stopProfiler(server.config.logger.info);
736
+ else {
737
+ const inspector = await import("node:inspector").then((r) => r.default);
738
+ await new Promise((res) => {
739
+ profileSession = new inspector.Session();
740
+ profileSession.connect();
741
+ profileSession.post("Profiler.enable", () => {
742
+ profileSession.post("Profiler.start", () => {
743
+ server.config.logger.info("Profiler started");
744
+ res();
745
+ });
746
+ });
747
+ });
748
+ }
749
+ }
750
+ });
751
+ server.bindCLIShortcuts({
752
+ print: true,
753
+ customShortcuts
754
+ });
755
+ } catch (e) {
756
+ const logger = createLogger(options.logLevel);
757
+ logger.error(import_picocolors.default.red(`error when starting dev server:\n${inspect(e)}`), { error: e });
758
+ await stopProfiler(logger.info);
759
+ process.exit(1);
760
+ }
761
+ });
762
+ cli.command("build [root]", "build for production").option("--target <target>", `[string] transpile target (default: 'baseline-widely-available')`).option("--outDir <dir>", `[string] output directory (default: dist)`).option("--assetsDir <dir>", `[string] directory under outDir to place assets in (default: assets)`).option("--assetsInlineLimit <number>", `[number] static asset base64 inline threshold in bytes (default: 4096)`).option("--ssr [entry]", `[string] build specified entry for server-side rendering`).option("--sourcemap [output]", `[boolean | "inline" | "hidden"] output source maps for build (default: false)`).option("--minify [minifier]", "[boolean | \"oxc\" | \"terser\" | \"esbuild\"] enable/disable minification, or specify minifier to use (default: oxc)").option("--manifest [name]", `[boolean | string] emit build manifest json`).option("--ssrManifest [name]", `[boolean | string] emit ssr manifest json`).option("--emptyOutDir", `[boolean] force empty outDir when it's outside of root`).option("-w, --watch", `[boolean] rebuilds when modules have changed on disk`).option("--app", `[boolean] same as \`builder: {}\``).action(async (root, options) => {
763
+ filterDuplicateOptions(options);
764
+ const { createBuilder } = await import("./chunks/node.js").then((n) => n.w);
765
+ const buildOptions = cleanGlobalCLIOptions(cleanBuilderCLIOptions(options));
766
+ try {
767
+ const builder = await createBuilder({
768
+ root,
769
+ base: options.base,
770
+ mode: options.mode,
771
+ configFile: options.config,
772
+ configLoader: options.configLoader,
773
+ logLevel: options.logLevel,
774
+ clearScreen: options.clearScreen,
775
+ build: buildOptions,
776
+ ...options.app ? { builder: {} } : {}
777
+ }, null);
778
+ await builder.buildApp();
779
+ await builder.runDevTools();
780
+ } catch (e) {
781
+ createLogger(options.logLevel).error(import_picocolors.default.red(`error during build:\n${inspect(e)}`), { error: e });
782
+ process.exit(1);
783
+ } finally {
784
+ await stopProfiler((message) => createLogger(options.logLevel).info(message));
785
+ }
786
+ });
787
+ cli.command("optimize [root]", "pre-bundle dependencies (deprecated, the pre-bundle process runs automatically and does not need to be called)").option("--force", `[boolean] force the optimizer to ignore the cache and re-bundle`).action(async (root, options) => {
788
+ filterDuplicateOptions(options);
789
+ const { resolveConfig } = await import("./chunks/node.js").then((n) => n.f);
790
+ const { optimizeDeps } = await import("./chunks/node.js").then((n) => n.D);
791
+ try {
792
+ await optimizeDeps(await resolveConfig({
793
+ root,
794
+ base: options.base,
795
+ configFile: options.config,
796
+ configLoader: options.configLoader,
797
+ logLevel: options.logLevel,
798
+ mode: options.mode
799
+ }, "serve"), options.force, true);
800
+ } catch (e) {
801
+ createLogger(options.logLevel).error(import_picocolors.default.red(`error when optimizing deps:\n${inspect(e)}`), { error: e });
802
+ process.exit(1);
803
+ }
804
+ });
805
+ cli.command("preview [root]", "locally preview production build").option("--host [host]", `[string] specify hostname`, { type: [convertHost] }).option("--port <port>", `[number] specify port`).option("--strictPort", `[boolean] exit if specified port is already in use`).option("--open [path]", `[boolean | string] open browser on startup`).option("--outDir <dir>", `[string] output directory (default: dist)`).action(async (root, options) => {
806
+ filterDuplicateOptions(options);
807
+ const { preview } = await import("./chunks/node.js").then((n) => n.y);
808
+ try {
809
+ const server = await preview({
810
+ root,
811
+ base: options.base,
812
+ configFile: options.config,
813
+ configLoader: options.configLoader,
814
+ logLevel: options.logLevel,
815
+ mode: options.mode,
816
+ build: { outDir: options.outDir },
817
+ preview: {
818
+ port: options.port,
819
+ strictPort: options.strictPort,
820
+ host: options.host,
821
+ open: options.open
822
+ }
823
+ });
824
+ server.printUrls();
825
+ server.bindCLIShortcuts({ print: true });
826
+ } catch (e) {
827
+ createLogger(options.logLevel).error(import_picocolors.default.red(`error when starting preview server:\n${inspect(e)}`), { error: e });
828
+ process.exit(1);
829
+ } finally {
830
+ await stopProfiler((message) => createLogger(options.logLevel).info(message));
831
+ }
832
+ });
833
+ cli.help();
834
+ cli.version(VERSION);
835
+ cli.parse();
836
+ //#endregion
837
+ export { stopProfiler };