@absolutejs/absolute 0.20.0-beta.177 → 0.20.0-beta.179

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 (88) hide show
  1. package/CHANGELOG.md +37 -0
  2. package/changelog.json +72 -0
  3. package/dist/angular/browser.js +17 -2
  4. package/dist/angular/browser.js.map +4 -4
  5. package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
  6. package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
  7. package/dist/angular/index.js +100 -54
  8. package/dist/angular/index.js.map +10 -9
  9. package/dist/angular/server.js +100 -54
  10. package/dist/angular/server.js.map +10 -9
  11. package/dist/build/buildWorker.js +6 -5
  12. package/dist/build.js +595 -454
  13. package/dist/build.js.map +20 -20
  14. package/dist/cli/{add-ntg96znk.js → add-8gw9mk2b.js} +1 -1
  15. package/dist/cli/{compile-w2z6c9vt.js → compile-p5yv6ecp.js} +2 -2
  16. package/dist/cli/config/server.js +45 -12
  17. package/dist/cli/{dev-8br5mr7t.js → dev-2hbcsvkp.js} +1 -1
  18. package/dist/cli/{index-420h9hq7.js → index-1ewba8ye.js} +32 -3
  19. package/dist/cli/index-5q6k5mvr.js +86 -0
  20. package/dist/cli/{index-7z1hh3fg.js → index-9dzdbbfc.js} +1 -1
  21. package/dist/cli/index.js +9 -9
  22. package/dist/cli/{islands-bx67g15t.js → islands-6zgb7501.js} +1 -1
  23. package/dist/cli/{mobile-we5q51ey.js → mobile-93vaawcz.js} +3 -3
  24. package/dist/cli/{remove-4jh862qa.js → remove-x987pvd3.js} +1 -1
  25. package/dist/cli/{start-srs11bm8.js → start-asxb79rc.js} +2 -2
  26. package/dist/cli/{typecheck-7fvww3b7.js → typecheck-m2j4tkdk.js} +165 -35
  27. package/dist/client/chunks/{index-8m2qq61n.js → index-58svs66p.js} +13 -3
  28. package/dist/client/chunks/{index-8m2qq61n.js.map → index-58svs66p.js.map} +5 -4
  29. package/dist/client/chunks/{islands-mfjmdwnb.js → islands-tcadmgcx.js} +3 -6
  30. package/dist/client/chunks/{islands-mfjmdwnb.js.map → islands-tcadmgcx.js.map} +3 -4
  31. package/dist/client/chunks/{react-sprprqzs.js → react-khr6ewhr.js} +2 -2
  32. package/dist/client/index.js +82 -6
  33. package/dist/client/index.js.map +7 -6
  34. package/dist/dev/client/handlers/islands.ts +2 -0
  35. package/dist/dev/client/handlers/react.ts +92 -111
  36. package/dist/dev/client/handlers/reactUpdateQueue.ts +153 -0
  37. package/dist/index.js +568 -427
  38. package/dist/index.js.map +20 -20
  39. package/dist/islands/browser.js +2 -2
  40. package/dist/islands/browser.js.map +3 -3
  41. package/dist/islands/index.js +56 -27
  42. package/dist/islands/index.js.map +7 -6
  43. package/dist/react/browser.js +113 -12
  44. package/dist/react/browser.js.map +10 -7
  45. package/dist/react/components/index.js +31 -7
  46. package/dist/react/components/index.js.map +5 -4
  47. package/dist/react/components/server/index.js +22 -6
  48. package/dist/react/index.js +233 -67
  49. package/dist/react/index.js.map +16 -12
  50. package/dist/react/server.js +82 -23
  51. package/dist/react/server.js.map +11 -9
  52. package/dist/src/build/compileSvelte.d.ts +12 -1
  53. package/dist/src/build/compileVue.d.ts +1 -0
  54. package/dist/src/build/islandEntries.d.ts +3 -1
  55. package/dist/src/cli/add/dependencies.d.ts +34 -6
  56. package/dist/src/cli/scripts/typecheck.d.ts +8 -0
  57. package/dist/src/cli/scripts/typecheckDiagnostics.d.ts +17 -0
  58. package/dist/src/client/preserveIslandMarkup.d.ts +4 -0
  59. package/dist/src/core/islandManifest.d.ts +6 -0
  60. package/dist/src/core/islandStylesheet.d.ts +17 -0
  61. package/dist/src/react/Island.d.ts +9 -2
  62. package/dist/src/react/IslandStyleLink.d.ts +11 -0
  63. package/dist/src/react/createIsland.d.ts +1 -1
  64. package/dist/src/react/serverComponents/nodeRendererRef.d.ts +13 -0
  65. package/dist/src/utils/requestRenderUrl.d.ts +1 -0
  66. package/dist/src/utils/resolveConvention.d.ts +1 -0
  67. package/dist/src/vue/Island.browser.d.ts +3 -1
  68. package/dist/src/vue/Island.d.ts +2 -2
  69. package/dist/src/vue/createIsland.browser.d.ts +2 -2
  70. package/dist/src/vue/createIsland.d.ts +2 -2
  71. package/dist/src/vue/islandStyleLink.d.ts +30 -0
  72. package/dist/svelte/browser.js +2 -2
  73. package/dist/svelte/browser.js.map +3 -3
  74. package/dist/svelte/index.js +94 -70
  75. package/dist/svelte/index.js.map +10 -9
  76. package/dist/svelte/server.js +65 -59
  77. package/dist/svelte/server.js.map +9 -8
  78. package/dist/types/globals.d.ts +3 -0
  79. package/dist/vue/browser.js +105 -10
  80. package/dist/vue/browser.js.map +10 -7
  81. package/dist/vue/index.js +213 -68
  82. package/dist/vue/index.js.map +15 -12
  83. package/dist/vue/server.js +81 -22
  84. package/dist/vue/server.js.map +9 -7
  85. package/package.json +1 -1
  86. package/dist/cli/index-jjfbjv1z.js +0 -65
  87. /package/dist/cli/{index-6522t968.js → index-yd672jyq.js} +0 -0
  88. /package/dist/client/chunks/{react-sprprqzs.js.map → react-khr6ewhr.js.map} +0 -0
