nitro 3.0.1-alpha.1 → 3.0.260311-beta

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 (383) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +4 -2
  3. package/dist/THIRD-PARTY-LICENSES.md +1646 -0
  4. package/dist/_build/common.mjs +29347 -54
  5. package/dist/_build/rolldown.mjs +53 -86
  6. package/dist/_build/rollup.mjs +42 -137
  7. package/dist/_build/vite.build.mjs +12 -50
  8. package/dist/_chunks/{B-D1JOIz.mjs → nitro.mjs} +211 -407
  9. package/dist/_chunks/nitro2.mjs +102 -0
  10. package/dist/_chunks/nitro3.mjs +129 -0
  11. package/dist/_chunks/utils.mjs +272 -0
  12. package/dist/{_chunks/Bqks5huO.mjs → _common.mjs} +11 -7
  13. package/dist/_dev.mjs +140 -326
  14. package/dist/_libs/_.mjs +3 -0
  15. package/dist/_libs/_2.mjs +2 -0
  16. package/dist/_libs/_3.mjs +3 -0
  17. package/dist/_libs/_4.mjs +2 -0
  18. package/dist/_libs/_5.mjs +3 -0
  19. package/dist/_libs/_6.mjs +4 -0
  20. package/dist/_libs/_7.mjs +5 -0
  21. package/dist/_libs/c12+rc9.mjs +812 -0
  22. package/dist/_libs/c12+readdirp+chokidar.d.mts +230 -0
  23. package/dist/_libs/citty.mjs +141 -113
  24. package/dist/_libs/{plugin-commonjs.mjs → commondir+is-reference.mjs} +79 -259
  25. package/dist/_libs/compatx.d.mts +47 -0
  26. package/dist/_libs/compatx.mjs +1 -2
  27. package/dist/_libs/esbuild.d.mts +20 -0
  28. package/dist/_libs/escape-string-regexp.mjs +1 -2
  29. package/dist/_libs/estree+pluginutils.d.mts +241 -0
  30. package/dist/_libs/estree-walker.mjs +1 -147
  31. package/dist/_libs/exsolve.d.mts +1 -0
  32. package/dist/_libs/{plugin-node-resolve.mjs → hasown+resolve+deepmerge.mjs} +612 -216
  33. package/dist/_libs/httpxy.d.mts +82 -0
  34. package/dist/_libs/httpxy.mjs +299 -38
  35. package/dist/_libs/js-tokens.d.mts +1 -0
  36. package/dist/_libs/klona.mjs +1 -2
  37. package/dist/_libs/magic-string.d.mts +220 -0
  38. package/dist/_libs/mlly.d.mts +57 -0
  39. package/dist/_libs/nypm+tinyexec.mjs +845 -0
  40. package/dist/_libs/perfect-debounce.mjs +88 -0
  41. package/dist/_libs/pkg-types.d.mts +23 -0
  42. package/dist/_libs/plugin-alias.mjs +4 -4
  43. package/dist/_libs/plugin-inject.mjs +3 -7
  44. package/dist/_libs/plugin-json.mjs +3 -5
  45. package/dist/_libs/{vite-plugin-fullstack.mjs → pluginutils.mjs} +241 -156
  46. package/dist/_libs/{chokidar.mjs → readdirp+chokidar.mjs} +268 -223
  47. package/dist/_libs/remapping.mjs +2 -4
  48. package/dist/_libs/{gen-mapping.mjs → resolve-uri+gen-mapping.mjs} +16 -186
  49. package/dist/_libs/rou3.d.mts +44 -0
  50. package/dist/_libs/rou3.mjs +231 -54
  51. package/dist/_libs/std-env.d.mts +12 -0
  52. package/dist/_libs/strip-literal.d.mts +1 -0
  53. package/dist/_libs/tsconfck.mjs +20 -39
  54. package/dist/_libs/ultrahtml.mjs +3 -14
  55. package/dist/_libs/unimport+unplugin.mjs +1684 -0
  56. package/dist/_libs/unplugin+unimport.d.mts +423 -0
  57. package/dist/_libs/unwasm.d.mts +29 -0
  58. package/dist/_presets.mjs +475 -468
  59. package/dist/builder.d.mts +8 -7
  60. package/dist/builder.mjs +7 -25
  61. package/dist/cli/_chunks/build.mjs +22 -23
  62. package/dist/cli/_chunks/common.mjs +1 -2
  63. package/dist/cli/_chunks/deploy.mjs +40 -0
  64. package/dist/cli/_chunks/dev.mjs +9 -15
  65. package/dist/cli/_chunks/docs.mjs +30 -0
  66. package/dist/cli/_chunks/list.mjs +4 -6
  67. package/dist/cli/_chunks/prepare.mjs +2 -4
  68. package/dist/cli/_chunks/preview.mjs +51 -0
  69. package/dist/cli/_chunks/run.mjs +7 -9
  70. package/dist/cli/_chunks/task.mjs +1 -3
  71. package/dist/cli/index.mjs +5 -4
  72. package/dist/node_modules/@poppinss/colors/build/index.js +130 -160
  73. package/dist/node_modules/@poppinss/colors/package.json +20 -18
  74. package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +8 -0
  75. package/dist/node_modules/@poppinss/dumper/package.json +1 -1
  76. package/dist/node_modules/@poppinss/exception/build/index.js +36 -55
  77. package/dist/node_modules/@poppinss/exception/package.json +19 -16
  78. package/dist/node_modules/@sindresorhus/is/distribution/index.js +46 -5
  79. package/dist/node_modules/@sindresorhus/is/package.json +1 -1
  80. package/dist/node_modules/@speed-highlight/core/dist/index.js +1 -1
  81. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +1 -1
  82. package/dist/node_modules/@speed-highlight/core/package.json +2 -2
  83. package/dist/node_modules/croner/dist/croner.js +1 -1
  84. package/dist/node_modules/croner/package.json +11 -1
  85. package/dist/node_modules/ufo/dist/index.mjs +16 -9
  86. package/dist/node_modules/ufo/package.json +15 -14
  87. package/dist/node_modules/unctx/package.json +16 -16
  88. package/dist/node_modules/youch/build/helpers-B9BQYaS6.js +23 -0
  89. package/dist/node_modules/youch/build/index.js +204 -352
  90. package/dist/node_modules/youch/build/public/error_info/script.js +1 -1
  91. package/dist/node_modules/youch/build/public/error_info/style.css +1 -0
  92. package/dist/node_modules/youch/build/public/error_metadata/style.css +3 -0
  93. package/dist/node_modules/youch/build/public/error_stack/style.css +2 -3
  94. package/dist/node_modules/youch/build/public_dir-C5bujZKB.js +25 -0
  95. package/dist/node_modules/youch/build/src/templates/error_cause/main.js +44 -0
  96. package/dist/node_modules/youch/build/src/templates/error_info/main.js +72 -0
  97. package/dist/node_modules/youch/build/src/templates/error_metadata/main.js +65 -0
  98. package/dist/node_modules/youch/build/src/templates/error_stack/main.js +152 -0
  99. package/dist/node_modules/youch/build/src/templates/error_stack_source/main.js +46 -0
  100. package/dist/node_modules/youch/build/src/templates/header/main.js +24 -0
  101. package/dist/node_modules/youch/build/src/templates/layout/main.js +27 -0
  102. package/dist/node_modules/youch/package.json +34 -31
  103. package/dist/presets/_nitro/runtime/nitro-dev.mjs +13 -61
  104. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +2 -1
  105. package/dist/presets/_nitro/runtime/service-worker.mjs +2 -3
  106. package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +1 -1
  107. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +11 -11
  108. package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +1 -1
  109. package/dist/presets/azure/runtime/azure-swa.mjs +1 -1
  110. package/dist/presets/bun/runtime/bun.mjs +11 -11
  111. package/dist/presets/cloudflare/runtime/_module-handler.mjs +19 -17
  112. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +17 -16
  113. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +8 -9
  114. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +12 -18
  115. package/dist/presets/deno/runtime/deno-deploy.mjs +4 -5
  116. package/dist/presets/deno/runtime/deno-server.mjs +9 -9
  117. package/dist/presets/netlify/runtime/netlify-edge.mjs +3 -3
  118. package/dist/presets/netlify/runtime/netlify.mjs +3 -1
  119. package/dist/presets/node/runtime/node-cluster.mjs +8 -8
  120. package/dist/presets/node/runtime/node-middleware.mjs +4 -5
  121. package/dist/presets/node/runtime/node-server.mjs +8 -8
  122. package/dist/presets/standard/runtime/server.mjs +1 -1
  123. package/dist/presets/stormkit/runtime/stormkit.mjs +1 -2
  124. package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
  125. package/dist/presets/vercel/runtime/isr.mjs +19 -0
  126. package/dist/presets/vercel/runtime/vercel.node.mjs +16 -7
  127. package/dist/presets/vercel/runtime/vercel.web.mjs +14 -11
  128. package/dist/presets/winterjs/runtime/winterjs.mjs +1 -1
  129. package/dist/presets/zeabur/runtime/zeabur.mjs +1 -1
  130. package/dist/presets/zephyr/runtime/server.mjs +3 -0
  131. package/dist/runtime/app.d.mts +1 -1
  132. package/dist/runtime/app.mjs +1 -1
  133. package/dist/runtime/internal/app.d.mts +7 -3
  134. package/dist/runtime/internal/app.mjs +29 -22
  135. package/dist/runtime/internal/cache.d.mts +0 -4
  136. package/dist/runtime/internal/cache.mjs +32 -256
  137. package/dist/runtime/internal/context.d.mts +3 -1
  138. package/dist/runtime/internal/database.mjs +1 -1
  139. package/dist/runtime/internal/error/dev.d.mts +5 -5
  140. package/dist/runtime/internal/error/dev.mjs +39 -41
  141. package/dist/runtime/internal/error/hooks.d.mts +1 -1
  142. package/dist/runtime/internal/error/prod.d.mts +2 -5
  143. package/dist/runtime/internal/error/prod.mjs +19 -33
  144. package/dist/runtime/internal/error/utils.d.mts +4 -4
  145. package/dist/runtime/internal/meta.d.mts +1 -1
  146. package/dist/runtime/internal/plugin.d.mts +2 -2
  147. package/dist/runtime/internal/route-rules.d.mts +9 -8
  148. package/dist/runtime/internal/route-rules.mjs +9 -1
  149. package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -2
  150. package/dist/runtime/internal/routes/dev-tasks.mjs +7 -3
  151. package/dist/runtime/internal/routes/openapi.d.mts +0 -1
  152. package/dist/runtime/internal/routes/openapi.mjs +3 -3
  153. package/dist/runtime/internal/routes/renderer-template.d.mts +1 -1
  154. package/dist/runtime/internal/routes/renderer-template.dev.d.mts +2 -1
  155. package/dist/runtime/internal/routes/renderer-template.dev.mjs +1 -1
  156. package/dist/runtime/internal/routes/renderer-template.mjs +1 -1
  157. package/dist/runtime/internal/routes/scalar.d.mts +0 -1
  158. package/dist/runtime/internal/routes/scalar.mjs +4 -4
  159. package/dist/runtime/internal/routes/swagger.d.mts +0 -1
  160. package/dist/runtime/internal/routes/swagger.mjs +3 -3
  161. package/dist/runtime/internal/runtime-config.d.mts +1 -1
  162. package/dist/runtime/internal/runtime-config.mjs +8 -8
  163. package/dist/runtime/internal/static.mjs +6 -5
  164. package/dist/runtime/internal/storage.mjs +1 -1
  165. package/dist/runtime/internal/task.d.mts +3 -1
  166. package/dist/runtime/internal/task.mjs +3 -3
  167. package/dist/runtime/internal/vite/dev-entry.mjs +8 -6
  168. package/dist/runtime/internal/vite/dev-worker.mjs +166 -216
  169. package/dist/runtime/meta.d.mts +1 -1
  170. package/dist/runtime/meta.mjs +2 -1
  171. package/dist/runtime/nitro.d.mts +2 -3
  172. package/dist/runtime/nitro.mjs +3 -1
  173. package/dist/runtime/virtual/_runtime_warn.d.mts +1 -0
  174. package/dist/runtime/virtual/_runtime_warn.mjs +5 -0
  175. package/dist/runtime/virtual/database.d.mts +8 -0
  176. package/dist/runtime/virtual/database.mjs +2 -0
  177. package/dist/runtime/virtual/error-handler.d.mts +6 -0
  178. package/dist/runtime/virtual/error-handler.mjs +9 -0
  179. package/dist/runtime/virtual/feature-flags.d.mts +7 -0
  180. package/dist/runtime/virtual/feature-flags.mjs +7 -0
  181. package/dist/runtime/virtual/plugins.d.mts +3 -0
  182. package/dist/runtime/virtual/plugins.mjs +2 -0
  183. package/dist/{presets/_nitro/runtime/nitro-prerenderer.d.mts → runtime/virtual/polyfills.d.mts} +1 -1
  184. package/dist/runtime/virtual/polyfills.mjs +2 -0
  185. package/dist/runtime/virtual/public-assets.d.mts +9 -0
  186. package/dist/runtime/virtual/public-assets.mjs +8 -0
  187. package/dist/runtime/virtual/renderer-template.d.mts +4 -0
  188. package/dist/runtime/virtual/renderer-template.mjs +7 -0
  189. package/dist/runtime/virtual/routing-meta.d.mts +7 -0
  190. package/dist/runtime/virtual/routing-meta.mjs +2 -0
  191. package/dist/runtime/virtual/routing.d.mts +8 -0
  192. package/dist/runtime/virtual/routing.mjs +11 -0
  193. package/dist/runtime/virtual/runtime-config.d.mts +3 -0
  194. package/dist/runtime/virtual/runtime-config.mjs +5 -0
  195. package/dist/runtime/virtual/server-assets.d.mts +7 -0
  196. package/dist/runtime/virtual/server-assets.mjs +12 -0
  197. package/dist/runtime/virtual/storage.d.mts +3 -0
  198. package/dist/runtime/virtual/storage.mjs +5 -0
  199. package/dist/runtime/virtual/tasks.d.mts +10 -0
  200. package/dist/runtime/virtual/tasks.mjs +3 -0
  201. package/dist/runtime/{vite-runtime.d.mts → vite.d.mts} +1 -1
  202. package/dist/types/index.d.mts +315 -443
  203. package/dist/types/index.mjs +1 -1
  204. package/dist/vite.d.mts +10 -15
  205. package/dist/vite.mjs +733 -37
  206. package/lib/vite.types.d.mts +26 -0
  207. package/lib/vite.types.mjs +2 -0
  208. package/package.json +129 -85
  209. package/skills/nitro/SKILL.md +10 -0
  210. package/skills/nitro/docs/TOC.md +83 -0
  211. package/skills/nitro/docs/_navigation.json +679 -0
  212. package/skills/nitro/docs/config/index.md +1147 -0
  213. package/skills/nitro/docs/deploy/index.md +64 -0
  214. package/skills/nitro/docs/deploy/providers/alwaysdata.md +50 -0
  215. package/skills/nitro/docs/deploy/providers/aws-amplify.md +81 -0
  216. package/skills/nitro/docs/deploy/providers/aws.md +47 -0
  217. package/skills/nitro/docs/deploy/providers/azure.md +72 -0
  218. package/skills/nitro/docs/deploy/providers/cleavr.md +33 -0
  219. package/skills/nitro/docs/deploy/providers/cloudflare.md +375 -0
  220. package/skills/nitro/docs/deploy/providers/deno-deploy.md +66 -0
  221. package/skills/nitro/docs/deploy/providers/digitalocean.md +46 -0
  222. package/skills/nitro/docs/deploy/providers/firebase.md +32 -0
  223. package/skills/nitro/docs/deploy/providers/flightcontrol.md +67 -0
  224. package/skills/nitro/docs/deploy/providers/genezio.md +67 -0
  225. package/skills/nitro/docs/deploy/providers/github-pages.md +68 -0
  226. package/skills/nitro/docs/deploy/providers/gitlab-pages.md +37 -0
  227. package/skills/nitro/docs/deploy/providers/heroku.md +84 -0
  228. package/skills/nitro/docs/deploy/providers/iis.md +38 -0
  229. package/skills/nitro/docs/deploy/providers/koyeb.md +109 -0
  230. package/skills/nitro/docs/deploy/providers/netlify.md +47 -0
  231. package/skills/nitro/docs/deploy/providers/platform-sh.md +37 -0
  232. package/skills/nitro/docs/deploy/providers/render.md +37 -0
  233. package/skills/nitro/docs/deploy/providers/stormkit.md +24 -0
  234. package/skills/nitro/docs/deploy/providers/vercel.md +179 -0
  235. package/skills/nitro/docs/deploy/providers/zeabur.md +19 -0
  236. package/skills/nitro/docs/deploy/providers/zephyr.md +99 -0
  237. package/skills/nitro/docs/deploy/providers/zerops.md +102 -0
  238. package/skills/nitro/docs/deploy/runtimes/bun.md +15 -0
  239. package/skills/nitro/docs/deploy/runtimes/deno.md +19 -0
  240. package/skills/nitro/docs/deploy/runtimes/node.md +63 -0
  241. package/skills/nitro/docs/docs/assets.md +166 -0
  242. package/skills/nitro/docs/docs/cache.md +408 -0
  243. package/skills/nitro/docs/docs/configuration.md +256 -0
  244. package/skills/nitro/docs/docs/database.md +185 -0
  245. package/skills/nitro/docs/docs/index.md +56 -0
  246. package/skills/nitro/docs/docs/lifecycle.md +204 -0
  247. package/skills/nitro/docs/docs/migration.md +215 -0
  248. package/skills/nitro/docs/docs/nightly.md +31 -0
  249. package/skills/nitro/docs/docs/plugins.md +164 -0
  250. package/skills/nitro/docs/docs/quick-start.md +110 -0
  251. package/skills/nitro/docs/docs/renderer.md +322 -0
  252. package/skills/nitro/docs/docs/routing.md +711 -0
  253. package/skills/nitro/docs/docs/server-entry.md +239 -0
  254. package/skills/nitro/docs/docs/storage.md +261 -0
  255. package/skills/nitro/docs/docs/tasks.md +277 -0
  256. package/skills/nitro/docs/examples/api-routes.md +145 -0
  257. package/skills/nitro/docs/examples/auto-imports.md +93 -0
  258. package/skills/nitro/docs/examples/cached-handler.md +81 -0
  259. package/skills/nitro/docs/examples/custom-error-handler.md +98 -0
  260. package/skills/nitro/docs/examples/database.md +157 -0
  261. package/skills/nitro/docs/examples/elysia.md +70 -0
  262. package/skills/nitro/docs/examples/express.md +78 -0
  263. package/skills/nitro/docs/examples/fastify.md +79 -0
  264. package/skills/nitro/docs/examples/hello-world.md +68 -0
  265. package/skills/nitro/docs/examples/hono.md +74 -0
  266. package/skills/nitro/docs/examples/import-alias.md +100 -0
  267. package/skills/nitro/docs/examples/index.md +3 -0
  268. package/skills/nitro/docs/examples/middleware.md +91 -0
  269. package/skills/nitro/docs/examples/mono-jsx.md +68 -0
  270. package/skills/nitro/docs/examples/nano-jsx.md +70 -0
  271. package/skills/nitro/docs/examples/plugins.md +91 -0
  272. package/skills/nitro/docs/examples/renderer.md +113 -0
  273. package/skills/nitro/docs/examples/runtime-config.md +97 -0
  274. package/skills/nitro/docs/examples/server-fetch.md +87 -0
  275. package/skills/nitro/docs/examples/shiki.md +198 -0
  276. package/skills/nitro/docs/examples/virtual-routes.md +74 -0
  277. package/skills/nitro/docs/examples/vite-nitro-plugin.md +79 -0
  278. package/skills/nitro/docs/examples/vite-rsc.md +1041 -0
  279. package/skills/nitro/docs/examples/vite-ssr-html.md +217 -0
  280. package/skills/nitro/docs/examples/vite-ssr-preact.md +247 -0
  281. package/skills/nitro/docs/examples/vite-ssr-react.md +226 -0
  282. package/skills/nitro/docs/examples/vite-ssr-solid.md +256 -0
  283. package/skills/nitro/docs/examples/vite-ssr-tsr-react.md +442 -0
  284. package/skills/nitro/docs/examples/vite-ssr-tss-react.md +444 -0
  285. package/skills/nitro/docs/examples/vite-ssr-vue-router.md +616 -0
  286. package/skills/nitro/docs/examples/vite-trpc.md +335 -0
  287. package/skills/nitro/docs/examples/websocket.md +282 -0
  288. package/skills/nitro/docs/index.md +121 -0
  289. package/dist/_build/common2.mjs +0 -772
  290. package/dist/_build/vite.plugin.mjs +0 -768
  291. package/dist/_chunks/ANM1K1bE.mjs +0 -304
  292. package/dist/_chunks/BX9-zVkM.mjs +0 -59
  293. package/dist/_chunks/C7CbzoI1.mjs +0 -39
  294. package/dist/_libs/acorn.mjs +0 -5034
  295. package/dist/_libs/c12.mjs +0 -2858
  296. package/dist/_libs/commondir.mjs +0 -22
  297. package/dist/_libs/confbox.mjs +0 -2920
  298. package/dist/_libs/deepmerge.mjs +0 -86
  299. package/dist/_libs/dot-prop.mjs +0 -138
  300. package/dist/_libs/duplexer.mjs +0 -71
  301. package/dist/_libs/etag.mjs +0 -80
  302. package/dist/_libs/fdir.mjs +0 -514
  303. package/dist/_libs/function-bind.mjs +0 -63
  304. package/dist/_libs/giget.mjs +0 -19289
  305. package/dist/_libs/gzip-size.mjs +0 -21
  306. package/dist/_libs/hasown.mjs +0 -14
  307. package/dist/_libs/is-core-module.mjs +0 -220
  308. package/dist/_libs/is-module.mjs +0 -13
  309. package/dist/_libs/is-reference.mjs +0 -32
  310. package/dist/_libs/js-tokens.mjs +0 -382
  311. package/dist/_libs/knitwork.mjs +0 -124
  312. package/dist/_libs/local-pkg.mjs +0 -1686
  313. package/dist/_libs/magic-string.mjs +0 -939
  314. package/dist/_libs/mime.mjs +0 -1391
  315. package/dist/_libs/node-fetch-native.mjs +0 -173
  316. package/dist/_libs/path-parse.mjs +0 -47
  317. package/dist/_libs/pathe.mjs +0 -41
  318. package/dist/_libs/picomatch.mjs +0 -1673
  319. package/dist/_libs/plugin-replace.mjs +0 -104
  320. package/dist/_libs/pretty-bytes.mjs +0 -116
  321. package/dist/_libs/std-env.mjs +0 -158
  322. package/dist/_libs/strip-literal.mjs +0 -51
  323. package/dist/_libs/tinyglobby.mjs +0 -292
  324. package/dist/_libs/unimport.mjs +0 -3520
  325. package/dist/_libs/untyped.mjs +0 -271
  326. package/dist/_libs/unwasm.mjs +0 -5836
  327. package/dist/cli/_chunks/detect-acorn.mjs +0 -12
  328. package/dist/cli/_chunks/dist.mjs +0 -3
  329. package/dist/cli/_chunks/dist2.mjs +0 -3
  330. package/dist/cli/_chunks/dist3.mjs +0 -3
  331. package/dist/cli/_chunks/dist4.mjs +0 -4
  332. package/dist/cli/_chunks/dist5.mjs +0 -4
  333. package/dist/cli/_chunks/esm.mjs +0 -3
  334. package/dist/cli/_chunks/json5.mjs +0 -4
  335. package/dist/cli/_chunks/jsonc.mjs +0 -4
  336. package/dist/cli/_chunks/multipart-parser.mjs +0 -6
  337. package/dist/cli/_chunks/toml.mjs +0 -4
  338. package/dist/cli/_chunks/yaml.mjs +0 -4
  339. package/dist/node_modules/hookable/dist/index.mjs +0 -267
  340. package/dist/node_modules/hookable/package.json +0 -52
  341. package/dist/node_modules/kleur/index.js +0 -110
  342. package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +0 -42
  343. package/dist/node_modules/youch/build/chunk-4XB2BYKC.js +0 -85
  344. package/dist/node_modules/youch/build/chunk-4YEN7HVQ.js +0 -61
  345. package/dist/node_modules/youch/build/chunk-EUJBVOYB.js +0 -83
  346. package/dist/node_modules/youch/build/chunk-F4I6KX4R.js +0 -46
  347. package/dist/node_modules/youch/build/chunk-HFSXRSKS.js +0 -85
  348. package/dist/node_modules/youch/build/chunk-OSUFJZHZ.js +0 -6
  349. package/dist/node_modules/youch/build/chunk-PINJDICN.js +0 -72
  350. package/dist/node_modules/youch/build/chunk-PUHGL6HA.js +0 -41
  351. package/dist/node_modules/youch/build/chunk-YYEJ3AGB.js +0 -225
  352. package/dist/presets/_nitro/runtime/nitro-dev.d.mts +0 -2
  353. package/dist/presets/_nitro/runtime/service-worker.d.mts +0 -2
  354. package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +0 -2
  355. package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -13
  356. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +0 -2
  357. package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +0 -3
  358. package/dist/presets/azure/runtime/_utils.d.mts +0 -2
  359. package/dist/presets/azure/runtime/azure-swa.d.mts +0 -5
  360. package/dist/presets/bun/runtime/bun.d.mts +0 -3
  361. package/dist/presets/cloudflare/runtime/_module-handler.d.mts +0 -16
  362. package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +0 -11
  363. package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +0 -3
  364. package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +0 -20
  365. package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +0 -3
  366. package/dist/presets/deno/runtime/deno-deploy.d.mts +0 -5
  367. package/dist/presets/deno/runtime/deno-server.d.mts +0 -3
  368. package/dist/presets/netlify/runtime/netlify-edge.d.mts +0 -4
  369. package/dist/presets/netlify/runtime/netlify.d.mts +0 -3
  370. package/dist/presets/node/runtime/node-cluster.d.mts +0 -3
  371. package/dist/presets/node/runtime/node-middleware.d.mts +0 -3
  372. package/dist/presets/node/runtime/node-server.d.mts +0 -3
  373. package/dist/presets/standard/runtime/server.d.mts +0 -3
  374. package/dist/presets/stormkit/runtime/stormkit.d.mts +0 -21
  375. package/dist/presets/vercel/runtime/vercel.node.d.mts +0 -3
  376. package/dist/presets/vercel/runtime/vercel.web.d.mts +0 -8
  377. package/dist/presets/winterjs/runtime/winterjs.d.mts +0 -3
  378. package/dist/presets/zeabur/runtime/zeabur.d.mts +0 -3
  379. package/lib/deps/ofetch.mjs +0 -1
  380. package/lib/deps/ofetch.mts +0 -1
  381. /package/dist/runtime/{vite-runtime.mjs → vite.mjs} +0 -0
  382. /package/lib/{deps/h3.d.mts → h3.d.mts} +0 -0
  383. /package/lib/{deps/h3.mjs → h3.mjs} +0 -0
