@absolutejs/absolute 0.19.0-beta.783 → 0.19.0-beta.784
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/dist/angular/browser.js +57 -9801
- package/dist/angular/browser.js.map +4 -246
- package/dist/angular/index.js +61 -14967
- package/dist/angular/index.js.map +4 -282
- package/dist/angular/server.js +45 -5699
- package/dist/angular/server.js.map +3 -52
- package/dist/build.js +45 -18021
- package/dist/build.js.map +3 -100
- package/dist/chunk-102fp7xe.js +63 -0
- package/dist/chunk-102fp7xe.js.map +10 -0
- package/dist/chunk-11zpfqz6.js +19 -0
- package/dist/chunk-11zpfqz6.js.map +10 -0
- package/dist/chunk-1e9vsfyh.js +100 -0
- package/dist/chunk-1e9vsfyh.js.map +10 -0
- package/dist/chunk-25v9t56f.js +29 -0
- package/dist/chunk-25v9t56f.js.map +11 -0
- package/dist/chunk-2f21eenc.js +21 -0
- package/dist/chunk-2f21eenc.js.map +10 -0
- package/dist/chunk-2ga2znex.js +13 -0
- package/dist/chunk-2ga2znex.js.map +9 -0
- package/dist/chunk-30yrw0f6.js +33 -0
- package/dist/chunk-30yrw0f6.js.map +10 -0
- package/dist/chunk-3c7mpj3m.js +784 -0
- package/dist/chunk-3c7mpj3m.js.map +10 -0
- package/dist/chunk-3g91wb4f.js +358 -0
- package/dist/chunk-3g91wb4f.js.map +10 -0
- package/dist/chunk-3yjzpcne.js +34 -0
- package/dist/chunk-3yjzpcne.js.map +10 -0
- package/dist/chunk-4bq79t8v.js +136 -0
- package/dist/chunk-4bq79t8v.js.map +10 -0
- package/dist/chunk-4d39r92n.js +81 -0
- package/dist/chunk-4d39r92n.js.map +10 -0
- package/dist/chunk-4m75s5xf.js +184 -0
- package/dist/chunk-4m75s5xf.js.map +11 -0
- package/dist/chunk-5003emhv.js +17 -0
- package/dist/chunk-5003emhv.js.map +10 -0
- package/dist/chunk-5fhp1jap.js +9169 -0
- package/dist/chunk-5fhp1jap.js.map +236 -0
- package/dist/chunk-6fkgm9s5.js +569 -0
- package/dist/chunk-6fkgm9s5.js.map +10 -0
- package/dist/chunk-6pdj08z3.js +73 -0
- package/dist/chunk-6pdj08z3.js.map +12 -0
- package/dist/chunk-6qjbrt0k.js +13 -0
- package/dist/chunk-6qjbrt0k.js.map +9 -0
- package/dist/chunk-6sccb4jr.js +14 -0
- package/dist/chunk-6sccb4jr.js.map +9 -0
- package/dist/chunk-73brtyw5.js +16 -0
- package/dist/chunk-73brtyw5.js.map +9 -0
- package/dist/chunk-77cqkarb.js +25 -0
- package/dist/chunk-77cqkarb.js.map +9 -0
- package/dist/chunk-798spvzv.js +50 -0
- package/dist/chunk-798spvzv.js.map +10 -0
- package/dist/chunk-7fw6x3js.js +131 -0
- package/dist/chunk-7fw6x3js.js.map +11 -0
- package/dist/chunk-7kjj42xm.js +11 -0
- package/dist/chunk-7kjj42xm.js.map +10 -0
- package/dist/chunk-851whwc7.js +17 -0
- package/dist/chunk-851whwc7.js.map +10 -0
- package/dist/chunk-85n68sy6.js +103 -0
- package/dist/chunk-85n68sy6.js.map +10 -0
- package/dist/chunk-8feq2qek.js +17 -0
- package/dist/chunk-8feq2qek.js.map +9 -0
- package/dist/chunk-8kcfffry.js +35 -0
- package/dist/chunk-8kcfffry.js.map +10 -0
- package/dist/chunk-93sqk7be.js +139 -0
- package/dist/chunk-93sqk7be.js.map +12 -0
- package/dist/chunk-97572s32.js +262 -0
- package/dist/chunk-97572s32.js.map +12 -0
- package/dist/chunk-9a307ca6.js +1742 -0
- package/dist/chunk-9a307ca6.js.map +11 -0
- package/dist/chunk-9c5tj4k3.js +130 -0
- package/dist/chunk-9c5tj4k3.js.map +10 -0
- package/dist/chunk-9xrsjeem.js +12 -0
- package/dist/chunk-9xrsjeem.js.map +9 -0
- package/dist/chunk-a9mvyp04.js +87 -0
- package/dist/chunk-a9mvyp04.js.map +10 -0
- package/dist/chunk-b3gbnrwe.js +21 -0
- package/dist/chunk-b3gbnrwe.js.map +10 -0
- package/dist/chunk-bmgqm774.js +65 -0
- package/dist/chunk-bmgqm774.js.map +9 -0
- package/dist/chunk-bxfghpma.js +69 -0
- package/dist/chunk-bxfghpma.js.map +10 -0
- package/dist/chunk-c1jfjnka.js +74 -0
- package/dist/chunk-c1jfjnka.js.map +10 -0
- package/dist/chunk-cbkrwmvh.js +80 -0
- package/dist/chunk-cbkrwmvh.js.map +10 -0
- package/dist/chunk-cdxd7sy2.js +71 -0
- package/dist/chunk-cdxd7sy2.js.map +10 -0
- package/dist/chunk-cg95827x.js +21 -0
- package/dist/chunk-cg95827x.js.map +10 -0
- package/dist/chunk-d9c0am65.js +12 -0
- package/dist/chunk-d9c0am65.js.map +10 -0
- package/dist/chunk-daqghmg8.js +12 -0
- package/dist/chunk-daqghmg8.js.map +9 -0
- package/dist/chunk-dr9yqsdb.js +203 -0
- package/dist/chunk-dr9yqsdb.js.map +10 -0
- package/dist/chunk-e8eecyrq.js +244 -0
- package/dist/chunk-e8eecyrq.js.map +10 -0
- package/dist/chunk-ex2hxe0v.js +160 -0
- package/dist/chunk-ex2hxe0v.js.map +11 -0
- package/dist/chunk-ey5hs6x6.js +253 -0
- package/dist/chunk-ey5hs6x6.js.map +11 -0
- package/dist/chunk-fak944et.js +91 -0
- package/dist/chunk-fak944et.js.map +10 -0
- package/dist/chunk-fygx2ymm.js +118 -0
- package/dist/chunk-fygx2ymm.js.map +12 -0
- package/dist/chunk-g15qj669.js +271 -0
- package/dist/chunk-g15qj669.js.map +11 -0
- package/dist/chunk-g3j22qf6.js +51 -0
- package/dist/chunk-g3j22qf6.js.map +9 -0
- package/dist/chunk-gd6wmknh.js +121 -0
- package/dist/chunk-gd6wmknh.js.map +11 -0
- package/dist/chunk-gf0ygptk.js +85 -0
- package/dist/chunk-gf0ygptk.js.map +11 -0
- package/dist/chunk-gq0zxpm0.js +90 -0
- package/dist/chunk-gq0zxpm0.js.map +10 -0
- package/dist/chunk-gytkmthr.js +220 -0
- package/dist/chunk-gytkmthr.js.map +10 -0
- package/dist/chunk-h5bbfn3n.js +28 -0
- package/dist/chunk-h5bbfn3n.js.map +11 -0
- package/dist/chunk-h6mye9r3.js +93 -0
- package/dist/chunk-h6mye9r3.js.map +10 -0
- package/dist/chunk-hcsmxw1v.js +85 -0
- package/dist/chunk-hcsmxw1v.js.map +10 -0
- package/dist/chunk-hep68ja7.js +4444 -0
- package/dist/chunk-hep68ja7.js.map +29 -0
- package/dist/chunk-hhqh49fz.js +149 -0
- package/dist/chunk-hhqh49fz.js.map +10 -0
- package/dist/chunk-hyjs4bqs.js +8 -0
- package/dist/chunk-hyjs4bqs.js.map +10 -0
- package/dist/chunk-hza0n8qm.js +20 -0
- package/dist/chunk-hza0n8qm.js.map +9 -0
- package/dist/chunk-jn91vzkh.js +66 -0
- package/dist/chunk-jn91vzkh.js.map +10 -0
- package/dist/chunk-jwxt8gnp.js +13 -0
- package/dist/chunk-jwxt8gnp.js.map +9 -0
- package/dist/chunk-kk8w9rh5.js +195 -0
- package/dist/chunk-kk8w9rh5.js.map +10 -0
- package/dist/chunk-kndkjsya.js +261 -0
- package/dist/chunk-kndkjsya.js.map +10 -0
- package/dist/chunk-kvq01j35.js +36 -0
- package/dist/chunk-kvq01j35.js.map +10 -0
- package/dist/chunk-mbazhahf.js +60 -0
- package/dist/chunk-mbazhahf.js.map +10 -0
- package/dist/chunk-mgfwq18r.js +15 -0
- package/dist/chunk-mgfwq18r.js.map +9 -0
- package/dist/chunk-mtgf69xn.js +88 -0
- package/dist/chunk-mtgf69xn.js.map +10 -0
- package/dist/chunk-nehhtthw.js +225 -0
- package/dist/chunk-nehhtthw.js.map +10 -0
- package/dist/chunk-nhzf4az4.js +149 -0
- package/dist/chunk-nhzf4az4.js.map +10 -0
- package/dist/chunk-p5504p14.js +16 -0
- package/dist/chunk-p5504p14.js.map +10 -0
- package/dist/chunk-pnscgw95.js +90 -0
- package/dist/chunk-pnscgw95.js.map +10 -0
- package/dist/chunk-pvpp4pvs.js +17 -0
- package/dist/chunk-pvpp4pvs.js.map +10 -0
- package/dist/chunk-qh75agse.js +95 -0
- package/dist/chunk-qh75agse.js.map +10 -0
- package/dist/chunk-qk8kd3hr.js +526 -0
- package/dist/chunk-qk8kd3hr.js.map +12 -0
- package/dist/chunk-qxq2zcty.js +52 -0
- package/dist/chunk-qxq2zcty.js.map +10 -0
- package/dist/chunk-r7jmgqnw.js +114 -0
- package/dist/chunk-r7jmgqnw.js.map +10 -0
- package/dist/chunk-s6defjk2.js +116 -0
- package/dist/chunk-s6defjk2.js.map +10 -0
- package/dist/chunk-sd39p726.js +619 -0
- package/dist/chunk-sd39p726.js.map +10 -0
- package/dist/chunk-smgj0epn.js +18 -0
- package/dist/chunk-smgj0epn.js.map +9 -0
- package/dist/chunk-swrnzs4c.js +63 -0
- package/dist/chunk-swrnzs4c.js.map +10 -0
- package/dist/chunk-t81a331y.js +27 -0
- package/dist/chunk-t81a331y.js.map +10 -0
- package/dist/chunk-tfe3sb44.js +33 -0
- package/dist/chunk-tfe3sb44.js.map +10 -0
- package/dist/chunk-tx9edm1x.js +34 -0
- package/dist/chunk-tx9edm1x.js.map +10 -0
- package/dist/chunk-vkrpm7kc.js +247 -0
- package/dist/chunk-vkrpm7kc.js.map +12 -0
- package/dist/chunk-vvz7dcvq.js +434 -0
- package/dist/chunk-vvz7dcvq.js.map +13 -0
- package/dist/chunk-w3m4m5we.js +4925 -0
- package/dist/chunk-w3m4m5we.js.map +12 -0
- package/dist/chunk-wrxtn9ve.js +18 -0
- package/dist/chunk-wrxtn9ve.js.map +10 -0
- package/dist/chunk-xpkjbmd3.js +428 -0
- package/dist/chunk-xpkjbmd3.js.map +14 -0
- package/dist/chunk-xrmjy8kk.js +454 -0
- package/dist/chunk-xrmjy8kk.js.map +10 -0
- package/dist/chunk-xw0tx842.js +13 -0
- package/dist/chunk-xw0tx842.js.map +9 -0
- package/dist/chunk-xx5b6b9m.js +69 -0
- package/dist/chunk-xx5b6b9m.js.map +10 -0
- package/dist/chunk-xz1kdswj.js +21 -0
- package/dist/chunk-xz1kdswj.js.map +9 -0
- package/dist/chunk-xzvy9hr4.js +377 -0
- package/dist/chunk-xzvy9hr4.js.map +10 -0
- package/dist/chunk-yfqhr31t.js +39 -0
- package/dist/chunk-yfqhr31t.js.map +9 -0
- package/dist/chunk-ygzd5s4z.js +184 -0
- package/dist/chunk-ygzd5s4z.js.map +10 -0
- package/dist/chunk-ywjn0rad.js +14 -0
- package/dist/chunk-ywjn0rad.js.map +9 -0
- package/dist/chunk-z9nvhm6r.js +13 -0
- package/dist/chunk-z9nvhm6r.js.map +9 -0
- package/dist/chunk-zhmvdpk6.js +15 -0
- package/dist/chunk-zhmvdpk6.js.map +9 -0
- package/dist/client/index.js +32 -1112
- package/dist/client/index.js.map +4 -22
- package/dist/core/streamingSlotRegistrar.js +11 -108
- package/dist/core/streamingSlotRegistrar.js.map +3 -4
- package/dist/core/streamingSlotRegistry.js +7 -169
- package/dist/core/streamingSlotRegistry.js.map +3 -5
- package/dist/index.js +536 -19835
- package/dist/index.js.map +3 -117
- package/dist/islands/browser.js +9 -228
- package/dist/islands/browser.js.map +4 -9
- package/dist/islands/index.js +17 -1986
- package/dist/islands/index.js.map +3 -28
- package/dist/react/browser.js +12 -328
- package/dist/react/browser.js.map +4 -12
- package/dist/react/components/index.js +16 -167
- package/dist/react/components/index.js.map +3 -6
- package/dist/react/hooks/index.js +8 -183
- package/dist/react/hooks/index.js.map +3 -7
- package/dist/react/index.js +36 -3705
- package/dist/react/index.js.map +4 -46
- package/dist/react/jsxDevRuntimeCompat.js +2 -61
- package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
- package/dist/react/server.js +18 -1789
- package/dist/react/server.js.map +3 -21
- package/dist/src/core/index.d.ts +0 -2
- package/dist/svelte/browser.js +12 -247
- package/dist/svelte/browser.js.map +3 -10
- package/dist/svelte/index.js +37 -3810
- package/dist/svelte/index.js.map +4 -48
- package/dist/svelte/server.js +21 -2787
- package/dist/svelte/server.js.map +3 -27
- package/dist/vue/browser.js +12 -348
- package/dist/vue/browser.js.map +4 -12
- package/dist/vue/components/Image.js +7 -240
- package/dist/vue/components/Image.js.map +3 -6
- package/dist/vue/components/index.js +11 -544
- package/dist/vue/components/index.js.map +3 -9
- package/dist/vue/index.js +52 -4290
- package/dist/vue/index.js.map +4 -51
- package/dist/vue/server.js +18 -1849
- package/dist/vue/server.js.map +3 -21
- package/package.json +7 -7
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/islandManifest.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { IslandFramework } from '../../types/island';\n\nconst toIslandFrameworkSegment = (framework: IslandFramework) =>\n\tframework[0]?.toUpperCase() + framework.slice(1);\n\nconst collectFrameworkIslands = (\n\tmanifest: Record<string, string>,\n\tprefix: string\n) => {\n\tconst entries: Record<string, string> = {};\n\tlet found = false;\n\n\tfor (const [key, value] of Object.entries(manifest)) {\n\t\tif (!key.startsWith(prefix)) continue;\n\n\t\tconst component = key.slice(prefix.length);\n\t\tif (!component) continue;\n\n\t\tentries[component] = value;\n\t\tfound = true;\n\t}\n\n\treturn found ? entries : undefined;\n};\n\nexport const getIslandManifestEntries = (manifest: Record<string, string>) => {\n\tconst islands: Partial<Record<IslandFramework, Record<string, string>>> =\n\t\t{};\n\tconst frameworks: IslandFramework[] = ['react', 'svelte', 'vue', 'angular'];\n\n\tfor (const framework of frameworks) {\n\t\tconst prefix = `Island${toIslandFrameworkSegment(framework)}`;\n\t\tconst entries = collectFrameworkIslands(manifest, prefix);\n\t\tif (entries) islands[framework] = entries;\n\t}\n\n\treturn islands;\n};\nexport const getIslandManifestKey = (\n\tframework: IslandFramework,\n\tcomponent: string\n) => `Island${toIslandFrameworkSegment(framework)}${component}`;\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAEA,IAAM,2BAA2B,CAAC,cACjC,UAAU,IAAI,YAAY,IAAI,UAAU,MAAM,CAAC;AAEhD,IAAM,0BAA0B,CAC/B,UACA,WACI;AAAA,EACJ,MAAM,UAAkC,CAAC;AAAA,EACzC,IAAI,QAAQ;AAAA,EAEZ,YAAY,KAAK,UAAU,OAAO,QAAQ,QAAQ,GAAG;AAAA,IACpD,IAAI,CAAC,IAAI,WAAW,MAAM;AAAA,MAAG;AAAA,IAE7B,MAAM,YAAY,IAAI,MAAM,OAAO,MAAM;AAAA,IACzC,IAAI,CAAC;AAAA,MAAW;AAAA,IAEhB,QAAQ,aAAa;AAAA,IACrB,QAAQ;AAAA,EACT;AAAA,EAEA,OAAO,QAAQ,UAAU;AAAA;AAGnB,IAAM,2BAA2B,CAAC,aAAqC;AAAA,EAC7E,MAAM,UACL,CAAC;AAAA,EACF,MAAM,aAAgC,CAAC,SAAS,UAAU,OAAO,SAAS;AAAA,EAE1E,WAAW,aAAa,YAAY;AAAA,IACnC,MAAM,SAAS,SAAS,yBAAyB,SAAS;AAAA,IAC1D,MAAM,UAAU,wBAAwB,UAAU,MAAM;AAAA,IACxD,IAAI;AAAA,MAAS,QAAQ,aAAa;AAAA,EACnC;AAAA,EAEA,OAAO;AAAA;AAED,IAAM,uBAAuB,CACnC,WACA,cACI,SAAS,yBAAyB,SAAS,IAAI;",
|
|
8
|
+
"debugId": "A4777F528EEB5C9A64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,136 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
captureStreamingSlotWarningCallsite,
|
|
4
|
+
runWithStreamingSlotWarningScope,
|
|
5
|
+
ssrErrorPage
|
|
6
|
+
} from "./chunk-gd6wmknh.js";
|
|
7
|
+
import {
|
|
8
|
+
getCurrentRouteRegistrationCallsite
|
|
9
|
+
} from "./chunk-mtgf69xn.js";
|
|
10
|
+
import {
|
|
11
|
+
derivePageName,
|
|
12
|
+
injectIslandPageContextStream,
|
|
13
|
+
renderConventionError,
|
|
14
|
+
withRegisteredStreamingSlots
|
|
15
|
+
} from "./chunk-qk8kd3hr.js";
|
|
16
|
+
import {
|
|
17
|
+
isSsrCacheDirty
|
|
18
|
+
} from "./chunk-d9c0am65.js";
|
|
19
|
+
import {
|
|
20
|
+
compileSvelteServerModule
|
|
21
|
+
} from "./chunk-dr9yqsdb.js";
|
|
22
|
+
import {
|
|
23
|
+
__require
|
|
24
|
+
} from "./chunk-bmgqm774.js";
|
|
25
|
+
|
|
26
|
+
// src/svelte/pageHandler.ts
|
|
27
|
+
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
28
|
+
var isGenericSvelteComponent = (value) => typeof value === "function" || isRecord(value);
|
|
29
|
+
var readHasIslands = (value) => {
|
|
30
|
+
if (!isRecord(value))
|
|
31
|
+
return false;
|
|
32
|
+
const hasIslands = value["__ABSOLUTE_PAGE_HAS_ISLANDS__"];
|
|
33
|
+
return typeof hasIslands === "boolean" ? hasIslands : false;
|
|
34
|
+
};
|
|
35
|
+
var readDefaultExport = (value) => isRecord(value) ? value.default : undefined;
|
|
36
|
+
var buildDirtyResponse = (indexPath, props) => {
|
|
37
|
+
const propsScript = `window.__ABS_SLOT_HYDRATION_PENDING__=true;window.__INITIAL_PROPS__=${JSON.stringify(props)};${indexPath ? `import(${JSON.stringify(indexPath)});` : ""}`;
|
|
38
|
+
const dirtyFlag = "window.__SSR_DIRTY__=true;";
|
|
39
|
+
const html = `<!DOCTYPE html><html><head></head><body><script>${propsScript}${dirtyFlag}</script></body></html>`;
|
|
40
|
+
return new Response(html, {
|
|
41
|
+
headers: { "Content-Type": "text/html" }
|
|
42
|
+
});
|
|
43
|
+
};
|
|
44
|
+
var primeSvelteStream = async (stream) => {
|
|
45
|
+
const reader = stream.getReader();
|
|
46
|
+
const firstChunk = await reader.read();
|
|
47
|
+
return { firstChunk, reader };
|
|
48
|
+
};
|
|
49
|
+
var restorePrimedStream = (firstChunk, reader) => new ReadableStream({
|
|
50
|
+
start(controller) {
|
|
51
|
+
if (!firstChunk.done) {
|
|
52
|
+
controller.enqueue(firstChunk.value);
|
|
53
|
+
}
|
|
54
|
+
if (firstChunk.done) {
|
|
55
|
+
controller.close();
|
|
56
|
+
return;
|
|
57
|
+
}
|
|
58
|
+
const pumpLoop = () => {
|
|
59
|
+
reader.read().then(({ done, value }) => done ? controller.close() : (controller.enqueue(value), pumpLoop())).catch((err) => controller.error(err));
|
|
60
|
+
};
|
|
61
|
+
pumpLoop();
|
|
62
|
+
}
|
|
63
|
+
});
|
|
64
|
+
var handleSveltePageRequest = async (input) => {
|
|
65
|
+
const resolvedIndexPath = input.indexPath;
|
|
66
|
+
const resolvedOptions = input;
|
|
67
|
+
const resolvedPagePath = input.pagePath;
|
|
68
|
+
const resolvedProps = input.props;
|
|
69
|
+
if (isSsrCacheDirty("svelte")) {
|
|
70
|
+
return buildDirtyResponse(resolvedIndexPath, resolvedProps);
|
|
71
|
+
}
|
|
72
|
+
try {
|
|
73
|
+
const handlerCallsite = resolvedOptions?.collectStreamingSlots === true ? undefined : getCurrentRouteRegistrationCallsite() ?? captureStreamingSlotWarningCallsite();
|
|
74
|
+
const renderPageResponse = async () => {
|
|
75
|
+
const resolvePageComponent = async () => {
|
|
76
|
+
const loadCompiledSourcePath = async (sourcePath) => {
|
|
77
|
+
const compiledModulePath = await compileSvelteServerModule(sourcePath);
|
|
78
|
+
const loadedModule = await import(compiledModulePath);
|
|
79
|
+
const loadedComponent = readDefaultExport(loadedModule) ?? loadedModule;
|
|
80
|
+
if (!isGenericSvelteComponent(loadedComponent)) {
|
|
81
|
+
throw new Error(`Invalid compiled Svelte page module: ${sourcePath}`);
|
|
82
|
+
}
|
|
83
|
+
return {
|
|
84
|
+
component: loadedComponent,
|
|
85
|
+
hasIslands: readHasIslands(loadedModule)
|
|
86
|
+
};
|
|
87
|
+
};
|
|
88
|
+
const importedPageModule = await import(resolvedPagePath);
|
|
89
|
+
const importedPageComponent = readDefaultExport(importedPageModule) ?? importedPageModule;
|
|
90
|
+
if (typeof importedPageComponent === "string" && importedPageComponent.endsWith(".svelte")) {
|
|
91
|
+
return loadCompiledSourcePath(importedPageComponent);
|
|
92
|
+
}
|
|
93
|
+
if (!isGenericSvelteComponent(importedPageComponent)) {
|
|
94
|
+
throw new Error(`Invalid Svelte page module: ${resolvedPagePath}`);
|
|
95
|
+
}
|
|
96
|
+
return {
|
|
97
|
+
component: importedPageComponent,
|
|
98
|
+
hasIslands: readHasIslands(importedPageModule)
|
|
99
|
+
};
|
|
100
|
+
};
|
|
101
|
+
const { renderToReadableStream } = await import("./chunk-zhmvdpk6.js");
|
|
102
|
+
const resolvedPage = await resolvePageComponent();
|
|
103
|
+
const stream = await renderToReadableStream(resolvedPage.component, resolvedProps, {
|
|
104
|
+
bodyContent: resolvedOptions?.bodyContent,
|
|
105
|
+
bootstrapScriptContent: `window.__ABS_SLOT_HYDRATION_PENDING__=true;window.__INITIAL_PROPS__=${JSON.stringify(resolvedProps)};${resolvedIndexPath ? `import(${JSON.stringify(resolvedIndexPath)});` : ""}`,
|
|
106
|
+
headContent: resolvedOptions?.headContent
|
|
107
|
+
});
|
|
108
|
+
const htmlStream = injectIslandPageContextStream(stream, {
|
|
109
|
+
hasIslands: resolvedPage.hasIslands ? true : undefined
|
|
110
|
+
});
|
|
111
|
+
const { firstChunk, reader } = await primeSvelteStream(htmlStream);
|
|
112
|
+
return new Response(restorePrimedStream(firstChunk, reader), {
|
|
113
|
+
headers: { "Content-Type": "text/html" }
|
|
114
|
+
});
|
|
115
|
+
};
|
|
116
|
+
return await runWithStreamingSlotWarningScope(() => resolvedOptions?.collectStreamingSlots === true ? withRegisteredStreamingSlots(renderPageResponse, {
|
|
117
|
+
...resolvedOptions,
|
|
118
|
+
runtimePlacement: resolvedOptions.runtimePlacement ?? "body"
|
|
119
|
+
}) : renderPageResponse(), { handlerCallsite });
|
|
120
|
+
} catch (error) {
|
|
121
|
+
console.error("[SSR] Svelte render error:", error);
|
|
122
|
+
const pageName = derivePageName(resolvedPagePath);
|
|
123
|
+
const conventionResponse = await renderConventionError("svelte", pageName, error);
|
|
124
|
+
if (conventionResponse)
|
|
125
|
+
return conventionResponse;
|
|
126
|
+
return new Response(ssrErrorPage("svelte", error), {
|
|
127
|
+
headers: { "Content-Type": "text/html" },
|
|
128
|
+
status: 500
|
|
129
|
+
});
|
|
130
|
+
}
|
|
131
|
+
};
|
|
132
|
+
|
|
133
|
+
export { handleSveltePageRequest };
|
|
134
|
+
|
|
135
|
+
//# debugId=CE7F9382EA2F47FE64756E2164756E21
|
|
136
|
+
//# sourceMappingURL=chunk-4bq79t8v.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/svelte/pageHandler.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { Component as SvelteComponent } from 'svelte';\nimport type { SveltePropsOf } from '../../types/svelte';\nimport { compileSvelteServerModule } from '../core/svelteServerModule';\nimport { injectIslandPageContextStream } from '../core/islandPageContext';\nimport { getCurrentRouteRegistrationCallsite } from '../core/devRouteRegistrationCallsite';\nimport {\n\ttype StreamingSlotEnhancerOptions,\n\twithRegisteredStreamingSlots\n} from '../core/responseEnhancers';\nimport {\n\tcaptureStreamingSlotWarningCallsite,\n\trunWithStreamingSlotWarningScope\n} from '../core/streamingSlotWarningScope';\nimport { isSsrCacheDirty, markSsrCacheDirty } from '../core/ssrCache';\nimport { ssrErrorPage } from '../utils/ssrErrorPage';\nimport {\n\tderivePageName,\n\trenderConventionError\n} from '../utils/resolveConvention';\n\ntype GenericSvelteComponent = SvelteComponent<Record<string, unknown>>;\ntype ResolvedSveltePage = {\n\tcomponent: GenericSvelteComponent;\n\thasIslands: boolean;\n};\n\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nconst isGenericSvelteComponent = (\n\tvalue: unknown\n): value is GenericSvelteComponent =>\n\ttypeof value === 'function' || isRecord(value);\n\nconst readHasIslands = (value: unknown) => {\n\tif (!isRecord(value)) return false;\n\tconst hasIslands = value['__ABSOLUTE_PAGE_HAS_ISLANDS__'];\n\n\treturn typeof hasIslands === 'boolean' ? hasIslands : false;\n};\n\nconst readDefaultExport = (value: unknown) =>\n\tisRecord(value) ? value.default : undefined;\n\nconst buildDirtyResponse = (indexPath: string, props?: unknown) => {\n\tconst propsScript = `window.__ABS_SLOT_HYDRATION_PENDING__=true;window.__INITIAL_PROPS__=${JSON.stringify(props)};${indexPath ? `import(${JSON.stringify(indexPath)});` : ''}`;\n\tconst dirtyFlag = 'window.__SSR_DIRTY__=true;';\n\tconst html = `<!DOCTYPE html><html><head></head><body><script>${propsScript}${dirtyFlag}</script></body></html>`;\n\n\treturn new Response(html, {\n\t\theaders: { 'Content-Type': 'text/html' }\n\t});\n};\n\nconst primeSvelteStream = async <T>(stream: ReadableStream<T>) => {\n\tconst reader = stream.getReader();\n\tconst firstChunk = await reader.read();\n\n\treturn { firstChunk, reader };\n};\n\nconst restorePrimedStream = <T>(\n\tfirstChunk: { done: boolean; value?: T },\n\treader: ReadableStreamDefaultReader<T>\n) =>\n\tnew ReadableStream<T>({\n\t\tstart(controller) {\n\t\t\tif (!firstChunk.done) {\n\t\t\t\tcontroller.enqueue(firstChunk.value as T);\n\t\t\t}\n\t\t\tif (firstChunk.done) {\n\t\t\t\tcontroller.close();\n\n\t\t\t\treturn;\n\t\t\t}\n\t\t\tconst pumpLoop = () => {\n\t\t\t\treader\n\t\t\t\t\t.read()\n\t\t\t\t\t.then(({ done, value }) =>\n\t\t\t\t\t\tdone\n\t\t\t\t\t\t\t? controller.close()\n\t\t\t\t\t\t\t: (controller.enqueue(value), pumpLoop())\n\t\t\t\t\t)\n\t\t\t\t\t.catch((err) => controller.error(err));\n\t\t\t};\n\t\t\tpumpLoop();\n\t\t}\n\t});\n\nexport type SveltePageRenderOptions = {\n\tcollectStreamingSlots?: boolean;\n\tbodyContent?: string;\n\theadContent?: string;\n} & StreamingSlotEnhancerOptions;\n\ntype HasNoSvelteProps<Props> = [Props] extends [never]\n\t? true\n\t: keyof Props extends never\n\t\t? true\n\t\t: false;\n\nexport type SveltePageRequestInput<\n\tComponent extends SvelteComponent<never> = SvelteComponent<\n\t\tRecord<never, never>\n\t>\n> = SveltePageRenderOptions & {\n\tindexPath: string;\n\tpagePath: string;\n} & (HasNoSvelteProps<SveltePropsOf<Component>> extends true\n\t\t? { props?: NoInfer<SveltePropsOf<Component>> }\n\t\t: { props: NoInfer<SveltePropsOf<Component>> });\n\nexport const handleSveltePageRequest = async <\n\tComponent extends SvelteComponent<never>\n>(\n\tinput: SveltePageRequestInput<Component>\n) => {\n\tconst resolvedIndexPath = input.indexPath;\n\tconst resolvedOptions = input;\n\tconst resolvedPagePath = input.pagePath;\n\tconst resolvedProps = input.props;\n\n\tif (isSsrCacheDirty('svelte')) {\n\t\treturn buildDirtyResponse(resolvedIndexPath, resolvedProps);\n\t}\n\n\ttry {\n\t\tconst handlerCallsite =\n\t\t\tresolvedOptions?.collectStreamingSlots === true\n\t\t\t\t? undefined\n\t\t\t\t: (getCurrentRouteRegistrationCallsite() ??\n\t\t\t\t\tcaptureStreamingSlotWarningCallsite());\n\t\tconst renderPageResponse = async () => {\n\t\t\tconst resolvePageComponent =\n\t\t\t\tasync (): Promise<ResolvedSveltePage> => {\n\t\t\t\t\tconst loadCompiledSourcePath = async (\n\t\t\t\t\t\tsourcePath: string\n\t\t\t\t\t): Promise<ResolvedSveltePage> => {\n\t\t\t\t\t\tconst compiledModulePath =\n\t\t\t\t\t\t\tawait compileSvelteServerModule(sourcePath);\n\t\t\t\t\t\tconst loadedModule: unknown = await import(\n\t\t\t\t\t\t\tcompiledModulePath\n\t\t\t\t\t\t);\n\t\t\t\t\t\tconst loadedComponent =\n\t\t\t\t\t\t\treadDefaultExport(loadedModule) ?? loadedModule;\n\t\t\t\t\t\tif (!isGenericSvelteComponent(loadedComponent)) {\n\t\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t\t`Invalid compiled Svelte page module: ${sourcePath}`\n\t\t\t\t\t\t\t);\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn {\n\t\t\t\t\t\t\tcomponent: loadedComponent,\n\t\t\t\t\t\t\thasIslands: readHasIslands(loadedModule)\n\t\t\t\t\t\t};\n\t\t\t\t\t};\n\n\t\t\t\t\tconst importedPageModule: unknown = await import(\n\t\t\t\t\t\tresolvedPagePath\n\t\t\t\t\t);\n\t\t\t\t\tconst importedPageComponent =\n\t\t\t\t\t\treadDefaultExport(importedPageModule) ??\n\t\t\t\t\t\timportedPageModule;\n\n\t\t\t\t\tif (\n\t\t\t\t\t\ttypeof importedPageComponent === 'string' &&\n\t\t\t\t\t\timportedPageComponent.endsWith('.svelte')\n\t\t\t\t\t) {\n\t\t\t\t\t\treturn loadCompiledSourcePath(importedPageComponent);\n\t\t\t\t\t}\n\n\t\t\t\t\tif (!isGenericSvelteComponent(importedPageComponent)) {\n\t\t\t\t\t\tthrow new Error(\n\t\t\t\t\t\t\t`Invalid Svelte page module: ${resolvedPagePath}`\n\t\t\t\t\t\t);\n\t\t\t\t\t}\n\n\t\t\t\t\treturn {\n\t\t\t\t\t\tcomponent: importedPageComponent,\n\t\t\t\t\t\thasIslands: readHasIslands(importedPageModule)\n\t\t\t\t\t};\n\t\t\t\t};\n\n\t\t\tconst { renderToReadableStream } = await import(\n\t\t\t\t'./renderToReadableStream'\n\t\t\t);\n\t\t\tconst resolvedPage = await resolvePageComponent();\n\n\t\t\tconst stream = await renderToReadableStream(\n\t\t\t\tresolvedPage.component,\n\t\t\t\tresolvedProps,\n\t\t\t\t{\n\t\t\t\t\tbodyContent: resolvedOptions?.bodyContent,\n\t\t\t\t\tbootstrapScriptContent: `window.__ABS_SLOT_HYDRATION_PENDING__=true;window.__INITIAL_PROPS__=${JSON.stringify(\n\t\t\t\t\t\tresolvedProps\n\t\t\t\t\t)};${resolvedIndexPath ? `import(${JSON.stringify(resolvedIndexPath)});` : ''}`,\n\t\t\t\t\theadContent: resolvedOptions?.headContent\n\t\t\t\t}\n\t\t\t);\n\n\t\t\tconst htmlStream = injectIslandPageContextStream(stream, {\n\t\t\t\thasIslands: resolvedPage.hasIslands ? true : undefined\n\t\t\t});\n\t\t\tconst { firstChunk, reader } = await primeSvelteStream(htmlStream);\n\n\t\t\treturn new Response(restorePrimedStream(firstChunk, reader), {\n\t\t\t\theaders: { 'Content-Type': 'text/html' }\n\t\t\t});\n\t\t};\n\n\t\treturn await runWithStreamingSlotWarningScope(\n\t\t\t() =>\n\t\t\t\tresolvedOptions?.collectStreamingSlots === true\n\t\t\t\t\t? withRegisteredStreamingSlots(renderPageResponse, {\n\t\t\t\t\t\t\t...resolvedOptions,\n\t\t\t\t\t\t\truntimePlacement:\n\t\t\t\t\t\t\t\tresolvedOptions.runtimePlacement ?? 'body'\n\t\t\t\t\t\t})\n\t\t\t\t\t: renderPageResponse(),\n\t\t\t{ handlerCallsite }\n\t\t);\n\t} catch (error) {\n\t\tconsole.error('[SSR] Svelte render error:', error);\n\n\t\tconst pageName = derivePageName(resolvedPagePath);\n\t\tconst conventionResponse = await renderConventionError(\n\t\t\t'svelte',\n\t\t\tpageName,\n\t\t\terror\n\t\t);\n\t\tif (conventionResponse) return conventionResponse;\n\n\t\treturn new Response(ssrErrorPage('svelte', error), {\n\t\t\theaders: { 'Content-Type': 'text/html' },\n\t\t\tstatus: 500\n\t\t});\n\t}\n};\n\nexport const invalidateSvelteSsrCache = () => {\n\tmarkSsrCacheDirty('svelte');\n};\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;;;;;;;;;;;;AA0BA,IAAM,WAAW,CAAC,UACjB,OAAO,UAAU,YAAY,UAAU;AAExC,IAAM,2BAA2B,CAChC,UAEA,OAAO,UAAU,cAAc,SAAS,KAAK;AAE9C,IAAM,iBAAiB,CAAC,UAAmB;AAAA,EAC1C,IAAI,CAAC,SAAS,KAAK;AAAA,IAAG,OAAO;AAAA,EAC7B,MAAM,aAAa,MAAM;AAAA,EAEzB,OAAO,OAAO,eAAe,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QAAQ;AAAA,QACxD,YAAY,aAAa,aAAa,OAAO;AAAA,MAC9C,CAAC;AAAA,MACD,QAAQ,YAAY,WAAW,MAAM,kBAAkB,UAAU;AAAA,MAEjE,OAAO,IAAI,SAAS,oBAAoB,YAAY,MAAM,GAAG;AAAA,QAC5D,SAAS,EAAE,gBAAgB,YAAY;AAAA,MACxC,CAAC;AAAA;AAAA,IAGF,OAAO,MAAM,iCACZ,MACC,iBAAiB,0BAA0B,OACxC,6BAA6B,oBAAoB;AAAA,SAC9C;AAAA,MACH,kBACC,gBAAgB,oBAAoB;AAAA,IACtC,CAAC,IACA,mBAAmB,GACvB,EAAE,gBAAgB,CACnB;AAAA,IACC,OAAO,OAAO;AAAA,IACf,QAAQ,MAAM,8BAA8B,KAAK;AAAA,IAEjD,MAAM,WAAW,eAAe,gBAAgB;AAAA,IAChD,MAAM,qBAAqB,MAAM,sBAChC,UACA,UACA,KACD;AAAA,IACA,IAAI;AAAA,MAAoB,OAAO;AAAA,IAE/B,OAAO,IAAI,SAAS,aAAa,UAAU,KAAK,GAAG;AAAA,MAClD,SAAS,EAAE,gBAAgB,YAAY;AAAA,MACvC,QAAQ;AAAA,IACT,CAAC;AAAA;AAAA;",
|
|
8
|
+
"debugId": "CE7F9382EA2F47FE64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,81 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
scanEntryPoints
|
|
4
|
+
} from "./chunk-11zpfqz6.js";
|
|
5
|
+
import {
|
|
6
|
+
DEFAULT_QUALITY,
|
|
7
|
+
OPTIMIZATION_ENDPOINT,
|
|
8
|
+
buildOptimizedUrl,
|
|
9
|
+
getAllSizes
|
|
10
|
+
} from "./chunk-kk8w9rh5.js";
|
|
11
|
+
import {
|
|
12
|
+
IMAGE_DEFAULT_DEVICE_SIZES
|
|
13
|
+
} from "./chunk-qh75agse.js";
|
|
14
|
+
|
|
15
|
+
// src/build/optimizeHtmlImages.ts
|
|
16
|
+
import { readFile, writeFile } from "fs/promises";
|
|
17
|
+
var IMG_REGEX = /<img\s+([^>]*?)data-optimized([^>]*?)\/?>/gi;
|
|
18
|
+
var getAttr = (attrs, name) => {
|
|
19
|
+
const regex = new RegExp(`${name}\\s*=\\s*["']([^"']*)["']`, "i");
|
|
20
|
+
const match = regex.exec(attrs);
|
|
21
|
+
return match ? match[1] : undefined;
|
|
22
|
+
};
|
|
23
|
+
var removeAttr = (attrs, name) => attrs.replace(new RegExp(`\\s*${name}\\s*=\\s*["'][^"']*["']`, "gi"), "");
|
|
24
|
+
var transformImgTag = (fullMatch, before, after, config) => {
|
|
25
|
+
const attrs = before + after;
|
|
26
|
+
const src = getAttr(attrs, "src");
|
|
27
|
+
if (!src)
|
|
28
|
+
return fullMatch;
|
|
29
|
+
const widthStr = getAttr(attrs, "width");
|
|
30
|
+
const sizes = getAttr(attrs, "sizes");
|
|
31
|
+
const quality = config?.quality ?? DEFAULT_QUALITY;
|
|
32
|
+
const basePath = config?.path ?? OPTIMIZATION_ENDPOINT;
|
|
33
|
+
const width = widthStr ? parseInt(widthStr, 10) : undefined;
|
|
34
|
+
const optimizedSrc = buildOptimizedUrl(src, width ?? 0, quality, basePath);
|
|
35
|
+
let srcset;
|
|
36
|
+
if (sizes) {
|
|
37
|
+
const allSizes = getAllSizes(config);
|
|
38
|
+
srcset = allSizes.map((sizeWidth) => `${buildOptimizedUrl(src, sizeWidth, quality, basePath)} ${sizeWidth}w`).join(", ");
|
|
39
|
+
} else if (width) {
|
|
40
|
+
const allSizes = getAllSizes(config);
|
|
41
|
+
const w1x = snapUp(width, allSizes);
|
|
42
|
+
const w2x = snapUp(width * 2, allSizes);
|
|
43
|
+
srcset = `${buildOptimizedUrl(src, w1x, quality, basePath)} 1x, ${buildOptimizedUrl(src, w2x, quality, basePath)} 2x`;
|
|
44
|
+
} else {
|
|
45
|
+
const deviceSizes = config?.deviceSizes ?? IMAGE_DEFAULT_DEVICE_SIZES;
|
|
46
|
+
srcset = deviceSizes.map((sizeWidth) => `${buildOptimizedUrl(src, sizeWidth, quality, basePath)} ${sizeWidth}w`).join(", ");
|
|
47
|
+
}
|
|
48
|
+
let cleanAttrs = removeAttr(attrs, "data-optimized");
|
|
49
|
+
cleanAttrs = removeAttr(cleanAttrs, "src");
|
|
50
|
+
cleanAttrs = removeAttr(cleanAttrs, "loading");
|
|
51
|
+
cleanAttrs = removeAttr(cleanAttrs, "decoding");
|
|
52
|
+
cleanAttrs = cleanAttrs.trim();
|
|
53
|
+
const resolvedSizes = sizes ?? (width ? undefined : "100vw");
|
|
54
|
+
const sizesAttr = resolvedSizes ? ` sizes="${resolvedSizes}"` : "";
|
|
55
|
+
return `<img src="${optimizedSrc}" srcset="${srcset}"${sizesAttr} ${cleanAttrs} loading="lazy" decoding="async">`;
|
|
56
|
+
};
|
|
57
|
+
var snapUp = (target, sizes) => {
|
|
58
|
+
for (const size of sizes) {
|
|
59
|
+
if (size >= target)
|
|
60
|
+
return size;
|
|
61
|
+
}
|
|
62
|
+
return sizes[sizes.length - 1] ?? target;
|
|
63
|
+
};
|
|
64
|
+
var optimizeHtmlImages = async (directory, config) => {
|
|
65
|
+
const htmlFiles = await scanEntryPoints(directory, "*.html");
|
|
66
|
+
const tasks = htmlFiles.map(async (filePath) => {
|
|
67
|
+
const original = await readFile(filePath, "utf8");
|
|
68
|
+
if (!original.includes("data-optimized"))
|
|
69
|
+
return;
|
|
70
|
+
const updated = original.replace(IMG_REGEX, (match, before, after) => transformImgTag(match, before, after, config));
|
|
71
|
+
if (updated !== original) {
|
|
72
|
+
await writeFile(filePath, updated, "utf8");
|
|
73
|
+
}
|
|
74
|
+
});
|
|
75
|
+
await Promise.all(tasks);
|
|
76
|
+
};
|
|
77
|
+
|
|
78
|
+
export { optimizeHtmlImages };
|
|
79
|
+
|
|
80
|
+
//# debugId=C7780E76D47EF80B64756E2164756E21
|
|
81
|
+
//# sourceMappingURL=chunk-4d39r92n.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/build/optimizeHtmlImages.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import { readFile, writeFile } from 'node:fs/promises';\nimport {\n\tDEFAULT_QUALITY,\n\tOPTIMIZATION_ENDPOINT,\n\tbuildOptimizedUrl,\n\tgetAllSizes\n} from '../utils/imageProcessing';\nimport { scanEntryPoints } from './scanEntryPoints';\nimport type { ImageConfig } from '../../types/image';\nimport { IMAGE_DEFAULT_DEVICE_SIZES } from '../constants';\n\n/**\n * Build-time transform for HTML files: finds `<img data-optimized ...>` tags\n * and rewrites them to use the optimization endpoint with responsive srcset.\n *\n * Example input:\n * <img data-optimized src=\"/photos/hero.jpg\" width=\"1200\" height=\"800\"\n * sizes=\"(max-width: 768px) 100vw, 50vw\" alt=\"Hero\">\n *\n * Output:\n * <img src=\"/_absolute/image?url=...&w=1200&q=75\"\n * srcset=\"/_absolute/image?url=...&w=640&q=75 640w, ...\"\n * sizes=\"(max-width: 768px) 100vw, 50vw\"\n * width=\"1200\" height=\"800\" alt=\"Hero\"\n * loading=\"lazy\" decoding=\"async\">\n */\n\nconst IMG_REGEX = /<img\\s+([^>]*?)data-optimized([^>]*?)\\/?>/gi;\n\nconst getAttr = (attrs: string, name: string) => {\n\tconst regex = new RegExp(`${name}\\\\s*=\\\\s*[\"']([^\"']*)[\"']`, 'i');\n\n\tconst match = regex.exec(attrs);\n\n\treturn match ? match[1] : undefined;\n};\n\nconst removeAttr = (attrs: string, name: string) =>\n\tattrs.replace(new RegExp(`\\\\s*${name}\\\\s*=\\\\s*[\"'][^\"']*[\"']`, 'gi'), '');\n\nconst transformImgTag = (fullMatch: string, before: string, after: string, config?: ImageConfig) => {\n\tconst attrs = before + after;\n\n\tconst src = getAttr(attrs, 'src');\n\n\tif (!src) return fullMatch;\n\n\tconst widthStr = getAttr(attrs, 'width');\n\n\tconst sizes = getAttr(attrs, 'sizes');\n\n\tconst quality = config?.quality ?? DEFAULT_QUALITY;\n\n\tconst basePath = config?.path ?? OPTIMIZATION_ENDPOINT;\n\n\tconst width = widthStr ? parseInt(widthStr, 10) : undefined;\n\n\t// Build optimized src\n\tconst optimizedSrc = buildOptimizedUrl(src, width ?? 0, quality, basePath);\n\n\t// Build srcset\n\tlet srcset: string;\n\n\tif (sizes) {\n\t\tconst allSizes = getAllSizes(config);\n\n\t\tsrcset = allSizes\n\t\t\t.map((sizeWidth) => `${buildOptimizedUrl(src, sizeWidth, quality, basePath)} ${sizeWidth}w`)\n\t\t\t.join(', ');\n\t} else if (width) {\n\t\t// 1x and 2x density descriptors\n\t\tconst allSizes = getAllSizes(config);\n\n\t\tconst w1x = snapUp(width, allSizes);\n\n\t\tconst w2x = snapUp(width * 2, allSizes);\n\n\t\tsrcset = `${buildOptimizedUrl(src, w1x, quality, basePath)} 1x, ${buildOptimizedUrl(src, w2x, quality, basePath)} 2x`;\n\t} else {\n\t\tconst deviceSizes = config?.deviceSizes ?? IMAGE_DEFAULT_DEVICE_SIZES;\n\n\t\tsrcset = deviceSizes\n\t\t\t.map((sizeWidth) => `${buildOptimizedUrl(src, sizeWidth, quality, basePath)} ${sizeWidth}w`)\n\t\t\t.join(', ');\n\t}\n\n\t// Clean original attributes — remove data-optimized and src (we'll re-add them)\n\tlet cleanAttrs = removeAttr(attrs, 'data-optimized');\n\n\tcleanAttrs = removeAttr(cleanAttrs, 'src');\n\n\t// Remove loading/decoding if present (we'll set our own)\n\tcleanAttrs = removeAttr(cleanAttrs, 'loading');\n\n\tcleanAttrs = removeAttr(cleanAttrs, 'decoding');\n\n\tcleanAttrs = cleanAttrs.trim();\n\n\tconst resolvedSizes = sizes ?? (width ? undefined : '100vw');\n\n\tconst sizesAttr = resolvedSizes ? ` sizes=\"${resolvedSizes}\"` : '';\n\n\treturn `<img src=\"${optimizedSrc}\" srcset=\"${srcset}\"${sizesAttr} ${cleanAttrs} loading=\"lazy\" decoding=\"async\">`;\n};\n\nconst snapUp = (target: number, sizes: number[]) => {\n\tfor (const size of sizes) {\n\t\tif (size >= target) return size;\n\t}\n\n\treturn sizes[sizes.length - 1] ?? target;\n};\n\nexport const optimizeHtmlImages = async (\n\tdirectory: string,\n\tconfig?: ImageConfig\n) => {\n\tconst htmlFiles = await scanEntryPoints(directory, '*.html');\n\n\tconst tasks = htmlFiles.map(async (filePath) => {\n\t\tconst original = await readFile(filePath, 'utf8');\n\n\t\tif (!original.includes('data-optimized')) return;\n\n\t\tconst updated = original.replace(\n\t\t\tIMG_REGEX,\n\t\t\t(match, before, after) => transformImgTag(match, before, after, config)\n\t\t);\n\n\t\tif (updated !== original) {\n\t\t\tawait writeFile(filePath, updated, 'utf8');\n\t\t}\n\t});\n\n\tawait Promise.all(tasks);\n};\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;;;;;;;;;;;;;;AAAA;AA2BA,IAAM,YAAY;AAElB,IAAM,UAAU,CAAC,OAAe,SAAiB;AAAA,EAChD,MAAM,QAAQ,IAAI,OAAO,GAAG,iCAAiC,GAAG;AAAA,EAEhE,MAAM,QAAQ,MAAM,KAAK,KAAK;AAAA,EAE9B,OAAO,QAAQ,MAAM,KAAK;AAAA;AAG3B,IAAM,aAAa,CAAC,OAAe,SAClC,MAAM,QAAQ,IAAI,OAAO,OAAO,+BAA+B,IAAI,GAAG,EAAE;AAEzE,IAAM,kBAAkB,CAAC,WAAmB,QAAgB,OAAe,WAAyB;AAAA,EACnG,MAAM,QAAQ,SAAS;AAAA,EAEvB,MAAM,MAAM,QAAQ,OAAO,KAAK;AAAA,EAEhC,IAAI,CAAC;AAAA,IAAK,OAAO;AAAA,EAEjB,MAAM,WAAW,QAAQ,OAAO,OAAO;AAAA,EAEvC,MAAM,QAAQ,QAAQ,OAAO,OAAO;AAAA,EAEpC,MAAM,UAAU,QAAQ,WAAW;AAAA,EAEnC,MAAM,WAAW,QAAQ,QAAQ;AAAA,EAEjC,MAAM,QAAQ,WAAW,SAAS,UAAU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BAAqB,OACjC,WACA,WACI;AAAA,EACJ,MAAM,YAAY,MAAM,gBAAgB,WAAW,QAAQ;AAAA,EAE3D,MAAM,QAAQ,UAAU,IAAI,OAAO,aAAa;AAAA,IAC/C,MAAM,WAAW,MAAM,SAAS,UAAU,MAAM;AAAA,IAEhD,IAAI,CAAC,SAAS,SAAS,gBAAgB;AAAA,MAAG;AAAA,IAE1C,MAAM,UAAU,SAAS,QACxB,WACA,CAAC,OAAO,QAAQ,UAAU,gBAAgB,OAAO,QAAQ,OAAO,MAAM,CACvE;AAAA,IAEA,IAAI,YAAY,UAAU;AAAA,MACzB,MAAM,UAAU,UAAU,SAAS,MAAM;AAAA,IAC1C;AAAA,GACA;AAAA,EAED,MAAM,QAAQ,IAAI,KAAK;AAAA;",
|
|
8
|
+
"debugId": "C7780E76D47EF80B64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|
|
@@ -0,0 +1,184 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
import {
|
|
3
|
+
compileSvelteServerModule
|
|
4
|
+
} from "./chunk-dr9yqsdb.js";
|
|
5
|
+
import {
|
|
6
|
+
getIslandMarkerAttributes,
|
|
7
|
+
serializeIslandAttributes
|
|
8
|
+
} from "./chunk-2f21eenc.js";
|
|
9
|
+
import {
|
|
10
|
+
getIslandBuildReference,
|
|
11
|
+
getIslandComponent
|
|
12
|
+
} from "./chunk-8kcfffry.js";
|
|
13
|
+
import {
|
|
14
|
+
__require
|
|
15
|
+
} from "./chunk-bmgqm774.js";
|
|
16
|
+
|
|
17
|
+
// src/core/islandSsr.ts
|
|
18
|
+
var renderAngularIslandToHtmlInternal = async (component, props, islandId) => {
|
|
19
|
+
const { renderAngularIslandToHtml } = await import("./chunk-hza0n8qm.js");
|
|
20
|
+
return renderAngularIslandToHtml(component, props, islandId);
|
|
21
|
+
};
|
|
22
|
+
var renderAngularIslandToHtml = renderAngularIslandToHtmlInternal;
|
|
23
|
+
var renderReactIslandToHtml = (component, props) => import("react").then(({ createElement }) => import("react-dom/server").then(({ renderToStaticMarkup }) => renderToStaticMarkup(createElement(component, props))));
|
|
24
|
+
var renderSvelteIslandToHtml = (component, props) => import("svelte/server").then(({ render }) => {
|
|
25
|
+
const { body } = render(component, { props });
|
|
26
|
+
return body;
|
|
27
|
+
});
|
|
28
|
+
var renderVueIslandToHtml = (component, props) => import("vue").then(({ createSSRApp, h: createVueVNode }) => {
|
|
29
|
+
const app = createSSRApp({
|
|
30
|
+
render: () => createVueVNode(component, props)
|
|
31
|
+
});
|
|
32
|
+
return import("vue/server-renderer").then(({ renderToString }) => renderToString(app));
|
|
33
|
+
});
|
|
34
|
+
|
|
35
|
+
// src/core/renderIslandMarkup.ts
|
|
36
|
+
var islandSequence = 0;
|
|
37
|
+
var resolvedServerComponentCache = new Map;
|
|
38
|
+
var resolvedServerBuildComponentCache = new Map;
|
|
39
|
+
var nextIslandId = () => {
|
|
40
|
+
islandSequence += 1;
|
|
41
|
+
return `island-${islandSequence}`;
|
|
42
|
+
};
|
|
43
|
+
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
44
|
+
var isReactServerIslandComponent = (value) => typeof value === "function";
|
|
45
|
+
var isSvelteServerIslandComponent = (value) => typeof value === "function";
|
|
46
|
+
var isVueServerIslandComponent = (value) => typeof value === "function" || isRecord(value);
|
|
47
|
+
var isAngularServerIslandComponent = (value) => typeof value === "function";
|
|
48
|
+
var resolveBuildReferencePath = (source, registryPath) => {
|
|
49
|
+
if (source.startsWith("file://"))
|
|
50
|
+
return new URL(source).pathname;
|
|
51
|
+
if (source.startsWith("."))
|
|
52
|
+
return new URL(source, registryPath).pathname;
|
|
53
|
+
return source;
|
|
54
|
+
};
|
|
55
|
+
var loadAndCompileServerBuildComponent = async (buildReferencePath) => {
|
|
56
|
+
const compiledModulePath = await compileSvelteServerModule(buildReferencePath);
|
|
57
|
+
const loadedModule = await import(compiledModulePath);
|
|
58
|
+
return "default" in loadedModule ? loadedModule.default : loadedModule;
|
|
59
|
+
};
|
|
60
|
+
var loadServerBuildComponent = async (buildReferencePath) => {
|
|
61
|
+
const cachedBuildComponent = resolvedServerBuildComponentCache.get(buildReferencePath);
|
|
62
|
+
if (cachedBuildComponent) {
|
|
63
|
+
return cachedBuildComponent;
|
|
64
|
+
}
|
|
65
|
+
const loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);
|
|
66
|
+
resolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);
|
|
67
|
+
return loadPromise;
|
|
68
|
+
};
|
|
69
|
+
var loadServerImportComponent = async (resolvedComponent, exportName) => {
|
|
70
|
+
const resolvedModulePath = resolvedComponent.startsWith(".") ? new URL(resolvedComponent, import.meta.url).pathname : resolvedComponent;
|
|
71
|
+
const importTarget = resolvedModulePath.endsWith(".svelte") ? await compileSvelteServerModule(resolvedModulePath) : resolvedModulePath;
|
|
72
|
+
const loadedModule = await import(importTarget);
|
|
73
|
+
if (exportName && exportName !== "default" && exportName in loadedModule) {
|
|
74
|
+
return loadedModule[exportName];
|
|
75
|
+
}
|
|
76
|
+
return "default" in loadedModule ? loadedModule.default : loadedModule;
|
|
77
|
+
};
|
|
78
|
+
var resolveIslandComponent = async (component) => {
|
|
79
|
+
const buildReference = getIslandBuildReference(component);
|
|
80
|
+
const buildReferencePath = buildReference?.source ? resolveBuildReferencePath(buildReference.source, import.meta.url) : null;
|
|
81
|
+
if (buildReferencePath?.endsWith(".svelte")) {
|
|
82
|
+
return loadServerBuildComponent(buildReferencePath);
|
|
83
|
+
}
|
|
84
|
+
if (buildReferencePath) {
|
|
85
|
+
return loadServerImportComponent(buildReferencePath, buildReference?.export);
|
|
86
|
+
}
|
|
87
|
+
const resolvedComponent = getIslandComponent(component);
|
|
88
|
+
if (typeof resolvedComponent !== "string") {
|
|
89
|
+
return resolvedComponent;
|
|
90
|
+
}
|
|
91
|
+
return loadServerImportComponent(resolvedComponent);
|
|
92
|
+
};
|
|
93
|
+
var resolveServerIslandComponent = async (component) => {
|
|
94
|
+
const cachedResolvedComponent = resolvedServerComponentCache.get(component);
|
|
95
|
+
if (cachedResolvedComponent) {
|
|
96
|
+
return cachedResolvedComponent;
|
|
97
|
+
}
|
|
98
|
+
const resolutionPromise = resolveIslandComponent(component);
|
|
99
|
+
resolvedServerComponentCache.set(component, resolutionPromise);
|
|
100
|
+
return resolutionPromise;
|
|
101
|
+
};
|
|
102
|
+
var resolveReactServerIslandComponent = async (component) => {
|
|
103
|
+
const resolvedComponent = await resolveServerIslandComponent(component);
|
|
104
|
+
if (!isReactServerIslandComponent(resolvedComponent)) {
|
|
105
|
+
throw new Error("Resolved React island is not a valid React component.");
|
|
106
|
+
}
|
|
107
|
+
return resolvedComponent;
|
|
108
|
+
};
|
|
109
|
+
var resolveSvelteServerIslandComponent = async (component) => {
|
|
110
|
+
const resolvedComponent = await resolveServerIslandComponent(component);
|
|
111
|
+
if (!isSvelteServerIslandComponent(resolvedComponent)) {
|
|
112
|
+
throw new Error("Resolved Svelte island is not a valid Svelte component.");
|
|
113
|
+
}
|
|
114
|
+
return resolvedComponent;
|
|
115
|
+
};
|
|
116
|
+
var resolveVueServerIslandComponent = async (component) => {
|
|
117
|
+
const resolvedComponent = await resolveServerIslandComponent(component);
|
|
118
|
+
if (!isVueServerIslandComponent(resolvedComponent)) {
|
|
119
|
+
throw new Error("Resolved Vue island is not a valid Vue component.");
|
|
120
|
+
}
|
|
121
|
+
return resolvedComponent;
|
|
122
|
+
};
|
|
123
|
+
var resolveAngularServerIslandComponent = async (component) => {
|
|
124
|
+
const resolvedComponent = await resolveServerIslandComponent(component);
|
|
125
|
+
if (!isAngularServerIslandComponent(resolvedComponent)) {
|
|
126
|
+
throw new Error("Resolved Angular island is not a valid Angular component.");
|
|
127
|
+
}
|
|
128
|
+
return resolvedComponent;
|
|
129
|
+
};
|
|
130
|
+
var renderIslandMarkup = async (registry, props) => {
|
|
131
|
+
const result = await renderIslandResult(registry, props);
|
|
132
|
+
return `<div ${serializeIslandAttributes(result.attributes)}>${result.html}</div>`;
|
|
133
|
+
};
|
|
134
|
+
var renderIslandResult = async (registry, props) => {
|
|
135
|
+
const islandId = nextIslandId();
|
|
136
|
+
const attributes = getIslandMarkerAttributes(props);
|
|
137
|
+
if (props.framework === "react") {
|
|
138
|
+
const entry = registry.react?.[props.component];
|
|
139
|
+
if (!entry) {
|
|
140
|
+
throw new Error(`Island component "${props.component}" is not registered for framework "react".`);
|
|
141
|
+
}
|
|
142
|
+
const component = await resolveReactServerIslandComponent(entry);
|
|
143
|
+
const html = await renderReactIslandToHtml(component, props.props);
|
|
144
|
+
return { attributes, html };
|
|
145
|
+
}
|
|
146
|
+
if (props.framework === "svelte") {
|
|
147
|
+
const entry = registry.svelte?.[props.component];
|
|
148
|
+
if (!entry) {
|
|
149
|
+
throw new Error(`Island component "${props.component}" is not registered for framework "svelte".`);
|
|
150
|
+
}
|
|
151
|
+
const component = await resolveSvelteServerIslandComponent(entry);
|
|
152
|
+
const html = await renderSvelteIslandToHtml(component, props.props);
|
|
153
|
+
return { attributes, html };
|
|
154
|
+
}
|
|
155
|
+
if (props.framework === "vue") {
|
|
156
|
+
const entry = registry.vue?.[props.component];
|
|
157
|
+
if (!entry) {
|
|
158
|
+
throw new Error(`Island component "${props.component}" is not registered for framework "vue".`);
|
|
159
|
+
}
|
|
160
|
+
const component = await resolveVueServerIslandComponent(entry);
|
|
161
|
+
const html = await renderVueIslandToHtml(component, props.props);
|
|
162
|
+
return { attributes, html };
|
|
163
|
+
}
|
|
164
|
+
if (props.framework === "angular") {
|
|
165
|
+
const entry = registry.angular?.[props.component];
|
|
166
|
+
if (!entry) {
|
|
167
|
+
throw new Error(`Island component "${props.component}" is not registered for framework "angular".`);
|
|
168
|
+
}
|
|
169
|
+
const component = await resolveAngularServerIslandComponent(entry);
|
|
170
|
+
const html = await renderAngularIslandToHtml(component, props.props, islandId);
|
|
171
|
+
return {
|
|
172
|
+
attributes: {
|
|
173
|
+
...getIslandMarkerAttributes(props, islandId)
|
|
174
|
+
},
|
|
175
|
+
html
|
|
176
|
+
};
|
|
177
|
+
}
|
|
178
|
+
throw new Error(`Framework "${props.framework}" is not implemented in this prototype.`);
|
|
179
|
+
};
|
|
180
|
+
|
|
181
|
+
export { renderIslandMarkup, renderIslandResult };
|
|
182
|
+
|
|
183
|
+
//# debugId=422A05E95D6E1A7B64756E2164756E21
|
|
184
|
+
//# sourceMappingURL=chunk-4m75s5xf.js.map
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/islandSsr.ts", "../src/core/renderIslandMarkup.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"type ReactComponentType<Props extends Record<string, unknown>> =\n\timport('react').ComponentType<Props>;\n\nconst renderAngularIslandToHtmlInternal = async (\n\tcomponent: import('@angular/core').Type<object>,\n\tprops: Record<string, unknown>,\n\tislandId: string\n) => {\n\tconst { renderAngularIslandToHtml } = await import('../angular/islands');\n\n\treturn renderAngularIslandToHtml(component, props, islandId);\n};\nexport const renderAngularIslandToHtml = renderAngularIslandToHtmlInternal;\nexport const renderReactIslandToHtml = <Props extends Record<string, unknown>>(\n\tcomponent: ReactComponentType<Props>,\n\tprops: Props\n) =>\n\timport('react').then(({ createElement }) =>\n\t\timport('react-dom/server').then(({ renderToStaticMarkup }) =>\n\t\t\trenderToStaticMarkup(createElement(component, props))\n\t\t)\n\t);\nexport const renderSvelteIslandToHtml = <Props extends Record<string, unknown>>(\n\tcomponent: import('svelte').Component<Props>,\n\tprops: Props\n) =>\n\timport('svelte/server').then(({ render }) => {\n\t\tconst { body } = render(component, { props });\n\n\t\treturn body;\n\t});\nexport const renderVueIslandToHtml = <Props extends Record<string, unknown>>(\n\tcomponent: import('vue').Component<Props>,\n\tprops: Props\n) =>\n\timport('vue').then(({ createSSRApp, h: createVueVNode }) => {\n\t\tconst app = createSSRApp({\n\t\t\trender: () => createVueVNode(component, props)\n\t\t});\n\n\t\treturn import('vue/server-renderer').then(({ renderToString }) =>\n\t\t\trenderToString(app)\n\t\t);\n\t});\n",
|
|
6
|
+
"import type {\n\tIslandRegistry,\n\tIslandRegistryInput,\n\tRuntimeIslandRenderProps\n} from '../../types/island';\nimport {\n\trenderAngularIslandToHtml,\n\trenderReactIslandToHtml,\n\trenderSvelteIslandToHtml,\n\trenderVueIslandToHtml\n} from './islandSsr';\nimport { compileSvelteServerModule } from './svelteServerModule';\nimport {\n\tgetIslandMarkerAttributes,\n\tserializeIslandAttributes\n} from './islandMarkupAttributes';\nimport { getIslandBuildReference, getIslandComponent } from './islands';\n\nlet islandSequence = 0;\nconst resolvedServerComponentCache = new Map<unknown, Promise<unknown>>();\nconst resolvedServerBuildComponentCache = new Map<string, Promise<unknown>>();\n\nconst nextIslandId = () => {\n\tislandSequence += 1;\n\n\treturn `island-${islandSequence}`;\n};\n\ntype AngularServerIslandComponent = import('@angular/core').Type<object>;\ntype ReactServerIslandComponent = import('react').ComponentType<\n\tRecord<string, unknown>\n>;\ntype SvelteServerIslandComponent = import('svelte').Component<\n\tRecord<string, unknown>\n>;\ntype VueServerIslandComponent = import('vue').Component<\n\tRecord<string, unknown>\n>;\nconst isRecord = (value: unknown): value is Record<string, unknown> =>\n\ttypeof value === 'object' && value !== null;\n\nconst isReactServerIslandComponent = (\n\tvalue: unknown\n): value is ReactServerIslandComponent => typeof value === 'function';\n\nconst isSvelteServerIslandComponent = (\n\tvalue: unknown\n): value is SvelteServerIslandComponent => typeof value === 'function';\n\nconst isVueServerIslandComponent = (\n\tvalue: unknown\n): value is VueServerIslandComponent =>\n\ttypeof value === 'function' || isRecord(value);\n\nconst isAngularServerIslandComponent = (\n\tvalue: unknown\n): value is AngularServerIslandComponent => typeof value === 'function';\n\nconst resolveBuildReferencePath = (source: string, registryPath: string) => {\n\tif (source.startsWith('file://')) return new URL(source).pathname;\n\tif (source.startsWith('.')) return new URL(source, registryPath).pathname;\n\n\treturn source;\n};\n\nconst loadAndCompileServerBuildComponent = async (\n\tbuildReferencePath: string\n) => {\n\tconst compiledModulePath =\n\t\tawait compileSvelteServerModule(buildReferencePath);\n\tconst loadedModule = await import(compiledModulePath);\n\n\treturn 'default' in loadedModule ? loadedModule.default : loadedModule;\n};\n\nconst loadServerBuildComponent = async (buildReferencePath: string) => {\n\tconst cachedBuildComponent =\n\t\tresolvedServerBuildComponentCache.get(buildReferencePath);\n\tif (cachedBuildComponent) {\n\t\treturn cachedBuildComponent;\n\t}\n\n\tconst loadPromise = loadAndCompileServerBuildComponent(buildReferencePath);\n\tresolvedServerBuildComponentCache.set(buildReferencePath, loadPromise);\n\n\treturn loadPromise;\n};\n\nconst loadServerImportComponent = async (\n\tresolvedComponent: string,\n\texportName?: string\n) => {\n\tconst resolvedModulePath = resolvedComponent.startsWith('.')\n\t\t? new URL(resolvedComponent, import.meta.url).pathname\n\t\t: resolvedComponent;\n\tconst importTarget = resolvedModulePath.endsWith('.svelte')\n\t\t? await compileSvelteServerModule(resolvedModulePath)\n\t\t: resolvedModulePath;\n\tconst loadedModule = await import(importTarget);\n\n\tif (exportName && exportName !== 'default' && exportName in loadedModule) {\n\t\treturn loadedModule[exportName];\n\t}\n\n\treturn 'default' in loadedModule ? loadedModule.default : loadedModule;\n};\n\nconst resolveIslandComponent = async (component: unknown) => {\n\tconst buildReference = getIslandBuildReference(component);\n\tconst buildReferencePath = buildReference?.source\n\t\t? resolveBuildReferencePath(buildReference.source, import.meta.url)\n\t\t: null;\n\tif (buildReferencePath?.endsWith('.svelte')) {\n\t\treturn loadServerBuildComponent(buildReferencePath);\n\t}\n\tif (buildReferencePath) {\n\t\treturn loadServerImportComponent(\n\t\t\tbuildReferencePath,\n\t\t\tbuildReference?.export\n\t\t);\n\t}\n\n\tconst resolvedComponent = getIslandComponent(component);\n\tif (typeof resolvedComponent !== 'string') {\n\t\treturn resolvedComponent;\n\t}\n\n\treturn loadServerImportComponent(resolvedComponent);\n};\n\nconst resolveServerIslandComponent = async (component: unknown) => {\n\tconst cachedResolvedComponent = resolvedServerComponentCache.get(component);\n\tif (cachedResolvedComponent) {\n\t\treturn cachedResolvedComponent;\n\t}\n\n\tconst resolutionPromise = resolveIslandComponent(component);\n\n\tresolvedServerComponentCache.set(component, resolutionPromise);\n\n\treturn resolutionPromise;\n};\n\nconst resolveReactServerIslandComponent = async (component: unknown) => {\n\tconst resolvedComponent = await resolveServerIslandComponent(component);\n\tif (!isReactServerIslandComponent(resolvedComponent)) {\n\t\tthrow new Error(\n\t\t\t'Resolved React island is not a valid React component.'\n\t\t);\n\t}\n\n\treturn resolvedComponent;\n};\n\nconst resolveSvelteServerIslandComponent = async (component: unknown) => {\n\tconst resolvedComponent = await resolveServerIslandComponent(component);\n\tif (!isSvelteServerIslandComponent(resolvedComponent)) {\n\t\tthrow new Error(\n\t\t\t'Resolved Svelte island is not a valid Svelte component.'\n\t\t);\n\t}\n\n\treturn resolvedComponent;\n};\n\nconst resolveVueServerIslandComponent = async (component: unknown) => {\n\tconst resolvedComponent = await resolveServerIslandComponent(component);\n\tif (!isVueServerIslandComponent(resolvedComponent)) {\n\t\tthrow new Error('Resolved Vue island is not a valid Vue component.');\n\t}\n\n\treturn resolvedComponent;\n};\n\nconst resolveAngularServerIslandComponent = async (component: unknown) => {\n\tconst resolvedComponent = await resolveServerIslandComponent(component);\n\tif (!isAngularServerIslandComponent(resolvedComponent)) {\n\t\tthrow new Error(\n\t\t\t'Resolved Angular island is not a valid Angular component.'\n\t\t);\n\t}\n\n\treturn resolvedComponent;\n};\n\nexport const renderIslandMarkup = async <T extends IslandRegistryInput>(\n\tregistry: IslandRegistry<T> | T,\n\tprops: RuntimeIslandRenderProps\n) => {\n\tconst result = await renderIslandResult(registry, props);\n\n\treturn `<div ${serializeIslandAttributes(result.attributes)}>${result.html}</div>`;\n};\nexport const renderIslandResult = async <T extends IslandRegistryInput>(\n\tregistry: IslandRegistry<T> | T,\n\tprops: RuntimeIslandRenderProps\n) => {\n\tconst islandId = nextIslandId();\n\tconst attributes = getIslandMarkerAttributes(props);\n\n\tif (props.framework === 'react') {\n\t\tconst entry = registry.react?.[props.component];\n\t\tif (!entry) {\n\t\t\tthrow new Error(\n\t\t\t\t`Island component \"${props.component}\" is not registered for framework \"react\".`\n\t\t\t);\n\t\t}\n\t\tconst component = await resolveReactServerIslandComponent(entry);\n\t\tconst html = await renderReactIslandToHtml(component, props.props);\n\n\t\treturn { attributes, html };\n\t}\n\n\tif (props.framework === 'svelte') {\n\t\tconst entry = registry.svelte?.[props.component];\n\t\tif (!entry) {\n\t\t\tthrow new Error(\n\t\t\t\t`Island component \"${props.component}\" is not registered for framework \"svelte\".`\n\t\t\t);\n\t\t}\n\t\tconst component = await resolveSvelteServerIslandComponent(entry);\n\t\tconst html = await renderSvelteIslandToHtml(component, props.props);\n\n\t\treturn { attributes, html };\n\t}\n\n\tif (props.framework === 'vue') {\n\t\tconst entry = registry.vue?.[props.component];\n\t\tif (!entry) {\n\t\t\tthrow new Error(\n\t\t\t\t`Island component \"${props.component}\" is not registered for framework \"vue\".`\n\t\t\t);\n\t\t}\n\t\tconst component = await resolveVueServerIslandComponent(entry);\n\t\tconst html = await renderVueIslandToHtml(component, props.props);\n\n\t\treturn { attributes, html };\n\t}\n\n\tif (props.framework === 'angular') {\n\t\tconst entry = registry.angular?.[props.component];\n\t\tif (!entry) {\n\t\t\tthrow new Error(\n\t\t\t\t`Island component \"${props.component}\" is not registered for framework \"angular\".`\n\t\t\t);\n\t\t}\n\t\tconst component = await resolveAngularServerIslandComponent(entry);\n\t\tconst html = await renderAngularIslandToHtml(\n\t\t\tcomponent,\n\t\t\tprops.props,\n\t\t\tislandId\n\t\t);\n\n\t\treturn {\n\t\t\tattributes: {\n\t\t\t\t...getIslandMarkerAttributes(props, islandId)\n\t\t\t},\n\t\t\thtml\n\t\t};\n\t}\n\n\tthrow new Error(\n\t\t`Framework \"${props.framework}\" is not implemented in this prototype.`\n\t);\n};\n"
|
|
7
|
+
],
|
|
8
|
+
"mappings": ";;;;;;;;;;;;;;;;;AAGA,IAAM,oCAAoC,OACzC,WACA,O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MACX,MAAM,IAAI,MACT,qBAAqB,MAAM,uDAC5B;AAAA,IACD;AAAA,IACA,MAAM,YAAY,MAAM,oCAAoC,KAAK;AAAA,IACjE,MAAM,OAAO,MAAM,0BAClB,WACA,MAAM,OACN,QACD;AAAA,IAEA,OAAO;AAAA,MACN,YAAY;AAAA,WACR,0BAA0B,OAAO,QAAQ;AAAA,MAC7C;AAAA,MACA;AAAA,IACD;AAAA,EACD;AAAA,EAEA,MAAM,IAAI,MACT,cAAc,MAAM,kDACrB;AAAA;",
|
|
9
|
+
"debugId": "422A05E95D6E1A7B64756E2164756E21",
|
|
10
|
+
"names": []
|
|
11
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
// @bun
|
|
2
|
+
// src/core/currentIslandRegistry.ts
|
|
3
|
+
var requireCurrentIslandRegistry = () => {
|
|
4
|
+
const registry = globalThis.__absoluteIslandRegistry;
|
|
5
|
+
if (!registry) {
|
|
6
|
+
throw new Error("No island registry is active. Configure `islands.registry` in absolute.config.ts before rendering <Island />.");
|
|
7
|
+
}
|
|
8
|
+
return registry;
|
|
9
|
+
};
|
|
10
|
+
var setCurrentIslandRegistry = (registry) => {
|
|
11
|
+
globalThis.__absoluteIslandRegistry = registry;
|
|
12
|
+
};
|
|
13
|
+
|
|
14
|
+
export { requireCurrentIslandRegistry, setCurrentIslandRegistry };
|
|
15
|
+
|
|
16
|
+
//# debugId=97E6069773F416CD64756E2164756E21
|
|
17
|
+
//# sourceMappingURL=chunk-5003emhv.js.map
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
{
|
|
2
|
+
"version": 3,
|
|
3
|
+
"sources": ["../src/core/currentIslandRegistry.ts"],
|
|
4
|
+
"sourcesContent": [
|
|
5
|
+
"import type { IslandRegistryInput } from '../../types/island';\n\ndeclare global {\n\tvar __absoluteIslandRegistry: IslandRegistryInput | undefined;\n}\n\nexport const getCurrentIslandRegistry = () =>\n\tglobalThis.__absoluteIslandRegistry;\nexport const requireCurrentIslandRegistry = () => {\n\tconst registry = globalThis.__absoluteIslandRegistry;\n\tif (!registry) {\n\t\tthrow new Error(\n\t\t\t'No island registry is active. Configure `islands.registry` in absolute.config.ts before rendering <Island />.'\n\t\t);\n\t}\n\n\treturn registry;\n};\nexport const setCurrentIslandRegistry = (\n\tregistry: IslandRegistryInput | undefined\n) => {\n\tglobalThis.__absoluteIslandRegistry = registry;\n};\n"
|
|
6
|
+
],
|
|
7
|
+
"mappings": ";;AAQO,IAAM,+BAA+B,MAAM;AAAA,EACjD,MAAM,WAAW,WAAW;AAAA,EAC5B,IAAI,CAAC,UAAU;AAAA,IACd,MAAM,IAAI,MACT,+GACD;AAAA,EACD;AAAA,EAEA,OAAO;AAAA;AAED,IAAM,2BAA2B,CACvC,aACI;AAAA,EACJ,WAAW,2BAA2B;AAAA;",
|
|
8
|
+
"debugId": "97E6069773F416CD64756E2164756E21",
|
|
9
|
+
"names": []
|
|
10
|
+
}
|