@depup/nitro 3.0.260311-beta-depup.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (370) hide show
  1. package/LICENSE +27 -0
  2. package/README.md +32 -0
  3. package/changes.json +14 -0
  4. package/dist/THIRD-PARTY-LICENSES.md +1646 -0
  5. package/dist/_build/common.mjs +29361 -0
  6. package/dist/_build/rolldown.mjs +173 -0
  7. package/dist/_build/rollup.mjs +194 -0
  8. package/dist/_build/vite.build.mjs +18 -0
  9. package/dist/_chunks/nitro.mjs +1159 -0
  10. package/dist/_chunks/nitro2.mjs +102 -0
  11. package/dist/_chunks/nitro3.mjs +129 -0
  12. package/dist/_chunks/utils.mjs +272 -0
  13. package/dist/_common.mjs +35 -0
  14. package/dist/_dev.d.mts +12 -0
  15. package/dist/_dev.mjs +519 -0
  16. package/dist/_libs/_.mjs +3 -0
  17. package/dist/_libs/_2.mjs +2 -0
  18. package/dist/_libs/_3.mjs +3 -0
  19. package/dist/_libs/_4.mjs +2 -0
  20. package/dist/_libs/_5.mjs +3 -0
  21. package/dist/_libs/_6.mjs +4 -0
  22. package/dist/_libs/_7.mjs +5 -0
  23. package/dist/_libs/c12+rc9.mjs +812 -0
  24. package/dist/_libs/c12+readdirp+chokidar.d.mts +230 -0
  25. package/dist/_libs/citty.mjs +361 -0
  26. package/dist/_libs/commondir+is-reference.mjs +1311 -0
  27. package/dist/_libs/compatx.d.mts +47 -0
  28. package/dist/_libs/compatx.mjs +45 -0
  29. package/dist/_libs/esbuild.d.mts +20 -0
  30. package/dist/_libs/escape-string-regexp.mjs +7 -0
  31. package/dist/_libs/estree+pluginutils.d.mts +241 -0
  32. package/dist/_libs/estree-walker.mjs +184 -0
  33. package/dist/_libs/exsolve.d.mts +1 -0
  34. package/dist/_libs/hasown+resolve+deepmerge.mjs +1949 -0
  35. package/dist/_libs/httpxy.d.mts +82 -0
  36. package/dist/_libs/httpxy.mjs +671 -0
  37. package/dist/_libs/js-tokens.d.mts +1 -0
  38. package/dist/_libs/klona.mjs +37 -0
  39. package/dist/_libs/magic-string.d.mts +220 -0
  40. package/dist/_libs/mlly.d.mts +57 -0
  41. package/dist/_libs/nypm+tinyexec.mjs +845 -0
  42. package/dist/_libs/perfect-debounce.mjs +88 -0
  43. package/dist/_libs/pkg-types.d.mts +23 -0
  44. package/dist/_libs/plugin-alias.mjs +64 -0
  45. package/dist/_libs/plugin-inject.mjs +131 -0
  46. package/dist/_libs/plugin-json.mjs +34 -0
  47. package/dist/_libs/pluginutils.mjs +646 -0
  48. package/dist/_libs/readdirp+chokidar.mjs +1606 -0
  49. package/dist/_libs/remapping.mjs +115 -0
  50. package/dist/_libs/resolve-uri+gen-mapping.mjs +442 -0
  51. package/dist/_libs/rou3.d.mts +44 -0
  52. package/dist/_libs/rou3.mjs +496 -0
  53. package/dist/_libs/std-env.d.mts +12 -0
  54. package/dist/_libs/strip-literal.d.mts +1 -0
  55. package/dist/_libs/tsconfck.mjs +813 -0
  56. package/dist/_libs/ultrahtml.mjs +127 -0
  57. package/dist/_libs/unimport+unplugin.mjs +1684 -0
  58. package/dist/_libs/unplugin+unimport.d.mts +423 -0
  59. package/dist/_libs/unwasm.d.mts +29 -0
  60. package/dist/_presets.mjs +1759 -0
  61. package/dist/builder.d.mts +64 -0
  62. package/dist/builder.mjs +15 -0
  63. package/dist/cli/_chunks/build.mjs +47 -0
  64. package/dist/cli/_chunks/common.mjs +14 -0
  65. package/dist/cli/_chunks/deploy.mjs +40 -0
  66. package/dist/cli/_chunks/dev.mjs +62 -0
  67. package/dist/cli/_chunks/docs.mjs +30 -0
  68. package/dist/cli/_chunks/list.mjs +25 -0
  69. package/dist/cli/_chunks/prepare.mjs +17 -0
  70. package/dist/cli/_chunks/preview.mjs +51 -0
  71. package/dist/cli/_chunks/run.mjs +53 -0
  72. package/dist/cli/_chunks/task.mjs +14 -0
  73. package/dist/cli/index.d.mts +1 -0
  74. package/dist/cli/index.mjs +22 -0
  75. package/dist/node_modules/@poppinss/colors/build/index.js +139 -0
  76. package/dist/node_modules/@poppinss/colors/package.json +118 -0
  77. package/dist/node_modules/@poppinss/dumper/build/chunk-26HALFTP.js +602 -0
  78. package/dist/node_modules/@poppinss/dumper/build/formatters/console/main.js +441 -0
  79. package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +725 -0
  80. package/dist/node_modules/@poppinss/dumper/package.json +122 -0
  81. package/dist/node_modules/@poppinss/exception/build/index.js +44 -0
  82. package/dist/node_modules/@poppinss/exception/package.json +109 -0
  83. package/dist/node_modules/@sindresorhus/is/distribution/index.js +1354 -0
  84. package/dist/node_modules/@sindresorhus/is/distribution/utilities.js +3 -0
  85. package/dist/node_modules/@sindresorhus/is/package.json +81 -0
  86. package/dist/node_modules/@speed-highlight/core/dist/index.js +4 -0
  87. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -0
  88. package/dist/node_modules/@speed-highlight/core/package.json +94 -0
  89. package/dist/node_modules/cookie-es/dist/index.mjs +262 -0
  90. package/dist/node_modules/cookie-es/package.json +37 -0
  91. package/dist/node_modules/croner/dist/croner.js +1 -0
  92. package/dist/node_modules/croner/package.json +73 -0
  93. package/dist/node_modules/defu/dist/defu.mjs +69 -0
  94. package/dist/node_modules/defu/package.json +43 -0
  95. package/dist/node_modules/destr/dist/index.mjs +72 -0
  96. package/dist/node_modules/destr/package.json +47 -0
  97. package/dist/node_modules/error-stack-parser-es/dist/index.mjs +38 -0
  98. package/dist/node_modules/error-stack-parser-es/dist/lite.mjs +167 -0
  99. package/dist/node_modules/error-stack-parser-es/package.json +83 -0
  100. package/dist/node_modules/get-port-please/dist/index.mjs +430 -0
  101. package/dist/node_modules/get-port-please/package.json +39 -0
  102. package/dist/node_modules/kleur/index.mjs +110 -0
  103. package/dist/node_modules/kleur/package.json +51 -0
  104. package/dist/node_modules/rendu/dist/index.mjs +380 -0
  105. package/dist/node_modules/rendu/package.json +47 -0
  106. package/dist/node_modules/scule/dist/index.mjs +80 -0
  107. package/dist/node_modules/scule/package.json +43 -0
  108. package/dist/node_modules/source-map/lib/array-set.js +100 -0
  109. package/dist/node_modules/source-map/lib/base64-vlq.js +94 -0
  110. package/dist/node_modules/source-map/lib/base64.js +19 -0
  111. package/dist/node_modules/source-map/lib/binary-search.js +113 -0
  112. package/dist/node_modules/source-map/lib/mapping-list.js +83 -0
  113. package/dist/node_modules/source-map/lib/mappings.wasm +0 -0
  114. package/dist/node_modules/source-map/lib/read-wasm.js +27 -0
  115. package/dist/node_modules/source-map/lib/source-map-consumer.js +1081 -0
  116. package/dist/node_modules/source-map/lib/source-map-generator.js +439 -0
  117. package/dist/node_modules/source-map/lib/source-node.js +430 -0
  118. package/dist/node_modules/source-map/lib/url.js +13 -0
  119. package/dist/node_modules/source-map/lib/util.js +444 -0
  120. package/dist/node_modules/source-map/lib/wasm.js +138 -0
  121. package/dist/node_modules/source-map/package.json +79 -0
  122. package/dist/node_modules/source-map/source-map.js +10 -0
  123. package/dist/node_modules/supports-color/index.js +202 -0
  124. package/dist/node_modules/supports-color/package.json +64 -0
  125. package/dist/node_modules/ufo/dist/index.mjs +645 -0
  126. package/dist/node_modules/ufo/package.json +48 -0
  127. package/dist/node_modules/unctx/dist/index.mjs +131 -0
  128. package/dist/node_modules/unctx/package.json +67 -0
  129. package/dist/node_modules/youch/build/helpers-B9BQYaS6.js +23 -0
  130. package/dist/node_modules/youch/build/index.js +212 -0
  131. package/dist/node_modules/youch/build/public/error_cause/style.css +5 -0
  132. package/dist/node_modules/youch/build/public/error_info/script.js +13 -0
  133. package/dist/node_modules/youch/build/public/error_info/style.css +145 -0
  134. package/dist/node_modules/youch/build/public/error_metadata/style.css +3 -0
  135. package/dist/node_modules/youch/build/public/error_stack/script.js +72 -0
  136. package/dist/node_modules/youch/build/public/error_stack/style.css +219 -0
  137. package/dist/node_modules/youch/build/public/error_stack_source/style.css +123 -0
  138. package/dist/node_modules/youch/build/public/header/script.js +14 -0
  139. package/dist/node_modules/youch/build/public/header/style.css +56 -0
  140. package/dist/node_modules/youch/build/public/layout/script.js +12 -0
  141. package/dist/node_modules/youch/build/public/layout/style.css +435 -0
  142. package/dist/node_modules/youch/build/public_dir-C5bujZKB.js +25 -0
  143. package/dist/node_modules/youch/build/src/templates/error_cause/main.js +44 -0
  144. package/dist/node_modules/youch/build/src/templates/error_info/main.js +72 -0
  145. package/dist/node_modules/youch/build/src/templates/error_metadata/main.js +65 -0
  146. package/dist/node_modules/youch/build/src/templates/error_stack/main.js +152 -0
  147. package/dist/node_modules/youch/build/src/templates/error_stack_source/main.js +46 -0
  148. package/dist/node_modules/youch/build/src/templates/header/main.js +24 -0
  149. package/dist/node_modules/youch/build/src/templates/layout/main.js +27 -0
  150. package/dist/node_modules/youch/package.json +135 -0
  151. package/dist/node_modules/youch-core/build/index.js +316 -0
  152. package/dist/node_modules/youch-core/package.json +124 -0
  153. package/dist/presets/_nitro/runtime/nitro-dev.mjs +20 -0
  154. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +15 -0
  155. package/dist/presets/_nitro/runtime/service-worker.mjs +23 -0
  156. package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +14 -0
  157. package/dist/presets/aws-lambda/runtime/_utils.mjs +116 -0
  158. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +31 -0
  159. package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +13 -0
  160. package/dist/presets/azure/runtime/_utils.mjs +50 -0
  161. package/dist/presets/azure/runtime/azure-swa.mjs +30 -0
  162. package/dist/presets/bun/runtime/bun.mjs +40 -0
  163. package/dist/presets/cloudflare/runtime/_module-handler.mjs +87 -0
  164. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +72 -0
  165. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +17 -0
  166. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +39 -0
  167. package/dist/presets/cloudflare/runtime/plugin.dev.mjs +96 -0
  168. package/dist/presets/cloudflare/runtime/shims/workers.dev.mjs +27 -0
  169. package/dist/presets/deno/runtime/deno-deploy.mjs +19 -0
  170. package/dist/presets/deno/runtime/deno-server.mjs +39 -0
  171. package/dist/presets/netlify/runtime/netlify-edge.mjs +20 -0
  172. package/dist/presets/netlify/runtime/netlify.mjs +20 -0
  173. package/dist/presets/node/runtime/node-cluster.mjs +54 -0
  174. package/dist/presets/node/runtime/node-middleware.mjs +14 -0
  175. package/dist/presets/node/runtime/node-server.mjs +47 -0
  176. package/dist/presets/standard/runtime/server.mjs +4 -0
  177. package/dist/presets/stormkit/runtime/stormkit.mjs +27 -0
  178. package/dist/presets/vercel/runtime/cron-handler.mjs +25 -0
  179. package/dist/presets/vercel/runtime/isr.mjs +19 -0
  180. package/dist/presets/vercel/runtime/vercel.node.mjs +24 -0
  181. package/dist/presets/vercel/runtime/vercel.web.mjs +23 -0
  182. package/dist/presets/winterjs/runtime/winterjs.mjs +91 -0
  183. package/dist/presets/zeabur/runtime/zeabur.mjs +4 -0
  184. package/dist/presets/zephyr/runtime/server.mjs +3 -0
  185. package/dist/runtime/app.d.mts +1 -0
  186. package/dist/runtime/app.mjs +1 -0
  187. package/dist/runtime/cache.d.mts +1 -0
  188. package/dist/runtime/cache.mjs +1 -0
  189. package/dist/runtime/config.d.mts +3 -0
  190. package/dist/runtime/config.mjs +4 -0
  191. package/dist/runtime/context.d.mts +1 -0
  192. package/dist/runtime/context.mjs +1 -0
  193. package/dist/runtime/database.d.mts +1 -0
  194. package/dist/runtime/database.mjs +1 -0
  195. package/dist/runtime/internal/app.d.mts +16 -0
  196. package/dist/runtime/internal/app.mjs +208 -0
  197. package/dist/runtime/internal/cache.d.mts +7 -0
  198. package/dist/runtime/internal/cache.mjs +41 -0
  199. package/dist/runtime/internal/context.d.mts +14 -0
  200. package/dist/runtime/internal/context.mjs +24 -0
  201. package/dist/runtime/internal/database.d.mts +2 -0
  202. package/dist/runtime/internal/database.mjs +12 -0
  203. package/dist/runtime/internal/empty.mjs +0 -0
  204. package/dist/runtime/internal/error/dev.d.mts +10 -0
  205. package/dist/runtime/internal/error/dev.mjs +121 -0
  206. package/dist/runtime/internal/error/hooks.d.mts +1 -0
  207. package/dist/runtime/internal/error/hooks.mjs +9 -0
  208. package/dist/runtime/internal/error/prod.d.mts +6 -0
  209. package/dist/runtime/internal/error/prod.mjs +40 -0
  210. package/dist/runtime/internal/error/utils.d.mts +8 -0
  211. package/dist/runtime/internal/error/utils.mjs +3 -0
  212. package/dist/runtime/internal/meta.d.mts +2 -0
  213. package/dist/runtime/internal/meta.mjs +3 -0
  214. package/dist/runtime/internal/plugin.d.mts +3 -0
  215. package/dist/runtime/internal/plugin.mjs +4 -0
  216. package/dist/runtime/internal/route-rules.d.mts +9 -0
  217. package/dist/runtime/internal/route-rules.mjs +72 -0
  218. package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -0
  219. package/dist/runtime/internal/routes/dev-tasks.mjs +25 -0
  220. package/dist/runtime/internal/routes/openapi.d.mts +3 -0
  221. package/dist/runtime/internal/routes/openapi.mjs +94 -0
  222. package/dist/runtime/internal/routes/renderer-template.d.mts +2 -0
  223. package/dist/runtime/internal/routes/renderer-template.dev.d.mts +3 -0
  224. package/dist/runtime/internal/routes/renderer-template.dev.mjs +19 -0
  225. package/dist/runtime/internal/routes/renderer-template.mjs +4 -0
  226. package/dist/runtime/internal/routes/scalar.d.mts +3 -0
  227. package/dist/runtime/internal/routes/scalar.mjs +193 -0
  228. package/dist/runtime/internal/routes/swagger.d.mts +3 -0
  229. package/dist/runtime/internal/routes/swagger.mjs +42 -0
  230. package/dist/runtime/internal/runtime-config.d.mts +9 -0
  231. package/dist/runtime/internal/runtime-config.mjs +54 -0
  232. package/dist/runtime/internal/static.d.mts +3 -0
  233. package/dist/runtime/internal/static.mjs +67 -0
  234. package/dist/runtime/internal/storage.d.mts +2 -0
  235. package/dist/runtime/internal/storage.mjs +6 -0
  236. package/dist/runtime/internal/task.d.mts +19 -0
  237. package/dist/runtime/internal/task.mjs +69 -0
  238. package/dist/runtime/internal/vite/dev-entry.mjs +18 -0
  239. package/dist/runtime/internal/vite/dev-worker.mjs +264 -0
  240. package/dist/runtime/internal/vite/ssr-renderer.mjs +6 -0
  241. package/dist/runtime/meta.d.mts +5 -0
  242. package/dist/runtime/meta.mjs +27 -0
  243. package/dist/runtime/nitro.d.mts +11 -0
  244. package/dist/runtime/nitro.mjs +34 -0
  245. package/dist/runtime/runtime-config.d.mts +1 -0
  246. package/dist/runtime/runtime-config.mjs +1 -0
  247. package/dist/runtime/storage.d.mts +1 -0
  248. package/dist/runtime/storage.mjs +1 -0
  249. package/dist/runtime/task.d.mts +1 -0
  250. package/dist/runtime/task.mjs +1 -0
  251. package/dist/runtime/virtual/_runtime_warn.d.mts +1 -0
  252. package/dist/runtime/virtual/_runtime_warn.mjs +5 -0
  253. package/dist/runtime/virtual/database.d.mts +8 -0
  254. package/dist/runtime/virtual/database.mjs +2 -0
  255. package/dist/runtime/virtual/error-handler.d.mts +6 -0
  256. package/dist/runtime/virtual/error-handler.mjs +9 -0
  257. package/dist/runtime/virtual/feature-flags.d.mts +7 -0
  258. package/dist/runtime/virtual/feature-flags.mjs +7 -0
  259. package/dist/runtime/virtual/plugins.d.mts +3 -0
  260. package/dist/runtime/virtual/plugins.mjs +2 -0
  261. package/dist/runtime/virtual/polyfills.d.mts +3 -0
  262. package/dist/runtime/virtual/polyfills.mjs +2 -0
  263. package/dist/runtime/virtual/public-assets.d.mts +9 -0
  264. package/dist/runtime/virtual/public-assets.mjs +8 -0
  265. package/dist/runtime/virtual/renderer-template.d.mts +4 -0
  266. package/dist/runtime/virtual/renderer-template.mjs +7 -0
  267. package/dist/runtime/virtual/routing-meta.d.mts +7 -0
  268. package/dist/runtime/virtual/routing-meta.mjs +2 -0
  269. package/dist/runtime/virtual/routing.d.mts +8 -0
  270. package/dist/runtime/virtual/routing.mjs +11 -0
  271. package/dist/runtime/virtual/runtime-config.d.mts +3 -0
  272. package/dist/runtime/virtual/runtime-config.mjs +5 -0
  273. package/dist/runtime/virtual/server-assets.d.mts +7 -0
  274. package/dist/runtime/virtual/server-assets.mjs +12 -0
  275. package/dist/runtime/virtual/storage.d.mts +3 -0
  276. package/dist/runtime/virtual/storage.mjs +5 -0
  277. package/dist/runtime/virtual/tasks.d.mts +10 -0
  278. package/dist/runtime/virtual/tasks.mjs +3 -0
  279. package/dist/runtime/vite.d.mts +8 -0
  280. package/dist/runtime/vite.mjs +9 -0
  281. package/dist/types/index.d.mts +3010 -0
  282. package/dist/types/index.mjs +1 -0
  283. package/dist/vite.d.mts +52 -0
  284. package/dist/vite.mjs +740 -0
  285. package/lib/h3.d.mts +1 -0
  286. package/lib/h3.mjs +1 -0
  287. package/lib/tsconfig.json +27 -0
  288. package/lib/vite.types.d.mts +26 -0
  289. package/lib/vite.types.mjs +2 -0
  290. package/package.json +256 -0
  291. package/skills/nitro/SKILL.md +10 -0
  292. package/skills/nitro/docs/TOC.md +83 -0
  293. package/skills/nitro/docs/_navigation.json +679 -0
  294. package/skills/nitro/docs/config/index.md +1147 -0
  295. package/skills/nitro/docs/deploy/index.md +64 -0
  296. package/skills/nitro/docs/deploy/providers/alwaysdata.md +50 -0
  297. package/skills/nitro/docs/deploy/providers/aws-amplify.md +81 -0
  298. package/skills/nitro/docs/deploy/providers/aws.md +47 -0
  299. package/skills/nitro/docs/deploy/providers/azure.md +72 -0
  300. package/skills/nitro/docs/deploy/providers/cleavr.md +33 -0
  301. package/skills/nitro/docs/deploy/providers/cloudflare.md +375 -0
  302. package/skills/nitro/docs/deploy/providers/deno-deploy.md +66 -0
  303. package/skills/nitro/docs/deploy/providers/digitalocean.md +46 -0
  304. package/skills/nitro/docs/deploy/providers/firebase.md +32 -0
  305. package/skills/nitro/docs/deploy/providers/flightcontrol.md +67 -0
  306. package/skills/nitro/docs/deploy/providers/genezio.md +67 -0
  307. package/skills/nitro/docs/deploy/providers/github-pages.md +68 -0
  308. package/skills/nitro/docs/deploy/providers/gitlab-pages.md +37 -0
  309. package/skills/nitro/docs/deploy/providers/heroku.md +84 -0
  310. package/skills/nitro/docs/deploy/providers/iis.md +38 -0
  311. package/skills/nitro/docs/deploy/providers/koyeb.md +109 -0
  312. package/skills/nitro/docs/deploy/providers/netlify.md +47 -0
  313. package/skills/nitro/docs/deploy/providers/platform-sh.md +37 -0
  314. package/skills/nitro/docs/deploy/providers/render.md +37 -0
  315. package/skills/nitro/docs/deploy/providers/stormkit.md +24 -0
  316. package/skills/nitro/docs/deploy/providers/vercel.md +179 -0
  317. package/skills/nitro/docs/deploy/providers/zeabur.md +19 -0
  318. package/skills/nitro/docs/deploy/providers/zephyr.md +99 -0
  319. package/skills/nitro/docs/deploy/providers/zerops.md +102 -0
  320. package/skills/nitro/docs/deploy/runtimes/bun.md +15 -0
  321. package/skills/nitro/docs/deploy/runtimes/deno.md +19 -0
  322. package/skills/nitro/docs/deploy/runtimes/node.md +63 -0
  323. package/skills/nitro/docs/docs/assets.md +166 -0
  324. package/skills/nitro/docs/docs/cache.md +408 -0
  325. package/skills/nitro/docs/docs/configuration.md +256 -0
  326. package/skills/nitro/docs/docs/database.md +185 -0
  327. package/skills/nitro/docs/docs/index.md +56 -0
  328. package/skills/nitro/docs/docs/lifecycle.md +204 -0
  329. package/skills/nitro/docs/docs/migration.md +215 -0
  330. package/skills/nitro/docs/docs/nightly.md +31 -0
  331. package/skills/nitro/docs/docs/plugins.md +164 -0
  332. package/skills/nitro/docs/docs/quick-start.md +110 -0
  333. package/skills/nitro/docs/docs/renderer.md +322 -0
  334. package/skills/nitro/docs/docs/routing.md +711 -0
  335. package/skills/nitro/docs/docs/server-entry.md +239 -0
  336. package/skills/nitro/docs/docs/storage.md +261 -0
  337. package/skills/nitro/docs/docs/tasks.md +277 -0
  338. package/skills/nitro/docs/examples/api-routes.md +145 -0
  339. package/skills/nitro/docs/examples/auto-imports.md +93 -0
  340. package/skills/nitro/docs/examples/cached-handler.md +81 -0
  341. package/skills/nitro/docs/examples/custom-error-handler.md +98 -0
  342. package/skills/nitro/docs/examples/database.md +157 -0
  343. package/skills/nitro/docs/examples/elysia.md +70 -0
  344. package/skills/nitro/docs/examples/express.md +78 -0
  345. package/skills/nitro/docs/examples/fastify.md +79 -0
  346. package/skills/nitro/docs/examples/hello-world.md +68 -0
  347. package/skills/nitro/docs/examples/hono.md +74 -0
  348. package/skills/nitro/docs/examples/import-alias.md +100 -0
  349. package/skills/nitro/docs/examples/index.md +3 -0
  350. package/skills/nitro/docs/examples/middleware.md +91 -0
  351. package/skills/nitro/docs/examples/mono-jsx.md +68 -0
  352. package/skills/nitro/docs/examples/nano-jsx.md +70 -0
  353. package/skills/nitro/docs/examples/plugins.md +91 -0
  354. package/skills/nitro/docs/examples/renderer.md +113 -0
  355. package/skills/nitro/docs/examples/runtime-config.md +97 -0
  356. package/skills/nitro/docs/examples/server-fetch.md +87 -0
  357. package/skills/nitro/docs/examples/shiki.md +198 -0
  358. package/skills/nitro/docs/examples/virtual-routes.md +74 -0
  359. package/skills/nitro/docs/examples/vite-nitro-plugin.md +79 -0
  360. package/skills/nitro/docs/examples/vite-rsc.md +1041 -0
  361. package/skills/nitro/docs/examples/vite-ssr-html.md +217 -0
  362. package/skills/nitro/docs/examples/vite-ssr-preact.md +247 -0
  363. package/skills/nitro/docs/examples/vite-ssr-react.md +226 -0
  364. package/skills/nitro/docs/examples/vite-ssr-solid.md +256 -0
  365. package/skills/nitro/docs/examples/vite-ssr-tsr-react.md +442 -0
  366. package/skills/nitro/docs/examples/vite-ssr-tss-react.md +444 -0
  367. package/skills/nitro/docs/examples/vite-ssr-vue-router.md +616 -0
  368. package/skills/nitro/docs/examples/vite-trpc.md +335 -0
  369. package/skills/nitro/docs/examples/websocket.md +282 -0
  370. package/skills/nitro/docs/index.md +121 -0
