@absolutejs/absolute 0.19.0-beta.807 → 0.19.0-beta.809
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 +9801 -57
- package/dist/angular/browser.js.map +246 -4
- package/dist/angular/components/core/streamingSlotRegistrar.js +1 -1
- package/dist/angular/components/core/streamingSlotRegistry.js +2 -2
- package/dist/angular/index.js +14877 -60
- package/dist/angular/index.js.map +281 -4
- package/dist/angular/server.js +5610 -45
- package/dist/angular/server.js.map +51 -3
- package/dist/build.js +18092 -45
- package/dist/build.js.map +99 -3
- package/dist/cli/index.js +317 -86
- package/dist/client/index.js +1091 -70
- package/dist/client/index.js.map +24 -4
- package/dist/core/streamingSlotRegistrar.js +108 -11
- package/dist/core/streamingSlotRegistrar.js.map +4 -3
- package/dist/core/streamingSlotRegistry.js +169 -7
- package/dist/core/streamingSlotRegistry.js.map +5 -3
- package/dist/index.js +19957 -547
- package/dist/index.js.map +116 -3
- package/dist/islands/browser.js +228 -9
- package/dist/islands/browser.js.map +9 -4
- package/dist/islands/index.js +1908 -17
- package/dist/islands/index.js.map +27 -3
- package/dist/react/browser.js +328 -12
- package/dist/react/browser.js.map +12 -4
- package/dist/react/components/index.js +167 -16
- package/dist/react/components/index.js.map +6 -3
- package/dist/react/hooks/index.js +183 -8
- package/dist/react/hooks/index.js.map +7 -3
- package/dist/react/index.js +3627 -36
- package/dist/react/index.js.map +45 -4
- package/dist/react/jsxDevRuntimeCompat.js +61 -2
- package/dist/react/jsxDevRuntimeCompat.js.map +2 -2
- package/dist/react/server.js +1789 -18
- package/dist/react/server.js.map +21 -3
- package/dist/src/angular/injectorPatch.d.ts +1 -0
- package/dist/src/angular/islands.d.ts +1 -0
- package/dist/src/client/hydrators/react.d.ts +3 -0
- package/dist/src/client/hydrators/svelte.d.ts +2 -0
- package/dist/src/client/hydrators/vue.d.ts +2 -0
- package/dist/src/index.d.ts +1 -0
- package/dist/svelte/browser.js +247 -12
- package/dist/svelte/browser.js.map +10 -3
- package/dist/svelte/index.js +3732 -37
- package/dist/svelte/index.js.map +47 -4
- package/dist/svelte/server.js +2794 -21
- package/dist/svelte/server.js.map +27 -3
- package/dist/vue/browser.js +348 -12
- package/dist/vue/browser.js.map +12 -4
- package/dist/vue/components/Image.js +240 -7
- package/dist/vue/components/Image.js.map +6 -3
- package/dist/vue/components/index.js +544 -11
- package/dist/vue/components/index.js.map +9 -3
- package/dist/vue/index.js +4212 -52
- package/dist/vue/index.js.map +50 -4
- package/dist/vue/server.js +1849 -18
- package/dist/vue/server.js.map +21 -3
- package/package.json +1 -1
- package/dist/chunk-0867j0r0.js +0 -136
- package/dist/chunk-0867j0r0.js.map +0 -10
- package/dist/chunk-102fp7xe.js +0 -63
- package/dist/chunk-102fp7xe.js.map +0 -10
- package/dist/chunk-11zpfqz6.js +0 -19
- package/dist/chunk-11zpfqz6.js.map +0 -10
- package/dist/chunk-1rfh7hw9.js +0 -319
- package/dist/chunk-1rfh7hw9.js.map +0 -11
- package/dist/chunk-1x4fxm57.js +0 -51
- package/dist/chunk-1x4fxm57.js.map +0 -9
- package/dist/chunk-25v9t56f.js +0 -29
- package/dist/chunk-25v9t56f.js.map +0 -11
- package/dist/chunk-2f21eenc.js +0 -21
- package/dist/chunk-2f21eenc.js.map +0 -10
- package/dist/chunk-2ga2znex.js +0 -13
- package/dist/chunk-2ga2znex.js.map +0 -9
- package/dist/chunk-30yrw0f6.js +0 -33
- package/dist/chunk-30yrw0f6.js.map +0 -10
- package/dist/chunk-3g91wb4f.js +0 -358
- package/dist/chunk-3g91wb4f.js.map +0 -10
- package/dist/chunk-3rea1gam.js +0 -4403
- package/dist/chunk-3rea1gam.js.map +0 -28
- package/dist/chunk-3yjzpcne.js +0 -34
- package/dist/chunk-3yjzpcne.js.map +0 -10
- package/dist/chunk-41bf6aqt.js +0 -17
- package/dist/chunk-41bf6aqt.js.map +0 -9
- package/dist/chunk-4d39r92n.js +0 -81
- package/dist/chunk-4d39r92n.js.map +0 -10
- package/dist/chunk-5003emhv.js +0 -17
- package/dist/chunk-5003emhv.js.map +0 -10
- package/dist/chunk-5f67rsed.js +0 -466
- package/dist/chunk-5f67rsed.js.map +0 -10
- package/dist/chunk-5fhp1jap.js +0 -9169
- package/dist/chunk-5fhp1jap.js.map +0 -236
- package/dist/chunk-629x0yh4.js +0 -20
- package/dist/chunk-629x0yh4.js.map +0 -9
- package/dist/chunk-6pdj08z3.js +0 -73
- package/dist/chunk-6pdj08z3.js.map +0 -12
- package/dist/chunk-6qjbrt0k.js +0 -13
- package/dist/chunk-6qjbrt0k.js.map +0 -9
- package/dist/chunk-6sccb4jr.js +0 -14
- package/dist/chunk-6sccb4jr.js.map +0 -9
- package/dist/chunk-798spvzv.js +0 -50
- package/dist/chunk-798spvzv.js.map +0 -10
- package/dist/chunk-7fw6x3js.js +0 -131
- package/dist/chunk-7fw6x3js.js.map +0 -11
- package/dist/chunk-7kjj42xm.js +0 -11
- package/dist/chunk-7kjj42xm.js.map +0 -10
- package/dist/chunk-7mtstdqn.js +0 -90
- package/dist/chunk-7mtstdqn.js.map +0 -10
- package/dist/chunk-851whwc7.js +0 -17
- package/dist/chunk-851whwc7.js.map +0 -10
- package/dist/chunk-85n68sy6.js +0 -103
- package/dist/chunk-85n68sy6.js.map +0 -10
- package/dist/chunk-8kcfffry.js +0 -35
- package/dist/chunk-8kcfffry.js.map +0 -10
- package/dist/chunk-92fsjfpp.js +0 -1731
- package/dist/chunk-92fsjfpp.js.map +0 -11
- package/dist/chunk-93sqk7be.js +0 -139
- package/dist/chunk-93sqk7be.js.map +0 -12
- package/dist/chunk-9c5tj4k3.js +0 -130
- package/dist/chunk-9c5tj4k3.js.map +0 -10
- package/dist/chunk-9j59emg3.js +0 -184
- package/dist/chunk-9j59emg3.js.map +0 -11
- package/dist/chunk-9ve9jq72.js +0 -203
- package/dist/chunk-9ve9jq72.js.map +0 -10
- package/dist/chunk-9xrsjeem.js +0 -12
- package/dist/chunk-9xrsjeem.js.map +0 -9
- package/dist/chunk-a9mvyp04.js +0 -87
- package/dist/chunk-a9mvyp04.js.map +0 -10
- package/dist/chunk-b3gbnrwe.js +0 -21
- package/dist/chunk-b3gbnrwe.js.map +0 -10
- package/dist/chunk-bgb8k1qs.js +0 -672
- package/dist/chunk-bgb8k1qs.js.map +0 -15
- package/dist/chunk-bmgqm774.js +0 -65
- package/dist/chunk-bmgqm774.js.map +0 -9
- package/dist/chunk-bxfghpma.js +0 -69
- package/dist/chunk-bxfghpma.js.map +0 -10
- package/dist/chunk-c1jfjnka.js +0 -74
- package/dist/chunk-c1jfjnka.js.map +0 -10
- package/dist/chunk-cbkrwmvh.js +0 -80
- package/dist/chunk-cbkrwmvh.js.map +0 -10
- package/dist/chunk-cdxd7sy2.js +0 -71
- package/dist/chunk-cdxd7sy2.js.map +0 -10
- package/dist/chunk-cg95827x.js +0 -21
- package/dist/chunk-cg95827x.js.map +0 -10
- package/dist/chunk-cm0g4q6w.js +0 -149
- package/dist/chunk-cm0g4q6w.js.map +0 -10
- package/dist/chunk-d7mwkzry.js +0 -261
- package/dist/chunk-d7mwkzry.js.map +0 -10
- package/dist/chunk-d9c0am65.js +0 -12
- package/dist/chunk-d9c0am65.js.map +0 -10
- package/dist/chunk-daqghmg8.js +0 -12
- package/dist/chunk-daqghmg8.js.map +0 -9
- package/dist/chunk-e3r9fxaa.js +0 -149
- package/dist/chunk-e3r9fxaa.js.map +0 -10
- package/dist/chunk-e8eecyrq.js +0 -244
- package/dist/chunk-e8eecyrq.js.map +0 -10
- package/dist/chunk-ex2hxe0v.js +0 -160
- package/dist/chunk-ex2hxe0v.js.map +0 -11
- package/dist/chunk-fak944et.js +0 -91
- package/dist/chunk-fak944et.js.map +0 -10
- package/dist/chunk-fygx2ymm.js +0 -118
- package/dist/chunk-fygx2ymm.js.map +0 -12
- package/dist/chunk-g15qj669.js +0 -271
- package/dist/chunk-g15qj669.js.map +0 -11
- package/dist/chunk-gd6wmknh.js +0 -121
- package/dist/chunk-gd6wmknh.js.map +0 -11
- package/dist/chunk-gf0ygptk.js +0 -85
- package/dist/chunk-gf0ygptk.js.map +0 -11
- package/dist/chunk-gytkmthr.js +0 -220
- package/dist/chunk-gytkmthr.js.map +0 -10
- package/dist/chunk-h5bbfn3n.js +0 -28
- package/dist/chunk-h5bbfn3n.js.map +0 -11
- package/dist/chunk-h6mye9r3.js +0 -93
- package/dist/chunk-h6mye9r3.js.map +0 -10
- package/dist/chunk-hcsmxw1v.js +0 -85
- package/dist/chunk-hcsmxw1v.js.map +0 -10
- package/dist/chunk-hyjs4bqs.js +0 -8
- package/dist/chunk-hyjs4bqs.js.map +0 -10
- package/dist/chunk-jn91vzkh.js +0 -66
- package/dist/chunk-jn91vzkh.js.map +0 -10
- package/dist/chunk-jpkjdgsk.js +0 -167
- package/dist/chunk-jpkjdgsk.js.map +0 -11
- package/dist/chunk-jwxt8gnp.js +0 -13
- package/dist/chunk-jwxt8gnp.js.map +0 -9
- package/dist/chunk-kk8w9rh5.js +0 -195
- package/dist/chunk-kk8w9rh5.js.map +0 -10
- package/dist/chunk-kwgh8rmg.js +0 -426
- package/dist/chunk-kwgh8rmg.js.map +0 -14
- package/dist/chunk-m97ze5hz.js +0 -46
- package/dist/chunk-m97ze5hz.js.map +0 -10
- package/dist/chunk-mbazhahf.js +0 -60
- package/dist/chunk-mbazhahf.js.map +0 -10
- package/dist/chunk-mgfwq18r.js +0 -15
- package/dist/chunk-mgfwq18r.js.map +0 -9
- package/dist/chunk-mtgf69xn.js +0 -88
- package/dist/chunk-mtgf69xn.js.map +0 -10
- package/dist/chunk-mtxzyxpg.js +0 -102
- package/dist/chunk-mtxzyxpg.js.map +0 -10
- package/dist/chunk-nehhtthw.js +0 -225
- package/dist/chunk-nehhtthw.js.map +0 -10
- package/dist/chunk-p5504p14.js +0 -16
- package/dist/chunk-p5504p14.js.map +0 -10
- package/dist/chunk-p5zgj77m.js +0 -184
- package/dist/chunk-p5zgj77m.js.map +0 -10
- package/dist/chunk-pnscgw95.js +0 -90
- package/dist/chunk-pnscgw95.js.map +0 -10
- package/dist/chunk-pvpp4pvs.js +0 -17
- package/dist/chunk-pvpp4pvs.js.map +0 -10
- package/dist/chunk-qh75agse.js +0 -95
- package/dist/chunk-qh75agse.js.map +0 -10
- package/dist/chunk-qxq2zcty.js +0 -52
- package/dist/chunk-qxq2zcty.js.map +0 -10
- package/dist/chunk-r6e8pytx.js +0 -22
- package/dist/chunk-r6e8pytx.js.map +0 -9
- package/dist/chunk-r7jmgqnw.js +0 -114
- package/dist/chunk-r7jmgqnw.js.map +0 -10
- package/dist/chunk-s6defjk2.js +0 -116
- package/dist/chunk-s6defjk2.js.map +0 -10
- package/dist/chunk-sd39p726.js +0 -619
- package/dist/chunk-sd39p726.js.map +0 -10
- package/dist/chunk-swrnzs4c.js +0 -63
- package/dist/chunk-swrnzs4c.js.map +0 -10
- package/dist/chunk-tfe3sb44.js +0 -33
- package/dist/chunk-tfe3sb44.js.map +0 -10
- package/dist/chunk-tjr0kcev.js +0 -41
- package/dist/chunk-tjr0kcev.js.map +0 -9
- package/dist/chunk-tx9edm1x.js +0 -34
- package/dist/chunk-tx9edm1x.js.map +0 -10
- package/dist/chunk-txhm2vb5.js +0 -18
- package/dist/chunk-txhm2vb5.js.map +0 -9
- package/dist/chunk-v5vmsxmy.js +0 -526
- package/dist/chunk-v5vmsxmy.js.map +0 -12
- package/dist/chunk-vjhxm8n2.js +0 -29
- package/dist/chunk-vjhxm8n2.js.map +0 -9
- package/dist/chunk-vkrpm7kc.js +0 -247
- package/dist/chunk-vkrpm7kc.js.map +0 -12
- package/dist/chunk-w3m4m5we.js +0 -4925
- package/dist/chunk-w3m4m5we.js.map +0 -12
- package/dist/chunk-wrxtn9ve.js +0 -18
- package/dist/chunk-wrxtn9ve.js.map +0 -10
- package/dist/chunk-x09cskqd.js +0 -377
- package/dist/chunk-x09cskqd.js.map +0 -10
- package/dist/chunk-xnt8c6h2.js +0 -576
- package/dist/chunk-xnt8c6h2.js.map +0 -10
- package/dist/chunk-xw0tx842.js +0 -13
- package/dist/chunk-xw0tx842.js.map +0 -9
- package/dist/chunk-xx5b6b9m.js +0 -69
- package/dist/chunk-xx5b6b9m.js.map +0 -10
- package/dist/chunk-xz1kdswj.js +0 -21
- package/dist/chunk-xz1kdswj.js.map +0 -9
- package/dist/chunk-y84qnsd3.js +0 -32
- package/dist/chunk-y84qnsd3.js.map +0 -10
- package/dist/chunk-ywjn0rad.js +0 -14
- package/dist/chunk-ywjn0rad.js.map +0 -9
- package/dist/chunk-z9nvhm6r.js +0 -13
- package/dist/chunk-z9nvhm6r.js.map +0 -9
- package/dist/chunk-zhmvdpk6.js +0 -15
- package/dist/chunk-zhmvdpk6.js.map +0 -9
- package/dist/chunk-zrg9d4zw.js +0 -784
- package/dist/chunk-zrg9d4zw.js.map +0 -10
package/dist/chunk-bgb8k1qs.js
DELETED
|
@@ -1,672 +0,0 @@
|
|
|
1
|
-
// @bun
|
|
2
|
-
import {
|
|
3
|
-
incrementalTailwindBuild
|
|
4
|
-
} from "./chunk-d7mwkzry.js";
|
|
5
|
-
import {
|
|
6
|
-
scanEntryPoints
|
|
7
|
-
} from "./chunk-11zpfqz6.js";
|
|
8
|
-
import {
|
|
9
|
-
extractIslandUsagesFromSource
|
|
10
|
-
} from "./chunk-a9mvyp04.js";
|
|
11
|
-
import {
|
|
12
|
-
requireCurrentIslandRegistry
|
|
13
|
-
} from "./chunk-5003emhv.js";
|
|
14
|
-
import {
|
|
15
|
-
renderStreamingSlotPlaceholder
|
|
16
|
-
} from "./chunk-sd39p726.js";
|
|
17
|
-
import {
|
|
18
|
-
getDurationString
|
|
19
|
-
} from "./chunk-gf0ygptk.js";
|
|
20
|
-
import {
|
|
21
|
-
renderIslandMarkup
|
|
22
|
-
} from "./chunk-9j59emg3.js";
|
|
23
|
-
import {
|
|
24
|
-
getIslandBuildReference
|
|
25
|
-
} from "./chunk-8kcfffry.js";
|
|
26
|
-
|
|
27
|
-
// src/build/compileTailwind.ts
|
|
28
|
-
import { mkdir } from "fs/promises";
|
|
29
|
-
import { dirname, join } from "path";
|
|
30
|
-
var TAILWIND_CANDIDATE_EXTENSION_PATTERN = /\.(html?|m?[jt]sx?|cjs|vue|svelte|astro|mdx?|css|s[ac]ss|less|styl(?:us)?)$/i;
|
|
31
|
-
var isTailwindCandidate = (filePath) => TAILWIND_CANDIDATE_EXTENSION_PATTERN.test(filePath);
|
|
32
|
-
var compileTailwind = async (input, output, buildPath, styleTransformConfig) => {
|
|
33
|
-
const outputPath = join(buildPath, output);
|
|
34
|
-
await mkdir(dirname(outputPath), { recursive: true });
|
|
35
|
-
await incrementalTailwindBuild({ input, output }, buildPath, [], styleTransformConfig);
|
|
36
|
-
};
|
|
37
|
-
var compileTailwindConfig = async (tailwind, buildPath, styleTransformConfig) => compileTailwind(tailwind.input, tailwind.output, buildPath, styleTransformConfig);
|
|
38
|
-
|
|
39
|
-
// src/utils/startupTimings.ts
|
|
40
|
-
var startupTimingsEnabled = process.env.ABSOLUTE_STARTUP_TIMINGS === "1" || process.env.ABSOLUTE_STARTUP_TIMINGS === "true";
|
|
41
|
-
var formatStartupTimingBlock = (title, steps) => {
|
|
42
|
-
const totalDuration = steps.reduce((sum, step) => sum + step.durationMs, 0);
|
|
43
|
-
return [
|
|
44
|
-
title,
|
|
45
|
-
...steps.map((step) => ` - ${step.label}: ${getDurationString(step.durationMs)}`),
|
|
46
|
-
` Total: ${getDurationString(totalDuration)}`
|
|
47
|
-
].join(`
|
|
48
|
-
`);
|
|
49
|
-
};
|
|
50
|
-
var logStartupTimingBlock = (title, steps) => {
|
|
51
|
-
if (!startupTimingsEnabled || steps.length === 0) {
|
|
52
|
-
return;
|
|
53
|
-
}
|
|
54
|
-
console.log(formatStartupTimingBlock(title, steps));
|
|
55
|
-
};
|
|
56
|
-
|
|
57
|
-
// src/build/islandEntries.ts
|
|
58
|
-
import { mkdirSync, rmSync, writeFileSync } from "fs";
|
|
59
|
-
import { dirname as dirname2, extname, join as join2, relative, resolve } from "path";
|
|
60
|
-
import ts from "typescript";
|
|
61
|
-
var frameworks = ["react", "svelte", "vue", "angular"];
|
|
62
|
-
var isRecord = (value) => typeof value === "object" && value !== null;
|
|
63
|
-
var resolveRegistryExport = (mod) => {
|
|
64
|
-
if (isRecord(mod.islandRegistry))
|
|
65
|
-
return mod.islandRegistry;
|
|
66
|
-
if (isRecord(mod.default))
|
|
67
|
-
return mod.default;
|
|
68
|
-
throw new Error("Island registry module must export `islandRegistry` or a default registry object.");
|
|
69
|
-
};
|
|
70
|
-
var hasSvelteImport = (source) => /from\s+['"][^'"]+\.svelte['"]/.test(source);
|
|
71
|
-
var normalizeImportPath = (wrapperPath, targetPath) => {
|
|
72
|
-
const importPath = relative(dirname2(wrapperPath), targetPath).replace(/\\/g, "/");
|
|
73
|
-
return importPath.startsWith(".") ? importPath : `./${importPath}`;
|
|
74
|
-
};
|
|
75
|
-
var isIdentifier = (value) => /^[A-Za-z_$][A-Za-z0-9_$]*$/.test(value);
|
|
76
|
-
var resolveIslandSourcePath = (registryPath, sourcePath) => {
|
|
77
|
-
if (sourcePath.startsWith("file://")) {
|
|
78
|
-
return new URL(sourcePath).pathname;
|
|
79
|
-
}
|
|
80
|
-
return resolve(dirname2(registryPath), sourcePath);
|
|
81
|
-
};
|
|
82
|
-
var getObjectPropertyName = (name) => {
|
|
83
|
-
if (ts.isIdentifier(name) || ts.isStringLiteral(name)) {
|
|
84
|
-
return name.text;
|
|
85
|
-
}
|
|
86
|
-
return null;
|
|
87
|
-
};
|
|
88
|
-
var collectDefaultImport = (imports, importClause, source) => {
|
|
89
|
-
if (!importClause.name)
|
|
90
|
-
return;
|
|
91
|
-
imports.set(importClause.name.text, {
|
|
92
|
-
export: "default",
|
|
93
|
-
source
|
|
94
|
-
});
|
|
95
|
-
};
|
|
96
|
-
var collectNamedImports = (imports, importClause, source) => {
|
|
97
|
-
const bindings = importClause.namedBindings;
|
|
98
|
-
if (!bindings || !ts.isNamedImports(bindings))
|
|
99
|
-
return;
|
|
100
|
-
for (const element of bindings.elements) {
|
|
101
|
-
imports.set(element.name.text, {
|
|
102
|
-
export: element.propertyName?.text ?? element.name.text,
|
|
103
|
-
source
|
|
104
|
-
});
|
|
105
|
-
}
|
|
106
|
-
};
|
|
107
|
-
var isIslandRegistryHelperImport = (source) => source === "@absolutejs/absolute/islands" || source.endsWith("/islands") || source.endsWith("/core/islands");
|
|
108
|
-
var collectRegistryHelperImports = (importClause, source, registryFactoryNames, registryNamespaceNames) => {
|
|
109
|
-
if (!isIslandRegistryHelperImport(source))
|
|
110
|
-
return;
|
|
111
|
-
const bindings = importClause.namedBindings;
|
|
112
|
-
if (!bindings)
|
|
113
|
-
return;
|
|
114
|
-
if (ts.isNamespaceImport(bindings)) {
|
|
115
|
-
registryNamespaceNames.add(bindings.name.text);
|
|
116
|
-
return;
|
|
117
|
-
}
|
|
118
|
-
for (const element of bindings.elements) {
|
|
119
|
-
const importedName = element.propertyName?.text ?? element.name.text;
|
|
120
|
-
if (importedName === "defineIslandRegistry") {
|
|
121
|
-
registryFactoryNames.add(element.name.text);
|
|
122
|
-
}
|
|
123
|
-
}
|
|
124
|
-
};
|
|
125
|
-
var createRegistryEntryValue = (reference) => ({
|
|
126
|
-
component: reference.source,
|
|
127
|
-
export: reference.export,
|
|
128
|
-
source: reference.source
|
|
129
|
-
});
|
|
130
|
-
var addRegistryEntries = (frameworkNode, framework, imports, definitions, registry) => {
|
|
131
|
-
const frameworkRegistry = registry[framework] ?? {};
|
|
132
|
-
registry[framework] = frameworkRegistry;
|
|
133
|
-
for (const property of frameworkNode.properties) {
|
|
134
|
-
if (!ts.isPropertyAssignment(property) && !ts.isShorthandPropertyAssignment(property))
|
|
135
|
-
continue;
|
|
136
|
-
const componentName = getObjectPropertyName(property.name);
|
|
137
|
-
if (!componentName)
|
|
138
|
-
continue;
|
|
139
|
-
const initializer = ts.isPropertyAssignment(property) ? property.initializer : property.name;
|
|
140
|
-
if (!ts.isIdentifier(initializer))
|
|
141
|
-
continue;
|
|
142
|
-
const reference = imports.get(initializer.text);
|
|
143
|
-
if (!reference)
|
|
144
|
-
continue;
|
|
145
|
-
frameworkRegistry[componentName] = createRegistryEntryValue(reference);
|
|
146
|
-
definitions.push({
|
|
147
|
-
buildReference: reference,
|
|
148
|
-
component: componentName,
|
|
149
|
-
framework
|
|
150
|
-
});
|
|
151
|
-
}
|
|
152
|
-
};
|
|
153
|
-
var processDefineIslandRegistry = (node, imports, definitions, registry) => {
|
|
154
|
-
const [firstArg] = node.arguments;
|
|
155
|
-
if (!firstArg || !ts.isObjectLiteralExpression(firstArg))
|
|
156
|
-
return;
|
|
157
|
-
const validFrameworks = [
|
|
158
|
-
"react",
|
|
159
|
-
"svelte",
|
|
160
|
-
"vue",
|
|
161
|
-
"angular"
|
|
162
|
-
];
|
|
163
|
-
for (const property of firstArg.properties) {
|
|
164
|
-
if (!ts.isPropertyAssignment(property))
|
|
165
|
-
continue;
|
|
166
|
-
const frameworkName = getObjectPropertyName(property.name);
|
|
167
|
-
if (!frameworkName)
|
|
168
|
-
continue;
|
|
169
|
-
const framework = validFrameworks.find((f) => f === frameworkName);
|
|
170
|
-
if (!framework)
|
|
171
|
-
continue;
|
|
172
|
-
if (!ts.isObjectLiteralExpression(property.initializer))
|
|
173
|
-
continue;
|
|
174
|
-
addRegistryEntries(property.initializer, framework, imports, definitions, registry);
|
|
175
|
-
}
|
|
176
|
-
};
|
|
177
|
-
var walkRegistryNode = (node, imports, registryFactoryNames, registryNamespaceNames, definitions, registry) => {
|
|
178
|
-
if (ts.isCallExpression(node) && isDefineIslandRegistryCall(node.expression, registryFactoryNames, registryNamespaceNames)) {
|
|
179
|
-
processDefineIslandRegistry(node, imports, definitions, registry);
|
|
180
|
-
}
|
|
181
|
-
ts.forEachChild(node, (child) => walkRegistryNode(child, imports, registryFactoryNames, registryNamespaceNames, definitions, registry));
|
|
182
|
-
};
|
|
183
|
-
var isDefineIslandRegistryCall = (expression, registryFactoryNames, registryNamespaceNames) => {
|
|
184
|
-
if (ts.isIdentifier(expression)) {
|
|
185
|
-
return registryFactoryNames.has(expression.text);
|
|
186
|
-
}
|
|
187
|
-
return ts.isPropertyAccessExpression(expression) && expression.name.text === "defineIslandRegistry" && ts.isIdentifier(expression.expression) && registryNamespaceNames.has(expression.expression.text);
|
|
188
|
-
};
|
|
189
|
-
var hasIslandRegistryNamedExport = (sourceFile) => {
|
|
190
|
-
for (const statement of sourceFile.statements) {
|
|
191
|
-
if (ts.isVariableStatement(statement) && statement.modifiers?.some((modifier) => modifier.kind === ts.SyntaxKind.ExportKeyword) && statement.declarationList.declarations.some((declaration) => ts.isIdentifier(declaration.name) && declaration.name.text === "islandRegistry")) {
|
|
192
|
-
return true;
|
|
193
|
-
}
|
|
194
|
-
if (!ts.isExportDeclaration(statement) || !statement.exportClause)
|
|
195
|
-
continue;
|
|
196
|
-
if (!ts.isNamedExports(statement.exportClause))
|
|
197
|
-
continue;
|
|
198
|
-
if (statement.exportClause.elements.some((element) => element.name.text === "islandRegistry")) {
|
|
199
|
-
return true;
|
|
200
|
-
}
|
|
201
|
-
}
|
|
202
|
-
return false;
|
|
203
|
-
};
|
|
204
|
-
var collectImportDeclarations = (sourceFile, registryPath, imports, registryFactoryNames, registryNamespaceNames) => {
|
|
205
|
-
for (const statement of sourceFile.statements) {
|
|
206
|
-
if (!ts.isImportDeclaration(statement) || !ts.isStringLiteral(statement.moduleSpecifier))
|
|
207
|
-
continue;
|
|
208
|
-
const { importClause } = statement;
|
|
209
|
-
if (!importClause)
|
|
210
|
-
continue;
|
|
211
|
-
const source = resolveIslandSourcePath(registryPath, statement.moduleSpecifier.text);
|
|
212
|
-
collectDefaultImport(imports, importClause, source);
|
|
213
|
-
collectNamedImports(imports, importClause, source);
|
|
214
|
-
collectRegistryHelperImports(importClause, statement.moduleSpecifier.text, registryFactoryNames, registryNamespaceNames);
|
|
215
|
-
}
|
|
216
|
-
};
|
|
217
|
-
var parseIslandRegistryBuildInfo = (registrySource, registryPath) => {
|
|
218
|
-
const sourceFile = ts.createSourceFile(registryPath, registrySource, ts.ScriptTarget.Latest, true, ts.ScriptKind.TS);
|
|
219
|
-
const imports = new Map;
|
|
220
|
-
const registryFactoryNames = new Set(["defineIslandRegistry"]);
|
|
221
|
-
const registryNamespaceNames = new Set;
|
|
222
|
-
const definitions = [];
|
|
223
|
-
const registry = {};
|
|
224
|
-
collectImportDeclarations(sourceFile, registryPath, imports, registryFactoryNames, registryNamespaceNames);
|
|
225
|
-
walkRegistryNode(sourceFile, imports, registryFactoryNames, registryNamespaceNames, definitions, registry);
|
|
226
|
-
return {
|
|
227
|
-
definitions,
|
|
228
|
-
hasNamedExport: hasIslandRegistryNamedExport(sourceFile),
|
|
229
|
-
registry
|
|
230
|
-
};
|
|
231
|
-
};
|
|
232
|
-
var loadDynamicIslandRegistryBuildInfo = async (resolvedRegistryPath) => {
|
|
233
|
-
const registryModule = await import(resolvedRegistryPath);
|
|
234
|
-
const registry = resolveRegistryExport(registryModule);
|
|
235
|
-
const definitions = frameworks.flatMap((framework) => {
|
|
236
|
-
const frameworkRegistry = registry[framework];
|
|
237
|
-
if (!isRecord(frameworkRegistry))
|
|
238
|
-
return [];
|
|
239
|
-
return Object.entries(frameworkRegistry).map(([component, value]) => ({
|
|
240
|
-
buildReference: getIslandBuildReference(value),
|
|
241
|
-
component,
|
|
242
|
-
framework
|
|
243
|
-
}));
|
|
244
|
-
});
|
|
245
|
-
return {
|
|
246
|
-
definitions,
|
|
247
|
-
hasNamedExport: isRecord(registryModule.islandRegistry),
|
|
248
|
-
registry
|
|
249
|
-
};
|
|
250
|
-
};
|
|
251
|
-
var createRegistryImportCode = (wrapperPath, registryPath, hasNamedExport) => {
|
|
252
|
-
const normalizedPath = normalizeImportPath(wrapperPath, registryPath);
|
|
253
|
-
if (hasNamedExport) {
|
|
254
|
-
return {
|
|
255
|
-
importStatement: `import { islandRegistry as __absoluteIslandRegistry } from ${JSON.stringify(normalizedPath)};`,
|
|
256
|
-
registryReference: "__absoluteIslandRegistry"
|
|
257
|
-
};
|
|
258
|
-
}
|
|
259
|
-
return {
|
|
260
|
-
importStatement: `import __absoluteIslandRegistry from ${JSON.stringify(normalizedPath)};`,
|
|
261
|
-
registryReference: "__absoluteIslandRegistry"
|
|
262
|
-
};
|
|
263
|
-
};
|
|
264
|
-
var createDirectEntrySource = (wrapperPath, importPath, exportName) => {
|
|
265
|
-
const normalizedImportPath = normalizeImportPath(wrapperPath, importPath);
|
|
266
|
-
if (!exportName || exportName === "default") {
|
|
267
|
-
return `export { default } from ${JSON.stringify(normalizedImportPath)};
|
|
268
|
-
`;
|
|
269
|
-
}
|
|
270
|
-
return `export { ${exportName} as default } from ${JSON.stringify(normalizedImportPath)};
|
|
271
|
-
`;
|
|
272
|
-
};
|
|
273
|
-
var createRegistryEntrySource = (wrapperPath, registryPath, hasNamedExport, framework, component) => {
|
|
274
|
-
const { importStatement, registryReference } = createRegistryImportCode(wrapperPath, registryPath, hasNamedExport);
|
|
275
|
-
const frameworkAccess = isIdentifier(framework) ? `${registryReference}.${framework}` : `${registryReference}[${JSON.stringify(framework)}]`;
|
|
276
|
-
const componentAccess = isIdentifier(component) ? `${frameworkAccess}.${component}` : `${frameworkAccess}[${JSON.stringify(component)}]`;
|
|
277
|
-
return `${importStatement}
|
|
278
|
-
|
|
279
|
-
const component = ${componentAccess};
|
|
280
|
-
|
|
281
|
-
export default component;
|
|
282
|
-
`;
|
|
283
|
-
};
|
|
284
|
-
var shouldUseCompiledClientPath = (framework, sourcePath) => {
|
|
285
|
-
if (framework === "svelte") {
|
|
286
|
-
return /\.svelte(?:\.(?:ts|js))?$/.test(sourcePath);
|
|
287
|
-
}
|
|
288
|
-
if (framework === "vue") {
|
|
289
|
-
return extname(sourcePath) === ".vue";
|
|
290
|
-
}
|
|
291
|
-
if (framework === "angular") {
|
|
292
|
-
return /\.(?:ts|js|tsx|jsx|mjs|cjs)$/.test(sourcePath);
|
|
293
|
-
}
|
|
294
|
-
return false;
|
|
295
|
-
};
|
|
296
|
-
var collectIslandFrameworkSources = (buildInfo) => {
|
|
297
|
-
const sources = {};
|
|
298
|
-
for (const definition of buildInfo.definitions) {
|
|
299
|
-
const { buildReference } = definition;
|
|
300
|
-
if (!buildReference)
|
|
301
|
-
continue;
|
|
302
|
-
const resolvedSourcePath = resolveIslandSourcePath(buildInfo.resolvedRegistryPath, buildReference.source);
|
|
303
|
-
if (!shouldUseCompiledClientPath(definition.framework, resolvedSourcePath))
|
|
304
|
-
continue;
|
|
305
|
-
const frameworkSources = sources[definition.framework] ?? [];
|
|
306
|
-
if (frameworkSources.includes(resolvedSourcePath))
|
|
307
|
-
continue;
|
|
308
|
-
frameworkSources.push(resolvedSourcePath);
|
|
309
|
-
sources[definition.framework] = frameworkSources;
|
|
310
|
-
}
|
|
311
|
-
return sources;
|
|
312
|
-
};
|
|
313
|
-
var generateIslandEntryPoints = async ({
|
|
314
|
-
buildInfo,
|
|
315
|
-
buildPath,
|
|
316
|
-
clientPathMaps = {}
|
|
317
|
-
}) => {
|
|
318
|
-
const generatedRoot = join2(buildPath, "_island_entries");
|
|
319
|
-
rmSync(generatedRoot, { force: true, recursive: true });
|
|
320
|
-
const entries = [];
|
|
321
|
-
for (const definition of buildInfo.definitions) {
|
|
322
|
-
const entryPath = join2(generatedRoot, "islands", definition.framework, `${definition.component}.ts`);
|
|
323
|
-
const { buildReference } = definition;
|
|
324
|
-
const source = buildReference ? resolveIslandSourcePath(buildInfo.resolvedRegistryPath, buildReference.source) : null;
|
|
325
|
-
const compiledSourcePath = source && shouldUseCompiledClientPath(definition.framework, source) ? clientPathMaps[definition.framework]?.get(source) : undefined;
|
|
326
|
-
const entrySource = source && (compiledSourcePath || !shouldUseCompiledClientPath(definition.framework, source)) ? createDirectEntrySource(entryPath, compiledSourcePath ?? source, compiledSourcePath ? undefined : buildReference?.export) : createRegistryEntrySource(entryPath, buildInfo.resolvedRegistryPath, buildInfo.hasNamedExport, definition.framework, definition.component);
|
|
327
|
-
mkdirSync(dirname2(entryPath), { recursive: true });
|
|
328
|
-
writeFileSync(entryPath, entrySource);
|
|
329
|
-
entries.push({
|
|
330
|
-
component: definition.component,
|
|
331
|
-
entryPath,
|
|
332
|
-
framework: definition.framework
|
|
333
|
-
});
|
|
334
|
-
}
|
|
335
|
-
return {
|
|
336
|
-
entries,
|
|
337
|
-
generatedRoot
|
|
338
|
-
};
|
|
339
|
-
};
|
|
340
|
-
var loadIslandRegistryBuildInfo = async (registryPath) => {
|
|
341
|
-
const resolvedRegistryPath = resolve(registryPath);
|
|
342
|
-
const registrySource = Bun.file(resolvedRegistryPath);
|
|
343
|
-
const registrySourceText = await registrySource.text();
|
|
344
|
-
const parsedInfo = parseIslandRegistryBuildInfo(registrySourceText, resolvedRegistryPath);
|
|
345
|
-
if (parsedInfo.definitions.length > 0) {
|
|
346
|
-
return {
|
|
347
|
-
definitions: parsedInfo.definitions,
|
|
348
|
-
hasNamedExport: parsedInfo.hasNamedExport,
|
|
349
|
-
registry: parsedInfo.registry,
|
|
350
|
-
resolvedRegistryPath
|
|
351
|
-
};
|
|
352
|
-
}
|
|
353
|
-
if (hasSvelteImport(registrySourceText)) {
|
|
354
|
-
throw new Error("Unable to statically analyze the island registry. Registries that import .svelte files must use defineIslandRegistry({ ... }) with direct imported component references.");
|
|
355
|
-
}
|
|
356
|
-
const dynamicInfo = await loadDynamicIslandRegistryBuildInfo(resolvedRegistryPath);
|
|
357
|
-
return {
|
|
358
|
-
definitions: dynamicInfo.definitions,
|
|
359
|
-
hasNamedExport: dynamicInfo.hasNamedExport,
|
|
360
|
-
registry: dynamicInfo.registry,
|
|
361
|
-
resolvedRegistryPath
|
|
362
|
-
};
|
|
363
|
-
};
|
|
364
|
-
|
|
365
|
-
// src/core/staticStreaming.ts
|
|
366
|
-
var STATIC_SLOT_TAG_RE = /<abs-stream-slot\b([^>]*?)(?:\/>|>([\s\S]*?)<\/abs-stream-slot>)/gi;
|
|
367
|
-
var ATTRIBUTE_RE = /([A-Za-z_:][-A-Za-z0-9_:.]*)\s*=\s*(?:"([^"]*)"|'([^']*)')/g;
|
|
368
|
-
var parseAttributes = (attributeString) => {
|
|
369
|
-
const attributes = new Map;
|
|
370
|
-
const setAttributeFromMatch = (matchParts) => {
|
|
371
|
-
const [, key, doubleQuotedValue, singleQuotedValue] = matchParts;
|
|
372
|
-
if (!key) {
|
|
373
|
-
return;
|
|
374
|
-
}
|
|
375
|
-
attributes.set(key, doubleQuotedValue ?? singleQuotedValue ?? "");
|
|
376
|
-
};
|
|
377
|
-
let match = ATTRIBUTE_RE.exec(attributeString);
|
|
378
|
-
while (match) {
|
|
379
|
-
setAttributeFromMatch(match);
|
|
380
|
-
match = ATTRIBUTE_RE.exec(attributeString);
|
|
381
|
-
}
|
|
382
|
-
ATTRIBUTE_RE.lastIndex = 0;
|
|
383
|
-
return attributes;
|
|
384
|
-
};
|
|
385
|
-
var parseTimeout = (value) => {
|
|
386
|
-
if (!value)
|
|
387
|
-
return;
|
|
388
|
-
const parsed = Number(value);
|
|
389
|
-
if (!Number.isFinite(parsed) || parsed < 0) {
|
|
390
|
-
throw new Error(`Invalid <abs-stream-slot timeout-ms="${value}">. Expected a non-negative number.`);
|
|
391
|
-
}
|
|
392
|
-
return parsed;
|
|
393
|
-
};
|
|
394
|
-
var parseStaticStreamingTag = (attributeString, innerHtml) => {
|
|
395
|
-
const attributes = parseAttributes(attributeString);
|
|
396
|
-
const resolver = attributes.get("resolver");
|
|
397
|
-
if (!resolver) {
|
|
398
|
-
throw new Error('Static <abs-stream-slot> requires a "resolver" attribute.');
|
|
399
|
-
}
|
|
400
|
-
const id = attributes.get("id") ?? resolver;
|
|
401
|
-
return {
|
|
402
|
-
errorHtml: attributes.get("error-html") ?? undefined,
|
|
403
|
-
fallbackHtml: innerHtml?.trim() ?? attributes.get("fallback-html") ?? "",
|
|
404
|
-
id,
|
|
405
|
-
resolver,
|
|
406
|
-
timeoutMs: parseTimeout(attributes.get("timeout-ms") ?? undefined)
|
|
407
|
-
};
|
|
408
|
-
};
|
|
409
|
-
var extractStaticStreamingTags = (html) => {
|
|
410
|
-
const tagRe = new RegExp(STATIC_SLOT_TAG_RE);
|
|
411
|
-
const tags = [];
|
|
412
|
-
let match = tagRe.exec(html);
|
|
413
|
-
while (match) {
|
|
414
|
-
const [, rawAttributeString, innerHtml] = match;
|
|
415
|
-
tags.push(parseStaticStreamingTag(rawAttributeString ?? "", innerHtml));
|
|
416
|
-
match = tagRe.exec(html);
|
|
417
|
-
}
|
|
418
|
-
return tags;
|
|
419
|
-
};
|
|
420
|
-
|
|
421
|
-
// src/build/staticIslandPages.ts
|
|
422
|
-
import { readFileSync, writeFileSync as writeFileSync2 } from "fs";
|
|
423
|
-
var ISLAND_TAG_RE_SOURCE = "<(?:absolute-island|island)\\b([^>]*?)(?:\\/\\>|>(?:[\\s\\S]*?)<\\/(?:absolute-island|island)>)";
|
|
424
|
-
var ATTRIBUTE_RE_SOURCE = `([A-Za-z_:][-A-Za-z0-9_:.]*)\\s*=\\s*(?:"([^"]*)"|'([^']*)')`;
|
|
425
|
-
var islandFrameworks = [
|
|
426
|
-
"react",
|
|
427
|
-
"svelte",
|
|
428
|
-
"vue",
|
|
429
|
-
"angular"
|
|
430
|
-
];
|
|
431
|
-
var islandHydrationModes = ["load", "idle", "visible", "none"];
|
|
432
|
-
var isRecord2 = (value) => typeof value === "object" && value !== null;
|
|
433
|
-
var isIslandFramework = (value) => islandFrameworks.some((framework) => framework === value);
|
|
434
|
-
var isIslandHydrationMode = (value) => islandHydrationModes.some((mode) => mode === value);
|
|
435
|
-
var parseHtmlAttributes = (attributeString) => {
|
|
436
|
-
const attributeRe = new RegExp(ATTRIBUTE_RE_SOURCE, "g");
|
|
437
|
-
const attributes = new Map;
|
|
438
|
-
let match = attributeRe.exec(attributeString);
|
|
439
|
-
while (match) {
|
|
440
|
-
const [, key, doubleQuotedValue, singleQuotedValue] = match;
|
|
441
|
-
match = attributeRe.exec(attributeString);
|
|
442
|
-
if (!key)
|
|
443
|
-
continue;
|
|
444
|
-
const value = doubleQuotedValue ?? singleQuotedValue ?? "";
|
|
445
|
-
attributes.set(key, value);
|
|
446
|
-
}
|
|
447
|
-
return attributes;
|
|
448
|
-
};
|
|
449
|
-
var parseIslandTag = (attributeString) => {
|
|
450
|
-
const attributes = parseHtmlAttributes(attributeString);
|
|
451
|
-
const framework = attributes.get("framework");
|
|
452
|
-
const component = attributes.get("component");
|
|
453
|
-
const hydrate = attributes.get("hydrate") ?? "load";
|
|
454
|
-
const propsSource = attributes.get("props") ?? "{}";
|
|
455
|
-
if (!framework || !component) {
|
|
456
|
-
return null;
|
|
457
|
-
}
|
|
458
|
-
if (!isIslandFramework(framework)) {
|
|
459
|
-
throw new Error(`Unsupported static island framework "${framework}".`);
|
|
460
|
-
}
|
|
461
|
-
if (!isIslandHydrationMode(hydrate)) {
|
|
462
|
-
throw new Error(`Unsupported static island hydrate mode "${hydrate}".`);
|
|
463
|
-
}
|
|
464
|
-
let parsedProps;
|
|
465
|
-
try {
|
|
466
|
-
const candidate = JSON.parse(propsSource);
|
|
467
|
-
parsedProps = isRecord2(candidate) ? candidate : {};
|
|
468
|
-
} catch (error) {
|
|
469
|
-
throw new Error(`Failed to parse static island props JSON for ${framework}:${component}: ${error instanceof Error ? error.message : String(error)}`, { cause: error });
|
|
470
|
-
}
|
|
471
|
-
return {
|
|
472
|
-
component,
|
|
473
|
-
framework,
|
|
474
|
-
hydrate,
|
|
475
|
-
props: parsedProps
|
|
476
|
-
};
|
|
477
|
-
};
|
|
478
|
-
var transformStaticPageHtml = async (originalHtml, registry) => {
|
|
479
|
-
const islandTagRe = new RegExp(ISLAND_TAG_RE_SOURCE, "gi");
|
|
480
|
-
if (!islandTagRe.test(originalHtml)) {
|
|
481
|
-
return originalHtml;
|
|
482
|
-
}
|
|
483
|
-
islandTagRe.lastIndex = 0;
|
|
484
|
-
const segments = [];
|
|
485
|
-
let lastIndex = 0;
|
|
486
|
-
let match = islandTagRe.exec(originalHtml);
|
|
487
|
-
while (match) {
|
|
488
|
-
const [fullMatch, rawAttributeString] = match;
|
|
489
|
-
const attributeString = rawAttributeString ?? "";
|
|
490
|
-
segments.push({
|
|
491
|
-
before: originalHtml.slice(lastIndex, match.index),
|
|
492
|
-
fullMatch,
|
|
493
|
-
props: parseIslandTag(attributeString)
|
|
494
|
-
});
|
|
495
|
-
lastIndex = match.index + fullMatch.length;
|
|
496
|
-
match = islandTagRe.exec(originalHtml);
|
|
497
|
-
}
|
|
498
|
-
const renderedSegments = await Promise.all(segments.map(async (segment) => segment.before + (segment.props ? await renderIslandMarkup(registry, segment.props) : segment.fullMatch)));
|
|
499
|
-
return renderedSegments.join("") + originalHtml.slice(lastIndex);
|
|
500
|
-
};
|
|
501
|
-
var HTMX_STREAM_SLOT_TAG_RE = /<abs-htmx-stream-slot\b([^>]*?)(?:\/>|>([\s\S]*?)<\/abs-htmx-stream-slot>)/gi;
|
|
502
|
-
var requireAttribute = (attributes, name) => {
|
|
503
|
-
const value = attributes.get(name)?.trim();
|
|
504
|
-
if (!value) {
|
|
505
|
-
throw new Error(`Static <abs-htmx-stream-slot> requires a "${name}" attribute.`);
|
|
506
|
-
}
|
|
507
|
-
return value;
|
|
508
|
-
};
|
|
509
|
-
var injectAttributesIntoSingleRootElement = (fallbackHtml, attributes) => {
|
|
510
|
-
const trimmed = fallbackHtml.trim();
|
|
511
|
-
if (!trimmed) {
|
|
512
|
-
throw new Error("Static <abs-htmx-stream-slot> requires fallback HTML inside the element body.");
|
|
513
|
-
}
|
|
514
|
-
const openingTagMatch = trimmed.match(/^<([A-Za-z][\w:-]*)([^>]*)>/);
|
|
515
|
-
if (!openingTagMatch) {
|
|
516
|
-
throw new Error("Static <abs-htmx-stream-slot> fallback must start with a single root HTML element.");
|
|
517
|
-
}
|
|
518
|
-
const attributeSource = [...attributes.entries()].map(([key, value]) => `${key}="${value}"`).join(" ");
|
|
519
|
-
if (!attributeSource) {
|
|
520
|
-
return trimmed;
|
|
521
|
-
}
|
|
522
|
-
const [openingTag, tagName, rawExistingAttributes = ""] = openingTagMatch;
|
|
523
|
-
const existingAttributes = rawExistingAttributes.trim();
|
|
524
|
-
const mergedAttributes = existingAttributes ? `${existingAttributes} ${attributeSource}` : attributeSource;
|
|
525
|
-
return trimmed.replace(openingTag, `<${tagName} ${mergedAttributes}>`);
|
|
526
|
-
};
|
|
527
|
-
var transformStaticHTMXStreamSlotHtml = (originalHtml) => {
|
|
528
|
-
let nextIndex = 0;
|
|
529
|
-
let result = "";
|
|
530
|
-
let match = HTMX_STREAM_SLOT_TAG_RE.exec(originalHtml);
|
|
531
|
-
while (match) {
|
|
532
|
-
const [fullMatch, rawAttributeString = "", innerHtml = ""] = match;
|
|
533
|
-
const attributes = parseHtmlAttributes(rawAttributeString);
|
|
534
|
-
const loweredAttributes = new Map([
|
|
535
|
-
["hx-get", requireAttribute(attributes, "src")],
|
|
536
|
-
["hx-trigger", attributes.get("trigger") ?? "load"],
|
|
537
|
-
["hx-swap", attributes.get("swap") ?? "outerHTML"],
|
|
538
|
-
["hx-target", attributes.get("target") ?? "this"]
|
|
539
|
-
]);
|
|
540
|
-
result += originalHtml.slice(nextIndex, match.index);
|
|
541
|
-
result += injectAttributesIntoSingleRootElement(innerHtml, loweredAttributes);
|
|
542
|
-
nextIndex = match.index + fullMatch.length;
|
|
543
|
-
match = HTMX_STREAM_SLOT_TAG_RE.exec(originalHtml);
|
|
544
|
-
}
|
|
545
|
-
return result + originalHtml.slice(nextIndex);
|
|
546
|
-
};
|
|
547
|
-
var transformStaticStreamingSlotHtml = (originalHtml) => {
|
|
548
|
-
const slotDefinitions = extractStaticStreamingTags(originalHtml);
|
|
549
|
-
if (slotDefinitions.length === 0) {
|
|
550
|
-
return originalHtml;
|
|
551
|
-
}
|
|
552
|
-
const tagRe = /<abs-stream-slot\b([^>]*?)(?:\/>|>([\s\S]*?)<\/abs-stream-slot>)/gi;
|
|
553
|
-
let nextIndex = 0;
|
|
554
|
-
let slotIndex = 0;
|
|
555
|
-
let result = "";
|
|
556
|
-
let match = tagRe.exec(originalHtml);
|
|
557
|
-
while (match) {
|
|
558
|
-
const [fullMatch] = match;
|
|
559
|
-
const tag = slotDefinitions[slotIndex++];
|
|
560
|
-
if (!tag) {
|
|
561
|
-
throw new Error("Static streaming slot transform lost sync with parsed slot definitions.");
|
|
562
|
-
}
|
|
563
|
-
result += originalHtml.slice(nextIndex, match.index);
|
|
564
|
-
result += renderStreamingSlotPlaceholder(tag.id, tag.fallbackHtml);
|
|
565
|
-
nextIndex = match.index + fullMatch.length;
|
|
566
|
-
match = tagRe.exec(originalHtml);
|
|
567
|
-
}
|
|
568
|
-
return result + originalHtml.slice(nextIndex);
|
|
569
|
-
};
|
|
570
|
-
var transformStaticPage = async (pagePath, registry) => {
|
|
571
|
-
const originalHtml = readFileSync(pagePath, "utf-8");
|
|
572
|
-
const transformedHtml = await transformStaticPageHtml(originalHtml, registry);
|
|
573
|
-
if (transformedHtml !== originalHtml) {
|
|
574
|
-
writeFileSync2(pagePath, transformedHtml);
|
|
575
|
-
}
|
|
576
|
-
};
|
|
577
|
-
var transformCurrentStaticPageHtml = async (html, options = {}) => {
|
|
578
|
-
const transformedHTMXStreamingHtml = options.enableHTMXStreaming === false ? html : transformStaticHTMXStreamSlotHtml(html);
|
|
579
|
-
const transformedStreamingHtml = options.enableStaticStreaming === false ? transformedHTMXStreamingHtml : transformStaticStreamingSlotHtml(transformedHTMXStreamingHtml);
|
|
580
|
-
const islandTagRe = new RegExp(ISLAND_TAG_RE_SOURCE, "i");
|
|
581
|
-
if (!islandTagRe.test(transformedStreamingHtml)) {
|
|
582
|
-
return transformedStreamingHtml;
|
|
583
|
-
}
|
|
584
|
-
return transformStaticPageHtml(transformedStreamingHtml, requireCurrentIslandRegistry());
|
|
585
|
-
};
|
|
586
|
-
var transformStaticPagesWithIslands = async (registryPath, pagePaths) => {
|
|
587
|
-
if (!registryPath || pagePaths.length === 0) {
|
|
588
|
-
return;
|
|
589
|
-
}
|
|
590
|
-
const { registry } = await loadIslandRegistryBuildInfo(registryPath);
|
|
591
|
-
await Promise.all(pagePaths.map((pagePath) => transformStaticPage(pagePath, registry)));
|
|
592
|
-
};
|
|
593
|
-
|
|
594
|
-
// src/islands/pageMetadata.ts
|
|
595
|
-
import { readFileSync as readFileSync2 } from "fs";
|
|
596
|
-
import { dirname as dirname3, resolve as resolve2 } from "path";
|
|
597
|
-
var pagePatterns = {
|
|
598
|
-
angular: "pages/**/*.{ts,js}",
|
|
599
|
-
html: "pages/**/*.html",
|
|
600
|
-
htmx: "pages/**/*.html",
|
|
601
|
-
react: "pages/**/*.{ts,tsx,js,jsx}",
|
|
602
|
-
svelte: "pages/**/*.svelte",
|
|
603
|
-
vue: "pages/**/*.vue"
|
|
604
|
-
};
|
|
605
|
-
var getPageDirs = (config) => [
|
|
606
|
-
{ dir: config.angularDirectory, framework: "angular" },
|
|
607
|
-
{ dir: config.reactDirectory, framework: "react" },
|
|
608
|
-
{ dir: config.svelteDirectory, framework: "svelte" },
|
|
609
|
-
{ dir: config.vueDirectory, framework: "vue" },
|
|
610
|
-
{ dir: config.htmlDirectory, framework: "html" },
|
|
611
|
-
{ dir: config.htmxDirectory, framework: "htmx" }
|
|
612
|
-
].filter((entry) => typeof entry.dir === "string" && entry.dir.length > 0);
|
|
613
|
-
var buildIslandSourceLookup = async (config) => {
|
|
614
|
-
const registryPath = config.islands?.registry;
|
|
615
|
-
if (!registryPath) {
|
|
616
|
-
return new Map;
|
|
617
|
-
}
|
|
618
|
-
const buildInfo = await loadIslandRegistryBuildInfo(registryPath);
|
|
619
|
-
const lookup = new Map;
|
|
620
|
-
for (const definition of buildInfo.definitions) {
|
|
621
|
-
const source = definition.buildReference?.source;
|
|
622
|
-
if (!source)
|
|
623
|
-
continue;
|
|
624
|
-
const resolvedSource = source.startsWith("file://") ? new URL(source).pathname : resolve2(dirname3(buildInfo.resolvedRegistryPath), source);
|
|
625
|
-
lookup.set(`${definition.framework}:${definition.component}`, resolve2(resolvedSource));
|
|
626
|
-
}
|
|
627
|
-
return lookup;
|
|
628
|
-
};
|
|
629
|
-
var getCurrentPageIslandMetadata = () => globalThis.__absolutePageIslandMetadata ?? new Map;
|
|
630
|
-
var metadataUsesSource = (metadata, target) => metadata.islands.some((usage) => {
|
|
631
|
-
const candidate = usage.source;
|
|
632
|
-
return candidate ? resolve2(candidate) === target : false;
|
|
633
|
-
});
|
|
634
|
-
var getPagesUsingIslandSource = (sourcePath) => {
|
|
635
|
-
const target = resolve2(sourcePath);
|
|
636
|
-
return [...getCurrentPageIslandMetadata().values()].filter((metadata) => metadataUsesSource(metadata, target)).map((metadata) => metadata.pagePath);
|
|
637
|
-
};
|
|
638
|
-
var resolveIslandUsages = (islands, islandSourceLookup) => islands.map((usage) => {
|
|
639
|
-
const sourcePath = islandSourceLookup.get(`${usage.framework}:${usage.component}`);
|
|
640
|
-
return sourcePath ? {
|
|
641
|
-
...usage,
|
|
642
|
-
source: sourcePath
|
|
643
|
-
} : usage;
|
|
644
|
-
});
|
|
645
|
-
var loadPageIslandFiles = async (entry, islandSourceLookup, pageMetadata) => {
|
|
646
|
-
const pattern = pagePatterns[entry.framework];
|
|
647
|
-
if (!pattern)
|
|
648
|
-
return;
|
|
649
|
-
const files = await scanEntryPoints(resolve2(entry.dir), pattern);
|
|
650
|
-
for (const filePath of files) {
|
|
651
|
-
const source = readFileSync2(filePath, "utf-8");
|
|
652
|
-
const islands = extractIslandUsagesFromSource(source);
|
|
653
|
-
pageMetadata.set(resolve2(filePath), {
|
|
654
|
-
islands: resolveIslandUsages(islands, islandSourceLookup),
|
|
655
|
-
pagePath: resolve2(filePath)
|
|
656
|
-
});
|
|
657
|
-
}
|
|
658
|
-
};
|
|
659
|
-
var loadPageIslandMetadata = async (config) => {
|
|
660
|
-
const pageMetadata = new Map;
|
|
661
|
-
const islandSourceLookup = await buildIslandSourceLookup(config);
|
|
662
|
-
await Promise.all(getPageDirs(config).map((entry) => loadPageIslandFiles(entry, islandSourceLookup, pageMetadata)));
|
|
663
|
-
return pageMetadata;
|
|
664
|
-
};
|
|
665
|
-
var setCurrentPageIslandMetadata = (metadata) => {
|
|
666
|
-
globalThis.__absolutePageIslandMetadata = metadata;
|
|
667
|
-
};
|
|
668
|
-
|
|
669
|
-
export { isTailwindCandidate, compileTailwind, compileTailwindConfig, collectIslandFrameworkSources, generateIslandEntryPoints, loadIslandRegistryBuildInfo, extractStaticStreamingTags, transformCurrentStaticPageHtml, transformStaticPagesWithIslands, getPagesUsingIslandSource, loadPageIslandMetadata, setCurrentPageIslandMetadata, logStartupTimingBlock };
|
|
670
|
-
|
|
671
|
-
//# debugId=EA2793B90D7FF16C64756E2164756E21
|
|
672
|
-
//# sourceMappingURL=chunk-bgb8k1qs.js.map
|