nitro-nightly 3.0.0-beta-28969273.f7aa9de6 → 4.0.0-20251010-091516-7cafddba

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 (417) hide show
  1. package/README.md +8 -39
  2. package/dist/_chunks/app.mjs +19797 -0
  3. package/dist/_chunks/build.mjs +84 -0
  4. package/dist/_chunks/build2.mjs +318 -0
  5. package/dist/_chunks/build3.mjs +6452 -0
  6. package/dist/_chunks/detect-acorn.mjs +503 -0
  7. package/dist/_chunks/index.mjs +22242 -0
  8. package/dist/_chunks/index2.mjs +297 -0
  9. package/dist/_chunks/index3.mjs +1058 -0
  10. package/dist/_chunks/index4.mjs +1206 -0
  11. package/dist/_chunks/info.mjs +11157 -0
  12. package/dist/_chunks/json5.mjs +68 -0
  13. package/dist/_chunks/jsonc.mjs +51 -0
  14. package/dist/_chunks/pathe.M-eThtNZ.mjs +204 -0
  15. package/dist/_chunks/plugin.mjs +960 -0
  16. package/dist/_chunks/server.mjs +254 -0
  17. package/dist/_chunks/snapshot.mjs +284 -0
  18. package/dist/_chunks/toml.mjs +259 -0
  19. package/dist/_chunks/yaml.mjs +86 -0
  20. package/dist/cli/build.mjs +10 -3
  21. package/dist/cli/dev.mjs +41 -9
  22. package/dist/cli/index.mjs +460 -1
  23. package/dist/cli/index2.mjs +4 -1
  24. package/dist/cli/list.mjs +10 -4
  25. package/dist/cli/prepare.mjs +6 -3
  26. package/dist/cli/run.mjs +7 -4
  27. package/dist/index.d.mts +52 -0
  28. package/dist/index.mjs +55 -0
  29. package/dist/node_modules/@poppinss/colors/build/index.js +169 -0
  30. package/dist/node_modules/@poppinss/colors/package.json +116 -0
  31. package/dist/node_modules/@poppinss/dumper/build/chunk-26HALFTP.js +602 -0
  32. package/dist/node_modules/@poppinss/dumper/build/formatters/console/main.js +441 -0
  33. package/dist/node_modules/@poppinss/dumper/build/formatters/html/main.js +717 -0
  34. package/dist/node_modules/@poppinss/dumper/package.json +122 -0
  35. package/dist/node_modules/@poppinss/exception/build/index.js +63 -0
  36. package/dist/node_modules/@poppinss/exception/package.json +106 -0
  37. package/dist/node_modules/@sindresorhus/is/distribution/index.js +1313 -0
  38. package/dist/node_modules/@sindresorhus/is/distribution/utilities.js +3 -0
  39. package/dist/node_modules/@sindresorhus/is/package.json +81 -0
  40. package/dist/node_modules/@speed-highlight/core/dist/index.js +4 -0
  41. package/dist/node_modules/@speed-highlight/core/dist/terminal.js +2 -0
  42. package/dist/node_modules/@speed-highlight/core/package.json +90 -0
  43. package/dist/node_modules/cookie/dist/index.js +239 -0
  44. package/dist/node_modules/cookie/package.json +42 -0
  45. package/dist/node_modules/croner/dist/croner.js +1 -0
  46. package/dist/node_modules/croner/package.json +63 -0
  47. package/dist/node_modules/defu/dist/defu.mjs +69 -0
  48. package/dist/node_modules/defu/package.json +43 -0
  49. package/dist/node_modules/destr/dist/index.mjs +72 -0
  50. package/dist/node_modules/destr/package.json +47 -0
  51. package/dist/node_modules/error-stack-parser-es/dist/index.mjs +38 -0
  52. package/dist/node_modules/error-stack-parser-es/dist/lite.mjs +167 -0
  53. package/dist/node_modules/error-stack-parser-es/package.json +83 -0
  54. package/dist/node_modules/get-port-please/dist/index.mjs +430 -0
  55. package/dist/node_modules/get-port-please/package.json +39 -0
  56. package/dist/node_modules/hookable/dist/index.mjs +290 -0
  57. package/dist/node_modules/hookable/package.json +49 -0
  58. package/dist/node_modules/kleur/index.js +110 -0
  59. package/dist/node_modules/kleur/index.mjs +110 -0
  60. package/dist/node_modules/kleur/package.json +51 -0
  61. package/dist/node_modules/klona/dist/index.mjs +81 -0
  62. package/dist/node_modules/klona/full/index.mjs +53 -0
  63. package/dist/node_modules/klona/package.json +74 -0
  64. package/dist/node_modules/scule/dist/index.mjs +80 -0
  65. package/dist/node_modules/scule/package.json +43 -0
  66. package/dist/node_modules/source-map/lib/array-set.js +100 -0
  67. package/dist/node_modules/source-map/lib/base64-vlq.js +94 -0
  68. package/dist/node_modules/source-map/lib/base64.js +19 -0
  69. package/dist/node_modules/source-map/lib/binary-search.js +113 -0
  70. package/dist/node_modules/source-map/lib/mapping-list.js +83 -0
  71. package/dist/node_modules/source-map/lib/mappings.wasm +0 -0
  72. package/dist/node_modules/source-map/lib/read-wasm.js +27 -0
  73. package/dist/node_modules/source-map/lib/source-map-consumer.js +1081 -0
  74. package/dist/node_modules/source-map/lib/source-map-generator.js +439 -0
  75. package/dist/node_modules/source-map/lib/source-node.js +430 -0
  76. package/dist/node_modules/source-map/lib/url.js +13 -0
  77. package/dist/node_modules/source-map/lib/util.js +444 -0
  78. package/dist/node_modules/source-map/lib/wasm.js +138 -0
  79. package/dist/node_modules/source-map/package.json +79 -0
  80. package/dist/node_modules/source-map/source-map.js +10 -0
  81. package/dist/node_modules/std-env/dist/index.mjs +1 -0
  82. package/dist/node_modules/std-env/package.json +46 -0
  83. package/dist/node_modules/supports-color/index.js +202 -0
  84. package/dist/node_modules/supports-color/package.json +64 -0
  85. package/dist/node_modules/ufo/dist/index.mjs +638 -0
  86. package/dist/node_modules/ufo/package.json +47 -0
  87. package/dist/node_modules/unctx/dist/index.mjs +131 -0
  88. package/dist/node_modules/unctx/package.json +67 -0
  89. package/dist/node_modules/youch/build/chunk-4L7RY2JA.js +42 -0
  90. package/dist/node_modules/youch/build/chunk-4XB2BYKC.js +85 -0
  91. package/dist/node_modules/youch/build/chunk-4YEN7HVQ.js +61 -0
  92. package/dist/node_modules/youch/build/chunk-EUJBVOYB.js +83 -0
  93. package/dist/node_modules/youch/build/chunk-HFSXRSKS.js +85 -0
  94. package/dist/node_modules/youch/build/chunk-JAN2TFI2.js +222 -0
  95. package/dist/node_modules/youch/build/chunk-OSUFJZHZ.js +6 -0
  96. package/dist/node_modules/youch/build/chunk-PINJDICN.js +72 -0
  97. package/dist/node_modules/youch/build/chunk-PUHGL6HA.js +41 -0
  98. package/dist/node_modules/youch/build/chunk-VE4LENUR.js +45 -0
  99. package/dist/node_modules/youch/build/index.js +352 -0
  100. package/dist/node_modules/youch/build/public/error_cause/style.css +5 -0
  101. package/dist/node_modules/youch/build/public/error_info/script.js +13 -0
  102. package/dist/node_modules/youch/build/public/error_info/style.css +144 -0
  103. package/dist/node_modules/youch/build/public/error_stack/script.js +74 -0
  104. package/dist/node_modules/youch/build/public/error_stack/style.css +220 -0
  105. package/dist/node_modules/youch/build/public/error_stack_source/style.css +123 -0
  106. package/dist/node_modules/youch/build/public/header/script.js +16 -0
  107. package/dist/node_modules/youch/build/public/header/style.css +56 -0
  108. package/dist/node_modules/youch/build/public/layout/script.js +20 -0
  109. package/dist/node_modules/youch/build/public/layout/style.css +431 -0
  110. package/dist/node_modules/youch/package.json +133 -0
  111. package/dist/node_modules/youch-core/build/index.js +316 -0
  112. package/dist/node_modules/youch-core/package.json +124 -0
  113. package/dist/presets/_nitro/runtime/nitro-dev.mjs +48 -73
  114. package/dist/presets/_nitro/runtime/{nitro-prerenderer.d.ts → nitro-prerenderer.d.mts} +1 -1
  115. package/dist/presets/_nitro/runtime/nitro-prerenderer.mjs +12 -1
  116. package/dist/presets/_nitro/runtime/service-worker.mjs +5 -15
  117. package/dist/presets/aws-amplify/runtime/aws-amplify.mjs +2 -2
  118. package/dist/presets/aws-lambda/runtime/_utils.d.mts +18 -0
  119. package/dist/presets/aws-lambda/runtime/_utils.mjs +102 -0
  120. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.mts +3 -0
  121. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.mjs +12 -32
  122. package/dist/presets/aws-lambda/runtime/aws-lambda.d.mts +3 -0
  123. package/dist/presets/aws-lambda/runtime/aws-lambda.mjs +6 -38
  124. package/dist/{runtime/internal/utils.azure.d.ts → presets/azure/runtime/_utils.d.mts} +1 -1
  125. package/dist/{runtime/internal/utils.azure.mjs → presets/azure/runtime/_utils.mjs} +3 -4
  126. package/dist/presets/azure/runtime/azure-swa.mjs +11 -13
  127. package/dist/presets/bun/runtime/bun.mjs +13 -18
  128. package/dist/presets/cloudflare/runtime/_module-handler.d.mts +13 -0
  129. package/dist/presets/cloudflare/runtime/_module-handler.mjs +93 -0
  130. package/dist/presets/cloudflare/runtime/cloudflare-durable.d.mts +19 -0
  131. package/dist/presets/cloudflare/runtime/cloudflare-durable.mjs +74 -0
  132. package/dist/presets/cloudflare/runtime/cloudflare-module.d.mts +9 -0
  133. package/dist/presets/cloudflare/runtime/cloudflare-module.mjs +13 -97
  134. package/dist/presets/cloudflare/runtime/{cloudflare-pages.d.ts → cloudflare-pages.d.mts} +1 -1
  135. package/dist/presets/cloudflare/runtime/cloudflare-pages.mjs +19 -27
  136. package/dist/{runtime/internal/timing.d.ts → presets/cloudflare/runtime/plugin.dev.d.mts} +1 -0
  137. package/dist/presets/cloudflare/runtime/plugin.dev.mjs +89 -0
  138. package/dist/presets/deno/runtime/deno-deploy.mjs +11 -25
  139. package/dist/presets/deno/runtime/deno-server.d.mts +6 -0
  140. package/dist/presets/deno/runtime/deno-server.mjs +15 -21
  141. package/dist/presets/netlify/runtime/netlify-edge.d.mts +3 -0
  142. package/dist/presets/netlify/runtime/netlify-edge.mjs +8 -16
  143. package/dist/presets/netlify/runtime/netlify.mjs +16 -45
  144. package/dist/presets/node/runtime/{cluster.mjs → node-cluster.mjs} +1 -3
  145. package/dist/presets/node/runtime/node-middleware.d.mts +4 -0
  146. package/dist/presets/node/runtime/{node-listener.mjs → node-middleware.mjs} +3 -4
  147. package/dist/presets/node/runtime/node-server.mjs +3 -4
  148. package/dist/presets/standard/runtime/server.d.mts +5 -0
  149. package/dist/presets/standard/runtime/server.mjs +6 -0
  150. package/dist/presets/stormkit/runtime/stormkit.mjs +8 -12
  151. package/dist/presets/vercel/runtime/vercel.d.mts +8 -0
  152. package/dist/presets/vercel/runtime/vercel.mjs +11 -11
  153. package/dist/presets/winterjs/runtime/winterjs.mjs +22 -4
  154. package/dist/presets/{node/runtime/node-server.d.ts → zeabur/runtime/zeabur.d.mts} +1 -1
  155. package/dist/presets/zeabur/runtime/zeabur.mjs +2 -6
  156. package/dist/presets.mjs +2460 -0
  157. package/dist/runtime/index.d.mts +11 -0
  158. package/dist/runtime/index.mjs +8 -8
  159. package/dist/runtime/internal/app.d.mts +2 -0
  160. package/dist/runtime/internal/app.mjs +129 -128
  161. package/dist/runtime/internal/cache.d.mts +7 -0
  162. package/dist/runtime/internal/cache.mjs +82 -175
  163. package/dist/runtime/internal/{context.d.ts → context.d.mts} +3 -3
  164. package/dist/runtime/internal/context.mjs +6 -6
  165. package/dist/runtime/internal/error/dev.d.mts +9 -0
  166. package/dist/runtime/internal/error/dev.mjs +122 -0
  167. package/dist/runtime/internal/error/prod.d.mts +8 -0
  168. package/dist/runtime/internal/error/prod.mjs +62 -0
  169. package/dist/runtime/internal/error/utils.d.mts +8 -0
  170. package/dist/runtime/internal/error/utils.mjs +3 -0
  171. package/dist/runtime/internal/index.d.mts +3 -0
  172. package/dist/runtime/internal/index.mjs +1 -14
  173. package/dist/runtime/internal/renderer.d.mts +3 -0
  174. package/dist/runtime/internal/renderer.mjs +29 -33
  175. package/dist/runtime/internal/route-rules.d.mts +8 -0
  176. package/dist/runtime/internal/route-rules.mjs +58 -63
  177. package/dist/runtime/internal/routes/dev-tasks.d.mts +3 -0
  178. package/dist/runtime/internal/routes/dev-tasks.mjs +23 -0
  179. package/dist/runtime/internal/routes/openapi.d.mts +3 -0
  180. package/dist/runtime/internal/routes/openapi.mjs +24 -9
  181. package/dist/runtime/internal/routes/renderer-template.d.mts +2 -0
  182. package/dist/runtime/internal/routes/renderer-template.dev.d.mts +3 -0
  183. package/dist/runtime/internal/routes/renderer-template.dev.mjs +21 -0
  184. package/dist/runtime/internal/routes/renderer-template.mjs +4 -0
  185. package/dist/runtime/internal/routes/scalar.d.mts +3 -0
  186. package/dist/runtime/internal/routes/scalar.mjs +7 -4
  187. package/dist/runtime/internal/routes/swagger.d.mts +3 -0
  188. package/dist/runtime/internal/routes/swagger.mjs +5 -4
  189. package/dist/runtime/internal/{utils.env.d.ts → runtime-config.d.mts} +4 -2
  190. package/dist/runtime/internal/{utils.env.mjs → runtime-config.mjs} +16 -6
  191. package/dist/runtime/internal/static.d.mts +3 -0
  192. package/dist/runtime/internal/static.mjs +24 -36
  193. package/dist/runtime/internal/storage.mjs +2 -1
  194. package/dist/runtime/internal/task.mjs +6 -6
  195. package/dist/runtime/internal/utils.d.mts +1 -0
  196. package/dist/runtime/internal/utils.mjs +1 -116
  197. package/dist/runtime/internal/vite/dev-entry.d.mts +1 -0
  198. package/dist/runtime/internal/vite/dev-entry.mjs +6 -0
  199. package/dist/runtime/internal/vite/dev-worker.mjs +362 -0
  200. package/dist/runtime/internal/vite/prod-setup.d.mts +4 -0
  201. package/dist/runtime/internal/vite/prod-setup.mjs +55 -0
  202. package/dist/runtime/internal/vite/ssr-renderer.d.mts +4 -0
  203. package/dist/runtime/internal/vite/ssr-renderer.mjs +4 -0
  204. package/dist/types/index.d.mts +2688 -138
  205. package/dist/vite.d.mts +59 -0
  206. package/dist/vite.mjs +68 -0
  207. package/lib/config.d.mts +9 -0
  208. package/lib/deps/h3.d.mts +1 -0
  209. package/lib/deps/h3.mjs +1 -0
  210. package/lib/deps/ofetch.mjs +1 -0
  211. package/lib/deps/ofetch.mts +1 -0
  212. package/lib/meta.d.mts +5 -0
  213. package/lib/meta.mjs +21 -0
  214. package/{runtime-meta.d.ts → lib/runtime-meta.d.mts} +1 -0
  215. package/{runtime-meta.mjs → lib/runtime-meta.mjs} +12 -4
  216. package/package.json +142 -160
  217. package/cli.d.ts +0 -1
  218. package/config.d.ts +0 -1
  219. package/core.d.ts +0 -1
  220. package/dist/cli/index.d.ts +0 -1
  221. package/dist/config/index.d.mts +0 -6
  222. package/dist/config/index.d.ts +0 -6
  223. package/dist/core/index.d.mts +0 -30
  224. package/dist/core/index.d.ts +0 -30
  225. package/dist/core/index.mjs +0 -2456
  226. package/dist/kit/index.d.mts +0 -44
  227. package/dist/kit/index.d.ts +0 -44
  228. package/dist/kit/index.mjs +0 -71
  229. package/dist/meta/index.d.mts +0 -3
  230. package/dist/meta/index.d.ts +0 -3
  231. package/dist/meta/index.mjs +0 -3
  232. package/dist/presets/_all.gen.d.ts +0 -2
  233. package/dist/presets/_all.gen.mjs +0 -52
  234. package/dist/presets/_nitro/base-worker.d.ts +0 -2
  235. package/dist/presets/_nitro/base-worker.mjs +0 -25
  236. package/dist/presets/_nitro/nitro-dev.d.ts +0 -2
  237. package/dist/presets/_nitro/nitro-dev.mjs +0 -19
  238. package/dist/presets/_nitro/nitro-prerender.d.ts +0 -2
  239. package/dist/presets/_nitro/nitro-prerender.mjs +0 -17
  240. package/dist/presets/_nitro/preset.d.ts +0 -2
  241. package/dist/presets/_nitro/preset.mjs +0 -5
  242. package/dist/presets/_nitro/service-worker.d.ts +0 -2
  243. package/dist/presets/_nitro/service-worker.mjs +0 -110
  244. package/dist/presets/_resolve.d.ts +0 -8
  245. package/dist/presets/_resolve.mjs +0 -44
  246. package/dist/presets/_static/preset.d.ts +0 -2
  247. package/dist/presets/_static/preset.mjs +0 -69
  248. package/dist/presets/_types.gen.d.ts +0 -16
  249. package/dist/presets/alwaysdata/preset.d.ts +0 -2
  250. package/dist/presets/alwaysdata/preset.mjs +0 -14
  251. package/dist/presets/aws-amplify/preset.d.ts +0 -3
  252. package/dist/presets/aws-amplify/preset.mjs +0 -27
  253. package/dist/presets/aws-amplify/types.d.ts +0 -141
  254. package/dist/presets/aws-amplify/utils.d.ts +0 -2
  255. package/dist/presets/aws-amplify/utils.mjs +0 -82
  256. package/dist/presets/aws-lambda/preset.d.ts +0 -2
  257. package/dist/presets/aws-lambda/preset.mjs +0 -21
  258. package/dist/presets/aws-lambda/runtime/aws-lambda-streaming.d.ts +0 -14
  259. package/dist/presets/aws-lambda/runtime/aws-lambda.d.ts +0 -4
  260. package/dist/presets/azure/preset.d.ts +0 -3
  261. package/dist/presets/azure/preset.mjs +0 -44
  262. package/dist/presets/azure/runtime/azure-functions.mjs +0 -24
  263. package/dist/presets/azure/runtime/azure-swa.d.ts +0 -5
  264. package/dist/presets/azure/types.d.ts +0 -13
  265. package/dist/presets/azure/types.mjs +0 -0
  266. package/dist/presets/azure/utils.d.ts +0 -3
  267. package/dist/presets/azure/utils.mjs +0 -183
  268. package/dist/presets/bun/preset.d.ts +0 -2
  269. package/dist/presets/bun/preset.mjs +0 -17
  270. package/dist/presets/cleavr/preset.d.ts +0 -2
  271. package/dist/presets/cleavr/preset.mjs +0 -12
  272. package/dist/presets/cloudflare/preset.d.ts +0 -3
  273. package/dist/presets/cloudflare/preset.mjs +0 -145
  274. package/dist/presets/cloudflare/runtime/cloudflare-module.d.ts +0 -13
  275. package/dist/presets/cloudflare/runtime/cloudflare-worker.mjs +0 -64
  276. package/dist/presets/cloudflare/types.d.ts +0 -89
  277. package/dist/presets/cloudflare/types.mjs +0 -0
  278. package/dist/presets/cloudflare/types.wrangler.d.ts +0 -974
  279. package/dist/presets/cloudflare/types.wrangler.mjs +0 -0
  280. package/dist/presets/cloudflare/utils.d.ts +0 -3
  281. package/dist/presets/cloudflare/utils.mjs +0 -163
  282. package/dist/presets/deno/preset.d.ts +0 -2
  283. package/dist/presets/deno/preset.mjs +0 -148
  284. package/dist/presets/deno/runtime/_deno-env-polyfill.d.ts +0 -0
  285. package/dist/presets/deno/runtime/_deno-env-polyfill.mjs +0 -1
  286. package/dist/presets/digitalocean/preset.d.ts +0 -2
  287. package/dist/presets/digitalocean/preset.mjs +0 -11
  288. package/dist/presets/edgio/preset.d.ts +0 -2
  289. package/dist/presets/edgio/preset.mjs +0 -95
  290. package/dist/presets/firebase/preset.d.ts +0 -3
  291. package/dist/presets/firebase/preset.mjs +0 -50
  292. package/dist/presets/firebase/runtime/firebase-gen-1.d.ts +0 -2
  293. package/dist/presets/firebase/runtime/firebase-gen-1.mjs +0 -7
  294. package/dist/presets/firebase/runtime/firebase-gen-2.d.ts +0 -2
  295. package/dist/presets/firebase/runtime/firebase-gen-2.mjs +0 -14
  296. package/dist/presets/firebase/runtime/firebase-gen-default.d.ts +0 -1
  297. package/dist/presets/firebase/runtime/firebase-gen-default.mjs +0 -1
  298. package/dist/presets/firebase/types.d.ts +0 -38
  299. package/dist/presets/firebase/types.mjs +0 -0
  300. package/dist/presets/firebase/utils.d.ts +0 -3
  301. package/dist/presets/firebase/utils.mjs +0 -50
  302. package/dist/presets/flightcontrol/preset.d.ts +0 -2
  303. package/dist/presets/flightcontrol/preset.mjs +0 -11
  304. package/dist/presets/heroku/preset.d.ts +0 -2
  305. package/dist/presets/heroku/preset.mjs +0 -11
  306. package/dist/presets/iis/preset.d.ts +0 -2
  307. package/dist/presets/iis/preset.mjs +0 -32
  308. package/dist/presets/iis/utils.d.ts +0 -3
  309. package/dist/presets/iis/utils.mjs +0 -161
  310. package/dist/presets/index.d.mts +0 -1
  311. package/dist/presets/index.d.ts +0 -2
  312. package/dist/presets/index.mjs +0 -1
  313. package/dist/presets/koyeb/preset.d.ts +0 -2
  314. package/dist/presets/koyeb/preset.mjs +0 -11
  315. package/dist/presets/netlify/legacy/preset.d.ts +0 -2
  316. package/dist/presets/netlify/legacy/preset.mjs +0 -143
  317. package/dist/presets/netlify/legacy/runtime/_deno-env-polyfill.d.ts +0 -0
  318. package/dist/presets/netlify/legacy/runtime/_deno-env-polyfill.mjs +0 -1
  319. package/dist/presets/netlify/legacy/runtime/netlify-builder.d.ts +0 -3
  320. package/dist/presets/netlify/legacy/runtime/netlify-builder.mjs +0 -5
  321. package/dist/presets/netlify/legacy/runtime/netlify-edge.d.ts +0 -2
  322. package/dist/presets/netlify/legacy/runtime/netlify-edge.mjs +0 -25
  323. package/dist/presets/netlify/legacy/runtime/netlify-lambda.d.ts +0 -3
  324. package/dist/presets/netlify/legacy/runtime/netlify-lambda.mjs +0 -38
  325. package/dist/presets/netlify/legacy/runtime/netlify.d.ts +0 -4
  326. package/dist/presets/netlify/legacy/runtime/netlify.mjs +0 -22
  327. package/dist/presets/netlify/legacy/utils.d.ts +0 -4
  328. package/dist/presets/netlify/legacy/utils.mjs +0 -113
  329. package/dist/presets/netlify/preset.d.ts +0 -3
  330. package/dist/presets/netlify/preset.mjs +0 -128
  331. package/dist/presets/netlify/runtime/_deno-env-polyfill.d.ts +0 -0
  332. package/dist/presets/netlify/runtime/_deno-env-polyfill.mjs +0 -1
  333. package/dist/presets/netlify/runtime/netlify-edge.d.ts +0 -2
  334. package/dist/presets/netlify/types.d.ts +0 -12
  335. package/dist/presets/netlify/types.mjs +0 -0
  336. package/dist/presets/netlify/utils.d.ts +0 -5
  337. package/dist/presets/netlify/utils.mjs +0 -94
  338. package/dist/presets/node/preset.d.ts +0 -2
  339. package/dist/presets/node/preset.mjs +0 -49
  340. package/dist/presets/node/runtime/cli.d.ts +0 -1
  341. package/dist/presets/node/runtime/cli.mjs +0 -22
  342. package/dist/presets/node/runtime/node-listener.d.ts +0 -6
  343. package/dist/presets/platform.sh/preset.d.ts +0 -2
  344. package/dist/presets/platform.sh/preset.mjs +0 -11
  345. package/dist/presets/render.com/preset.d.ts +0 -2
  346. package/dist/presets/render.com/preset.mjs +0 -11
  347. package/dist/presets/stormkit/preset.d.ts +0 -2
  348. package/dist/presets/stormkit/preset.mjs +0 -15
  349. package/dist/presets/vercel/preset.d.ts +0 -3
  350. package/dist/presets/vercel/preset.mjs +0 -104
  351. package/dist/presets/vercel/runtime/vercel-edge.d.ts +0 -2
  352. package/dist/presets/vercel/runtime/vercel-edge.mjs +0 -22
  353. package/dist/presets/vercel/runtime/vercel.d.ts +0 -4
  354. package/dist/presets/vercel/types.d.ts +0 -78
  355. package/dist/presets/vercel/types.mjs +0 -0
  356. package/dist/presets/vercel/utils.d.ts +0 -5
  357. package/dist/presets/vercel/utils.mjs +0 -186
  358. package/dist/presets/winterjs/preset.d.ts +0 -2
  359. package/dist/presets/winterjs/preset.mjs +0 -20
  360. package/dist/presets/winterjs/runtime/winterjs.d.ts +0 -1
  361. package/dist/presets/zeabur/preset.d.ts +0 -2
  362. package/dist/presets/zeabur/preset.mjs +0 -70
  363. package/dist/presets/zeabur/runtime/zeabur.d.ts +0 -4
  364. package/dist/rollup/index.d.mts +0 -5
  365. package/dist/rollup/index.d.ts +0 -5
  366. package/dist/rollup/index.mjs +0 -1673
  367. package/dist/runtime/index.d.ts +0 -12
  368. package/dist/runtime/internal/app.d.ts +0 -3
  369. package/dist/runtime/internal/cache.d.ts +0 -8
  370. package/dist/runtime/internal/client.mjs +0 -4
  371. package/dist/runtime/internal/config.d.ts +0 -5
  372. package/dist/runtime/internal/config.mjs +0 -45
  373. package/dist/runtime/internal/error.d.ts +0 -4
  374. package/dist/runtime/internal/error.mjs +0 -73
  375. package/dist/runtime/internal/index.d.ts +0 -6
  376. package/dist/runtime/internal/renderer.d.ts +0 -2
  377. package/dist/runtime/internal/route-rules.d.ts +0 -14
  378. package/dist/runtime/internal/routes/openapi.d.ts +0 -3
  379. package/dist/runtime/internal/routes/scalar.d.ts +0 -2
  380. package/dist/runtime/internal/routes/swagger.d.ts +0 -2
  381. package/dist/runtime/internal/static.d.ts +0 -2
  382. package/dist/runtime/internal/timing.mjs +0 -29
  383. package/dist/runtime/internal/utils.d.ts +0 -21
  384. package/dist/runtime/internal/utils.lambda.d.ts +0 -10
  385. package/dist/runtime/internal/utils.lambda.mjs +0 -30
  386. package/dist/shared/nitro.bra5i6ER.d.mts +0 -620
  387. package/dist/shared/nitro.bra5i6ER.d.ts +0 -620
  388. package/dist/types/index.d.ts +0 -260
  389. package/kit.d.ts +0 -1
  390. package/meta.d.ts +0 -1
  391. package/presets.d.ts +0 -1
  392. package/rollup.d.ts +0 -1
  393. package/runtime.d.ts +0 -1
  394. package/types.d.ts +0 -1
  395. /package/dist/presets/_nitro/runtime/{nitro-dev.d.ts → nitro-dev.d.mts} +0 -0
  396. /package/dist/presets/_nitro/runtime/{service-worker.d.ts → service-worker.d.mts} +0 -0
  397. /package/dist/presets/aws-amplify/runtime/{aws-amplify.d.ts → aws-amplify.d.mts} +0 -0
  398. /package/dist/presets/azure/runtime/{azure-functions.d.ts → azure-swa.d.mts} +0 -0
  399. /package/dist/presets/bun/runtime/{bun.d.ts → bun.d.mts} +0 -0
  400. /package/dist/presets/{cloudflare/runtime/cloudflare-worker.d.ts → deno/runtime/deno-deploy.d.mts} +0 -0
  401. /package/dist/presets/netlify/runtime/{netlify.d.ts → netlify.d.mts} +0 -0
  402. /package/dist/presets/node/runtime/{cluster.d.ts → node-cluster.d.mts} +0 -0
  403. /package/dist/presets/{deno/runtime/deno-server.d.ts → node/runtime/node-server.d.mts} +0 -0
  404. /package/dist/presets/stormkit/runtime/{stormkit.d.ts → stormkit.d.mts} +0 -0
  405. /package/dist/presets/{deno/runtime/deno-deploy.d.ts → winterjs/runtime/winterjs.d.mts} +0 -0
  406. /package/dist/runtime/internal/{database.d.ts → database.d.mts} +0 -0
  407. /package/dist/runtime/internal/{debug.d.ts → debug.d.mts} +0 -0
  408. /package/dist/{presets/_types.gen.mjs → runtime/internal/empty.d.mts} +0 -0
  409. /package/dist/{presets/aws-amplify/types.mjs → runtime/internal/empty.mjs} +0 -0
  410. /package/dist/runtime/internal/lib/{http-graceful-shutdown.d.ts → http-graceful-shutdown.d.mts} +0 -0
  411. /package/dist/runtime/internal/{meta.d.ts → meta.d.mts} +0 -0
  412. /package/dist/runtime/internal/{plugin.d.ts → plugin.d.mts} +0 -0
  413. /package/dist/runtime/internal/{shutdown.d.ts → shutdown.d.mts} +0 -0
  414. /package/dist/runtime/internal/{storage.d.ts → storage.d.mts} +0 -0
  415. /package/dist/runtime/internal/{task.d.ts → task.d.mts} +0 -0
  416. /package/dist/runtime/internal/{client.d.ts → vite/dev-worker.d.mts} +0 -0
  417. /package/{dist/config/index.mjs → lib/config.mjs} +0 -0
