nitro 3.0.1-alpha.2 → 3.0.260415-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 (297) hide show
  1. package/LICENSE +6 -0
  2. package/README.md +2 -2
  3. package/dist/THIRD-PARTY-LICENSES.md +1646 -0
  4. package/dist/_build/common.mjs +7261 -3812
  5. package/dist/_build/rolldown.mjs +32 -42
  6. package/dist/_build/rollup.mjs +28 -48
  7. package/dist/_build/vite.build.mjs +10 -10
  8. package/dist/_chunks/nitro.mjs +102 -327
  9. package/dist/_chunks/nitro2.mjs +8 -9
  10. package/dist/_chunks/nitro3.mjs +136 -0
  11. package/dist/_chunks/nitro4.mjs +127 -0
  12. package/dist/_chunks/utils.mjs +40 -29
  13. package/dist/_common.mjs +13 -25
  14. package/dist/_dev.d.mts +0 -3
  15. package/dist/{_chunks/dev.mjs → _dev.mjs} +132 -330
  16. package/dist/_libs/_.mjs +2 -0
  17. package/dist/_libs/_2.mjs +2 -0
  18. package/dist/_libs/_3.mjs +2 -0
  19. package/dist/_libs/_4.mjs +2 -0
  20. package/dist/_libs/_5.mjs +2 -0
  21. package/dist/_libs/_6.mjs +2 -0
  22. package/dist/_libs/_7.mjs +2 -0
  23. package/dist/_libs/c12+rc9.mjs +814 -0
  24. package/dist/_libs/{c12+giget+readdirp+chokidar.d.mts → c12+readdirp+chokidar.d.mts} +49 -40
  25. package/dist/_libs/citty.mjs +142 -41
  26. package/dist/_libs/commondir+is-reference.mjs +60 -56
  27. package/dist/_libs/compatx.d.mts +0 -2
  28. package/dist/_libs/compatx.mjs +1 -4
  29. package/dist/_libs/esbuild.d.mts +0 -1
  30. package/dist/_libs/escape-string-regexp.mjs +1 -4
  31. package/dist/_libs/{pluginutils+plugin-commonjs.d.mts → estree+pluginutils.d.mts} +0 -5
  32. package/dist/_libs/estree-walker.mjs +4 -92
  33. package/dist/_libs/exsolve.d.mts +1 -0
  34. package/dist/_libs/hasown+resolve+deepmerge.mjs +160 -246
  35. package/dist/_libs/httpxy.d.mts +20 -13
  36. package/dist/_libs/httpxy.mjs +519 -95
  37. package/dist/_libs/js-tokens.d.mts +1 -0
  38. package/dist/_libs/klona.mjs +1 -4
  39. package/dist/_libs/magic-string.d.mts +0 -2
  40. package/dist/_libs/mlly.d.mts +0 -2
  41. package/dist/_libs/nypm+tinyexec.mjs +822 -0
  42. package/dist/_libs/perfect-debounce.mjs +68 -0
  43. package/dist/_libs/pkg-types.d.mts +0 -3
  44. package/dist/_libs/plugin-alias.mjs +1 -5
  45. package/dist/_libs/plugin-inject.mjs +1 -7
  46. package/dist/_libs/plugin-json.mjs +1 -5
  47. package/dist/_libs/pluginutils.mjs +3 -35
  48. package/dist/_libs/readdirp+chokidar.mjs +187 -365
  49. package/dist/_libs/remapping.mjs +1 -5
  50. package/dist/_libs/resolve-uri+gen-mapping.mjs +15 -53
  51. package/dist/_libs/rou3.d.mts +1 -4
  52. package/dist/_libs/rou3.mjs +223 -78
  53. package/dist/_libs/std-env.d.mts +8 -2
  54. package/dist/_libs/strip-literal.d.mts +1 -0
  55. package/dist/_libs/tsconfck.mjs +21 -334
  56. package/dist/_libs/ultrahtml.mjs +3 -16
  57. package/dist/_libs/unimport+unplugin.mjs +244 -388
  58. package/dist/_libs/unplugin+unimport.d.mts +5 -15
  59. package/dist/_libs/unwasm.d.mts +0 -3
  60. package/dist/_presets.mjs +576 -488
  61. package/dist/builder.d.mts +5 -25
  62. package/dist/builder.mjs +3 -8
  63. package/dist/cli/_chunks/build.mjs +22 -25
  64. package/dist/cli/_chunks/common.mjs +1 -4
  65. package/dist/cli/_chunks/deploy.mjs +37 -0
  66. package/dist/cli/_chunks/dev.mjs +6 -11
  67. package/dist/cli/_chunks/docs.mjs +28 -0
  68. package/dist/cli/_chunks/list.mjs +4 -8
  69. package/dist/cli/_chunks/prepare.mjs +2 -6
  70. package/dist/cli/_chunks/preview.mjs +48 -0
  71. package/dist/cli/_chunks/run.mjs +7 -11
  72. package/dist/cli/_chunks/task.mjs +1 -5
  73. package/dist/cli/index.mjs +5 -6
  74. package/dist/docs/0.docs/0.index/index.md +56 -0
  75. package/dist/docs/0.docs/1.quick-start.md +110 -0
  76. package/dist/docs/0.docs/10.lifecycle.md +204 -0
  77. package/dist/docs/0.docs/11.openapi.md +291 -0
  78. package/dist/docs/0.docs/12.plugins.md +164 -0
  79. package/dist/docs/0.docs/13.tasks.md +277 -0
  80. package/dist/docs/0.docs/14.websocket.md +386 -0
  81. package/dist/docs/0.docs/15.migration.md +213 -0
  82. package/dist/docs/0.docs/16.nightly.md +31 -0
  83. package/dist/docs/0.docs/2.renderer.md +322 -0
  84. package/dist/docs/0.docs/3.routing.md +711 -0
  85. package/dist/docs/0.docs/4.server-entry.md +239 -0
  86. package/dist/docs/0.docs/5.cache.md +408 -0
  87. package/dist/docs/0.docs/6.storage.md +261 -0
  88. package/dist/docs/0.docs/7.assets.md +166 -0
  89. package/dist/docs/0.docs/8.configuration.md +256 -0
  90. package/dist/docs/0.docs/9.database.md +185 -0
  91. package/dist/docs/1.deploy/0.index/index.md +64 -0
  92. package/dist/docs/1.deploy/1.runtimes/0.node.md +63 -0
  93. package/dist/docs/1.deploy/1.runtimes/1.bun.md +15 -0
  94. package/dist/docs/1.deploy/1.runtimes/2.deno.md +19 -0
  95. package/dist/docs/1.deploy/2.providers/0.alwaysdata.md +50 -0
  96. package/dist/docs/1.deploy/2.providers/1.aws.md +47 -0
  97. package/dist/docs/1.deploy/2.providers/10.flightcontrol.md +67 -0
  98. package/dist/docs/1.deploy/2.providers/11.genezio.md +67 -0
  99. package/dist/docs/1.deploy/2.providers/12.github-pages.md +68 -0
  100. package/dist/docs/1.deploy/2.providers/13.gitlab-pages.md +37 -0
  101. package/dist/docs/1.deploy/2.providers/14.heroku.md +84 -0
  102. package/dist/docs/1.deploy/2.providers/15.iis.md +38 -0
  103. package/dist/docs/1.deploy/2.providers/16.koyeb.md +109 -0
  104. package/dist/docs/1.deploy/2.providers/17.netlify.md +47 -0
  105. package/dist/docs/1.deploy/2.providers/18.platform-sh.md +37 -0
  106. package/dist/docs/1.deploy/2.providers/19.render.md +37 -0
  107. package/dist/docs/1.deploy/2.providers/2.aws-amplify.md +81 -0
  108. package/dist/docs/1.deploy/2.providers/20.stormkit.md +24 -0
  109. package/dist/docs/1.deploy/2.providers/21.vercel.md +270 -0
  110. package/dist/docs/1.deploy/2.providers/22.zeabur.md +19 -0
  111. package/dist/docs/1.deploy/2.providers/23.zephyr.md +99 -0
  112. package/dist/docs/1.deploy/2.providers/24.zerops.md +102 -0
  113. package/dist/docs/1.deploy/2.providers/3.azure.md +72 -0
  114. package/dist/docs/1.deploy/2.providers/4.cleavr.md +33 -0
  115. package/dist/docs/1.deploy/2.providers/5.cloudflare.md +369 -0
  116. package/dist/docs/1.deploy/2.providers/6.deno-deploy.md +66 -0
  117. package/dist/docs/1.deploy/2.providers/7.digitalocean.md +46 -0
  118. package/dist/docs/1.deploy/2.providers/8.edgeone.md +20 -0
  119. package/dist/docs/1.deploy/2.providers/9.firebase.md +32 -0
  120. package/dist/docs/2.config/0.index/index.md +1221 -0
  121. package/dist/docs/3.examples/0.index/index.md +3 -0
  122. package/dist/docs/3.examples/1.api-routes.md +145 -0
  123. package/dist/docs/3.examples/10.hono.md +74 -0
  124. package/dist/docs/3.examples/11.import-alias.md +97 -0
  125. package/dist/docs/3.examples/12.middleware.md +91 -0
  126. package/dist/docs/3.examples/13.mono-jsx.md +68 -0
  127. package/dist/docs/3.examples/14.nano-jsx.md +70 -0
  128. package/dist/docs/3.examples/15.plugins.md +91 -0
  129. package/dist/docs/3.examples/16.renderer.md +113 -0
  130. package/dist/docs/3.examples/17.runtime-config.md +97 -0
  131. package/dist/docs/3.examples/18.server-fetch.md +87 -0
  132. package/dist/docs/3.examples/19.shiki.md +198 -0
  133. package/dist/docs/3.examples/2.auto-imports.md +92 -0
  134. package/dist/docs/3.examples/20.virtual-routes.md +74 -0
  135. package/dist/docs/3.examples/21.vite-nitro-plugin.md +79 -0
  136. package/dist/docs/3.examples/22.vite-rsc.md +1041 -0
  137. package/dist/docs/3.examples/23.vite-ssr-html.md +217 -0
  138. package/dist/docs/3.examples/24.vite-ssr-preact.md +247 -0
  139. package/dist/docs/3.examples/25.vite-ssr-react.md +226 -0
  140. package/dist/docs/3.examples/26.vite-ssr-solid.md +256 -0
  141. package/dist/docs/3.examples/27.vite-ssr-tsr-react.md +442 -0
  142. package/dist/docs/3.examples/28.vite-ssr-tss-react.md +444 -0
  143. package/dist/docs/3.examples/29.vite-ssr-vue-router.md +617 -0
  144. package/dist/docs/3.examples/3.cached-handler.md +81 -0
  145. package/dist/docs/3.examples/30.vite-trpc.md +335 -0
  146. package/dist/docs/3.examples/31.websocket.md +282 -0
  147. package/dist/docs/3.examples/4.custom-error-handler.md +98 -0
  148. package/dist/docs/3.examples/5.database.md +157 -0
  149. package/dist/docs/3.examples/6.elysia.md +70 -0
  150. package/dist/docs/3.examples/7.express.md +78 -0
  151. package/dist/docs/3.examples/8.fastify.md +79 -0
  152. package/dist/docs/3.examples/9.hello-world.md +68 -0
  153. package/dist/docs/README.md +86 -0
  154. package/dist/docs/index.md +121 -0
  155. package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +8 -0
  156. package/dist/node_modules/@poppinss/dumper/package.json +1 -1
  157. package/dist/node_modules/@speed-highlight/core/dist/index.js +4 -4
  158. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -2
  159. package/dist/node_modules/@speed-highlight/core/package.json +1 -1
  160. package/dist/node_modules/cookie-es/dist/index.mjs +299 -250
  161. package/dist/node_modules/cookie-es/package.json +26 -23
  162. package/dist/node_modules/croner/dist/croner.js +1 -1
  163. package/dist/node_modules/croner/package.json +11 -1
  164. package/dist/node_modules/defu/dist/defu.mjs +2 -2
  165. package/dist/node_modules/defu/package.json +33 -28
  166. package/dist/node_modules/rendu/dist/_chunks/libs/cookie-es.mjs +151 -0
  167. package/dist/node_modules/rendu/dist/index.mjs +5 -112
  168. package/dist/node_modules/rendu/package.json +25 -24
  169. package/dist/node_modules/youch/build/helpers-B9BQYaS6.js +23 -0
  170. package/dist/node_modules/youch/build/index.js +204 -351
  171. package/dist/node_modules/youch/build/public/error_info/script.js +1 -1
  172. package/dist/node_modules/youch/build/public_dir-C5bujZKB.js +25 -0
  173. package/dist/node_modules/youch/build/src/templates/error_cause/main.js +44 -0
  174. package/dist/node_modules/youch/build/src/templates/error_info/main.js +72 -0
  175. package/dist/node_modules/youch/build/src/templates/error_metadata/main.js +65 -0
  176. package/dist/node_modules/youch/build/src/templates/error_stack/main.js +152 -0
  177. package/dist/node_modules/youch/build/src/templates/error_stack_source/main.js +46 -0
  178. package/dist/node_modules/youch/build/src/templates/header/main.js +24 -0
  179. package/dist/node_modules/youch/build/src/templates/layout/main.js +27 -0
  180. package/dist/node_modules/youch/package.json +35 -32
  181. package/dist/presets/_nitro/runtime/nitro-dev.mjs +12 -57
  182. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +1 -0
  183. package/dist/presets/_nitro/runtime/service-worker.mjs +1 -2
  184. package/dist/presets/aws-lambda/runtime/_utils.mjs +6 -6
  185. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +3 -1
  186. package/dist/presets/azure/runtime/_utils.mjs +5 -5
  187. package/dist/presets/azure/runtime/azure-swa.mjs +5 -5
  188. package/dist/presets/bun/runtime/bun.mjs +9 -6
  189. package/dist/presets/cloudflare/runtime/_module-handler.mjs +1 -1
  190. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +4 -4
  191. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +3 -3
  192. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +2 -2
  193. package/dist/presets/cloudflare/runtime/plugin.dev.mjs +10 -21
  194. package/dist/presets/deno/runtime/deno-deploy.mjs +4 -4
  195. package/dist/presets/deno/runtime/deno-server.mjs +9 -6
  196. package/dist/presets/edgeone/runtime/edgeone.mjs +10 -0
  197. package/dist/presets/netlify/runtime/netlify-edge.mjs +2 -3
  198. package/dist/presets/netlify/runtime/netlify.mjs +1 -1
  199. package/dist/presets/node/runtime/node-cluster.mjs +5 -4
  200. package/dist/presets/node/runtime/node-middleware.mjs +1 -1
  201. package/dist/presets/node/runtime/node-server.mjs +8 -5
  202. package/dist/presets/stormkit/runtime/stormkit.mjs +1 -2
  203. package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
  204. package/dist/presets/vercel/runtime/queue-handler.mjs +21 -0
  205. package/dist/presets/vercel/runtime/vercel.node.mjs +3 -3
  206. package/dist/presets/vercel/runtime/vercel.web.mjs +3 -5
  207. package/dist/presets/winterjs/runtime/winterjs.mjs +10 -10
  208. package/dist/presets/zephyr/runtime/server.mjs +3 -0
  209. package/dist/runtime/internal/app.mjs +12 -11
  210. package/dist/runtime/internal/cache.d.mts +0 -4
  211. package/dist/runtime/internal/cache.mjs +32 -256
  212. package/dist/runtime/internal/context.d.mts +3 -1
  213. package/dist/runtime/internal/context.mjs +1 -9
  214. package/dist/runtime/internal/error/dev.d.mts +5 -4
  215. package/dist/runtime/internal/error/dev.mjs +47 -49
  216. package/dist/runtime/internal/error/hooks.d.mts +1 -1
  217. package/dist/runtime/internal/error/prod.d.mts +2 -5
  218. package/dist/runtime/internal/error/prod.mjs +19 -33
  219. package/dist/runtime/internal/error/utils.d.mts +4 -4
  220. package/dist/runtime/internal/meta.d.mts +1 -1
  221. package/dist/runtime/internal/plugin.d.mts +2 -2
  222. package/dist/runtime/internal/route-rules.d.mts +11 -4
  223. package/dist/runtime/internal/route-rules.mjs +15 -5
  224. package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -2
  225. package/dist/runtime/internal/routes/dev-tasks.mjs +15 -10
  226. package/dist/runtime/internal/routes/openapi.mjs +2 -2
  227. package/dist/runtime/internal/routes/renderer-template.d.mts +1 -1
  228. package/dist/runtime/internal/routes/renderer-template.dev.d.mts +2 -1
  229. package/dist/runtime/internal/routes/scalar.mjs +3 -3
  230. package/dist/runtime/internal/routes/swagger.mjs +7 -4
  231. package/dist/runtime/internal/runtime-config.d.mts +1 -1
  232. package/dist/runtime/internal/runtime-config.mjs +2 -2
  233. package/dist/runtime/internal/static.mjs +5 -4
  234. package/dist/runtime/internal/task.d.mts +3 -1
  235. package/dist/runtime/internal/task.mjs +7 -7
  236. package/dist/runtime/internal/vite/dev-entry.mjs +6 -3
  237. package/dist/runtime/internal/vite/dev-worker.mjs +264 -0
  238. package/dist/runtime/meta.d.mts +1 -0
  239. package/dist/runtime/meta.mjs +2 -0
  240. package/dist/runtime/nitro.d.mts +2 -0
  241. package/dist/runtime/nitro.mjs +4 -2
  242. package/dist/runtime/virtual/error-handler.mjs +1 -1
  243. package/dist/runtime/virtual/renderer-template.mjs +1 -1
  244. package/dist/runtime/virtual/server-assets.d.mts +2 -1
  245. package/dist/runtime/virtual/tracing.d.mts +5 -0
  246. package/dist/runtime/virtual/tracing.mjs +1 -0
  247. package/dist/runtime/vite.d.mts +1 -1
  248. package/dist/types/index.d.mts +215 -195
  249. package/dist/types/index.mjs +1 -11
  250. package/dist/vite.d.mts +3 -8
  251. package/dist/vite.mjs +285 -253
  252. package/lib/tsconfig.json +3 -5
  253. package/package.json +97 -80
  254. package/dist/_libs/confbox.mjs +0 -2509
  255. package/dist/_libs/nypm+giget+tinyexec.mjs +0 -3603
  256. package/dist/_libs/rc9+c12+dotenv.mjs +0 -972
  257. package/dist/node_modules/hookable/dist/index.mjs +0 -266
  258. package/dist/node_modules/hookable/package.json +0 -52
  259. package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +0 -42
  260. package/dist/node_modules/youch/build/chunk-7QV3D5YX.js +0 -83
  261. package/dist/node_modules/youch/build/chunk-AUGPHE32.js +0 -39
  262. package/dist/node_modules/youch/build/chunk-CM7DWJNZ.js +0 -44
  263. package/dist/node_modules/youch/build/chunk-EJH674NB.js +0 -223
  264. package/dist/node_modules/youch/build/chunk-OIJ3WD7L.js +0 -81
  265. package/dist/node_modules/youch/build/chunk-P36L72PL.js +0 -87
  266. package/dist/node_modules/youch/build/chunk-PE3GG3TN.js +0 -65
  267. package/dist/node_modules/youch/build/chunk-X53OIOJH.js +0 -70
  268. package/dist/presets/_nitro/runtime/nitro-dev.d.mts +0 -2
  269. package/dist/presets/_nitro/runtime/nitro-prerenderer.d.mts +0 -3
  270. package/dist/presets/_nitro/runtime/service-worker.d.mts +0 -2
  271. package/dist/presets/aws-amplify/runtime/aws-amplify.d.mts +0 -2
  272. package/dist/presets/aws-lambda/runtime/_utils.d.mts +0 -8
  273. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +0 -2
  274. package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +0 -3
  275. package/dist/presets/azure/runtime/_utils.d.mts +0 -2
  276. package/dist/presets/azure/runtime/azure-swa.d.mts +0 -5
  277. package/dist/presets/bun/runtime/bun.d.mts +0 -3
  278. package/dist/presets/cloudflare/runtime/_module-handler.d.mts +0 -16
  279. package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +0 -11
  280. package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +0 -3
  281. package/dist/presets/cloudflare/runtime/cloudflare-pages.d.mts +0 -20
  282. package/dist/presets/cloudflare/runtime/plugin.dev.d.mts +0 -3
  283. package/dist/presets/deno/runtime/deno-deploy.d.mts +0 -5
  284. package/dist/presets/deno/runtime/deno-server.d.mts +0 -3
  285. package/dist/presets/netlify/runtime/netlify-edge.d.mts +0 -3
  286. package/dist/presets/netlify/runtime/netlify.d.mts +0 -4
  287. package/dist/presets/node/runtime/node-cluster.d.mts +0 -3
  288. package/dist/presets/node/runtime/node-middleware.d.mts +0 -3
  289. package/dist/presets/node/runtime/node-server.d.mts +0 -3
  290. package/dist/presets/standard/runtime/server.d.mts +0 -3
  291. package/dist/presets/stormkit/runtime/stormkit.d.mts +0 -21
  292. package/dist/presets/vercel/runtime/isr.d.mts +0 -2
  293. package/dist/presets/vercel/runtime/vercel.node.d.mts +0 -3
  294. package/dist/presets/vercel/runtime/vercel.web.d.mts +0 -8
  295. package/dist/presets/winterjs/runtime/winterjs.d.mts +0 -2
  296. package/dist/presets/zeabur/runtime/zeabur.d.mts +0 -3
  297. package/dist/runtime/internal/vite/node-runner.mjs +0 -359
