@absolutejs/absolute 0.20.0-beta.169 → 0.20.0-beta.170

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 (238) hide show
  1. package/CHANGELOG.md +80 -0
  2. package/README.md +232 -0
  3. package/changelog.json +228 -0
  4. package/dist/angular/browser.js +7 -8
  5. package/dist/angular/browser.js.map +6 -5
  6. package/dist/angular/components/core/streamingSlotRegistrar.js +6 -2
  7. package/dist/angular/components/core/streamingSlotRegistry.js +7 -3
  8. package/dist/angular/index.js +555 -156
  9. package/dist/angular/index.js.map +29 -23
  10. package/dist/angular/server.js +555 -156
  11. package/dist/angular/server.js.map +29 -23
  12. package/dist/build/buildWorker.js +14 -8
  13. package/dist/build.js +4949 -1941
  14. package/dist/build.js.map +72 -42
  15. package/dist/cli/{add-7azr0c83.js → add-6a7pjkn9.js} +11 -7
  16. package/dist/cli/{analyze-3cyek6v3.js → analyze-606fshwa.js} +1 -1
  17. package/dist/cli/{build-25rz8v25.js → build-g81xqbb9.js} +1 -1
  18. package/dist/cli/{compile-4jnfxts9.js → compile-9y1w9zpj.js} +3 -3
  19. package/dist/cli/config/server.js +10699 -1538
  20. package/dist/cli/{dev-9tk5hn2e.js → dev-hyeb89hp.js} +5 -1
  21. package/dist/cli/{doctor-4nv2c2j3.js → doctor-h55y9hj1.js} +1 -1
  22. package/dist/cli/{generate-v75p2fct.js → generate-20x1pkf7.js} +4 -4
  23. package/dist/cli/{htmx-427swtdz.js → htmx-6mz2h7k1.js} +2 -2
  24. package/dist/cli/{index-bhbs6d5z.js → index-32ge2w1f.js} +12 -4
  25. package/dist/cli/{index-a4ws2jwd.js → index-3wz3mktm.js} +1 -1
  26. package/dist/cli/{index-b7hjgknf.js → index-9sksd8c8.js} +13 -4
  27. package/dist/cli/{index-eyzwc7gz.js → index-qbrzvmh9.js} +4 -2
  28. package/dist/cli/index-qw98g1p6.js +269 -0
  29. package/dist/cli/{index-434b7j4a.js → index-vtp20gwf.js} +69 -1
  30. package/dist/cli/{index-h7qhz02e.js → index-wk0pyxrg.js} +3 -0
  31. package/dist/cli/{index-k3y8cb6c.js → index-z6f43b20.js} +1 -1
  32. package/dist/cli/index.js +16 -16
  33. package/dist/cli/{islands-8sgky9gh.js → islands-dc54e5y1.js} +1 -1
  34. package/dist/cli/{ls-4m4yqwww.js → ls-b6zz24nt.js} +1 -1
  35. package/dist/cli/{mobile-hcxjr2gf.js → mobile-ajnnvqtv.js} +3 -3
  36. package/dist/cli/prerender-fqpp0m1j.js +10 -0
  37. package/dist/cli/{remove-1ycjx85k.js → remove-t8x1mrxg.js} +4 -4
  38. package/dist/cli/{start-mbaejxhm.js → start-d6p831ny.js} +3 -3
  39. package/dist/cli/{typecheck-dr068pmh.js → typecheck-stbt0qt5.js} +6 -1
  40. package/dist/cli/{workspace-1sycp9g1.js → workspace-61hh6jq1.js} +1 -1
  41. package/dist/client/chunks/index-6b66nzyf.js +381 -0
  42. package/dist/client/chunks/index-6b66nzyf.js.map +11 -0
  43. package/dist/client/chunks/{islands-rc28k5sx.js → islands-s2ta5ajb.js} +5 -2
  44. package/dist/client/chunks/{islands-rc28k5sx.js.map → islands-s2ta5ajb.js.map} +7 -6
  45. package/dist/client/index.js +160 -3
  46. package/dist/client/index.js.map +6 -4
  47. package/dist/client/navigation.js +764 -0
  48. package/dist/client/navigation.js.map +10 -0
  49. package/dist/client/prefetch.js +33 -375
  50. package/dist/client/prefetch.js.map +3 -4
  51. package/dist/core/streamingSlotRegistrar.js +5 -2
  52. package/dist/core/streamingSlotRegistrar.js.map +5 -4
  53. package/dist/core/streamingSlotRegistry.js +5 -2
  54. package/dist/core/streamingSlotRegistry.js.map +5 -4
  55. package/dist/dev/client/cspNonce.ts +28 -0
  56. package/dist/dev/client/handlers/html.ts +4 -3
  57. package/dist/dev/client/handlers/htmx.ts +3 -2
  58. package/dist/dev/client/handlers/svelte.ts +15 -90
  59. package/dist/dev/client/syncDevtools.ts +2 -1
  60. package/dist/dev/serverBootstrap.js +11 -4
  61. package/dist/i18n/index.js +543 -0
  62. package/dist/i18n/index.js.map +15 -0
  63. package/dist/index.js +6339 -2233
  64. package/dist/index.js.map +89 -54
  65. package/dist/islands/index.js +282 -40
  66. package/dist/islands/index.js.map +14 -10
  67. package/dist/mobile/browser.js +7 -2
  68. package/dist/mobile/browser.js.map +5 -4
  69. package/dist/mobile/index.js +7 -2
  70. package/dist/mobile/index.js.map +5 -4
  71. package/dist/mobile/remoteMacAgentEntry.js +1 -1
  72. package/dist/react/components/browser/index.js +94 -4
  73. package/dist/react/components/index.js +150 -10
  74. package/dist/react/components/index.js.map +15 -10
  75. package/dist/react/hooks/index.js +479 -13
  76. package/dist/react/hooks/index.js.map +12 -4
  77. package/dist/react/index.js +769 -166
  78. package/dist/react/index.js.map +32 -21
  79. package/dist/react/router/browser.js +21 -4
  80. package/dist/react/router/browser.js.map +5 -4
  81. package/dist/react/router/index.js +21 -4
  82. package/dist/react/router/index.js.map +5 -4
  83. package/dist/react/server.js +597 -203
  84. package/dist/react/server.js.map +25 -15
  85. package/dist/src/angular/zoneRuntime.d.ts +5 -0
  86. package/dist/src/build/buildReactServerComponents.d.ts +22 -0
  87. package/dist/src/build/downlevelAsyncForZone.d.ts +1 -0
  88. package/dist/src/build/fileRoutes.d.ts +65 -0
  89. package/dist/src/build/fonts/buildFonts.d.ts +25 -0
  90. package/dist/src/build/fonts/fallbackMetrics.d.ts +13 -0
  91. package/dist/src/build/fonts/googleFonts.d.ts +18 -0
  92. package/dist/src/build/fonts/injectFontTags.d.ts +7 -0
  93. package/dist/src/build/fonts/parseFontMetrics.d.ts +4 -0
  94. package/dist/src/build/generateReactIndexes.d.ts +7 -1
  95. package/dist/src/build/htmlIncludes.d.ts +16 -0
  96. package/dist/src/build/inlineSourceMapComment.d.ts +1 -0
  97. package/dist/src/build/scanConventions.d.ts +3 -0
  98. package/dist/src/build/vitals.d.ts +21 -0
  99. package/dist/src/client/formActions.d.ts +29 -0
  100. package/dist/src/client/index.d.ts +2 -0
  101. package/dist/src/client/navigation.d.ts +16 -0
  102. package/dist/src/client/prefetch.d.ts +2 -30
  103. package/dist/src/core/build.d.ts +2 -2
  104. package/dist/src/core/cspNonce.d.ts +12 -0
  105. package/dist/src/core/fileRouteAdapter.d.ts +15 -0
  106. package/dist/src/core/fileRoutes.d.ts +5 -0
  107. package/dist/src/core/formActionFlash.d.ts +25 -0
  108. package/dist/src/core/formActions.d.ts +249 -0
  109. package/dist/src/core/index.d.ts +5 -0
  110. package/dist/src/core/partialPrerender.d.ts +28 -0
  111. package/dist/src/core/partialPrerenderServe.d.ts +24 -0
  112. package/dist/src/core/precompressed.d.ts +11 -1
  113. package/dist/src/core/prerenderNonce.d.ts +9 -0
  114. package/dist/src/core/productionRuntime.d.ts +4 -2
  115. package/dist/src/core/serverOnlyStaticFiles.d.ts +8 -0
  116. package/dist/src/core/staticHtmlNonce.d.ts +2 -0
  117. package/dist/src/core/vitals.d.ts +108 -0
  118. package/dist/src/dev/angular/fastHmrCompiler.d.ts +1 -1
  119. package/dist/src/dev/client/cspNonce.d.ts +2 -0
  120. package/dist/src/dev/fileRouteRefresher.d.ts +5 -0
  121. package/dist/src/dev/importCost/instrument.d.ts +1 -1
  122. package/dist/src/dev/reactServerComponentsRebuild.d.ts +3 -0
  123. package/dist/src/i18n/defineMessages.d.ts +5 -0
  124. package/dist/src/i18n/formatMessage.d.ts +26 -0
  125. package/dist/src/i18n/index.d.ts +6 -0
  126. package/dist/src/i18n/intlCache.d.ts +5 -0
  127. package/dist/src/i18n/routing.d.ts +28 -0
  128. package/dist/src/i18n/translator.d.ts +11 -0
  129. package/dist/src/mobile/androidRelease.d.ts +2 -2
  130. package/dist/src/mobile/iosRelease.d.ts +4 -4
  131. package/dist/src/mobile/materializedBundle.d.ts +1 -1
  132. package/dist/src/mobile/mobileInspect.d.ts +1 -1
  133. package/dist/src/mobile/releaseArtifact.d.ts +2 -2
  134. package/dist/src/mobile/remoteMacProtocol.d.ts +2 -2
  135. package/dist/src/plugins/i18n.d.ts +30 -0
  136. package/dist/src/plugins/index.d.ts +2 -1
  137. package/dist/src/plugins/secureHeaders.d.ts +48 -0
  138. package/dist/src/react/components/Head.d.ts +1 -1
  139. package/dist/src/react/components/StreamSlot.browser.d.ts +1 -0
  140. package/dist/src/react/components/StreamSlot.d.ts +5 -1
  141. package/dist/src/react/components/SuspenseSlot.browser.d.ts +2 -0
  142. package/dist/src/react/components/SuspenseSlot.d.ts +12 -0
  143. package/dist/src/react/fileRoute.d.ts +18 -0
  144. package/dist/src/react/hooks/index.d.ts +4 -0
  145. package/dist/src/react/hooks/useFormAction.d.ts +42 -0
  146. package/dist/src/react/hooks/useI18n.d.ts +15 -0
  147. package/dist/src/react/index.d.ts +2 -0
  148. package/dist/src/react/server.d.ts +2 -0
  149. package/dist/src/react/serverComponents/constants.d.ts +11 -0
  150. package/dist/src/react/serverComponents/flightPayload.d.ts +2 -0
  151. package/dist/src/react/serverComponents/pageHandler.d.ts +14 -0
  152. package/dist/src/svelte/browser.d.ts +1 -0
  153. package/dist/src/svelte/fileRoute.d.ts +15 -0
  154. package/dist/src/svelte/i18n.d.ts +8 -0
  155. package/dist/src/svelte/index.d.ts +2 -0
  156. package/dist/src/svelte/lowerAwaitSlotSyntax.d.ts +5 -1
  157. package/dist/src/svelte/renderToReadableStream.d.ts +10 -2
  158. package/dist/src/svelte/router/browser.d.ts +3 -1
  159. package/dist/src/svelte/router/goto.d.ts +13 -10
  160. package/dist/src/svelte/router/guards.d.ts +43 -0
  161. package/dist/src/svelte/router/index.d.ts +3 -1
  162. package/dist/src/svelte/router/lazy.d.ts +17 -0
  163. package/dist/src/svelte/router/lazyModule.d.ts +29 -0
  164. package/dist/src/svelte/router/navigation.d.ts +55 -0
  165. package/dist/src/svelte/router/pushState.d.ts +4 -2
  166. package/dist/src/svelte/router/scroll.d.ts +34 -0
  167. package/dist/src/svelte/routerSsr.d.ts +9 -0
  168. package/dist/src/svelte/server.d.ts +1 -0
  169. package/dist/src/utils/cspNonceRef.d.ts +8 -0
  170. package/dist/src/utils/fontAssets.d.ts +17 -0
  171. package/dist/src/utils/formActionProtocol.d.ts +10 -0
  172. package/dist/src/utils/generateHeadElement.d.ts +1 -1
  173. package/dist/src/utils/index.d.ts +1 -0
  174. package/dist/src/utils/inlinePageCss.d.ts +18 -0
  175. package/dist/src/utils/loadConfig.d.ts +5 -0
  176. package/dist/src/utils/localeRef.d.ts +10 -0
  177. package/dist/src/utils/resolveConvention.d.ts +6 -1
  178. package/dist/src/utils/streamingSlots.d.ts +5 -0
  179. package/dist/src/vue/browser.d.ts +2 -0
  180. package/dist/src/vue/components/Image.d.ts +2 -2
  181. package/dist/src/vue/index.d.ts +2 -0
  182. package/dist/src/vue/serverDataPayload.d.ts +32 -0
  183. package/dist/src/vue/serverDataState.d.ts +9 -0
  184. package/dist/src/vue/useServerData.browser.d.ts +6 -0
  185. package/dist/src/vue/useServerData.d.ts +24 -0
  186. package/dist/svelte/browser.js +330 -3
  187. package/dist/svelte/browser.js.map +8 -4
  188. package/dist/svelte/components/AwaitSlot.svelte +5 -0
  189. package/dist/svelte/components/Head.svelte +50 -0
  190. package/dist/svelte/components/JsonLd.svelte +9 -1
  191. package/dist/svelte/components/StreamSlot.svelte +5 -0
  192. package/dist/svelte/index.js +1017 -117
  193. package/dist/svelte/index.js.map +38 -24
  194. package/dist/svelte/router/Link.svelte +40 -8
  195. package/dist/svelte/router/Route.svelte +157 -12
  196. package/dist/svelte/router/Route.svelte.d.ts +39 -5
  197. package/dist/svelte/router/Router.svelte +140 -25
  198. package/dist/svelte/router/Router.svelte.d.ts +5 -1
  199. package/dist/svelte/router/browser.ts +10 -0
  200. package/dist/svelte/router/goto.ts +15 -86
  201. package/dist/svelte/router/guards.ts +112 -0
  202. package/dist/svelte/router/index.ts +10 -0
  203. package/dist/svelte/router/lazy.ts +82 -0
  204. package/dist/svelte/router/lazyModule.ts +74 -0
  205. package/dist/svelte/router/navigation.ts +412 -0
  206. package/dist/svelte/router/pushState.ts +7 -4
  207. package/dist/svelte/router/scroll.ts +286 -0
  208. package/dist/svelte/server.js +747 -252
  209. package/dist/svelte/server.js.map +30 -20
  210. package/dist/types/angular.d.ts +2 -0
  211. package/dist/types/build.d.ts +37 -0
  212. package/dist/types/conventions.d.ts +3 -0
  213. package/dist/types/fileRoutes.d.ts +72 -0
  214. package/dist/types/fonts.d.ts +86 -0
  215. package/dist/types/formAction.d.ts +54 -0
  216. package/dist/types/globals.d.ts +10 -0
  217. package/dist/types/i18n.d.ts +185 -0
  218. package/dist/types/index.d.ts +4 -0
  219. package/dist/types/metadata.d.ts +11 -0
  220. package/dist/types/navigation.d.ts +37 -0
  221. package/dist/types/prefetch.d.ts +10 -0
  222. package/dist/types/sitemap.d.ts +4 -0
  223. package/dist/types/svelteRouter.d.ts +89 -2
  224. package/dist/types/svelteRouter.ts +112 -2
  225. package/dist/types/vue.d.ts +46 -1
  226. package/dist/utils/iconVersion.ts +34 -0
  227. package/dist/vue/browser.js +107 -11
  228. package/dist/vue/browser.js.map +7 -4
  229. package/dist/vue/components/index.js +5 -2
  230. package/dist/vue/components/index.js.map +5 -4
  231. package/dist/vue/index.js +712 -158
  232. package/dist/vue/index.js.map +32 -23
  233. package/dist/vue/server.js +310 -79
  234. package/dist/vue/server.js.map +20 -15
  235. package/package.json +9 -1
  236. package/dist/cli/prerender-mfnwsvyt.js +0 -7
  237. package/dist/src/plugins/pageRouter.d.ts +0 -1
  238. /package/dist/cli/{index-j7m8pq48.js → index-rervww4p.js} +0 -0
