@withl5e/l5e 1.1.0-alpha.0 → 1.1.0-alpha.1
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/index.js +2 -2
- package/dist/island/compact-runtime.js +81 -0
- package/dist/island/compact-runtime.js.map +1 -0
- package/dist/island/runtime.js +7 -3
- package/dist/island/runtime.js.map +1 -1
- package/dist/{server-CvsOU9cg.js → server-BOdEiJoN.js} +212 -122
- package/dist/server-BOdEiJoN.js.map +1 -0
- package/dist/server.js +1 -1
- package/dist/{vite-plugin-D9qTnleZ.js → vite-plugin-R3LFxv9a.js} +148 -120
- package/dist/vite-plugin-R3LFxv9a.js.map +1 -0
- package/dist/vite-plugin.js +1 -1
- package/package.json +7 -1
- package/src/core/bundler.ts +76 -6
- package/src/core/chunking.ts +61 -4
- package/src/core/script-bundle-policy.ts +57 -2
- package/src/core/server.ts +90 -9
- package/src/core/vite-plugin.ts +25 -5
- package/src/island/compact-runtime.ts +121 -0
- package/src/island/runtime.ts +22 -8
- package/dist/server-CvsOU9cg.js.map +0 -1
- package/dist/vite-plugin-D9qTnleZ.js.map +0 -1
|
@@ -13,12 +13,15 @@ function _(e) {
|
|
|
13
13
|
return n[0].startsWith("@") ? n.slice(0, 2).join("/") : n[0];
|
|
14
14
|
}
|
|
15
15
|
function v(e = {}) {
|
|
16
|
-
let t = e.shared || []
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
if (
|
|
21
|
-
|
|
16
|
+
let t = e.shared || [];
|
|
17
|
+
if (e.mode === "compact" && t.length > 1) throw Error("[l5e chunking] Compact mode accepts one canonical shared group.");
|
|
18
|
+
let n = /* @__PURE__ */ new Set();
|
|
19
|
+
for (let r of t) {
|
|
20
|
+
if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(r.name) || n.has(r.name)) throw Error(`[l5e chunking] Invalid or duplicate shared group: ${r.name}`);
|
|
21
|
+
if (!r.packages?.length && !r.modules?.length) throw Error(`[l5e chunking] Group ${r.name} needs packages or modules.`);
|
|
22
|
+
if (r.maxSize !== void 0 && (!Number.isFinite(r.maxSize) || r.maxSize <= 0)) throw Error(`[l5e chunking] Invalid maxSize for ${r.name}`);
|
|
23
|
+
if (e.mode === "compact" && r.maxSize !== void 0) throw Error(`[l5e chunking] Compact mode cannot use maxSize for ${r.name}; it would split the canonical shared file.`);
|
|
24
|
+
n.add(r.name);
|
|
22
25
|
}
|
|
23
26
|
let r = "", i = /* @__PURE__ */ new Map(), a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = (e) => _(e) ? `npm:${h(e).split("/node_modules/").at(-1)}` : h(c.relative(r, e));
|
|
24
27
|
return {
|
|
@@ -34,71 +37,92 @@ function v(e = {}) {
|
|
|
34
37
|
i.set(e, t);
|
|
35
38
|
}
|
|
36
39
|
},
|
|
37
|
-
analyze(
|
|
40
|
+
analyze(n) {
|
|
38
41
|
a.clear();
|
|
39
|
-
let
|
|
40
|
-
|
|
41
|
-
let
|
|
42
|
+
let r = new Map(n.map((e) => [e.id, e]));
|
|
43
|
+
if (e.mode === "compact") {
|
|
44
|
+
let e = /* @__PURE__ */ new Map();
|
|
45
|
+
for (let t of n.filter((e) => e.isEntry)) {
|
|
46
|
+
let n = (i, a) => {
|
|
47
|
+
let o = e.get(i) || /* @__PURE__ */ new Map(), s = o.get(t.id);
|
|
48
|
+
if (s === !1 || s === a) return;
|
|
49
|
+
o.set(t.id, a), e.set(i, o);
|
|
50
|
+
let c = r.get(i);
|
|
51
|
+
c && (c.importedIds.forEach((e) => n(e, a)), c.dynamicallyImportedIds.forEach((e) => n(e, !0)));
|
|
52
|
+
};
|
|
53
|
+
n(t.id, !1);
|
|
54
|
+
}
|
|
55
|
+
let t = n.find((e) => e.isEntry && h(e.id).endsWith("/src/client.global.ts"));
|
|
56
|
+
if (t) {
|
|
57
|
+
for (let [n, r] of e) if (!/\.css(?:\?|$)/.test(h(n)) && r.get(t.id) === !0 && [...r.keys()].some((e) => e !== t.id)) throw Error(`[l5e chunking] Compact mode cannot bridge a dynamic-only global overlap: ${s(n)}. Import it statically from global or place state behind an explicit shared root.`);
|
|
58
|
+
}
|
|
59
|
+
}
|
|
60
|
+
let c = n.filter((e) => e.isEntry || e.dynamicImporters.length > 0), l = /* @__PURE__ */ new Map();
|
|
61
|
+
for (let e of c) {
|
|
62
|
+
let t = /* @__PURE__ */ new Set(), n = (i) => {
|
|
42
63
|
if (t.has(i)) return;
|
|
43
64
|
t.add(i);
|
|
44
|
-
let a =
|
|
65
|
+
let a = r.get(i);
|
|
45
66
|
if (!a) return;
|
|
46
|
-
let o =
|
|
47
|
-
o.add(e.id),
|
|
67
|
+
let o = l.get(i) || /* @__PURE__ */ new Set();
|
|
68
|
+
o.add(e.id), l.set(i, o), a.importedIds.forEach(n);
|
|
48
69
|
};
|
|
49
|
-
|
|
70
|
+
n(e.id);
|
|
50
71
|
}
|
|
51
|
-
let
|
|
52
|
-
for (let
|
|
53
|
-
let
|
|
54
|
-
|
|
55
|
-
let
|
|
56
|
-
if (!
|
|
57
|
-
let t = Math.min(...
|
|
72
|
+
let u = (e) => r.get(e).isEntry ? h(e).endsWith("/src/client.global.ts") ? 0 : /\/react\//.test(h(e)) && !_(e) ? 2 : 1 : 3, d = /* @__PURE__ */ new Set();
|
|
73
|
+
for (let r of n) {
|
|
74
|
+
let n = [...l.get(r.id) || []].sort(), c = n.map(s).sort(), f = t.filter((e) => i.get(e)?.has(r.id) || e.packages?.includes(_(r.id) || "")).sort((e, t) => (t.priority || 0) - (e.priority || 0));
|
|
75
|
+
f.forEach((e) => d.add(e)), f.length > 1 && o.add(`${s(r.id)} matches ${f.map((e) => e.name).join(", ")}; using ${f[0].name}.`);
|
|
76
|
+
let p = null, m = "Private dependency stays with its entry or dynamic import.";
|
|
77
|
+
if (!r.isEntry && n.length && f.length) {
|
|
78
|
+
let t = Math.min(...n.map(u)), r = t === 3 ? `lazy-${g(JSON.stringify(c))}` : [
|
|
58
79
|
"global",
|
|
59
80
|
"page",
|
|
60
81
|
"island"
|
|
61
82
|
][t];
|
|
62
|
-
|
|
63
|
-
} else !
|
|
64
|
-
a.set(
|
|
65
|
-
group:
|
|
66
|
-
rule:
|
|
67
|
-
consumers:
|
|
68
|
-
reason:
|
|
83
|
+
p = e.mode === "compact" ? "shared" : `shared-${f[0].name}-${r}`, m = `Configured group ${f[0].name}; activation ${r}.`;
|
|
84
|
+
} else e.mode === "compact" && !r.isEntry && n.some((e) => u(e) === 0) && n.some((e) => u(e) > 0) ? (p = "global-owner", m = "Static global/page overlap is exported by the canonical global artifact.") : e.mode !== "compact" && !r.isEntry && n.length > 1 && (p = `shared-auto-${g(JSON.stringify(c))}`, m = "Shared by the same static consumers; preserves dynamic import roots.");
|
|
85
|
+
a.set(r.id, {
|
|
86
|
+
group: p,
|
|
87
|
+
rule: f[0]?.name,
|
|
88
|
+
consumers: c,
|
|
89
|
+
reason: m
|
|
69
90
|
});
|
|
70
91
|
}
|
|
71
|
-
for (let e of t)
|
|
92
|
+
for (let e of t) d.has(e) || o.add(`Group ${e.name} matched no modules in this client build.`);
|
|
72
93
|
return [...o];
|
|
73
94
|
},
|
|
74
95
|
groups() {
|
|
75
|
-
return [...t.map((
|
|
76
|
-
name: (
|
|
77
|
-
let n = a.get(
|
|
78
|
-
return n?.rule ===
|
|
96
|
+
return [...t.map((t) => ({
|
|
97
|
+
name: (e) => {
|
|
98
|
+
let n = a.get(e);
|
|
99
|
+
return n?.rule === t.name ? n.group : null;
|
|
79
100
|
},
|
|
80
|
-
maxSize:
|
|
81
|
-
includeDependenciesRecursively:
|
|
101
|
+
maxSize: t.maxSize,
|
|
102
|
+
includeDependenciesRecursively: e.mode === "compact"
|
|
82
103
|
})), {
|
|
83
104
|
name: (e) => a.get(e)?.group || null,
|
|
84
105
|
includeDependenciesRecursively: !1
|
|
85
106
|
}];
|
|
86
107
|
},
|
|
87
|
-
report(
|
|
108
|
+
report(t) {
|
|
88
109
|
return {
|
|
89
|
-
version:
|
|
110
|
+
version: 2,
|
|
111
|
+
mode: e.mode || "default",
|
|
90
112
|
warnings: [...o],
|
|
91
|
-
chunks: Object.values(
|
|
92
|
-
if (
|
|
93
|
-
let
|
|
113
|
+
chunks: Object.values(t).flatMap((t) => {
|
|
114
|
+
if (t.type !== "chunk") return [];
|
|
115
|
+
let n = t.facadeModuleId ? s(t.facadeModuleId) : null, r = n === "src/client.global.ts" ? "global" : n && /(?:^|\/)react\//.test(n) ? "island" : t.isEntry || t.isDynamicEntry ? "page" : "shared";
|
|
94
116
|
return [{
|
|
95
|
-
file:
|
|
96
|
-
kind:
|
|
97
|
-
|
|
98
|
-
|
|
99
|
-
|
|
100
|
-
|
|
101
|
-
|
|
117
|
+
file: t.fileName,
|
|
118
|
+
kind: r,
|
|
119
|
+
canonicalShared: e.mode === "compact" && t.name === "shared",
|
|
120
|
+
canonicalGlobal: e.mode === "compact" && t.name === "global-owner",
|
|
121
|
+
source: n,
|
|
122
|
+
bytes: Buffer.byteLength(t.code),
|
|
123
|
+
imports: t.imports,
|
|
124
|
+
dynamicImports: t.dynamicImports,
|
|
125
|
+
modules: Object.keys(t.modules).map((e) => ({
|
|
102
126
|
id: s(e),
|
|
103
127
|
...a.get(e)
|
|
104
128
|
}))
|
|
@@ -110,7 +134,7 @@ function v(e = {}) {
|
|
|
110
134
|
}
|
|
111
135
|
//#endregion
|
|
112
136
|
//#region src/core/vite-plugin.ts
|
|
113
|
-
var y = "virtual:l5e-views", b = "virtual:l5e-route", x = "virtual:l5e-ssr-entry", S = "virtual:l5e-global-loader", C = "virtual:l5e-island-strategies", w = "virtual:l5e-islands", T = "virtual:l5e-
|
|
137
|
+
var y = "virtual:l5e-views", b = "virtual:l5e-route", x = "virtual:l5e-ssr-entry", S = "virtual:l5e-global-loader", C = "virtual:l5e-island-strategies", w = "virtual:l5e-islands", T = "virtual:l5e-compact-renderer", E = "virtual:l5e-actions", D = "virtual:l5e-middleware", O = /* @__PURE__ */ new Set([
|
|
114
138
|
"MODE",
|
|
115
139
|
"BASE_URL",
|
|
116
140
|
"PROD",
|
|
@@ -118,30 +142,30 @@ var y = "virtual:l5e-views", b = "virtual:l5e-route", x = "virtual:l5e-ssr-entry
|
|
|
118
142
|
"SSR",
|
|
119
143
|
"LEGACY"
|
|
120
144
|
]);
|
|
121
|
-
function
|
|
145
|
+
function k(e, t = []) {
|
|
122
146
|
let n = i(e);
|
|
123
147
|
for (let r of n) {
|
|
124
148
|
let n = f(e, r);
|
|
125
149
|
if (o(n).isDirectory()) {
|
|
126
150
|
if (r === "node_modules" || r === "dist" || r === ".git") continue;
|
|
127
|
-
|
|
151
|
+
k(n, t);
|
|
128
152
|
} else (r.endsWith(".tsx") || r.endsWith(".ts")) && t.push(n);
|
|
129
153
|
}
|
|
130
154
|
return t;
|
|
131
155
|
}
|
|
132
|
-
function
|
|
156
|
+
function A(e) {
|
|
133
157
|
let t = 0;
|
|
134
158
|
for (let n = 0; n < e.length; n++) t = (t << 5) - t + e.charCodeAt(n), t &= t;
|
|
135
159
|
return Math.abs(t).toString(16).slice(0, 4);
|
|
136
160
|
}
|
|
137
|
-
function
|
|
161
|
+
function j(e) {
|
|
138
162
|
let t = e.split("/"), n = t[t.length - 1];
|
|
139
163
|
return n = n.replace(/\.(tsx?|jsx?)$/, ""), n;
|
|
140
164
|
}
|
|
141
|
-
function
|
|
142
|
-
return `${
|
|
165
|
+
function M(e) {
|
|
166
|
+
return `${j(e)}_${A(e)}`;
|
|
143
167
|
}
|
|
144
|
-
function
|
|
168
|
+
function N(e, n) {
|
|
145
169
|
let r = e.replace(/^\//, ""), i = m(n, r);
|
|
146
170
|
for (let e of [
|
|
147
171
|
".tsx",
|
|
@@ -151,7 +175,7 @@ function M(e, n) {
|
|
|
151
175
|
]) if (t(i + e)) return r + e;
|
|
152
176
|
return t(i) ? r : null;
|
|
153
177
|
}
|
|
154
|
-
function
|
|
178
|
+
function P(e, t) {
|
|
155
179
|
let n = r(e, "utf-8"), i = [], a = /<ClientIsland\s[^>]*?from\s*=\s*"([^"]+)"/g, o = /* @__PURE__ */ new Set(), s;
|
|
156
180
|
for (; (s = a.exec(n)) !== null;) {
|
|
157
181
|
let n = s[1], r;
|
|
@@ -161,14 +185,14 @@ function N(e, t) {
|
|
|
161
185
|
let i = m(e, "..", n);
|
|
162
186
|
r = "/" + p(t, i).replace(/\\/g, "/");
|
|
163
187
|
} else r = n;
|
|
164
|
-
let a =
|
|
188
|
+
let a = N(r, t);
|
|
165
189
|
if (!a) {
|
|
166
190
|
console.warn(`[l5e] Island component not found: ${r} (from ${n} in ${e})`);
|
|
167
191
|
continue;
|
|
168
192
|
}
|
|
169
|
-
let c =
|
|
193
|
+
let c = M(r);
|
|
170
194
|
o.has(c) || (o.add(c), i.push({
|
|
171
|
-
component:
|
|
195
|
+
component: j(r),
|
|
172
196
|
resolvedPath: r,
|
|
173
197
|
src: a,
|
|
174
198
|
key: c
|
|
@@ -176,7 +200,7 @@ function N(e, t) {
|
|
|
176
200
|
}
|
|
177
201
|
return i;
|
|
178
202
|
}
|
|
179
|
-
function
|
|
203
|
+
function F(e, t) {
|
|
180
204
|
let n = r(e, "utf-8"), i = [], a = [], o = /useCss\s*\(\s*['"]([^'"]+)['"]\s*,?\s*\)/g, s = /useClientJs\s*\(\s*['"]([^'"]+)['"]\s*,?\s*\)/g, c;
|
|
181
205
|
for (; (c = o.exec(n)) !== null;) {
|
|
182
206
|
let n = c[1];
|
|
@@ -199,7 +223,7 @@ function P(e, t) {
|
|
|
199
223
|
js: a
|
|
200
224
|
};
|
|
201
225
|
}
|
|
202
|
-
function
|
|
226
|
+
function I(n) {
|
|
203
227
|
let i = {}, a = f(n, "src"), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
|
|
204
228
|
try {
|
|
205
229
|
if (!o(a).isDirectory()) return {
|
|
@@ -213,17 +237,17 @@ function F(n) {
|
|
|
213
237
|
t(h) && (i.global = h, console.log("[l5e] Detected src/client.global.ts and added as entry"));
|
|
214
238
|
let g = e(n);
|
|
215
239
|
g && (i["global-style"] = g, console.log("[l5e] Detected src/global.css and added as global stylesheet"));
|
|
216
|
-
let _ =
|
|
240
|
+
let _ = k(a), v = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set();
|
|
217
241
|
for (let e of _) {
|
|
218
|
-
let { css: t, js: i } =
|
|
242
|
+
let { css: t, js: i } = F(e, n);
|
|
219
243
|
t.forEach((e) => v.add(e)), i.forEach((e) => y.add(e));
|
|
220
|
-
let o =
|
|
244
|
+
let o = P(e, n);
|
|
221
245
|
for (let e of o) s.set(e.key, e.resolvedPath), c.set(e.resolvedPath, e.key), l.set(e.key, e.src);
|
|
222
246
|
let f = e.replace(/\\/g, "/");
|
|
223
247
|
if (/\/actions\.(ts|tsx)$/.test(f)) {
|
|
224
248
|
let t = r(e, "utf-8"), n = /export\s+const\s+(\w+)\s*=\s*defineAction\s*\(/g, i, o = p(a, d(e)).replace(/\\/g, "/") || ".";
|
|
225
249
|
for (; (i = n.exec(t)) !== null;) {
|
|
226
|
-
let e = i[1], t = `${e}_${
|
|
250
|
+
let e = i[1], t = `${e}_${A(o)}`;
|
|
227
251
|
u.set(t, {
|
|
228
252
|
modulePath: o,
|
|
229
253
|
actionName: e
|
|
@@ -266,7 +290,7 @@ function F(n) {
|
|
|
266
290
|
actionRegistry: u
|
|
267
291
|
};
|
|
268
292
|
}
|
|
269
|
-
function
|
|
293
|
+
function L(e, t, n, r, i) {
|
|
270
294
|
let a = [], o = 0, s = /ClientIsland\s*,\s*\{/g, c;
|
|
271
295
|
for (; (c = s.exec(e)) !== null;) {
|
|
272
296
|
let s = c.index + c[0].length, l = e.substring(s, s + 500), u = /from:\s*"([^"]+)"/.exec(l);
|
|
@@ -287,7 +311,7 @@ function I(e, t, n, r, i) {
|
|
|
287
311
|
}
|
|
288
312
|
return a.push(e.substring(o)), a.join("");
|
|
289
313
|
}
|
|
290
|
-
function
|
|
314
|
+
function R(e = {}) {
|
|
291
315
|
let r = process.cwd(), i = !1, o = e.chunking === !1 ? null : v(e.chunking), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), d = /* @__PURE__ */ new Map();
|
|
292
316
|
return {
|
|
293
317
|
name: "l5e-jsx-classic",
|
|
@@ -311,7 +335,7 @@ function L(e = {}) {
|
|
|
311
335
|
handleHotUpdate({ file: e, server: t }) {
|
|
312
336
|
let n = p(r, e);
|
|
313
337
|
if (/actions\.(ts|tsx)$/.test(e)) {
|
|
314
|
-
d =
|
|
338
|
+
d = I(r).actionRegistry;
|
|
315
339
|
let e = t.moduleGraph.getModuleById("\0virtual:l5e-actions");
|
|
316
340
|
e && t.moduleGraph.invalidateModule(e), console.log(`[l5e] Action file changed: ${n} — re-scanned ${d.size} action(s)`);
|
|
317
341
|
}
|
|
@@ -351,60 +375,63 @@ function L(e = {}) {
|
|
|
351
375
|
s(f(e, "action-registry.json"), JSON.stringify(i), "utf-8"), console.log(`[l5e] Wrote action-registry.json (${d.size} actions)`);
|
|
352
376
|
}
|
|
353
377
|
},
|
|
354
|
-
config(
|
|
355
|
-
let
|
|
356
|
-
if (
|
|
357
|
-
let
|
|
358
|
-
|
|
359
|
-
let
|
|
360
|
-
...
|
|
361
|
-
...
|
|
362
|
-
} :
|
|
363
|
-
return
|
|
364
|
-
...e.
|
|
365
|
-
|
|
366
|
-
|
|
367
|
-
|
|
368
|
-
|
|
369
|
-
|
|
370
|
-
|
|
371
|
-
|
|
372
|
-
|
|
373
|
-
|
|
374
|
-
|
|
375
|
-
|
|
376
|
-
|
|
377
|
-
|
|
378
|
+
config(t) {
|
|
379
|
+
let n = t.root || process.cwd(), r = t.build?.rolldownOptions?.output, i = !t.build?.ssr && o !== null;
|
|
380
|
+
if (i && (Array.isArray(r) || r?.manualChunks || r?.codeSplitting !== void 0)) throw Error("[l5e chunking] Use coreVite({ chunking: { shared: [...] } }) or set chunking: false when configuring raw Rolldown chunk placement.");
|
|
381
|
+
let a = I(n);
|
|
382
|
+
a.islandRegistry, c = a.pathToKey, l = a.keyToSrc, d = a.actionRegistry;
|
|
383
|
+
let s = t.build?.rolldownOptions?.input || {}, u = typeof s == "object" && !Array.isArray(s) ? {
|
|
384
|
+
...a.input,
|
|
385
|
+
...s
|
|
386
|
+
} : a.input;
|
|
387
|
+
return e.chunking && e.chunking.mode === "compact" && (u["l5e-compact-renderer"] = T), { build: {
|
|
388
|
+
...e.chunking && e.chunking.mode === "compact" ? { modulePreload: { resolveDependencies: (e, t) => t.filter((e) => !/\.[cm]?js(?:\?|$)/.test(e)) } } : {},
|
|
389
|
+
rolldownOptions: {
|
|
390
|
+
...t.build?.rolldownOptions,
|
|
391
|
+
input: Object.keys(u).length > 0 ? u : void 0,
|
|
392
|
+
preserveEntrySignatures: i ? "allow-extension" : "exports-only",
|
|
393
|
+
...i ? { output: {
|
|
394
|
+
...r,
|
|
395
|
+
strictExecutionOrder: !0,
|
|
396
|
+
codeSplitting: { groups: o.groups() },
|
|
397
|
+
entryFileNames: (e) => {
|
|
398
|
+
let t = e.facadeModuleId?.replace(/\\/g, "/") || "";
|
|
399
|
+
return t.endsWith("/src/client.global.ts") ? "assets/global-[hash].js" : /\/react\//.test(t) ? e.name.startsWith("island-") ? "assets/[name]-[hash].js" : "assets/island-[name]-[hash].js" : "assets/bundle-[name]-[hash].js";
|
|
400
|
+
},
|
|
401
|
+
chunkFileNames: (e) => e.name.startsWith("shared-") ? "assets/[name]-[hash].js" : e.name === "shared" ? "assets/shared-[hash].js" : e.isDynamicEntry ? "assets/bundle-[name]-[hash].js" : "assets/shared-[name]-[hash].js"
|
|
402
|
+
} } : {}
|
|
403
|
+
}
|
|
404
|
+
} };
|
|
378
405
|
},
|
|
379
406
|
resolveId(e) {
|
|
380
|
-
return e === y ? "\0virtual:l5e-views" : e === b ? "\0virtual:l5e-route" : e === x ? "\0virtual:l5e-ssr-entry" : e === S ? "\0virtual:l5e-global-loader" : e === C ? "\0virtual:l5e-island-strategies" : e === w ? "\0virtual:l5e-islands" : e === T ? "\0virtual:l5e-
|
|
407
|
+
return e === y ? "\0virtual:l5e-views" : e === b ? "\0virtual:l5e-route" : e === x ? "\0virtual:l5e-ssr-entry" : e === S ? "\0virtual:l5e-global-loader" : e === C ? "\0virtual:l5e-island-strategies" : e === w ? "\0virtual:l5e-islands" : e === T ? "\0virtual:l5e-compact-renderer" : e === E ? "\0virtual:l5e-actions" : e === D ? "\0virtual:l5e-middleware" : null;
|
|
381
408
|
},
|
|
382
|
-
async transform(
|
|
383
|
-
if (
|
|
384
|
-
code: `import '@withl5e/l5e/island
|
|
409
|
+
async transform(t, n, i) {
|
|
410
|
+
if (n.replace(/\\/g, "/").endsWith("src/client.global.ts") && !i?.ssr) return {
|
|
411
|
+
code: `import '@withl5e/l5e/island/${e.chunking && e.chunking.mode === "compact" ? "compact-runtime" : "runtime"}';\n${t}`,
|
|
385
412
|
map: null
|
|
386
413
|
};
|
|
387
|
-
if (!
|
|
388
|
-
let
|
|
389
|
-
if (
|
|
390
|
-
let
|
|
391
|
-
for (; (a = r.exec(
|
|
392
|
-
let
|
|
414
|
+
if (!i?.ssr) {
|
|
415
|
+
let e = n.replace(/\\/g, "/").match(/\/src\/(.+)\/actions\.(ts|tsx)$/);
|
|
416
|
+
if (e) {
|
|
417
|
+
let n = e[1], r = /export\s+const\s+(\w+)\s*=\s*defineAction\s*\(/g, i = [], a;
|
|
418
|
+
for (; (a = r.exec(t)) !== null;) {
|
|
419
|
+
let e = a[1], n = t.substring(a.index, a.index + 500).match(/method:\s*['"](\w+)['"]/), r = n ? n[1].toUpperCase() : "GET";
|
|
393
420
|
i.push({
|
|
394
|
-
name:
|
|
421
|
+
name: e,
|
|
395
422
|
method: r
|
|
396
423
|
});
|
|
397
424
|
}
|
|
398
425
|
if (i.length > 0) return {
|
|
399
|
-
code: i.map(({ name: e, method:
|
|
400
|
-
let r = `${e}_${
|
|
401
|
-
return
|
|
426
|
+
code: i.map(({ name: e, method: t }) => {
|
|
427
|
+
let r = `${e}_${A(n)}`;
|
|
428
|
+
return t === "GET" ? `export async function ${e}(params) {
|
|
402
429
|
const res = await fetch('/_l5e/action/${r}?' + new URLSearchParams(params));
|
|
403
430
|
if (!res.ok) throw Object.assign(new Error('HTTP ' + res.status), { status: res.status });
|
|
404
431
|
return res;
|
|
405
432
|
}` : `export async function ${e}(body) {
|
|
406
433
|
const res = await fetch('/_l5e/action/${r}', {
|
|
407
|
-
method: '${
|
|
434
|
+
method: '${t}',
|
|
408
435
|
headers: { 'Content-Type': 'application/json' },
|
|
409
436
|
body: JSON.stringify(body),
|
|
410
437
|
});
|
|
@@ -416,28 +443,28 @@ function L(e = {}) {
|
|
|
416
443
|
};
|
|
417
444
|
}
|
|
418
445
|
}
|
|
419
|
-
if (
|
|
420
|
-
if (/\.(tsx|jsx)$/.test(
|
|
421
|
-
let
|
|
422
|
-
loader:
|
|
446
|
+
if (n.includes("node_modules") || n.includes("/react/") || n.includes("\\react\\")) return null;
|
|
447
|
+
if (/\.(tsx|jsx)$/.test(n)) try {
|
|
448
|
+
let e = `import { Fragment as __Fragment, jsxFactory } from "@withl5e/l5e/jsx-runtime"\n${t}`, i = await u(e, {
|
|
449
|
+
loader: n.endsWith(".tsx") ? "tsx" : "jsx",
|
|
423
450
|
jsx: "transform",
|
|
424
451
|
jsxFactory: "jsxFactory",
|
|
425
452
|
jsxFragment: "__Fragment",
|
|
426
453
|
sourcemap: !0,
|
|
427
|
-
sourcefile:
|
|
454
|
+
sourcefile: n,
|
|
428
455
|
target: "es2020"
|
|
429
456
|
}), a = i.code;
|
|
430
|
-
return a.includes("ClientIsland") && (a =
|
|
457
|
+
return a.includes("ClientIsland") && (a = L(a, n, r, c, l)), {
|
|
431
458
|
code: a,
|
|
432
459
|
map: i.map || null
|
|
433
460
|
};
|
|
434
461
|
} catch (e) {
|
|
435
|
-
throw console.error(`[l5e] Failed to transform JSX in ${
|
|
462
|
+
throw console.error(`[l5e] Failed to transform JSX in ${n}:`, e), e;
|
|
436
463
|
}
|
|
437
|
-
if (
|
|
438
|
-
let
|
|
439
|
-
if (
|
|
440
|
-
code:
|
|
464
|
+
if (i?.ssr) {
|
|
465
|
+
let e = t, n = !1;
|
|
466
|
+
if (e = e.replace(/import\.meta\.env\.([a-zA-Z_][a-zA-Z0-9_]*)/g, (e, t) => O.has(t) ? e : (n = !0, `process.env.${t}`)), e = e.replace(/import\.meta\.env\[(['"`])([^'"`]+)\1\]/g, (e, t, r) => O.has(r) ? e : (n = !0, `process.env[${t}${r}${t}]`)), n) return {
|
|
467
|
+
code: e,
|
|
441
468
|
map: null
|
|
442
469
|
};
|
|
443
470
|
}
|
|
@@ -455,6 +482,7 @@ export const actionRegistry = ${JSON.stringify(e)};`;
|
|
|
455
482
|
}
|
|
456
483
|
if (e === "\0virtual:l5e-middleware") return "\nconst middlewareModules = import.meta.glob([\n '/src/middleware.{ts,tsx,js,jsx}',\n '/src/middleware/index.{ts,tsx,js,jsx}',\n]);\n\nconst middlewarePaths = [\n '/src/middleware.ts',\n '/src/middleware.tsx',\n '/src/middleware.js',\n '/src/middleware.jsx',\n '/src/middleware/index.ts',\n '/src/middleware/index.tsx',\n '/src/middleware/index.js',\n '/src/middleware/index.jsx',\n];\n\nexport async function loadMiddleware() {\n const middlewarePath = middlewarePaths.find((path) => middlewareModules[path]);\n if (!middlewarePath) return undefined;\n\n const mod = await middlewareModules[middlewarePath]();\n return mod.onRequest;\n}\n";
|
|
457
484
|
if (e === "\0virtual:l5e-islands") return "export const islandModules = import.meta.glob('/src/**/react/*.{tsx,jsx}');";
|
|
485
|
+
if (e === "\0virtual:l5e-compact-renderer") return "export * as reactDomClient from 'react-dom/client'; export { createElement } from 'react';";
|
|
458
486
|
if (e === "\0virtual:l5e-island-strategies") {
|
|
459
487
|
let e = f(r, "src", "island-strategies.ts");
|
|
460
488
|
return t(e) ? "import '/src/island-strategies.ts';" : "/* no custom island strategies */";
|
|
@@ -464,6 +492,6 @@ export const actionRegistry = ${JSON.stringify(e)};`;
|
|
|
464
492
|
};
|
|
465
493
|
}
|
|
466
494
|
//#endregion
|
|
467
|
-
export {
|
|
495
|
+
export { R as t };
|
|
468
496
|
|
|
469
|
-
//# sourceMappingURL=vite-plugin-
|
|
497
|
+
//# sourceMappingURL=vite-plugin-R3LFxv9a.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"vite-plugin-R3LFxv9a.js","names":["join"],"sources":["../src/core/chunking.ts","../src/core/vite-plugin.ts"],"sourcesContent":["import { createHash } from 'node:crypto';\nimport path from 'node:path';\nimport type { CodeSplittingGroup, ModuleInfo, OutputBundle } from 'rolldown';\n\nexport interface SharedChunkGroup {\n name: string;\n /** Exact package names, including their subpath imports. */\n packages?: string[];\n /** Module specifiers resolved by Vite, including aliases. */\n modules?: string[];\n priority?: number;\n /** Approximate uncompressed maximum; not a hard network byte budget. */\n maxSize?: number;\n}\n\nexport interface ChunkingOptions {\n /**\n * Opt in to at most one global, one page bundle and one canonical shared file.\n * State that must retain identity across page bundles must be listed in `shared`.\n */\n mode?: 'compact';\n shared?: SharedChunkGroup[];\n}\n\nexport interface CoreViteOptions {\n /** false leaves chunk placement to Vite; runtime identity protection stays enabled. */\n chunking?: ChunkingOptions | false;\n}\n\nconst normalize = (id: string) => id.replace(/\\\\/g, '/');\nconst digest = (value: string) => createHash('sha256').update(value).digest('hex').slice(0, 8);\n\n/** The last node_modules segment also handles pnpm's nested package layout. */\nfunction packageName(id: string): string | undefined {\n const suffix = normalize(id).split('/node_modules/').at(-1);\n if (suffix === normalize(id)) return undefined;\n const parts = suffix!.split('/');\n return parts[0].startsWith('@') ? parts.slice(0, 2).join('/') : parts[0];\n}\n\ntype Decision = { group: string | null; rule?: string; consumers: string[]; reason: string };\n\n/** One build-time plan drives placement and the diagnostic report. Runtime reads Vite's manifest. */\nexport function createChunkPlanner(options: ChunkingOptions = {}) {\n const rules = options.shared || [];\n if (options.mode === 'compact' && rules.length > 1) {\n throw new Error('[l5e chunking] Compact mode accepts one canonical shared group.');\n }\n const names = new Set<string>();\n for (const rule of rules) {\n if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(rule.name) || names.has(rule.name)) {\n throw new Error(`[l5e chunking] Invalid or duplicate shared group: ${rule.name}`);\n }\n if (!rule.packages?.length && !rule.modules?.length) {\n throw new Error(`[l5e chunking] Group ${rule.name} needs packages or modules.`);\n }\n if (rule.maxSize !== undefined && (!Number.isFinite(rule.maxSize) || rule.maxSize <= 0)) {\n throw new Error(`[l5e chunking] Invalid maxSize for ${rule.name}`);\n }\n if (options.mode === 'compact' && rule.maxSize !== undefined) {\n throw new Error(\n `[l5e chunking] Compact mode cannot use maxSize for ${rule.name}; it would split the canonical shared file.`,\n );\n }\n names.add(rule.name);\n }\n let root = '';\n const resolvedRules = new Map<SharedChunkGroup, Set<string>>();\n const decisions = new Map<string, Decision>();\n const warnings = new Set<string>();\n const portable = (id: string) => {\n const pkg = packageName(id);\n if (pkg) return `npm:${normalize(id).split('/node_modules/').at(-1)}`;\n return normalize(path.relative(root, id));\n };\n\n return {\n async resolve(\n projectRoot: string,\n resolveId: (id: string, importer: string) => Promise<string | null>,\n ) {\n root = projectRoot;\n resolvedRules.clear();\n decisions.clear();\n warnings.clear();\n for (const rule of rules) {\n const ids = new Set<string>();\n for (const specifier of rule.modules || []) {\n const id = await resolveId(specifier, path.join(root, 'index.html'));\n if (!id) throw new Error(`[l5e chunking] Cannot resolve ${specifier} in ${rule.name}`);\n ids.add(id);\n }\n resolvedRules.set(rule, ids);\n }\n },\n analyze(modules: ModuleInfo[]) {\n decisions.clear();\n const graph = new Map(modules.map((mod) => [mod.id, mod]));\n if (options.mode === 'compact') {\n const reachability = new Map<string, Map<string, boolean>>();\n for (const entry of modules.filter((mod) => mod.isEntry)) {\n const visit = (id: string, lazy: boolean) => {\n const owners = reachability.get(id) || new Map<string, boolean>();\n const previous = owners.get(entry.id);\n if (previous === false || previous === lazy) return;\n owners.set(entry.id, lazy);\n reachability.set(id, owners);\n const module = graph.get(id);\n if (!module) return;\n module.importedIds.forEach((dependency) => visit(dependency, lazy));\n module.dynamicallyImportedIds.forEach((dependency) => visit(dependency, true));\n };\n visit(entry.id, false);\n }\n const globalEntry = modules.find(\n (mod) => mod.isEntry && normalize(mod.id).endsWith('/src/client.global.ts'),\n );\n if (globalEntry) {\n for (const [id, owners] of reachability) {\n if (\n !/\\.css(?:\\?|$)/.test(normalize(id)) &&\n owners.get(globalEntry.id) === true &&\n [...owners.keys()].some((owner) => owner !== globalEntry.id)\n ) {\n throw new Error(\n `[l5e chunking] Compact mode cannot bridge a dynamic-only global overlap: ${portable(id)}. Import it statically from global or place state behind an explicit shared root.`,\n );\n }\n }\n }\n }\n const roots = modules.filter((mod) => mod.isEntry || mod.dynamicImporters.length > 0);\n const consumers = new Map<string, Set<string>>();\n for (const entry of roots) {\n const visited = new Set<string>();\n const visit = (id: string) => {\n if (visited.has(id)) return;\n visited.add(id);\n const mod = graph.get(id);\n if (!mod) return;\n const users = consumers.get(id) || new Set<string>();\n users.add(entry.id);\n consumers.set(id, users);\n mod.importedIds.forEach(visit);\n };\n visit(entry.id);\n }\n const rank = (id: string) => {\n const mod = graph.get(id)!;\n if (!mod.isEntry) return 3;\n if (normalize(id).endsWith('/src/client.global.ts')) return 0;\n if (/\\/react\\//.test(normalize(id)) && !packageName(id)) return 2;\n return 1;\n };\n const matched = new Set<SharedChunkGroup>();\n for (const mod of modules) {\n const users = [...(consumers.get(mod.id) || [])].sort();\n const labels = users.map(portable).sort();\n const matches = rules\n .filter(\n (rule) =>\n resolvedRules.get(rule)?.has(mod.id) ||\n rule.packages?.includes(packageName(mod.id) || ''),\n )\n .sort((a, b) => (b.priority || 0) - (a.priority || 0));\n matches.forEach((rule) => matched.add(rule));\n if (matches.length > 1)\n warnings.add(\n `${portable(mod.id)} matches ${matches.map((r) => r.name).join(', ')}; using ${matches[0].name}.`,\n );\n let group: string | null = null;\n let reason = 'Private dependency stays with its entry or dynamic import.';\n if (!mod.isEntry && users.length && matches.length) {\n // Explicit groups can combine consumers at the same activation tier.\n // Never promote island-only code into global/page, or dynamic-only code\n // into a static entry. Distinct dynamic roots remain separate as well.\n const tier = Math.min(...users.map(rank));\n const activation =\n tier === 3\n ? `lazy-${digest(JSON.stringify(labels))}`\n : ['global', 'page', 'island'][tier];\n group = options.mode === 'compact' ? 'shared' : `shared-${matches[0].name}-${activation}`;\n reason = `Configured group ${matches[0].name}; activation ${activation}.`;\n } else if (\n options.mode === 'compact' &&\n !mod.isEntry &&\n users.some((id) => rank(id) === 0) &&\n users.some((id) => rank(id) > 0)\n ) {\n group = 'global-owner';\n reason = 'Static global/page overlap is exported by the canonical global artifact.';\n } else if (options.mode !== 'compact' && !mod.isEntry && users.length > 1) {\n group = `shared-auto-${digest(JSON.stringify(labels))}`;\n reason = 'Shared by the same static consumers; preserves dynamic import roots.';\n }\n decisions.set(mod.id, { group, rule: matches[0]?.name, consumers: labels, reason });\n }\n for (const rule of rules) {\n if (!matched.has(rule))\n warnings.add(`Group ${rule.name} matched no modules in this client build.`);\n }\n return [...warnings];\n },\n groups(): CodeSplittingGroup[] {\n return [\n ...rules.map((rule) => ({\n name: (id: string) => {\n const decision = decisions.get(id);\n return decision?.rule === rule.name ? decision.group : null;\n },\n maxSize: rule.maxSize,\n includeDependenciesRecursively: options.mode === 'compact',\n })),\n {\n name: (id: string) => decisions.get(id)?.group || null,\n includeDependenciesRecursively: false,\n },\n ];\n },\n report(bundle: OutputBundle) {\n return {\n version: 2,\n mode: options.mode || 'default',\n warnings: [...warnings],\n chunks: Object.values(bundle).flatMap((chunk) => {\n if (chunk.type !== 'chunk') return [];\n const source = chunk.facadeModuleId ? portable(chunk.facadeModuleId) : null;\n const kind =\n source === 'src/client.global.ts'\n ? 'global'\n : source && /(?:^|\\/)react\\//.test(source)\n ? 'island'\n : chunk.isEntry || chunk.isDynamicEntry\n ? 'page'\n : 'shared';\n return [\n {\n file: chunk.fileName,\n kind,\n canonicalShared: options.mode === 'compact' && chunk.name === 'shared',\n canonicalGlobal: options.mode === 'compact' && chunk.name === 'global-owner',\n source,\n bytes: Buffer.byteLength(chunk.code),\n imports: chunk.imports,\n dynamicImports: chunk.dynamicImports,\n modules: Object.keys(chunk.modules).map((id) => ({\n id: portable(id),\n ...decisions.get(id),\n })),\n },\n ];\n }),\n };\n },\n };\n}\n","import { transform } from 'esbuild';\nimport {\n existsSync,\n mkdirSync,\n readdirSync,\n readFileSync,\n rmSync,\n statSync,\n writeFileSync,\n} from 'fs';\nimport { dirname, join, relative, resolve } from 'path';\nimport type { Plugin, UserConfig } from 'vite';\nimport { findGlobalStyleInput } from './global-style';\nimport { createChunkPlanner, type CoreViteOptions } from './chunking';\nexport type { CoreViteOptions, ChunkingOptions, SharedChunkGroup } from './chunking';\n\nconst VIRTUAL_L5E_VIEWS = 'virtual:l5e-views';\nconst VIRTUAL_L5E_ROUTE = 'virtual:l5e-route';\nconst VIRTUAL_L5E_SSR_ENTRY = 'virtual:l5e-ssr-entry';\nconst VIRTUAL_L5E_GLOBAL_LOADER = 'virtual:l5e-global-loader';\nconst VIRTUAL_L5E_ISLAND_STRATEGIES = 'virtual:l5e-island-strategies';\nconst VIRTUAL_L5E_ISLANDS = 'virtual:l5e-islands';\nconst VIRTUAL_L5E_COMPACT_RENDERER = 'virtual:l5e-compact-renderer';\nconst VIRTUAL_L5E_ACTIONS = 'virtual:l5e-actions';\nconst VIRTUAL_L5E_MIDDLEWARE = 'virtual:l5e-middleware';\n\n/**\n * Vite's built-in env vars on `import.meta.env`. These are statically replaced\n * by Vite itself (DEV/PROD/SSR are booleans, MODE/BASE_URL strings), so the SSR\n * `import.meta.env.* -> process.env.*` rewrite must skip them — otherwise it\n * clobbers Vite defaults (e.g. `import.meta.env.DEV` would become the undefined\n * `process.env.DEV`).\n */\nconst VITE_RESERVED_ENV = new Set(['MODE', 'BASE_URL', 'PROD', 'DEV', 'SSR', 'LEGACY']);\n\n/**\n * Recursively scan directory for .tsx and .ts files\n */\nfunction scanTsFiles(dir: string, fileList: string[] = []): string[] {\n const files = readdirSync(dir);\n\n for (const file of files) {\n const filePath = join(dir, file);\n const stat = statSync(filePath);\n\n if (stat.isDirectory()) {\n // Skip node_modules and dist directories\n if (file === 'node_modules' || file === 'dist' || file === '.git') {\n continue;\n }\n scanTsFiles(filePath, fileList);\n } else if (file.endsWith('.tsx') || file.endsWith('.ts')) {\n fileList.push(filePath);\n }\n }\n\n return fileList;\n}\n\n/**\n * Short hash function for island keys\n */\nfunction shortHash(str: string): string {\n let hash = 0;\n for (let i = 0; i < str.length; i++) {\n hash = (hash << 5) - hash + str.charCodeAt(i);\n hash = hash & hash;\n }\n return Math.abs(hash).toString(16).slice(0, 4);\n}\n\n/**\n * Derive component name from path: \"./react/Counter\" → \"Counter\"\n */\nfunction deriveComponentName(fromPath: string): string {\n const segments = fromPath.split('/');\n let filename = segments[segments.length - 1];\n // Remove extension if present\n filename = filename.replace(/\\.(tsx?|jsx?)$/, '');\n return filename;\n}\n\n/**\n * Create island registry key: \"/src/views/test-island/react/Counter\" → \"Counter_a3f2\"\n */\nfunction makeIslandKey(resolvedPath: string): string {\n const name = deriveComponentName(resolvedPath);\n return `${name}_${shortHash(resolvedPath)}`;\n}\n\n/**\n * Resolve file path with extension (.tsx, .ts, .jsx, .js)\n * Returns the relative path with extension (e.g., \"src/views/.../Counter.tsx\")\n * or null if file not found\n */\nfunction resolveWithExtension(resolvedPath: string, rootDir: string): string | null {\n // resolvedPath: \"/src/views/test-island/react/Counter\" (no extension, leading /)\n const relPath = resolvedPath.replace(/^\\//, ''); // \"src/views/.../Counter\"\n const absBase = resolve(rootDir, relPath);\n\n // Check with extensions\n for (const ext of ['.tsx', '.ts', '.jsx', '.js']) {\n if (existsSync(absBase + ext)) {\n return relPath + ext; // \"src/views/.../Counter.tsx\"\n }\n }\n // Check without extension (file might already have one)\n if (existsSync(absBase)) {\n return relPath;\n }\n return null;\n}\n\n/**\n * Extract island entries from file using regex on JSX source\n */\nfunction extractIslandEntries(\n filePath: string,\n rootDir: string,\n): Array<{ component: string; resolvedPath: string; src: string; key: string }> {\n const content = readFileSync(filePath, 'utf-8');\n const entries: Array<{ component: string; resolvedPath: string; src: string; key: string }> = [];\n\n // Regex scan JSX source (NOT post-transform code).\n // Just find <ClientIsland ... from=\"Y\" ...> — component name derived from path.\n const regex = /<ClientIsland\\s[^>]*?from\\s*=\\s*\"([^\"]+)\"/g;\n\n const seen = new Set<string>();\n let match;\n\n while ((match = regex.exec(content)) !== null) {\n const fromPath = match[1];\n\n // Resolve relative path → absolute\n let resolvedPath: string;\n if (fromPath.startsWith('~/')) {\n // Alias ~/ → /src/ (project convention)\n resolvedPath = '/src/' + fromPath.substring(2);\n } else if (fromPath.startsWith('/src/')) {\n resolvedPath = fromPath;\n } else if (fromPath.startsWith('./') || fromPath.startsWith('../')) {\n const abs = resolve(filePath, '..', fromPath);\n resolvedPath = '/' + relative(rootDir, abs).replace(/\\\\/g, '/');\n } else {\n resolvedPath = fromPath;\n }\n\n // Resolve file extension for manifest compatibility\n const src = resolveWithExtension(resolvedPath, rootDir);\n if (!src) {\n console.warn(\n `[l5e] Island component not found: ${resolvedPath} (from ${fromPath} in ${filePath})`,\n );\n continue;\n }\n\n const key = makeIslandKey(resolvedPath);\n if (!seen.has(key)) {\n seen.add(key);\n entries.push({\n component: deriveComponentName(resolvedPath),\n resolvedPath,\n src, // \"src/views/.../Counter.tsx\" — matches manifest key format\n key,\n });\n }\n }\n return entries;\n}\n\n/**\n * Extract paths from useCss and useClientJs calls using regex\n */\nfunction extractPathsFromFile(filePath: string, rootDir: string): { css: string[]; js: string[] } {\n const content = readFileSync(filePath, 'utf-8');\n const css: string[] = [];\n const js: string[] = [];\n\n // Regex patterns to match useCss('path') or useCss(\"path\")\n // Handles single and double quotes, and escaped quotes\n const useCssPattern = /useCss\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*,?\\s*\\)/g;\n const useClientJsPattern = /useClientJs\\s*\\(\\s*['\"]([^'\"]+)['\"]\\s*,?\\s*\\)/g;\n\n let match;\n\n // Extract CSS paths\n while ((match = useCssPattern.exec(content)) !== null) {\n const path = match[1];\n // Convert relative path to absolute if needed\n if (path.startsWith('/src/')) {\n css.push(path);\n } else if (path.startsWith('./') || path.startsWith('../')) {\n // Resolve relative path\n const absolutePath = resolve(filePath, '..', path);\n const relativePath = '/' + relative(rootDir, absolutePath).replace(/\\\\/g, '/');\n css.push(relativePath);\n } else {\n css.push(path);\n }\n }\n\n // Extract JS paths\n while ((match = useClientJsPattern.exec(content)) !== null) {\n const path = match[1];\n if (path.startsWith('/src/')) {\n js.push(path);\n } else if (path.startsWith('./') || path.startsWith('../')) {\n const absolutePath = resolve(filePath, '..', path);\n const relativePath = '/' + relative(rootDir, absolutePath).replace(/\\\\/g, '/');\n js.push(relativePath);\n } else {\n js.push(path);\n }\n }\n\n return { css, js };\n}\n\n/**\n * Auto-discover bundler input entries from useCss and useClientJs calls\n */\nfunction discoverBundlerInput(rootDir: string): {\n input: Record<string, string>;\n islandRegistry: Map<string, string>;\n pathToKey: Map<string, string>;\n keyToSrc: Map<string, string>;\n actionRegistry: Map<string, { modulePath: string; actionName: string }>;\n} {\n const input: Record<string, string> = {};\n const srcDir = join(rootDir, 'src');\n\n // Island registries\n const islandRegistry = new Map<string, string>(); // key → resolvedPath\n const pathToKey = new Map<string, string>(); // resolvedPath → key\n const keyToSrc = new Map<string, string>(); // key → src (manifest-compatible path with extension)\n\n // Action registry: actionKey → { modulePath, actionName }\n const actionRegistry = new Map<string, { modulePath: string; actionName: string }>();\n\n try {\n // Check if src directory exists\n if (!statSync(srcDir).isDirectory()) {\n return { input, islandRegistry, pathToKey, keyToSrc, actionRegistry };\n }\n\n // Check if src/client.global.ts exists and add it as an entry\n const globalTsPath = join(rootDir, 'src', 'client.global.ts');\n if (existsSync(globalTsPath)) {\n input['global'] = globalTsPath;\n console.log('[l5e] Detected src/client.global.ts and added as entry');\n }\n\n const globalStyleInput = findGlobalStyleInput(rootDir);\n if (globalStyleInput) {\n input['global-style'] = globalStyleInput;\n console.log('[l5e] Detected src/global.css and added as global stylesheet');\n }\n\n // Scan all .tsx and .ts files\n const tsFiles = scanTsFiles(srcDir);\n\n // Extract all paths\n const allCssPaths = new Set<string>();\n const allJsPaths = new Set<string>();\n\n for (const file of tsFiles) {\n const { css, js } = extractPathsFromFile(file, rootDir);\n css.forEach((path) => allCssPaths.add(path));\n js.forEach((path) => allJsPaths.add(path));\n\n // Extract island entries\n const islandEntries = extractIslandEntries(file, rootDir);\n for (const entry of islandEntries) {\n islandRegistry.set(entry.key, entry.resolvedPath);\n pathToKey.set(entry.resolvedPath, entry.key);\n keyToSrc.set(entry.key, entry.src);\n }\n\n // Extract action entries from actions.ts/tsx files\n const normalizedFile = file.replace(/\\\\/g, '/');\n if (/\\/actions\\.(ts|tsx)$/.test(normalizedFile)) {\n const content = readFileSync(file, 'utf-8');\n const actionExportRegex = /export\\s+const\\s+(\\w+)\\s*=\\s*defineAction\\s*\\(/g;\n let actionMatch;\n\n // Compute modulePath: relative path from src/ to parent dir\n const relFromSrc = relative(srcDir, dirname(file)).replace(/\\\\/g, '/');\n const modulePath = relFromSrc || '.';\n\n while ((actionMatch = actionExportRegex.exec(content)) !== null) {\n const actionName = actionMatch[1];\n const actionKey = `${actionName}_${shortHash(modulePath)}`;\n actionRegistry.set(actionKey, { modulePath, actionName });\n }\n }\n }\n\n // Convert paths to bundler input entries\n // CSS files\n for (const cssPath of allCssPaths) {\n // Remove leading /src/ and convert to relative path\n const relativePath = cssPath.startsWith('/src/')\n ? cssPath.substring(1) // Remove leading /\n : cssPath.startsWith('/')\n ? cssPath.substring(1)\n : cssPath;\n\n const absolutePath = resolve(rootDir, relativePath);\n\n // src/global.css is already a dedicated convention entry. Keeping one\n // Separate input entries avoid collisions if a shared layout also calls useCss().\n if (globalStyleInput && resolve(absolutePath) === resolve(globalStyleInput)) {\n continue;\n }\n\n // Only add if file exists\n if (!existsSync(absolutePath)) {\n console.warn(`[l5e] CSS file not found: ${absolutePath} (from ${cssPath})`);\n continue;\n }\n\n // Generate entry name from path (e.g., /src/views/home/home.css -> views-home-home)\n const entryName = relativePath\n .replace(/^src\\//, '')\n .replace(/\\.css$/, '')\n .replace(/\\//g, '-')\n .replace(/\\\\/g, '-');\n\n input[entryName] = absolutePath;\n }\n\n // JS/TS files\n for (const jsPath of allJsPaths) {\n const relativePath = jsPath.startsWith('/src/')\n ? jsPath.substring(1)\n : jsPath.startsWith('/')\n ? jsPath.substring(1)\n : jsPath;\n\n const absolutePath = resolve(rootDir, relativePath);\n\n // Only add if file exists\n if (!existsSync(absolutePath)) {\n console.warn(`[l5e] JS/TS file not found: ${absolutePath} (from ${jsPath})`);\n continue;\n }\n\n // Generate entry name from path\n const entryName = relativePath\n .replace(/^src\\//, '')\n .replace(/\\.(ts|tsx|js|jsx)$/, '')\n .replace(/\\//g, '-')\n .replace(/\\\\/g, '-');\n\n input[entryName] = absolutePath;\n }\n\n // Add island component files to the bundler input so they appear in the manifest.\n // server.ts looks up manifest at runtime to resolve per-page island URLs.\n for (const [key, src] of keyToSrc) {\n const absolutePath = resolve(rootDir, src);\n input[`island-${key}`] = absolutePath;\n }\n\n if (islandRegistry.size > 0) {\n console.log(`[l5e] Detected ${islandRegistry.size} island(s)`);\n }\n if (actionRegistry.size > 0) {\n console.log(`[l5e] Detected ${actionRegistry.size} action(s)`);\n }\n } catch (error) {\n // Silently fail if directory doesn't exist or other errors\n console.warn('[l5e] Failed to discover bundler input:', error);\n }\n\n return { input, islandRegistry, pathToKey, keyToSrc, actionRegistry };\n}\n\n/**\n * Inject __key prop into ClientIsland calls\n * Use anchor-based approach to avoid fragile regex with nested objects\n */\nfunction injectIslandKeys(\n code: string,\n fileId: string,\n rootDir: string,\n pathToKey: Map<string, string>,\n keyToSrc: Map<string, string>,\n): string {\n // After esbuild, code has form:\n // jsxFactory(ClientIsland, { from: \"./react/Counter\", props: { n: 5 } })\n // ^anchor ^find from here\n\n const result: string[] = [];\n let lastIndex = 0;\n\n // Find each position \"ClientIsland,\" (anchor)\n const anchorRegex = /ClientIsland\\s*,\\s*\\{/g;\n let anchorMatch;\n\n while ((anchorMatch = anchorRegex.exec(code)) !== null) {\n const searchStart = anchorMatch.index + anchorMatch[0].length;\n\n // Scan for from: \"...\" in window ~500 chars after anchor\n const window = code.substring(searchStart, searchStart + 500);\n const fromMatch = /from:\\s*\"([^\"]+)\"/.exec(window);\n\n if (!fromMatch) continue;\n\n const fromPath = fromMatch[1];\n\n // Resolve path (handle ~/ alias)\n let resolved: string;\n if (fromPath.startsWith('~/')) {\n resolved = '/src/' + fromPath.substring(2);\n } else if (fromPath.startsWith('/src/')) {\n resolved = fromPath;\n } else if (fromPath.startsWith('./') || fromPath.startsWith('../')) {\n const abs = resolve(fileId, '..', fromPath);\n resolved = '/' + relative(rootDir, abs).replace(/\\\\/g, '/');\n } else {\n resolved = fromPath;\n }\n\n const key = pathToKey.get(resolved);\n if (!key) continue;\n\n const src = keyToSrc.get(key);\n if (!src) continue;\n\n // Inject __key and __src right after from: \"...\"\n const insertPos = searchStart + fromMatch.index + fromMatch[0].length;\n result.push(code.substring(lastIndex, insertPos));\n result.push(`, __key: \"${key}\", __src: \"${src}\"`);\n lastIndex = insertPos;\n }\n\n result.push(code.substring(lastIndex));\n return result.join('');\n}\n\nexport function coreVite(options: CoreViteOptions = {}): Plugin {\n let rootDir: string = process.cwd();\n let clientBuild = false;\n const planner = options.chunking === false ? null : createChunkPlanner(options.chunking);\n let islandRegistry = new Map<string, string>();\n let pathToKey = new Map<string, string>();\n let keyToSrc = new Map<string, string>();\n let actionRegistry = new Map<string, { modulePath: string; actionName: string }>();\n\n return {\n name: 'l5e-jsx-classic',\n enforce: 'pre',\n\n configResolved(resolvedConfig) {\n // Store root directory for later use\n rootDir = resolvedConfig.root || process.cwd();\n clientBuild = resolvedConfig.command === 'build' && !resolvedConfig.build.ssr;\n },\n\n async buildStart() {\n if (clientBuild && planner) {\n await planner.resolve(rootDir, async (id, importer) => {\n const resolved = await this.resolve(id, importer);\n return resolved && !resolved.external ? resolved.id : null;\n });\n }\n },\n\n generateBundle(_options, bundle) {\n if (clientBuild && planner) {\n this.emitFile({\n type: 'asset',\n fileName: '.vite/l5e-chunks.json',\n source: JSON.stringify(planner.report(bundle), null, 2),\n });\n }\n },\n\n handleHotUpdate({ file, server }) {\n const relPath = relative(rootDir, file);\n\n // Re-scan action registry when an actions file changes\n if (/actions\\.(ts|tsx)$/.test(file)) {\n const discovered = discoverBundlerInput(rootDir);\n actionRegistry = discovered.actionRegistry;\n // Invalidate the virtual:l5e-actions module so server picks up new registry\n const mod = server.moduleGraph.getModuleById('\\0' + VIRTUAL_L5E_ACTIONS);\n if (mod) {\n server.moduleGraph.invalidateModule(mod);\n }\n console.log(\n `[l5e] Action file changed: ${relPath} — re-scanned ${actionRegistry.size} action(s)`,\n );\n }\n\n // Allow Vite's default HMR for CSS and client-side JS files\n if (file.endsWith('.css')) {\n console.log(`[l5e] CSS changed: ${relPath} - using Vite HMR`);\n return; // Let Vite handle CSS HMR\n }\n\n if (file.includes('client.ts')) {\n console.log(`[l5e] Client JS changed: ${relPath} - using Vite HMR`);\n return; // Let Vite handle client JS HMR\n }\n\n // Trigger full page reload for SSR-related file changes (components, loaders, routes)\n // This ensures that server-side rendered components update properly\n if (file.includes('/src/') || file.includes('\\\\src\\\\')) {\n console.log(`[l5e] SSR file changed: ${relPath} - triggering full reload`);\n server.ws.send({\n type: 'full-reload',\n path: '*',\n });\n return []; // Prevent Vite's default HMR behavior\n }\n },\n\n buildEnd(error) {\n if (!error && clientBuild && planner) {\n const modules = [...this.getModuleIds()]\n .map((id) => this.getModuleInfo(id))\n .filter((mod) => mod !== null);\n for (const warning of planner.analyze(modules)) this.warn(`[l5e chunking] ${warning}`);\n }\n // Cleanup temporary files after build\n const tempDir = join(rootDir, '.l5e-temp');\n if (existsSync(tempDir)) {\n try {\n rmSync(tempDir, { recursive: true, force: true });\n console.log('[l5e] Cleaned up temporary files');\n } catch (error) {\n console.warn('[l5e] Failed to cleanup temporary files:', error);\n }\n }\n },\n\n writeBundle(_options, _bundle) {\n // Emit action registry JSON for production server\n if (actionRegistry.size > 0) {\n const outDir = join(rootDir, 'dist', 'server');\n if (!existsSync(outDir)) {\n mkdirSync(outDir, { recursive: true });\n }\n const registryObj = Object.fromEntries(actionRegistry);\n writeFileSync(join(outDir, 'action-registry.json'), JSON.stringify(registryObj), 'utf-8');\n console.log(`[l5e] Wrote action-registry.json (${actionRegistry.size} actions)`);\n }\n },\n\n config(userConfig) {\n // Auto-discover bundler input from useCss and useClientJs\n const projectRoot = userConfig.root || process.cwd();\n const output = userConfig.build?.rolldownOptions?.output;\n const configureChunks = !userConfig.build?.ssr && planner !== null;\n if (\n configureChunks &&\n (Array.isArray(output) || output?.manualChunks || output?.codeSplitting !== undefined)\n ) {\n throw new Error(\n '[l5e chunking] Use coreVite({ chunking: { shared: [...] } }) or set chunking: false when configuring raw Rolldown chunk placement.',\n );\n }\n const discovered = discoverBundlerInput(projectRoot);\n\n // Store island registries for use in other hooks\n islandRegistry = discovered.islandRegistry;\n pathToKey = discovered.pathToKey;\n keyToSrc = discovered.keyToSrc;\n actionRegistry = discovered.actionRegistry;\n\n // Merge with existing rolldownOptions.input if any\n const existingInput = userConfig.build?.rolldownOptions?.input || {};\n const mergedInput =\n typeof existingInput === 'object' && !Array.isArray(existingInput)\n ? { ...discovered.input, ...existingInput }\n : discovered.input;\n if (options.chunking && options.chunking.mode === 'compact') {\n mergedInput['l5e-compact-renderer'] = VIRTUAL_L5E_COMPACT_RENDERER;\n }\n\n return {\n build: {\n ...(options.chunking && options.chunking.mode === 'compact'\n ? {\n modulePreload: {\n resolveDependencies: (_filename: string, dependencies: string[]) =>\n dependencies.filter((dependency) => !/\\.[cm]?js(?:\\?|$)/.test(dependency)),\n },\n }\n : {}),\n rolldownOptions: {\n ...userConfig.build?.rolldownOptions,\n input: Object.keys(mergedInput).length > 0 ? mergedInput : undefined,\n // Preserve exports for island component entries — without this,\n // The bundler tree-shakes their exports since nothing imports them\n // (they're loaded at runtime via dynamic import from the island runtime).\n preserveEntrySignatures: configureChunks ? 'allow-extension' : 'exports-only',\n ...(configureChunks\n ? {\n output: {\n ...output,\n strictExecutionOrder: true,\n codeSplitting: { groups: planner!.groups() },\n entryFileNames: (chunk) => {\n const source = chunk.facadeModuleId?.replace(/\\\\/g, '/') || '';\n if (source.endsWith('/src/client.global.ts'))\n return 'assets/global-[hash].js';\n if (/\\/react\\//.test(source))\n return chunk.name.startsWith('island-')\n ? 'assets/[name]-[hash].js'\n : 'assets/island-[name]-[hash].js';\n return 'assets/bundle-[name]-[hash].js';\n },\n chunkFileNames: (chunk) =>\n chunk.name.startsWith('shared-')\n ? 'assets/[name]-[hash].js'\n : chunk.name === 'shared'\n ? 'assets/shared-[hash].js'\n : chunk.isDynamicEntry\n ? 'assets/bundle-[name]-[hash].js'\n : 'assets/shared-[name]-[hash].js',\n },\n }\n : {}),\n },\n },\n } satisfies UserConfig;\n },\n\n resolveId(id) {\n if (id === VIRTUAL_L5E_VIEWS) {\n return '\\0' + VIRTUAL_L5E_VIEWS;\n }\n if (id === VIRTUAL_L5E_ROUTE) {\n return '\\0' + VIRTUAL_L5E_ROUTE;\n }\n if (id === VIRTUAL_L5E_SSR_ENTRY) {\n return '\\0' + VIRTUAL_L5E_SSR_ENTRY;\n }\n if (id === VIRTUAL_L5E_GLOBAL_LOADER) {\n return '\\0' + VIRTUAL_L5E_GLOBAL_LOADER;\n }\n if (id === VIRTUAL_L5E_ISLAND_STRATEGIES) {\n return '\\0' + VIRTUAL_L5E_ISLAND_STRATEGIES;\n }\n if (id === VIRTUAL_L5E_ISLANDS) {\n return '\\0' + VIRTUAL_L5E_ISLANDS;\n }\n if (id === VIRTUAL_L5E_COMPACT_RENDERER) {\n return '\\0' + VIRTUAL_L5E_COMPACT_RENDERER;\n }\n if (id === VIRTUAL_L5E_ACTIONS) {\n return '\\0' + VIRTUAL_L5E_ACTIONS;\n }\n if (id === VIRTUAL_L5E_MIDDLEWARE) {\n return '\\0' + VIRTUAL_L5E_MIDDLEWARE;\n }\n return null;\n },\n\n async transform(code, id, transformOptions) {\n // Auto-inject island runtime into client.global.ts so it's always loaded globally\n if (id.replace(/\\\\/g, '/').endsWith('src/client.global.ts') && !transformOptions?.ssr) {\n return {\n code: `import '@withl5e/l5e/island/${options.chunking && options.chunking.mode === 'compact' ? 'compact-runtime' : 'runtime'}';\\n${code}`,\n map: null,\n };\n }\n\n // Client-side action transform: replace defineAction exports with fetch stubs\n // Supports actions anywhere under src/ (e.g., src/views/*, src/features/*, etc.)\n if (!transformOptions?.ssr) {\n const normalizedId = id.replace(/\\\\/g, '/');\n const actionMatch = normalizedId.match(/\\/src\\/(.+)\\/actions\\.(ts|tsx)$/);\n if (actionMatch) {\n const modulePath = actionMatch[1];\n\n // Parse exported action names\n const exportRegex = /export\\s+const\\s+(\\w+)\\s*=\\s*defineAction\\s*\\(/g;\n const actions: Array<{ name: string; method: string }> = [];\n let m;\n while ((m = exportRegex.exec(code)) !== null) {\n const name = m[1];\n // Find method for this action — scan from the defineAction( position\n const chunk = code.substring(m.index, m.index + 500);\n const methodMatch = chunk.match(/method:\\s*['\"](\\w+)['\"]/);\n const method = methodMatch ? methodMatch[1].toUpperCase() : 'GET';\n actions.push({ name, method });\n }\n\n if (actions.length > 0) {\n const stubs = actions.map(({ name, method }) => {\n const actionKey = `${name}_${shortHash(modulePath)}`;\n if (method === 'GET') {\n return `export async function ${name}(params) {\n const res = await fetch('/_l5e/action/${actionKey}?' + new URLSearchParams(params));\n if (!res.ok) throw Object.assign(new Error('HTTP ' + res.status), { status: res.status });\n return res;\n}`;\n }\n return `export async function ${name}(body) {\n const res = await fetch('/_l5e/action/${actionKey}', {\n method: '${method}',\n headers: { 'Content-Type': 'application/json' },\n body: JSON.stringify(body),\n });\n if (!res.ok) throw Object.assign(new Error('HTTP ' + res.status), { status: res.status });\n return res;\n}`;\n });\n\n return {\n code: stubs.join('\\n\\n'),\n map: null,\n };\n }\n }\n }\n\n // Skip node_modules\n if (id.includes('node_modules')) {\n return null;\n }\n\n // Skip files in /react/ directories\n if (id.includes('/react/') || id.includes('\\\\react\\\\')) {\n return null;\n }\n\n // Check if this is a JSX/TSX file that needs L5E JSX transformation\n const isJsxFile = /\\.(tsx|jsx)$/.test(id);\n\n if (isJsxFile) {\n try {\n const injected = `import { Fragment as __Fragment, jsxFactory } from \"@withl5e/l5e/jsx-runtime\"\\n${code}`;\n\n // Transform JSX using esbuild with L5E's JSX runtime (async)\n const result = await transform(injected, {\n loader: id.endsWith('.tsx') ? 'tsx' : 'jsx',\n jsx: 'transform',\n jsxFactory: 'jsxFactory',\n jsxFragment: '__Fragment',\n sourcemap: true,\n sourcefile: id,\n target: 'es2020',\n });\n\n let transformedCode = result.code;\n\n // Inject __key and __src for ALL ClientIsland calls\n if (transformedCode.includes('ClientIsland')) {\n transformedCode = injectIslandKeys(transformedCode, id, rootDir, pathToKey, keyToSrc);\n }\n\n return {\n code: transformedCode,\n map: result.map || null,\n };\n } catch (error) {\n // Log error but let Vite handle it\n console.error(`[l5e] Failed to transform JSX in ${id}:`, error);\n throw error;\n }\n }\n\n // Transform import.meta.env thà nh process.env ở server side\n // Server side có thể access tất cả env variables\n // Client side chỉ access được VITE_ env variables\n // Transform nà y chạy ở runtime khi module được load trong SSR context\n if (transformOptions?.ssr) {\n let transformedCode = code;\n let hasChanges = false;\n\n // Thay thế import.meta.env.VARIABLE_NAME thà nh process.env.VARIABLE_NAME\n // Match: import.meta.env.VITE_EVENT_CATEGORY_SLUG\n transformedCode = transformedCode.replace(\n /import\\.meta\\.env\\.([a-zA-Z_][a-zA-Z0-9_]*)/g,\n (match, varName) => {\n // Leave Vite's built-in env vars for Vite to handle.\n if (VITE_RESERVED_ENV.has(varName)) return match;\n hasChanges = true;\n return `process.env.${varName}`;\n },\n );\n\n // Thay thế import.meta.env['VARIABLE_NAME'] hoặc import.meta.env[\"VARIABLE_NAME\"]\n // thà nh process.env['VARIABLE_NAME'] hoặc process.env[\"VARIABLE_NAME\"]\n // Match: import.meta.env['VITE_EVENT_CATEGORY_SLUG'] hoặc import.meta.env[\"VITE_EVENT_CATEGORY_SLUG\"]\n transformedCode = transformedCode.replace(\n /import\\.meta\\.env\\[(['\"`])([^'\"`]+)\\1\\]/g,\n (match, quote, varName) => {\n // Leave Vite's built-in env vars for Vite to handle.\n if (VITE_RESERVED_ENV.has(varName)) return match;\n hasChanges = true;\n return `process.env[${quote}${varName}${quote}]`;\n },\n );\n\n if (hasChanges) {\n return {\n code: transformedCode,\n map: null, // Không cần source map cho env transform\n };\n }\n }\n return null;\n },\n\n load(id) {\n // Virtual module: l5e-views\n if (id === '\\0' + VIRTUAL_L5E_VIEWS) {\n return `\nexport const viewLoaders = import.meta.glob('/src/views/*/loader.{ts,tsx}');\nexport const viewComponents = import.meta.glob('/src/views/*/index.tsx');\n`;\n }\n\n // Virtual module: l5e-route\n if (id === '\\0' + VIRTUAL_L5E_ROUTE) {\n // Load /src/route.ts LAZILY (dynamic import inside the handler) rather\n // than via a static `export { default } from '/src/route.ts'`.\n //\n // A static re-export drags the user's route module — and everything it\n // imports — into entry-server's *static* SSR graph. Route files commonly\n // import the `@withl5e/l5e` barrel (for RedirectException, types, ...),\n // and that barrel re-exports `render` from entry-server. That closes a\n // static import cycle:\n // entry-server → virtual:l5e-route → /src/route.ts → @withl5e/l5e → entry-server\n // On the first dev request Vite can begin evaluating entry-server while\n // it is still suspended awaiting this very import, so `render()` runs\n // before `const __vite_ssr_import_N__ = await import('virtual:l5e-route')`\n // has been assigned — throwing \"Cannot access '__vite_ssr_import_N__'\n // before initialization\". A page reload \"fixes\" it only because the graph\n // is fully warm the second time.\n //\n // Importing lazily removes /src/route.ts from the static graph: entry-server\n // finishes initializing first, and the route module (with its barrel import\n // back to a now-complete entry-server) is pulled only on the first render()\n // call. No manual caching — Vite/ESM caches the evaluated module and later\n // imports still observe HMR invalidations of route.ts.\n return `export default function routeHandler(requestInfo) {\n return import('/src/route.ts').then((mod) => mod.default(requestInfo));\n}`;\n }\n\n // Virtual module: l5e-ssr-entry\n if (id === '\\0' + VIRTUAL_L5E_SSR_ENTRY) {\n return `export { render } from '@withl5e/l5e/entry-server';\nexport { viewActions } from 'virtual:l5e-actions';`;\n }\n\n // Virtual module: l5e-global-loader\n if (id === '\\0' + VIRTUAL_L5E_GLOBAL_LOADER) {\n return `export const globalLoader = import.meta.glob('/src/global-loader.{ts,tsx}', { eager: false });`;\n }\n\n // Virtual module: l5e-actions\n if (id === '\\0' + VIRTUAL_L5E_ACTIONS) {\n const registryObj = Object.fromEntries(actionRegistry);\n return `export const viewActions = import.meta.glob('/src/**/actions.{ts,tsx}');\nexport const actionRegistry = ${JSON.stringify(registryObj)};`;\n }\n\n // Virtual module: l5e-middleware\n if (id === '\\0' + VIRTUAL_L5E_MIDDLEWARE) {\n return `\nconst middlewareModules = import.meta.glob([\n '/src/middleware.{ts,tsx,js,jsx}',\n '/src/middleware/index.{ts,tsx,js,jsx}',\n]);\n\nconst middlewarePaths = [\n '/src/middleware.ts',\n '/src/middleware.tsx',\n '/src/middleware.js',\n '/src/middleware.jsx',\n '/src/middleware/index.ts',\n '/src/middleware/index.tsx',\n '/src/middleware/index.js',\n '/src/middleware/index.jsx',\n];\n\nexport async function loadMiddleware() {\n const middlewarePath = middlewarePaths.find((path) => middlewareModules[path]);\n if (!middlewarePath) return undefined;\n\n const mod = await middlewareModules[middlewarePath]();\n return mod.onRequest;\n}\n`;\n }\n\n // Virtual module: l5e-islands\n // Lazy glob of all React island components so the SSR entry can import a\n // component by its __src path and renderToString() it. Non-eager → only\n // islands actually present on a page (with ssr) get imported at runtime.\n if (id === '\\0' + VIRTUAL_L5E_ISLANDS) {\n return `export const islandModules = import.meta.glob('/src/**/react/*.{tsx,jsx}');`;\n }\n if (id === '\\0' + VIRTUAL_L5E_COMPACT_RENDERER) {\n return `export * as reactDomClient from 'react-dom/client'; export { createElement } from 'react';`;\n }\n\n // Virtual module: l5e-island-strategies\n if (id === '\\0' + VIRTUAL_L5E_ISLAND_STRATEGIES) {\n // Check if src/island-strategies.ts exists\n const strategiesFile = join(rootDir, 'src', 'island-strategies.ts');\n if (existsSync(strategiesFile)) {\n // Re-export user's file → Vite will build this file\n return `import '/src/island-strategies.ts';`;\n }\n // No file → empty module, no error\n return `/* no custom island strategies */`;\n }\n\n return null;\n },\n };\n}\n\nexport default coreVite;\n"],"mappings":";;;;;;;AA6BA,IAAM,KAAa,MAAe,EAAG,QAAQ,OAAO,GAAG,GACjD,KAAU,MAAkB,EAAW,QAAQ,CAAC,CAAC,OAAO,CAAK,CAAC,CAAC,OAAO,KAAK,CAAC,CAAC,MAAM,GAAG,CAAC;AAG7F,SAAS,EAAY,GAAgC;CACnD,IAAM,IAAS,EAAU,CAAE,CAAC,CAAC,MAAM,gBAAgB,CAAC,CAAC,GAAG,EAAE;CAC1D,IAAI,MAAW,EAAU,CAAE,GAAG;CAC9B,IAAM,IAAQ,EAAQ,MAAM,GAAG;CAC/B,OAAO,EAAM,EAAE,CAAC,WAAW,GAAG,IAAI,EAAM,MAAM,GAAG,CAAC,CAAC,CAAC,KAAK,GAAG,IAAI,EAAM;AACxE;AAKA,SAAgB,EAAmB,IAA2B,CAAC,GAAG;CAChE,IAAM,IAAQ,EAAQ,UAAU,CAAC;CACjC,IAAI,EAAQ,SAAS,aAAa,EAAM,SAAS,GAC/C,MAAU,MAAM,iEAAiE;CAEnF,IAAM,oBAAQ,IAAI,IAAY;CAC9B,KAAK,IAAM,KAAQ,GAAO;EACxB,IAAI,CAAC,8BAA8B,KAAK,EAAK,IAAI,KAAK,EAAM,IAAI,EAAK,IAAI,GACvE,MAAU,MAAM,qDAAqD,EAAK,MAAM;EAElF,IAAI,CAAC,EAAK,UAAU,UAAU,CAAC,EAAK,SAAS,QAC3C,MAAU,MAAM,wBAAwB,EAAK,KAAK,4BAA4B;EAEhF,IAAI,EAAK,YAAY,KAAA,MAAc,CAAC,OAAO,SAAS,EAAK,OAAO,KAAK,EAAK,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,IAAkB,GAClB,IAAa;IA2BjB,IAvBA,IAAkB,EAAgB,QAChC,iDACC,GAAO,MAEF,EAAkB,IAAI,CAAO,IAAU,KAC3C,IAAa,IACN,eAAe,IAE1B,GAKA,IAAkB,EAAgB,QAChC,6CACC,GAAO,GAAO,MAET,EAAkB,IAAI,CAAO,IAAU,KAC3C,IAAa,IACN,eAAe,IAAQ,IAAU,EAAM,GAElD,GAEI,GACF,OAAO;KACL,MAAM;KACN,KAAK;IACP;GAEJ;GACA,OAAO;EACT;EAEA,KAAK,GAAI;GAEP,IAAI,MAAO,uBACT,OAAO;GAOT,IAAI,MAAO,uBAsBT,OAAO;GAMT,IAAI,MAAO,2BACT,OAAO;GAKT,IAAI,MAAO,+BACT,OAAO;GAIT,IAAI,MAAO,yBAA4B;IACrC,IAAM,IAAc,OAAO,YAAY,CAAc;IACrD,OAAO;gCACiB,KAAK,UAAU,CAAW,EAAE;GACtD;GAGA,IAAI,MAAO,4BACT,OAAO;GA+BT,IAAI,MAAO,yBACT,OAAO;GAET,IAAI,MAAO,kCACT,OAAO;GAIT,IAAI,MAAO,mCAAsC;IAE/C,IAAM,IAAiBA,EAAK,GAAS,OAAO,sBAAsB;IAMlE,OALI,EAAW,CAAc,IAEpB,wCAGF;GACT;GAEA,OAAO;EACT;CACF;AACF"}
|
package/dist/vite-plugin.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { t as e } from "./vite-plugin-
|
|
1
|
+
import { t as e } from "./vite-plugin-R3LFxv9a.js";
|
|
2
2
|
export { e as coreVite, e as default };
|