@@ -1,10 +1,35 @@
1
1
  import { Stats } from "node:fs";
2
- import { Jiti, JitiOptions } from "jiti";
3
2
  import { EventEmitter } from "node:events";
4
3
  import { Readable } from "node:stream";
5
- import { diff } from "ohash/utils";
6
-
7
- //#region node_modules/.pnpm/chokidar@5.0.0/node_modules/chokidar/index.d.ts
4
+ import { DownloadTemplateOptions } from "giget";
5
+ //#region node_modules/.pnpm/ohash@2.0.11/node_modules/ohash/dist/utils/index.d.mts
6
+ /**
7
+ * Calculates the difference between two objects and returns a list of differences.
8
+ *
9
+ * @param {any} obj1 - The first object to compare.
10
+ * @param {any} obj2 - The second object to compare.
11
+ * @param {HashOptions} [opts={}] - Configuration options for hashing the objects. See {@link HashOptions}.
12
+ * @returns {DiffEntry[]} An array with the differences between the two objects.
13
+ */
14
+ declare function diff(obj1: any, obj2: any): DiffEntry[];
15
+ declare class DiffEntry {
16
+ key: string;
17
+ type: "changed" | "added" | "removed";
18
+ newValue: DiffHashedObject;
19
+ oldValue?: DiffHashedObject | undefined;
20
+ constructor(key: string, type: "changed" | "added" | "removed", newValue: DiffHashedObject, oldValue?: DiffHashedObject | undefined);
21
+ toString(): string;
22
+ toJSON(): string;
23
+ }
24
+ declare class DiffHashedObject {
25
+ key: string;
26
+ value: any;
27
+ hash?: string | undefined;
28
+ props?: Record<string, DiffHashedObject> | undefined;
29
+ constructor(key: string, value: any, hash?: string | undefined, props?: Record<string, DiffHashedObject> | undefined);
30
+ toString(): string;
31
+ toJSON(): string;
32
+ } //#endregion
8
33
  type AWF = {
9
34
  stabilityThreshold: number;
10
35
  pollInterval: number;
@@ -32,39 +57,6 @@ interface MatcherObject {
32
57
  recursive?: boolean;
33
58
  }
34
59
  type Matcher = string | RegExp | MatchFunction | MatcherObject;
35
- //#endregion
36
- //#region node_modules/.pnpm/giget@2.0.0/node_modules/giget/dist/index.d.mts
37
- interface TemplateInfo {
38
- name: string;
39
- tar: string;
40
- version?: string;
41
- subdir?: string;
42
- url?: string;
43
- defaultDir?: string;
44
- headers?: Record<string, string | undefined>;
45
- source?: never;
46
- dir?: never;
47
- [key: string]: any;
48
- }
49
- type TemplateProvider = (input: string, options: {
50
- auth?: string;
51
- }) => TemplateInfo | Promise<TemplateInfo> | null;
52
- interface DownloadTemplateOptions {
53
- provider?: string;
54
- force?: boolean;
55
- forceClean?: boolean;
56
- offline?: boolean;
57
- preferOffline?: boolean;
58
- providers?: Record<string, TemplateProvider>;
59
- dir?: string;
60
- registry?: false | string;
61
- cwd?: string;
62
- auth?: string;
63
- install?: boolean;
64
- silent?: boolean;
65
- }
66
- //#endregion
67
- //#region node_modules/.pnpm/c12@3.3.3_magicast@0.5.1/node_modules/c12/dist/index.d.mts
68
60
  //#region src/dotenv.d.ts
69
61
  interface DotenvOptions {
70
62
  /**
@@ -94,6 +86,22 @@ interface DotenvOptions {
94
86
  * An object describing environment variables (key, value pairs).
95
87
  */
96
88
  env?: NodeJS.ProcessEnv;
89
+ /**
90
+ * Resolve `_FILE` suffixed environment variables by reading the file at the
91
+ * specified path and assigning its trimmed content to the base key.
92
+ *
93
+ * This is useful for container secrets (e.g. Docker, Kubernetes) where
94
+ * sensitive values are mounted as files.
95
+ *
96
+ * @default false
97
+ *
98
+ * @example
99
+ * ```env
100
+ * DATABASE_PASSWORD_FILE="/run/secrets/db_password"
101
+ * # resolves to DATABASE_PASSWORD=<contents of /run/secrets/db_password>
102
+ * ```
103
+ */
104
+ expandFileReferences?: boolean;
97
105
  }
98
106
  declare global {
99
107
  var __c12_dotenv_vars__: Map<Record<string, any>, Set<string>>;
@@ -176,8 +184,10 @@ interface LoadConfigOptions<T extends UserInputConfig = UserInputConfig, MT exte
176
184
  /** Context passed to config functions */
177
185
  context?: ConfigFunctionContext;
178
186
  resolve?: (id: string, options: LoadConfigOptions<T, MT>) => null | undefined | ResolvedConfig<T, MT> | Promise<ResolvedConfig<T, MT> | undefined | null>;
179
- jiti?: Jiti;
180
- jitiOptions?: JitiOptions;
187
+ /** Custom import function used to load configuration files */
188
+ import?: (id: string) => Promise<unknown>;
189
+ /** Custom resolver for picking which export to use from the loaded module. Default: `(mod) => mod.default || mod` */
190
+ resolveModule?: (mod: any) => any;
181
191
  giget?: false | DownloadTemplateOptions;
182
192
  merger?: (...sources: Array<T | null | undefined>) => T;
183
193
  extend?: false | {
@@ -210,5 +220,4 @@ interface WatchConfigOptions<T extends UserInputConfig = UserInputConfig, MT ext
210
220
  oldConfig: ResolvedConfig<T, MT>;
211
221
  }) => void | Promise<void>;
212
222
  }