@@ -0,0 +1,230 @@
1
+ import { Stats } from "node:fs";
2
+ import { EventEmitter } from "node:events";
3
+ import { Readable } from "node:stream";
4
+ import { DownloadTemplateOptions } from "giget";
5
+
6
+ //#region node_modules/.pnpm/c12@4.0.0-beta.3_chokidar@5.0.0_dotenv@17.3.1_giget@3.1.2_jiti@2.6.1_magicast@0.5.2/node_modules/c12/dist/_chunks/libs/ohash.d.mts
7
+ //#region node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/utils/index.d.mts
8
+ /**
9
+ * Calculates the difference between two objects and returns a list of differences.
10
+ *
11
+ * @param {any} obj1 - The first object to compare.
12
+ * @param {any} obj2 - The second object to compare.
13
+ * @param {HashOptions} [opts={}] - Configuration options for hashing the objects. See {@link HashOptions}.
14
+ * @returns {DiffEntry[]} An array with the differences between the two objects.
15
+ */
16
+ declare function diff(obj1: any, obj2: any): DiffEntry[];
17
+ declare class DiffEntry {
18
+ key: string;
19
+ type: "changed" | "added" | "removed";
20
+ newValue: DiffHashedObject;
21
+ oldValue?: DiffHashedObject | undefined;
22
+ constructor(key: string, type: "changed" | "added" | "removed", newValue: DiffHashedObject, oldValue?: DiffHashedObject | undefined);
23
+ toString(): string;
24
+ toJSON(): string;
25
+ }
26
+ declare class DiffHashedObject {
27
+ key: string;
28
+ value: any;
29
+ hash?: string | undefined;
30
+ props?: Record<string, DiffHashedObject> | undefined;
31
+ constructor(key: string, value: any, hash?: string | undefined, props?: Record<string, DiffHashedObject> | undefined);
32
+ toString(): string;
33
+ toJSON(): string;
34
+ } //#endregion
35
+ //#endregion
36
+ //#region node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.d.ts
37
+ type AWF = {
38
+ stabilityThreshold: number;
39
+ pollInterval: number;
40
+ };
41
+ type BasicOpts = {
42
+ persistent: boolean;
43
+ ignoreInitial: boolean;
44
+ followSymlinks: boolean;
45
+ cwd?: string;
46
+ usePolling: boolean;
47
+ interval: number;
48
+ binaryInterval: number;
49
+ alwaysStat?: boolean;
50
+ depth?: number;
51
+ ignorePermissionErrors: boolean;
52
+ atomic: boolean | number;
53
+ };
54
+ type ChokidarOptions = Partial<BasicOpts & {
55
+ ignored: Matcher | Matcher[];
56
+ awaitWriteFinish: boolean | Partial<AWF>;
57
+ }>;
58
+ type MatchFunction = (val: string, stats?: Stats) => boolean;
59
+ interface MatcherObject {
60
+ path: string;
61
+ recursive?: boolean;
62
+ }
63
+ type Matcher = string | RegExp | MatchFunction | MatcherObject;
64
+ //#endregion
65
+ //#region node_modules/.pnpm/c12@4.0.0-beta.3_chokidar@5.0.0_dotenv@17.3.1_giget@3.1.2_jiti@2.6.1_magicast@0.5.2/node_modules/c12/dist/index.d.mts
66
+ //#region src/dotenv.d.ts
67
+ interface DotenvOptions {
68
+ /**
69
+ * The project root directory (either absolute or relative to the current working directory).
70
+ *
71
+ * Defaults to `options.cwd` in `loadConfig` context, or `process.cwd()` when used as standalone.
72
+ */
73
+ cwd?: string;
74
+ /**
75
+ * What file or files to look in for environment variables (either absolute or relative
76
+ * to the current working directory). For example, `.env`.
77
+ * With the array type, the order enforce the env loading priority (last one overrides).
78
+ */
79
+ fileName?: string | string[];
80
+ /**
81
+ * Whether to interpolate variables within .env.
82
+ *
83
+ * @example
84
+ * ```env
85
+ * BASE_DIR="/test"
86
+ * # resolves to "/test/further"
87
+ * ANOTHER_DIR="${BASE_DIR}/further"
88
+ * ```
89
+ */
90
+ interpolate?: boolean;
91
+ /**
92
+ * An object describing environment variables (key, value pairs).
93
+ */
94
+ env?: NodeJS.ProcessEnv;
95
+ /**
96
+ * Resolve `_FILE` suffixed environment variables by reading the file at the
97
+ * specified path and assigning its trimmed content to the base key.
98
+ *
99
+ * This is useful for container secrets (e.g. Docker, Kubernetes) where
100
+ * sensitive values are mounted as files.
101
+ *
102
+ * @default false
103
+ *
104
+ * @example
105
+ * ```env
106
+ * DATABASE_PASSWORD_FILE="/run/secrets/db_password"
107
+ * # resolves to DATABASE_PASSWORD=<contents of /run/secrets/db_password>
108
+ * ```
109
+ */
110
+ expandFileReferences?: boolean;
111
+ }
112
+ declare global {
113
+ var __c12_dotenv_vars__: Map<Record<string, any>, Set<string>>;
114
+ } //#endregion
115
+ //#region src/types.d.ts
116
+ interface ConfigLayerMeta {
117
+ name?: string;
118
+ [key: string]: any;
119
+ }
120
+ type UserInputConfig = Record<string, any>;
121
+ interface C12InputConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
122
+ $test?: T;
123
+ $development?: T;
124
+ $production?: T;
125
+ $env?: Record<string, T>;
126
+ $meta?: MT;
127
+ }
128
+ interface SourceOptions<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
129
+ /** Custom meta for layer */
130
+ meta?: MT;
131
+ /** Layer config overrides */
132
+ overrides?: T;
133
+ [key: string]: any;
134
+ /**
135
+ * Options for cloning remote sources
136
+ *
137
+ * @see https://giget.unjs.io
138
+ */
139
+ giget?: DownloadTemplateOptions;
140
+ /**
141
+ * Install dependencies after cloning
142
+ *
143
+ * @see https://nypm.unjs.io
144
+ */
145
+ install?: boolean;
146
+ /**
147
+ * Token for cloning private sources
148
+ *
149
+ * @see https://giget.unjs.io#providing-token-for-private-repositories
150
+ */
151
+ auth?: string;
152
+ }
153
+ interface ConfigLayer<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
154
+ config: T | null;
155
+ source?: string;
156
+ sourceOptions?: SourceOptions<T, MT>;
157
+ meta?: MT;
158
+ cwd?: string;
159
+ configFile?: string;
160
+ }
161
+ interface ResolvedConfig<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> extends ConfigLayer<T, MT> {
162
+ config: T;
163
+ layers?: ConfigLayer<T, MT>[];
164
+ cwd?: string;
165
+ _configFile?: string;
166
+ }
167
+ type ConfigSource = "overrides" | "main" | "rc" | "packageJson" | "defaultConfig";
168
+ interface ConfigFunctionContext {
169
+ [key: string]: any;
170
+ }
171
+ interface ResolvableConfigContext<T extends UserInputConfig = UserInputConfig> {
172
+ configs: Record<ConfigSource, T | null | undefined>;
173
+ rawConfigs: Record<ConfigSource, ResolvableConfig<T> | null | undefined>;
174
+ }
175
+ type MaybePromise<T> = T | Promise<T>;
176
+ type ResolvableConfig<T extends UserInputConfig = UserInputConfig> = MaybePromise<T | null | undefined> | ((ctx: ResolvableConfigContext<T>) => MaybePromise<T | null | undefined>);
177
+ interface LoadConfigOptions<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> {
178
+ name?: string;
179
+ cwd?: string;
180
+ configFile?: string;
181
+ rcFile?: false | string;
182
+ globalRc?: boolean;
183
+ dotenv?: boolean | DotenvOptions;
184
+ envName?: string | false;
185
+ packageJson?: boolean | string | string[];
186
+ defaults?: T;
187
+ defaultConfig?: ResolvableConfig<T>;
188
+ overrides?: ResolvableConfig<T>;
189
+ omit$Keys?: boolean;
190
+ /** Context passed to config functions */
191
+ context?: ConfigFunctionContext;
192
+ resolve?: (id: string, options: LoadConfigOptions<T, MT>) => null | undefined | ResolvedConfig<T, MT> | Promise<ResolvedConfig<T, MT> | undefined | null>;
193
+ /** Custom import function used to load configuration files */
194
+ import?: (id: string) => Promise<unknown>;
195
+ /** Custom resolver for picking which export to use from the loaded module. Default: `(mod) => mod.default || mod` */
196
+ resolveModule?: (mod: any) => any;
197
+ giget?: false | DownloadTemplateOptions;
198
+ merger?: (...sources: Array<T | null | undefined>) => T;
199
+ extend?: false | {
200
+ extendKey?: string | string[];
201
+ };
202
+ configFileRequired?: boolean;
203
+ }
204
+ //#endregion
205
+ //#region src/watch.d.ts
206
+ type DiffEntries = ReturnType<typeof diff>;
207
+ type ConfigWatcher<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> = ResolvedConfig<T, MT> & {
208
+ watchingFiles: string[];
209
+ unwatch: () => Promise<void>;
210
+ };
211
+ interface WatchConfigOptions<T extends UserInputConfig = UserInputConfig, MT extends ConfigLayerMeta = ConfigLayerMeta> extends LoadConfigOptions<T, MT> {
212
+ chokidarOptions?: ChokidarOptions;
213
+ debounce?: false | number;
214
+ onWatch?: (event: {
215
+ type: "created" | "updated" | "removed";
216
+ path: string;
217
+ }) => void | Promise<void>;
218
+ acceptHMR?: (context: {
219
+ getDiff: () => DiffEntries;
220
+ newConfig: ResolvedConfig<T, MT>;
221
+ oldConfig: ResolvedConfig<T, MT>;
222
+ }) => void | boolean | Promise<void | boolean>;
223
+ onUpdate?: (context: {
224
+ getDiff: () => ReturnType<typeof diff>;
225
+ newConfig: ResolvedConfig<T, MT>;
226
+ oldConfig: ResolvedConfig<T, MT>;
227
+ }) => void | Promise<void>;
228
+ }
229
+ //#endregion
230
+ export { WatchConfigOptions as a, ResolvedConfig as i, ConfigWatcher as n, ChokidarOptions as o, DotenvOptions as r, C12InputConfig as t };
@@ -1,26 +1,5 @@
1
- import consola$1 from "consola";
2
- import { colors } from "consola/utils";
3
-
4
- //#region node_modules/.pnpm/citty@0.1.6/node_modules/citty/dist/index.mjs
5
- function toArray(val) {
6
- if (Array.isArray(val)) return val;
7
- return val === void 0 ? [] : [val];
8
- }
9
- function formatLineColumns(lines, linePrefix = "") {
10
- const maxLengh = [];
11
- for (const line of lines) for (const [i, element] of line.entries()) maxLengh[i] = Math.max(maxLengh[i] || 0, element.length);
12
- return lines.map((l) => l.map((c, i) => linePrefix + c[i === 0 ? "padStart" : "padEnd"](maxLengh[i])).join(" ")).join("\n");
13
- }
14
- function resolveValue(input) {
15
- return typeof input === "function" ? input() : input;
16
- }
17
- var CLIError = class extends Error {
18
- constructor(message, code) {
19
- super(message);
20
- this.code = code;
21
- this.name = "CLIError";
22
- }
23
- };
1
+ import { parseArgs } from "node:util";
2
+ //#region node_modules/.pnpm/citty@0.2.1/node_modules/citty/dist/_chunks/libs/scule.mjs
24
3
  const NUMBER_CHAR_RE = /\d/;