@@ -0,0 +1,1081 @@
1
+ /* -*- Mode: js; js-indent-level: 2; -*- */
2
+ /*
3
+ * Copyright 2011 Mozilla Foundation and contributors
4
+ * Licensed under the New BSD license. See LICENSE or:
5
+ * http://opensource.org/licenses/BSD-3-Clause
6
+ */
7
+
8
+ const util = require("./util");
9
+ const binarySearch = require("./binary-search");
10
+ const ArraySet = require("./array-set").ArraySet;
11
+ const base64VLQ = require("./base64-vlq"); // eslint-disable-line no-unused-vars
12
+ const readWasm = require("../lib/read-wasm");
13
+ const wasm = require("./wasm");
14
+
15
+ const INTERNAL = Symbol("smcInternal");
16
+
17
+ class SourceMapConsumer {
18
+ constructor(aSourceMap, aSourceMapURL) {
19
+ // If the constructor was called by super(), just return Promise<this>.
20
+ // Yes, this is a hack to retain the pre-existing API of the base-class
21
+ // constructor also being an async factory function.
22
+ if (aSourceMap == INTERNAL) {
23
+ return Promise.resolve(this);
24
+ }
25
+
26
+ return _factory(aSourceMap, aSourceMapURL);
27
+ }
28
+
29
+ static initialize(opts) {
30
+ readWasm.initialize(opts["lib/mappings.wasm"]);
31
+ }
32
+
33
+ static fromSourceMap(aSourceMap, aSourceMapURL) {
34
+ return _factoryBSM(aSourceMap, aSourceMapURL);
35
+ }
36
+
37
+ /**
38
+ * Construct a new `SourceMapConsumer` from `rawSourceMap` and `sourceMapUrl`
39
+ * (see the `SourceMapConsumer` constructor for details. Then, invoke the `async
40
+ * function f(SourceMapConsumer) -> T` with the newly constructed consumer, wait
41
+ * for `f` to complete, call `destroy` on the consumer, and return `f`'s return
42
+ * value.
43
+ *
44
+ * You must not use the consumer after `f` completes!
45
+ *
46
+ * By using `with`, you do not have to remember to manually call `destroy` on
47
+ * the consumer, since it will be called automatically once `f` completes.
48
+ *
49
+ * ```js
50
+ * const xSquared = await SourceMapConsumer.with(
51
+ * myRawSourceMap,
52
+ * null,
53
+ * async function (consumer) {
54
+ * // Use `consumer` inside here and don't worry about remembering
55
+ * // to call `destroy`.
56
+ *
57
+ * const x = await whatever(consumer);
58
+ * return x * x;
59
+ * }
60
+ * );
61
+ *
62
+ * // You may not use that `consumer` anymore out here; it has
63
+ * // been destroyed. But you can use `xSquared`.
64
+ * console.log(xSquared);
65
+ * ```
66
+ */
67
+ static async with(rawSourceMap, sourceMapUrl, f) {
68
+ const consumer = await new SourceMapConsumer(rawSourceMap, sourceMapUrl);
69
+ try {
70
+ return await f(consumer);
71
+ } finally {
72
+ consumer.destroy();
73
+ }
74
+ }
75
+
76
+ /**
77
+ * Iterate over each mapping between an original source/line/column and a
78
+ * generated line/column in this source map.
79
+ *
80
+ * @param Function aCallback
81
+ * The function that is called with each mapping.
82
+ * @param Object aContext
83
+ * Optional. If specified, this object will be the value of `this` every
84
+ * time that `aCallback` is called.
85
+ * @param aOrder
86
+ * Either `SourceMapConsumer.GENERATED_ORDER` or
87
+ * `SourceMapConsumer.ORIGINAL_ORDER`. Specifies whether you want to
88
+ * iterate over the mappings sorted by the generated file's line/column
89
+ * order or the original's source/line/column order, respectively. Defaults to
90
+ * `SourceMapConsumer.GENERATED_ORDER`.
91
+ */
92
+ eachMapping(aCallback, aContext, aOrder) {
93
+ throw new Error("Subclasses must implement eachMapping");
94
+ }
95
+
96
+ /**
97
+ * Returns all generated line and column information for the original source,
98
+ * line, and column provided. If no column is provided, returns all mappings
99
+ * corresponding to a either the line we are searching for or the next
100
+ * closest line that has any mappings. Otherwise, returns all mappings
101
+ * corresponding to the given line and either the column we are searching for
102
+ * or the next closest column that has any offsets.
103
+ *
104
+ * The only argument is an object with the following properties:
105
+ *
106
+ * - source: The filename of the original source.
107
+ * - line: The line number in the original source. The line number is 1-based.
108
+ * - column: Optional. the column number in the original source.
109
+ * The column number is 0-based.
110
+ *
111
+ * and an array of objects is returned, each with the following properties:
112
+ *
113
+ * - line: The line number in the generated source, or null. The
114
+ * line number is 1-based.
115
+ * - column: The column number in the generated source, or null.
116
+ * The column number is 0-based.
117
+ */
118
+ allGeneratedPositionsFor(aArgs) {
119
+ throw new Error("Subclasses must implement allGeneratedPositionsFor");
120
+ }
121
+
122
+ destroy() {
123
+ throw new Error("Subclasses must implement destroy");
124
+ }
125
+ }
126
+
127
+ /**
128
+ * The version of the source mapping spec that we are consuming.
129
+ */
130
+ SourceMapConsumer.prototype._version = 3;
131
+ SourceMapConsumer.GENERATED_ORDER = 1;
132
+ SourceMapConsumer.ORIGINAL_ORDER = 2;
133
+
134
+ SourceMapConsumer.GREATEST_LOWER_BOUND = 1;
135
+ SourceMapConsumer.LEAST_UPPER_BOUND = 2;
136
+
137
+ exports.SourceMapConsumer = SourceMapConsumer;
138
+
139
+ /**
140
+ * A BasicSourceMapConsumer instance represents a parsed source map which we can
141
+ * query for information about the original file positions by giving it a file
142
+ * position in the generated source.
143
+ *
144
+ * The first parameter is the raw source map (either as a JSON string, or
145
+ * already parsed to an object). According to the spec, source maps have the
146
+ * following attributes:
147
+ *
148
+ * - version: Which version of the source map spec this map is following.
149
+ * - sources: An array of URLs to the original source files.
150
+ * - names: An array of identifiers which can be referenced by individual mappings.
151
+ * - sourceRoot: Optional. The URL root from which all sources are relative.
152
+ * - sourcesContent: Optional. An array of contents of the original source files.
153
+ * - mappings: A string of base64 VLQs which contain the actual mappings.
154
+ * - file: Optional. The generated file this source map is associated with.
155
+ *
156
+ * Here is an example source map, taken from the source map spec[0]:
157
+ *
158
+ * {
159
+ * version : 3,
160
+ * file: "out.js",
161
+ * sourceRoot : "",
162
+ * sources: ["foo.js", "bar.js"],
163
+ * names: ["src", "maps", "are", "fun"],
164
+ * mappings: "AA,AB;;ABCDE;"
165
+ * }
166
+ *
167
+ * The second parameter, if given, is a string whose value is the URL
168
+ * at which the source map was found. This URL is used to compute the
169
+ * sources array.
170
+ *
171
+ * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit?pli=1#
172
+ */
173
+ class BasicSourceMapConsumer extends SourceMapConsumer {
174
+ constructor(aSourceMap, aSourceMapURL) {
175
+ return super(INTERNAL).then(that => {
176
+ let sourceMap = aSourceMap;
177
+ if (typeof aSourceMap === "string") {
178
+ sourceMap = util.parseSourceMapInput(aSourceMap);
179
+ }
180
+
181
+ const version = util.getArg(sourceMap, "version");
182
+ const sources = util.getArg(sourceMap, "sources").map(String);
183
+ // Sass 3.3 leaves out the 'names' array, so we deviate from the spec (which
184
+ // requires the array) to play nice here.
185
+ const names = util.getArg(sourceMap, "names", []);
186
+ const sourceRoot = util.getArg(sourceMap, "sourceRoot", null);
187
+ const sourcesContent = util.getArg(sourceMap, "sourcesContent", null);
188
+ const mappings = util.getArg(sourceMap, "mappings");
189
+ const file = util.getArg(sourceMap, "file", null);
190
+ const x_google_ignoreList = util.getArg(
191
+ sourceMap,
192
+ "x_google_ignoreList",
193
+ null
194
+ );
195
+
196
+ // Once again, Sass deviates from the spec and supplies the version as a
197
+ // string rather than a number, so we use loose equality checking here.
198
+ if (version != that._version) {
199
+ throw new Error("Unsupported version: " + version);
200
+ }
201
+
202
+ that._sourceLookupCache = new Map();
203
+
204
+ // Pass `true` below to allow duplicate names and sources. While source maps
205
+ // are intended to be compressed and deduplicated, the TypeScript compiler
206
+ // sometimes generates source maps with duplicates in them. See Github issue
207
+ // #72 and bugzil.la/889492.
208
+ that._names = ArraySet.fromArray(names.map(String), true);
209
+ that._sources = ArraySet.fromArray(sources, true);
210
+
211
+ that._absoluteSources = ArraySet.fromArray(
212
+ that._sources.toArray().map(function (s) {
213
+ return util.computeSourceURL(sourceRoot, s, aSourceMapURL);
214
+ }),
215
+ true
216
+ );
217
+
218
+ that.sourceRoot = sourceRoot;
219
+ that.sourcesContent = sourcesContent;
220
+ that._mappings = mappings;
221
+ that._sourceMapURL = aSourceMapURL;
222
+ that.file = file;
223
+ that.x_google_ignoreList = x_google_ignoreList;
224
+
225
+ that._computedColumnSpans = false;
226
+ that._mappingsPtr = 0;
227
+ that._wasm = null;
228
+
229
+ return wasm().then(w => {
230
+ that._wasm = w;
231
+ return that;
232
+ });
233
+ });
234
+ }
235
+
236
+ /**
237
+ * Utility function to find the index of a source. Returns -1 if not
238
+ * found.
239
+ */
240
+ _findSourceIndex(aSource) {
241
+ // In the most common usecases, we'll be constantly looking up the index for the same source
242
+ // files, so we cache the index lookup to avoid constantly recomputing the full URLs.
243
+ const cachedIndex = this._sourceLookupCache.get(aSource);
244
+ if (typeof cachedIndex === "number") {
245
+ return cachedIndex;
246
+ }
247
+
248
+ // Treat the source as map-relative overall by default.
249
+ const sourceAsMapRelative = util.computeSourceURL(
250
+ null,
251
+ aSource,
252
+ this._sourceMapURL
253
+ );
254
+ if (this._absoluteSources.has(sourceAsMapRelative)) {
255
+ const index = this._absoluteSources.indexOf(sourceAsMapRelative);
256
+ this._sourceLookupCache.set(aSource, index);
257
+ return index;
258
+ }
259
+
260
+ // Fall back to treating the source as sourceRoot-relative.
261
+ const sourceAsSourceRootRelative = util.computeSourceURL(
262
+ this.sourceRoot,
263
+ aSource,
264
+ this._sourceMapURL
265
+ );
266
+ if (this._absoluteSources.has(sourceAsSourceRootRelative)) {
267
+ const index = this._absoluteSources.indexOf(sourceAsSourceRootRelative);
268
+ this._sourceLookupCache.set(aSource, index);
269
+ return index;
270
+ }
271
+
272
+ // To avoid this cache growing forever, we do not cache lookup misses.
273
+ return -1;
274
+ }
275
+
276
+ /**
277
+ * Create a BasicSourceMapConsumer from a SourceMapGenerator.
278
+ *
279
+ * @param SourceMapGenerator aSourceMap
280
+ * The source map that will be consumed.
281
+ * @param String aSourceMapURL
282
+ * The URL at which the source map can be found (optional)
283
+ * @returns BasicSourceMapConsumer
284
+ */
285
+ static fromSourceMap(aSourceMap, aSourceMapURL) {
286
+ return new BasicSourceMapConsumer(aSourceMap.toString());
287
+ }
288
+
289
+ get sources() {
290
+ return this._absoluteSources.toArray();
291
+ }
292
+
293
+ _getMappingsPtr() {
294
+ if (this._mappingsPtr === 0) {
295
+ this._parseMappings();
296
+ }
297
+
298
+ return this._mappingsPtr;
299
+ }
300
+
301
+ /**
302
+ * Parse the mappings in a string in to a data structure which we can easily
303
+ * query (the ordered arrays in the `this.__generatedMappings` and
304
+ * `this.__originalMappings` properties).
305
+ */
306
+ _parseMappings() {
307
+ const aStr = this._mappings;
308
+ const size = aStr.length;
309
+
310
+ // Interpret signed result of allocate_mappings as unsigned, otherwise
311
+ // addresses higher than 2GB will be negative.
312
+ const mappingsBufPtr = this._wasm.exports.allocate_mappings(size) >>> 0;
313
+ const mappingsBuf = new Uint8Array(
314
+ this._wasm.exports.memory.buffer,
315
+ mappingsBufPtr,
316
+ size
317
+ );
318
+ for (let i = 0; i < size; i++) {
319
+ mappingsBuf[i] = aStr.charCodeAt(i);
320
+ }
321
+
322
+ const mappingsPtr = this._wasm.exports.parse_mappings(mappingsBufPtr);
323
+
324
+ if (!mappingsPtr) {
325
+ const error = this._wasm.exports.get_last_error();
326
+ let msg = `Error parsing mappings (code ${error}): `;
327
+
328
+ // XXX: keep these error codes in sync with `wasm-mappings`.
329
+ switch (error) {
330
+ case 1:
331
+ msg +=
332
+ "the mappings contained a negative line, column, source index, or name index";
333
+ break;
334
+ case 2:
335
+ msg += "the mappings contained a number larger than 2**32";
336
+ break;
337
+ case 3:
338
+ msg += "reached EOF while in the middle of parsing a VLQ";
339
+ break;
340
+ case 4:
341
+ msg += "invalid base 64 character while parsing a VLQ";
342
+ break;
343
+ default:
344
+ msg += "unknown error code";
345
+ break;
346
+ }
347
+
348
+ throw new Error(msg);
349
+ }
350
+
351
+ this._mappingsPtr = mappingsPtr;
352
+ }
353
+
354
+ eachMapping(aCallback, aContext, aOrder) {
355
+ const context = aContext || null;
356
+ const order = aOrder || SourceMapConsumer.GENERATED_ORDER;
357
+
358
+ this._wasm.withMappingCallback(
359
+ mapping => {
360
+ if (mapping.source !== null) {
361
+ mapping.source = this._absoluteSources.at(mapping.source);
362
+
363
+ if (mapping.name !== null) {
364
+ mapping.name = this._names.at(mapping.name);
365
+ }
366
+ }
367
+ if (this._computedColumnSpans && mapping.lastGeneratedColumn === null) {
368
+ mapping.lastGeneratedColumn = Infinity;
369
+ }
370
+
371
+ aCallback.call(context, mapping);
372
+ },
373
+ () => {
374
+ switch (order) {
375
+ case SourceMapConsumer.GENERATED_ORDER:
376
+ this._wasm.exports.by_generated_location(this._getMappingsPtr());
377
+ break;
378
+ case SourceMapConsumer.ORIGINAL_ORDER:
379
+ this._wasm.exports.by_original_location(this._getMappingsPtr());
380
+ break;
381
+ default:
382
+ throw new Error("Unknown order of iteration.");
383
+ }
384
+ }
385
+ );
386
+ }
387
+
388
+ allGeneratedPositionsFor(aArgs) {
389
+ let source = util.getArg(aArgs, "source");
390
+ const originalLine = util.getArg(aArgs, "line");
391
+ const originalColumn = aArgs.column || 0;
392
+
393
+ source = this._findSourceIndex(source);
394
+ if (source < 0) {
395
+ return [];
396
+ }
397
+
398
+ if (originalLine < 1) {
399
+ throw new Error("Line numbers must be >= 1");
400
+ }
401
+
402
+ if (originalColumn < 0) {
403
+ throw new Error("Column numbers must be >= 0");
404
+ }
405
+
406
+ const mappings = [];
407
+
408
+ this._wasm.withMappingCallback(
409
+ m => {
410
+ let lastColumn = m.lastGeneratedColumn;
411
+ if (this._computedColumnSpans && lastColumn === null) {
412
+ lastColumn = Infinity;
413
+ }
414
+ mappings.push({
415
+ line: m.generatedLine,
416
+ column: m.generatedColumn,
417
+ lastColumn,
418
+ });
419
+ },
420
+ () => {
421
+ this._wasm.exports.all_generated_locations_for(
422
+ this._getMappingsPtr(),
423
+ source,
424
+ originalLine - 1,
425
+ "column" in aArgs,
426
+ originalColumn
427
+ );
428
+ }
429
+ );
430
+
431
+ return mappings;
432
+ }
433
+
434
+ destroy() {
435
+ if (this._mappingsPtr !== 0) {
436
+ this._wasm.exports.free_mappings(this._mappingsPtr);
437
+ this._mappingsPtr = 0;
438
+ }
439
+ }
440
+
441
+ /**
442
+ * Compute the last column for each generated mapping. The last column is
443
+ * inclusive.
444
+ */
445
+ computeColumnSpans() {
446
+ if (this._computedColumnSpans) {
447
+ return;
448
+ }
449
+
450
+ this._wasm.exports.compute_column_spans(this._getMappingsPtr());
451
+ this._computedColumnSpans = true;
452
+ }
453
+
454
+ /**
455
+ * Returns the original source, line, and column information for the generated
456
+ * source's line and column positions provided. The only argument is an object
457
+ * with the following properties:
458
+ *
459
+ * - line: The line number in the generated source. The line number
460
+ * is 1-based.
461
+ * - column: The column number in the generated source. The column
462
+ * number is 0-based.
463
+ * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
464
+ * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
465
+ * closest element that is smaller than or greater than the one we are
466
+ * searching for, respectively, if the exact element cannot be found.
467
+ * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
468
+ *
469
+ * and an object is returned with the following properties:
470
+ *
471
+ * - source: The original source file, or null.
472
+ * - line: The line number in the original source, or null. The
473
+ * line number is 1-based.
474
+ * - column: The column number in the original source, or null. The
475
+ * column number is 0-based.
476
+ * - name: The original identifier, or null.
477
+ */
478
+ originalPositionFor(aArgs) {
479
+ const needle = {
480
+ generatedLine: util.getArg(aArgs, "line"),
481
+ generatedColumn: util.getArg(aArgs, "column"),
482
+ };
483
+
484
+ if (needle.generatedLine < 1) {
485
+ throw new Error("Line numbers must be >= 1");
486
+ }
487
+
488
+ if (needle.generatedColumn < 0) {
489
+ throw new Error("Column numbers must be >= 0");
490
+ }
491
+
492
+ let bias = util.getArg(
493
+ aArgs,
494
+ "bias",
495
+ SourceMapConsumer.GREATEST_LOWER_BOUND
496
+ );
497
+ if (bias == null) {
498
+ bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
499
+ }
500
+
501
+ let mapping;
502
+ this._wasm.withMappingCallback(
503
+ m => (mapping = m),
504
+ () => {
505
+ this._wasm.exports.original_location_for(
506
+ this._getMappingsPtr(),
507
+ needle.generatedLine - 1,
508
+ needle.generatedColumn,
509
+ bias
510
+ );
511
+ }
512
+ );
513
+
514
+ if (mapping) {
515
+ if (mapping.generatedLine === needle.generatedLine) {
516
+ let source = util.getArg(mapping, "source", null);
517
+ if (source !== null) {
518
+ source = this._absoluteSources.at(source);
519
+ }
520
+
521
+ let name = util.getArg(mapping, "name", null);
522
+ if (name !== null) {
523
+ name = this._names.at(name);
524
+ }
525
+
526
+ return {
527
+ source,
528
+ line: util.getArg(mapping, "originalLine", null),
529
+ column: util.getArg(mapping, "originalColumn", null),
530
+ name,
531
+ };
532
+ }
533
+ }
534
+
535
+ return {
536
+ source: null,
537
+ line: null,
538
+ column: null,
539
+ name: null,
540
+ };
541
+ }
542
+
543
+ /**
544
+ * Return true if we have the source content for every source in the source
545
+ * map, false otherwise.
546
+ */
547
+ hasContentsOfAllSources() {
548
+ if (!this.sourcesContent) {
549
+ return false;
550
+ }
551
+ return (
552
+ this.sourcesContent.length >= this._sources.size() &&
553
+ !this.sourcesContent.some(function (sc) {
554
+ return sc == null;
555
+ })
556
+ );
557
+ }
558
+
559
+ /**
560
+ * Returns the original source content. The only argument is the url of the
561
+ * original source file. Returns null if no original source content is
562
+ * available.
563
+ */
564
+ sourceContentFor(aSource, nullOnMissing) {
565
+ if (!this.sourcesContent) {
566
+ return null;
567
+ }
568
+
569
+ const index = this._findSourceIndex(aSource);
570
+ if (index >= 0) {
571
+ return this.sourcesContent[index];
572
+ }
573
+
574
+ // This function is used recursively from
575
+ // IndexedSourceMapConsumer.prototype.sourceContentFor. In that case, we
576
+ // don't want to throw if we can't find the source - we just want to
577
+ // return null, so we provide a flag to exit gracefully.
578
+ if (nullOnMissing) {
579
+ return null;
580
+ }
581
+
582
+ throw new Error('"' + aSource + '" is not in the SourceMap.');
583
+ }
584
+
585
+ /**
586
+ * Returns the generated line and column information for the original source,
587
+ * line, and column positions provided. The only argument is an object with
588
+ * the following properties:
589
+ *
590
+ * - source: The filename of the original source.
591
+ * - line: The line number in the original source. The line number
592
+ * is 1-based.
593
+ * - column: The column number in the original source. The column
594
+ * number is 0-based.
595
+ * - bias: Either 'SourceMapConsumer.GREATEST_LOWER_BOUND' or
596
+ * 'SourceMapConsumer.LEAST_UPPER_BOUND'. Specifies whether to return the
597
+ * closest element that is smaller than or greater than the one we are
598
+ * searching for, respectively, if the exact element cannot be found.
599
+ * Defaults to 'SourceMapConsumer.GREATEST_LOWER_BOUND'.
600
+ *
601
+ * and an object is returned with the following properties:
602
+ *
603
+ * - line: The line number in the generated source, or null. The
604
+ * line number is 1-based.
605
+ * - column: The column number in the generated source, or null.
606
+ * The column number is 0-based.
607
+ */
608
+ generatedPositionFor(aArgs) {
609
+ let source = util.getArg(aArgs, "source");
610
+ source = this._findSourceIndex(source);
611
+ if (source < 0) {
612
+ return {
613
+ line: null,
614
+ column: null,
615
+ lastColumn: null,
616
+ };
617
+ }
618
+
619
+ const needle = {
620
+ source,
621
+ originalLine: util.getArg(aArgs, "line"),
622
+ originalColumn: util.getArg(aArgs, "column"),
623
+ };
624
+
625
+ if (needle.originalLine < 1) {
626
+ throw new Error("Line numbers must be >= 1");
627
+ }
628
+
629
+ if (needle.originalColumn < 0) {
630
+ throw new Error("Column numbers must be >= 0");
631
+ }
632
+
633
+ let bias = util.getArg(
634
+ aArgs,
635
+ "bias",
636
+ SourceMapConsumer.GREATEST_LOWER_BOUND
637
+ );
638
+ if (bias == null) {
639
+ bias = SourceMapConsumer.GREATEST_LOWER_BOUND;
640
+ }
641
+
642
+ let mapping;
643
+ this._wasm.withMappingCallback(
644
+ m => (mapping = m),
645
+ () => {
646
+ this._wasm.exports.generated_location_for(
647
+ this._getMappingsPtr(),
648
+ needle.source,
649
+ needle.originalLine - 1,
650
+ needle.originalColumn,
651
+ bias
652
+ );
653
+ }
654
+ );
655
+
656
+ if (mapping) {
657
+ if (mapping.source === needle.source) {
658
+ let lastColumn = mapping.lastGeneratedColumn;
659
+ if (this._computedColumnSpans && lastColumn === null) {
660
+ lastColumn = Infinity;
661
+ }
662
+ return {
663
+ line: util.getArg(mapping, "generatedLine", null),
664
+ column: util.getArg(mapping, "generatedColumn", null),
665
+ lastColumn,
666
+ };
667
+ }
668
+ }
669
+
670
+ return {
671
+ line: null,
672
+ column: null,
673
+ lastColumn: null,
674
+ };
675
+ }
676
+ }
677
+
678
+ BasicSourceMapConsumer.prototype.consumer = SourceMapConsumer;
679
+ exports.BasicSourceMapConsumer = BasicSourceMapConsumer;
680
+
681
+ /**
682
+ * An IndexedSourceMapConsumer instance represents a parsed source map which
683
+ * we can query for information. It differs from BasicSourceMapConsumer in
684
+ * that it takes "indexed" source maps (i.e. ones with a "sections" field) as
685
+ * input.
686
+ *
687
+ * The first parameter is a raw source map (either as a JSON string, or already
688
+ * parsed to an object). According to the spec for indexed source maps, they
689
+ * have the following attributes:
690
+ *
691
+ * - version: Which version of the source map spec this map is following.
692
+ * - file: Optional. The generated file this source map is associated with.
693
+ * - sections: A list of section definitions.
694
+ *
695
+ * Each value under the "sections" field has two fields:
696
+ * - offset: The offset into the original specified at which this section
697
+ * begins to apply, defined as an object with a "line" and "column"
698
+ * field.
699
+ * - map: A source map definition. This source map could also be indexed,
700
+ * but doesn't have to be.
701
+ *
702
+ * Instead of the "map" field, it's also possible to have a "url" field
703
+ * specifying a URL to retrieve a source map from, but that's currently
704
+ * unsupported.
705
+ *
706
+ * Here's an example source map, taken from the source map spec[0], but
707
+ * modified to omit a section which uses the "url" field.
708
+ *
709
+ * {
710
+ * version : 3,
711
+ * file: "app.js",
712
+ * sections: [{
713
+ * offset: {line:100, column:10},
714
+ * map: {
715
+ * version : 3,
716
+ * file: "section.js",
717
+ * sources: ["foo.js", "bar.js"],
718
+ * names: ["src", "maps", "are", "fun"],
719
+ * mappings: "AAAA,E;;ABCDE;"
720
+ * }
721
+ * }],
722
+ * }
723
+ *
724
+ * The second parameter, if given, is a string whose value is the URL
725
+ * at which the source map was found. This URL is used to compute the
726
+ * sources array.
727
+ *
728
+ * [0]: https://docs.google.com/document/d/1U1RGAehQwRypUTovF1KRlpiOFze0b-_2gc6fAH0KY0k/edit#heading=h.535es3xeprgt
729
+ */
730
+ class IndexedSourceMapConsumer extends SourceMapConsumer {
731
+ constructor(aSourceMap, aSourceMapURL) {
732
+ return super(INTERNAL).then(that => {
733
+ let sourceMap = aSourceMap;
734
+ if (typeof aSourceMap === "string") {
735
+ sourceMap = util.parseSourceMapInput(aSourceMap);
736
+ }
737
+
738
+ const version = util.getArg(sourceMap, "version");
739
+ const sections = util.getArg(sourceMap, "sections");
740
+
741
+ if (version != that._version) {
742
+ throw new Error("Unsupported version: " + version);
743
+ }
744
+
745
+ let lastOffset = {
746
+ line: -1,
747
+ column: 0,
748
+ };
749
+ return Promise.all(
750
+ sections.map(s => {
751
+ if (s.url) {
752
+ // The url field will require support for asynchronicity.
753
+ // See https://github.com/mozilla/source-map/issues/16
754
+ throw new Error(
755
+ "Support for url field in sections not implemented."
756
+ );
757
+ }
758
+ const offset = util.getArg(s, "offset");
759
+ const offsetLine = util.getArg(offset, "line");
760
+ const offsetColumn = util.getArg(offset, "column");
761
+
762
+ if (
763
+ offsetLine < lastOffset.line ||
764
+ (offsetLine === lastOffset.line && offsetColumn < lastOffset.column)
765
+ ) {
766
+ throw new Error(
767
+ "Section offsets must be ordered and non-overlapping."
768
+ );
769
+ }
770
+ lastOffset = offset;
771
+
772
+ const cons = new SourceMapConsumer(
773
+ util.getArg(s, "map"),
774
+ aSourceMapURL
775
+ );
776
+ return cons.then(consumer => {
777
+ return {
778
+ generatedOffset: {
779
+ // The offset fields are 0-based, but we use 1-based indices when
780
+ // encoding/decoding from VLQ.
781
+ generatedLine: offsetLine + 1,
782
+ generatedColumn: offsetColumn + 1,
783
+ },
784
+ consumer,
785
+ };
786
+ });
787
+ })
788
+ ).then(s => {
789
+ that._sections = s;
790
+ return that;
791
+ });
792
+ });
793
+ }
794
+
795
+ /**
796
+ * The list of original sources.
797
+ */
798
+ get sources() {
799
+ const sources = [];
800
+ for (let i = 0; i < this._sections.length; i++) {
801
+ for (let j = 0; j < this._sections[i].consumer.sources.length; j++) {
802
+ sources.push(this._sections[i].consumer.sources[j]);
803
+ }
804
+ }
805
+ return sources;
806
+ }
807
+
808
+ /**
809
+ * Returns the original source, line, and column information for the generated
810
+ * source's line and column positions provided. The only argument is an object
811
+ * with the following properties:
812
+ *
813
+ * - line: The line number in the generated source. The line number
814
+ * is 1-based.
815
+ * - column: The column number in the generated source. The column
816
+ * number is 0-based.
817
+ *
818
+ * and an object is returned with the following properties:
819
+ *
820
+ * - source: The original source file, or null.
821
+ * - line: The line number in the original source, or null. The
822
+ * line number is 1-based.
823
+ * - column: The column number in the original source, or null. The
824
+ * column number is 0-based.
825
+ * - name: The original identifier, or null.
826
+ */
827
+ originalPositionFor(aArgs) {
828
+ const needle = {
829
+ generatedLine: util.getArg(aArgs, "line"),
830
+ generatedColumn: util.getArg(aArgs, "column"),
831
+ };
832
+
833
+ // Find the section containing the generated position we're trying to map
834
+ // to an original position.
835
+ const sectionIndex = binarySearch.search(
836
+ needle,
837
+ this._sections,
838
+ function (aNeedle, section) {
839
+ const cmp =
840
+ aNeedle.generatedLine - section.generatedOffset.generatedLine;
841
+ if (cmp) {
842
+ return cmp;
843
+ }
844
+
845
+ // The generated column is 0-based, but the section offset column is
846
+ // stored 1-based.
847
+ return (
848
+ aNeedle.generatedColumn -
849
+ (section.generatedOffset.generatedColumn - 1)
850
+ );
851
+ }
852
+ );
853
+ const section = this._sections[sectionIndex];
854
+
855
+ if (!section) {
856
+ return {
857
+ source: null,
858
+ line: null,
859
+ column: null,
860
+ name: null,
861
+ };
862
+ }
863
+
864
+ return section.consumer.originalPositionFor({
865
+ line: needle.generatedLine - (section.generatedOffset.generatedLine - 1),
866
+ column:
867
+ needle.generatedColumn -
868
+ (section.generatedOffset.generatedLine === needle.generatedLine
869
+ ? section.generatedOffset.generatedColumn - 1
870
+ : 0),
871
+ bias: aArgs.bias,
872
+ });
873
+ }
874
+
875
+ /**
876
+ * Return true if we have the source content for every source in the source
877
+ * map, false otherwise.
878
+ */
879
+ hasContentsOfAllSources() {
880
+ return this._sections.every(function (s) {
881
+ return s.consumer.hasContentsOfAllSources();
882
+ });
883
+ }
884
+
885
+ /**
886
+ * Returns the original source content. The only argument is the url of the
887
+ * original source file. Returns null if no original source content is
888
+ * available.
889
+ */
890
+ sourceContentFor(aSource, nullOnMissing) {
891
+ for (let i = 0; i < this._sections.length; i++) {
892
+ const section = this._sections[i];
893
+
894
+ const content = section.consumer.sourceContentFor(aSource, true);
895
+ if (content) {
896
+ return content;
897
+ }
898
+ }
899
+ if (nullOnMissing) {
900
+ return null;
901
+ }
902
+ throw new Error('"' + aSource + '" is not in the SourceMap.');
903
+ }
904
+
905
+ _findSectionIndex(source) {
906
+ for (let i = 0; i < this._sections.length; i++) {
907
+ const { consumer } = this._sections[i];
908
+ if (consumer._findSourceIndex(source) !== -1) {
909
+ return i;
910
+ }
911
+ }
912
+ return -1;
913
+ }
914
+
915
+ /**
916
+ * Returns the generated line and column information for the original source,
917
+ * line, and column positions provided. The only argument is an object with
918
+ * the following properties:
919
+ *
920
+ * - source: The filename of the original source.
921
+ * - line: The line number in the original source. The line number
922
+ * is 1-based.
923
+ * - column: The column number in the original source. The column
924
+ * number is 0-based.
925
+ *
926
+ * and an object is returned with the following properties:
927
+ *
928
+ * - line: The line number in the generated source, or null. The
929
+ * line number is 1-based.
930
+ * - column: The column number in the generated source, or null.
931
+ * The column number is 0-based.
932
+ */
933
+ generatedPositionFor(aArgs) {
934
+ const index = this._findSectionIndex(util.getArg(aArgs, "source"));
935
+ const section = index >= 0 ? this._sections[index] : null;
936
+ const nextSection =
937
+ index >= 0 && index + 1 < this._sections.length
938
+ ? this._sections[index + 1]
939
+ : null;
940
+
941
+ const generatedPosition =
942
+ section && section.consumer.generatedPositionFor(aArgs);
943
+ if (generatedPosition && generatedPosition.line !== null) {
944
+ const lineShift = section.generatedOffset.generatedLine - 1;
945
+ const columnShift = section.generatedOffset.generatedColumn - 1;
946
+
947
+ if (generatedPosition.line === 1) {
948
+ generatedPosition.column += columnShift;
949
+ if (typeof generatedPosition.lastColumn === "number") {
950
+ generatedPosition.lastColumn += columnShift;
951
+ }
952
+ }
953
+
954
+ if (
955
+ generatedPosition.lastColumn === Infinity &&
956
+ nextSection &&
957
+ generatedPosition.line === nextSection.generatedOffset.generatedLine
958
+ ) {
959
+ generatedPosition.lastColumn =
960
+ nextSection.generatedOffset.generatedColumn - 2;
961
+ }
962
+ generatedPosition.line += lineShift;
963
+
964
+ return generatedPosition;
965
+ }
966
+
967
+ return {
968
+ line: null,
969
+ column: null,
970
+ lastColumn: null,
971
+ };
972
+ }
973
+
974
+ allGeneratedPositionsFor(aArgs) {
975
+ const index = this._findSectionIndex(util.getArg(aArgs, "source"));
976
+ const section = index >= 0 ? this._sections[index] : null;
977
+ const nextSection =
978
+ index >= 0 && index + 1 < this._sections.length
979
+ ? this._sections[index + 1]
980
+ : null;
981
+
982
+ if (!section) return [];
983
+
984
+ return section.consumer
985
+ .allGeneratedPositionsFor(aArgs)
986
+ .map(generatedPosition => {
987
+ const lineShift = section.generatedOffset.generatedLine - 1;
988
+ const columnShift = section.generatedOffset.generatedColumn - 1;
989
+
990
+ if (generatedPosition.line === 1) {
991
+ generatedPosition.column += columnShift;
992
+ if (typeof generatedPosition.lastColumn === "number") {
993
+ generatedPosition.lastColumn += columnShift;
994
+ }
995
+ }
996
+
997
+ if (
998
+ generatedPosition.lastColumn === Infinity &&
999
+ nextSection &&
1000
+ generatedPosition.line === nextSection.generatedOffset.generatedLine
1001
+ ) {
1002
+ generatedPosition.lastColumn =
1003
+ nextSection.generatedOffset.generatedColumn - 2;
1004
+ }
1005
+ generatedPosition.line += lineShift;
1006
+
1007
+ return generatedPosition;
1008
+ });
1009
+ }
1010
+
1011
+ eachMapping(aCallback, aContext, aOrder) {
1012
+ this._sections.forEach((section, index) => {
1013
+ const nextSection =
1014
+ index + 1 < this._sections.length ? this._sections[index + 1] : null;
1015
+ const { generatedOffset } = section;
1016
+
1017
+ const lineShift = generatedOffset.generatedLine - 1;
1018
+ const columnShift = generatedOffset.generatedColumn - 1;
1019
+
1020
+ section.consumer.eachMapping(
1021
+ function (mapping) {
1022
+ if (mapping.generatedLine === 1) {
1023
+ mapping.generatedColumn += columnShift;
1024
+
1025
+ if (typeof mapping.lastGeneratedColumn === "number") {
1026
+ mapping.lastGeneratedColumn += columnShift;
1027
+ }
1028
+ }
1029
+
1030
+ if (
1031
+ mapping.lastGeneratedColumn === Infinity &&
1032
+ nextSection &&
1033
+ mapping.generatedLine === nextSection.generatedOffset.generatedLine
1034
+ ) {
1035
+ mapping.lastGeneratedColumn =
1036
+ nextSection.generatedOffset.generatedColumn - 2;
1037
+ }
1038
+ mapping.generatedLine += lineShift;
1039
+
1040
+ aCallback.call(this, mapping);
1041
+ },
1042
+ aContext,
1043
+ aOrder
1044
+ );
1045
+ });
1046
+ }
1047
+
1048
+ computeColumnSpans() {
1049
+ for (let i = 0; i < this._sections.length; i++) {
1050
+ this._sections[i].consumer.computeColumnSpans();
1051
+ }
1052
+ }
1053
+
1054
+ destroy() {
1055
+ for (let i = 0; i < this._sections.length; i++) {
1056
+ this._sections[i].consumer.destroy();
1057
+ }
1058
+ }
1059
+ }
1060
+ exports.IndexedSourceMapConsumer = IndexedSourceMapConsumer;
1061
+
1062
+ /*
1063
+ * Cheat to get around inter-twingled classes. `factory()` can be at the end
1064
+ * where it has access to non-hoisted classes, but it gets hoisted itself.
1065
+ */
1066
+ function _factory(aSourceMap, aSourceMapURL) {
1067
+ let sourceMap = aSourceMap;
1068
+ if (typeof aSourceMap === "string") {
1069
+ sourceMap = util.parseSourceMapInput(aSourceMap);
1070
+ }
1071
+
1072
+ const consumer =
1073
+ sourceMap.sections != null
1074
+ ? new IndexedSourceMapConsumer(sourceMap, aSourceMapURL)
1075
+ : new BasicSourceMapConsumer(sourceMap, aSourceMapURL);
1076
+ return Promise.resolve(consumer);
1077
+ }
1078
+
1079
+ function _factoryBSM(aSourceMap, aSourceMapURL) {
1080
+ return BasicSourceMapConsumer.fromSourceMap(aSourceMap, aSourceMapURL);
1081
+ }