@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.
- package/CHANGELOG.md +37 -0
- package/changelog.json +72 -0
- package/dist/angular/browser.js +17 -2
- package/dist/angular/browser.js.map +4 -4
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +100 -54
- package/dist/angular/index.js.map +10 -9
- package/dist/angular/server.js +100 -54
- package/dist/angular/server.js.map +10 -9
- package/dist/build/buildWorker.js +6 -5
- package/dist/build.js +595 -454
- package/dist/build.js.map +20 -20
- package/dist/cli/{add-ntg96znk.js → add-8gw9mk2b.js} +1 -1
- package/dist/cli/{compile-w2z6c9vt.js → compile-p5yv6ecp.js} +2 -2
- package/dist/cli/config/server.js +45 -12
- package/dist/cli/{dev-8br5mr7t.js → dev-2hbcsvkp.js} +1 -1
- package/dist/cli/{index-420h9hq7.js → index-1ewba8ye.js} +32 -3
- package/dist/cli/index-5q6k5mvr.js +86 -0
- package/dist/cli/{index-7z1hh3fg.js → index-9dzdbbfc.js} +1 -1
- package/dist/cli/index.js +9 -9
- package/dist/cli/{islands-bx67g15t.js → islands-6zgb7501.js} +1 -1
- package/dist/cli/{mobile-we5q51ey.js → mobile-93vaawcz.js} +3 -3
- package/dist/cli/{remove-4jh862qa.js → remove-x987pvd3.js} +1 -1
- package/dist/cli/{start-srs11bm8.js → start-asxb79rc.js} +2 -2
- package/dist/cli/{typecheck-7fvww3b7.js → typecheck-m2j4tkdk.js} +165 -35
- package/dist/client/chunks/{index-8m2qq61n.js → index-58svs66p.js} +13 -3
- package/dist/client/chunks/{index-8m2qq61n.js.map → index-58svs66p.js.map} +5 -4
- package/dist/client/chunks/{islands-mfjmdwnb.js → islands-tcadmgcx.js} +3 -6
- package/dist/client/chunks/{islands-mfjmdwnb.js.map → islands-tcadmgcx.js.map} +3 -4
- package/dist/client/chunks/{react-sprprqzs.js → react-khr6ewhr.js} +2 -2
- package/dist/client/index.js +82 -6
- package/dist/client/index.js.map +7 -6
- package/dist/dev/client/handlers/islands.ts +2 -0
- package/dist/dev/client/handlers/react.ts +92 -111
- package/dist/dev/client/handlers/reactUpdateQueue.ts +153 -0
- package/dist/index.js +568 -427
- package/dist/index.js.map +20 -20
- package/dist/islands/browser.js +2 -2
- package/dist/islands/browser.js.map +3 -3
- package/dist/islands/index.js +56 -27
- package/dist/islands/index.js.map +7 -6
- package/dist/react/browser.js +113 -12
- package/dist/react/browser.js.map +10 -7
- package/dist/react/components/index.js +31 -7
- package/dist/react/components/index.js.map +5 -4
- package/dist/react/components/server/index.js +22 -6
- package/dist/react/index.js +233 -67
- package/dist/react/index.js.map +16 -12
- package/dist/react/server.js +82 -23
- package/dist/react/server.js.map +11 -9
- package/dist/src/build/compileSvelte.d.ts +12 -1
- package/dist/src/build/compileVue.d.ts +1 -0
- package/dist/src/build/islandEntries.d.ts +3 -1
- package/dist/src/cli/add/dependencies.d.ts +34 -6
- package/dist/src/cli/scripts/typecheck.d.ts +8 -0
- package/dist/src/cli/scripts/typecheckDiagnostics.d.ts +17 -0
- package/dist/src/client/preserveIslandMarkup.d.ts +4 -0
- package/dist/src/core/islandManifest.d.ts +6 -0
- package/dist/src/core/islandStylesheet.d.ts +17 -0
- package/dist/src/react/Island.d.ts +9 -2
- package/dist/src/react/IslandStyleLink.d.ts +11 -0
- package/dist/src/react/createIsland.d.ts +1 -1
- package/dist/src/react/serverComponents/nodeRendererRef.d.ts +13 -0
- package/dist/src/utils/requestRenderUrl.d.ts +1 -0
- package/dist/src/utils/resolveConvention.d.ts +1 -0
- package/dist/src/vue/Island.browser.d.ts +3 -1
- package/dist/src/vue/Island.d.ts +2 -2
- package/dist/src/vue/createIsland.browser.d.ts +2 -2
- package/dist/src/vue/createIsland.d.ts +2 -2
- package/dist/src/vue/islandStyleLink.d.ts +30 -0
- package/dist/svelte/browser.js +2 -2
- package/dist/svelte/browser.js.map +3 -3
- package/dist/svelte/index.js +94 -70
- package/dist/svelte/index.js.map +10 -9
- package/dist/svelte/server.js +65 -59
- package/dist/svelte/server.js.map +9 -8
- package/dist/types/globals.d.ts +3 -0
- package/dist/vue/browser.js +105 -10
- package/dist/vue/browser.js.map +10 -7
- package/dist/vue/index.js +213 -68
- package/dist/vue/index.js.map +15 -12
- package/dist/vue/server.js +81 -22
- package/dist/vue/server.js.map +9 -7
- package/package.json +1 -1
- package/dist/cli/index-jjfbjv1z.js +0 -65
- /package/dist/cli/{index-6522t968.js → index-yd672jyq.js} +0 -0
- /package/dist/client/chunks/{react-sprprqzs.js.map → react-khr6ewhr.js.map} +0 -0
package/dist/react/index.js
CHANGED
|
@@ -313,7 +313,7 @@ var ISLAND_BOOTSTRAP_MANIFEST_KEY = "AbsoluteIslandBootstrap", LEGACY_ISLAND_BOO
|
|
|
313
313
|
islands[framework] = entries;
|
|
314
314
|
}
|
|
315
315
|
return islands;
|
|
316
|
-
}, getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
|
|
316
|
+
}, 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}`;
|
|
317
317
|
|
|
318
318
|
// src/core/islandPageContext.ts
|
|
319
319
|
var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__", ISLAND_STATE_MARKER = "__ABS_ISLAND_STATE__", CLOSING_HEAD_TAG = "</head>", warnedMissingBootstrap = false, warnIfBootstrapMissing = (manifest) => {
|
|
@@ -350,12 +350,27 @@ var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST
|
|
|
350
350
|
browserManifest[key] = value;
|
|
351
351
|
}
|
|
352
352
|
return browserManifest;
|
|
353
|
-
},
|
|
353
|
+
}, ISLAND_MARKER_TAG, ISLAND_FRAMEWORKS, readMarkerAttribute = (tag, name) => new RegExp(`\\b${name}="([^"]*)"`).exec(tag)?.[1]?.replaceAll(""", '"').replaceAll("<", "<").replaceAll(">", ">").replaceAll("&", "&"), toIslandFramework = (value) => ISLAND_FRAMEWORKS.find((framework) => framework === value), collectRenderedIslandStyleKeys = (html) => {
|
|
354
|
+
const keys = new Set;
|
|
355
|
+
for (const [tag] of html.matchAll(ISLAND_MARKER_TAG)) {
|
|
356
|
+
const framework = toIslandFramework(readMarkerAttribute(tag, "data-framework"));
|
|
357
|
+
const component = readMarkerAttribute(tag, "data-component");
|
|
358
|
+
if (framework && component)
|
|
359
|
+
keys.add(getIslandStyleManifestKey(framework, component));
|
|
360
|
+
}
|
|
361
|
+
return keys;
|
|
362
|
+
}, buildIslandStyleLinks = (manifest, html) => {
|
|
363
|
+
if (html === undefined)
|
|
364
|
+
return "";
|
|
365
|
+
const renderedKeys = collectRenderedIslandStyleKeys(html);
|
|
366
|
+
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("");
|
|
367
|
+
}, buildIslandsHeadMarkup = (manifest, html) => {
|
|
368
|
+
const styleLinks = buildIslandStyleLinks(manifest, html);
|
|
354
369
|
const manifestScript = `<script${nonceAttr()}>window.__ABSOLUTE_MANIFEST__ = ${escapeScriptContent(JSON.stringify(toBrowserManifest(manifest)))}</script>`;
|
|
355
370
|
const islandStateScript = `<script${nonceAttr()}>window.__ABS_ISLAND_STATE__ = ${escapeScriptContent(JSON.stringify(globalThis.__ABS_ISLAND_STATE__ ?? {}))}</script>`;
|
|
356
371
|
const bootstrapPath = getIslandBootstrapPath(manifest);
|
|
357
372
|
const bootstrapScript = bootstrapPath ? `<script${nonceAttr()} type="module" src="${bootstrapPath}"></script>` : "";
|
|
358
|
-
return `${manifestScript}${islandStateScript}${bootstrapScript}`;
|
|
373
|
+
return `${styleLinks}${manifestScript}${islandStateScript}${bootstrapScript}`;
|
|
359
374
|
}, injectHeadMarkup = (html, markup) => {
|
|
360
375
|
const closingHeadIndex = html.indexOf("</head>");
|
|
361
376
|
if (closingHeadIndex >= 0) {
|
|
@@ -537,7 +552,7 @@ var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST
|
|
|
537
552
|
return html;
|
|
538
553
|
}
|
|
539
554
|
warnIfBootstrapMissing(manifest);
|
|
540
|
-
return injectHeadMarkup(html, buildIslandsHeadMarkup(manifest));
|
|
555
|
+
return injectHeadMarkup(html, buildIslandsHeadMarkup(manifest, html));
|
|
541
556
|
}, injectIslandPageContextStream = (stream, options) => {
|
|
542
557
|
const manifest = globalThis.__absoluteManifest;
|
|
543
558
|
if (!manifest)
|
|
@@ -561,6 +576,13 @@ var init_islandPageContext = __esm(() => {
|
|
|
561
576
|
init_logger();
|
|
562
577
|
MANIFEST_BUILD_DIR_KEY = Symbol.for("absolutejs.islandManifestBuildDir");
|
|
563
578
|
WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]|^\\\\/;
|
|
579
|
+
ISLAND_MARKER_TAG = /<[^>]*\bdata-island="true"[^>]*>/g;
|
|
580
|
+
ISLAND_FRAMEWORKS = [
|
|
581
|
+
"react",
|
|
582
|
+
"svelte",
|
|
583
|
+
"vue",
|
|
584
|
+
"angular"
|
|
585
|
+
];
|
|
564
586
|
});
|
|
565
587
|
|
|
566
588
|
// src/core/devRouteRegistrationCallsite.ts
|
|
@@ -2128,6 +2150,12 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
|
|
|
2128
2150
|
logConventionRenderError(framework, "error", renderError);
|
|
2129
2151
|
}
|
|
2130
2152
|
return null;
|
|
2153
|
+
}, isPageRequest = (request) => {
|
|
2154
|
+
if (request.headers.get("hx-request") === "true")
|
|
2155
|
+
return true;
|
|
2156
|
+
if (request.headers.get("sec-fetch-dest") === "document")
|
|
2157
|
+
return true;
|
|
2158
|
+
return (request.headers.get("accept") ?? "").includes("text/html");
|
|
2131
2159
|
}, renderConventionError = async (framework, pageName, error) => {
|
|
2132
2160
|
const errorProps = buildErrorProps(error);
|
|
2133
2161
|
const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
|
|
@@ -2139,12 +2167,6 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
|
|
|
2139
2167
|
return htmlResponse;
|
|
2140
2168
|
}
|
|
2141
2169
|
return null;
|
|
2142
|
-
}, isPageRequest = (request) => {
|
|
2143
|
-
if (request.headers.get("hx-request") === "true")
|
|
2144
|
-
return true;
|
|
2145
|
-
if (request.headers.get("sec-fetch-dest") === "document")
|
|
2146
|
-
return true;
|
|
2147
|
-
return (request.headers.get("accept") ?? "").includes("text/html");
|
|
2148
2170
|
}, renderStaticRouteError = async (request, error) => {
|
|
2149
2171
|
if (!isPageRequest(request))
|
|
2150
2172
|
return null;
|
|
@@ -4458,7 +4480,7 @@ import { basename as basename3, dirname as dirname4, extname as extname2, join a
|
|
|
4458
4480
|
var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandGeneration, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
4459
4481
|
const importPath = relative3(dirname4(from), target).replace(/\\/g, "/");
|
|
4460
4482
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
4461
|
-
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
4483
|
+
}, 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) => {
|
|
4462
4484
|
for (const entry of entries) {
|
|
4463
4485
|
const entryPath = join7(dir, entry.name);
|
|
4464
4486
|
if (entry.isDirectory())
|
|
@@ -4503,18 +4525,21 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandG
|
|
|
4503
4525
|
return null;
|
|
4504
4526
|
}
|
|
4505
4527
|
const basePath = resolve4(dirname4(from), spec);
|
|
4528
|
+
const extensions = [
|
|
4529
|
+
".ts",
|
|
4530
|
+
".tsx",
|
|
4531
|
+
".mts",
|
|
4532
|
+
".cts",
|
|
4533
|
+
".js",
|
|
4534
|
+
".jsx",
|
|
4535
|
+
".mjs",
|
|
4536
|
+
".cjs",
|
|
4537
|
+
".json"
|
|
4538
|
+
];
|
|
4506
4539
|
const candidates = [
|
|
4507
4540
|
basePath,
|
|
4508
|
-
`${basePath}
|
|
4509
|
-
|
|
4510
|
-
`${basePath}.mjs`,
|
|
4511
|
-
`${basePath}.cjs`,
|
|
4512
|
-
`${basePath}.json`,
|
|
4513
|
-
join7(basePath, "index.ts"),
|
|
4514
|
-
join7(basePath, "index.js"),
|
|
4515
|
-
join7(basePath, "index.mjs"),
|
|
4516
|
-
join7(basePath, "index.cjs"),
|
|
4517
|
-
join7(basePath, "index.json")
|
|
4541
|
+
...extensions.map((extension) => `${basePath}${extension}`),
|
|
4542
|
+
...extensions.map((extension) => join7(basePath, `index${extension}`))
|
|
4518
4543
|
];
|
|
4519
4544
|
const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
|
|
4520
4545
|
const foundIndex = existResults.indexOf(true);
|
|
@@ -4599,7 +4624,7 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandG
|
|
|
4599
4624
|
rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), resolvedModuleImport));
|
|
4600
4625
|
}
|
|
4601
4626
|
for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
|
|
4602
|
-
transpiled = transpiled
|
|
4627
|
+
transpiled = replaceQuotedSpecifier(transpiled, spec, resolvedModuleImport);
|
|
4603
4628
|
}
|
|
4604
4629
|
let compiledCode = compile(transpiled, {
|
|
4605
4630
|
css: "injected",
|
|
@@ -4611,10 +4636,10 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandG
|
|
|
4611
4636
|
hmr: isDevelopmentRuntime()
|
|
4612
4637
|
}).js.code;
|
|
4613
4638
|
for (const [spec, compiledChildPath] of childModulePaths) {
|
|
4614
|
-
compiledCode = compiledCode
|
|
4639
|
+
compiledCode = replaceQuotedSpecifier(compiledCode, spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), compiledChildPath));
|
|
4615
4640
|
}
|
|
4616
4641
|
for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
|
|
4617
|
-
compiledCode = compiledCode
|
|
4642
|
+
compiledCode = replaceQuotedSpecifier(compiledCode, spec, resolvedModuleImport);
|
|
4618
4643
|
}
|
|
4619
4644
|
const sourceId = JSON.stringify(relative3(process.cwd(), resolutionSourcePath).replace(/\\/g, "/"));
|
|
4620
4645
|
const componentName = /export default function ([\w$]+)\s*\(/.exec(compiledCode)?.[1];
|
|
@@ -4674,9 +4699,9 @@ var createVueCompiler = async () => {
|
|
|
4674
4699
|
// src/core/vueServerModule.ts
|
|
4675
4700
|
import { readFileSync as readFileSync5, realpathSync } from "fs";
|
|
4676
4701
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
4677
|
-
import { dirname as dirname5, join as join8, relative as relative4, resolve as resolve5 } from "path";
|
|
4702
|
+
import { basename as basename4, dirname as dirname5, join as join8, relative as relative4, resolve as resolve5 } from "path";
|
|
4678
4703
|
var {Transpiler } = globalThis.Bun;
|
|
4679
|
-
var
|
|
4704
|
+
var serverCacheRoot3, compiledModuleCache3, syncIslandGeneration2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
4680
4705
|
const importPath = relative4(dirname5(from), target).replace(/\\/g, "/");
|
|
4681
4706
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
4682
4707
|
}, getCachedModulePath3 = (sourcePath) => {
|
|
@@ -4710,7 +4735,13 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
|
|
|
4710
4735
|
].join(`
|
|
4711
4736
|
`) : nonVueLines.join(`
|
|
4712
4737
|
`);
|
|
4713
|
-
},
|
|
4738
|
+
}, 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) => {
|
|
4739
|
+
try {
|
|
4740
|
+
return Bun.resolveSync(spec, dirname5(sourcePath));
|
|
4741
|
+
} catch {
|
|
4742
|
+
return null;
|
|
4743
|
+
}
|
|
4744
|
+
}, compileVueServerModule = async (sourcePath) => {
|
|
4714
4745
|
syncIslandGeneration2();
|
|
4715
4746
|
const cachedModulePath = compiledModuleCache3.get(sourcePath);
|
|
4716
4747
|
if (cachedModulePath)
|
|
@@ -4718,7 +4749,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
|
|
|
4718
4749
|
const compiler = await loadVueCompiler();
|
|
4719
4750
|
const source = await Bun.file(sourcePath).text();
|
|
4720
4751
|
const { descriptor } = compiler.parse(source, { filename: sourcePath });
|
|
4721
|
-
const componentId =
|
|
4752
|
+
const componentId = toKebab(basename4(sourcePath, ".vue"));
|
|
4722
4753
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
4723
4754
|
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
4724
4755
|
fs: {
|
|
@@ -4743,10 +4774,10 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
|
|
|
4743
4774
|
ssr: true,
|
|
4744
4775
|
ssrCssVars: descriptor.cssVars
|
|
4745
4776
|
}).code : "const ssrRender = () => {};";
|
|
4746
|
-
const
|
|
4747
|
-
const compiledChildren = await Promise.all(
|
|
4748
|
-
compiledPath: await compileVueServerModule(resolve5(dirname5(sourcePath),
|
|
4749
|
-
spec
|
|
4777
|
+
const relativeImports = extractRelativeImports(compiledScript.content);
|
|
4778
|
+
const compiledChildren = await Promise.all(relativeImports.filter((spec) => spec.endsWith(".vue")).map(async (spec) => ({
|
|
4779
|
+
compiledPath: await compileVueServerModule(resolve5(dirname5(sourcePath), spec)),
|
|
4780
|
+
spec
|
|
4750
4781
|
})));
|
|
4751
4782
|
const strippedScript = stripExports(compiledScript.content);
|
|
4752
4783
|
const transpiledScript = transpiler2.transformSync(strippedScript);
|
|
@@ -4758,17 +4789,28 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
|
|
|
4758
4789
|
].join(`
|
|
4759
4790
|
`));
|
|
4760
4791
|
const compiledModulePath = getCachedModulePath3(sourcePath);
|
|
4761
|
-
|
|
4792
|
+
const rewrittenSpecifiers = new Map;
|
|
4762
4793
|
for (const child of compiledChildren) {
|
|
4763
|
-
|
|
4794
|
+
rewrittenSpecifiers.set(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
4764
4795
|
}
|
|
4796
|
+
for (const spec of extractRelativeImports(assembled)) {
|
|
4797
|
+
if (rewrittenSpecifiers.has(spec))
|
|
4798
|
+
continue;
|
|
4799
|
+
const resolvedImport = resolveFromSource(spec, sourcePath);
|
|
4800
|
+
if (!resolvedImport)
|
|
4801
|
+
continue;
|
|
4802
|
+
rewrittenSpecifiers.set(spec, ensureRelativeImportPath2(compiledModulePath, resolvedImport));
|
|
4803
|
+
}
|
|
4804
|
+
const rewritten = assembled.replace(RELATIVE_SPECIFIER_PATTERN, (match, prefix, quote, spec) => {
|
|
4805
|
+
const target = rewrittenSpecifiers.get(spec);
|
|
4806
|
+
return target ? `${prefix}${quote}${target}${quote}` : match;
|
|
4807
|
+
});
|
|
4765
4808
|
await mkdir3(dirname5(compiledModulePath), { recursive: true });
|
|
4766
4809
|
await writeIfChanged2(compiledModulePath, rewritten);
|
|
4767
4810
|
compiledModuleCache3.set(sourcePath, compiledModulePath);
|
|
4768
4811
|
return compiledModulePath;
|
|
4769
4812
|
};
|
|
4770
4813
|
var init_vueServerModule = __esm(() => {
|
|
4771
|
-
init_constants();
|
|
4772
4814
|
init_isFile();
|
|
4773
4815
|
serverCacheRoot3 = join8(process.cwd(), ".absolutejs", "islands", "vue");
|
|
4774
4816
|
compiledModuleCache3 = new Map;
|
|
@@ -4776,6 +4818,7 @@ var init_vueServerModule = __esm(() => {
|
|
|
4776
4818
|
compiledModuleCache3.clear();
|
|
4777
4819
|
});
|
|
4778
4820
|
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
4821
|
+
RELATIVE_SPECIFIER_PATTERN = /(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(?<spec>\.{1,2}\/[^'"]*)\2/g;
|
|
4779
4822
|
});
|
|
4780
4823
|
|
|
4781
4824
|
// src/core/renderIslandMarkup.ts
|
|
@@ -4937,6 +4980,18 @@ var init_renderIslandMarkup = __esm(() => {
|
|
|
4937
4980
|
});
|
|
4938
4981
|
});
|
|
4939
4982
|
|
|
4983
|
+
// src/utils/requestRenderUrl.ts
|
|
4984
|
+
var requestRenderUrl = (request) => {
|
|
4985
|
+
if (!request)
|
|
4986
|
+
return;
|
|
4987
|
+
try {
|
|
4988
|
+
const parsed = new URL(request.url);
|
|
4989
|
+
return `${parsed.pathname.replace(/\/{2,}/g, "/")}${parsed.search}`;
|
|
4990
|
+
} catch {
|
|
4991
|
+
return;
|
|
4992
|
+
}
|
|
4993
|
+
};
|
|
4994
|
+
|
|
4940
4995
|
// src/react/pageHandler.ts
|
|
4941
4996
|
init_cspNonceRef();
|
|
4942
4997
|
init_islandPageContext();
|
|
@@ -5222,16 +5277,7 @@ init_spaRouteManifest();
|
|
|
5222
5277
|
init_resolveConvention();
|
|
5223
5278
|
init_browserTranslation();
|
|
5224
5279
|
var withRequestUrl = (props, url) => Object.assign(Object.create(null), props, { url });
|
|
5225
|
-
var resolveRequestPathname = (request) =>
|
|
5226
|
-
if (!request)
|
|
5227
|
-
return;
|
|
5228
|
-
try {
|
|
5229
|
-
const parsed = new URL(request.url);
|
|
5230
|
-
return `${parsed.pathname}${parsed.search}`;
|
|
5231
|
-
} catch {
|
|
5232
|
-
return;
|
|
5233
|
-
}
|
|
5234
|
-
};
|
|
5280
|
+
var resolveRequestPathname = (request) => requestRenderUrl(request);
|
|
5235
5281
|
var buildRefreshSetup = () => {
|
|
5236
5282
|
if (isProductionRuntime()) {
|
|
5237
5283
|
return "";
|
|
@@ -5407,6 +5453,7 @@ var reactFileRoute = (route) => defineFileRouteWith("react", route, async ({ man
|
|
|
5407
5453
|
init_cspNonceRef();
|
|
5408
5454
|
init_requestContext();
|
|
5409
5455
|
init_pageResponseCache();
|
|
5456
|
+
import { AsyncLocalStorage as AsyncLocalStorage5 } from "async_hooks";
|
|
5410
5457
|
import { readFile } from "fs/promises";
|
|
5411
5458
|
import { dirname, join } from "path";
|
|
5412
5459
|
init_devRouteRegistrationCallsite();
|
|
@@ -5479,6 +5526,27 @@ var injectFlightPayload = (html, flight, nonce) => {
|
|
|
5479
5526
|
});
|
|
5480
5527
|
};
|
|
5481
5528
|
|
|
5529
|
+
// src/react/serverComponents/nodeRendererRef.ts
|
|
5530
|
+
var STORAGE_KEY = Symbol.for("absolutejs.reactServerNodeRendererStorage");
|
|
5531
|
+
var isRendererStorage = (value) => typeof value === "object" && value !== null && ("getStore" in value) && typeof value.getStore === "function" && ("run" in value) && typeof value.run === "function";
|
|
5532
|
+
var isRenderer = (value) => typeof value === "function";
|
|
5533
|
+
var readStorage = () => {
|
|
5534
|
+
const storage = Reflect.get(globalThis, STORAGE_KEY);
|
|
5535
|
+
return isRendererStorage(storage) ? storage : undefined;
|
|
5536
|
+
};
|
|
5537
|
+
var getReactServerNodeRenderer = () => {
|
|
5538
|
+
const store = readStorage()?.getStore();
|
|
5539
|
+
return isRenderer(store) ? store : undefined;
|
|
5540
|
+
};
|
|
5541
|
+
var runWithReactServerNodeRenderer = (renderer, createStorage, render) => {
|
|
5542
|
+
let storage = readStorage();
|
|
5543
|
+
if (!storage) {
|
|
5544
|
+
storage = createStorage();
|
|
5545
|
+
Reflect.set(globalThis, STORAGE_KEY, storage);
|
|
5546
|
+
}
|
|
5547
|
+
return storage.run(renderer, render);
|
|
5548
|
+
};
|
|
5549
|
+
|
|
5482
5550
|
// src/react/serverComponents/pageHandler.ts
|
|
5483
5551
|
var isRecord4 = (value) => typeof value === "object" && value !== null;
|
|
5484
5552
|
var isPageModule = (value) => isRecord4(value) && typeof value.Page === "function" && isRecord4(value.clientManifest) && typeof value.createElement === "function" && typeof value.renderToReadableStream === "function";
|
|
@@ -5521,6 +5589,16 @@ var loadRenderer = async (rendererPath) => {
|
|
|
5521
5589
|
var logRenderError = (error) => {
|
|
5522
5590
|
console.error("[SSR] React Server Components error:", error);
|
|
5523
5591
|
};
|
|
5592
|
+
var createNodeRenderer = (pageModule, renderer) => {
|
|
5593
|
+
const { renderStaticHtml } = renderer;
|
|
5594
|
+
if (!renderStaticHtml)
|
|
5595
|
+
return;
|
|
5596
|
+
const render = (node) => renderStaticHtml(pageModule.renderToReadableStream(node, pageModule.clientManifest, {
|
|
5597
|
+
onError: logRenderError
|
|
5598
|
+
}));
|
|
5599
|
+
return render;
|
|
5600
|
+
};
|
|
5601
|
+
var createRendererStorage = () => new AsyncLocalStorage5;
|
|
5524
5602
|
var handleReactServerPageRequest = async (input) => {
|
|
5525
5603
|
const request = input.request ?? getCurrentAbsoluteRequest();
|
|
5526
5604
|
if (input.page === "") {
|
|
@@ -5536,11 +5614,13 @@ var handleReactServerPageRequest = async (input) => {
|
|
|
5536
5614
|
]);
|
|
5537
5615
|
const renderer = await loadRenderer(runtime.ssr);
|
|
5538
5616
|
const nonce = readCspNonce();
|
|
5539
|
-
const
|
|
5617
|
+
const renderFlight = () => pageModule.renderToReadableStream(pageModule.createElement(pageModule.Page, input.props ?? {}), pageModule.clientManifest, { onError: logRenderError });
|
|
5618
|
+
const nodeRenderer = createNodeRenderer(pageModule, renderer);
|
|
5619
|
+
const flight = nodeRenderer ? runWithReactServerNodeRenderer(nodeRenderer, createRendererStorage, renderFlight) : renderFlight();
|
|
5540
5620
|
const [forHtml, forPayload] = flight.tee();
|
|
5541
5621
|
const html = await renderer.renderHtml(forHtml, {
|
|
5542
5622
|
bootstrapModules: [runtime.client],
|
|
5543
|
-
bootstrapScriptContent: BROWSER_TRANSLATION_BASELINE_SCRIPT
|
|
5623
|
+
bootstrapScriptContent: `${BROWSER_TRANSLATION_BASELINE_SCRIPT}window.__ABS_SLOT_HYDRATION_PENDING__=true;`,
|
|
5544
5624
|
nonce,
|
|
5545
5625
|
onError: logRenderError
|
|
5546
5626
|
});
|
|
@@ -5563,36 +5643,122 @@ var handleReactServerPageRequest = async (input) => {
|
|
|
5563
5643
|
// src/react/Island.tsx
|
|
5564
5644
|
init_islandMarkupAttributes();
|
|
5565
5645
|
init_renderIslandMarkup();
|
|
5566
|
-
|
|
5567
|
-
|
|
5646
|
+
|
|
5647
|
+
// src/core/islandStylesheet.ts
|
|
5648
|
+
init_cspNonceRef();
|
|
5649
|
+
var INLINE_ISLAND_STYLES_CONTEXT_KEY = "__absoluteInlineIslandStyles";
|
|
5650
|
+
var ISLAND_STYLE_PRECEDENCE = "absolute-islands";
|
|
5651
|
+
var ISLAND_FRAMEWORKS2 = [
|
|
5652
|
+
"react",
|
|
5653
|
+
"svelte",
|
|
5654
|
+
"vue",
|
|
5655
|
+
"angular"
|
|
5656
|
+
];
|
|
5657
|
+
var toIslandFramework2 = (value) => ISLAND_FRAMEWORKS2.find((framework) => framework === value);
|
|
5658
|
+
var readIslandManifest = () => {
|
|
5659
|
+
const manifest = typeof window === "undefined" ? Reflect.get(globalThis, "__absoluteManifest") : Reflect.get(window, "__ABSOLUTE_MANIFEST__");
|
|
5660
|
+
return typeof manifest === "object" && manifest !== null ? manifest : undefined;
|
|
5661
|
+
};
|
|
5662
|
+
var findIslandStylesheet = (framework, component) => {
|
|
5663
|
+
const islandFramework = toIslandFramework2(framework);
|
|
5664
|
+
const manifest = readIslandManifest();
|
|
5665
|
+
if (!islandFramework || !manifest)
|
|
5666
|
+
return;
|
|
5667
|
+
const key = getIslandStyleManifestKey(islandFramework, component);
|
|
5668
|
+
const href = Reflect.get(manifest, key);
|
|
5669
|
+
return typeof href === "string" ? { href, key } : undefined;
|
|
5670
|
+
};
|
|
5671
|
+
var readIslandStyleNonce = () => {
|
|
5672
|
+
if (typeof document === "undefined")
|
|
5673
|
+
return readCspNonce() ?? "";
|
|
5674
|
+
return Array.from(document.querySelectorAll("script[nonce]")).find((element) => element.nonce)?.nonce ?? "";
|
|
5675
|
+
};
|
|
5676
|
+
|
|
5677
|
+
// src/react/IslandStyleLink.tsx
|
|
5678
|
+
import { jsx, jsxs, Fragment } from "react/jsx-runtime";
|
|
5679
|
+
var IslandStyleLink = ({
|
|
5680
|
+
component,
|
|
5681
|
+
framework
|
|
5682
|
+
}) => {
|
|
5683
|
+
const stylesheet = findIslandStylesheet(framework, component);
|
|
5684
|
+
if (!stylesheet)
|
|
5685
|
+
return null;
|
|
5686
|
+
const nonce = readIslandStyleNonce();
|
|
5687
|
+
return /* @__PURE__ */ jsx("link", {
|
|
5688
|
+
"data-island-style": stylesheet.key,
|
|
5689
|
+
href: stylesheet.href,
|
|
5690
|
+
nonce: nonce || undefined,
|
|
5691
|
+
precedence: ISLAND_STYLE_PRECEDENCE,
|
|
5692
|
+
rel: "stylesheet"
|
|
5693
|
+
});
|
|
5694
|
+
};
|
|
5695
|
+
var IslandWithStylesheet = ({
|
|
5696
|
+
component,
|
|
5697
|
+
framework,
|
|
5698
|
+
marker
|
|
5699
|
+
}) => /* @__PURE__ */ jsxs(Fragment, {
|
|
5700
|
+
children: [
|
|
5701
|
+
/* @__PURE__ */ jsx(IslandStyleLink, {
|
|
5702
|
+
component,
|
|
5703
|
+
framework
|
|
5704
|
+
}),
|
|
5705
|
+
/* @__PURE__ */ jsx("div", {
|
|
5706
|
+
...marker
|
|
5707
|
+
})
|
|
5708
|
+
]
|
|
5709
|
+
});
|
|
5710
|
+
|
|
5711
|
+
// src/react/Island.tsx
|
|
5712
|
+
import { jsx as jsx2, jsxs as jsxs2, Fragment as Fragment2 } from "react/jsx-runtime";
|
|
5713
|
+
var Island = (props) => {
|
|
5568
5714
|
if (typeof window !== "undefined") {
|
|
5569
|
-
return /* @__PURE__ */
|
|
5570
|
-
|
|
5571
|
-
|
|
5715
|
+
return /* @__PURE__ */ jsx2(IslandWithStylesheet, {
|
|
5716
|
+
component: props.component,
|
|
5717
|
+
framework: props.framework,
|
|
5718
|
+
marker: {
|
|
5719
|
+
...getIslandMarkerAttributes(props),
|
|
5720
|
+
suppressHydrationWarning: true
|
|
5721
|
+
}
|
|
5572
5722
|
});
|
|
5573
5723
|
}
|
|
5574
|
-
|
|
5575
|
-
|
|
5576
|
-
|
|
5577
|
-
|
|
5724
|
+
return /* @__PURE__ */ jsx2(ServerIsland, {
|
|
5725
|
+
island: props,
|
|
5726
|
+
registry: requireCurrentIslandRegistry()
|
|
5727
|
+
});
|
|
5728
|
+
};
|
|
5729
|
+
var ServerIsland = async ({ island, registry }) => {
|
|
5730
|
+
const { attributes, html } = await renderIslandResult(registry, island);
|
|
5731
|
+
return /* @__PURE__ */ jsxs2(Fragment2, {
|
|
5732
|
+
children: [
|
|
5733
|
+
/* @__PURE__ */ jsx2(IslandStyleLink, {
|
|
5734
|
+
component: island.component,
|
|
5735
|
+
framework: island.framework
|
|
5736
|
+
}),
|
|
5737
|
+
/* @__PURE__ */ jsx2("div", {
|
|
5738
|
+
...attributes,
|
|
5739
|
+
dangerouslySetInnerHTML: { __html: html }
|
|
5740
|
+
})
|
|
5741
|
+
]
|
|
5578
5742
|
});
|
|
5579
5743
|
};
|
|
5580
5744
|
// src/react/createIsland.tsx
|
|
5581
5745
|
init_islandMarkupAttributes();
|
|
5582
|
-
|
|
5583
|
-
import { jsx as jsx2 } from "react/jsx-runtime";
|
|
5746
|
+
import { jsx as jsx3 } from "react/jsx-runtime";
|
|
5584
5747
|
var createTypedIsland = (registry) => {
|
|
5585
|
-
const Island =
|
|
5748
|
+
const Island = (props) => {
|
|
5586
5749
|
if (typeof window !== "undefined") {
|
|
5587
|
-
return /* @__PURE__ */
|
|
5588
|
-
|
|
5589
|
-
|
|
5750
|
+
return /* @__PURE__ */ jsx3(IslandWithStylesheet, {
|
|
5751
|
+
component: props.component,
|
|
5752
|
+
framework: props.framework,
|
|
5753
|
+
marker: {
|
|
5754
|
+
...getIslandMarkerAttributes(props),
|
|
5755
|
+
suppressHydrationWarning: true
|
|
5756
|
+
}
|
|
5590
5757
|
});
|
|
5591
5758
|
}
|
|
5592
|
-
|
|
5593
|
-
|
|
5594
|
-
|
|
5595
|
-
dangerouslySetInnerHTML: { __html: result.html }
|
|
5759
|
+
return /* @__PURE__ */ jsx3(ServerIsland, {
|
|
5760
|
+
island: props,
|
|
5761
|
+
registry
|
|
5596
5762
|
});
|
|
5597
5763
|
};
|
|
5598
5764
|
return Island;
|
|
@@ -5710,5 +5876,5 @@ export {
|
|
|
5710
5876
|
useIslandStore
|
|
5711
5877
|
};
|
|
5712
5878
|
|
|
5713
|
-
//# debugId=
|
|
5879
|
+
//# debugId=EB99DA4FD961DFEC64756E2164756E21
|
|
5714
5880
|
//# sourceMappingURL=index.js.map
|