@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/vue/index.js
CHANGED
|
@@ -491,6 +491,12 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
|
|
|
491
491
|
logConventionRenderError(framework, "error", renderError);
|
|
492
492
|
}
|
|
493
493
|
return null;
|
|
494
|
+
}, isPageRequest = (request) => {
|
|
495
|
+
if (request.headers.get("hx-request") === "true")
|
|
496
|
+
return true;
|
|
497
|
+
if (request.headers.get("sec-fetch-dest") === "document")
|
|
498
|
+
return true;
|
|
499
|
+
return (request.headers.get("accept") ?? "").includes("text/html");
|
|
494
500
|
}, renderConventionError = async (framework, pageName, error) => {
|
|
495
501
|
const errorProps = buildErrorProps(error);
|
|
496
502
|
const frameworkResponse = await tryFrameworkErrorConvention(framework, pageName, errorProps, error);
|
|
@@ -502,12 +508,6 @@ var CONVENTIONS_KEY = "__absoluteConventions", isConventionsMap = (value) => Boo
|
|
|
502
508
|
return htmlResponse;
|
|
503
509
|
}
|
|
504
510
|
return null;
|
|
505
|
-
}, isPageRequest = (request) => {
|
|
506
|
-
if (request.headers.get("hx-request") === "true")
|
|
507
|
-
return true;
|
|
508
|
-
if (request.headers.get("sec-fetch-dest") === "document")
|
|
509
|
-
return true;
|
|
510
|
-
return (request.headers.get("accept") ?? "").includes("text/html");
|
|
511
511
|
}, renderStaticRouteError = async (request, error) => {
|
|
512
512
|
if (!isPageRequest(request))
|
|
513
513
|
return null;
|
|
@@ -927,7 +927,7 @@ var ISLAND_BOOTSTRAP_MANIFEST_KEY = "AbsoluteIslandBootstrap", LEGACY_ISLAND_BOO
|
|
|
927
927
|
islands[framework] = entries;
|
|
928
928
|
}
|
|
929
929
|
return islands;
|
|
930
|
-
}, getIslandManifestKey = (framework, component) => `Island${toIslandFrameworkSegment(framework)}${component}`;
|
|
930
|
+
}, 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}`;
|
|
931
931
|
|
|
932
932
|
// src/core/islandPageContext.ts
|
|
933
933
|
var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST__", ISLAND_STATE_MARKER = "__ABS_ISLAND_STATE__", CLOSING_HEAD_TAG = "</head>", warnedMissingBootstrap = false, warnIfBootstrapMissing = (manifest) => {
|
|
@@ -964,12 +964,27 @@ var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST
|
|
|
964
964
|
browserManifest[key] = value;
|
|
965
965
|
}
|
|
966
966
|
return browserManifest;
|
|
967
|
-
},
|
|
967
|
+
}, 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) => {
|
|
968
|
+
const keys = new Set;
|
|
969
|
+
for (const [tag] of html.matchAll(ISLAND_MARKER_TAG)) {
|
|
970
|
+
const framework = toIslandFramework(readMarkerAttribute(tag, "data-framework"));
|
|
971
|
+
const component = readMarkerAttribute(tag, "data-component");
|
|
972
|
+
if (framework && component)
|
|
973
|
+
keys.add(getIslandStyleManifestKey(framework, component));
|
|
974
|
+
}
|
|
975
|
+
return keys;
|
|
976
|
+
}, buildIslandStyleLinks = (manifest, html) => {
|
|
977
|
+
if (html === undefined)
|
|
978
|
+
return "";
|
|
979
|
+
const renderedKeys = collectRenderedIslandStyleKeys(html);
|
|
980
|
+
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("");
|
|
981
|
+
}, buildIslandsHeadMarkup = (manifest, html) => {
|
|
982
|
+
const styleLinks = buildIslandStyleLinks(manifest, html);
|
|
968
983
|
const manifestScript = `<script${nonceAttr()}>window.__ABSOLUTE_MANIFEST__ = ${escapeScriptContent(JSON.stringify(toBrowserManifest(manifest)))}</script>`;
|
|
969
984
|
const islandStateScript = `<script${nonceAttr()}>window.__ABS_ISLAND_STATE__ = ${escapeScriptContent(JSON.stringify(globalThis.__ABS_ISLAND_STATE__ ?? {}))}</script>`;
|
|
970
985
|
const bootstrapPath = getIslandBootstrapPath(manifest);
|
|
971
986
|
const bootstrapScript = bootstrapPath ? `<script${nonceAttr()} type="module" src="${bootstrapPath}"></script>` : "";
|
|
972
|
-
return `${manifestScript}${islandStateScript}${bootstrapScript}`;
|
|
987
|
+
return `${styleLinks}${manifestScript}${islandStateScript}${bootstrapScript}`;
|
|
973
988
|
}, injectHeadMarkup = (html, markup) => {
|
|
974
989
|
const closingHeadIndex = html.indexOf("</head>");
|
|
975
990
|
if (closingHeadIndex >= 0) {
|
|
@@ -1151,7 +1166,7 @@ var ISLAND_MARKER = 'data-island="true"', MANIFEST_MARKER = "__ABSOLUTE_MANIFEST
|
|
|
1151
1166
|
return html;
|
|
1152
1167
|
}
|
|
1153
1168
|
warnIfBootstrapMissing(manifest);
|
|
1154
|
-
return injectHeadMarkup(html, buildIslandsHeadMarkup(manifest));
|
|
1169
|
+
return injectHeadMarkup(html, buildIslandsHeadMarkup(manifest, html));
|
|
1155
1170
|
}, injectIslandPageContextStream = (stream, options) => {
|
|
1156
1171
|
const manifest = globalThis.__absoluteManifest;
|
|
1157
1172
|
if (!manifest)
|
|
@@ -1175,6 +1190,13 @@ var init_islandPageContext = __esm(() => {
|
|
|
1175
1190
|
init_logger();
|
|
1176
1191
|
MANIFEST_BUILD_DIR_KEY = Symbol.for("absolutejs.islandManifestBuildDir");
|
|
1177
1192
|
WINDOWS_ABSOLUTE_PATH = /^[A-Za-z]:[\\/]|^\\\\/;
|
|
1193
|
+
ISLAND_MARKER_TAG = /<[^>]*\bdata-island="true"[^>]*>/g;
|
|
1194
|
+
ISLAND_FRAMEWORKS = [
|
|
1195
|
+
"react",
|
|
1196
|
+
"svelte",
|
|
1197
|
+
"vue",
|
|
1198
|
+
"angular"
|
|
1199
|
+
];
|
|
1178
1200
|
});
|
|
1179
1201
|
|
|
1180
1202
|
// src/core/devRouteRegistrationCallsite.ts
|
|
@@ -4730,7 +4752,7 @@ import { basename as basename4, dirname as dirname6, extname as extname2, join a
|
|
|
4730
4752
|
var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandGeneration, transpiler, ensureRelativeImportPath = (from, target) => {
|
|
4731
4753
|
const importPath = relative3(dirname6(from), target).replace(/\\/g, "/");
|
|
4732
4754
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
4733
|
-
}, processDirectoryEntries = (entries, dir, targetFileName, stack) => {
|
|
4755
|
+
}, 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) => {
|
|
4734
4756
|
for (const entry of entries) {
|
|
4735
4757
|
const entryPath = join8(dir, entry.name);
|
|
4736
4758
|
if (entry.isDirectory())
|
|
@@ -4775,18 +4797,21 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandG
|
|
|
4775
4797
|
return null;
|
|
4776
4798
|
}
|
|
4777
4799
|
const basePath = resolve6(dirname6(from), spec);
|
|
4800
|
+
const extensions = [
|
|
4801
|
+
".ts",
|
|
4802
|
+
".tsx",
|
|
4803
|
+
".mts",
|
|
4804
|
+
".cts",
|
|
4805
|
+
".js",
|
|
4806
|
+
".jsx",
|
|
4807
|
+
".mjs",
|
|
4808
|
+
".cjs",
|
|
4809
|
+
".json"
|
|
4810
|
+
];
|
|
4778
4811
|
const candidates = [
|
|
4779
4812
|
basePath,
|
|
4780
|
-
`${basePath}
|
|
4781
|
-
|
|
4782
|
-
`${basePath}.mjs`,
|
|
4783
|
-
`${basePath}.cjs`,
|
|
4784
|
-
`${basePath}.json`,
|
|
4785
|
-
join8(basePath, "index.ts"),
|
|
4786
|
-
join8(basePath, "index.js"),
|
|
4787
|
-
join8(basePath, "index.mjs"),
|
|
4788
|
-
join8(basePath, "index.cjs"),
|
|
4789
|
-
join8(basePath, "index.json")
|
|
4813
|
+
...extensions.map((extension) => `${basePath}${extension}`),
|
|
4814
|
+
...extensions.map((extension) => join8(basePath, `index${extension}`))
|
|
4790
4815
|
];
|
|
4791
4816
|
const existResults = await Promise.all(candidates.map((candidate) => Bun.file(candidate).exists()));
|
|
4792
4817
|
const foundIndex = existResults.indexOf(true);
|
|
@@ -4871,7 +4896,7 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandG
|
|
|
4871
4896
|
rewrittenModulePaths.set(spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), resolvedModuleImport));
|
|
4872
4897
|
}
|
|
4873
4898
|
for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
|
|
4874
|
-
transpiled = transpiled
|
|
4899
|
+
transpiled = replaceQuotedSpecifier(transpiled, spec, resolvedModuleImport);
|
|
4875
4900
|
}
|
|
4876
4901
|
let compiledCode = compile(transpiled, {
|
|
4877
4902
|
css: "injected",
|
|
@@ -4883,10 +4908,10 @@ var serverCacheRoot2, compiledModuleCache2, originalSourcePathCache, syncIslandG
|
|
|
4883
4908
|
hmr: isDevelopmentRuntime()
|
|
4884
4909
|
}).js.code;
|
|
4885
4910
|
for (const [spec, compiledChildPath] of childModulePaths) {
|
|
4886
|
-
compiledCode = compiledCode
|
|
4911
|
+
compiledCode = replaceQuotedSpecifier(compiledCode, spec, ensureRelativeImportPath(getCachedModulePath2(sourcePath), compiledChildPath));
|
|
4887
4912
|
}
|
|
4888
4913
|
for (const [spec, resolvedModuleImport] of rewrittenModulePaths) {
|
|
4889
|
-
compiledCode = compiledCode
|
|
4914
|
+
compiledCode = replaceQuotedSpecifier(compiledCode, spec, resolvedModuleImport);
|
|
4890
4915
|
}
|
|
4891
4916
|
const sourceId = JSON.stringify(relative3(process.cwd(), resolutionSourcePath).replace(/\\/g, "/"));
|
|
4892
4917
|
const componentName = /export default function ([\w$]+)\s*\(/.exec(compiledCode)?.[1];
|
|
@@ -4946,9 +4971,9 @@ var createVueCompiler = async () => {
|
|
|
4946
4971
|
// src/core/vueServerModule.ts
|
|
4947
4972
|
import { readFileSync as readFileSync7, realpathSync } from "fs";
|
|
4948
4973
|
import { mkdir as mkdir3 } from "fs/promises";
|
|
4949
|
-
import { dirname as dirname7, join as join9, relative as relative4, resolve as resolve7 } from "path";
|
|
4974
|
+
import { basename as basename5, dirname as dirname7, join as join9, relative as relative4, resolve as resolve7 } from "path";
|
|
4950
4975
|
var {Transpiler } = globalThis.Bun;
|
|
4951
|
-
var
|
|
4976
|
+
var serverCacheRoot3, compiledModuleCache3, syncIslandGeneration2, transpiler2, ensureRelativeImportPath2 = (from, target) => {
|
|
4952
4977
|
const importPath = relative4(dirname7(from), target).replace(/\\/g, "/");
|
|
4953
4978
|
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
4954
4979
|
}, getCachedModulePath3 = (sourcePath) => {
|
|
@@ -4982,7 +5007,13 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
|
|
|
4982
5007
|
].join(`
|
|
4983
5008
|
`) : nonVueLines.join(`
|
|
4984
5009
|
`);
|
|
4985
|
-
},
|
|
5010
|
+
}, 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) => {
|
|
5011
|
+
try {
|
|
5012
|
+
return Bun.resolveSync(spec, dirname7(sourcePath));
|
|
5013
|
+
} catch {
|
|
5014
|
+
return null;
|
|
5015
|
+
}
|
|
5016
|
+
}, compileVueServerModule = async (sourcePath) => {
|
|
4986
5017
|
syncIslandGeneration2();
|
|
4987
5018
|
const cachedModulePath = compiledModuleCache3.get(sourcePath);
|
|
4988
5019
|
if (cachedModulePath)
|
|
@@ -4990,7 +5021,7 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
|
|
|
4990
5021
|
const compiler = await loadVueCompiler();
|
|
4991
5022
|
const source = await Bun.file(sourcePath).text();
|
|
4992
5023
|
const { descriptor } = compiler.parse(source, { filename: sourcePath });
|
|
4993
|
-
const componentId =
|
|
5024
|
+
const componentId = toKebab(basename5(sourcePath, ".vue"));
|
|
4994
5025
|
const hasScript = descriptor.script || descriptor.scriptSetup;
|
|
4995
5026
|
const compiledScript = hasScript ? compiler.compileScript(descriptor, {
|
|
4996
5027
|
fs: {
|
|
@@ -5015,10 +5046,10 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
|
|
|
5015
5046
|
ssr: true,
|
|
5016
5047
|
ssrCssVars: descriptor.cssVars
|
|
5017
5048
|
}).code : "const ssrRender = () => {};";
|
|
5018
|
-
const
|
|
5019
|
-
const compiledChildren = await Promise.all(
|
|
5020
|
-
compiledPath: await compileVueServerModule(resolve7(dirname7(sourcePath),
|
|
5021
|
-
spec
|
|
5049
|
+
const relativeImports = extractRelativeImports(compiledScript.content);
|
|
5050
|
+
const compiledChildren = await Promise.all(relativeImports.filter((spec) => spec.endsWith(".vue")).map(async (spec) => ({
|
|
5051
|
+
compiledPath: await compileVueServerModule(resolve7(dirname7(sourcePath), spec)),
|
|
5052
|
+
spec
|
|
5022
5053
|
})));
|
|
5023
5054
|
const strippedScript = stripExports(compiledScript.content);
|
|
5024
5055
|
const transpiledScript = transpiler2.transformSync(strippedScript);
|
|
@@ -5030,17 +5061,28 @@ var ISLAND_COMPONENT_ID_LENGTH = 8, serverCacheRoot3, compiledModuleCache3, sync
|
|
|
5030
5061
|
].join(`
|
|
5031
5062
|
`));
|
|
5032
5063
|
const compiledModulePath = getCachedModulePath3(sourcePath);
|
|
5033
|
-
|
|
5064
|
+
const rewrittenSpecifiers = new Map;
|
|
5034
5065
|
for (const child of compiledChildren) {
|
|
5035
|
-
|
|
5066
|
+
rewrittenSpecifiers.set(child.spec, ensureRelativeImportPath2(compiledModulePath, child.compiledPath));
|
|
5036
5067
|
}
|
|
5068
|
+
for (const spec of extractRelativeImports(assembled)) {
|
|
5069
|
+
if (rewrittenSpecifiers.has(spec))
|
|
5070
|
+
continue;
|
|
5071
|
+
const resolvedImport = resolveFromSource(spec, sourcePath);
|
|
5072
|
+
if (!resolvedImport)
|
|
5073
|
+
continue;
|
|
5074
|
+
rewrittenSpecifiers.set(spec, ensureRelativeImportPath2(compiledModulePath, resolvedImport));
|
|
5075
|
+
}
|
|
5076
|
+
const rewritten = assembled.replace(RELATIVE_SPECIFIER_PATTERN, (match, prefix, quote, spec) => {
|
|
5077
|
+
const target = rewrittenSpecifiers.get(spec);
|
|
5078
|
+
return target ? `${prefix}${quote}${target}${quote}` : match;
|
|
5079
|
+
});
|
|
5037
5080
|
await mkdir3(dirname7(compiledModulePath), { recursive: true });
|
|
5038
5081
|
await writeIfChanged2(compiledModulePath, rewritten);
|
|
5039
5082
|
compiledModuleCache3.set(sourcePath, compiledModulePath);
|
|
5040
5083
|
return compiledModulePath;
|
|
5041
5084
|
};
|
|
5042
5085
|
var init_vueServerModule = __esm(() => {
|
|
5043
|
-
init_constants();
|
|
5044
5086
|
init_isFile();
|
|
5045
5087
|
serverCacheRoot3 = join9(process.cwd(), ".absolutejs", "islands", "vue");
|
|
5046
5088
|
compiledModuleCache3 = new Map;
|
|
@@ -5048,6 +5090,7 @@ var init_vueServerModule = __esm(() => {
|
|
|
5048
5090
|
compiledModuleCache3.clear();
|
|
5049
5091
|
});
|
|
5050
5092
|
transpiler2 = new Transpiler({ loader: "ts", target: "browser" });
|
|
5093
|
+
RELATIVE_SPECIFIER_PATTERN = /(\bfrom\s*|\bimport\s*\(\s*|\bimport\s+)(['"])(?<spec>\.{1,2}\/[^'"]*)\2/g;
|
|
5051
5094
|
});
|
|
5052
5095
|
|
|
5053
5096
|
// src/core/renderIslandMarkup.ts
|
|
@@ -5209,6 +5252,18 @@ var init_renderIslandMarkup = __esm(() => {
|
|
|
5209
5252
|
});
|
|
5210
5253
|
});
|
|
5211
5254
|
|
|
5255
|
+
// src/utils/requestRenderUrl.ts
|
|
5256
|
+
var requestRenderUrl = (request) => {
|
|
5257
|
+
if (!request)
|
|
5258
|
+
return;
|
|
5259
|
+
try {
|
|
5260
|
+
const parsed = new URL(request.url);
|
|
5261
|
+
return `${parsed.pathname.replace(/\/{2,}/g, "/")}${parsed.search}`;
|
|
5262
|
+
} catch {
|
|
5263
|
+
return;
|
|
5264
|
+
}
|
|
5265
|
+
};
|
|
5266
|
+
|
|
5212
5267
|
// src/vue/pageHandler.ts
|
|
5213
5268
|
init_escapeScriptContent();
|
|
5214
5269
|
init_cspNonceRef();
|
|
@@ -5216,6 +5271,38 @@ init_inlinePageCss();
|
|
|
5216
5271
|
init_spaRouteCss();
|
|
5217
5272
|
init_spaRouteManifest();
|
|
5218
5273
|
init_islandPageContext();
|
|
5274
|
+
|
|
5275
|
+
// src/core/islandStylesheet.ts
|
|
5276
|
+
init_cspNonceRef();
|
|
5277
|
+
var INLINE_ISLAND_STYLES_CONTEXT_KEY = "__absoluteInlineIslandStyles";
|
|
5278
|
+
var ISLAND_STYLE_PRECEDENCE = "absolute-islands";
|
|
5279
|
+
var ISLAND_FRAMEWORKS2 = [
|
|
5280
|
+
"react",
|
|
5281
|
+
"svelte",
|
|
5282
|
+
"vue",
|
|
5283
|
+
"angular"
|
|
5284
|
+
];
|
|
5285
|
+
var toIslandFramework2 = (value) => ISLAND_FRAMEWORKS2.find((framework) => framework === value);
|
|
5286
|
+
var readIslandManifest = () => {
|
|
5287
|
+
const manifest = typeof window === "undefined" ? Reflect.get(globalThis, "__absoluteManifest") : Reflect.get(window, "__ABSOLUTE_MANIFEST__");
|
|
5288
|
+
return typeof manifest === "object" && manifest !== null ? manifest : undefined;
|
|
5289
|
+
};
|
|
5290
|
+
var findIslandStylesheet = (framework, component) => {
|
|
5291
|
+
const islandFramework = toIslandFramework2(framework);
|
|
5292
|
+
const manifest = readIslandManifest();
|
|
5293
|
+
if (!islandFramework || !manifest)
|
|
5294
|
+
return;
|
|
5295
|
+
const key = getIslandStyleManifestKey(islandFramework, component);
|
|
5296
|
+
const href = Reflect.get(manifest, key);
|
|
5297
|
+
return typeof href === "string" ? { href, key } : undefined;
|
|
5298
|
+
};
|
|
5299
|
+
var readIslandStyleNonce = () => {
|
|
5300
|
+
if (typeof document === "undefined")
|
|
5301
|
+
return readCspNonce() ?? "";
|
|
5302
|
+
return Array.from(document.querySelectorAll("script[nonce]")).find((element) => element.nonce)?.nonce ?? "";
|
|
5303
|
+
};
|
|
5304
|
+
|
|
5305
|
+
// src/vue/pageHandler.ts
|
|
5219
5306
|
init_devRouteRegistrationCallsite();
|
|
5220
5307
|
init_requestContext();
|
|
5221
5308
|
init_pageProtocol();
|
|
@@ -5618,16 +5705,7 @@ var readSetupAppHook = (value) => {
|
|
|
5618
5705
|
};
|
|
5619
5706
|
var readHasSpaRoutes = (value) => isRecord4(value) && Array.isArray(value["routes"]);
|
|
5620
5707
|
var readDefaultExport = (value) => isRecord4(value) ? value.default : undefined;
|
|
5621
|
-
var resolveRequestRenderUrl = (request) =>
|
|
5622
|
-
if (!request)
|
|
5623
|
-
return "/";
|
|
5624
|
-
try {
|
|
5625
|
-
const parsed = new URL(request.url);
|
|
5626
|
-
return `${parsed.pathname}${parsed.search}`;
|
|
5627
|
-
} catch {
|
|
5628
|
-
return "/";
|
|
5629
|
-
}
|
|
5630
|
-
};
|
|
5708
|
+
var resolveRequestRenderUrl = (request) => requestRenderUrl(request) ?? "/";
|
|
5631
5709
|
var primeVueStream = async (stream) => {
|
|
5632
5710
|
const reader = stream.getReader();
|
|
5633
5711
|
const firstChunk = await reader.read();
|
|
@@ -5783,10 +5861,12 @@ var handleVuePageRequest = async (input) => {
|
|
|
5783
5861
|
}
|
|
5784
5862
|
if (resolvedOptions?.collectStreamingSlots !== true) {
|
|
5785
5863
|
const body = await renderToString(app, ssrContext);
|
|
5786
|
-
|
|
5864
|
+
const html = injectIslandPageContext(`${head}${body}${buildTail()}`, { hasIslands: resolvedPage.hasIslands ? true : undefined });
|
|
5865
|
+
return new Response(html, {
|
|
5787
5866
|
headers: streamingPageHeaders()
|
|
5788
5867
|
});
|
|
5789
5868
|
}
|
|
5869
|
+
ssrContext[INLINE_ISLAND_STYLES_CONTEXT_KEY] = new Set;
|
|
5790
5870
|
const bodyStream = renderToWebStream(app, ssrContext);
|
|
5791
5871
|
const { firstChunk, reader } = await primeVueStream(bodyStream);
|
|
5792
5872
|
const stream = new ReadableStream({
|
|
@@ -5856,7 +5936,12 @@ var applyVueRouterRedirect = (router, requestedUrl, setRedirect, status = DEFAUL
|
|
|
5856
5936
|
var defineRoutes = (routes) => routes;
|
|
5857
5937
|
var defineVueSetupApp = (hook) => hook;
|
|
5858
5938
|
// src/vue/Island.ts
|
|
5859
|
-
import {
|
|
5939
|
+
import {
|
|
5940
|
+
defineComponent,
|
|
5941
|
+
h as h2,
|
|
5942
|
+
onServerPrefetch,
|
|
5943
|
+
useSSRContext
|
|
5944
|
+
} from "vue";
|
|
5860
5945
|
|
|
5861
5946
|
// src/client/preserveIslandMarkup.ts
|
|
5862
5947
|
init_islandMarkupAttributes();
|
|
@@ -5910,6 +5995,21 @@ var preserveIslandMarkup = (props) => {
|
|
|
5910
5995
|
innerHTML: liveCandidate.innerHTML
|
|
5911
5996
|
};
|
|
5912
5997
|
};
|
|
5998
|
+
var claimedServerIslands = new WeakSet;
|
|
5999
|
+
var claimServerIslandStyleLink = (props) => {
|
|
6000
|
+
if (typeof document === "undefined")
|
|
6001
|
+
return null;
|
|
6002
|
+
const element = Array.from(document.querySelectorAll('[data-island="true"]')).find((candidate) => !claimedServerIslands.has(candidate) && isMatchingIslandElement(candidate, props));
|
|
6003
|
+
if (!element)
|
|
6004
|
+
return null;
|
|
6005
|
+
claimedServerIslands.add(element);
|
|
6006
|
+
const previous = element.previousSibling;
|
|
6007
|
+
if (!(previous instanceof HTMLLinkElement))
|
|
6008
|
+
return null;
|
|
6009
|
+
const key = previous.dataset.islandStyle;
|
|
6010
|
+
const href = previous.getAttribute("href");
|
|
6011
|
+
return key && href ? { href, key } : null;
|
|
6012
|
+
};
|
|
5913
6013
|
var innerHtmlObjects = new Map;
|
|
5914
6014
|
var getStableInnerHtml = (html) => {
|
|
5915
6015
|
const existing = innerHtmlObjects.get(html);
|
|
@@ -5925,7 +6025,7 @@ init_islandMarkupAttributes();
|
|
|
5925
6025
|
|
|
5926
6026
|
// src/core/normalizeIslandProps.ts
|
|
5927
6027
|
var EMPTY_PROPS = {};
|
|
5928
|
-
var
|
|
6028
|
+
var ISLAND_FRAMEWORKS3 = [
|
|
5929
6029
|
"react",
|
|
5930
6030
|
"svelte",
|
|
5931
6031
|
"vue",
|
|
@@ -5938,7 +6038,7 @@ var ISLAND_HYDRATE_MODES = [
|
|
|
5938
6038
|
"visible",
|
|
5939
6039
|
"none"
|
|
5940
6040
|
];
|
|
5941
|
-
var isIslandFramework = (value) =>
|
|
6041
|
+
var isIslandFramework = (value) => ISLAND_FRAMEWORKS3.some((framework) => framework === value);
|
|
5942
6042
|
var isIslandHydrate = (value) => ISLAND_HYDRATE_MODES.some((mode) => mode === value);
|
|
5943
6043
|
var normalizeRuntimeIslandRenderProps = (raw) => {
|
|
5944
6044
|
const { component, framework, hydrate, props } = raw;
|
|
@@ -5977,6 +6077,40 @@ var normalizeIslandProps = (value) => {
|
|
|
5977
6077
|
|
|
5978
6078
|
// src/vue/Island.ts
|
|
5979
6079
|
init_renderIslandMarkup();
|
|
6080
|
+
|
|
6081
|
+
// src/vue/islandStyleLink.ts
|
|
6082
|
+
import { h } from "vue";
|
|
6083
|
+
var readInlineStyleKeys = (ssrContext) => {
|
|
6084
|
+
if (typeof ssrContext !== "object" || ssrContext === null)
|
|
6085
|
+
return;
|
|
6086
|
+
const keys = Reflect.get(ssrContext, INLINE_ISLAND_STYLES_CONTEXT_KEY);
|
|
6087
|
+
return keys instanceof Set ? keys : undefined;
|
|
6088
|
+
};
|
|
6089
|
+
var claimInlineIslandStyleLink = (ssrContext, props) => {
|
|
6090
|
+
const claimed = readInlineStyleKeys(ssrContext);
|
|
6091
|
+
const stylesheet = claimed ? findIslandStylesheet(props.framework, props.component) : undefined;
|
|
6092
|
+
if (!claimed || !stylesheet || claimed.has(stylesheet.key))
|
|
6093
|
+
return null;
|
|
6094
|
+
claimed.add(stylesheet.key);
|
|
6095
|
+
const nonce = readIslandStyleNonce();
|
|
6096
|
+
return {
|
|
6097
|
+
"data-island-style": stylesheet.key,
|
|
6098
|
+
href: stylesheet.href,
|
|
6099
|
+
...nonce ? { nonce } : {},
|
|
6100
|
+
rel: "stylesheet"
|
|
6101
|
+
};
|
|
6102
|
+
};
|
|
6103
|
+
var hydratedIslandStyleLink = (props) => {
|
|
6104
|
+
const link = claimServerIslandStyleLink(props);
|
|
6105
|
+
return link ? {
|
|
6106
|
+
"data-island-style": link.key,
|
|
6107
|
+
href: link.href,
|
|
6108
|
+
rel: "stylesheet"
|
|
6109
|
+
} : null;
|
|
6110
|
+
};
|
|
6111
|
+
var withIslandStyleLink = (link, island) => link ? [h("link", link), island] : island;
|
|
6112
|
+
|
|
6113
|
+
// src/vue/Island.ts
|
|
5980
6114
|
var defineRuntimeIslandComponent = (setup) => defineComponent({
|
|
5981
6115
|
name: "AbsoluteIsland",
|
|
5982
6116
|
props: {
|
|
@@ -6001,25 +6135,33 @@ var defineRuntimeIslandComponent = (setup) => defineComponent({
|
|
|
6001
6135
|
});
|
|
6002
6136
|
var Island = defineRuntimeIslandComponent((props) => {
|
|
6003
6137
|
const isBrowser = typeof window !== "undefined";
|
|
6138
|
+
const ssrContext = isBrowser ? undefined : useSSRContext();
|
|
6004
6139
|
let markerAttributes = getIslandMarkerAttributes(props);
|
|
6005
6140
|
let html = "";
|
|
6141
|
+
let styleLink = isBrowser ? hydratedIslandStyleLink(props) : null;
|
|
6006
6142
|
onServerPrefetch(async () => {
|
|
6007
6143
|
const result = await renderIslandResult(requireCurrentIslandRegistry(), props);
|
|
6008
6144
|
({ attributes: markerAttributes, html } = result);
|
|
6145
|
+
styleLink = claimInlineIslandStyleLink(ssrContext, props);
|
|
6009
6146
|
});
|
|
6010
6147
|
return () => {
|
|
6011
6148
|
const preserved = isBrowser ? preserveIslandMarkup(props) : null;
|
|
6012
|
-
return
|
|
6149
|
+
return withIslandStyleLink(styleLink, h2("div", {
|
|
6013
6150
|
...preserved?.attributes ?? markerAttributes,
|
|
6014
6151
|
"data-allow-mismatch": "",
|
|
6015
6152
|
innerHTML: isBrowser ? preserved?.innerHTML : html
|
|
6016
|
-
});
|
|
6153
|
+
}));
|
|
6017
6154
|
};
|
|
6018
6155
|
});
|
|
6019
6156
|
// src/vue/createIsland.ts
|
|
6020
6157
|
init_islandMarkupAttributes();
|
|
6021
6158
|
init_renderIslandMarkup();
|
|
6022
|
-
import {
|
|
6159
|
+
import {
|
|
6160
|
+
defineComponent as defineComponent2,
|
|
6161
|
+
h as h3,
|
|
6162
|
+
onServerPrefetch as onServerPrefetch2,
|
|
6163
|
+
useSSRContext as useSSRContext2
|
|
6164
|
+
} from "vue";
|
|
6023
6165
|
var defineRuntimeIslandComponent2 = (setup) => defineComponent2({
|
|
6024
6166
|
name: "AbsoluteIsland",
|
|
6025
6167
|
props: {
|
|
@@ -6044,17 +6186,20 @@ var defineRuntimeIslandComponent2 = (setup) => defineComponent2({
|
|
|
6044
6186
|
});
|
|
6045
6187
|
var createTypedIsland = (registry) => defineRuntimeIslandComponent2((props) => {
|
|
6046
6188
|
const isBrowser = typeof window !== "undefined";
|
|
6189
|
+
const ssrContext = isBrowser ? undefined : useSSRContext2();
|
|
6047
6190
|
let markerAttributes = getIslandMarkerAttributes(props);
|
|
6048
6191
|
let html = "";
|
|
6192
|
+
let styleLink = isBrowser ? hydratedIslandStyleLink(props) : null;
|
|
6049
6193
|
onServerPrefetch2(async () => {
|
|
6050
6194
|
const result = await renderIslandResult(registry, props);
|
|
6051
6195
|
({ attributes: markerAttributes, html } = result);
|
|
6196
|
+
styleLink = claimInlineIslandStyleLink(ssrContext, props);
|
|
6052
6197
|
});
|
|
6053
|
-
return () =>
|
|
6198
|
+
return () => withIslandStyleLink(styleLink, h3("div", {
|
|
6054
6199
|
...markerAttributes,
|
|
6055
6200
|
"data-allow-mismatch": "",
|
|
6056
6201
|
innerHTML: isBrowser ? undefined : html
|
|
6057
|
-
});
|
|
6202
|
+
}));
|
|
6058
6203
|
});
|
|
6059
6204
|
// src/vue/useIslandStore.ts
|
|
6060
6205
|
import { customRef, onBeforeUnmount } from "vue";
|
|
@@ -6334,7 +6479,7 @@ var preserveBrowserTranslation = (strategy) => {
|
|
|
6334
6479
|
return translatedStrategy;
|
|
6335
6480
|
};
|
|
6336
6481
|
// src/vue/components/Image.ts
|
|
6337
|
-
import { computed, defineComponent as defineComponent3, h as
|
|
6482
|
+
import { computed, defineComponent as defineComponent3, h as h4, ref } from "vue";
|
|
6338
6483
|
|
|
6339
6484
|
// src/utils/imageClient.ts
|
|
6340
6485
|
init_constants();
|
|
@@ -6471,7 +6616,7 @@ var Image = defineComponent3({
|
|
|
6471
6616
|
props.onError?.(event);
|
|
6472
6617
|
};
|
|
6473
6618
|
return () => {
|
|
6474
|
-
const imgNode =
|
|
6619
|
+
const imgNode = h4("img", {
|
|
6475
6620
|
alt: props.alt,
|
|
6476
6621
|
class: props.className,
|
|
6477
6622
|
crossorigin: props.crossOrigin,
|
|
@@ -6488,7 +6633,7 @@ var Image = defineComponent3({
|
|
|
6488
6633
|
style: imgStyle.value,
|
|
6489
6634
|
width: props.fill ? undefined : props.width
|
|
6490
6635
|
});
|
|
6491
|
-
return props.fill ?
|
|
6636
|
+
return props.fill ? h4("span", { style: fillWrapperStyle }, [imgNode]) : imgNode;
|
|
6492
6637
|
};
|
|
6493
6638
|
}
|
|
6494
6639
|
});
|
|
@@ -6496,12 +6641,12 @@ var Image = defineComponent3({
|
|
|
6496
6641
|
import {
|
|
6497
6642
|
cloneVNode,
|
|
6498
6643
|
defineComponent as defineComponent4,
|
|
6499
|
-
h as
|
|
6644
|
+
h as h5,
|
|
6500
6645
|
isVNode,
|
|
6501
6646
|
onMounted,
|
|
6502
6647
|
onBeforeUnmount as onBeforeUnmount2,
|
|
6503
6648
|
ref as ref2,
|
|
6504
|
-
useSSRContext
|
|
6649
|
+
useSSRContext as useSSRContext3
|
|
6505
6650
|
} from "vue";
|
|
6506
6651
|
var renderVueNodesToHtml = async (nodes) => {
|
|
6507
6652
|
const { createSSRApp, h: createVNode } = await import("vue");
|
|
@@ -6644,7 +6789,7 @@ var SuspenseSlot = defineComponent4({
|
|
|
6644
6789
|
const hasError = ref2(false);
|
|
6645
6790
|
const hasPatchedDom = ref2(readPatchedDomState());
|
|
6646
6791
|
const usesFrameworkSlots = hasFrameworkSlots(slots.default, slots.fallback, slots.error, props.promise);
|
|
6647
|
-
const isSsrRender =
|
|
6792
|
+
const isSsrRender = useSSRContext3() !== undefined;
|
|
6648
6793
|
if (isSsrRender) {
|
|
6649
6794
|
registerSuspenseSlotForSsr(props, slots, usesFrameworkSlots);
|
|
6650
6795
|
}
|
|
@@ -6694,14 +6839,14 @@ var SuspenseSlot = defineComponent4({
|
|
|
6694
6839
|
};
|
|
6695
6840
|
return () => {
|
|
6696
6841
|
if (!usesFrameworkSlots) {
|
|
6697
|
-
return
|
|
6842
|
+
return h5("div", {
|
|
6698
6843
|
class: props.className,
|
|
6699
6844
|
"data-absolute-slot": "true",
|
|
6700
6845
|
id: props.id,
|
|
6701
6846
|
innerHTML: props.fallbackHtml
|
|
6702
6847
|
});
|
|
6703
6848
|
}
|
|
6704
|
-
return
|
|
6849
|
+
return h5("div", {
|
|
6705
6850
|
class: props.className,
|
|
6706
6851
|
"data-absolute-slot": "true",
|
|
6707
6852
|
"data-allow-mismatch": "",
|
|
@@ -6711,7 +6856,7 @@ var SuspenseSlot = defineComponent4({
|
|
|
6711
6856
|
}
|
|
6712
6857
|
});
|
|
6713
6858
|
// src/vue/components/StreamSlot.ts
|
|
6714
|
-
import { defineComponent as defineComponent5, h as
|
|
6859
|
+
import { defineComponent as defineComponent5, h as h6, useSSRContext as useSSRContext4 } from "vue";
|
|
6715
6860
|
var StreamSlot = defineComponent5({
|
|
6716
6861
|
name: "AbsoluteStreamSlot",
|
|
6717
6862
|
props: {
|
|
@@ -6726,10 +6871,10 @@ var StreamSlot = defineComponent5({
|
|
|
6726
6871
|
timeoutMs: { default: undefined, type: Number }
|
|
6727
6872
|
},
|
|
6728
6873
|
setup(props) {
|
|
6729
|
-
if (
|
|
6874
|
+
if (useSSRContext4() !== undefined) {
|
|
6730
6875
|
registerStreamSlotForSsr(props);
|
|
6731
6876
|
}
|
|
6732
|
-
return () =>
|
|
6877
|
+
return () => h6("div", {
|
|
6733
6878
|
class: props.className,
|
|
6734
6879
|
"data-absolute-slot": "true",
|
|
6735
6880
|
id: props.id,
|
|
@@ -6914,7 +7059,7 @@ var useServerData = (key, fetcher, options = {}) => {
|
|
|
6914
7059
|
return state;
|
|
6915
7060
|
};
|
|
6916
7061
|
// src/vue/router/Link.ts
|
|
6917
|
-
import { defineComponent as defineComponent6, getCurrentInstance as getCurrentInstance2, h as
|
|
7062
|
+
import { defineComponent as defineComponent6, getCurrentInstance as getCurrentInstance2, h as h7 } from "vue";
|
|
6918
7063
|
|
|
6919
7064
|
// src/client/prefetch.ts
|
|
6920
7065
|
var PREFETCH_CACHE_LIMIT = 16;
|
|
@@ -7382,7 +7527,7 @@ var Link = defineComponent6({
|
|
|
7382
7527
|
router.push(props.href);
|
|
7383
7528
|
}
|
|
7384
7529
|
};
|
|
7385
|
-
return () =>
|
|
7530
|
+
return () => h7("a", {
|
|
7386
7531
|
download: props.download,
|
|
7387
7532
|
href: props.href,
|
|
7388
7533
|
onBlur,
|
|
@@ -7418,5 +7563,5 @@ export {
|
|
|
7418
7563
|
useServerData
|
|
7419
7564
|
};
|
|
7420
7565
|
|
|
7421
|
-
//# debugId=
|
|
7566
|
+
//# debugId=9F5483EBA9A0E22964756E2164756E21
|
|
7422
7567
|
//# sourceMappingURL=index.js.map
|