@@ -107,6 +107,37 @@ var init_constants = __esm(() => {
107
107
  TWO_THIRDS = 2 / 3;
108
108
  });
109
109
 
110
+ // src/utils/escapeScriptContent.ts
111
+ var ESCAPE_LOOKUP, ESCAPE_REGEX, escapeScriptContent = (content) => content.replace(ESCAPE_REGEX, (char) => {
112
+ const escaped = ESCAPE_LOOKUP[char];
113
+ return escaped !== undefined ? escaped : char;
114
+ });
115
+ var init_escapeScriptContent = __esm(() => {
116
+ ESCAPE_LOOKUP = {
117
+ "\u2028": "\\u2028",
118
+ "\u2029": "\\u2029",
119
+ "<": "\\u003C"
120
+ };
121
+ ESCAPE_REGEX = /[<\u2028\u2029]/g;
122
+ });
123
+
124
+ // src/utils/cspNonceRef.ts
125
+ var GETTER_KEY, nonceAttr = (nonce = readCspNonce()) => nonce ? ` nonce="${nonce}"` : "", nonceSvelteHeadStyles = (head, nonce = readCspNonce()) => nonce ? head.replace(/<style(?=\s+id="svelte-[^"]*")(?![^>]*\snonce=)/g, `<style nonce="${nonce}"`) : head, readCspNonce = () => {
126
+ const getter = Reflect.get(globalThis, GETTER_KEY);
127
+ if (typeof getter !== "function")
128
+ return;
129
+ const nonce = getter();
130
+ return typeof nonce === "string" ? nonce : undefined;
131
+ }, registerCspNonceGetter = (getter) => {
132
+ Reflect.set(globalThis, GETTER_KEY, getter);
133
+ };
134
+ var init_cspNonceRef = __esm(() => {
135
+ GETTER_KEY = Symbol.for("absolutejs.cspNonceGetter");
136
+ });
137
+
138
+ // src/utils/runtimeMode.ts
139
+ var ENV_VAR = "NODE_ENV", getNodeEnv = () => process.env[ENV_VAR], isDevelopmentRuntime = () => process.env[ENV_VAR] === "development", isProductionRuntime = () => process.env[ENV_VAR] === "production";
140
+
110
141
  // src/utils/getDurationString.ts
111
142
  var getDurationString = (duration) => {
112
143
  let durationString;
@@ -303,15 +334,15 @@ var ISLAND_BOOTSTRAP_MANIFEST_KEY = "AbsoluteIslandBootstrap", LEGACY_ISLAND_BOO
303
334
  var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__", ISLAND_STATE_MARKER = "__ABS_ISLAND_STATE__", CLOSING_HEAD_TAG = "</head>", warnedMissingBootstrap = false, warnIfBootstrapMissing = (manifest) => {
304
335
  if (warnedMissingBootstrap || getIslandBootstrapPath(manifest))
305
336
  return;
306
- if (false)
307
- ;
337
+ if (isProductionRuntime())
338
+ return;
308
339
  warnedMissingBootstrap = true;
309
340
  logWarn("A page contains islands, but the build manifest has no islands bootstrap, so they will render without hydrating. Set `islands.registry` in absolute.config.ts (a default bootstrap is generated from it) or point `islands.bootstrap` at a file that calls startIslands().");
310
341
  }, buildIslandsHeadMarkup = (manifest) => {
311
- const manifestScript = `<script>window.__ABSOLUTE_MANIFEST__ = ${JSON.stringify(manifest)}</script>`;
312
- const islandStateScript = `<script>window.__ABS_ISLAND_STATE__ = ${JSON.stringify(globalThis.__ABS_ISLAND_STATE__ ?? {})}</script>`;
342
+ const manifestScript = `<script${nonceAttr()}>window.__ABSOLUTE_MANIFEST__ = ${escapeScriptContent(JSON.stringify(manifest))}</script>`;
343
+ const islandStateScript = `<script${nonceAttr()}>window.__ABS_ISLAND_STATE__ = ${escapeScriptContent(JSON.stringify(globalThis.__ABS_ISLAND_STATE__ ?? {}))}</script>`;
313
344
  const bootstrapPath = getIslandBootstrapPath(manifest);
314
- const bootstrapScript = bootstrapPath ? `<script type="module" src="${bootstrapPath}"></script>` : "";
345
+ const bootstrapScript = bootstrapPath ? `<script${nonceAttr()} type="module" src="${bootstrapPath}"></script>` : "";
315
346
  return `${manifestScript}${islandStateScript}${bootstrapScript}`;
316
347
  }, injectHeadMarkup = (html, markup) => {
317
348
  const closingHeadIndex = html.indexOf("</head>");
@@ -512,6 +543,8 @@ var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST
512
543
  globalThis.__absoluteManifest = manifest;
513
544
  };
514
545
  var init_islandPageContext = __esm(() => {
546
+ init_escapeScriptContent();
547
+ init_cspNonceRef();
515
548
  init_logger();
516
549
  });
517
550
 
@@ -558,7 +591,7 @@ var siblingCssCache, clearSiblingCssCache = () => {
558
591
  }, injectInlineCss = (headTag, css) => {
559
592
  if (!css)
560
593
  return headTag;
561
- const styleBlock = `<style data-absolute-page-css>${css}</style>`;
594
+ const styleBlock = `<style data-absolute-page-css${nonceAttr()}>${css}</style>`;
562
595
  return headTag.replace("</head>", `${styleBlock}</head>`);
563
596
  }, readSiblingCss = async (siblingJsPath) => {
564
597
  if (!siblingJsPath)
@@ -580,6 +613,7 @@ var siblingCssCache, clearSiblingCssCache = () => {
580
613
  }
581
614
  };
582
615
  var init_inlinePageCss = __esm(() => {
616
+ init_cspNonceRef();
583
617
  siblingCssCache = new Map;
584
618
  });
585
619
 
@@ -607,7 +641,7 @@ var errorPageHtml = ({
607
641
  <meta charset="utf-8">
608
642
  <meta name="viewport" content="width=device-width, initial-scale=1">
609
643
  <title>SSR Error - AbsoluteJS</title>
610
- <style>
644
+ <style${nonceAttr()}>
611
645
  *{margin:0;padding:0;box-sizing:border-box}
612
646
  body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,rgba(30,41,59,0.98) 100%);color:#e2e8f0;font-family:"JetBrains Mono","Fira Code",ui-monospace,SFMono-Regular,Menlo,Monaco,Consolas,monospace;font-size:14px;line-height:1.6;display:flex;align-items:flex-start;justify-content:center;padding:32px}
613
647
  .card{max-width:720px;width:100%;background:rgba(30,41,59,0.6);border:1px solid rgba(71,85,105,0.5);border-radius:16px;box-shadow:0 25px 50px -12px rgba(0,0,0,0.5),0 0 0 1px rgba(255,255,255,0.05);overflow:hidden}
@@ -639,20 +673,23 @@ body{min-height:100vh;background:linear-gradient(135deg,rgba(15,23,42,0.98) 0%,r
639
673
  ${script}
640
674
  </body>
641
675
  </html>`;
642
- }, RELOAD_ON_REBUILD = `<script>(()=>{const url=(location.protocol==='https:'?'wss://':'ws://')+location.host+'/hmr';let seen=false;const connect=()=>{const socket=new WebSocket(url);socket.onopen=()=>{if(seen)location.reload();seen=true;};socket.onmessage=(event)=>{try{const message=JSON.parse(event.data);const type=message&&typeof message.type==='string'?message.type:'';if(type==='rebuild-complete'||type==='server-entry-reloaded'||type.endsWith('-update'))location.reload();}catch{}};socket.onclose=()=>setTimeout(connect,500);};connect();})();</script>`, buildErrorPage = (framework, pageName, error) => errorPageHtml({
676
+ }, reloadOnRebuild = () => `<script${nonceAttr()}>(()=>{const url=(location.protocol==='https:'?'wss://':'ws://')+location.host+'/hmr';let seen=false;const connect=()=>{const socket=new WebSocket(url);socket.onopen=()=>{if(seen)location.reload();seen=true;};socket.onmessage=(event)=>{try{const message=JSON.parse(event.data);const type=message&&typeof message.type==='string'?message.type:'';if(type==='rebuild-complete'||type==='server-entry-reloaded'||type.endsWith('-update'))location.reload();}catch{}};socket.onclose=()=>setTimeout(connect,500);};connect();})();</script>`, buildErrorPage = (framework, pageName, error) => errorPageHtml({
643
677
  framework,
644
678
  hint: "Fix the file and save. This page reloads by itself when the build succeeds.",
645
679
  kind: "Build Error",
646
680
  message: `${pageName || "This page"} could not be built.
647
681
 
648
682
  ${error ?? "The dev-server terminal has the build output."}`,
649
- script: RELOAD_ON_REBUILD
683
+ script: reloadOnRebuild()
650
684
  }), ssrErrorPage = (framework, error) => errorPageHtml({
651
685
  framework,
652
686
  hint: "A component threw during server-side rendering. Check the terminal for the full stack trace.",
653
687
  kind: "Server Render Error",
654
688
  message: error instanceof Error ? error.message : String(error)
655
689
  });
690
+ var init_ssrErrorPage = __esm(() => {
691
+ init_cspNonceRef();
692
+ });
656
693
 
657
694
  // src/utils/stringModifiers.ts
658
695
  var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-9\-_]+/g, "").replace(/[-_]{2,}/g, "-"), toKebab = (str) => normalizeSlug(str).replace(/([a-z0-9])([A-Z])/g, "$1-$2").toLowerCase(), toPascal = (str) => {
@@ -662,6 +699,45 @@ var normalizeSlug = (str) => str.trim().replace(/\s+/g, "-").replace(/[^A-Za-z0-
662
699
  return normalizeSlug(str).split(/[-_]/).filter(Boolean).map((segment) => segment.charAt(0).toUpperCase() + segment.slice(1).toLowerCase()).join("");
663
700
  };
664
701
 
702
+ // src/core/staticHtmlNonce.ts
703
+ var nonceStaticHtml = async (html, nonce = readCspNonce()) => {
704
+ if (!nonce)
705
+ return html;
706
+ const stamp = {
707
+ element: (element) => {
708
+ if (!element.hasAttribute("nonce"))
709
+ element.setAttribute("nonce", nonce);
710
+ }
711
+ };
712
+ return new HTMLRewriter().on("script", stamp).on("style", stamp).transform(new Response(html)).text();
713
+ }, isRecord = (value) => typeof value === "object" && value !== null && !Array.isArray(value), parseHtmxConfig = (content) => {
714
+ try {
715
+ const parsed = JSON.parse(content ?? "{}");
716
+ return isRecord(parsed) ? parsed : {};
717
+ } catch {
718
+ return {};
719
+ }
720
+ }, withHtmxStyleNonce = async (html, nonce = readCspNonce()) => {
721
+ if (!nonce)
722
+ return html;
723
+ let found = false;
724
+ const merged = await new HTMLRewriter().on('meta[name="htmx-config"]', {
725
+ element: (element) => {
726
+ found = true;
727
+ const config = parseHtmxConfig(element.getAttribute("content"));
728
+ element.setAttribute("content", JSON.stringify({ ...config, inlineStyleNonce: nonce }));
729
+ }
730
+ }).transform(new Response(html)).text();
731
+ if (found)
732
+ return merged;
733
+ const meta = `<meta name="htmx-config" content='${JSON.stringify({ inlineStyleNonce: nonce })}'>`;
734
+ const headClose = merged.search(/<\/head>/i);
735
+ return headClose >= 0 ? `${merged.slice(0, headClose)}${meta}${merged.slice(headClose)}` : `${meta}${merged}`;
736
+ };
737
+ var init_staticHtmlNonce = __esm(() => {
738
+ init_cspNonceRef();
739
+ });
740
+
665
741
  // src/utils/resolveConvention.ts
666
742
  import { basename } from "path";
667
743
  var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boolean(value) && typeof value === "object", getMap = () => {
@@ -698,7 +774,7 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
698
774
  return conventions.defaults?.error;
699
775
  }, resolveNotFoundConventionPath = (framework) => getMap()[framework]?.defaults?.notFound, setConventions = (map) => {
700
776
  Reflect.set(globalThis, CONVENTIONS_KEY, map);
701
- }, isDev = () => true, buildErrorProps = (error) => {
777
+ }, isDev = () => isDevelopmentRuntime(), buildErrorProps = (error) => {
702
778
  if (error instanceof Error) {
703
779
  return {
704
780
  message: error.message,
@@ -715,7 +791,9 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
715
791
  if (typeof ErrorComponent !== "function")
716
792
  return null;
717
793
  const element = createElement(ErrorComponent, errorProps);
718
- const stream = await renderToReadableStream(element);
794
+ const stream = await renderToReadableStream(element, {
795
+ nonce: readCspNonce()
796
+ });
719
797
  return new Response(stream, {
720
798
  headers: { "Content-Type": "text/html" },
721
799
  status: 500
@@ -726,10 +804,12 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
726
804
  const ErrorComponent = mod.default;
727
805
  if (!ErrorComponent)
728
806
  return null;
807
+ const nonce = readCspNonce();
729
808
  const { head, body } = render(ErrorComponent, {
730
- props: errorProps
809
+ props: errorProps,
810
+ ...nonce ? { csp: { nonce } } : {}
731
811
  });
732
- const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
812
+ const html = `<!DOCTYPE html><html><head>${nonceSvelteHeadStyles(head)}</head><body>${body}</body></html>`;
733
813
  return new Response(html, {
734
814
  headers: { "Content-Type": "text/html" },
735
815
  status: 500
@@ -737,7 +817,7 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
737
817
  }, unescapeVueStyles = (ssrBody) => {
738
818
  let styles = "";
739
819
  const body = ssrBody.replace(/<style>([\s\S]*?)<\/style>/g, (_, css) => {
740
- styles += `<style>${css.replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")}</style>`;
820
+ styles += `<style${nonceAttr()}>${css.replace(/&quot;/g, '"').replace(/&amp;/g, "&").replace(/&lt;/g, "<").replace(/&gt;/g, ">")}</style>`;
741
821
  return "";
742
822
  });
743
823
  return { body, styles };
@@ -769,7 +849,7 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
769
849
  status: 500
770
850
  });