@@ -1007,7 +1007,7 @@ import { basename, dirname as dirname2, extname as extname2, join as join3, rela
1007
1007
  var serverCacheRoot, compiledModuleCache, originalSourcePathCache, syncIslandGeneration, transpiler, ensureRelativeImportPath = (from, target) => {
1008
1008
  const importPath = relative2(dirname2(from), target).replace(/\\/g, "/");
1009
1009
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
1010
- }, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
1010
+ }, escapeRegExp = (value) => value.replace(/[.*+?^${}()|[\]\\]/g, "\\$&"), replaceQuotedSpecifier = (code, spec, target) => code.replace(new RegExp(`(['"])${escapeRegExp(spec)}\\1`, "g"), (_match, quote) => `${quote}${target}${quote}`), processDirectoryEntries = (entries, dir, targetFileName, stack) => {
1011
1011
  for (const entry of entries) {
1012
1012
  const entryPath = join3(dir, entry.name);
1013
1013
  if (entry.isDirectory())
@@ -1052,18 +1052,21 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, syncIslandGen
1052
1052
  return null;
1053
1053
  }
1054
1054
  const basePath = resolve3(dirname2(from), spec);
1055
+ const extensions = [
1056
+ ".ts",
1057
+ ".tsx",
1058
+ ".mts",
1059
+ ".cts",
1060
+ ".js",
1061
+ ".jsx",
1062
+ ".mjs",
1063
+ ".cjs",
1064
+ ".json"
1065
+ ];
1055
1066
  const candidates = [
1056
1067
  basePath,
1057
- `${basePath}.ts`,
1058
- `${basePath}.js`,
1059
- `${basePath}.mjs`,
1060
- `${basePath}.cjs`,
1061
- `${basePath}.json`,
1062
- join3(basePath, "index.ts"),
1063
- join3(basePath, "index.js"),
1064
- join3(basePath, "index.mjs"),
1065
- join3(basePath, "index.cjs"),
1066
- join3(basePath, "index.json")
1068
+ ...extensions.map((extension) => `${basePath}${extension}`),
1069
+ ...extensions.map((extension) => join3(basePath, `index${extension}`))
1067
1070
  ];
1068
1071
  const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
1069
1072
  const foundIndex = existResults.indexOf(true);
@@ -1148,7 +1151,7 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, syncIslandGen
1148
1151
  rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath(sourcePath), resolvedModuleImport));
1149
1152
  }
1150
1153
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
1151
- transpiled = transpiled.replaceAll(spec, resolvedModuleImport);
1154
+ transpiled = replaceQuotedSpecifier(transpiled, spec, resolvedModuleImport);
1152
1155
  }