213
- //#endregion
214
223
  export { WatchConfigOptions as a, ResolvedConfig as i, ConfigWatcher as n, ChokidarOptions as o, DotenvOptions as r, C12InputConfig as t };
@@ -1,6 +1,4 @@
1
1
  import { parseArgs } from "node:util";
2
-
3
- //#region node_modules/.pnpm/citty@0.2.0/node_modules/citty/dist/_chunks/libs/scule.mjs
4
2
  const NUMBER_CHAR_RE = /\d/;
5
3
  const STR_SPLITTERS = [
6
4
  "-",
@@ -65,9 +63,9 @@ function camelCase(str, opts) {
65
63
  function kebabCase(str, joiner) {
66
64
  return str ? (Array.isArray(str) ? str : splitByCase(str)).map((p) => p.toLowerCase()).join(joiner ?? "-") : "";
67
65
  }
68
-
69
- //#endregion
70
- //#region node_modules/.pnpm/citty@0.2.0/node_modules/citty/dist/index.mjs
66
+ function snakeCase(str) {
67
+ return kebabCase(str || "", "_");
68
+ }
71
69
  function toArray(val) {
72
70
  if (Array.isArray(val)) return val;
73
71
  return val === void 0 ? [] : [val];
@@ -113,6 +111,12 @@ function parseRawArgs(args = [], opts = {}) {
113
111
  for (const alias of aliases) if (booleans.has(alias)) return "boolean";
114
112
  return "string";
115
113
  }
114
+ function isStringType(name) {
115
+ if (strings.has(name)) return true;
116
+ const aliases = mainToAliases.get(name) || [];
117
+ for (const alias of aliases) if (strings.has(alias)) return true;
118
+ return false;
119
+ }
116
120
  const allOptions = new Set([
117
121
  ...booleans,
118
122
  ...strings,
@@ -156,11 +160,23 @@ function parseRawArgs(args = [], opts = {}) {
156
160
  }
157
161
  const out = { _: [] };
158
162
  out._ = parsed.positionals;
159
- for (const [key, value] of Object.entries(parsed.values)) out[key] = value;
160
- for (const [name] of Object.entries(negatedFlags)) out[name] = false;
163
+ for (const [key, value] of Object.entries(parsed.values)) {
164
+ let coerced = value;
165
+ if (getType(key) === "boolean" && typeof value === "string") coerced = value !== "false";
166
+ else if (isStringType(key) && typeof value === "boolean") coerced = "";
167
+ out[key] = coerced;
168
+ }
169
+ for (const [name] of Object.entries(negatedFlags)) {
170
+ out[name] = false;
171
+ const mainName = aliasToMain.get(name);
172
+ if (mainName) out[mainName] = false;
173
+ const aliases = mainToAliases.get(name);
174
+ if (aliases) for (const alias of aliases) out[alias] = false;
175
+ }
161
176
  for (const [alias, main] of aliasToMain.entries()) {
162
177
  if (out[alias] !== void 0 && out[main] === void 0) out[main] = out[alias];
163
178
  if (out[main] !== void 0 && out[alias] === void 0) out[alias] = out[main];
179
+ if (out[alias] !== out[main] && defaults[main] === out[main]) out[main] = out[alias];
164
180
  }
165
181
  return out;
166
182
  }
@@ -222,6 +238,9 @@ function resolveArgs(argsDef) {
222
238
  });
223
239
  return args;
224
240
  }
241
+ async function resolvePlugins(plugins) {
242
+ return Promise.all(plugins.map((p) => resolveValue(p)));
243
+ }
225
244
  function defineCommand(def) {
226
245
  return def;
227
246
  }
@@ -234,35 +253,92 @@ async function runCommand(cmd, opts) {
234
253
  data: opts.data,
235
254
  cmd
236
255
  };
237
- if (typeof cmd.setup === "function") await cmd.setup(context);
256
+ const plugins = await resolvePlugins(cmd.plugins ?? []);
238
257
  let result;
258
+ let runError;
239
259
  try {
260
+ for (const plugin of plugins) await plugin.setup?.(context);
261
+ if (typeof cmd.setup === "function") await cmd.setup(context);
240
262
  const subCommands = await resolveValue(cmd.subCommands);
241
263
  if (subCommands && Object.keys(subCommands).length > 0) {
242
- const subCommandArgIndex = opts.rawArgs.findIndex((arg) => !arg.startsWith("-"));
243
- const subCommandName = opts.rawArgs[subCommandArgIndex];
244
- if (subCommandName) {
245
- if (!subCommands[subCommandName]) throw new CLIError(`Unknown command ${cyan(subCommandName)}`, "E_UNKNOWN_COMMAND");
246
- const subCommand = await resolveValue(subCommands[subCommandName]);
247
- if (subCommand) await runCommand(subCommand, { rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1) });
248
- } else if (!cmd.run) throw new CLIError(`No command specified.`, "E_NO_COMMAND");
264
+ const subCommandArgIndex = findSubCommandIndex(opts.rawArgs, cmdArgs);
265
+ const explicitName = opts.rawArgs[subCommandArgIndex];
266
+ if (explicitName) {
267
+ const subCommand = await _findSubCommand(subCommands, explicitName);
268
+ if (!subCommand) throw new CLIError(`Unknown command ${cyan(explicitName)}`, "E_UNKNOWN_COMMAND");
269
+ await runCommand(subCommand, { rawArgs: opts.rawArgs.slice(subCommandArgIndex + 1) });
270
+ } else {
271
+ const defaultSubCommand = await resolveValue(cmd.default);
272
+ if (defaultSubCommand) {
273
+ if (cmd.run) throw new CLIError(`Cannot specify both 'run' and 'default' on the same command.`, "E_DEFAULT_CONFLICT");
274
+ const subCommand = await _findSubCommand(subCommands, defaultSubCommand);
275
+ if (!subCommand) throw new CLIError(`Default sub command ${cyan(defaultSubCommand)} not found in subCommands.`, "E_UNKNOWN_COMMAND");
276
+ await runCommand(subCommand, { rawArgs: opts.rawArgs });
277
+ } else if (!cmd.run) throw new CLIError(`No command specified.`, "E_NO_COMMAND");
278
+ }
249
279
  }
250
280
  if (typeof cmd.run === "function") result = await cmd.run(context);
251
- } finally {
252
- if (typeof cmd.cleanup === "function") await cmd.cleanup(context);
281
+ } catch (error) {
282
+ runError = error;
283
+ }
284
+ const cleanupErrors = [];
285
+ if (typeof cmd.cleanup === "function") try {
286
+ await cmd.cleanup(context);
287
+ } catch (error) {
288
+ cleanupErrors.push(error);
253
289
  }
290
+ for (const plugin of [...plugins].reverse()) try {
291
+ await plugin.cleanup?.(context);
292
+ } catch (error) {
293
+ cleanupErrors.push(error);
294
+ }
295
+ if (runError) throw runError;
296
+ if (cleanupErrors.length === 1) throw cleanupErrors[0];
297
+ if (cleanupErrors.length > 1) throw new Error("Multiple cleanup errors", { cause: cleanupErrors });
254
298
  return { result };
255
299
  }