@@ -0,0 +1,813 @@
1
+ import fs, { promises } from "node:fs";
2
+ import path from "node:path";
3
+ import { createRequire } from "module";
4
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/util.js
5
+ const POSIX_SEP_RE = new RegExp("\\" + path.posix.sep, "g");
6
+ const NATIVE_SEP_RE = new RegExp("\\" + path.sep, "g");
7
+ /** @type {Map<string,RegExp>}*/
8
+ const PATTERN_REGEX_CACHE = /* @__PURE__ */ new Map();
9
+ const GLOB_ALL_PATTERN = `**/*`;
10
+ const TS_EXTENSIONS = [
11
+ ".ts",
12
+ ".tsx",
13
+ ".mts",
14
+ ".cts"
15
+ ];
16
+ const TSJS_EXTENSIONS = TS_EXTENSIONS.concat([
17
+ ".js",
18
+ ".jsx",
19
+ ".mjs",
20
+ ".cjs"
21
+ ]);
22
+ const TS_EXTENSIONS_RE_GROUP = `\\.(?:${TS_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`;
23
+ const TSJS_EXTENSIONS_RE_GROUP = `\\.(?:${TSJS_EXTENSIONS.map((ext) => ext.substring(1)).join("|")})`;
24
+ const IS_POSIX = path.posix.sep === path.sep;
25
+ /**
26
+ * @template T
27
+ * @returns {{resolve:(result:T)=>void, reject:(error:any)=>void, promise: Promise<T>}}
28
+ */
29
+ function makePromise() {
30
+ let resolve, reject;
31
+ return {
32
+ promise: new Promise((res, rej) => {
33
+ resolve = res;
34
+ reject = rej;
35
+ }),
36
+ resolve,
37
+ reject
38
+ };
39
+ }
40
+ /**
41
+ * @param {string} filename
42
+ * @param {import('./cache.js').TSConfckCache} [cache]
43
+ * @returns {Promise<string|void>}
44
+ */
45
+ async function resolveTSConfigJson(filename, cache) {
46
+ if (path.extname(filename) !== ".json") return;
47
+ const tsconfig = path.resolve(filename);
48
+ if (cache && (cache.hasParseResult(tsconfig) || cache.hasParseResult(filename))) return tsconfig;
49
+ return promises.stat(tsconfig).then((stat) => {
50
+ if (stat.isFile() || stat.isFIFO()) return tsconfig;
51
+ else throw new Error(`${filename} exists but is not a regular file.`);
52
+ });
53
+ }
54
+ /**
55
+ *
56
+ * @param {string} dir an absolute directory path
57
+ * @returns {boolean} if dir path includes a node_modules segment
58
+ */
59
+ const isInNodeModules = IS_POSIX ? (dir) => dir.includes("/node_modules/") : (dir) => dir.match(/[/\\]node_modules[/\\]/);
60
+ /**
61
+ * convert posix separator to native separator
62
+ *
63
+ * eg.
64
+ * windows: C:/foo/bar -> c:\foo\bar
65
+ * linux: /foo/bar -> /foo/bar
66
+ *
67
+ * @param {string} filename with posix separators
68
+ * @returns {string} filename with native separators
69
+ */
70
+ const posix2native = IS_POSIX ? (filename) => filename : (filename) => filename.replace(POSIX_SEP_RE, path.sep);
71
+ /**
72
+ * convert native separator to posix separator
73
+ *
74
+ * eg.
75
+ * windows: C:\foo\bar -> c:/foo/bar
76
+ * linux: /foo/bar -> /foo/bar
77
+ *
78
+ * @param {string} filename - filename with native separators
79
+ * @returns {string} filename with posix separators
80
+ */
81
+ const native2posix = IS_POSIX ? (filename) => filename : (filename) => filename.replace(NATIVE_SEP_RE, path.posix.sep);
82
+ /**
83
+ * converts params to native separator, resolves path and converts native back to posix
84
+ *
85
+ * needed on windows to handle posix paths in tsconfig
86
+ *
87
+ * @param dir {string|null} directory to resolve from
88
+ * @param filename {string} filename or pattern to resolve
89
+ * @returns string
90
+ */
91
+ const resolve2posix = IS_POSIX ? (dir, filename) => dir ? path.resolve(dir, filename) : path.resolve(filename) : (dir, filename) => native2posix(dir ? path.resolve(posix2native(dir), posix2native(filename)) : path.resolve(posix2native(filename)));
92
+ /**
93
+ *
94
+ * @param {import('./public.d.ts').TSConfckParseResult} result
95
+ * @param {import('./public.d.ts').TSConfckParseOptions} [options]
96
+ * @returns {string[]}
97
+ */
98
+ function resolveReferencedTSConfigFiles(result, options) {
99
+ const dir = path.dirname(result.tsconfigFile);
100
+ return result.tsconfig.references.map((ref) => {
101
+ return resolve2posix(dir, ref.path.endsWith(".json") ? ref.path : path.join(ref.path, options?.configName ?? "tsconfig.json"));
102
+ });
103
+ }
104
+ /**
105
+ * @param {string} filename
106
+ * @param {import('./public.d.ts').TSConfckParseResult} result
107
+ * @returns {import('./public.d.ts').TSConfckParseResult}
108
+ */
109
+ function resolveSolutionTSConfig(filename, result) {
110
+ const extensions = result.tsconfig.compilerOptions?.allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
111
+ if (result.referenced && extensions.some((ext) => filename.endsWith(ext)) && !isIncluded(filename, result)) {
112
+ const solutionTSConfig = result.referenced.find((referenced) => isIncluded(filename, referenced));
113
+ if (solutionTSConfig) return solutionTSConfig;
114
+ }
115
+ return result;
116
+ }
117
+ /**
118
+ *
119
+ * @param {string} filename
120
+ * @param {import('./public.d.ts').TSConfckParseResult} result
121
+ * @returns {boolean}
122
+ */
123
+ function isIncluded(filename, result) {
124
+ const dir = native2posix(path.dirname(result.tsconfigFile));
125
+ const files = (result.tsconfig.files || []).map((file) => resolve2posix(dir, file));
126
+ const absoluteFilename = resolve2posix(null, filename);
127
+ if (files.includes(filename)) return true;
128
+ const allowJs = result.tsconfig.compilerOptions?.allowJs;
129
+ if (isGlobMatch(absoluteFilename, dir, result.tsconfig.include || (result.tsconfig.files ? [] : [GLOB_ALL_PATTERN]), allowJs)) return !isGlobMatch(absoluteFilename, dir, result.tsconfig.exclude || [], allowJs);
130
+ return false;
131
+ }
132
+ /**
133
+ * test filenames agains glob patterns in tsconfig
134
+ *
135
+ * @param filename {string} posix style abolute path to filename to test
136
+ * @param dir {string} posix style absolute path to directory of tsconfig containing patterns
137
+ * @param patterns {string[]} glob patterns to match against
138
+ * @param allowJs {boolean} allowJs setting in tsconfig to include js extensions in checks
139
+ * @returns {boolean} true when at least one pattern matches filename
140
+ */
141
+ function isGlobMatch(filename, dir, patterns, allowJs) {
142
+ const extensions = allowJs ? TSJS_EXTENSIONS : TS_EXTENSIONS;
143
+ return patterns.some((pattern) => {
144
+ let lastWildcardIndex = pattern.length;
145
+ let hasWildcard = false;
146
+ let hasExtension = false;
147
+ let hasSlash = false;
148
+ let lastSlashIndex = -1;
149
+ for (let i = pattern.length - 1; i > -1; i--) {
150
+ const c = pattern[i];
151
+ if (!hasWildcard) {
152
+ if (c === "*" || c === "?") {
153
+ lastWildcardIndex = i;
154
+ hasWildcard = true;
155
+ }
156
+ }
157
+ if (!hasSlash) {
158
+ if (c === ".") hasExtension = true;
159
+ else if (c === "/") {
160
+ lastSlashIndex = i;
161
+ hasSlash = true;
162
+ }
163
+ }
164
+ if (hasWildcard && hasSlash) break;
165
+ }
166
+ if (!hasExtension && (!hasWildcard || lastWildcardIndex < lastSlashIndex)) {
167
+ pattern += `${pattern.endsWith("/") ? "" : "/"}${GLOB_ALL_PATTERN}`;
168
+ lastWildcardIndex = pattern.length - 1;
169
+ hasWildcard = true;
170
+ }
171
+ if (lastWildcardIndex < pattern.length - 1 && !filename.endsWith(pattern.slice(lastWildcardIndex + 1))) return false;
172
+ if (pattern.endsWith("*") && !extensions.some((ext) => filename.endsWith(ext))) return false;
173
+ if (pattern === GLOB_ALL_PATTERN) return filename.startsWith(`${dir}/`);
174
+ const resolvedPattern = resolve2posix(dir, pattern);
175
+ let firstWildcardIndex = -1;
176
+ for (let i = 0; i < resolvedPattern.length; i++) if (resolvedPattern[i] === "*" || resolvedPattern[i] === "?") {
177
+ firstWildcardIndex = i;
178
+ hasWildcard = true;
179
+ break;
180
+ }
181
+ if (firstWildcardIndex > 1 && !filename.startsWith(resolvedPattern.slice(0, firstWildcardIndex - 1))) return false;
182
+ if (!hasWildcard) return filename === resolvedPattern;
183
+ else if (firstWildcardIndex + GLOB_ALL_PATTERN.length === resolvedPattern.length - (pattern.length - 1 - lastWildcardIndex) && resolvedPattern.slice(firstWildcardIndex, firstWildcardIndex + GLOB_ALL_PATTERN.length) === GLOB_ALL_PATTERN) return true;
184
+ if (PATTERN_REGEX_CACHE.has(resolvedPattern)) return PATTERN_REGEX_CACHE.get(resolvedPattern).test(filename);
185
+ const regex = pattern2regex(resolvedPattern, allowJs);
186
+ PATTERN_REGEX_CACHE.set(resolvedPattern, regex);
187
+ return regex.test(filename);
188
+ });
189
+ }
190
+ /**
191
+ * @param {string} resolvedPattern
192
+ * @param {boolean} allowJs
193
+ * @returns {RegExp}
194
+ */
195
+ function pattern2regex(resolvedPattern, allowJs) {
196
+ let regexStr = "^";
197
+ for (let i = 0; i < resolvedPattern.length; i++) {
198
+ const char = resolvedPattern[i];
199
+ if (char === "?") {
200
+ regexStr += "[^\\/]";
201
+ continue;
202
+ }
203
+ if (char === "*") {
204
+ if (resolvedPattern[i + 1] === "*" && resolvedPattern[i + 2] === "/") {
205
+ i += 2;
206
+ regexStr += "(?:[^\\/]*\\/)*";
207
+ continue;
208
+ }
209
+ regexStr += "[^\\/]*";
210
+ continue;
211
+ }
212
+ if ("/.+^${}()|[]\\".includes(char)) regexStr += `\\`;
213
+ regexStr += char;
214
+ }
215
+ if (resolvedPattern.endsWith("*")) regexStr += allowJs ? TSJS_EXTENSIONS_RE_GROUP : TS_EXTENSIONS_RE_GROUP;
216
+ regexStr += "$";
217
+ return new RegExp(regexStr);
218
+ }
219
+ /**
220
+ * replace tokens like ${configDir}
221
+ * @param {import('./public.d.ts').TSConfckParseResult} result
222
+ */
223
+ function replaceTokens(result) {
224
+ if (result.tsconfig) result.tsconfig = JSON.parse(JSON.stringify(result.tsconfig).replaceAll(/"\${configDir}/g, `"${native2posix(path.dirname(result.tsconfigFile))}`));
225
+ }
226
+ //#endregion
227
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/find.js
228
+ /**
229
+ * find the closest tsconfig.json file
230
+ *
231
+ * @param {string} filename - path to file to find tsconfig for (absolute or relative to cwd)
232
+ * @param {import('./public.d.ts').TSConfckFindOptions} [options] - options
233
+ * @returns {Promise<string|null>} absolute path to closest tsconfig.json or null if not found
234
+ */
235
+ async function find(filename, options) {
236
+ let dir = path.dirname(path.resolve(filename));
237
+ if (options?.ignoreNodeModules && isInNodeModules(dir)) return null;
238
+ const cache = options?.cache;
239
+ const configName = options?.configName ?? "tsconfig.json";
240
+ if (cache?.hasConfigPath(dir, configName)) return cache.getConfigPath(dir, configName);
241
+ const { promise, resolve, reject } = makePromise();
242
+ if (options?.root && !path.isAbsolute(options.root)) options.root = path.resolve(options.root);
243
+ findUp(dir, {
244
+ promise,
245
+ resolve,
246
+ reject
247
+ }, options);
248
+ return promise;
249
+ }
250
+ /**
251
+ *
252
+ * @param {string} dir
253
+ * @param {{promise:Promise<string|null>,resolve:(result:string|null)=>void,reject:(err:any)=>void}} madePromise
254
+ * @param {import('./public.d.ts').TSConfckFindOptions} [options] - options
255
+ */
256
+ function findUp(dir, { resolve, reject, promise }, options) {
257
+ const { cache, root, configName } = options ?? {};
258
+ if (cache) if (cache.hasConfigPath(dir, configName)) {
259
+ let cached;
260
+ try {
261
+ cached = cache.getConfigPath(dir, configName);
262
+ } catch (e) {
263
+ reject(e);
264
+ return;
265
+ }
266
+ if (cached?.then) cached.then(resolve).catch(reject);
267
+ else resolve(cached);
268
+ } else cache.setConfigPath(dir, promise, configName);
269
+ const tsconfig = path.join(dir, options?.configName ?? "tsconfig.json");
270
+ fs.stat(tsconfig, (err, stats) => {
271
+ if (stats && (stats.isFile() || stats.isFIFO())) resolve(tsconfig);
272
+ else if (err?.code !== "ENOENT") reject(err);
273
+ else {
274
+ let parent;
275
+ if (root === dir || (parent = path.dirname(dir)) === dir) resolve(null);
276
+ else findUp(parent, {
277
+ promise,
278
+ resolve,
279
+ reject
280
+ }, options);
281
+ }
282
+ });
283
+ }
284
+ path.sep;
285
+ //#endregion
286
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/to-json.js
287
+ /**
288
+ * convert content of tsconfig.json to regular json
289
+ *
290
+ * @param {string} tsconfigJson - content of tsconfig.json
291
+ * @returns {string} content as regular json, comments and dangling commas have been replaced with whitespace
292
+ */
293
+ function toJson(tsconfigJson) {
294
+ const stripped = stripDanglingComma(stripJsonComments(stripBom(tsconfigJson)));
295
+ if (stripped.trim() === "") return "{}";
296
+ else return stripped;
297
+ }
298
+ /**
299
+ * replace dangling commas from pseudo-json string with single space
300
+ * implementation heavily inspired by strip-json-comments
301
+ *
302
+ * @param {string} pseudoJson
303
+ * @returns {string}
304
+ */
305
+ function stripDanglingComma(pseudoJson) {
306
+ let insideString = false;
307
+ let offset = 0;
308
+ let result = "";
309
+ let danglingCommaPos = null;
310
+ for (let i = 0; i < pseudoJson.length; i++) {
311
+ const currentCharacter = pseudoJson[i];
312
+ if (currentCharacter === "\"") {
313
+ if (!isEscaped(pseudoJson, i)) insideString = !insideString;
314
+ }
315
+ if (insideString) {
316
+ danglingCommaPos = null;
317
+ continue;
318
+ }
319
+ if (currentCharacter === ",") {
320
+ danglingCommaPos = i;
321
+ continue;
322
+ }
323
+ if (danglingCommaPos) {
324
+ if (currentCharacter === "}" || currentCharacter === "]") {
325
+ result += pseudoJson.slice(offset, danglingCommaPos) + " ";
326
+ offset = danglingCommaPos + 1;
327
+ danglingCommaPos = null;
328
+ } else if (!currentCharacter.match(/\s/)) danglingCommaPos = null;
329
+ }
330
+ }
331
+ return result + pseudoJson.substring(offset);
332
+ }
333
+ /**
334
+ *
335
+ * @param {string} jsonString
336
+ * @param {number} quotePosition
337
+ * @returns {boolean}
338
+ */
339
+ function isEscaped(jsonString, quotePosition) {
340
+ let index = quotePosition - 1;
341
+ let backslashCount = 0;
342
+ while (jsonString[index] === "\\") {
343
+ index -= 1;
344
+ backslashCount += 1;
345
+ }
346
+ return Boolean(backslashCount % 2);
347
+ }
348
+ /**
349
+ *
350
+ * @param {string} string
351
+ * @param {number?} start
352
+ * @param {number?} end
353
+ */
354
+ function strip(string, start, end) {
355
+ return string.slice(start, end).replace(/\S/g, " ");
356
+ }
357
+ const singleComment = Symbol("singleComment");
358
+ const multiComment = Symbol("multiComment");
359
+ /**
360
+ * @param {string} jsonString
361
+ * @returns {string}
362
+ */
363
+ function stripJsonComments(jsonString) {
364
+ let isInsideString = false;
365
+ /** @type {false | symbol} */
366
+ let isInsideComment = false;
367
+ let offset = 0;
368
+ let result = "";
369
+ for (let index = 0; index < jsonString.length; index++) {
370
+ const currentCharacter = jsonString[index];
371
+ const nextCharacter = jsonString[index + 1];
372
+ if (!isInsideComment && currentCharacter === "\"") {
373
+ if (!isEscaped(jsonString, index)) isInsideString = !isInsideString;
374
+ }
375
+ if (isInsideString) continue;
376
+ if (!isInsideComment && currentCharacter + nextCharacter === "//") {
377
+ result += jsonString.slice(offset, index);
378
+ offset = index;
379
+ isInsideComment = singleComment;
380
+ index++;
381
+ } else if (isInsideComment === singleComment && currentCharacter + nextCharacter === "\r\n") {
382
+ index++;
383
+ isInsideComment = false;
384
+ result += strip(jsonString, offset, index);
385
+ offset = index;
386
+ } else if (isInsideComment === singleComment && currentCharacter === "\n") {
387
+ isInsideComment = false;
388
+ result += strip(jsonString, offset, index);
389
+ offset = index;
390
+ } else if (!isInsideComment && currentCharacter + nextCharacter === "/*") {
391
+ result += jsonString.slice(offset, index);
392
+ offset = index;
393
+ isInsideComment = multiComment;
394
+ index++;
395
+ } else if (isInsideComment === multiComment && currentCharacter + nextCharacter === "*/") {
396
+ index++;
397
+ isInsideComment = false;
398
+ result += strip(jsonString, offset, index + 1);
399
+ offset = index + 1;
400
+ }
401
+ }
402
+ return result + (isInsideComment ? strip(jsonString.slice(offset)) : jsonString.slice(offset));
403
+ }
404
+ /**
405
+ * @param {string} string
406
+ * @returns {string}
407
+ */
408
+ function stripBom(string) {
409
+ if (string.charCodeAt(0) === 65279) return string.slice(1);
410
+ return string;
411
+ }
412
+ //#endregion
413
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/parse.js
414
+ const not_found_result = {
415
+ tsconfigFile: null,
416
+ tsconfig: {}
417
+ };
418
+ /**
419
+ * parse the closest tsconfig.json file
420
+ *
421
+ * @param {string} filename - path to a tsconfig .json or a source file or directory (absolute or relative to cwd)
422
+ * @param {import('./public.d.ts').TSConfckParseOptions} [options] - options
423
+ * @returns {Promise<import('./public.d.ts').TSConfckParseResult>}
424
+ * @throws {TSConfckParseError}
425
+ */
426
+ async function parse(filename, options) {
427
+ /** @type {import('./cache.js').TSConfckCache} */
428
+ const cache = options?.cache;
429
+ if (cache?.hasParseResult(filename)) return getParsedDeep(filename, cache, options);
430
+ const { resolve, reject, promise } = makePromise();
431
+ cache?.setParseResult(filename, promise, true);
432
+ try {
433
+ let tsconfigFile = await resolveTSConfigJson(filename, cache) || await find(filename, options);
434
+ if (!tsconfigFile) {
435
+ resolve(not_found_result);
436
+ return promise;
437
+ }
438
+ let result;
439
+ if (filename !== tsconfigFile && cache?.hasParseResult(tsconfigFile)) result = await getParsedDeep(tsconfigFile, cache, options);
440
+ else {
441
+ result = await parseFile(tsconfigFile, cache, filename === tsconfigFile);
442
+ await Promise.all([parseExtends(result, cache), parseReferences(result, options)]);
443
+ }
444
+ replaceTokens(result);
445
+ resolve(resolveSolutionTSConfig(filename, result));
446
+ } catch (e) {
447
+ reject(e);
448
+ }
449
+ return promise;
450
+ }
451
+ /**
452
+ * ensure extends and references are parsed
453
+ *
454
+ * @param {string} filename - cached file
455
+ * @param {import('./cache.js').TSConfckCache} cache - cache
456
+ * @param {import('./public.d.ts').TSConfckParseOptions} options - options
457
+ */
458
+ async function getParsedDeep(filename, cache, options) {
459
+ const result = await cache.getParseResult(filename);
460
+ if (result.tsconfig.extends && !result.extended || result.tsconfig.references && !result.referenced) {
461
+ const promise = Promise.all([parseExtends(result, cache), parseReferences(result, options)]).then(() => result);
462
+ cache.setParseResult(filename, promise, true);
463
+ return promise;
464
+ }
465
+ return result;
466
+ }
467
+ /**
468
+ *
469
+ * @param {string} tsconfigFile - path to tsconfig file
470
+ * @param {import('./cache.js').TSConfckCache} [cache] - cache
471
+ * @param {boolean} [skipCache] - skip cache
472
+ * @returns {Promise<import('./public.d.ts').TSConfckParseResult>}
473
+ */
474
+ async function parseFile(tsconfigFile, cache, skipCache) {
475
+ if (!skipCache && cache?.hasParseResult(tsconfigFile) && !cache.getParseResult(tsconfigFile)._isRootFile_) return cache.getParseResult(tsconfigFile);
476
+ const promise = promises.readFile(tsconfigFile, "utf-8").then(toJson).then((json) => {
477
+ const parsed = JSON.parse(json);
478
+ applyDefaults(parsed, tsconfigFile);
479
+ return {
480
+ tsconfigFile,
481
+ tsconfig: normalizeTSConfig(parsed, path.dirname(tsconfigFile))
482
+ };
483
+ }).catch((e) => {
484
+ throw new TSConfckParseError(`parsing ${tsconfigFile} failed: ${e}`, "PARSE_FILE", tsconfigFile, e);
485
+ });
486
+ if (!skipCache && (!cache?.hasParseResult(tsconfigFile) || !cache.getParseResult(tsconfigFile)._isRootFile_)) cache?.setParseResult(tsconfigFile, promise);
487
+ return promise;
488
+ }
489
+ /**
490
+ * normalize to match the output of ts.parseJsonConfigFileContent
491
+ *
492
+ * @param {any} tsconfig - typescript tsconfig output
493
+ * @param {string} dir - directory
494
+ */
495
+ function normalizeTSConfig(tsconfig, dir) {
496
+ const baseUrl = tsconfig.compilerOptions?.baseUrl;
497
+ if (baseUrl && !baseUrl.startsWith("${") && !path.isAbsolute(baseUrl)) tsconfig.compilerOptions.baseUrl = resolve2posix(dir, baseUrl);
498
+ return tsconfig;
499
+ }
500
+ /**
501
+ *
502
+ * @param {import('./public.d.ts').TSConfckParseResult} result
503
+ * @param {import('./public.d.ts').TSConfckParseOptions} [options]
504
+ * @returns {Promise<void>}
505
+ */
506
+ async function parseReferences(result, options) {
507
+ if (!result.tsconfig.references) return;
508
+ const referencedFiles = resolveReferencedTSConfigFiles(result, options);
509
+ const referenced = await Promise.all(referencedFiles.map((file) => parseFile(file, options?.cache)));
510
+ await Promise.all(referenced.map((ref) => parseExtends(ref, options?.cache)));
511
+ referenced.forEach((ref) => {
512
+ ref.solution = result;
513
+ replaceTokens(ref);
514
+ });
515
+ result.referenced = referenced;
516
+ }
517
+ /**
518
+ * @param {import('./public.d.ts').TSConfckParseResult} result
519
+ * @param {import('./cache.js').TSConfckCache}[cache]
520
+ * @returns {Promise<void>}
521
+ */
522
+ async function parseExtends(result, cache) {
523
+ if (!result.tsconfig.extends) return;
524
+ /** @type {import('./public.d.ts').TSConfckParseResult[]} */
525
+ const extended = [{
526
+ tsconfigFile: result.tsconfigFile,
527
+ tsconfig: JSON.parse(JSON.stringify(result.tsconfig))
528
+ }];
529
+ let pos = 0;
530
+ /** @type {string[]} */
531
+ const extendsPath = [];
532
+ let currentBranchDepth = 0;
533
+ while (pos < extended.length) {
534
+ const extending = extended[pos];
535
+ extendsPath.push(extending.tsconfigFile);
536
+ if (extending.tsconfig.extends) {
537
+ currentBranchDepth += 1;
538
+ /** @type {string[]} */
539
+ let resolvedExtends;
540
+ if (!Array.isArray(extending.tsconfig.extends)) resolvedExtends = [resolveExtends(extending.tsconfig.extends, extending.tsconfigFile)];
541
+ else resolvedExtends = extending.tsconfig.extends.reverse().map((ex) => resolveExtends(ex, extending.tsconfigFile));
542
+ const circularExtends = resolvedExtends.find((tsconfigFile) => extendsPath.includes(tsconfigFile));
543
+ if (circularExtends) throw new TSConfckParseError(`Circular dependency in "extends": ${extendsPath.concat([circularExtends]).join(" -> ")}`, "EXTENDS_CIRCULAR", result.tsconfigFile);
544
+ extended.splice(pos + 1, 0, ...await Promise.all(resolvedExtends.map((file) => parseFile(file, cache))));
545
+ } else {
546
+ extendsPath.splice(-currentBranchDepth);
547
+ currentBranchDepth = 0;
548
+ }
549
+ pos = pos + 1;
550
+ }
551
+ result.extended = extended;
552
+ for (const ext of result.extended.slice(1)) extendTSConfig(result, ext);
553
+ }
554
+ /**
555
+ *
556
+ * @param {string} extended
557
+ * @param {string} from
558
+ * @returns {string}
559
+ */
560
+ function resolveExtends(extended, from) {
561
+ if ([".", ".."].includes(extended)) extended = extended + "/tsconfig.json";
562
+ const req = createRequire(from);
563
+ let error;
564
+ try {
565
+ return req.resolve(extended);
566
+ } catch (e) {
567
+ error = e;
568
+ }
569
+ if (extended[0] !== "." && !path.isAbsolute(extended)) try {
570
+ return req.resolve(`${extended}/tsconfig.json`);
571
+ } catch (e) {
572
+ error = e;
573
+ }
574
+ throw new TSConfckParseError(`failed to resolve "extends":"${extended}" in ${from}`, "EXTENDS_RESOLVE", from, error);
575
+ }
576
+ const EXTENDABLE_KEYS = [
577
+ "compilerOptions",
578
+ "files",
579
+ "include",
580
+ "exclude",
581
+ "watchOptions",
582
+ "compileOnSave",
583
+ "typeAcquisition",
584
+ "buildOptions"
585
+ ];
586
+ /**
587
+ *
588
+ * @param {import('./public.d.ts').TSConfckParseResult} extending
589
+ * @param {import('./public.d.ts').TSConfckParseResult} extended
590
+ * @returns void
591
+ */
592
+ function extendTSConfig(extending, extended) {
593
+ const extendingConfig = extending.tsconfig;
594
+ const extendedConfig = extended.tsconfig;
595
+ const relativePath = native2posix(path.relative(path.dirname(extending.tsconfigFile), path.dirname(extended.tsconfigFile)));
596
+ for (const key of Object.keys(extendedConfig).filter((key) => EXTENDABLE_KEYS.includes(key))) if (key === "compilerOptions") {
597
+ if (!extendingConfig.compilerOptions) extendingConfig.compilerOptions = {};
598
+ for (const option of Object.keys(extendedConfig.compilerOptions)) {
599
+ if (Object.prototype.hasOwnProperty.call(extendingConfig.compilerOptions, option)) continue;
600
+ extendingConfig.compilerOptions[option] = rebaseRelative(option, extendedConfig.compilerOptions[option], relativePath);
601
+ }
602
+ } else if (extendingConfig[key] === void 0) if (key === "watchOptions") {
603
+ extendingConfig.watchOptions = {};
604
+ for (const option of Object.keys(extendedConfig.watchOptions)) extendingConfig.watchOptions[option] = rebaseRelative(option, extendedConfig.watchOptions[option], relativePath);
605
+ } else extendingConfig[key] = rebaseRelative(key, extendedConfig[key], relativePath);
606
+ }
607
+ const REBASE_KEYS = [
608
+ "files",
609
+ "include",
610
+ "exclude",
611
+ "baseUrl",
612
+ "rootDir",
613
+ "rootDirs",
614
+ "typeRoots",
615
+ "outDir",
616
+ "outFile",
617
+ "declarationDir",
618
+ "excludeDirectories",
619
+ "excludeFiles"
620
+ ];
621
+ /** @typedef {string | string[]} PathValue */
622
+ /**
623
+ *
624
+ * @param {string} key
625
+ * @param {PathValue} value
626
+ * @param {string} prependPath
627
+ * @returns {PathValue}
628
+ */
629
+ function rebaseRelative(key, value, prependPath) {
630
+ if (!REBASE_KEYS.includes(key)) return value;
631
+ if (Array.isArray(value)) return value.map((x) => rebasePath(x, prependPath));
632
+ else return rebasePath(value, prependPath);
633
+ }
634
+ /**
635
+ *
636
+ * @param {string} value
637
+ * @param {string} prependPath
638
+ * @returns {string}
639
+ */
640
+ function rebasePath(value, prependPath) {
641
+ if (path.isAbsolute(value) || value.startsWith("${configDir}")) return value;
642
+ else return path.posix.normalize(path.posix.join(prependPath, value));
643
+ }
644
+ var TSConfckParseError = class TSConfckParseError extends Error {
645
+ /**
646
+ * error code
647
+ * @type {string}
648
+ */
649
+ code;
650
+ /**
651
+ * error cause
652
+ * @type { Error | undefined}
653
+ */
654
+ cause;
655
+ /**
656
+ * absolute path of tsconfig file where the error happened
657
+ * @type {string}
658
+ */
659
+ tsconfigFile;
660
+ /**
661
+ *
662
+ * @param {string} message - error message
663
+ * @param {string} code - error code
664
+ * @param {string} tsconfigFile - path to tsconfig file
665
+ * @param {Error?} cause - cause of this error
666
+ */
667
+ constructor(message, code, tsconfigFile, cause) {
668
+ super(message);
669
+ Object.setPrototypeOf(this, TSConfckParseError.prototype);
670
+ this.name = TSConfckParseError.name;
671
+ this.code = code;
672
+ this.cause = cause;
673
+ this.tsconfigFile = tsconfigFile;
674
+ }
675
+ };
676
+ /**
677
+ *
678
+ * @param {any} tsconfig
679
+ * @param {string} tsconfigFile
680
+ */
681
+ function applyDefaults(tsconfig, tsconfigFile) {
682
+ if (isJSConfig(tsconfigFile)) tsconfig.compilerOptions = {
683
+ ...DEFAULT_JSCONFIG_COMPILER_OPTIONS,
684
+ ...tsconfig.compilerOptions
685
+ };
686
+ }
687
+ const DEFAULT_JSCONFIG_COMPILER_OPTIONS = {
688
+ allowJs: true,
689
+ maxNodeModuleJsDepth: 2,
690
+ allowSyntheticDefaultImports: true,
691
+ skipLibCheck: true,
692
+ noEmit: true
693
+ };
694
+ /**
695
+ * @param {string} configFileName
696
+ */
697
+ function isJSConfig(configFileName) {
698
+ return path.basename(configFileName) === "jsconfig.json";
699
+ }
700
+ //#endregion
701
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/parse-native.js
702
+ /** @typedef TSDiagnosticError {
703
+ code: number;
704
+ category: number;
705
+ messageText: string;
706
+ start?: number;
707
+ } TSDiagnosticError */
708
+ //#endregion
709
+ //#region node_modules/.pnpm/tsconfck@3.1.6_typescript@5.9.3/node_modules/tsconfck/src/cache.js
710
+ /** @template T */
711
+ var TSConfckCache = class {
712
+ /**
713
+ * clear cache, use this if you have a long running process and tsconfig files have been added,changed or deleted
714
+ */
715
+ clear() {
716
+ this.#configPaths.clear();
717
+ this.#parsed.clear();
718
+ }
719
+ /**
720
+ * has cached closest config for files in dir
721
+ * @param {string} dir
722
+ * @param {string} [configName=tsconfig.json]
723
+ * @returns {boolean}
724
+ */
725
+ hasConfigPath(dir, configName = "tsconfig.json") {
726
+ return this.#configPaths.has(`${dir}/${configName}`);
727
+ }
728
+ /**
729
+ * get cached closest tsconfig for files in dir
730
+ * @param {string} dir
731
+ * @param {string} [configName=tsconfig.json]
732
+ * @returns {Promise<string|null>|string|null}
733
+ * @throws {unknown} if cached value is an error
734
+ */
735
+ getConfigPath(dir, configName = "tsconfig.json") {
736
+ const key = `${dir}/${configName}`;
737
+ const value = this.#configPaths.get(key);
738
+ if (value == null || value.length || value.then) return value;
739
+ else throw value;
740
+ }
741
+ /**
742
+ * has parsed tsconfig for file
743
+ * @param {string} file
744
+ * @returns {boolean}
745
+ */
746
+ hasParseResult(file) {
747
+ return this.#parsed.has(file);
748
+ }
749
+ /**
750
+ * get parsed tsconfig for file
751
+ * @param {string} file
752
+ * @returns {Promise<T>|T}
753
+ * @throws {unknown} if cached value is an error
754
+ */
755
+ getParseResult(file) {
756
+ const value = this.#parsed.get(file);
757
+ if (value.then || value.tsconfig) return value;
758
+ else throw value;
759
+ }
760
+ /**
761
+ * @internal
762
+ * @private
763
+ * @param file
764
+ * @param {boolean} isRootFile a flag to check if current file which involking the parse() api, used to distinguish the normal cache which only parsed by parseFile()
765
+ * @param {Promise<T>} result
766
+ */
767
+ setParseResult(file, result, isRootFile = false) {
768
+ Object.defineProperty(result, "_isRootFile_", {
769
+ value: isRootFile,
770
+ writable: false,
771
+ enumerable: false,
772
+ configurable: false
773
+ });
774
+ this.#parsed.set(file, result);
775
+ result.then((parsed) => {
776
+ if (this.#parsed.get(file) === result) this.#parsed.set(file, parsed);
777
+ }).catch((e) => {
778
+ if (this.#parsed.get(file) === result) this.#parsed.set(file, e);
779
+ });
780
+ }
781
+ /**
782
+ * @internal
783
+ * @private
784
+ * @param {string} dir
785
+ * @param {Promise<string|null>} configPath
786
+ * @param {string} [configName=tsconfig.json]
787
+ */
788
+ setConfigPath(dir, configPath, configName = "tsconfig.json") {
789
+ const key = `${dir}/${configName}`;
790
+ this.#configPaths.set(key, configPath);
791
+ configPath.then((path) => {
792
+ if (this.#configPaths.get(key) === configPath) this.#configPaths.set(key, path);
793
+ }).catch((e) => {
794
+ if (this.#configPaths.get(key) === configPath) this.#configPaths.set(key, e);
795
+ });
796
+ }
797
+ /**
798
+ * map directories to their closest tsconfig.json
799
+ * @internal
800
+ * @private
801
+ * @type{Map<string,(Promise<string|null>|string|null)>}
802
+ */
803
+ #configPaths = /* @__PURE__ */ new Map();
804
+ /**
805
+ * map files to their parsed tsconfig result
806
+ * @internal
807
+ * @private
808
+ * @type {Map<string,(Promise<T>|T)> }
809
+ */
810
+ #parsed = /* @__PURE__ */ new Map();
811
+ };
812
+ //#endregion
813
+ export { parse as n, TSConfckCache as t };