1153
1156
  let compiledCode = compile(transpiled, {
1154
1157
  css: "injected",
@@ -1160,10 +1163,10 @@ var serverCacheRoot, compiledModuleCache, originalSourcePathCache, syncIslandGen
1160
1163
  hmr: isDevelopmentRuntime()
1161
1164
  }).js.code;
1162
1165
  for (const [spec, compiledChildPath] of childModulePaths) {
1163
- compiledCode = compiledCode.replaceAll(spec, ensureRelativeImportPath(getCachedModulePath(sourcePath), compiledChildPath));
1166
+ compiledCode = replaceQuotedSpecifier(compiledCode, spec, ensureRelativeImportPath(getCachedModulePath(sourcePath), compiledChildPath));
1164
1167
  }
1165
1168
  for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
1166
- compiledCode = compiledCode.replaceAll(spec, resolvedModuleImport);
1169
+ compiledCode = replaceQuotedSpecifier(compiledCode, spec, resolvedModuleImport);
1167
1170
  }
1168
1171
  const sourceId = JSON.stringify(relative2(process.cwd(), resolutionSourcePath).replace(/\\/g, "/"));
1169
1172
  const componentName = /export default function ([\w$]+)\s*\(/.exec(compiledCode)?.[1];
@@ -1402,7 +1405,7 @@ var ISLAND_BOOTSTRAP_MANIFEST_KEY = "AbsoluteIslandBootstrap", LEGACY_ISLAND_BOO
1402
1405
  islands[framework] = entries;
1403
1406
  }
1404
1407
  return islands;
1405
- }, getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
1408
+ }, getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`, ISLAND_STYLE_PREFIX = "IslandStyle", getIslandStyleManifestEntries = (manifest) => Object.entries(manifest).filter(([key]) => key.startsWith(ISLAND_STYLE_PREFIX)), getIslandStyleManifestKey = (framework, component) => `${ISLAND_STYLE_PREFIX}${toIslandFrameworkSegment(framework)}${component}`;
1406
1409
 
1407
1410
  // src/core/islandPageContext.ts
1408
1411
  var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__", ISLAND_STATE_MARKER = "__ABS_ISLAND_STATE__", CLOSING_HEAD_TAG = "</head>", warnedMissingBootstrap = false, warnIfBootstrapMissing = (manifest) => {
@@ -1439,12 +1442,27 @@ var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST
1439
1442
  browserManifest[key] = value;
1440
1443
  }
1441
1444
  return browserManifest;
1442
- }, buildIslandsHeadMarkup = (manifest) => {
1445
+ }, ISLAND_MARKER_TAG, ISLAND_FRAMEWORKS, readMarkerAttribute = (tag, name) => new RegExp(`\\b${name}="([^"]*)"`).exec(tag)?.[1]?.replaceAll("&quot;", '"').replaceAll("&lt;", "<").replaceAll("&gt;", ">").replaceAll("&amp;", "&"), toIslandFramework = (value) => ISLAND_FRAMEWORKS.find((framework) => framework === value), collectRenderedIslandStyleKeys = (html) => {
1446
+ const keys = new Set;
1447
+ for (const [tag] of html.matchAll(ISLAND_MARKER_TAG)) {
1448
+ const framework = toIslandFramework(readMarkerAttribute(tag, "data-framework"));
1449
+ const component = readMarkerAttribute(tag, "data-component");
1450
+ if (framework && component)
1451
+ keys.add(getIslandStyleManifestKey(framework, component));
1452
+ }
1453
+ return keys;
1454
+ }, buildIslandStyleLinks = (manifest, html) => {
1455
+ if (html === undefined)
1456
+ return "";
1457
+ const renderedKeys = collectRenderedIslandStyleKeys(html);
1458
+ return getIslandStyleManifestEntries(manifest).filter(([key]) => renderedKeys.has(key)).filter(([, href]) => !html.includes(`href="${href}"`)).map(([key, href]) => `<link rel="stylesheet" href="${href}" data-island-style="${key}"${nonceAttr()}>`).join("");
1459
+ }, buildIslandsHeadMarkup = (manifest, html) => {
1460
+ const styleLinks = buildIslandStyleLinks(manifest, html);
1443
1461
  const manifestScript = `<script${nonceAttr()}>window.__ABSOLUTE_MANIFEST__ = ${escapeScriptContent(JSON.stringify(toBrowserManifest(manifest)))}</script>`;
1444
1462
  const islandStateScript = `<script${nonceAttr()}>window.__ABS_ISLAND_STATE__ = ${escapeScriptContent(JSON.stringify(globalThis.__ABS_ISLAND_STATE__ ?? {}))}</script>`;
1445
1463
  const bootstrapPath = getIslandBootstrapPath(manifest);
1446
1464
  const bootstrapScript = bootstrapPath ? `<script${nonceAttr()} type="module" src="${bootstrapPath}"></script>` : "";
1447
- return `${manifestScript}${islandStateScript}${bootstrapScript}`;
1465
+ return `${styleLinks}${manifestScript}${islandStateScript}${bootstrapScript}`;
1448
1466
  }, injectHeadMarkup = (html, markup) => {
1449
1467
  const closingHeadIndex = html.indexOf("</head>");
1450
1468
  if (closingHeadIndex >= 0) {
@@ -1626,7 +1644,7 @@ var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST
1626
1644
  return html;
1627
1645
  }
1628
1646
  warnIfBootstrapMissing(manifest);
1629
- return injectHeadMarkup(html, buildIslandsHeadMarkup(manifest));
1647
+ return injectHeadMarkup(html, buildIslandsHeadMarkup(manifest, html));
1630
1648
  }, injectIslandPageContextStream = (stream, options) => {
1631
1649
  const manifest = globalThis.__absoluteManifest;
1632
1650
  if (!manifest)
@@ -1650,6 +1668,13 @@ var init_islandPageContext = __esm(() => {
1650
1668
  init_logger();
1651
1669
  MANIFEST_BUILD_DIR_KEY = Symbol.for("absolutejs.islandManifestBuildDir");
1652
1670
  WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]|^\\\\/;
1671
+ ISLAND_MARKER_TAG = /<[^>]*\bdata-island="true"[^>]*>/g;
1672
+ ISLAND_FRAMEWORKS = [
1673
+ "react",
1674
+ "svelte",
1675
+ "vue",
1676
+ "angular"
1677
+ ];
1653
1678
  });