256
300
  async function resolveSubCommand(cmd, rawArgs, parent) {
257
301
  const subCommands = await resolveValue(cmd.subCommands);
258
302
  if (subCommands && Object.keys(subCommands).length > 0) {
259
- const subCommandArgIndex = rawArgs.findIndex((arg) => !arg.startsWith("-"));
303
+ const subCommandArgIndex = findSubCommandIndex(rawArgs, await resolveValue(cmd.args || {}));
260
304
  const subCommandName = rawArgs[subCommandArgIndex];
261
- const subCommand = await resolveValue(subCommands[subCommandName]);
305
+ const subCommand = await _findSubCommand(subCommands, subCommandName);
262
306
  if (subCommand) return resolveSubCommand(subCommand, rawArgs.slice(subCommandArgIndex + 1), cmd);
263
307
  }
264
308
  return [cmd, parent];
265
309
  }
310
+ async function _findSubCommand(subCommands, name) {
311
+ if (name in subCommands) return resolveValue(subCommands[name]);
312
+ for (const sub of Object.values(subCommands)) {
313
+ const resolved = await resolveValue(sub);
314
+ const meta = await resolveValue(resolved?.meta);
315
+ if (meta?.alias) {
316
+ if (toArray(meta.alias).includes(name)) return resolved;
317
+ }
318
+ }
319
+ }
320
+ function findSubCommandIndex(rawArgs, argsDef) {
321
+ for (let i = 0; i < rawArgs.length; i++) {
322
+ const arg = rawArgs[i];
323
+ if (arg === "--") return -1;
324
+ if (arg.startsWith("-")) {
325
+ if (!arg.includes("=") && _isValueFlag(arg, argsDef)) i++;
326
+ continue;
327
+ }
328
+ return i;
329
+ }
330
+ return -1;
331
+ }
332
+ function _isValueFlag(flag, argsDef) {
333
+ const name = flag.replace(/^-{1,2}/, "");
334
+ const normalized = camelCase(name);
335
+ for (const [key, def] of Object.entries(argsDef)) {
336
+ if (def.type !== "string" && def.type !== "enum") continue;
337
+ if (normalized === camelCase(key)) return true;
338
+ if ((Array.isArray(def.alias) ? def.alias : def.alias ? [def.alias] : []).includes(name)) return true;
339
+ }
340
+ return false;
341
+ }
266
342
  async function showUsage(cmd, parent) {
267
343
  try {
268
344
  console.log(await renderUsage(cmd, parent) + "\n");
@@ -283,27 +359,17 @@ async function renderUsage(cmd, parent) {
283
359
  for (const arg of cmdArgs) if (arg.type === "positional") {
284
360
  const name = arg.name.toUpperCase();
285
361
  const isRequired = arg.required !== false && arg.default === void 0;
286
- const defaultHint = arg.default ? `="${arg.default}"` : "";
287
- posLines.push([
288
- cyan(name + defaultHint),
289
- arg.description || "",
290
- arg.valueHint ? `<${arg.valueHint}>` : ""
291
- ]);
362
+ posLines.push([cyan(name + renderValueHint(arg)), renderDescription(arg, isRequired)]);
292
363
  usageLine.push(isRequired ? `<${name}>` : `[${name}]`);
293
364
  } else {
294
365
  const isRequired = arg.required === true && arg.default === void 0;
295
- 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("|")}>` : "");
296
- argLines.push([cyan(argStr + (isRequired ? " (required)" : "")), arg.description || ""]);
297
- /**
298
- * print negative boolean arg variant usage when
299
- * - enabled by default or has `negativeDescription`
300
- * - not prefixed with `no-` or `no[A-Z]`
301
- */
366
+ const argStr = [...(arg.alias || []).map((a) => `-${a}`), `--${arg.name}`].join(", ") + renderValueHint(arg);
367
+ argLines.push([cyan(argStr), renderDescription(arg, isRequired)]);
302
368
  if (arg.type === "boolean" && (arg.default === true || arg.negativeDescription) && !negativePrefixRe.test(arg.name)) {
303
369
  const negativeArgStr = [...(arg.alias || []).map((a) => `--no-${a}`), `--no-${arg.name}`].join(", ");
304
- argLines.push([cyan(negativeArgStr + (isRequired ? " (required)" : "")), arg.negativeDescription || ""]);
370
+ argLines.push([cyan(negativeArgStr), [arg.negativeDescription, isRequired ? gray("(Required)") : ""].filter(Boolean).join(" ")]);
305
371
  }
306
- if (isRequired) usageLine.push(argStr);
372
+ if (isRequired) usageLine.push(`--${arg.name}` + renderValueHint(arg));
307
373
  }
308
374
  if (cmd.subCommands) {
309
375
  const commandNames = [];
@@ -311,8 +377,10 @@ async function renderUsage(cmd, parent) {
311
377
  for (const [name, sub] of Object.entries(subCommands)) {
312
378
  const meta = await resolveValue((await resolveValue(sub))?.meta);
313
379
  if (meta?.hidden) continue;
314
- commandsLines.push([cyan(name), meta?.description || ""]);
315
- commandNames.push(name);
380
+ const aliases = toArray(meta?.alias);
381
+ const label = [name, ...aliases].join(", ");
382
+ commandsLines.push([cyan(label), meta?.description || ""]);
383
+ commandNames.push(name, ...aliases);
316
384
  }
317
385
  usageLine.push(commandNames.join("|"));
318
386
  }
@@ -338,14 +406,31 @@ async function renderUsage(cmd, parent) {
338
406
  }
339
407
  return usageLines.filter((l) => typeof l === "string").join("\n");
340
408
  }
409
+ function renderValueHint(arg) {
410
+ const valueHint = arg.valueHint ? `=<${arg.valueHint}>` : "";
411
+ const fallbackValueHint = valueHint || `=<${snakeCase(arg.name)}>`;
412
+ if (!arg.type || arg.type === "positional" || arg.type === "boolean") return valueHint;
413
+ if (arg.type === "enum" && arg.options?.length) return `=<${arg.options.join("|")}>`;
414
+ return fallbackValueHint;
415
+ }
416
+ function renderDescription(arg, required) {
417
+ const requiredHint = required ? gray("(Required)") : "";
418
+ const defaultHint = arg.default === void 0 ? "" : gray(`(Default: ${arg.default})`);
419
+ return [
420
+ arg.description,
421
+ requiredHint,
422
+ defaultHint
423
+ ].filter(Boolean).join(" ");
424
+ }
341
425
  async function runMain(cmd, opts = {}) {
342
426
  const rawArgs = opts.rawArgs || process.argv.slice(2);
343
427
  const showUsage$1 = opts.showUsage || showUsage;
344
428
  try {
345
- if (rawArgs.includes("--help") || rawArgs.includes("-h")) {
429
+ const builtinFlags = await _resolveBuiltinFlags(cmd);
430
+ if (builtinFlags.help.length > 0 && rawArgs.some((arg) => builtinFlags.help.includes(arg))) {
346
431
  await showUsage$1(...await resolveSubCommand(cmd, rawArgs));
347
432
  process.exit(0);
348
- } else if (rawArgs.length === 1 && rawArgs[0] === "--version") {
433
+ } else if (rawArgs.length === 1 && builtinFlags.version.includes(rawArgs[0])) {
349
434
  const meta = typeof cmd.meta === "function" ? await cmd.meta() : await cmd.meta;
350
435
  if (!meta?.version) throw new CLIError("No version specified", "E_NO_VERSION");
351
436
  console.log(meta.version);
@@ -358,6 +443,22 @@ async function runMain(cmd, opts = {}) {
358
443
  process.exit(1);
359
444
  }
360
445
  }
361
-
362
- //#endregion
363
- export { runMain as n, defineCommand as t };
446
+ async function _resolveBuiltinFlags(cmd) {
447
+ const argsDef = await resolveValue(cmd.args || {});
448
+ const userNames = /* @__PURE__ */ new Set();
449
+ const userAliases = /* @__PURE__ */ new Set();
450
+ for (const [name, def] of Object.entries(argsDef)) {
451
+ userNames.add(name);
452
+ for (const alias of toArray(def.alias)) userAliases.add(alias);
453
+ }
454
+ return {
455
+ help: _getBuiltinFlags("help", "h", userNames, userAliases),
456
+ version: _getBuiltinFlags("version", "v", userNames, userAliases)
457
+ };
458
+ }
459
+ function _getBuiltinFlags(long, short, userNames, userAliases) {
460
+ if (userNames.has(long) || userAliases.has(long)) return [];
461
+ if (userNames.has(short) || userAliases.has(short)) return [`--${long}`];
462
+ return [`--${long}`, `-${short}`];
463
+ }
464
+ export { runMain as n, defineCommand as t };
@@ -1,10 +1,8 @@
1
1
  import { i as __toESM, r as __require, t as __commonJSMin } from "../_common.mjs";
2
- import { F as Builder, S as MagicString, c as walk, i as createFilter, o as extractAssignedNames, r as attachScopes, s as makeLegalIdentifier } from "../_build/common.mjs";
2
+ import { P as Builder, S as MagicString, c as walk, i as createFilter, o as extractAssignedNames, r as attachScopes, s as makeLegalIdentifier } from "../_build/common.mjs";
3
3
  import { existsSync, readFileSync, statSync } from "fs";
4
4
  import { basename, dirname, extname, join, relative, resolve, sep } from "path";
5
-
6
- //#region node_modules/.pnpm/commondir@1.0.1/node_modules/commondir/index.js
7
- var require_commondir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
5
+ var import_commondir = /* @__PURE__ */ __toESM((/* @__PURE__ */ __commonJSMin(((exports, module) => {
8
6
  var path$1 = __require("path");
9
7
  module.exports = function(basedir, relfiles) {
10
8
  if (relfiles) var files = relfiles.map(function(r) {
@@ -19,43 +17,27 @@ var require_commondir = /* @__PURE__ */ __commonJSMin(((exports, module) => {
19
17
  }, files[0].split(/\/+|\\+/));
20
18
  return res.length > 1 ? res.join("/") : "/";
21
19
  };
22
- }));
23
-
24
- //#endregion
25
- //#region node_modules/.pnpm/is-reference@1.2.1/node_modules/is-reference/dist/is-reference.js
26
- var require_is_reference = /* @__PURE__ */ __commonJSMin(((exports, module) => {
27
- (function(global, factory) {
28
- typeof exports === "object" && typeof module !== "undefined" ? module.exports = factory() : typeof define === "function" && define.amd ? define(factory) : (global = global || self, global.isReference = factory());
29
- })(exports, (function() {
30
- "use strict";
31
- function isReference$1(node, parent) {
32
- if (node.type === "MemberExpression") return !node.computed && isReference$1(node.object, node);
33
- if (node.type === "Identifier") {
34
- if (!parent) return true;
35
- switch (parent.type) {
36
- case "MemberExpression": return parent.computed || node === parent.object;
37
- case "MethodDefinition": return parent.computed;
38
- case "FieldDefinition": return parent.computed || node === parent.value;
39
- case "Property": return parent.computed || node === parent.value;
40
- case "ExportSpecifier":
41
- case "ImportSpecifier": return node === parent.local;
42
- case "LabeledStatement":
43
- case "BreakStatement":
44
- case "ContinueStatement": return false;
45
- default: return true;
46
- }
47
- }
48
- return false;
20
+ })))(), 1);
21
+ function isReference(node, parent) {
22
+ if (node.type === "MemberExpression") return !node.computed && isReference(node.object, node);
23
+ if (node.type === "Identifier") {
24
+ if (!parent) return true;
25
+ switch (parent.type) {
26
+ case "MemberExpression": return parent.computed || node === parent.object;
27
+ case "MethodDefinition": return parent.computed;
28
+ case "FieldDefinition": return parent.computed || node === parent.value;
29
+ case "Property": return parent.computed || node === parent.value;
30
+ case "ExportSpecifier":
31
+ case "ImportSpecifier": return node === parent.local;
32
+ case "LabeledStatement":
33
+ case "BreakStatement":
34
+ case "ContinueStatement": return false;
35
+ default: return true;
49
36
  }
50
- return isReference$1;
51
- }));
52
- }));
53
-
54
- //#endregion
55
- //#region node_modules/.pnpm/@rollup+plugin-commonjs@29.0.0_rollup@4.55.3/node_modules/@rollup/plugin-commonjs/dist/es/index.js
56
- var import_commondir = /* @__PURE__ */ __toESM(require_commondir(), 1);
57
- var import_is_reference = /* @__PURE__ */ __toESM(require_is_reference(), 1);
58
- var version = "29.0.0";
37
+ }
38
+ return false;
39
+ }
40
+ var version = "29.0.1";
59
41
  var peerDependencies = { rollup: "^2.68.0||^3.0.0||^4.0.0" };
60
42
  function tryParse(parse, code, id) {
61
43
  try {
@@ -118,10 +100,10 @@ function getName(id) {
118
100
  if (name !== "index") return name;
119
101
  return makeLegalIdentifier(basename(dirname(id)));
120
102
  }
121
- function normalizePathSlashes(path$2) {
122
- return path$2.replace(/\\/g, "/");
103
+ function normalizePathSlashes(path) {
104
+ return path.replace(/\\/g, "/");
123
105
  }
124
- const getVirtualPathForDynamicRequirePath = (path$2, commonDir) => `/${normalizePathSlashes(relative(commonDir, path$2))}`;
106
+ const getVirtualPathForDynamicRequirePath = (path, commonDir) => `/${normalizePathSlashes(relative(commonDir, path))}`;
125
107
  function capitalize(name) {
126
108
  return name[0].toUpperCase() + name.slice(1);
127
109
  }
@@ -157,9 +139,9 @@ function getPackageEntryPoint(dirPath) {
157
139
  } catch (ignored) {}
158
140
  return entryPoint;
159
141
  }
160
- function isDirectory(path$2) {
142
+ function isDirectory(path) {
161
143
  try {
162
- if (statSync(path$2).isDirectory()) return true;
144
+ if (statSync(path).isDirectory()) return true;
163
145
  } catch (ignored) {}
164
146
  return false;
165
147
  }
@@ -169,12 +151,12 @@ function getDynamicRequireModules(patterns, dynamicRequireRoot) {
169
151
  for (const pattern of !patterns || Array.isArray(patterns) ? patterns || [] : [patterns]) {
170
152
  const isNegated = pattern.startsWith("!");
171
153
  const modifyMap = (targetPath, resolvedPath) => isNegated ? dynamicRequireModules.delete(targetPath) : dynamicRequireModules.set(targetPath, resolvedPath);
172
- for (const path$2 of new Builder().withBasePath().withDirs().glob(isNegated ? pattern.substr(1) : pattern).crawl(relative(".", dynamicRequireRoot)).sync().sort((a, b) => a.localeCompare(b, "en"))) {
173
- const resolvedPath = resolve(path$2);
154
+ for (const path of new Builder().withBasePath().withDirs().glob(isNegated ? pattern.substr(1) : pattern).crawl(relative(".", dynamicRequireRoot)).sync().sort((a, b) => a.localeCompare(b, "en"))) {
155
+ const resolvedPath = resolve(path);
174
156
  const requirePath = normalizePathSlashes(resolvedPath);
175
157
  if (isDirectory(resolvedPath)) {
176
158
  dirNames.add(resolvedPath);
177
- const modulePath = resolve(join(resolvedPath, getPackageEntryPoint(path$2)));
159
+ const modulePath = resolve(join(resolvedPath, getPackageEntryPoint(path)));
178
160
  modifyMap(requirePath, modulePath);
179
161
  modifyMap(normalizePathSlashes(modulePath), modulePath);
180
162
  } else {
@@ -606,14 +588,26 @@ function validateVersion(actualVersion, peerDependencyVersion, name) {
606
588
  const [major, minor, patch] = actualVersion.split(".").map(Number);
607
589
  if (major < minMajor || major === minMajor && (minor < minMinor || minor === minMinor && patch < minPatch)) throw new Error(`Insufficient ${name} version: "@rollup/plugin-commonjs" requires at least ${name}@${minMajor}.${minMinor}.${minPatch} but found ${name}@${actualVersion}.`);
608
590
  }
591
+ function triStateAnd(a, b) {
592
+ if (a === false) return false;
593
+ if (b === false) return false;
594
+ if (a === true && b === true) return true;
595
+ return null;
596
+ }
597
+ function triStateOr(a, b) {
598
+ if (a === true) return true;
599
+ if (b === true) return true;
600
+ if (a === false && b === false) return false;
601
+ return null;
602
+ }
609
603
  const operators = {
610
604
  "==": (x) => equals(x.left, x.right, false),
611
605
  "!=": (x) => not(operators["=="](x)),
612
606
  "===": (x) => equals(x.left, x.right, true),
613
607
  "!==": (x) => not(operators["==="](x)),
614
608
  "!": (x) => isFalsy(x.argument),
615
- "&&": (x) => isTruthy(x.left) && isTruthy(x.right),
616
- "||": (x) => isTruthy(x.left) || isTruthy(x.right)
609
+ "&&": (x) => triStateAnd(isTruthy(x.left), isTruthy(x.right)),
610
+ "||": (x) => triStateOr(isTruthy(x.left), isTruthy(x.right))
617
611
  };
618
612
  function not(value) {
619
613
  return value === null ? value : !value;
@@ -679,6 +673,9 @@ function getDefinePropertyCallName(node, targetName) {
679
673
  function isShorthandProperty(parent) {
680
674
  return parent && parent.type === "Property" && parent.shorthand;
681
675
  }
676
+ function isPropertyDefinitionKey(parent, node) {
677
+ return parent && parent.type === "PropertyDefinition" && parent.key === node;
678
+ }
682
679
  function wrapCode(magicString, uses, moduleName, exportsName, indentExclusionRanges) {
683
680
  const args = [];
684
681
  const passedArgs = [];
@@ -1018,7 +1015,7 @@ async function transformCommonjs(parse, code, id, isEsModule, ignoreGlobal, igno
1018
1015
  return;
1019
1016
  case "Identifier": {
1020
1017
  const { name } = node;
1021
- if (!(0, import_is_reference.default)(node, parent) || scope.contains(name) || parent.type === "PropertyDefinition" && parent.key === node) return;
1018
+ if (!isReference(node, parent) || scope.contains(name) || isPropertyDefinitionKey(parent, node)) return;
1022
1019
  switch (name) {
1023
1020
  case "require":
1024
1021
  uses.require = true;
@@ -1038,7 +1035,13 @@ async function transformCommonjs(parse, code, id, isEsModule, ignoreGlobal, igno
1038
1035
  return;
1039
1036
  case "global":
1040
1037
  uses.global = true;
1041
- if (!ignoreGlobal) replacedGlobal.push(node);
1038
+ if (!ignoreGlobal) {
1039
+ if (isShorthandProperty(parent)) {
1040
+ skippedNodes.add(parent.value);
1041
+ magicString.prependRight(node.start, "global: ");
1042
+ }
1043
+ replacedGlobal.push(node);
1044
+ }
1042
1045
  return;
1043
1046
  case "define":
1044
1047
  magicString.overwrite(node.start, node.end, "undefined", { storeName: true });
@@ -1108,7 +1111,10 @@ async function transformCommonjs(parse, code, id, isEsModule, ignoreGlobal, igno
1108
1111
  const dynamicRequireName = replacedDynamicRequires.length > 0 && deconflict([scope], globals, isDynamicRequireModulesEnabled ? CREATE_COMMONJS_REQUIRE_EXPORT : COMMONJS_REQUIRE_EXPORT);
1109
1112
  const deconflictedExportNames = Object.create(null);
1110
1113
  for (const [exportName, { scopes }] of exportsAssignmentsByName) deconflictedExportNames[exportName] = deconflict([...scopes], globals, exportName);
1111
- for (const node of replacedGlobal) magicString.overwrite(node.start, node.end, `${helpersName}.commonjsGlobal`, { storeName: true });
1114
+ for (const node of replacedGlobal) magicString.overwrite(node.start, node.end, `${helpersName}.commonjsGlobal`, {
1115
+ contentOnly: true,
1116
+ storeName: true
1117
+ });
1112
1118
  for (const node of replacedThis) magicString.overwrite(node.start, node.end, exportsName, { storeName: true });
1113
1119
  for (const node of replacedDynamicRequires) magicString.overwrite(node.start, node.end, isDynamicRequireModulesEnabled ? `${dynamicRequireName}(${JSON.stringify(virtualDynamicRequirePath)})` : dynamicRequireName, {
1114
1120
  contentOnly: true,
@@ -1295,6 +1301,4 @@ function commonjs(options = {}) {
1295
1301
  }
1296
1302
  };
1297
1303
  }
1298
-
1299
- //#endregion
1300
- export { commonjs as t };
1304
+ export { commonjs as t };
@@ -1,4 +1,3 @@
1
- //#region node_modules/.pnpm/compatx@0.2.0/node_modules/compatx/dist/index.d.mts
2
1
  /**
3
2
  * Known platform names
4
3
  */
@@ -43,5 +42,4 @@ type CompatibilityDateSpec = DateString | Partial<CompatibilityDates>;
43
42
  /**
44
43
  * Get compatibility updates applicable for the user given platform and date range.
45
44
  */
46
- //#endregion
47
45
  export { CompatibilityDates as n, DateString as r, CompatibilityDateSpec as t };
@@ -1,4 +1,3 @@
1
- //#region node_modules/.pnpm/compatx@0.2.0/node_modules/compatx/dist/index.mjs
2
1
  const platforms = [
3
2
  "aws",
4
3
  "azure",
@@ -41,6 +40,4 @@ function normalizeDate(date) {
41
40
  if (date === "latest") return /* @__PURE__ */ new Date();
42
41
  return new Date(date);
43
42
  }
44
-
45
- //#endregion
46
- export { resolveCompatibilityDates as n, resolveCompatibilityDatesFromEnv as r, formatCompatibilityDate as t };
43
+ export { resolveCompatibilityDates as n, resolveCompatibilityDatesFromEnv as r, formatCompatibilityDate as t };
@@ -1,4 +1,3 @@
1
- //#region node_modules/.pnpm/esbuild@0.27.2/node_modules/esbuild/lib/main.d.ts
2
1
  // Note: These declarations exist to avoid type errors when you omit "dom" from
3
2
  // "lib" in your "tsconfig.json" file. TypeScript confusingly declares the
4
3
  // global "WebAssembly" type in "lib.dom.d.ts" even though it has nothing to do
@@ -1,8 +1,5 @@
1
- //#region node_modules/.pnpm/escape-string-regexp@5.0.0/node_modules/escape-string-regexp/index.js
2
1
  function escapeStringRegexp(string) {
3
2
  if (typeof string !== "string") throw new TypeError("Expected a string");
4
3
  return string.replace(/[|\\{}()[\]^$+*?.]/g, "\\$&").replace(/-/g, "\\x2d");
5
4
  }
6
-
7
- //#endregion
8
- export { escapeStringRegexp as t };
5
+ export { escapeStringRegexp as t };
@@ -1,12 +1,8 @@
1
1
  import { Plugin } from "rollup";
2
-
3
- //#region node_modules/.pnpm/@rollup+pluginutils@5.3.0_rollup@4.55.3/node_modules/@rollup/pluginutils/types/index.d.ts
4
2
  /**
5
3
  * A valid `picomatch` glob pattern, or array of patterns.
6
4
  */
7
5
  type FilterPattern = ReadonlyArray<string | RegExp> | string | RegExp | null;
8
- //#endregion
9
- //#region node_modules/.pnpm/@rollup+plugin-commonjs@29.0.0_rollup@4.55.3/node_modules/@rollup/plugin-commonjs/types/index.d.ts
10
6
  type RequireReturnsDefaultOption = boolean | 'auto' | 'preferred' | 'namespace';
11
7
  type DefaultIsModuleExportsOption = boolean | 'auto';
12
8
  interface RollupCommonJSOptions {
@@ -237,5 +233,4 @@ interface RollupCommonJSOptions {
237
233
  * Convert CommonJS modules to ES6, so they can be included in a Rollup bundle
238
234
  */
239
235
  declare function commonjs(options?: RollupCommonJSOptions): Plugin;
240
- //#endregion
241
236
  export { commonjs as t };