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,223 +0,0 @@
1
- import {
2
- colors,
3
- htmlEscape
4
- } from "./chunk-4L7RY2JA.js";
5
- import {
6
- BaseComponent,
7
- publicDirURL
8
- } from "./chunk-PE3GG3TN.js";
9
-
10
- // src/templates/error_stack/main.ts
11
- import { dump, themes } from "@poppinss/dumper/html";
12
- import { dump as dumpCli } from "@poppinss/dumper/console";
13
- var CHEVIRON = `<svg xmlns="http://www.w3.org/2000/svg" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" width="24" height="24" stroke-width="2">
14
- <path d="M6 9l6 6l6 -6"></path>
15
- </svg>`;
16
- var EDITORS = {
17
- textmate: "txmt://open?url=file://%f&line=%l",
18
- macvim: "mvim://open?url=file://%f&line=%l",
19
- emacs: "emacs://open?url=file://%f&line=%l",
20
- sublime: "subl://open?url=file://%f&line=%l",
21
- phpstorm: "phpstorm://open?file=%f&line=%l",
22
- atom: "atom://core/open/file?filename=%f&line=%l",
23
- vscode: "vscode://file/%f:%l"
24
- };
25
- var ErrorStack = class extends BaseComponent {
26
- cssFile = new URL("./error_stack/style.css", publicDirURL);
27
- scriptFile = new URL("./error_stack/script.js", publicDirURL);
28
- /**
29
- * Returns the file's relative name from the CWD
30
- */
31
- #getRelativeFileName(filePath) {
32
- return filePath.replace(`${process.cwd()}/`, "");
33
- }
34
- /**
35
- * Returns the index of the frame that should be expanded by
36
- * default
37
- */
38
- #getFirstExpandedFrameIndex(frames) {
39
- let expandAtIndex = frames.findIndex((frame) => frame.type === "app");
40
- if (expandAtIndex === -1) {
41
- expandAtIndex = frames.findIndex((frame) => frame.type === "module");
42
- }
43
- return expandAtIndex;
44
- }
45
- /**
46
- * Returns the link to open the file within known code
47
- * editors
48
- */
49
- #getEditorLink(ide, frame) {
50
- const editorURL = EDITORS[ide] || ide;
51
- if (!editorURL || frame.type === "native") {
52
- return {
53
- text: this.#getRelativeFileName(frame.fileName)
54
- };
55
- }
56
- return {
57
- href: editorURL.replace("%f", frame.fileName).replace("%l", String(frame.lineNumber)),
58
- text: this.#getRelativeFileName(frame.fileName)
59
- };
60
- }
61
- /**
62
- * Returns the HTML fragment for the frame location
63
- */
64
- #renderFrameLocation(frame, ide) {
65
- const { text, href } = this.#getEditorLink(ide, frame);
66
- const fileName = `<a${href ? ` href="${href}"` : ""} class="stack-frame-filepath" title="${text}">
67
- ${htmlEscape(text)}
68
- </a>`;
69
- const functionName = frame.functionName ? `<span>in <code title="${frame.functionName}">
70
- ${htmlEscape(frame.functionName)}
71
- </code></span>` : "";
72
- const loc = `<span>at line <code>${frame.lineNumber}:${frame.columnNumber}</code></span>`;
73
- if (frame.type !== "native" && frame.source) {
74
- return `<button class="stack-frame-location">
75
- ${fileName} ${functionName} ${loc}
76
- </button>`;
77
- }
78
- return `<div class="stack-frame-location">
79
- ${fileName} ${functionName} ${loc}
80
- </div>`;
81
- }
82
- /**
83
- * Returns HTML fragment for the stack frame
84
- */
85
- async #renderStackFrame(frame, index, expandAtIndex, props) {
86
- const label = frame.type === "app" ? '<span class="frame-label">In App</span>' : "";
87
- const expandedClass = expandAtIndex === index ? " expanded" : "";
88
- const toggleButton = frame.type !== "native" && frame.source ? `<button class="stack-frame-toggle-indicator">${CHEVIRON}</button>` : "";
89
- return `<li class="stack-frame stack-frame-${frame.type}${expandedClass}">
90
- <div class="stack-frame-contents">
91
- ${this.#renderFrameLocation(frame, props.ide)}
92
- <div class="stack-frame-extras">
93
- ${label}
94
- ${toggleButton}
95
- </div>
96
- </div>
97
- <div class="stack-frame-source">
98
- ${await props.sourceCodeRenderer(props.error, frame)}
99
- </div>
100
- </li>`;
101
- }
102
- /**
103
- * Returns the ANSI output to print the stack frame on the
104
- * terminal
105
- */
106
- async #printStackFrame(frame, index, expandAtIndex, props) {
107
- const fileName = this.#getRelativeFileName(frame.fileName);
108
- const loc = `${fileName}:${frame.lineNumber}:${frame.columnNumber}`;
109
- if (index === expandAtIndex) {
110
- const functionName2 = frame.functionName ? `at ${frame.functionName} ` : "";
111
- const codeSnippet = await props.sourceCodeRenderer(props.error, frame);
112
- return ` \u2043 ${functionName2}${colors.yellow(`(${loc})`)}${codeSnippet}`;
113
- }
114
- if (frame.type === "native") {
115
- const functionName2 = frame.functionName ? `at ${colors.italic(frame.functionName)} ` : "";
116
- return colors.dim(` \u2043 ${functionName2}(${colors.italic(loc)})`);
117
- }
118
- const functionName = frame.functionName ? `at ${frame.functionName} ` : "";
119
- return ` \u2043 ${functionName}${colors.yellow(`(${loc})`)}`;
120
- }
121
- /**
122
- * The toHTML method is used to output the HTML for the
123
- * web view
124
- */
125
- async toHTML(props) {
126
- const frames = await Promise.all(
127
- props.error.frames.map((frame, index) => {
128
- return this.#renderStackFrame(
129
- frame,
130
- index,
131
- this.#getFirstExpandedFrameIndex(props.error.frames),
132
- props
133
- );
134
- })
135
- );
136
- return `<section>
137
- <div class="card">
138
- <div class="card-heading">
139
- <div>
140
- <h3 class="card-title">
141
- Stack Trace
142
- </h3>
143
- </div>
144
- </div>
145
- <div class="card-body">
146
- <div id="stack-frames-wrapper">
147
- <div id="stack-frames-header">
148
- <div id="all-frames-toggle-wrapper">
149
- <label id="all-frames-toggle">
150
- <input type="checkbox" />
151
- <span> View All Frames </span>
152
- </label>
153
- </div>
154
-
155
- <div>
156
- <div class="toggle-switch">
157
- <button id="formatted-frames-toggle" class="active"> Pretty </button>
158
- <button id="raw-frames-toggle"> Raw </button>
159
- </div>
160
- </div>
161
- </div>
162
-
163
- <div id="stack-frames-body">
164
- <div id="stack-frames-formatted" class="visible">
165
- <ul id="stack-frames">
166
- ${frames.join("\n")}
167
- </ul>
168
- </div>
169
- <div id="stack-frames-raw">
170
- ${dump(props.error.raw, {
171
- styles: themes.cssVariables,
172
- expand: true,
173
- cspNonce: props.cspNonce,
174
- inspectObjectPrototype: false,
175
- inspectStaticMembers: false,
176
- inspectArrayPrototype: false
177
- })}
178
- </div>
179
- </div>
180
- <div>
181
- </div>
182
- </div>
183
- </section>`;
184
- }
185
- /**
186
- * The toANSI method is used to output the text for the console
187
- */
188
- async toANSI(props) {
189
- const displayRaw = process.env.YOUCH_RAW;
190
- if (displayRaw) {
191
- const depth = Number.isNaN(Number(displayRaw)) ? 2 : Number(displayRaw);
192
- return `
193
-
194
- ${colors.red("[RAW]")}
195
- ${dumpCli(props.error.raw, {
196
- depth,
197
- inspectObjectPrototype: false,
198
- inspectStaticMembers: false,
199
- inspectArrayPrototype: false
200
- })}`;
201
- }
202
- const frames = await Promise.all(
203
- props.error.frames.map((frame, index) => {
204
- return this.#printStackFrame(
205
- frame,
206
- index,
207
- this.#getFirstExpandedFrameIndex(props.error.frames),
208
- props
209
- );
210
- })
211
- );
212
- if (frames.length) {
213
- return `
214
-
215
- ${frames.join("\n")}`;
216
- }
217
- return "";
218
- }
219
- };
220
-
221
- export {
222
- ErrorStack
223
- };
@@ -1,81 +0,0 @@
1
- import {
2
- colors,
3
- wordWrap
4
- } from "./chunk-4L7RY2JA.js";
5
- import {
6
- BaseComponent,
7
- publicDirURL
8
- } from "./chunk-PE3GG3TN.js";
9
-
10
- // src/templates/error_info/main.ts
11
- var ERROR_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" height="24" fill="none"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="2" d="M12 7v6m0 4.01.01-.011M12 22c5.523 0 10-4.477 10-10S17.523 2 12 2 2 6.477 2 12s4.477 10 10 10Z"/></svg>`;
12
- var HINT_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" aria-hidden="true" width="24" height="24" fill="none"><path stroke="currentColor" stroke-linecap="round" stroke-linejoin="round" stroke-width="1.5" d="m21 2-1 1M3 2l1 1m17 13-1-1M3 16l1-1m5 3h6m-5 3h4M12 3C8 3 5.952 4.95 6 8c.023 1.487.5 2.5 1.5 3.5S9 13 9 15h6c0-2 .5-2.5 1.5-3.5h0c1-1 1.477-2.013 1.5-3.5.048-3.05-2-5-6-5Z"/></svg>`;
13
- var COPY_ICON_SVG = `<svg xmlns="http://www.w3.org/2000/svg" width="24" height="24" viewBox="0 0 24 24" fill="none" stroke="currentColor" stroke-width="2" stroke-linecap="round" stroke-linejoin="round"><path stroke="none" d="M0 0h24v24H0z" fill="none"/><path d="M7 7m0 2.667a2.667 2.667 0 0 1 2.667 -2.667h8.666a2.667 2.667 0 0 1 2.667 2.667v8.666a2.667 2.667 0 0 1 -2.667 2.667h-8.666a2.667 2.667 0 0 1 -2.667 -2.667z" /><path d="M4.012 16.737a2.005 2.005 0 0 1 -1.012 -1.737v-10c0 -1.1 .9 -2 2 -2h10c.75 0 1.158 .385 1.5 1" /></svg>`;
14
- function htmlAttributeEscape(value) {
15
- return value.replace(/&/g, "&amp;").replace(/"/g, "&quot;").replace(/'/g, "&#x27;").replace(/</g, "&lt;").replace(/>/g, "&gt;");
16
- }
17
- var ErrorInfo = class extends BaseComponent {
18
- cssFile = new URL("./error_info/style.css", publicDirURL);
19
- scriptFile = new URL("./error_info/script.js", publicDirURL);
20
- /**
21
- * The toHTML method is used to output the HTML for the
22
- * web view
23
- */
24
- async toHTML(props) {
25
- return `<section>
26
- <h4 id="error-name">${props.error.name}</h4>
27
- <h1 id="error-title">${props.title}</h1>
28
- </section>
29
- <section>
30
- <div class="card">
31
- <div class="card-body">
32
- <h2 id="error-message">
33
- <span>${ERROR_ICON_SVG}</span>
34
- <span>${props.error.message}</span>
35
- <button
36
- id="copy-error-btn"
37
- data-error-text="${htmlAttributeEscape(`${props.error.name}: ${props.error.message}`)}"
38
- onclick="copyErrorMessage(this)"
39
- title="Copy error message"
40
- aria-label="Copy error message to clipboard"
41
- >
42
- ${COPY_ICON_SVG}
43
- </button>
44
- </h2>
45
- ${props.error.hint ? `<div id="error-hint">
46
- <span>${HINT_ICON_SVG}</span>
47
- <span>${props.error.hint}</span>
48
- </div>` : ""}
49
- </div>
50
- </div>
51
- </section>`;
52
- }
53
- /**
54
- * The toANSI method is used to output the text for the console
55
- */
56
- async toANSI(props) {
57
- const errorMessage = colors.red(
58
- `\u2139 ${wordWrap(`${props.error.name}: ${props.error.message}`, {
59
- width: process.stdout.columns,
60
- indent: " ",
61
- newLine: "\n",
62
- escape: (value) => value
63
- })}`
64
- );
65
- const hint = props.error.hint ? `
66
-
67
- ${colors.blue("\u25C9")} ${colors.dim().italic(
68
- wordWrap(props.error.hint.replace(/(<([^>]+)>)/gi, ""), {
69
- width: process.stdout.columns,
70
- indent: " ",
71
- newLine: "\n",
72
- escape: (value) => value
73
- })
74
- )}` : "";
75
- return `${errorMessage}${hint}`;
76
- }
77
- };
78
-
79
- export {
80
- ErrorInfo
81
- };
@@ -1,87 +0,0 @@
1
- import {
2
- BaseComponent,
3
- publicDirURL
4
- } from "./chunk-PE3GG3TN.js";
5
-
6
- // src/templates/error_metadata/main.ts
7
- import { dump, themes } from "@poppinss/dumper/html";
8
- var ErrorMetadata = class extends BaseComponent {
9
- cssFile = new URL("./error_metadata/style.css", publicDirURL);
10
- #primitives = ["string", "boolean", "number", "undefined"];
11
- /**
12
- * Formats the error row value
13
- */
14
- #formatRowValue(value, dumpValue, cspNonce) {
15
- if (dumpValue === true) {
16
- return dump(value, { styles: themes.cssVariables, cspNonce });
17
- }
18
- if (this.#primitives.includes(typeof value) || value === null) {
19
- return value;
20
- }
21
- return dump(value, { styles: themes.cssVariables, cspNonce });
22
- }
23
- /**
24
- * Returns HTML fragment with HTML table containing rows
25
- * metadata section rows
26
- */
27
- #renderRows(rows, cspNonce) {
28
- return `<table class="card-table">
29
- <tbody>
30
- ${rows.map((row) => {
31
- return `<tr>
32
- <td class="table-key">${row.key}</td>
33
- <td class="table-value">
34
- ${this.#formatRowValue(row.value, row.dump, cspNonce)}
35
- </td>
36
- </tr>`;
37
- }).join("\n")}
38
- </tbody>
39
- </table>`;
40
- }
41
- /**
42
- * Renders each section with its rows inside a table
43
- */
44
- #renderSection(section, rows, cspNonce) {
45
- return `<div>
46
- <h4 class="card-subtitle">${section}</h4>
47
- ${Array.isArray(rows) ? this.#renderRows(rows, cspNonce) : `<span>${this.#formatRowValue(rows.value, rows.dump, cspNonce)}</span>`}
48
- </div>`;
49
- }
50
- /**
51
- * Renders each group as a card
52
- */
53
- #renderGroup(group, sections, cspNonce) {
54
- return `<section class="metadata-group">
55
- <div class="card">
56
- <div class="card-heading">
57
- <h3 class="card-title">${group}</h3>
58
- </div>
59
- <div class="card-body">
60
- ${Object.keys(sections).map((section) => this.#renderSection(section, sections[section], cspNonce)).join("\n")}
61
- </div>
62
- </div>
63
- </section>`;
64
- }
65
- /**
66
- * The toHTML method is used to output the HTML for the
67
- * web view
68
- */
69
- async toHTML(props) {
70
- const groups = props.metadata.toJSON();
71
- const groupsNames = Object.keys(groups);
72
- if (!groupsNames.length) {
73
- return "";
74
- }
75
- return groupsNames.map((group) => this.#renderGroup(group, groups[group], props.cspNonce)).join("\n");
76
- }
77
- /**
78
- * The toANSI method is used to output the text for the console
79
- */
80
- async toANSI() {
81
- return "";
82
- }
83
- };
84
-
85
- export {
86
- ErrorMetadata
87
- };
@@ -1,65 +0,0 @@
1
- // src/component.ts
2
- import { readFile } from "fs/promises";
3
- var BaseComponent = class {
4
- #cachedStyles;
5
- #cachedScript;
6
- /**
7
- * A flag to know if we are in dev mode or not. In dev mode,
8
- * the styles and scripts are refetched from the disk.
9
- * Otherwise they are cached.
10
- */
11
- #inDevMode;
12
- /**
13
- * Absolute path to the frontend JavaScript that should be
14
- * injected within the HTML head. The JavaScript does not
15
- * get transpiled, hence it should work cross browser by
16
- * default.
17
- */
18
- scriptFile;
19
- /**
20
- * Absolute path to the CSS file that should be injected
21
- * within the HTML head.
22
- */
23
- cssFile;
24
- constructor(devMode) {
25
- this.#inDevMode = devMode;
26
- }
27
- /**
28
- * Returns the styles for the component. The null value
29
- * is not returned if no styles are associated with
30
- * the component
31
- */
32
- async getStyles() {
33
- if (!this.cssFile) {
34
- return null;
35
- }
36
- if (this.#inDevMode) {
37
- return await readFile(this.cssFile, "utf-8");
38
- }
39
- this.#cachedStyles = this.#cachedStyles ?? await readFile(this.cssFile, "utf-8");
40
- return this.#cachedStyles;
41
- }
42
- /**
43
- * Returns the frontend script for the component. The null
44
- * value is not returned if no styles are associated
45
- * with the component
46
- */
47
- async getScript() {
48
- if (!this.scriptFile) {
49
- return null;
50
- }
51
- if (this.#inDevMode) {
52
- return await readFile(this.scriptFile, "utf-8");
53
- }
54
- this.#cachedScript = this.#cachedScript ?? await readFile(this.scriptFile, "utf-8");
55
- return this.#cachedScript;
56
- }
57
- };
58
-
59
- // src/public_dir.ts
60
- var publicDirURL = new URL("./public/", import.meta.url);
61
-
62
- export {
63
- BaseComponent,
64
- publicDirURL
65
- };
@@ -1,70 +0,0 @@
1
- import {
2
- colors
3
- } from "./chunk-4L7RY2JA.js";
4
- import {
5
- BaseComponent,
6
- publicDirURL
7
- } from "./chunk-PE3GG3TN.js";
8
-
9
- // src/templates/error_cause/main.ts
10
- import { dump, themes } from "@poppinss/dumper/html";
11
- import { dump as dumpCli } from "@poppinss/dumper/console";
12
- var ErrorCause = class extends BaseComponent {
13
- cssFile = new URL("./error_cause/style.css", publicDirURL);
14
- /**
15
- * The toHTML method is used to output the HTML for the
16
- * web view
17
- */
18
- async toHTML(props) {
19
- if (!props.error.cause) {
20
- return "";
21
- }
22
- return `<section>
23
- <div class="card">
24
- <div class="card-heading">
25
- <div>
26
- <h3 class="card-title">
27
- Error Cause
28
- </h3>
29
- </div>
30
- </div>
31
- <div class="card-body">
32
- <div id="error-cause">
33
- ${dump(props.error.cause, {
34
- cspNonce: props.cspNonce,
35
- styles: themes.cssVariables,
36
- inspectObjectPrototype: false,
37
- inspectStaticMembers: false,
38
- inspectArrayPrototype: false
39
- })}
40
- </div>
41
- </div>
42
- </div>
43
- </section>`;
44
- }
45
- /**
46
- * The toANSI method is used to output the text for the console
47
- */
48
- async toANSI(props) {
49
- if (!props.error.cause) {
50
- return "";
51
- }
52
- let depth = process.env.YOUCH_CAUSE ? Number(process.env.YOUCH_CAUSE) : 2;
53
- if (Number.isNaN(depth)) {
54
- depth = 2;
55
- }
56
- return `
57
-
58
- ${colors.red("[CAUSE]")}
59
- ${dumpCli(props.error.cause, {
60
- depth,
61
- inspectObjectPrototype: false,
62
- inspectStaticMembers: false,
63
- inspectArrayPrototype: false
64
- })}`;
65
- }
66
- };
67
-
68
- export {
69
- ErrorCause
70
- };
@@ -1,2 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- export {};
@@ -1,3 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- declare const _default: {};
3
- export default _default;
@@ -1,2 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- export {};
@@ -1,2 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- export {};
@@ -1,8 +0,0 @@
1
- import type { APIGatewayProxyEvent, APIGatewayProxyEventV2 } from "aws-lambda";
2
- import type { ServerRequest } from "srvx";
3
- export declare function awsRequest(event: APIGatewayProxyEvent | APIGatewayProxyEventV2, context: unknown): ServerRequest;
4
- export declare function awsResponseHeaders(response: Response);
5
- export declare function awsResponseBody(response: Response): Promise<{
6
- body: string;
7
- isBase64Encoded?: boolean;
8
- }>;
@@ -1,2 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- export declare const handler: unknown;
@@ -1,3 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- import type { APIGatewayProxyEvent, APIGatewayProxyEventV2, APIGatewayProxyResult, APIGatewayProxyResultV2, Context } from "aws-lambda";
3
- export declare function handler(event: APIGatewayProxyEvent | APIGatewayProxyEventV2, context: Context): Promise<APIGatewayProxyResult | APIGatewayProxyResultV2>;
@@ -1,2 +0,0 @@
1
- import type { Cookie } from "@azure/functions";
2
- export declare function getAzureParsedCookiesFromHeaders(headers: Headers): Cookie[];
@@ -1,5 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- import type { HttpRequest, HttpResponse } from "@azure/functions";
3
- export declare function handle(context: {
4
- res: HttpResponse;
5
- }, req: HttpRequest);
@@ -1,3 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- declare const _default: {};
3
- export default _default;
@@ -1,16 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- import type * as CF from "@cloudflare/workers-types";
3
- import type { ServerRuntimeContext } from "srvx";
4
- type MaybePromise<T> = T | Promise<T>;
5
- export declare function createHandler<Env>(hooks: {
6
- fetch: (...params: [...Parameters<NonNullable<ExportedHandler<Env>["fetch"]>>, url: URL, cfContextExtras: any]) => MaybePromise<Response | CF.Response | undefined>;
7
- }): {
8
- fetch(request, env, context);
9
- scheduled(controller, env, context);
10
- email(message, env, context);
11
- queue(batch, env, context);
12
- tail(traces, env, context);
13
- trace(traces, env, context);
14
- };
15
- export declare function augmentReq(cfReq: Request | CF.Request, ctx: NonNullable<ServerRuntimeContext["cloudflare"]>);
16
- export {};
@@ -1,11 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- import { DurableObject } from "cloudflare:workers";
3
- declare const _default;
4
- export default _default;
5
- export declare class $DurableObject extends DurableObject {
6
- constructor(state: DurableObjectState, env: Record<string, any>);
7
- fetch(request: Request);
8
- alarm(): void | Promise<void>;
9
- webSocketMessage(client: WebSocket, message: ArrayBuffer | string);
10
- webSocketClose(client: WebSocket, code: number, reason: string, wasClean: boolean);
11
- }
@@ -1,3 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- declare const _default;
3
- export default _default;
@@ -1,20 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- import type { Request as CFRequest, EventContext, ExecutionContext } from "@cloudflare/workers-types";
3
- /**
4
- * Reference: https://developers.cloudflare.com/workers/runtime-apis/fetch-event/#parameters
5
- */
6
- interface CFPagesEnv {
7
- ASSETS: {
8
- fetch: (request: CFRequest) => Promise<Response>;
9
- };
10
- CF_PAGES: "1";
11
- CF_PAGES_BRANCH: string;
12
- CF_PAGES_COMMIT_SHA: string;
13
- CF_PAGES_URL: string;
14
- [key: string]: any;
15
- }
16
- declare const _default: {
17
- fetch(cfReq: CFRequest, env: CFPagesEnv, context: EventContext<CFPagesEnv, string, any>);
18
- scheduled(event: any, env: CFPagesEnv, context: ExecutionContext);
19
- };
20
- export default _default;
@@ -1,3 +0,0 @@
1
- import type { NitroAppPlugin } from "nitro/types";
2
- declare const cloudflareDevPlugin: NitroAppPlugin;
3
- export default cloudflareDevPlugin;
@@ -1,5 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- import type { Deno as _Deno } from "@deno/types";
3
- declare global {
4
- var Deno: typeof _Deno;
5
- }
@@ -1,3 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- declare const _default: {};
3
- export default _default;
@@ -1,3 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- import type { Context } from "@netlify/edge-functions";
3
- export default function netlifyEdge(netlifyReq: Request, context: Context);
@@ -1,4 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- import type { ServerRequest } from "srvx";
3
- declare const handler: (req: ServerRequest) => Promise<Response>;
4
- export default handler;
@@ -1,3 +0,0 @@
1
- import "#nitro/virtual/polyfills";
2
- declare const _default: {};
3
- export default _default;