1654
1679
 
1655
1680
  // src/core/devRouteRegistrationCallsite.ts
@@ -3286,6 +3311,12 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
3286
3311
  logConventionRenderError(framework, "error", renderError);
3287
3312
  }
3288
3313
  return null;
3314
+ }, isPageRequest = (request) => {
3315
+ if (request.headers.get("hx-request") === "true")
3316
+ return true;
3317
+ if (request.headers.get("sec-fetch-dest") === "document")
3318
+ return true;
3319
+ return (request.headers.get("accept") ?? "").includes("text/html");
3289
3320
  }, renderConventionError = async (framework, pageName, error) => {
3290
3321
  const errorProps = buildErrorProps(error);
3291
3322
  const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
@@ -3297,12 +3328,6 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
3297
3328
  return htmlResponse;
3298
3329
  }
3299
3330
  return null;
3300
- }, isPageRequest = (request) => {
3301
- if (request.headers.get("hx-request") === "true")
3302
- return true;
3303
- if (request.headers.get("sec-fetch-dest") === "document")
3304
- return true;
3305
- return (request.headers.get("accept") ?? "").includes("text/html");
3306
3331
  }, renderStaticRouteError = async (request, error) => {
3307
3332
  if (!isPageRequest(request))
3308
3333
  return null;
@@ -4782,9 +4807,9 @@ var createVueCompiler = async () => {
4782
4807
  // src/core/vueServerModule.ts
4783
4808
  import { readFileSync as readFileSync5, realpathSync } from "fs";
4784
4809
  import { mkdir as mkdir3 } from "fs/promises";
4785
- import { dirname as dirname4, join as join7, relative as relative4, resolve as resolve5 } from "path";
4810
+ import { basename as basename4, dirname as dirname4, join as join7, relative as relative4, resolve as resolve5 } from "path";
4786
4811
  var {Transpiler } = globalThis.Bun;
4787
- var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, syncIslandGeneration2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
4812
+ var serverCacheRoot3, compiledModuleCache3, syncIslandGeneration2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
4788
4813
  const importPath = relative4(dirname4(from), target).replace(/\\/g, "/");
4789
4814
  return importPath.startsWith(".") ? importPath : `./${importPath}`;
4790
4815
  }, getCachedModulePath3 = (sourcePath) => {
@@ -4818,7 +4843,13 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
4818
4843
  ].join(`
4819
4844
  `) : nonVueLines.join(`
4820
4845
  `);
4821
- }, extractRelativeVueImports = (sourceCode) => Array.from(sourceCode.matchAll(/import\s+[\s\S]+?['"]([^'"]+)['"]/g)).map((match) => match[1]).filter((importPath) => typeof importPath === "string" && importPath.startsWith(".") && importPath.endsWith(".vue")), compileVueServerModule = async (sourcePath) => {
4846
+ }, RELATIVE_SPECIFIER_PATTERN, extractRelativeImports = (code) => Array.from(new Set(Array.from(code.matchAll(RELATIVE_SPECIFIER_PATTERN), (match) => match.groups?.spec).filter((spec) => spec !== undefined))), resolveFromSource = (spec, sourcePath) => {
4847
+ try {
4848
+ return Bun.resolveSync(spec, dirname4(sourcePath));
4849
+ } catch {
4850
+ return null;
4851
+ }
4852
+ }, compileVueServerModule = async (sourcePath) => {
4822
4853
  syncIslandGeneration2();
4823
4854
  const cachedModulePath = compiledModuleCache3.get(sourcePath);
4824
4855
  if (cachedModulePath)
@@ -4826,7 +4857,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
4826
4857
  const compiler = await loadVueCompiler();
4827
4858
  const source = await Bun.file(sourcePath).text();
4828
4859
  const { descriptor } = compiler.parse(source, { filename: sourcePath });
4829
- const componentId = Bun.hash(sourcePath).toString(BASE_36_RADIX).slice(0, ISLAND_COMPONENT_ID_LENGTH);
4860
+ const componentId = toKebab(basename4(sourcePath, ".vue"));
4830
4861
  const hasScript = descriptor.script || descriptor.scriptSetup;
4831
4862
  const compiledScript = hasScript ? compiler.compileScript(descriptor, {
4832
4863
  fs: {
@@ -4851,10 +4882,10 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
4851
4882
  ssr: true,
4852
4883
  ssrCssVars: descriptor.cssVars
4853
4884
  }).code : "const ssrRender = () => {};";
4854
- const childImportPaths = extractRelativeVueImports(compiledScript.content);
4855
- const compiledChildren = await Promise.all(childImportPaths.map(async (relativeImport) => ({
4856
- compiledPath: await compileVueServerModule(resolve5(dirname4(sourcePath), relativeImport)),
4857
- spec: relativeImport
4885
+ const relativeImports = extractRelativeImports(compiledScript.content);
4886
+ const compiledChildren = await Promise.all(relativeImports.filter((spec) => spec.endsWith(".vue")).map(async (spec) => ({
4887
+ compiledPath: await compileVueServerModule(resolve5(dirname4(sourcePath), spec)),
4888
+ spec
4858
4889
  })));
4859
4890
  const strippedScript = stripExports(compiledScript.content);
4860
4891
  const transpiledScript = transpiler2.transformSync(strippedScript);
@@ -4866,17 +4897,28 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
4866
4897
  ].join(`
4867
4898
  `));
4868
4899
  const compiledModulePath = getCachedModulePath3(sourcePath);
4869
- let rewritten = assembled;
4900
+ const rewrittenSpecifiers = new Map;
4870
4901
  for (const child of compiledChildren) {
4871
- rewritten = rewritten.replaceAll(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
4902
+ rewrittenSpecifiers.set(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
4903
+ }
4904
+ for (const spec of extractRelativeImports(assembled)) {
4905
+ if (rewrittenSpecifiers.has(spec))
4906
+ continue;
4907
+ const resolvedImport = resolveFromSource(spec, sourcePath);
4908
+ if (!resolvedImport)
4909
+ continue;
4910
+ rewrittenSpecifiers.set(spec, ensureRelativeImportPath2(compiledModulePath, resolvedImport));
4872
4911
  }
4912
+ const rewritten = assembled.replace(RELATIVE_SPECIFIER_PATTERN, (match, prefix, quote, spec) => {
4913
+ const target = rewrittenSpecifiers.get(spec);
4914
+ return target ? `${prefix}${quote}${target}${quote}` : match;
4915
+ });
4873
4916
  await mkdir3(dirname4(compiledModulePath), { recursive: true });
4874
4917
  await writeIfChanged2(compiledModulePath, rewritten);
4875
4918
  compiledModuleCache3.set(sourcePath, compiledModulePath);
4876
4919
  return compiledModulePath;
4877
4920
  };
4878
4921
  var init_vueServerModule = __esm(() => {
4879
- init_constants();
4880
4922
  init_isFile();
4881
4923
  serverCacheRoot3 = join7(process.cwd(), ".absolutejs", "islands", "vue");
4882
4924
  compiledModuleCache3 = new Map;
@@ -4884,6 +4926,7 @@ var init_vueServerModule = __esm(() => {
4884
4926
  compiledModuleCache3.clear();
4885
4927
  });
4886
4928
  transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
4929
+ RELATIVE_SPECIFIER_PATTERN = /(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(?<spec>\.{1,2}\/[^'"]*)\2/g;
4887
4930
  });
4888
4931
 
4889
4932
  // src/core/islands.ts
@@ -5094,6 +5137,18 @@ var requireCurrentIslandRegistry = () => {
5094
5137
  globalThis.__absoluteIslandRegistry = registry;
5095
5138
  };
5096
5139
 
5140
+ // src/utils/requestRenderUrl.ts
5141
+ var requestRenderUrl = (request) => {
5142
+ if (!request)
5143
+ return;
5144
+ try {
5145
+ const parsed = new URL(request.url);
5146
+ return `${parsed.pathname.replace(/\/{2,}/g, "/")}${parsed.search}`;
5147
+ } catch {
5148
+ return;
5149
+ }
5150
+ };
5151
+
5097
5152
  // src/svelte/pageHandler.ts
5098
5153
  init_cspNonceRef();
5099
5154
  init_svelteServerModule();
@@ -5483,35 +5538,7 @@ var readHasIslands = (value) => {
5483
5538
  return typeof hasIslands === "boolean" ? hasIslands : false;
5484
5539
  };
5485
5540
  var readDefaultExport = (value) => isRecord5(value) ? value.default : undefined;
5486
- var primeSvelteStream = async (stream) => {
5487
- const reader = stream.getReader();
5488
- const firstChunk = await reader.read();
5489
- return { firstChunk, reader };
5490
- };
5491
- var restorePrimedStream = (firstChunk, reader) => new ReadableStream({
5492
- start(controller) {
5493
- if (!firstChunk.done)
5494
- controller.enqueue(firstChunk.value);
5495
- if (firstChunk.done) {
5496
- controller.close();
5497
- return;
5498
- }
5499
- const pumpLoop = () => {
5500
- reader.read().then(({ done, value }) => done ? controller.close() : (controller.enqueue(value), pumpLoop())).catch((err) => controller.error(err));
5501
- };
5502
- pumpLoop();
5503
- }
5504
- });
5505
- var resolveRequestPathname = (request) => {
5506
- if (!request)
5507
- return;
5508
- try {
5509
- const parsed = new URL(request.url);
5510
- return `${parsed.pathname}${parsed.search}`;
5511
- } catch {
5512
- return;
5513
- }
5514
- };
5541
+ var resolveRequestPathname = (request) => requestRenderUrl(request);
5515
5542
  var handleSveltePageRequest = async (input) => {
5516
5543
  const deferredAssets = input.pagePath === "" || input.indexPath === "" ? await resolveDeferredPageAssets() : null;
5517
5544
  const buildFailure = devBuildErrorResponse("svelte", deferredAssets);
@@ -5607,11 +5634,8 @@ var handleSveltePageRequest = async (input) => {
5607
5634
  const routerResponse = routerSsr.response();
5608
5635
  if (routerResponse)
5609
5636
  return routerResponse;
5610
- const htmlStream = injectIslandPageContextStream(stream, {
5611
- hasIslands: resolvedPage.hasIslands ? true : undefined
5612
- });
5613
- const { firstChunk, reader } = await primeSvelteStream(htmlStream);
5614
- return new Response(restorePrimedStream(firstChunk, reader), {
5637
+ const html = injectIslandPageContext(await new Response(stream).text(), { hasIslands: resolvedPage.hasIslands ? true : undefined });
5638
+ return new Response(html, {
5615
5639
  headers: streamingPageHeaders()
5616
5640
  });
5617
5641
  };
@@ -6161,5 +6185,5 @@ export {
6161
6185
  useIslandStore
6162
6186
  };
6163
6187
 
6164
- //# debugId=3C69D998E176291964756E2164756E21
6188
+ //# debugId=E6EA4B1420FAE74C64756E2164756E21
6165
6189
  //# sourceMappingURL=index.js.map