771
851
  }, escapeHtml = (value) => value.replace(/&/g, "&amp;").replace(/</g, "&lt;").replace(/>/g, "&gt;").replace(/"/g, "&quot;").replace(/'/g, "&#39;"), replaceErrorTokens = (template, errorProps) => template.replace(/\{\{\s*name\s*\}\}/g, escapeHtml(errorProps.name)).replace(/\{\{\s*message\s*\}\}/g, escapeHtml(errorProps.message)).replace(/\{\{\s*stack\s*\}\}/g, errorProps.stack ? escapeHtml(errorProps.stack) : ""), renderHtmlError = async (conventionPath, errorProps) => {
772
- const template = await Bun.file(conventionPath).text();
852
+ const template = await nonceStaticHtml(await Bun.file(conventionPath).text());
773
853
  const html = replaceErrorTokens(template, errorProps);
774
854
  return new Response(html, {
775
855
  headers: { "Content-Type": "text/html" },
@@ -824,7 +904,9 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
824
904
  if (typeof NotFoundComponent !== "function")
825
905
  return null;
826
906
  const element = createElement(NotFoundComponent);
827
- const stream = await renderToReadableStream(element);
907
+ const stream = await renderToReadableStream(element, {
908
+ nonce: readCspNonce()
909
+ });
828
910
  return new Response(stream, {
829
911
  headers: { "Content-Type": "text/html" },
830
912
  status: 404
@@ -835,8 +917,9 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
835
917
  const NotFoundComponent = mod.default;
836
918
  if (!NotFoundComponent)
837
919
  return null;
838
- const { head, body } = render(NotFoundComponent);
839
- const html = `<!DOCTYPE html><html><head>${head}</head><body>${body}</body></html>`;
920
+ const nonce = readCspNonce();
921
+ const { head, body } = render(NotFoundComponent, nonce ? { csp: { nonce } } : {});
922
+ const html = `<!DOCTYPE html><html><head>${nonceSvelteHeadStyles(head)}</head><body>${body}</body></html>`;
840
923
  return new Response(html, {
841
924
  headers: { "Content-Type": "text/html" },
842
925
  status: 404
@@ -869,7 +952,7 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
869
952
  status: 404
870
953
  });
871
954
  }, renderHtmlNotFound = async (conventionPath) => {
872
- const html = await Bun.file(conventionPath).text();
955
+ const html = await nonceStaticHtml(await Bun.file(conventionPath).text());
873
956
  return new Response(html, {
874
957
  headers: { "Content-Type": "text/html" },
875
958
  status: 404
@@ -887,7 +970,7 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
887
970
  logConventionRenderError(framework, "not-found", renderError);
888
971
  }
889
972
  return null;
890
- }, NOT_FOUND_PRIORITY, renderFirstNotFound = async () => {
973
+ }, NOT_FOUND_PRIORITY, renderFirstNotFound = async (options = {}) => {
891
974
  const renderNext = async (frameworks) => {
892
975
  const [framework, ...remaining] = frameworks;
893
976
  if (!framework) {
@@ -902,13 +985,16 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
902
985
  }
903
986
  return renderNext(remaining);
904
987
  };
905
- return renderNext(NOT_FOUND_PRIORITY);
988
+ return renderNext(options.preferHtmx ? ["htmx", ...NOT_FOUND_PRIORITY.filter((key) => key !== "htmx")] : NOT_FOUND_PRIORITY);
906
989
  };
907
990
  var init_resolveConvention = __esm(() => {
991
+ init_cspNonceRef();
992
+ init_staticHtmlNonce();
908
993
  ERROR_RENDERERS = {
909
994
  angular: renderAngularError,
910
995
  ember: renderEmberError,
911
996
  html: renderHtmlError,
997
+ htmx: renderHtmlError,
912
998
  react: renderReactError,
913
999
  svelte: renderSvelteError,
914
1000
  vue: renderVueError
@@ -917,6 +1003,7 @@ var init_resolveConvention = __esm(() => {
917
1003
  angular: renderAngularNotFound,
918
1004
  ember: renderEmberNotFound,
919
1005
  html: renderHtmlNotFound,
1006
+ htmx: renderHtmlNotFound,
920
1007
  react: renderReactNotFound,
921
1008
  svelte: renderSvelteNotFound,
922
1009
  vue: renderVueNotFound
@@ -926,7 +1013,8 @@ var init_resolveConvention = __esm(() => {
926
1013
  "svelte",
927
1014
  "vue",
928
1015
  "angular",
929
- "html"
1016
+ "html",
1017
+ "htmx"
930
1018
  ];
931
1019
  });
932
1020
 
@@ -985,7 +1073,7 @@ var scriptRegistry, requestCounter = 0, getRequestId = () => `req_${Date.now()}_
985
1073
  })();`;
986
1074
  }).join(`
987
1075
  `);
988
- return `<script>
1076
+ return `<script${nonceAttr()}>
989
1077
  (function() {
990
1078
  ${scriptCode}
991
1079
  })();
@@ -1003,6 +1091,7 @@ ${scriptCode}
1003
1091
  return scriptArray;
1004
1092
  };
1005
1093
  var init_registerClientScript = __esm(() => {
1094
+ init_cspNonceRef();
1006
1095
  scriptRegistry = new Map;
1007
1096
  if (typeof globalThis !== "undefined") {
1008
1097
  Object.assign(globalThis, { registerClientScript });
@@ -1050,9 +1139,6 @@ var resolveAngularPackageDir = (specifier) => {
1050
1139
  };
1051
1140
  var init_resolveAngularPackage = () => {};
1052
1141
 
1053
- // src/utils/runtimeMode.ts
1054
- var ENV_VAR = "NODE_ENV", isDevelopmentRuntime = () => process.env[ENV_VAR] === "development", isProductionRuntime = () => process.env[ENV_VAR] === "production";
1055
-
1056
1142
  // src/angular/angularPatch.ts
1057
1143
  var ensureHead = (doc) => {
1058
1144
  if (!doc || doc.head || !doc.documentElement) {
@@ -1226,6 +1312,7 @@ var initDominoAdapter = (platformServer) => {
1226
1312
  APP_BASE_HREF: common.APP_BASE_HREF,
1227
1313
  bootstrapApplication: platformBrowser.bootstrapApplication,
1228
1314
  Component: core.Component,
1315
+ CSP_NONCE: core.CSP_NONCE,
1229
1316
  DomSanitizer: platformBrowser.DomSanitizer,
1230
1317
  ENVIRONMENT_INITIALIZER: core.ENVIRONMENT_INITIALIZER,
1231
1318
  inject: core.inject,
@@ -1233,6 +1320,7 @@ var initDominoAdapter = (platformServer) => {
1233
1320
  NgComponentOutlet: common.NgComponentOutlet,
1234
1321
  provideClientHydration: platformBrowser.provideClientHydration,
1235
1322
  provideServerRendering: platformServer.provideServerRendering,
1323
+ provideZoneChangeDetection: core.provideZoneChangeDetection,
1236
1324
  provideZonelessChangeDetection: core.provideZonelessChangeDetection,
1237
1325
  reflectComponentType: core.reflectComponentType,
1238
1326
  renderApplication: platformServer.renderApplication,
@@ -1345,7 +1433,7 @@ var init_browserTranslationAttributes = __esm(() => {
1345
1433
  });
1346
1434
 
1347
1435
  // src/core/browserTranslation.ts
1348
- var BASELINE_MARKER = "__ABSOLUTE_SSR_TEXT_BASELINES__", BROWSER_TRANSLATION_BASELINE_SCRIPT, browserTranslationBaselineTag = () => `<script>${BROWSER_TRANSLATION_BASELINE_SCRIPT}</script>`, injectBrowserTranslationBaseline = (html) => {
1436
+ var BASELINE_MARKER = "__ABSOLUTE_SSR_TEXT_BASELINES__", BROWSER_TRANSLATION_BASELINE_SCRIPT, browserTranslationBaselineTag = () => `<script${nonceAttr()}>${BROWSER_TRANSLATION_BASELINE_SCRIPT}</script>`, injectBrowserTranslationBaseline = (html) => {
1349
1437
  if (html.includes(BASELINE_MARKER))
1350
1438
  return html;
1351
1439
  const script = browserTranslationBaselineTag();
@@ -1355,6 +1443,7 @@ var BASELINE_MARKER = "__ABSOLUTE_SSR_TEXT_BASELINES__", BROWSER_TRANSLATION_BAS
1355
1443
  return `${html.slice(0, closingBodyIndex)}${script}${html.slice(closingBodyIndex)}`;
1356
1444
  };
1357
1445
  var init_browserTranslation = __esm(() => {
1446
+ init_cspNonceRef();
1358
1447
  init_browserTranslationAttributes();
1359
1448
  BROWSER_TRANSLATION_BASELINE_SCRIPT = "window.__ABSOLUTE_SSR_TEXT_BASELINES__=new WeakMap();" + "window.__ABSOLUTE_SSR_ATTRIBUTE_BASELINES__=new WeakMap();" + "{const r=document.body,b=window.__ABSOLUTE_SSR_TEXT_BASELINES__," + "a=window.__ABSOLUTE_SSR_ATTRIBUTE_BASELINES__;" + 'if(r)for(const e of [r,...r.querySelectorAll("*")]){' + "const t=new Map();for(const [i,n]of[...e.childNodes].entries())" + 'if(n.nodeType===3)t.set(i,n.nodeValue??"");if(t.size)b.set(e,t);' + `const v=new Map();for(const k of ${JSON.stringify(TRANSLATABLE_ATTRIBUTES)}){` + "const s=e.getAttribute(k);if(s!==null)v.set(k,s);}if(v.size)a.set(e,v);}}";
1360
1449
  });
@@ -1366,6 +1455,81 @@ var buildRequestProviders = (deps, request, requestContext, responseInit) => [
1366
1455
  { provide: deps.RESPONSE_INIT, useValue: responseInit ?? null }
1367
1456
  ];
1368
1457
 
1458
+ // src/angular/zoneRuntime.ts
1459
+ var ZONE_NODE_SPECIFIER = "zone.js/node", MISSING_ZONE_MESSAGE = 'angular.changeDetection is "zone" but zone.js could not be loaded. Install it in your app (bun add zone.js).', isAngularZoneMode = () => globalThis.__absoluteAngularChangeDetection === "zone", setAngularChangeDetection = (mode) => {
1460
+ globalThis.__absoluteAngularChangeDetection = mode ?? "zoneless";
1461
+ }, isRecord2 = (value) => typeof value === "object" && value !== null, adoptIntoNativePromise = (NativePromise, value) => {
1462
+ if (value instanceof NativePromise || !isRecord2(value))
1463
+ return value;
1464
+ const { then } = value;
1465
+ if (typeof then !== "function")
1466
+ return value;
1467
+ return new NativePromise((resolve, reject) => {
1468
+ Reflect.apply(then, value, [resolve, reject]);
1469
+ });
1470
+ }, wrapHandler = (NativePromise, handler) => {
1471
+ if (typeof handler !== "function")
1472
+ return handler;
1473
+ return function nativePromiseHandler(...args) {
1474
+ return adoptIntoNativePromise(NativePromise, Reflect.apply(handler, this, args));
1475
+ };
1476
+ }, wrapRoute = (NativePromise, route) => {
1477
+ if (typeof route === "function")
1478
+ return wrapHandler(NativePromise, route);
1479
+ if (!isRecord2(route) || route instanceof Response || route instanceof Blob)
1480
+ return route;
1481
+ return Object.fromEntries(Object.entries(route).map(([method, handler]) => [
1482
+ method,
1483
+ wrapHandler(NativePromise, handler)
1484
+ ]));
1485
+ }, wrapServeOptions = (NativePromise, options) => {
1486
+ if (!isRecord2(options))
1487
+ return options;
1488
+ const wrapped = { ...options };
1489
+ if (options.fetch)
1490
+ wrapped.fetch = wrapHandler(NativePromise, options.fetch);
1491
+ if (options.error)
1492
+ wrapped.error = wrapHandler(NativePromise, options.error);
1493
+ if (isRecord2(options.routes))
1494
+ wrapped.routes = Object.fromEntries(Object.entries(options.routes).map(([path, route]) => [
1495
+ path,
1496
+ wrapRoute(NativePromise, route)
1497
+ ]));
1498
+ return wrapped;
1499
+ }, wrapServerReload = (NativePromise, server) => {
1500
+ if (!isRecord2(server))
1501
+ return;
1502
+ const { reload } = server;
1503
+ if (typeof reload !== "function")
1504
+ return;
1505
+ Reflect.set(server, "reload", (options) => Reflect.apply(reload, server, [
1506
+ wrapServeOptions(NativePromise, options)
1507
+ ]));
1508
+ }, patchBunServe = (NativePromise) => {
1509
+ const originalServe = Bun.serve;
1510
+ Reflect.set(Bun, "serve", (options) => {
1511
+ const server = Reflect.apply(originalServe, Bun, [
1512
+ wrapServeOptions(NativePromise, options)
1513
+ ]);
1514
+ wrapServerReload(NativePromise, server);
1515
+ return server;
1516
+ });
1517
+ wrapServerReload(NativePromise, globalThis.__absoluteBunServer);
1518
+ }, installation = null, isPromiseConstructor = (value) => typeof value === "function", install = async () => {
1519
+ setAngularChangeDetection("zone");
1520
+ const savedNative = Reflect.get(globalThis, "__zone_symbol__Promise");
1521
+ const NativePromise = isPromiseConstructor(savedNative) ? savedNative : globalThis.Promise;
1522
+ try {
1523
+ await import(ZONE_NODE_SPECIFIER);
1524
+ } catch (error) {
1525
+ throw new Error(MISSING_ZONE_MESSAGE, { cause: error });
1526
+ }
1527
+ patchBunServe(NativePromise);
1528
+ }, installAngularZoneRuntime = () => {
1529
+ installation ??= install();
1530
+ return installation;
1531
+ };
1532
+
1369
1533
  // src/angular/ssrRender.ts
1370
1534
  var routeContextCache, cacheRouteData = (pagePath, data) => {
1371
1535
  const cacheKey = pagePath.split("?")[0] ?? pagePath;
@@ -1373,7 +1537,7 @@ var routeContextCache, cacheRouteData = (pagePath, data) => {
1373
1537
  }, getCachedRouteData = (pagePath) => routeContextCache.get(pagePath), selectorCache, buildProviders = (deps, sanitizer, request, requestContext, responseInit, userProviders = []) => [
1374
1538
  deps.provideServerRendering(),
1375
1539
  deps.provideClientHydration(deps.withHttpTransferCacheOptions(buildAbsoluteHttpTransferCacheOptions())),
1376
- deps.provideZonelessChangeDetection(),
1540
+ isAngularZoneMode() ? deps.provideZoneChangeDetection({ eventCoalescing: true }) : deps.provideZonelessChangeDetection(),
1377
1541
  { provide: deps.APP_BASE_HREF, useValue: "/" },
1378
1542
  { provide: deps.DomSanitizer, useValue: sanitizer },
1379
1543
  { provide: deps.Sanitizer, useValue: sanitizer },
@@ -1402,15 +1566,17 @@ var routeContextCache, cacheRouteData = (pagePath, data) => {
1402
1566
  result = injectBeforeClose(result, generateClientScriptCode(registeredScripts));
1403
1567
  }
1404
1568
  if (requestContext !== undefined) {
1405
- result = injectBeforeClose(result, `<script>window.__ABS_ANGULAR_REQUEST_CONTEXT__ = ${JSON.stringify(requestContext)};</script>`);
1569
+ result = injectBeforeClose(result, `<script${nonceAttr()}>window.__ABS_ANGULAR_REQUEST_CONTEXT__ = ${escapeScriptContent(JSON.stringify(requestContext))};</script>`);
1406
1570
  }
1407
1571
  if (indexPath) {
1408
1572
  const escapedIndexPath = JSON.stringify(indexPath);
1409
- result = injectBeforeClose(result, `<script>import(${escapedIndexPath});</script>`);
1573
+ result = injectBeforeClose(result, `<script${nonceAttr()}>import(${escapeScriptContent(escapedIndexPath)});</script>`);
1410
1574
  }
1411
1575
  return result;
1412
1576
  }, renderAngularApp = async (deps, PageComponent, providers, document2, url = "/") => {
1413
- const bootstrap = (context) => deps.bootstrapApplication(PageComponent, { providers }, context);
1577
+ const nonce = readCspNonce();
1578
+ const cspProviders = nonce ? [{ provide: deps.CSP_NONCE, useValue: nonce }] : [];
1579
+ const bootstrap = (context) => deps.bootstrapApplication(PageComponent, { providers: [...providers, ...cspProviders] }, context);
1414
1580
  return withSuppressedAngularDevLogs(() => deps.renderApplication(bootstrap, {
1415
1581
  document: document2,
1416
1582
  platformProviders: [],
@@ -1431,6 +1597,8 @@ var routeContextCache, cacheRouteData = (pagePath, data) => {
1431
1597
  }
1432
1598
  };
1433
1599
  var init_ssrRender = __esm(() => {
1600
+ init_escapeScriptContent();
1601
+ init_cspNonceRef();
1434
1602
  init_registerClientScript();
1435
1603
  init_browserTranslation();
1436
1604
  routeContextCache = new Map;
@@ -2174,47 +2342,140 @@ var init_lowerIslandSyntax = __esm(() => {
2174
2342
  });
2175
2343
 
2176
2344
  // src/svelte/lowerAwaitSlotSyntax.ts
2177
- var AWAIT_BLOCK_RE, escapeTemplateLiteral = (value) => value.replaceAll("\\", "\\\\").replaceAll("`", "\\`").replaceAll("${", "\\${"), markupToTemplateLiteral = (markup) => {
2178
- const escaped = escapeTemplateLiteral(markup.trim());
2179
- const withExpressions = escaped.replace(/\{([^{}]+)\}/g, (_, expression) => `\${${String(expression).trim()}}`);
2180
- return `\`${withExpressions}\``;
2181
- }, lowerSvelteAwaitSlotSyntax = (source) => {
2182
- if (!source.includes("{#await")) {
2345
+ var AWAIT_STREAM_DIRECTIVE = "<!-- absolute:stream -->", DIRECTIVE_RE, BRANCH_TAG_RE, SVELTE_ONLY_MARKUP_RE, QUOTES, scanCharacter = (scan, char) => {
2346
+ if (scan.escaped) {
2347
+ scan.escaped = false;
2348
+ return;
2349
+ }
2350
+ if (scan.quote) {
2351
+ scan.escaped = char === "\\";
2352
+ if (char === scan.quote)
2353
+ scan.quote = null;
2354
+ return;
2355
+ }
2356
+ if (QUOTES.has(char))
2357
+ scan.quote = char;
2358
+ if (char === "{")
2359
+ scan.depth += 1;
2360
+ if (char === "}")
2361
+ scan.depth -= 1;
2362
+ }, findTagEnd = (source, start) => {
2363
+ const scan = { depth: 0, escaped: false, quote: null };
2364
+ for (let index = start;index < source.length; index += 1) {
2365
+ scanCharacter(scan, source[index] ?? "");
2366
+ if (scan.depth === 0)
2367
+ return index + 1;
2368
+ }
2369
+ return -1;
2370
+ }, topLevelTags = (markup) => {
2371
+ const tags = [];
2372
+ let index = markup.indexOf("{");
2373
+ while (index !== -1) {
2374
+ const end = findTagEnd(markup, index);
2375
+ if (end === -1)
2376
+ break;
2377
+ tags.push({ end, start: index, text: markup.slice(index, end) });
2378
+ index = markup.indexOf("{", end);
2379
+ }
2380
+ return tags;
2381
+ }, escapeTemplateLiteral = (value) => value.replaceAll("\\", "\\\\").replaceAll("`", "\\`").replaceAll("${", "\\${"), markupToTemplateLiteral = (markup) => {
2382
+ const parts = topLevelTags(markup.trim());
2383
+ const trimmed = markup.trim();
2384
+ let cursor = 0;
2385
+ let literal = "";
2386
+ for (const { end, start, text } of parts) {
2387
+ literal += escapeTemplateLiteral(trimmed.slice(cursor, start));
2388
+ literal += `\${${text.slice(1, -1).trim()}}`;
2389
+ cursor = end;
2390
+ }
2391
+ literal += escapeTemplateLiteral(trimmed.slice(cursor));
2392
+ return `\`${literal}\``;
2393
+ }, fail = (filePath, message) => {
2394
+ throw new Error(`${filePath ? `${filePath}: ` : ""}${message} (${AWAIT_STREAM_DIRECTIVE} streams plain HTML; remove the directive to let Svelte render the block and hydrate it)`);
2395
+ }, assertPlainHtml = (markup, branch, filePath) => {
2396
+ const withoutExpressions = topLevelTags(markup).reduceRight((text, { end, start }) => text.slice(0, start) + text.slice(end), markup);
2397
+ const nestedTag = topLevelTags(markup).find(({ text }) => /^\{[#:/@]/.test(text));
2398
+ if (nestedTag || SVELTE_ONLY_MARKUP_RE.test(withoutExpressions)) {
2399
+ fail(filePath, `the ${branch} branch of a streamed {#await} holds Svelte markup (${nestedTag?.text ?? withoutExpressions.match(SVELTE_ONLY_MARKUP_RE)?.[0]}\u2026)`);
2400
+ }
2401
+ }, parseStreamedAwait = (source, start, filePath) => {
2402
+ if (!source.startsWith("{#await", start)) {
2403
+ fail(filePath, `${AWAIT_STREAM_DIRECTIVE} must come directly before an {#await} block`);
2404
+ }
2405
+ const headerEnd = findTagEnd(source, start);
2406
+ if (headerEnd === -1)
2407
+ fail(filePath, "unterminated {#await} tag");
2408
+ const expression = source.slice(start + "{#await".length, headerEnd - 1).trim();
2409
+ if (!expression)
2410
+ fail(filePath, "{#await} without an expression");
2411
+ if (/\s(?:then|catch)\b/.test(` ${expression}`)) {
2412
+ fail(filePath, "a streamed {#await} needs a pending branch; the shorthand {#await \u2026 then \u2026} has none");
2413
+ }
2414
+ const close = source.indexOf("{/await}", headerEnd);
2415
+ if (close === -1)
2416
+ fail(filePath, "{#await} without a matching {/await}");
2417
+ const body = source.slice(headerEnd, close);
2418
+ const branchTags = topLevelTags(body).filter(({ text }) => /^\{:/.test(text));
2419
+ const [thenTag, catchTag, extra] = branchTags;
2420
+ const thenMatch = thenTag?.text.match(BRANCH_TAG_RE);
2421
+ const catchMatch = catchTag?.text.match(BRANCH_TAG_RE);
2422
+ if (!thenTag || thenMatch?.[1] !== "then" || catchTag && catchMatch?.[1] !== "catch" || extra) {
2423
+ fail(filePath, "a streamed {#await} takes exactly one {:then} and at most one {:catch}, in that order");
2424
+ }
2425
+ const pendingMarkup = body.slice(0, thenTag?.start);
2426
+ const thenMarkup = body.slice(thenTag?.end, catchTag?.start);
2427
+ const catchMarkup = catchTag ? body.slice(catchTag.end) : undefined;
2428
+ assertPlainHtml(pendingMarkup, "pending", filePath);
2429
+ assertPlainHtml(thenMarkup, "then", filePath);
2430
+ if (catchMarkup !== undefined)
2431
+ assertPlainHtml(catchMarkup, "catch", filePath);
2432
+ return {
2433
+ catchIdentifier: catchMatch?.[2],
2434
+ catchMarkup,
2435
+ end: close + "{/await}".length,
2436
+ expression,
2437
+ pendingMarkup,
2438
+ thenIdentifier: thenMatch?.[2],
2439
+ thenMarkup
2440
+ };
2441
+ }, renderSlot = (block, slotId, dynamic) => {
2442
+ const thenValueIdentifier = block.thenIdentifier ?? "__awaitValue";
2443
+ const catchValueIdentifier = block.catchIdentifier ?? "__awaitError";
2444
+ const catchBranch = block.catchMarkup === undefined ? "catch (_absoluteAwaitError) { throw _absoluteAwaitError; }" : `catch (${catchValueIdentifier}) { return ${markupToTemplateLiteral(block.catchMarkup)}; }`;
2445
+ return `<AbsoluteAwaitSlot id="${slotId}"${dynamic ? " dynamic" : ""} fallbackHtml={${markupToTemplateLiteral(block.pendingMarkup)}} resolve={async () => { try { const ${thenValueIdentifier} = await (${block.expression}); return ${markupToTemplateLiteral(block.thenMarkup)}; } ${catchBranch} }} />`;
2446
+ }, IMPORT_LINE = 'import AbsoluteAwaitSlot from "@absolutejs/absolute/svelte/components/AwaitSlot.svelte";', lowerSvelteAwaitSlotSyntax = (source, filePath) => {
2447
+ if (!source.includes("absolute:stream")) {
2183
2448
  return { code: source, transformed: false };
2184
2449
  }
2450
+ let lowered = "";
2451
+ let cursor = 0;
2185
2452
  let awaitIndex = 0;
2186
- let transformed = false;
2187
- const lowered = source.replace(AWAIT_BLOCK_RE, (fullMatch, awaitExpression, pendingMarkup, thenIdentifier, thenMarkup, catchIdentifier, catchMarkup) => {
2188
- const trimmedAwaitExpression = awaitExpression.trim();
2189
- if (!trimmedAwaitExpression) {
2190
- return fullMatch;
2191
- }
2453
+ for (const directive of source.matchAll(DIRECTIVE_RE)) {
2454
+ const awaitStart = directive.index + directive[0].length;
2455
+ if (awaitStart < cursor)
2456
+ continue;
2457
+ const block = parseStreamedAwait(source, awaitStart, filePath);
2192
2458
  const slotId = `absolute-svelte-await-${awaitIndex.toString(BASE_36_RADIX)}`;
2193
2459
  awaitIndex += 1;
2194
- transformed = true;
2195
- const thenValueIdentifier = thenIdentifier?.trim() || "__awaitValue";
2196
- const catchValueIdentifier = catchIdentifier?.trim() || "__awaitError";
2197
- const fallbackHtml = markupToTemplateLiteral(pendingMarkup);
2198
- const resolvedHtml = markupToTemplateLiteral(thenMarkup);
2199
- const rejectedHtml = typeof catchMarkup === "string" ? markupToTemplateLiteral(catchMarkup) : null;
2200
- const catchBranch = rejectedHtml ? `catch (${catchValueIdentifier}) { return ${rejectedHtml}; }` : "catch (_absoluteAwaitError) { throw _absoluteAwaitError; }";
2201
- return `<AbsoluteAwaitSlot id="${slotId}" fallbackHtml={${fallbackHtml}} resolve={async () => { try { const ${thenValueIdentifier} = await (${trimmedAwaitExpression}); return ${resolvedHtml}; } ${catchBranch} }} />`;
2202
- });
2203
- if (!transformed) {
2460
+ lowered += source.slice(cursor, directive.index);
2461
+ lowered += renderSlot(block, slotId, directive[1] !== undefined);
2462
+ cursor = block.end;
2463
+ }
2464
+ if (awaitIndex === 0) {
2204
2465
  return { code: source, transformed: false };
2205
2466
  }
2206
- const importLine = 'import AbsoluteAwaitSlot from "@absolutejs/absolute/svelte/components/AwaitSlot.svelte";';
2467
+ lowered += source.slice(cursor);
2207
2468
  if (lowered.includes("<script")) {
2208
2469
  return {
2209
2470
  code: lowered.replace(/<script(\s[^>]*)?>/, (match) => `${match}
2210
- ${importLine}
2471
+ ${IMPORT_LINE}
2211
2472
  `),
2212
2473
  transformed: true
2213
2474
  };
2214
2475
  }
2215
2476
  return {
2216
2477
  code: `<script lang="ts">
2217
- ${importLine}
2478
+ ${IMPORT_LINE}
2218
2479
  </script>
2219
2480
  ${lowered}`,
2220
2481
  transformed: true
@@ -2222,7 +2483,10 @@ ${lowered}`,
2222
2483
  };
2223
2484
  var init_lowerAwaitSlotSyntax = __esm(() => {
2224
2485
  init_constants();
2225
- AWAIT_BLOCK_RE = /\{#await\s+([^}]+)\}([\s\S]*?)\{:then(?:\s+([A-Za-z_$][\w$]*))?\}([\s\S]*?)(?:\{:catch(?:\s+([A-Za-z_$][\w$]*))?\}([\s\S]*?))?\{\/await\}/g;
2486
+ DIRECTIVE_RE = /<!--\s*absolute:stream(\s+dynamic)?\s*-->\s*/g;
2487
+ BRANCH_TAG_RE = /^\{:(then|catch)(?:\s+([A-Za-z_$][\w$]*))?\s*\}$/;
2488
+ SVELTE_ONLY_MARKUP_RE = /\{[#:/@]|<[A-Z]|<svelte:/;
2489
+ QUOTES = new Set(['"', "'", "`"]);
2226
2490
  });
2227
2491
 
2228
2492
  // src/build/stylePreprocessor.ts
@@ -2414,7 +2678,7 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2414
2678
  const config = normalizePostcssModule(loaded);
2415
2679
  const value = typeof config === "function" ? await config({
2416
2680
  cwd: process.cwd(),
2417
- env: "development"
2681
+ env: getNodeEnv()
2418
2682
  }) : config;
2419
2683
  return normalizePostcssModule(value) ?? {};
2420
2684
  }, normalizePostcssPlugins = (plugins) => {
@@ -2780,10 +3044,10 @@ ${contents}` : contents, normalizePostcssModule = (mod) => {
2780
3044
  return resolveCssImportsSync(result.css, dirname2(filePath), new Set([filePath]));
2781
3045
  }
2782
3046
  if (language === "less") {
2783
- throw new Error(`Unable to compile ${filePath}: Less styleUrl preprocessing is async-only. Import the Less file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
3047
+ throw new Error(`Unable to compile ${filePath} synchronously: Less only has an async compiler. Compile it with compileStyleFileIfNeeded() instead.`);
2784
3048
  }
2785
3049
  if (language === "stylus") {
2786
- throw new Error(`Unable to compile ${filePath}: Stylus styleUrl preprocessing is async-only. Import the Stylus file from a bundled entrypoint or use SCSS/CSS for Angular styleUrl.`);
3050
+ throw new Error(`Unable to compile ${filePath} synchronously: Stylus only has an async compiler. Compile it with compileStyleFileIfNeeded() instead.`);
2787
3051
  }
2788
3052
  return resolveCssImportsSync(rawContents, dirname2(filePath), new Set([filePath]));
2789
3053
  };
@@ -2801,6 +3065,32 @@ var init_stylePreprocessor = __esm(() => {
2801
3065
  CSS_IMPORT_PATTERN = /@import\s+["']([^"']+)["']\s*;?/g;
2802
3066
  });
2803
3067
 
3068
+ // src/svelte/router/lazyModule.ts
3069
+ var LAZY_RESOLVED_KEY, LAZY_SOURCE_EXPORT = "__ABSOLUTE_SVELTE_SOURCE__", isRecord3 = (value) => typeof value === "object" && value !== null, isComponent = (value) => typeof value === "function", toLazyComponent = (value) => {
3070
+ if (isComponent(value))
3071
+ return value;
3072
+ if (!isRecord3(value))
3073
+ return;
3074
+ const fallback = value.default;
3075
+ return isComponent(fallback) ? fallback : undefined;
3076
+ }, readSourceFrom = (value) => {
3077
+ if (!isRecord3(value) && !isComponent(value))
3078
+ return;
3079
+ const source = Reflect.get(value, LAZY_SOURCE_EXPORT);
3080
+ return typeof source === "string" ? source : undefined;
3081
+ }, lazyModuleRegistration = (sourceId, specifier) => `
3082
+ ;(globalThis[Symbol.for("absolutejs.svelte.lazy-modules")] ??= new Map()).set(${JSON.stringify(sourceId)}, () => import(${JSON.stringify(specifier)}));`, readLazySource = (value) => {
3083
+ const fromValue = readSourceFrom(value);
3084
+ if (fromValue !== undefined)
3085
+ return fromValue;
3086
+ if (!isRecord3(value))
3087
+ return;
3088
+ return readSourceFrom(value.default);
3089
+ };
3090
+ var init_lazyModule = __esm(() => {
3091
+ LAZY_RESOLVED_KEY = Symbol.for("absolutejs.svelte.lazy-resolved");
3092
+ });
3093
+
2804
3094
  // src/core/svelteServerModule.ts
2805
3095
  import { mkdir as mkdir2, readdir as readdir2 } from "fs/promises";
2806
3096
  import { basename as basename3, dirname as dirname3, extname as extname2, join as join6, relative as relative3, resolve as resolve4 } from "path";
@@ -2910,11 +3200,11 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler,
2910
3200
  const resolutionSourcePath = await resolveOriginalSourcePath(sourcePath);
2911
3201
  const source = await Bun.file(sourcePath).text();
2912
3202
  const { compile, preprocess } = await import("svelte/compiler");
2913
- const loweredAwaitSource = lowerSvelteAwaitSlotSyntax(source);
3203
+ const loweredAwaitSource = lowerSvelteAwaitSlotSyntax(source, sourcePath);
2914
3204
  const loweredSource = lowerSvelteIslandSyntax(loweredAwaitSource.code, "server");
2915
3205
  const preprocessed = await preprocess(loweredSource.code, createSvelteStylePreprocessor());
2916
3206
  let transpiled = sourcePath.endsWith(".ts") || sourcePath.endsWith(".svelte.ts") ? transpiler.transformSync(preprocessed.code) : preprocessed.code;
2917
- const childImportSpecs = Array.from(transpiled.matchAll(/from\s+['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((value) => value !== undefined);
3207
+ const childImportSpecs = Array.from(new Set(Array.from(transpiled.matchAll(/(?:from\s+|\bimport\s*\(\s*)['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((value) => value !== undefined)));
2918
3208
  const resolvedChildModules = await Promise.all(childImportSpecs.map((spec) => resolveSvelteImport(spec, resolutionSourcePath)));
2919
3209
  const resolvedModuleImports = await Promise.all(childImportSpecs.map((spec) => resolveRelativeModule(spec, resolutionSourcePath)));
2920
3210
  const childModulePaths = new Map;
@@ -2961,6 +3251,14 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, transpiler,
2961
3251
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
2962
3252
  compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
2963
3253
  }
3254
+ const sourceId = JSON.stringify(relative3(process.cwd(), resolutionSourcePath).replace(/\\/g, "/"));
3255
+ const componentName = /export default function ([\w$]+)\s*\(/.exec(compiledCode)?.[1];
3256
+ compiledCode += `
3257
+ export const ${LAZY_SOURCE_EXPORT} = ${sourceId};`;
3258
+ if (componentName) {
3259
+ compiledCode += `
3260
+ ${componentName}.${LAZY_SOURCE_EXPORT} = ${sourceId};`;
3261
+ }
2964
3262
  const compiledModulePath = getCachedModulePath2(sourcePath);
2965
3263
  await mkdir2(dirname3(compiledModulePath), { recursive: true });
2966
3264
  await writeIfChanged(compiledModulePath, compiledCode);
@@ -2972,6 +3270,7 @@ var init_svelteServerModule = __esm(() => {
2972
3270
  init_lowerIslandSyntax();
2973
3271
  init_lowerAwaitSlotSyntax();
2974
3272
  init_stylePreprocessor();
3273
+ init_lazyModule();
2975
3274
  serverCacheRoot2 = join6(process.cwd(), ".absolutejs", "islands", "svelte");
2976
3275
  compiledModuleCache2 = new Map;
2977
3276
  originalSourcePathCache = new Map;
@@ -3115,14 +3414,14 @@ var defineIslandComponent = (component, options) => ({
3115
3414
  component,
3116
3415
  export: options.export,
3117
3416
  source: options.source
3118
- }), defineIslandRegistry = (registry) => registry, isRecord = (value) => typeof value === "object" && value !== null, getIslandBuildReference = (component) => {
3417
+ }), defineIslandRegistry = (registry) => registry, isRecord4 = (value) => typeof value === "object" && value !== null, getIslandBuildReference = (component) => {
3119
3418
  if (!isIslandComponentDefinition(component))
3120
3419
  return null;
3121
3420
  return {
3122
3421
  export: component.export,
3123
3422
  source: component.source
3124
3423
  };
3125
- }, isIslandComponentDefinition = (value) => isRecord(value) && ("component" in value) && ("source" in value) && typeof value.source === "string", parseIslandProps = (rawProps) => {
3424
+ }, isIslandComponentDefinition = (value) => isRecord4(value) && ("component" in value) && ("source" in value) && typeof value.source === "string", parseIslandProps = (rawProps) => {
3126
3425
  if (!rawProps)
3127
3426
  return {};
3128
3427
  return JSON.parse(rawProps);
@@ -3146,7 +3445,7 @@ var init_islandMarkupAttributes = __esm(() => {
3146
3445
  var islandSequence = 0, resolvedServerComponentCache, resolvedServerBuildComponentCache, nextIslandId = () => {
3147
3446
  islandSequence += 1;
3148
3447
  return `island-${islandSequence}`;
3149
- }, isRecord2 = (value) => typeof value === "object" && value !== null, isReactServerIslandComponent = (value) => typeof value === "function", isSvelteServerIslandComponent = (value) => typeof value === "function", isVueServerIslandComponent = (value) => typeof value === "function" || isRecord2(value), isAngularServerIslandComponent = (value) => typeof value === "function", resolveBuildReferencePath = (source, registryPath) => {
3448
+ }, isRecord5 = (value) => typeof value === "object" && value !== null, isReactServerIslandComponent = (value) => typeof value === "function", isSvelteServerIslandComponent = (value) => typeof value === "function", isVueServerIslandComponent = (value) => typeof value === "function" || isRecord5(value), isAngularServerIslandComponent = (value) => typeof value === "function", resolveBuildReferencePath = (source, registryPath) => {
3150
3449
  if (source.startsWith("file://"))
3151
3450
  return new URL(source).pathname;
3152
3451
  if (source.startsWith("."))
@@ -3469,6 +3768,7 @@ var REQUEST_STORAGE_KEY, PAGE_WARMER_KEY, isAbsoluteRequestStorage = (value) =>
3469
3768
  return headClose ? head.slice(0, headClose.index) + links + head.slice(headClose.index) : head + links;
3470
3769
  };
3471
3770
  var init_requestContext = __esm(() => {
3771
+ init_ssrErrorPage();
3472
3772
  REQUEST_STORAGE_KEY = Symbol.for("absolutejs.requestAsyncLocalStorage");
3473
3773
  PAGE_WARMER_KEY = Symbol.for("absolutejs.devPageWarmer");
3474
3774
  absoluteRequestContext = new Elysia2({
@@ -3596,13 +3896,13 @@ var ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE = "application/vnd.absolute.page+json", ABSO
3596
3896
  }, headerVaryValues, envelopeResponse = (response, status) => new Response(JSON.stringify({
3597
3897
  protocol: ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION,
3598
3898
  response
3599
- }), { headers: responseHeaders(), status }), isRecord4 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), normalizeJsonValue = (value) => {
3899
+ }), { headers: responseHeaders(), status }), isRecord7 = (value) => typeof value === "object" && value !== null && !Array.isArray(value), normalizeJsonValue = (value) => {
3600
3900
  const serialized = JSON.stringify(value);
3601
3901
  if (serialized === undefined) {
3602
3902
  throw new TypeError("Mobile page props must be JSON-serializable.");
3603
3903
  }
3604
3904
  const parsed = JSON.parse(serialized);
3605
- if (!isRecord4(parsed)) {
3905
+ if (!isRecord7(parsed)) {
3606
3906
  throw new TypeError("Mobile page props must serialize to an object.");
3607
3907
  }
3608
3908
  return parsed;
@@ -3632,7 +3932,9 @@ var ABSOLUTE_MOBILE_PAGE_MEDIA_TYPE = "application/vnd.absolute.page+json", ABSO
3632
3932
  return createAbsoluteMobilePageErrorResponse(page.pageId);
3633
3933
  }
3634
3934
  }, finalizeAbsoluteNativeRouteDevelopmentPage = (input) => {
3635
- if (false) {}
3935
+ if (!isDevelopmentRuntime()) {
3936
+ return createAbsoluteMobileInvalidRequestResponse("The native-route development representation is disabled outside development.");
3937
+ }
3636
3938
  if (input.request?.method !== "GET") {
3637
3939
  return createAbsoluteMobileInvalidRequestResponse("Native-route data requests must use GET.");
3638
3940
  }
@@ -3974,22 +4276,15 @@ var streamSwapRuntime = () => {
3974
4276
  return value.slice(start + 1, end);
3975
4277
  }, getStreamSwapRuntimeScript = () => `(function(){${stripFunctionWrapper(streamSwapRuntime.toString())}})();`;
3976
4278
 
3977
- // src/utils/escapeScriptContent.ts
3978
- var ESCAPE_LOOKUP, ESCAPE_REGEX, escapeScriptContent = (content) => content.replace(ESCAPE_REGEX, (char) => {
3979
- const escaped = ESCAPE_LOOKUP[char];
3980
- return escaped !== undefined ? escaped : char;
3981
- });
3982
- var init_escapeScriptContent = __esm(() => {
3983
- ESCAPE_LOOKUP = {
3984
- "\u2028": "\\u2028",
3985
- "\u2029": "\\u2029",
3986
- "<": "\\u003C"
3987
- };
3988
- ESCAPE_REGEX = /[<\u2028\u2029]/g;
3989
- });
3990
-
3991
4279
  // src/utils/streamingSlots.ts
3992
- var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG2 = "</head>", CLOSING_BODY_TAG_LENGTH, CLOSING_HEAD_TAG_LENGTH, CLOSING_PAGE_TAG_REGEX, STREAMING_RUNTIME_GLOBAL = "__ABS_SLOT_ENQUEUE__", STREAMING_PENDING_GLOBAL = "__ABS_SLOT_PENDING__", STREAM_TAIL_LOOKBEHIND = 128, STREAMING_SLOT_TIMEOUT_MS = 5000, STREAMING_SLOT_MAX_PER_RESPONSE = 128, STREAMING_SLOT_MAX_HTML_BYTES = 64000, createSlotPatchStatement = (id, payload) => `(window.${STREAMING_RUNTIME_GLOBAL}||function(i,p){window.${STREAMING_PENDING_GLOBAL}=window.${STREAMING_PENDING_GLOBAL}||{};window.${STREAMING_PENDING_GLOBAL}[i]=p;})(${JSON.stringify(id)},${JSON.stringify(payload)});`, createNonceAttr = (nonce) => nonce ? ` nonce="${nonce}"` : "", createStreamingSlotId = () => `${SLOT_ID_PREFIX}${Math.random().toString(BASE_36_RADIX).slice(2, RANDOM_ID_END_INDEX)}`, getStreamingSlotsRuntimeScript = () => getStreamSwapRuntimeScript(), injectHtmlIntoBody = (html, injection) => {
4280
+ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG2 = "</head>", CLOSING_BODY_TAG_LENGTH, CLOSING_HEAD_TAG_LENGTH, CLOSING_PAGE_TAG_REGEX, STREAMING_RUNTIME_GLOBAL = "__ABS_SLOT_ENQUEUE__", STREAMING_PENDING_GLOBAL = "__ABS_SLOT_PENDING__", STREAM_TAIL_LOOKBEHIND = 128, STREAMING_SLOT_TIMEOUT_MS = 5000, findSafeFlushIndex = (text, cut) => {
4281
+ const head = text.slice(0, cut);
4282
+ const openScript = head.lastIndexOf("<script");
4283
+ const scriptCut = openScript > head.lastIndexOf("</script>") ? openScript : cut;
4284
+ const beforeScript = text.slice(0, scriptCut);
4285
+ const openTag = beforeScript.lastIndexOf("<");
4286
+ return openTag > beforeScript.lastIndexOf(">") ? openTag : scriptCut;
4287
+ }, STREAMING_SLOT_MAX_PER_RESPONSE = 128, STREAMING_SLOT_MAX_HTML_BYTES = 64000, createSlotPatchStatement = (id, payload) => `(window.${STREAMING_RUNTIME_GLOBAL}||function(i,p){window.${STREAMING_PENDING_GLOBAL}=window.${STREAMING_PENDING_GLOBAL}||{};window.${STREAMING_PENDING_GLOBAL}[i]=p;})(${JSON.stringify(id)},${JSON.stringify(payload)});`, createNonceAttr = (nonce) => nonceAttr(nonce), createStreamingSlotId = () => `${SLOT_ID_PREFIX}${Math.random().toString(BASE_36_RADIX).slice(2, RANDOM_ID_END_INDEX)}`, getStreamingSlotsRuntimeScript = () => getStreamSwapRuntimeScript(), injectHtmlIntoBody = (html, injection) => {
3993
4288
  const closingBodyIndex = html.indexOf(CLOSING_BODY_TAG);
3994
4289
  if (closingBodyIndex >= 0) {
3995
4290
  return `${html.slice(0, closingBodyIndex)}${injection}${html.slice(closingBodyIndex)}`;
@@ -4007,7 +4302,7 @@ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG
4007
4302
  getStreamingSlotsRuntimeScript()
4008
4303
  ].filter(Boolean).join(";");
4009
4304
  return `<script${createNonceAttr(nonce)}>${escapeScriptContent(runtimeBody)}</script>`;
4010
- }, toUint8 = (value, encoder) => encoder.encode(value), isRecord5 = (value) => Boolean(value) && typeof value === "object", isSafeHtmlLike = (value) => isRecord5(value) && typeof value.changingThisBreaksApplicationSecurity === "string", normalizeSafeHtml = (value) => {
4305
+ }, toUint8 = (value, encoder) => encoder.encode(value), isRecord8 = (value) => Boolean(value) && typeof value === "object", isSafeHtmlLike = (value) => isRecord8(value) && typeof value.changingThisBreaksApplicationSecurity === "string", normalizeSafeHtml = (value) => {
4011
4306
  if (isSafeHtmlLike(value)) {
4012
4307
  return value.changingThisBreaksApplicationSecurity;
4013
4308
  }
@@ -4068,7 +4363,8 @@ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG
4068
4363
  }, createTimeoutError = (slot, timeoutMs) => {
4069
4364
  const error = Object.assign(new Error(`Streaming slot "${slot.id}" timed out after ${timeoutMs}ms`), { __absTimeout: true });
4070
4365
  return error;
4071
- }, isSlotPatchPayloadObject = (value) => isRecord5(value) && ("html" in value), isTimeoutError = (error) => isRecord5(error) && error.__absTimeout === true, toStreamingSlot = (slot, policy) => ({
4366
+ }, isSlotPatchPayloadObject = (value) => isRecord8(value) && ("html" in value), isTimeoutError = (error) => isRecord8(error) && error.__absTimeout === true, toStreamingSlot = (slot, policy) => ({
4367
+ dynamic: slot.dynamic,
4072
4368
  errorHtml: slot.errorHtml === undefined ? policy.errorHtml : slot.errorHtml,
4073
4369
  fallbackHtml: normalizeSlotText(slot.fallbackHtml, policy.fallbackHtml),
4074
4370
  id: slot.id ?? createStreamingSlotId(),
@@ -4293,9 +4589,10 @@ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG
4293
4589
  if (tail.length <= STREAM_TAIL_LOOKBEHIND) {
4294
4590
  return tail;
4295
4591
  }
4296
- const content = tail.slice(0, tail.length - STREAM_TAIL_LOOKBEHIND);
4297
- controller.enqueue(encoder.encode(content));
4298
- return tail.slice(-STREAM_TAIL_LOOKBEHIND);
4592
+ const cut = findSafeFlushIndex(tail, tail.length - STREAM_TAIL_LOOKBEHIND);
4593
+ if (cut > 0)
4594
+ controller.enqueue(encoder.encode(tail.slice(0, cut)));
4595
+ return tail.slice(cut);
4299
4596
  };
4300
4597
  const finalizeCompletedBaseWinner = (controller, decodedTail, baseRead) => {
4301
4598
  const footerStart = decodedTail.search(CLOSING_PAGE_TAG_REGEX);
@@ -4528,6 +4825,7 @@ var SLOT_ID_PREFIX = "abs-slot-", CLOSING_BODY_TAG = "</body>", CLOSING_HEAD_TAG
4528
4825
  });
4529
4826
  };
4530
4827
  var init_streamingSlots = __esm(() => {
4828
+ init_cspNonceRef();
4531
4829
  init_constants();
4532
4830
  init_escapeScriptContent();
4533
4831
  CLOSING_BODY_TAG_LENGTH = CLOSING_BODY_TAG.length;
@@ -4542,6 +4840,42 @@ var init_streamingSlots = __esm(() => {
4542
4840
  };
4543
4841
  });
4544
4842
 
4843
+ // src/core/partialPrerender.ts
4844
+ import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
4845
+ import { existsSync as existsSync4, readFileSync as readFileSync5 } from "fs";
4846
+ import { rm } from "fs/promises";
4847
+ var PARTIAL_HOLES_HEADER = "X-Absolute-Partial-Holes", PARTIAL_SHELL_HEADER = "X-Absolute-Partial-Shell", SINK_STORAGE_KEY, isSinkStorage = (value) => value instanceof AsyncLocalStorage3, getSinkStorage = () => {
4848
+ const existing = Reflect.get(globalThis, SINK_STORAGE_KEY);
4849
+ if (isSinkStorage(existing))
4850
+ return existing;
4851
+ const created = new AsyncLocalStorage3;
4852
+ Reflect.set(globalThis, SINK_STORAGE_KEY, created);
4853
+ return created;
4854
+ }, activePartialHolesSink = () => getSinkStorage().getStore(), collectPartialHoles = async (render) => {
4855
+ const sink = { slots: undefined };
4856
+ const response = await getSinkStorage().run(sink, render);
4857
+ return { response, slots: sink.slots };
4858
+ }, decodePartialHoles = (value) => value ? value.split(",").filter(Boolean).map((id) => decodeURIComponent(id)) : [], encodePartialHoles = (ids) => ids.map((id) => encodeURIComponent(id)).join(","), isDynamicStreamingSlot = (slot) => slot.dynamic === true, isPartialShellCapture = (request) => request?.headers.get(PARTIAL_SHELL_HEADER) === "1", holesPath = (htmlPath) => htmlPath.replace(/\.html$/, ".holes"), readPartialHoles = (htmlPath) => {
4859
+ const path = holesPath(htmlPath);
4860
+ if (!existsSync4(path))
4861
+ return [];
4862
+ return decodePartialHoles(readFileSync5(path, "utf-8").trim().split(`
4863
+ `).join(","));
4864
+ }, writePartialHoles = async (htmlPath, response) => {
4865
+ const ids = decodePartialHoles(response.headers.get(PARTIAL_HOLES_HEADER));
4866
+ if (ids.length > 0) {
4867
+ await Bun.write(holesPath(htmlPath), `${encodePartialHoles(ids).split(",").join(`
4868
+ `)}
4869
+ `);
4870
+ } else {
4871
+ await rm(holesPath(htmlPath), { force: true });
4872
+ }
4873
+ return ids;
4874
+ };
4875
+ var init_partialPrerender = __esm(() => {
4876
+ SINK_STORAGE_KEY = Symbol.for("absolutejs.partialPrerenderHolesSink");
4877
+ });
4878
+
4545
4879
  // src/islands/sourceMetadata.ts
4546
4880
  var islandFrameworks2, islandHydrationModes2, isIslandFramework2 = (value) => islandFrameworks2.some((framework) => framework === value), isIslandHydrate2 = (value) => islandHydrationModes2.some((hydrate) => hydrate === value), parseIslandTagAttributes = (attributeString) => {
4547
4881
  const frameworkMatch = attributeString.match(/\bframework\s*=\s*["']([^"']+)["']/);
@@ -5090,6 +5424,26 @@ import { join as join8 } from "path";
5090
5424
  var GENERATED_DIR_NAME = "generated", ABSOLUTE_CACHE_DIR_NAME = ".absolutejs", getFrameworkGeneratedDir = (framework, projectRoot = process.cwd()) => join8(getGeneratedRoot(projectRoot), framework), getGeneratedRoot = (projectRoot = process.cwd()) => join8(projectRoot, ABSOLUTE_CACHE_DIR_NAME, GENERATED_DIR_NAME);
5091
5425
  var init_generatedDir = () => {};
5092
5426
 
5427
+ // src/build/downlevelAsyncForZone.ts
5428
+ import ts from "typescript";
5429
+ var ASYNC_KEYWORD, downlevelAsyncForZone = (code, fileName) => {
5430
+ if (!isAngularZoneMode() || !ASYNC_KEYWORD.test(code))
5431
+ return code;
5432
+ return ts.transpileModule(code, {
5433
+ compilerOptions: {
5434
+ importHelpers: false,
5435
+ module: ts.ModuleKind.ESNext,
5436
+ sourceMap: false,
5437
+ target: ts.ScriptTarget.ES2016,
5438
+ useDefineForClassFields: false
5439
+ },
5440
+ fileName: fileName.replace(/\.[cm]?[tj]sx?$/, ".js")
5441
+ }).outputText;
5442
+ };
5443
+ var init_downlevelAsyncForZone = __esm(() => {
5444
+ ASYNC_KEYWORD = /\basync\b/;
5445
+ });
5446
+
5093
5447
  // src/build/compileAngular.ts
5094
5448
  var exports_compileAngular = {};
5095
5449
  __export(exports_compileAngular, {
@@ -5097,10 +5451,10 @@ __export(exports_compileAngular, {
5097
5451
  compileAngularFileJIT: () => compileAngularFileJIT,
5098
5452
  invalidateAngularJitCache: () => invalidateAngularJitCache
5099
5453
  });
5100
- import { existsSync as existsSync4, readFileSync as readFileSync5, promises as fs } from "fs";
5454
+ import { existsSync as existsSync5, readFileSync as readFileSync6, promises as fs } from "fs";
5101
5455
  import { join as join9, basename as basename4, sep, dirname as dirname5, resolve as resolve6, relative as relative5 } from "path";
5102
5456
  var {Glob } = globalThis.Bun;
5103
- import ts from "typescript";
5457
+ import ts2 from "typescript";
5104
5458
  var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) => {
5105
5459
  const temporaryPath = `${path}.tmp.${process.pid}.${atomicWriteSequence++}`;
5106
5460
  try {
@@ -5115,7 +5469,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5115
5469
  }, readTsconfigPathAliases = () => {
5116
5470
  try {
5117
5471
  const configPath = resolve6(process.cwd(), "tsconfig.json");
5118
- const config = ts.readConfigFile(configPath, ts.sys.readFile).config;
5472
+ const config = ts2.readConfigFile(configPath, ts2.sys.readFile).config;
5119
5473
  const compilerOptions = config?.compilerOptions ?? {};
5120
5474
  const baseUrl = resolve6(process.cwd(), compilerOptions.baseUrl ?? ".");
5121
5475
  const aliases = Object.entries(compilerOptions.paths ?? {}).map(([pattern, replacements]) => ({ pattern, replacements }));
@@ -5154,7 +5508,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5154
5508
  join9(candidate, "index.js"),
5155
5509
  join9(candidate, "index.jsx")
5156
5510
  ];
5157
- return candidates.find((file) => existsSync4(file));
5511
+ return candidates.find((file) => existsSync5(file));
5158
5512
  }, createLegacyAngularAnimationUsageResolver = (rootDir) => {
5159
5513
  const baseDir = resolve6(rootDir);
5160
5514
  const tsconfigAliases = readTsconfigPathAliases();
@@ -5235,16 +5589,16 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5235
5589
  }, resolveDevClientDir = () => {
5236
5590
  const projectRoot = process.cwd();
5237
5591
  const fromSource = resolve6(import.meta.dir, "../dev/client");
5238
- if (existsSync4(fromSource) && fromSource.startsWith(projectRoot)) {
5592
+ if (existsSync5(fromSource) && fromSource.startsWith(projectRoot)) {
5239
5593
  return fromSource;
5240
5594
  }
5241
5595
  const fromNodeModules = resolve6(projectRoot, "node_modules/@absolutejs/absolute/dist/dev/client");
5242
- if (existsSync4(fromNodeModules))
5596
+ if (existsSync5(fromNodeModules))
5243
5597
  return fromNodeModules;
5244
5598
  return resolve6(import.meta.dir, "./dev/client");
5245
5599
  }, devClientDir, hmrClientPath, formatDiagnosticMessage = (diagnostic) => {
5246
5600
  try {
5247
- return ts.flattenDiagnosticMessageText(diagnostic.messageText, `
5601
+ return ts2.flattenDiagnosticMessageText(diagnostic.messageText, `
5248
5602
  `);
5249
5603
  } catch {
5250
5604
  return String(diagnostic.messageText || "Unknown error");
@@ -5252,7 +5606,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5252
5606
  }, throwOnCompilationErrors = (diagnostics) => {
5253
5607
  if (!diagnostics?.length)
5254
5608
  return;
5255
- const errors = diagnostics.filter((diag) => diag.category === ts.DiagnosticCategory.Error);
5609
+ const errors = diagnostics.filter((diag) => diag.category === ts2.DiagnosticCategory.Error);
5256
5610
  if (!errors.length)
5257
5611
  return;
5258
5612
  const fullMessage = errors.map(formatDiagnosticMessage).join(`
@@ -5285,31 +5639,31 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5285
5639
  return `${path}${query}`;
5286
5640
  const importerDir = dirname5(importerOutputPath);
5287
5641
  const fileCandidate = resolve6(importerDir, `${path}.js`);
5288
- if (outputFiles?.has(fileCandidate) || existsSync4(fileCandidate)) {
5642
+ if (outputFiles?.has(fileCandidate) || existsSync5(fileCandidate)) {
5289
5643
  return `${path}.js${query}`;
5290
5644
  }
5291
5645
  const indexCandidate = resolve6(importerDir, path, "index.js");
5292
- if (outputFiles?.has(indexCandidate) || existsSync4(indexCandidate)) {
5646
+ if (outputFiles?.has(indexCandidate) || existsSync5(indexCandidate)) {
5293
5647
  return `${path}/index.js${query}`;
5294
5648
  }
5295
5649
  return `${path}.js${query}`;
5296
5650
  }, isRelativeModuleSpecifier = (specifier) => specifier.startsWith("./") || specifier.startsWith("../"), extractLocalImportSpecifiers = (source, fileName) => {
5297
- const sourceFile = ts.createSourceFile(fileName, source, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
5651
+ const sourceFile = ts2.createSourceFile(fileName, source, ts2.ScriptTarget.Latest, true, ts2.ScriptKind.TS);
5298
5652
  const specifiers = [];
5299
5653
  const addSpecifier = (node) => {
5300
- if (!node || !ts.isStringLiteralLike(node))
5654
+ if (!node || !ts2.isStringLiteralLike(node))
5301
5655
  return;
5302
5656
  const specifier = node.text;
5303
5657
  if (isRelativeModuleSpecifier(specifier))
5304
5658
  specifiers.push(specifier);
5305
5659
  };
5306
5660
  const visit = (node) => {
5307
- if (ts.isImportDeclaration(node) || ts.isExportDeclaration(node)) {
5661
+ if (ts2.isImportDeclaration(node) || ts2.isExportDeclaration(node)) {
5308
5662
  addSpecifier(node.moduleSpecifier);
5309
- } else if (ts.isCallExpression(node) && node.expression.kind === ts.SyntaxKind.ImportKeyword) {
5663
+ } else if (ts2.isCallExpression(node) && node.expression.kind === ts2.SyntaxKind.ImportKeyword) {
5310
5664
  addSpecifier(node.arguments[0]);
5311
5665
  }
5312
- ts.forEachChild(node, visit);
5666
+ ts2.forEachChild(node, visit);
5313
5667
  };
5314
5668
  visit(sourceFile);
5315
5669
  return specifiers;
@@ -5327,7 +5681,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5327
5681
  join9(basePath, "index.mts"),
5328
5682
  join9(basePath, "index.cts")
5329
5683
  ];
5330
- return candidates.map((candidate) => resolve6(candidate)).find((candidate) => existsSync4(candidate) && !candidate.endsWith(".d.ts")) ?? null;
5684
+ return candidates.map((candidate) => resolve6(candidate)).find((candidate) => existsSync5(candidate) && !candidate.endsWith(".d.ts")) ?? null;
5331
5685
  }, readFileForAotTransform = async (fileName, readFile) => {
5332
5686
  const hostSource = readFile?.(fileName);
5333
5687
  if (typeof hostSource === "string")
@@ -5408,7 +5762,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5408
5762
  if (visited.has(resolvedPath))
5409
5763
  return;
5410
5764
  visited.add(resolvedPath);
5411
- if (!existsSync4(resolvedPath) || resolvedPath.endsWith(".d.ts"))
5765
+ if (!existsSync5(resolvedPath) || resolvedPath.endsWith(".d.ts"))
5412
5766
  return;
5413
5767
  stats.filesVisited += 1;
5414
5768
  const source = await readFileForAotTransform(resolvedPath, readFile);
@@ -5442,7 +5796,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5442
5796
  const outputPath = resolve6(join9(outDir, relative5(process.cwd(), resolve6(inputPath)).replace(/\.[cm]?[tj]sx?$/, ".js")));
5443
5797
  return [
5444
5798
  outputPath,
5445
- buildIslandMetadataExports(readFileSync5(inputPath, "utf-8"))
5799
+ buildIslandMetadataExports(readFileSync6(inputPath, "utf-8"))
5446
5800
  ];
5447
5801
  })), { entries: inputPaths.length });
5448
5802
  await traceAngularPhase("aot/preload-compiler", () => import("@angular/compiler"));
@@ -5457,25 +5811,25 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5457
5811
  emitDecoratorMetadata: true,
5458
5812
  esModuleInterop: true,
5459
5813
  experimentalDecorators: true,
5460
- module: ts.ModuleKind.ESNext,
5461
- moduleResolution: ts.ModuleResolutionKind.Bundler,
5462
- newLine: ts.NewLineKind.LineFeed,
5814
+ module: ts2.ModuleKind.ESNext,
5815
+ moduleResolution: ts2.ModuleResolutionKind.Bundler,
5816
+ newLine: ts2.NewLineKind.LineFeed,
5463
5817
  noLib: false,
5464
5818
  outDir,
5465
5819
  skipLibCheck: true,
5466
- target: ts.ScriptTarget.ES2022,
5820
+ target: ts2.ScriptTarget.ES2022,
5467
5821
  ...config.options
5468
5822
  };
5469
- options.target = ts.ScriptTarget.ES2022;
5823
+ options.target = ts2.ScriptTarget.ES2022;
5470
5824
  options.experimentalDecorators = true;
5471
5825
  options.emitDecoratorMetadata = true;
5472
- options.newLine = ts.NewLineKind.LineFeed;
5826
+ options.newLine = ts2.NewLineKind.LineFeed;
5473
5827
  options.outDir = outDir;
5474
5828
  options.noEmit = false;
5475
5829
  options.incremental = false;
5476
5830
  options.tsBuildInfoFile = undefined;
5477
5831
  options.rootDir = process.cwd();
5478
- const host = await traceAngularPhase("aot/create-compiler-host", () => ts.createCompilerHost(options));
5832
+ const host = await traceAngularPhase("aot/create-compiler-host", () => ts2.createCompilerHost(options));
5479
5833
  const originalGetDefaultLibLocation = host.getDefaultLibLocation;
5480
5834
  host.getDefaultLibLocation = () => tsLibDir || (originalGetDefaultLibLocation ? originalGetDefaultLibLocation() : "");
5481
5835
  const originalGetDefaultLibFileName = host.getDefaultLibFileName;
@@ -5521,7 +5875,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5521
5875
  host.getSourceFile = (fileName, languageVersion, onError) => {
5522
5876
  const source = transformedSources.get(resolve6(fileName));
5523
5877
  if (source) {
5524
- return ts.createSourceFile(fileName, source, languageVersion, true);
5878
+ return ts2.createSourceFile(fileName, source, languageVersion, true);
5525
5879
  }
5526
5880
  return originalGetSourceFileForCompile?.call(host, fileName, languageVersion, onError);
5527
5881
  };
@@ -5559,6 +5913,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5559
5913
  });
5560
5914
  processedContent = processedContent.replace(/\b(?<!Internal)InjectFlags\b/g, "InternalInjectFlags");
5561
5915
  processedContent += islandMetadataByOutputPath.get(resolve6(target)) ?? "";
5916
+ processedContent = downlevelAsyncForZone(processedContent, target);
5562
5917
  return { content: processedContent, target };
5563
5918
  });
5564
5919
  });
@@ -5582,7 +5937,7 @@ var atomicWriteSequence = 0, writeTextFileAtomically = async (path, content) =>
5582
5937
  return null;
5583
5938
  }, resolveAngularDeferImportSpecifier = () => {
5584
5939
  const sourceEntry = resolve6(import.meta.dir, "../angular/components/index.ts");
5585
- if (existsSync4(sourceEntry)) {
5940
+ if (existsSync5(sourceEntry)) {
5586
5941
  return sourceEntry.replace(/\\/g, "/");
5587
5942
  }
5588
5943
  return "@absolutejs/absolute/angular/components";
@@ -5710,7 +6065,7 @@ ${slot.resolvedBindings.map((binding) => ` "${binding.key}": this.__absoluteDef
5710
6065
  ${fields}
5711
6066
  `);
5712
6067
  }, readAndEscapeFile = async (filePath, stylePreprocessors) => {
5713
- if (!existsSync4(filePath)) {
6068
+ if (!existsSync5(filePath)) {
5714
6069
  throw new Error(`Unable to inline Angular style resource: file not found at ${filePath}`);
5715
6070
  }
5716
6071
  const content = await compileStyleFileIfNeeded(filePath, stylePreprocessors);
@@ -5719,7 +6074,7 @@ ${fields}
5719
6074
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
5720
6075
  if (templateUrlMatch?.[1]) {
5721
6076
  const templatePath = join9(fileDir, templateUrlMatch[1]);
5722
- if (!existsSync4(templatePath)) {
6077
+ if (!existsSync5(templatePath)) {
5723
6078
  throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
5724
6079
  }
5725
6080
  const templateRaw = await fs.readFile(templatePath, "utf-8");
@@ -5750,10 +6105,10 @@ ${fields}
5750
6105
  const templateUrlMatch = findUncommentedMatch(source, /templateUrl\s*:\s*['"]([^'"]+)['"]/);
5751
6106
  if (templateUrlMatch?.[1]) {
5752
6107
  const templatePath = join9(fileDir, templateUrlMatch[1]);
5753
- if (!existsSync4(templatePath)) {
6108
+ if (!existsSync5(templatePath)) {
5754
6109
  throw new Error(`Unable to inline Angular templateUrl "${templateUrlMatch[1]}": file not found at ${templatePath}`);
5755
6110
  }
5756
- const templateRaw = readFileSync5(templatePath, "utf-8");
6111
+ const templateRaw = readFileSync6(templatePath, "utf-8");
5757
6112
  const lowered = lowerAngularDeferSyntax(templateRaw);
5758
6113
  const escaped = escapeTemplateContent(lowered.template);
5759
6114
  const replacedSource = source.slice(0, templateUrlMatch.index) + `template: \`${escaped}\`` + source.slice(templateUrlMatch.index + templateUrlMatch[0].length);
@@ -5898,7 +6253,7 @@ ${fields}
5898
6253
  join9(candidate, "index.js"),
5899
6254
  join9(candidate, "index.jsx")
5900
6255
  ];
5901
- return candidates.find((file) => existsSync4(file));
6256
+ return candidates.find((file) => existsSync5(file));
5902
6257
  };
5903
6258
  const resolveLocalImport = (specifier, fromDir) => {
5904
6259
  if (specifier.startsWith(".") || specifier.startsWith("/")) {
@@ -5934,7 +6289,7 @@ ${fields}
5934
6289
  return specifier.includes("?") ? `${specifier}&t=${cacheBuster}` : `${specifier}?t=${cacheBuster}`;
5935
6290
  };
5936
6291
  const transpileAndRewrite = (sourceCode, relativeDir, actualPath, importRewrites) => {
5937
- let processedContent = angularTranspiler.transformSync(hoistExportPastDecorators(sourceCode));
6292
+ let processedContent = downlevelAsyncForZone(angularTranspiler.transformSync(hoistExportPastDecorators(sourceCode)), actualPath);
5938
6293
  const outputPath = toOutputPath(actualPath);
5939
6294
  const rewriteBareImport = (prefix, specifier, suffix) => {
5940
6295
  const rewritten = importRewrites.get(specifier);
@@ -5973,7 +6328,7 @@ ${fields}
5973
6328
  if (visited.has(resolved))
5974
6329
  return;
5975
6330
  visited.add(resolved);
5976
- if (resolved.endsWith(".json") && existsSync4(resolved)) {
6331
+ if (resolved.endsWith(".json") && existsSync5(resolved)) {
5977
6332
  const inputDir = dirname5(resolved);
5978
6333
  const relativeDir = inputDir.startsWith(baseDir) ? inputDir.substring(baseDir.length + 1) : inputDir;
5979
6334
  const targetDir = join9(outDir, relativeDir);
@@ -5986,7 +6341,7 @@ ${fields}
5986
6341
  let actualPath = resolved;
5987
6342
  if (!actualPath.endsWith(".ts"))
5988
6343
  actualPath += ".ts";
5989
- if (!existsSync4(actualPath))
6344
+ if (!existsSync5(actualPath))
5990
6345
  return;
5991
6346
  let sourceCode = await fs.readFile(actualPath, "utf-8");
5992
6347
  const inlined = await inlineResources(sourceCode, dirname5(actualPath), stylePreprocessors);
@@ -6024,7 +6379,7 @@ ${fields}
6024
6379
  const isEntry = resolve6(actualPath) === resolve6(entryPath);
6025
6380
  const contentHash = Bun.hash(sourceCode).toString(BASE_36_RADIX);
6026
6381
  const cacheKey = actualPath;
6027
- const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey) !== contentHash || !existsSync4(targetPath);
6382
+ const shouldWriteFile = cacheBuster && isEntry ? true : jitContentCache.get(cacheKey) !== contentHash || !existsSync5(targetPath);
6028
6383
  if (shouldWriteFile) {
6029
6384
  const processedContent = transpileAndRewrite(sourceCode, relativeDir, actualPath, importRewrites);
6030
6385
  const preservedInjection = await readPreservedInjection(targetPath);
@@ -6037,7 +6392,7 @@ ${fields}
6037
6392
  };
6038
6393
  await transpileFile(inputPath);
6039
6394
  const entryOutputPath = toOutputPath(entryPath);
6040
- if (existsSync4(entryOutputPath)) {
6395
+ if (existsSync5(entryOutputPath)) {
6041
6396
  const entryOutput = await fs.readFile(entryOutputPath, "utf-8");
6042
6397
  const withoutLegacyFlag = entryOutput.replace(/\nexport const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;\n?/g, `
6043
6398
  `);
@@ -6063,7 +6418,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
6063
6418
  await traceAngularPhase("aot/copy-json-resources", async () => {
6064
6419
  const cwd = process.cwd();
6065
6420
  const angularSrcDir = resolve6(outRoot);
6066
- if (!existsSync4(angularSrcDir))
6421
+ if (!existsSync5(angularSrcDir))
6067
6422
  return;
6068
6423
  const jsonGlob = new Glob("**/*.json");
6069
6424
  for (const rel of jsonGlob.scanSync({
@@ -6098,15 +6453,15 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
6098
6453
  ...candidatePaths.map((file) => resolve6(file)),
6099
6454
  ...compiledFallbackPaths
6100
6455
  ];
6101
- let candidate = normalizedCandidates.find((file) => existsSync4(file) && file.endsWith(`${sep}${relativeEntry}`));
6456
+ let candidate = normalizedCandidates.find((file) => existsSync5(file) && file.endsWith(`${sep}${relativeEntry}`));
6102
6457
  if (!candidate) {
6103
- candidate = normalizedCandidates.find((file) => existsSync4(file) && file.endsWith(`${sep}pages${sep}${jsName}`));
6458
+ candidate = normalizedCandidates.find((file) => existsSync5(file) && file.endsWith(`${sep}pages${sep}${jsName}`));
6104
6459
  }
6105
6460
  if (!candidate) {
6106
- candidate = normalizedCandidates.find((file) => existsSync4(file) && file.endsWith(`${sep}${jsName}`));
6461
+ candidate = normalizedCandidates.find((file) => existsSync5(file) && file.endsWith(`${sep}${jsName}`));
6107
6462
  }
6108
6463
  if (!candidate) {
6109
- candidate = normalizedCandidates.find((file) => existsSync4(file));
6464
+ candidate = normalizedCandidates.find((file) => existsSync5(file));
6110
6465
  }
6111
6466
  return candidate;
6112
6467
  };
@@ -6114,11 +6469,11 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
6114
6469
  if (!rawServerFile) {
6115
6470
  rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-fallback", () => resolveRawServerFile([]), { entry: resolvedEntry });
6116
6471
  }
6117
- if (rawServerFile && !existsSync4(rawServerFile)) {
6472
+ if (rawServerFile && !existsSync5(rawServerFile)) {
6118
6473
  outputs = hmr ? await compileEntry() : aotOutputs;
6119
6474
  rawServerFile = await traceAngularPhase("wrapper/resolve-server-output-retry", () => resolveRawServerFile(outputs), { entry: resolvedEntry });
6120
6475
  }
6121
- if (!rawServerFile || !existsSync4(rawServerFile)) {
6476
+ if (!rawServerFile || !existsSync5(rawServerFile)) {
6122
6477
  throw new Error(`Compiled output not found for ${entry}. Looking for: ${jsName}. Available: ${[
6123
6478
  ...outputs,
6124
6479
  ...compiledFallbackPaths
@@ -6142,7 +6497,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
6142
6497
  let providersSourceContent = "";
6143
6498
  if (providersInjection.appProvidersSource) {
6144
6499
  try {
6145
- providersSourceContent = readFileSync5(providersInjection.appProvidersSource, "utf-8");
6500
+ providersSourceContent = readFileSync6(providersInjection.appProvidersSource, "utf-8");
6146
6501
  } catch {}
6147
6502
  }
6148
6503
  return JSON.stringify({
@@ -6154,7 +6509,7 @@ export const __ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__ = true;
6154
6509
  const serverContentHash = `${Bun.hash(original).toString(BASE_36_RADIX)}.${Bun.hash(providersHashInput).toString(BASE_36_RADIX)}`;
6155
6510
  const cachedWrapper = wrapperOutputCache.get(resolvedEntry);
6156
6511
  const clientFile = join9(indexesDir, jsName);
6157
- if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync4(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
6512
+ if (hmr && cachedWrapper && cachedWrapper.serverHash === serverContentHash && existsSync5(clientFile) && (usesLegacyAnimations || !original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__")) && (!usesLegacyAnimations || original.includes("__ABSOLUTE_PAGE_USES_LEGACY_ANIMATIONS__"))) {
6158
6513
  return {
6159
6514
  clientPath: clientFile,
6160
6515
  indexUnchanged: true,
@@ -6221,12 +6576,17 @@ export const providers = [${fragments.join(", ")}];
6221
6576
  const hmrPreamble = hmr ? `window.__HMR_FRAMEWORK__ = "angular";
6222
6577
  import "${hmrClientPath}";
6223
6578
  ` : "";
6224
- const hydration = hmr ? `${hmrPreamble}
6579
+ const zoneMode = isAngularZoneMode();
6580
+ const zoneImport = zoneMode ? `import 'zone.js';
6581
+ ` : "";
6582
+ const changeDetectionImport = zoneMode ? "provideZoneChangeDetection" : "provideZonelessChangeDetection";
6583
+ const changeDetectionProvider = zoneMode ? "provideZoneChangeDetection({ eventCoalescing: true })" : "provideZonelessChangeDetection()";
6584
+ const hydration = hmr ? `${zoneImport}${hmrPreamble}
6225
6585
  import '@angular/compiler';
6226
6586
  import { bootstrapApplication } from '@angular/platform-browser';
6227
6587
  import { provideClientHydration } from '@angular/platform-browser';
6228
6588
  import { withHttpTransferCacheOptions } from '@angular/platform-browser';
6229
- import { provideZonelessChangeDetection, REQUEST_CONTEXT } from '@angular/core';
6589
+ import { ${changeDetectionImport}, REQUEST_CONTEXT } from '@angular/core';
6230
6590
  import { prepareBrowserTranslationHydration } from '@absolutejs/absolute/client';
6231
6591
  import * as pageModule from '${normalizedImportPath}';
6232
6592
  var ${componentClassName} = pageModule.default;
@@ -6290,7 +6650,7 @@ if (!document.querySelector(_sel)) {
6290
6650
  (document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
6291
6651
  }
6292
6652
 
6293
- var providers = [provideZonelessChangeDetection()];
6653
+ var providers = [${changeDetectionProvider}];
6294
6654
  var restoreTranslation = function() {};
6295
6655
  if (!isClientRender && !window.__HMR_SKIP_HYDRATION__ && !pageHasIslands) {
6296
6656
  providers.push(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
@@ -6332,11 +6692,11 @@ window.__ABSOLUTE_PAGE_DISPOSE__ = async function() {
6332
6692
  }
6333
6693
  };
6334
6694
  `.trim() : `
6335
- import '@angular/compiler';
6695
+ ${zoneImport}import '@angular/compiler';
6336
6696
  import { bootstrapApplication } from '@angular/platform-browser';
6337
6697
  import { provideClientHydration } from '@angular/platform-browser';
6338
6698
  import { withHttpTransferCacheOptions } from '@angular/platform-browser';
6339
- import { enableProdMode, provideZonelessChangeDetection, REQUEST_CONTEXT } from '@angular/core';
6699
+ import { enableProdMode, ${changeDetectionImport}, REQUEST_CONTEXT } from '@angular/core';
6340
6700
  import { prepareBrowserTranslationHydration } from '@absolutejs/absolute/client';
6341
6701
  import * as pageModule from '${normalizedImportPath}';
6342
6702
  var ${componentClassName} = pageModule.default;
@@ -6379,7 +6739,7 @@ if (!document.querySelector(_sel)) {
6379
6739
  (document.getElementById('root') || document.body).appendChild(document.createElement(_sel));
6380
6740
  }
6381
6741
 
6382
- var providers = [provideZonelessChangeDetection()].concat(pageProviders).concat(contextProviders);
6742
+ var providers = [${changeDetectionProvider}].concat(pageProviders).concat(contextProviders);
6383
6743
  var restoreTranslation = function() {};
6384
6744
  if (!isClientRender && !pageHasIslands) {
6385
6745
  providers.unshift(provideClientHydration(withHttpTransferCacheOptions(absoluteHttpTransferCacheOptions)));
@@ -6448,6 +6808,7 @@ var init_compileAngular = __esm(() => {
6448
6808
  init_lowerDeferSyntax();
6449
6809
  init_stylePreprocessor();
6450
6810
  init_generatedDir();
6811
+ init_downlevelAsyncForZone();
6451
6812
  devClientDir = resolveDevClientDir();
6452
6813
  hmrClientPath = join9(devClientDir, "hmrClient.ts").replace(/\\/g, "/");
6453
6814
  jitContentCache = new Map;
@@ -15453,10 +15814,11 @@ init_constants();
15453
15814
  init_islandPageContext();
15454
15815
  init_routeAssets();
15455
15816
  init_inlinePageCss();
15817
+ init_ssrErrorPage();
15456
15818
  init_resolveConvention();
15457
15819
  init_registerClientScript();
15458
15820
  init_angularDeps();
15459
- import { AsyncLocalStorage as AsyncLocalStorage4 } from "async_hooks";
15821
+ import { AsyncLocalStorage as AsyncLocalStorage5 } from "async_hooks";
15460
15822
  import { lstat, mkdir as mkdir4, readlink, symlink } from "fs/promises";
15461
15823
  import { basename as basename5, dirname as dirname6, join as join10, resolve as resolve7 } from "path";
15462
15824
 
@@ -15555,7 +15917,7 @@ var islandHydrationModes = [
15555
15917
  "none"
15556
15918
  ];
15557
15919
  var decodeHtmlAttribute = (value) => value.replaceAll("&quot;", '"').replaceAll("&#34;", '"').replaceAll("&apos;", "'").replaceAll("&#39;", "'").replaceAll("&amp;", "&").replaceAll("&lt;", "<").replaceAll("&gt;", ">");
15558
- var isRecord3 = (value) => typeof value === "object" && value !== null;
15920
+ var isRecord6 = (value) => typeof value === "object" && value !== null;
15559
15921
  var isIslandFramework = (value) => islandFrameworks.some((framework) => framework === value);
15560
15922
  var isIslandHydrate = (value) => islandHydrationModes.some((mode) => mode === value);
15561
15923
  var parseAttributes = (attributeString) => {
@@ -15586,7 +15948,7 @@ var parseAngularIslandProps = (attributeString) => {
15586
15948
  let parsedProps = {};
15587
15949
  try {
15588
15950
  const candidate = JSON.parse(serializedProps);
15589
- parsedProps = isRecord3(candidate) ? candidate : {};
15951
+ parsedProps = isRecord6(candidate) ? candidate : {};
15590
15952
  } catch {}
15591
15953
  return {
15592
15954
  component,
@@ -15685,6 +16047,8 @@ init_pageResponseCache();
15685
16047
  // src/core/responseEnhancers.ts
15686
16048
  init_streamingSlots();
15687
16049
  init_pageResponseCache();
16050
+ init_partialPrerender();
16051
+ init_requestContext();
15688
16052
 
15689
16053
  // src/core/streamingSlotRegistrar.ts
15690
16054
  var STREAMING_SLOT_REGISTRAR_KEY = Symbol.for("absolutejs.streamingSlotRegistrar");
@@ -15727,7 +16091,7 @@ var setStreamingSlotWarningController = (controller) => {
15727
16091
  Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY, controller);
15728
16092
  };
15729
16093
  var warnMissingStreamingSlotCollector = (primitiveName) => {
15730
- if (isStreamingSlotCollectionActive()) {
16094
+ if (isProductionRuntime() || isStreamingSlotCollectionActive()) {
15731
16095
  return;
15732
16096
  }
15733
16097
  getWarningController()?.maybeWarn(primitiveName);
@@ -15835,18 +16199,51 @@ var mergeStreamingSlots = (registered, explicit) => {
15835
16199
  merged.set(slot.id, slot);
15836
16200
  return [...merged.values()];
15837
16201
  };
16202
+ var captureStaticShell = async (responseLike, slots, options) => {
16203
+ const holes = slots.filter(isDynamicStreamingSlot);
16204
+ const staticSlots = slots.filter((slot) => !isDynamicStreamingSlot(slot));
16205
+ const response = await withStreamingSlots(responseLike, {
16206
+ ...options,
16207
+ streamingSlots: staticSlots
16208
+ });
16209
+ if (holes.length === 0 || !response.body)
16210
+ return response;
16211
+ const headers = cloneHeaders(response);
16212
+ headers.set(PARTIAL_HOLES_HEADER, encodePartialHoles(holes.map((slot) => slot.id)));
16213
+ const body = staticSlots.length > 0 ? response.body : injectStreamingRuntimeIntoStream(response.body, options.nonce, options.runtimePlacement, options.runtimePreludeScript);
16214
+ return new Response(body, {
16215
+ headers,
16216
+ status: response.status,
16217
+ statusText: response.statusText
16218
+ });
16219
+ };
16220
+ var handOverHoles = async (responseLike, slots, sink) => {
16221
+ sink.slots = slots.filter(isDynamicStreamingSlot);
16222
+ const response = await toResponse(responseLike);
16223
+ await response.body?.cancel().catch(() => {
16224
+ return;
16225
+ });
16226
+ return new Response(null, { status: 204 });
16227
+ };
15838
16228
  var withRegisteredStreamingSlots = async (renderResponse, options = {}) => {
15839
16229
  const { result, slots } = await runWithStreamingSlotRegistry(renderResponse);
15840
16230
  const explicit = options.streamingSlots ?? [];
16231
+ const streamingSlots = mergeStreamingSlots(slots, explicit);
16232
+ const holesSink = activePartialHolesSink();
16233
+ if (holesSink)
16234
+ return handOverHoles(result, streamingSlots, holesSink);
16235
+ if (isPartialShellCapture(getCurrentAbsoluteRequest())) {
16236
+ return captureStaticShell(result, streamingSlots, options);
16237
+ }
15841
16238
  return withStreamingSlots(result, {
15842
16239
  ...options,
15843
- streamingSlots: mergeStreamingSlots(slots, explicit)
16240
+ streamingSlots
15844
16241
  });
15845
16242
  };
15846
16243
 
15847
16244
  // src/core/streamingSlotWarningScope.ts
15848
16245
  init_logger();
15849
- import { AsyncLocalStorage as AsyncLocalStorage3 } from "async_hooks";
16246
+ import { AsyncLocalStorage as AsyncLocalStorage4 } from "async_hooks";
15850
16247
  var STREAMING_SLOT_WARNING_STORAGE_KEY2 = Symbol.for("absolutejs.streamingSlotWarningAsyncLocalStorage");
15851
16248
  var isObjectRecord4 = (value) => Boolean(value) && typeof value === "object";
15852
16249
  var isAsyncLocalStorage3 = (value) => isObjectRecord4(value) && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
@@ -15862,7 +16259,7 @@ var ensureWarningStorage = () => {
15862
16259
  if (existing) {
15863
16260
  return existing;
15864
16261
  }
15865
- const storage = new AsyncLocalStorage3;
16262
+ const storage = new AsyncLocalStorage4;
15866
16263
  Reflect.set(globalThis, STREAMING_SLOT_WARNING_STORAGE_KEY2, storage);
15867
16264
  return storage;
15868
16265
  };
@@ -15893,7 +16290,9 @@ setStreamingSlotWarningController({
15893
16290
  }
15894
16291
  });
15895
16292
  var captureStreamingSlotWarningCallsite = () => {
15896
- if (false) {}
16293
+ if (isProductionRuntime()) {
16294
+ return;
16295
+ }
15897
16296
  const { stack } = new Error;
15898
16297
  if (!stack) {
15899
16298
  return;
@@ -15904,11 +16303,11 @@ var runWithStreamingSlotWarningScope = (task, metadata) => ensureWarningStorage(
15904
16303
 
15905
16304
  // src/angular/pageHandler.ts
15906
16305
  init_ssrRender();
15907
- var isRecord6 = (value) => typeof value === "object" && value !== null;
16306
+ var isRecord9 = (value) => typeof value === "object" && value !== null;
15908
16307
  var isAngularComponent = (value) => typeof value === "function";
15909
16308
  var componentHostsRouterOutlet = (component) => {
15910
16309
  const componentDef = Reflect.get(component, "\u0275cmp");
15911
- if (!isRecord6(componentDef))
16310
+ if (!isRecord9(componentDef))
15912
16311
  return false;
15913
16312
  const rawDependencies = componentDef.dependencies;
15914
16313
  const dependencies = typeof rawDependencies === "function" ? Reflect.apply(rawDependencies, undefined, []) : rawDependencies;
@@ -15918,7 +16317,7 @@ var componentHostsRouterOutlet = (component) => {
15918
16317
  if (dependency === null || typeof dependency !== "object" && typeof dependency !== "function")
15919
16318
  return false;
15920
16319
  const directiveDef = Reflect.get(dependency, "\u0275dir") ?? dependency;
15921
- if (!isRecord6(directiveDef))
16320
+ if (!isRecord9(directiveDef))
15922
16321
  return false;
15923
16322
  const { selectors } = directiveDef;
15924
16323
  return Array.isArray(selectors) && JSON.stringify(selectors).includes("router-outlet");
@@ -15948,7 +16347,7 @@ var ensureAngularCompiler = () => {
15948
16347
  }
15949
16348
  return compilerImportPromise;
15950
16349
  };
15951
- var readAngularPageModule = (value) => isRecord6(value) ? value : null;
16350
+ var readAngularPageModule = (value) => isRecord9(value) ? value : null;
15952
16351
  var resolveAngularSsrOutDir = (projectRoot = process.cwd(), configuredOutDir = process.env.ABSOLUTE_ANGULAR_SSR_OUTDIR) => configuredOutDir ?? join10(projectRoot, ".absolutejs", "runtime", "angular-ssr");
15953
16352
  var createAngularRuntimeCacheBuster = () => `${Date.now().toString(BASE_36_RADIX)}.${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
15954
16353
  var existingNodeModulesLinkMatches = async (nodeModulesLink, expectedTarget) => {
@@ -15995,7 +16394,7 @@ var ensureAngularSsrNodeModules = async (outDir, projectRoot = process.cwd(), ha
15995
16394
  };
15996
16395
  var resolveRuntimeAngularModulePath = async (pagePath) => {
15997
16396
  if (!pagePath.endsWith(".ts")) {
15998
- if (true) {
16397
+ if (isDevelopmentRuntime()) {
15999
16398
  try {
16000
16399
  const { stat } = await import("fs/promises");
16001
16400
  const stats = await stat(pagePath);
@@ -16047,7 +16446,7 @@ var resolveRequestRenderUrl = (request) => {
16047
16446
  return "/";
16048
16447
  }
16049
16448
  };
16050
- var angularSsrContext = new AsyncLocalStorage4;
16449
+ var angularSsrContext = new AsyncLocalStorage5;
16051
16450
  setSsrContextGetter(() => angularSsrContext.getStore());
16052
16451
  var handleAngularPageRequest = async (input) => {
16053
16452
  const requestId = `angular_${Date.now()}_${Math.random().toString(BASE_36_RADIX).substring(2, RANDOM_ID_END_INDEX)}`;
@@ -16074,7 +16473,7 @@ var handleAngularPageRequest = async (input) => {
16074
16473
  ],
16075
16474
  runtimes: [String(ABSOLUTE_MOBILE_PAGE_PROTOCOL_VERSION)]
16076
16475
  },
16077
- props: isRecord6(input.requestContext) ? input.requestContext : Object.create(null),
16476
+ props: isRecord9(input.requestContext) ? input.requestContext : Object.create(null),
16078
16477
  request,
16079
16478
  status: input.responseInit?.status,
16080
16479
  route: () => {
@@ -16687,5 +17086,5 @@ export {
16687
17086
  withPendingTask
16688
17087
  };
16689
17088
 
16690
- //# debugId=41EA69A6F72F18D764756E2164756E21
17089
+ //# debugId=A0AFAEE9B21C13B364756E2164756E21
16691
17090
  //# sourceMappingURL=index.js.map