25
4
  const STR_SPLITTERS = [
26
5
  "-",
@@ -85,101 +64,141 @@ function camelCase(str, opts) {
85
64
  function kebabCase(str, joiner) {
86
65
  return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
87
66
  }
88
- function toArr(any) {
89
- return any == void 0 ? [] : Array.isArray(any) ? any : [any];
67
+ //#endregion
68
+ //#region node_modules/.pnpm/citty@0.2.1/node_modules/citty/dist/index.mjs
69
+ function toArray(val) {
70
+ if (Array.isArray(val)) return val;
71
+ return val === void 0 ? [] : [val];
90
72
  }
91
- function toVal(out, key, val, opts) {
92
- let x;
93
- const old = out[key];
94
- const nxt = ~opts.string.indexOf(key) ? val == void 0 || 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;
95
- out[key] = old == void 0 ? nxt : Array.isArray(old) ? old.concat(nxt) : [old, nxt];
73
+ function formatLineColumns(lines, linePrefix = "") {
74
+ const maxLength = [];
75
+ for (const line of lines) for (const [i, element] of line.entries()) maxLength[i] = Math.max(maxLength[i] || 0, element.length);
76
+ return lines.map((l) => l.map((c, i) => linePrefix + c[i === 0 ? "padStart" : "padEnd"](maxLength[i])).join(" ")).join("\n");
96
77
  }
97
- function parseRawArgs(args = [], opts = {}) {
98
- let k;
99
- let arr;
100
- let arg;
101
- let name;
102
- let val;
103
- const out = { _: [] };
104
- let i = 0;
105
- let j = 0;
106
- let idx = 0;
107
- const len = args.length;
108
- const alibi = opts.alias !== void 0;
109
- const strict = opts.unknown !== void 0;
110
- const defaults = opts.default !== void 0;
111
- opts.alias = opts.alias || {};
112
- opts.string = toArr(opts.string);
113
- opts.boolean = toArr(opts.boolean);
114
- if (alibi) for (k in opts.alias) {
115
- arr = opts.alias[k] = toArr(opts.alias[k]);
116
- for (i = 0; i < arr.length; i++) (opts.alias[arr[i]] = arr.concat(k)).splice(i, 1);
117
- }
118
- for (i = opts.boolean.length; i-- > 0;) {
119
- arr = opts.alias[opts.boolean[i]] || [];
120
- for (j = arr.length; j-- > 0;) opts.boolean.push(arr[j]);
121
- }
122
- for (i = opts.string.length; i-- > 0;) {
123
- arr = opts.alias[opts.string[i]] || [];
124
- for (j = arr.length; j-- > 0;) opts.string.push(arr[j]);
78
+ function resolveValue(input) {
79
+ return typeof input === "function" ? input() : input;
80
+ }
81
+ var CLIError = class extends Error {
82
+ code;
83
+ constructor(message, code) {
84
+ super(message);
85
+ this.name = "CLIError";
86
+ this.code = code;
125
87
  }
126
- if (defaults) for (k in opts.default) {
127
- name = typeof opts.default[k];
128
- arr = opts.alias[k] = opts.alias[k] || [];
129
- if (opts[name] !== void 0) {
130
- opts[name].push(k);
131
- for (i = 0; i < arr.length; i++) opts[name].push(arr[i]);
88
+ };
89
+ function parseRawArgs(args = [], opts = {}) {
90
+ const booleans = new Set(opts.boolean || []);
91
+ const strings = new Set(opts.string || []);
92
+ const aliasMap = opts.alias || {};
93
+ const defaults = opts.default || {};
94
+ const aliasToMain = /* @__PURE__ */ new Map();
95
+ const mainToAliases = /* @__PURE__ */ new Map();
96
+ for (const [key, value] of Object.entries(aliasMap)) {
97
+ const targets = value;
98
+ for (const target of targets) {
99
+ aliasToMain.set(key, target);
100
+ if (!mainToAliases.has(target)) mainToAliases.set(target, []);
101
+ mainToAliases.get(target).push(key);
102
+ aliasToMain.set(target, key);
103
+ if (!mainToAliases.has(key)) mainToAliases.set(key, []);
104
+ mainToAliases.get(key).push(target);
132
105
  }
133
106
  }
134
- const keys = strict ? Object.keys(opts.alias) : [];
135
- for (i = 0; i < len; i++) {
136
- arg = args[i];
107
+ const options = {};
108
+ function getType(name) {
109
+ if (booleans.has(name)) return "boolean";
110
+ const aliases = mainToAliases.get(name) || [];
111
+ for (const alias of aliases) if (booleans.has(alias)) return "boolean";
112
+ return "string";
113
+ }
114
+ const allOptions = new Set([
115
+ ...booleans,
116
+ ...strings,
117
+ ...Object.keys(aliasMap),
118
+ ...Object.values(aliasMap).flat(),
119
+ ...Object.keys(defaults)
120
+ ]);
121
+ for (const name of allOptions) if (!options[name]) options[name] = {
122
+ type: getType(name),
123
+ default: defaults[name]
124
+ };
125
+ for (const [alias, main] of aliasToMain.entries()) if (alias.length === 1 && options[main] && !options[main].short) options[main].short = alias;
126
+ const processedArgs = [];
127
+ const negatedFlags = {};
128
+ for (let i = 0; i < args.length; i++) {
129
+ const arg = args[i];
137
130
  if (arg === "--") {
138
- out._ = out._.concat(args.slice(++i));
131
+ processedArgs.push(...args.slice(i));
139
132
  break;
140
133
  }
141
- for (j = 0; j < arg.length; j++) if (arg.charCodeAt(j) !== 45) break;
142
- if (j === 0) out._.push(arg);
143
- else if (arg.substring(j, j + 3) === "no-") {
144
- name = arg.slice(Math.max(0, j + 3));
145
- if (strict && !~keys.indexOf(name)) return opts.unknown(arg);
146
- out[name] = false;
147
- } else {
148
- for (idx = j + 1; idx < arg.length; idx++) if (arg.charCodeAt(idx) === 61) break;
149
- name = arg.substring(j, idx);
150
- val = arg.slice(Math.max(0, ++idx)) || i + 1 === len || ("" + args[i + 1]).charCodeAt(0) === 45 || args[++i];
151
- arr = j === 2 ? [name] : name;
152
- for (idx = 0; idx < arr.length; idx++) {
153
- name = arr[idx];
154
- if (strict && !~keys.indexOf(name)) return opts.unknown("-".repeat(j) + name);
155
- toVal(out, name, idx + 1 < arr.length || val, opts);
156
- }
134
+ if (arg.startsWith("--no-")) {
135
+ const flagName = arg.slice(5);
136
+ negatedFlags[flagName] = true;
137
+ continue;
157
138
  }
139
+ processedArgs.push(arg);
158
140
  }
159
- if (defaults) {
160
- for (k in opts.default) if (out[k] === void 0) out[k] = opts.default[k];
141
+ let parsed;
142
+ try {
143
+ parsed = parseArgs({
144
+ args: processedArgs,
145
+ options: Object.keys(options).length > 0 ? options : void 0,
146
+ allowPositionals: true,
147
+ strict: false
148
+ });
149
+ } catch {
150
+ parsed = {
151
+ values: {},
152
+ positionals: processedArgs
153
+ };
161
154
  }
162
- if (alibi) for (k in out) {
163
- arr = opts.alias[k] || [];
164
- while (arr.length > 0) out[arr.shift()] = out[k];
155
+ const out = { _: [] };
156
+ out._ = parsed.positionals;
157
+ for (const [key, value] of Object.entries(parsed.values)) out[key] = value;
158
+ for (const [name] of Object.entries(negatedFlags)) {
159
+ out[name] = false;
160
+ const mainName = aliasToMain.get(name);
161
+ if (mainName) out[mainName] = false;
162
+ const aliases = mainToAliases.get(name);
163
+ if (aliases) for (const alias of aliases) out[alias] = false;
164
+ }
165
+ for (const [alias, main] of aliasToMain.entries()) {
166
+ if (out[alias] !== void 0 && out[main] === void 0) out[main] = out[alias];
167
+ if (out[main] !== void 0 && out[alias] === void 0) out[alias] = out[main];
165
168
  }
166
169
  return out;
167
170
  }
168
- function parseArgs(rawArgs, argsDef) {
171
+ const noColor = /* @__PURE__ */ (() => {
172
+ const env = globalThis.process?.env ?? {};
173
+ return env.NO_COLOR === "1" || env.TERM === "dumb" || env.TEST || env.CI;
174
+ })();
175
+ const _c = (c, r = 39) => (t) => noColor ? t : `\u001B[${c}m${t}\u001B[${r}m`;
176
+ const bold = /* @__PURE__ */ _c(1, 22);
177
+ const cyan = /* @__PURE__ */ _c(36);
178
+ const gray = /* @__PURE__ */ _c(90);
179
+ const underline = /* @__PURE__ */ _c(4, 24);
180
+ function parseArgs$1(rawArgs, argsDef) {
169
181
  const parseOptions = {
170
182
  boolean: [],
171
183
  string: [],
172
- mixed: [],
173
184
  alias: {},
174
185
  default: {}
175
186
  };
176
187
  const args = resolveArgs(argsDef);
177
188
  for (const arg of args) {
178
189
  if (arg.type === "positional") continue;
179
- if (arg.type === "string") parseOptions.string.push(arg.name);
190
+ if (arg.type === "string" || arg.type === "enum") parseOptions.string.push(arg.name);
180
191
  else if (arg.type === "boolean") parseOptions.boolean.push(arg.name);
181
192
  if (arg.default !== void 0) parseOptions.default[arg.name] = arg.default;
182
193
  if (arg.alias) parseOptions.alias[arg.name] = arg.alias;
194
+ const camelName = camelCase(arg.name);
195
+ const kebabName = kebabCase(arg.name);
196
+ if (camelName !== arg.name || kebabName !== arg.name) {
197
+ const existingAliases = toArray(parseOptions.alias[arg.name] || []);
198
+ if (camelName !== arg.name && !existingAliases.includes(camelName)) existingAliases.push(camelName);
199
+ if (kebabName !== arg.name && !existingAliases.includes(kebabName)) existingAliases.push(kebabName);
200
+ if (existingAliases.length > 0) parseOptions.alias[arg.name] = existingAliases;
201
+ }
183
202
  }
184
203
  const parsed = parseRawArgs(rawArgs, parseOptions);
185
204
  const [ ...positionalArguments] = parsed._;
@@ -191,6 +210,10 @@ function parseArgs(rawArgs, argsDef) {
191
210
  if (nextPositionalArgument !== void 0) parsedArgsProxy[arg.name] = nextPositionalArgument;
192
211
  else if (arg.default === void 0 && arg.required !== false) throw new CLIError(`Missing required positional argument: ${arg.name.toUpperCase()}`, "EARG");
193
212
  else parsedArgsProxy[arg.name] = arg.default;
213
+ } else if (arg.type === "enum") {
214
+ const argument = parsedArgsProxy[arg.name];
215
+ const options = arg.options || [];
216
+ if (argument !== void 0 && options.length > 0 && !options.includes(argument)) throw new CLIError(`Invalid value for argument: ${cyan(`--${arg.name}`)} (${cyan(argument)}). Expected one of: ${options.map((o) => cyan(o)).join(", ")}.`, "EARG");
194
217
  } else if (arg.required && parsedArgsProxy[arg.name] === void 0) throw new CLIError(`Missing required argument: --${arg.name}`, "EARG");
195
218
  return parsedArgsProxy;
196
219
  }
@@ -208,7 +231,7 @@ function defineCommand(def) {
208
231
  }
209
232
  async function runCommand(cmd, opts) {
210
233
  const cmdArgs = await resolveValue(cmd.args || {});
211
- const parsedArgs = parseArgs(opts.rawArgs, cmdArgs);
234
+ const parsedArgs = parseArgs$1(opts.rawArgs, cmdArgs);
212
235
  const context = {
213
236
  rawArgs: opts.rawArgs,
214
237
  args: parsedArgs,
@@ -223,7 +246,7 @@ async function runCommand(cmd, opts) {
223
246
  const subCommandArgIndex = opts.rawArgs.findIndex((arg) => !arg.startsWith("-"));
224
247
  const subCommandName = opts.rawArgs[subCommandArgIndex];
225
248
  if (subCommandName) {
226
- if (!subCommands[subCommandName]) throw new CLIError(`Unknown command \`${subCommandName}\``, "E_UNKNOWN_COMMAND");
249
+ if (!subCommands[subCommandName]) throw new CLIError(`Unknown command ${cyan(subCommandName)}`, "E_UNKNOWN_COMMAND");
227
250
  const subCommand = await resolveValue(subCommands[subCommandName]);
228
251
  if (subCommand) await runCommand(subCommand, { rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1) });
229
252
  } else if (!cmd.run) throw new CLIError(`No command specified.`, "E_NO_COMMAND");
@@ -246,11 +269,12 @@ async function resolveSubCommand(cmd, rawArgs, parent) {
246
269
  }
247
270
  async function showUsage(cmd, parent) {
248
271
  try {
249
- consola$1.log(await renderUsage(cmd, parent) + "\n");
272
+ console.log(await renderUsage(cmd, parent) + "\n");
250
273
  } catch (error) {
251
- consola$1.error(error);
274
+ console.error(error);
252
275
  }
253
276
  }
277
+ const negativePrefixRe = /^no[-A-Z]/;
254
278
  async function renderUsage(cmd, parent) {
255
279
  const cmdMeta = await resolveValue(cmd.meta || {});
256
280
  const cmdArgs = resolveArgs(await resolveValue(cmd.args || {}));
@@ -265,15 +289,19 @@ async function renderUsage(cmd, parent) {
265
289
  const isRequired = arg.required !== false && arg.default === void 0;
266
290
  const defaultHint = arg.default ? `="${arg.default}"` : "";
267
291
  posLines.push([
268
- "`" + name + defaultHint + "`",
292
+ cyan(name + defaultHint),
269
293
  arg.description || "",
270
294
  arg.valueHint ? `<${arg.valueHint}>` : ""
271
295
  ]);
272
296
  usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
273
297
  } else {
274
298
  const isRequired = arg.required === true && arg.default === void 0;
275
- const argStr = (arg.type === "boolean" && arg.default === true ? [...(arg.alias || []).map((a) => `--no-${a}`), `--no-${arg.name}`].join(", ") : [...(arg.alias || []).map((a) => `-${a}`), `--${arg.name}`].join(", ")) + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "");
276
- argLines.push(["`" + argStr + (isRequired ? " (required)" : "") + "`", arg.description || ""]);
299
+ const argStr = [...(arg.alias || []).map((a) => `-${a}`), `--${arg.name}`].join(", ") + (arg.type === "string" && (arg.valueHint || arg.default) ? `=${arg.valueHint ? `<${arg.valueHint}>` : `"${arg.default || ""}"`}` : "") + (arg.type === "enum" && arg.options ? `=<${arg.options.join("|")}>` : "");
300
+ argLines.push([cyan(argStr + (isRequired ? " (required)" : "")), arg.description || ""]);
301
+ if (arg.type === "boolean" && (arg.default === true || arg.negativeDescription) && !negativePrefixRe.test(arg.name)) {
302
+ const negativeArgStr = [...(arg.alias || []).map((a) => `--no-${a}`), `--no-${arg.name}`].join(", ");
303
+ argLines.push([cyan(negativeArgStr + (isRequired ? " (required)" : "")), arg.negativeDescription || ""]);
304
+ }
277
305
  if (isRequired) usageLine.push(argStr);
278
306
  }
279
307
  if (cmd.subCommands) {
@@ -281,30 +309,31 @@ async function renderUsage(cmd, parent) {
281
309
  const subCommands = await resolveValue(cmd.subCommands);
282
310
  for (const [name, sub] of Object.entries(subCommands)) {
283
311
  const meta = await resolveValue((await resolveValue(sub))?.meta);
284
- commandsLines.push([`\`${name}\``, meta?.description || ""]);
312
+ if (meta?.hidden) continue;
313
+ commandsLines.push([cyan(name), meta?.description || ""]);
285
314
  commandNames.push(name);
286
315
  }
287
316
  usageLine.push(commandNames.join("|"));
288
317
  }
289
318
  const usageLines = [];
290
319
  const version = cmdMeta.version || parentMeta.version;
291
- usageLines.push(colors.gray(`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`), "");
320
+ usageLines.push(gray(`${cmdMeta.description} (${commandName + (version ? ` v${version}` : "")})`), "");
292
321
  const hasOptions = argLines.length > 0 || posLines.length > 0;
293
- usageLines.push(`${colors.underline(colors.bold("USAGE"))} \`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}\``, "");
322
+ usageLines.push(`${underline(bold("USAGE"))} ${cyan(`${commandName}${hasOptions ? " [OPTIONS]" : ""} ${usageLine.join(" ")}`)}`, "");
294
323
  if (posLines.length > 0) {
295
- usageLines.push(colors.underline(colors.bold("ARGUMENTS")), "");
324
+ usageLines.push(underline(bold("ARGUMENTS")), "");
296
325
  usageLines.push(formatLineColumns(posLines, " "));
297
326
  usageLines.push("");
298
327
  }
299
328
  if (argLines.length > 0) {
300
- usageLines.push(colors.underline(colors.bold("OPTIONS")), "");
329
+ usageLines.push(underline(bold("OPTIONS")), "");
301
330
  usageLines.push(formatLineColumns(argLines, " "));
302
331
  usageLines.push("");
303
332
  }
304
333
  if (commandsLines.length > 0) {
305
- usageLines.push(colors.underline(colors.bold("COMMANDS")), "");
334
+ usageLines.push(underline(bold("COMMANDS")), "");
306
335
  usageLines.push(formatLineColumns(commandsLines, " "));
307
- usageLines.push("", `Use \`${commandName} <command> --help\` for more information about a command.`);
336
+ usageLines.push("", `Use ${cyan(`${commandName} <command> --help`)} for more information about a command.`);
308
337
  }
309
338
  return usageLines.filter((l) => typeof l === "string").join("\n");
310
339
  }
@@ -318,16 +347,15 @@ async function runMain(cmd, opts = {}) {
318
347
  } else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
319
348
  const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
320
349
  if (!meta?.version) throw new CLIError("No version specified", "E_NO_VERSION");
321
- consola$1.log(meta.version);
350
+ console.log(meta.version);
322
351
  } else await runCommand(cmd, { rawArgs });
323
352
  } catch (error) {
324
- const isCLIError = error instanceof CLIError;
325
- if (!isCLIError) consola$1.error(error, "\n");
326
- if (isCLIError) await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
327
- consola$1.error(error.message);
353
+ if (error instanceof CLIError) {
354
+ await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
355
+ console.error(error.message);
356
+ } else console.error(error, "\n");
328
357
  process.exit(1);
329
358
  }
330
359
  }
331
-
332
360
  //#endregion
333
- export { runMain as n, defineCommand as t };
361
+ export { runMain as n, defineCommand as t };