@withl5e/l5e 1.1.0-alpha.0 → 1.1.0-alpha.2

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.
@@ -13,94 +13,136 @@ 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 || [], n = /* @__PURE__ */ new Set();
17
- for (let e of t) {
18
- if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(e.name) || n.has(e.name)) throw Error(`[l5e chunking] Invalid or duplicate shared group: ${e.name}`);
19
- if (!e.packages?.length && !e.modules?.length) throw Error(`[l5e chunking] Group ${e.name} needs packages or modules.`);
20
- if (e.maxSize !== void 0 && (!Number.isFinite(e.maxSize) || e.maxSize <= 0)) throw Error(`[l5e chunking] Invalid maxSize for ${e.name}`);
21
- n.add(e.name);
16
+ let t = e.shared || [], n = e.islandRuntime;
17
+ if (n && !n.packages?.length && !n.modules?.length) throw Error("[l5e chunking] islandRuntime needs packages or modules.");
18
+ if (e.mode === "compact" && t.length > 1) throw Error("[l5e chunking] Compact mode accepts one canonical shared group.");
19
+ let r = /* @__PURE__ */ new Set();
20
+ for (let n of t) {
21
+ if (!/^[a-zA-Z0-9][a-zA-Z0-9_-]*$/.test(n.name) || r.has(n.name)) throw Error(`[l5e chunking] Invalid or duplicate shared group: ${n.name}`);
22
+ if (!n.packages?.length && !n.modules?.length) throw Error(`[l5e chunking] Group ${n.name} needs packages or modules.`);
23
+ if (n.maxSize !== void 0 && (!Number.isFinite(n.maxSize) || n.maxSize <= 0)) throw Error(`[l5e chunking] Invalid maxSize for ${n.name}`);
24
+ if (e.mode === "compact" && n.maxSize !== void 0) throw Error(`[l5e chunking] Compact mode cannot use maxSize for ${n.name}; it would split the canonical shared file.`);
25
+ r.add(n.name);
22
26
  }
23
- 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));
27
+ let i = "", a = /* @__PURE__ */ new Map(), o = /* @__PURE__ */ new Set(), s = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Set(), u = (e) => _(e) ? `npm:${h(e).split("/node_modules/").at(-1)}` : h(c.relative(i, e));
24
28
  return {
25
- async resolve(e, n) {
26
- r = e, i.clear(), a.clear(), o.clear();
29
+ async resolve(e, r) {
30
+ i = e, a.clear(), o = /* @__PURE__ */ new Set(), s.clear(), l.clear();
27
31
  for (let e of t) {
28
32
  let t = /* @__PURE__ */ new Set();
29
- for (let i of e.modules || []) {
30
- let a = await n(i, c.join(r, "index.html"));
31
- if (!a) throw Error(`[l5e chunking] Cannot resolve ${i} in ${e.name}`);
33
+ for (let n of e.modules || []) {
34
+ let a = await r(n, c.join(i, "index.html"));
35
+ if (!a) throw Error(`[l5e chunking] Cannot resolve ${n} in ${e.name}`);
32
36
  t.add(a);
33
37
  }
34
- i.set(e, t);
38
+ a.set(e, t);
39
+ }
40
+ if (n) for (let e of n.modules || []) {
41
+ let t = await r(e, c.join(i, "index.html"));
42
+ if (!t) throw Error(`[l5e chunking] Cannot resolve ${e} in islandRuntime`);
43
+ o.add(t);
35
44
  }
36
45
  },
37
- analyze(e) {
38
- a.clear();
39
- let n = new Map(e.map((e) => [e.id, e])), r = e.filter((e) => e.isEntry || e.dynamicImporters.length > 0), c = /* @__PURE__ */ new Map();
40
- for (let e of r) {
41
- let t = /* @__PURE__ */ new Set(), r = (i) => {
42
- if (t.has(i)) return;
43
- t.add(i);
44
- let a = n.get(i);
46
+ analyze(r) {
47
+ s.clear();
48
+ let i = new Map(r.map((e) => [e.id, e]));
49
+ if (e.mode === "compact") {
50
+ let e = /* @__PURE__ */ new Map();
51
+ for (let t of r.filter((e) => e.isEntry)) {
52
+ let n = (r, a) => {
53
+ let o = e.get(r) || /* @__PURE__ */ new Map(), s = o.get(t.id);
54
+ if (s === !1 || s === a) return;
55
+ o.set(t.id, a), e.set(r, o);
56
+ let c = i.get(r);
57
+ c && (c.importedIds.forEach((e) => n(e, a)), c.dynamicallyImportedIds.forEach((e) => n(e, !0)));
58
+ };
59
+ n(t.id, !1);
60
+ }
61
+ let t = r.find((e) => e.isEntry && h(e.id).endsWith("/src/client.global.ts"));
62
+ if (t) {
63
+ 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: ${u(n)}. Import it statically from global or place state behind an explicit shared root.`);
64
+ }
65
+ }
66
+ let c = r.filter((e) => e.isEntry || e.dynamicImporters.length > 0), d = /* @__PURE__ */ new Map();
67
+ for (let e of c) {
68
+ let t = /* @__PURE__ */ new Set(), n = (r) => {
69
+ if (t.has(r)) return;
70
+ t.add(r);
71
+ let a = i.get(r);
45
72
  if (!a) return;
46
- let o = c.get(i) || /* @__PURE__ */ new Set();
47
- o.add(e.id), c.set(i, o), a.importedIds.forEach(r);
73
+ let o = d.get(r) || /* @__PURE__ */ new Set();
74
+ o.add(e.id), d.set(r, o), a.importedIds.forEach(n);
48
75
  };
49
- r(e.id);
76
+ n(e.id);
50
77
  }
51
- let l = (e) => n.get(e).isEntry ? h(e).endsWith("/src/client.global.ts") ? 0 : /\/react\//.test(h(e)) && !_(e) ? 2 : 1 : 3, u = /* @__PURE__ */ new Set();
52
- for (let n of e) {
53
- let e = [...c.get(n.id) || []].sort(), r = e.map(s).sort(), d = t.filter((e) => i.get(e)?.has(n.id) || e.packages?.includes(_(n.id) || "")).sort((e, t) => (t.priority || 0) - (e.priority || 0));
54
- d.forEach((e) => u.add(e)), d.length > 1 && o.add(`${s(n.id)} matches ${d.map((e) => e.name).join(", ")}; using ${d[0].name}.`);
55
- let f = null, p = "Private dependency stays with its entry or dynamic import.";
56
- if (!n.isEntry && e.length && d.length) {
57
- let t = Math.min(...e.map(l)), n = t === 3 ? `lazy-${g(JSON.stringify(r))}` : [
78
+ let f = (e) => i.get(e).isEntry ? h(e).endsWith("/src/client.global.ts") ? 0 : h(e).includes("virtual:l5e-compact-renderer") || /\/react\//.test(h(e)) && !_(e) ? 2 : 1 : 3, p = /* @__PURE__ */ new Set();
79
+ for (let i of r) {
80
+ let r = [...d.get(i.id) || []].sort(), c = r.map(u).sort(), m = t.filter((e) => a.get(e)?.has(i.id) || e.packages?.includes(_(i.id) || "")).sort((e, t) => (t.priority || 0) - (e.priority || 0));
81
+ m.forEach((e) => p.add(e)), m.length > 1 && l.add(`${u(i.id)} matches ${m.map((e) => e.name).join(", ")}; using ${m[0].name}.`);
82
+ let v = null, y = "Private dependency stays with its entry or dynamic import.", b = _(i.id), x = o.has(i.id) || n?.packages?.includes(b || "") === !0;
83
+ if (e.mode === "compact" && h(i.id).includes("virtual:l5e-compact-renderer")) v = "lazy-react-runtime", y = "Renderer joins the canonical React runtime activation.";
84
+ else if (e.mode === "compact" && !i.isEntry && (b === "react" || b === "react-dom" || b === "scheduler") && r.length > 0 && r.every((e) => f(e) >= 2)) v = "lazy-react-runtime", y = "Canonical React runtime is fetched when the first island activates.";
85
+ else if (!i.isEntry && r.length && m.length) {
86
+ let t = Math.min(...r.map(f)), n = t === 3 ? `lazy-${g(JSON.stringify(c))}` : [
58
87
  "global",
59
88
  "page",
60
89
  "island"
61
90
  ][t];
62
- f = `shared-${d[0].name}-${n}`, p = `Configured group ${d[0].name}; activation ${n}.`;
63
- } else !n.isEntry && e.length > 1 && (f = `shared-auto-${g(JSON.stringify(r))}`, p = "Shared by the same static consumers; preserves dynamic import roots.");
64
- a.set(n.id, {
65
- group: f,
66
- rule: d[0]?.name,
67
- consumers: r,
68
- reason: p
91
+ v = e.mode === "compact" ? "shared" : `shared-${m[0].name}-${n}`, y = `Configured group ${m[0].name}; activation ${n}.`;
92
+ } else e.mode === "compact" && !i.isEntry && x ? (v = "lazy-react-runtime", y = "Configured canonical island runtime is fetched with the first island consumer.") : e.mode === "compact" && !i.isEntry && r.some((e) => f(e) === 0) && r.some((e) => f(e) > 0) ? (v = "global-owner", y = "Static global/page overlap is exported by the canonical global artifact.") : e.mode !== "compact" && !i.isEntry && r.length > 1 && (v = `shared-auto-${g(JSON.stringify(c))}`, y = "Shared by the same static consumers; preserves dynamic import roots.");
93
+ s.set(i.id, {
94
+ group: v,
95
+ rule: m[0]?.name,
96
+ consumers: c,
97
+ reason: y
69
98
  });
70
99
  }
71
- for (let e of t) u.has(e) || o.add(`Group ${e.name} matched no modules in this client build.`);
72
- return [...o];
100
+ for (let e of t) p.has(e) || l.add(`Group ${e.name} matched no modules in this client build.`);
101
+ return [...l];
73
102
  },
74
103
  groups() {
75
- return [...t.map((e) => ({
76
- name: (t) => {
77
- let n = a.get(t);
78
- return n?.rule === e.name ? n.group : null;
104
+ return [
105
+ ...t.map((t) => ({
106
+ name: (e) => {
107
+ let n = s.get(e);
108
+ return n?.rule === t.name ? n.group : null;
109
+ },
110
+ maxSize: t.maxSize,
111
+ includeDependenciesRecursively: e.mode === "compact"
112
+ })),
113
+ {
114
+ name: (e) => s.get(e)?.group === "lazy-react-runtime" ? "lazy-react-runtime" : null,
115
+ includeDependenciesRecursively: !0
79
116
  },
80
- maxSize: e.maxSize,
81
- includeDependenciesRecursively: !1
82
- })), {
83
- name: (e) => a.get(e)?.group || null,
84
- includeDependenciesRecursively: !1
85
- }];
117
+ {
118
+ name: (e) => {
119
+ let t = s.get(e)?.group;
120
+ return t === "lazy-react-runtime" ? null : t || null;
121
+ },
122
+ includeDependenciesRecursively: !1
123
+ }
124
+ ];
86
125
  },
87
- report(e) {
126
+ report(t) {
88
127
  return {
89
- version: 1,
90
- warnings: [...o],
91
- chunks: Object.values(e).flatMap((e) => {
92
- if (e.type !== "chunk") return [];
93
- let t = e.facadeModuleId ? s(e.facadeModuleId) : null, n = t === "src/client.global.ts" ? "global" : t && /(?:^|\/)react\//.test(t) ? "island" : e.isEntry || e.isDynamicEntry ? "page" : "shared";
128
+ version: 2,
129
+ mode: e.mode || "default",
130
+ warnings: [...l],
131
+ chunks: Object.values(t).flatMap((t) => {
132
+ if (t.type !== "chunk") return [];
133
+ let n = t.facadeModuleId ? u(t.facadeModuleId) : null, r = n === "src/client.global.ts" ? "global" : n && /(?:^|\/)react\//.test(n) ? "island" : t.isEntry || t.isDynamicEntry ? "page" : "shared";
94
134
  return [{
95
- file: e.fileName,
96
- kind: n,
97
- source: t,
98
- bytes: Buffer.byteLength(e.code),
99
- imports: e.imports,
100
- dynamicImports: e.dynamicImports,
101
- modules: Object.keys(e.modules).map((e) => ({
102
- id: s(e),
103
- ...a.get(e)
135
+ file: t.fileName,
136
+ kind: r,
137
+ canonicalShared: e.mode === "compact" && t.name === "shared",
138
+ canonicalGlobal: e.mode === "compact" && t.name === "global-owner",
139
+ source: n,
140
+ bytes: Buffer.byteLength(t.code),
141
+ imports: t.imports,
142
+ dynamicImports: t.dynamicImports,
143
+ modules: Object.keys(t.modules).map((e) => ({
144
+ id: u(e),
145
+ ...s.get(e)
104
146
  }))
105
147
  }];
106
148
  })
@@ -110,7 +152,7 @@ function v(e = {}) {
110
152
  }
111
153
  //#endregion
112
154
  //#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-actions", E = "virtual:l5e-middleware", D = /* @__PURE__ */ new Set([
155
+ 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
156
  "MODE",
115
157
  "BASE_URL",
116
158
  "PROD",
@@ -118,30 +160,30 @@ var y = "virtual:l5e-views", b = "virtual:l5e-route", x = "virtual:l5e-ssr-entry
118
160
  "SSR",
119
161
  "LEGACY"
120
162
  ]);
121
- function O(e, t = []) {
163
+ function k(e, t = []) {
122
164
  let n = i(e);
123
165
  for (let r of n) {
124
166
  let n = f(e, r);
125
167
  if (o(n).isDirectory()) {
126
168
  if (r === "node_modules" || r === "dist" || r === ".git") continue;
127
- O(n, t);
169
+ k(n, t);
128
170
  } else (r.endsWith(".tsx") || r.endsWith(".ts")) && t.push(n);
129
171
  }
130
172
  return t;
131
173
  }
132
- function k(e) {
174
+ function A(e) {
133
175
  let t = 0;
134
176
  for (let n = 0; n < e.length; n++) t = (t << 5) - t + e.charCodeAt(n), t &= t;
135
177
  return Math.abs(t).toString(16).slice(0, 4);
136
178
  }
137
- function A(e) {
179
+ function j(e) {
138
180
  let t = e.split("/"), n = t[t.length - 1];
139
181
  return n = n.replace(/\.(tsx?|jsx?)$/, ""), n;
140
182
  }
141
- function j(e) {
142
- return `${A(e)}_${k(e)}`;
183
+ function M(e) {
184
+ return `${j(e)}_${A(e)}`;
143
185
  }
144
- function M(e, n) {
186
+ function N(e, n) {
145
187
  let r = e.replace(/^\//, ""), i = m(n, r);
146
188
  for (let e of [
147
189
  ".tsx",
@@ -151,7 +193,7 @@ function M(e, n) {
151
193
  ]) if (t(i + e)) return r + e;
152
194
  return t(i) ? r : null;
153
195
  }
154
- function N(e, t) {
196
+ function P(e, t) {
155
197
  let n = r(e, "utf-8"), i = [], a = /<ClientIsland\s[^>]*?from\s*=\s*"([^"]+)"/g, o = /* @__PURE__ */ new Set(), s;
156
198
  for (; (s = a.exec(n)) !== null;) {
157
199
  let n = s[1], r;
@@ -161,14 +203,14 @@ function N(e, t) {
161
203
  let i = m(e, "..", n);
162
204
  r = "/" + p(t, i).replace(/\\/g, "/");
163
205
  } else r = n;
164
- let a = M(r, t);
206
+ let a = N(r, t);
165
207
  if (!a) {
166
208
  console.warn(`[l5e] Island component not found: ${r} (from ${n} in ${e})`);
167
209
  continue;
168
210
  }
169
- let c = j(r);
211
+ let c = M(r);
170
212
  o.has(c) || (o.add(c), i.push({
171
- component: A(r),
213
+ component: j(r),
172
214
  resolvedPath: r,
173
215
  src: a,
174
216
  key: c
@@ -176,7 +218,7 @@ function N(e, t) {
176
218
  }
177
219
  return i;
178
220
  }
179
- function P(e, t) {
221
+ function F(e, t) {
180
222
  let n = r(e, "utf-8"), i = [], a = [], o = /useCss\s*\(\s*['"]([^'"]+)['"]\s*,?\s*\)/g, s = /useClientJs\s*\(\s*['"]([^'"]+)['"]\s*,?\s*\)/g, c;
181
223
  for (; (c = o.exec(n)) !== null;) {
182
224
  let n = c[1];
@@ -199,7 +241,7 @@ function P(e, t) {
199
241
  js: a
200
242
  };
201
243
  }
202
- function F(n) {
244
+ function I(n) {
203
245
  let i = {}, a = f(n, "src"), s = /* @__PURE__ */ new Map(), c = /* @__PURE__ */ new Map(), l = /* @__PURE__ */ new Map(), u = /* @__PURE__ */ new Map();
204
246
  try {
205
247
  if (!o(a).isDirectory()) return {
@@ -213,17 +255,17 @@ function F(n) {
213
255
  t(h) && (i.global = h, console.log("[l5e] Detected src/client.global.ts and added as entry"));
214
256
  let g = e(n);
215
257
  g && (i["global-style"] = g, console.log("[l5e] Detected src/global.css and added as global stylesheet"));
216
- let _ = O(a), v = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set();
258
+ let _ = k(a), v = /* @__PURE__ */ new Set(), y = /* @__PURE__ */ new Set();
217
259
  for (let e of _) {
218
- let { css: t, js: i } = P(e, n);
260
+ let { css: t, js: i } = F(e, n);
219
261
  t.forEach((e) => v.add(e)), i.forEach((e) => y.add(e));
220
- let o = N(e, n);
262
+ let o = P(e, n);
221
263
  for (let e of o) s.set(e.key, e.resolvedPath), c.set(e.resolvedPath, e.key), l.set(e.key, e.src);
222
264
  let f = e.replace(/\\/g, "/");
223
265
  if (/\/actions\.(ts|tsx)$/.test(f)) {
224
266
  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
267
  for (; (i = n.exec(t)) !== null;) {
226
- let e = i[1], t = `${e}_${k(o)}`;
268
+ let e = i[1], t = `${e}_${A(o)}`;
227
269
  u.set(t, {
228
270
  modulePath: o,
229
271
  actionName: e
@@ -266,7 +308,7 @@ function F(n) {
266
308
  actionRegistry: u
267
309
  };
268
310
  }
269
- function I(e, t, n, r, i) {
311
+ function L(e, t, n, r, i) {
270
312
  let a = [], o = 0, s = /ClientIsland\s*,\s*\{/g, c;
271
313
  for (; (c = s.exec(e)) !== null;) {
272
314
  let s = c.index + c[0].length, l = e.substring(s, s + 500), u = /from:\s*"([^"]+)"/.exec(l);
@@ -287,7 +329,7 @@ function I(e, t, n, r, i) {
287
329
  }
288
330
  return a.push(e.substring(o)), a.join("");
289
331
  }
290
- function L(e = {}) {
332
+ function R(e = {}) {
291
333
  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
334
  return {
293
335
  name: "l5e-jsx-classic",
@@ -311,7 +353,7 @@ function L(e = {}) {
311
353
  handleHotUpdate({ file: e, server: t }) {
312
354
  let n = p(r, e);
313
355
  if (/actions\.(ts|tsx)$/.test(e)) {
314
- d = F(r).actionRegistry;
356
+ d = I(r).actionRegistry;
315
357
  let e = t.moduleGraph.getModuleById("\0virtual:l5e-actions");
316
358
  e && t.moduleGraph.invalidateModule(e), console.log(`[l5e] Action file changed: ${n} — re-scanned ${d.size} action(s)`);
317
359
  }
@@ -351,60 +393,63 @@ function L(e = {}) {
351
393
  s(f(e, "action-registry.json"), JSON.stringify(i), "utf-8"), console.log(`[l5e] Wrote action-registry.json (${d.size} actions)`);
352
394
  }
353
395
  },
354
- config(e) {
355
- let t = e.root || process.cwd(), n = e.build?.rolldownOptions?.output, r = !e.build?.ssr && o !== null;
356
- if (r && (Array.isArray(n) || n?.manualChunks || n?.codeSplitting !== void 0)) throw Error("[l5e chunking] Use coreVite({ chunking: { shared: [...] } }) or set chunking: false when configuring raw Rolldown chunk placement.");
357
- let i = F(t);
358
- i.islandRegistry, c = i.pathToKey, l = i.keyToSrc, d = i.actionRegistry;
359
- let a = e.build?.rolldownOptions?.input || {}, s = typeof a == "object" && !Array.isArray(a) ? {
360
- ...i.input,
361
- ...a
362
- } : i.input;
363
- return { build: { rolldownOptions: {
364
- ...e.build?.rolldownOptions,
365
- input: Object.keys(s).length > 0 ? s : void 0,
366
- preserveEntrySignatures: r ? "allow-extension" : "exports-only",
367
- ...r ? { output: {
368
- ...n,
369
- strictExecutionOrder: !0,
370
- codeSplitting: { groups: o.groups() },
371
- entryFileNames: (e) => {
372
- let t = e.facadeModuleId?.replace(/\\/g, "/") || "";
373
- 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";
374
- },
375
- chunkFileNames: (e) => e.name.startsWith("shared-") ? "assets/[name]-[hash].js" : e.isDynamicEntry ? "assets/bundle-[name]-[hash].js" : "assets/shared-[name]-[hash].js"
376
- } } : {}
377
- } } };
396
+ config(t) {
397
+ let n = t.root || process.cwd(), r = t.build?.rolldownOptions?.output, i = !t.build?.ssr && o !== null;
398
+ 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.");
399
+ let a = I(n);
400
+ a.islandRegistry, c = a.pathToKey, l = a.keyToSrc, d = a.actionRegistry;
401
+ let s = t.build?.rolldownOptions?.input || {}, u = typeof s == "object" && !Array.isArray(s) ? {
402
+ ...a.input,
403
+ ...s
404
+ } : a.input;
405
+ return e.chunking && e.chunking.mode === "compact" && (u["l5e-compact-renderer"] = T), { build: {
406
+ ...e.chunking && e.chunking.mode === "compact" ? { modulePreload: { resolveDependencies: (e, t, n) => n.hostType === "html" ? t.filter((e) => !/\.[cm]?js(?:\?|$)/.test(e)) : t } } : {},
407
+ rolldownOptions: {
408
+ ...t.build?.rolldownOptions,
409
+ input: Object.keys(u).length > 0 ? u : void 0,
410
+ preserveEntrySignatures: i ? "allow-extension" : "exports-only",
411
+ ...i ? { output: {
412
+ ...r,
413
+ strictExecutionOrder: !0,
414
+ codeSplitting: { groups: o.groups() },
415
+ entryFileNames: (e) => {
416
+ let t = e.facadeModuleId?.replace(/\\/g, "/") || "";
417
+ 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";
418
+ },
419
+ chunkFileNames: (e) => e.name.startsWith("shared-") ? "assets/[name]-[hash].js" : e.name === "shared" ? "assets/shared-[hash].js" : e.name === "lazy-react-runtime" ? "assets/lazy-react-runtime-[hash].js" : e.isDynamicEntry ? "assets/bundle-[name]-[hash].js" : "assets/shared-[name]-[hash].js"
420
+ } } : {}
421
+ }
422
+ } };
378
423
  },
379
424
  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-actions" : e === E ? "\0virtual:l5e-middleware" : null;
425
+ 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
426
  },
382
- async transform(e, t, n) {
383
- if (t.replace(/\\/g, "/").endsWith("src/client.global.ts") && !n?.ssr) return {
384
- code: `import '@withl5e/l5e/island/runtime';\n${e}`,
427
+ async transform(t, n, i) {
428
+ if (n.replace(/\\/g, "/").endsWith("src/client.global.ts") && !i?.ssr) return {
429
+ code: `import '@withl5e/l5e/island/${e.chunking && e.chunking.mode === "compact" ? "compact-runtime" : "runtime"}';\n${t}`,
385
430
  map: null
386
431
  };
387
- if (!n?.ssr) {
388
- let n = t.replace(/\\/g, "/").match(/\/src\/(.+)\/actions\.(ts|tsx)$/);
389
- if (n) {
390
- let t = n[1], r = /export\s+const\s+(\w+)\s*=\s*defineAction\s*\(/g, i = [], a;
391
- for (; (a = r.exec(e)) !== null;) {
392
- let t = a[1], n = e.substring(a.index, a.index + 500).match(/method:\s*['"](\w+)['"]/), r = n ? n[1].toUpperCase() : "GET";
432
+ if (!i?.ssr) {
433
+ let e = n.replace(/\\/g, "/").match(/\/src\/(.+)\/actions\.(ts|tsx)$/);
434
+ if (e) {
435
+ let n = e[1], r = /export\s+const\s+(\w+)\s*=\s*defineAction\s*\(/g, i = [], a;
436
+ for (; (a = r.exec(t)) !== null;) {
437
+ let e = a[1], n = t.substring(a.index, a.index + 500).match(/method:\s*['"](\w+)['"]/), r = n ? n[1].toUpperCase() : "GET";
393
438
  i.push({
394
- name: t,
439
+ name: e,
395
440
  method: r
396
441
  });
397
442
  }
398
443
  if (i.length > 0) return {
399
- code: i.map(({ name: e, method: n }) => {
400
- let r = `${e}_${k(t)}`;
401
- return n === "GET" ? `export async function ${e}(params) {
444
+ code: i.map(({ name: e, method: t }) => {
445
+ let r = `${e}_${A(n)}`;
446
+ return t === "GET" ? `export async function ${e}(params) {
402
447
  const res = await fetch('/_l5e/action/${r}?' + new URLSearchParams(params));
403
448
  if (!res.ok) throw Object.assign(new Error('HTTP ' + res.status), { status: res.status });
404
449
  return res;
405
450
  }` : `export async function ${e}(body) {
406
451
  const res = await fetch('/_l5e/action/${r}', {
407
- method: '${n}',
452
+ method: '${t}',
408
453
  headers: { 'Content-Type': 'application/json' },
409
454
  body: JSON.stringify(body),
410
455
  });
@@ -416,28 +461,28 @@ function L(e = {}) {
416
461
  };
417
462
  }
418
463
  }
419
- if (t.includes("node_modules") || t.includes("/react/") || t.includes("\\react\\")) return null;
420
- if (/\.(tsx|jsx)$/.test(t)) try {
421
- let n = `import { Fragment as __Fragment, jsxFactory } from "@withl5e/l5e/jsx-runtime"\n${e}`, i = await u(n, {
422
- loader: t.endsWith(".tsx") ? "tsx" : "jsx",
464
+ if (n.includes("node_modules") || n.includes("/react/") || n.includes("\\react\\")) return null;
465
+ if (/\.(tsx|jsx)$/.test(n)) try {
466
+ let e = `import { Fragment as __Fragment, jsxFactory } from "@withl5e/l5e/jsx-runtime"\n${t}`, i = await u(e, {
467
+ loader: n.endsWith(".tsx") ? "tsx" : "jsx",
423
468
  jsx: "transform",
424
469
  jsxFactory: "jsxFactory",
425
470
  jsxFragment: "__Fragment",
426
471
  sourcemap: !0,
427
- sourcefile: t,
472
+ sourcefile: n,
428
473
  target: "es2020"
429
474
  }), a = i.code;
430
- return a.includes("ClientIsland") && (a = I(a, t, r, c, l)), {
475
+ return a.includes("ClientIsland") && (a = L(a, n, r, c, l)), {
431
476
  code: a,
432
477
  map: i.map || null
433
478
  };
434
479
  } catch (e) {
435
- throw console.error(`[l5e] Failed to transform JSX in ${t}:`, e), e;
480
+ throw console.error(`[l5e] Failed to transform JSX in ${n}:`, e), e;
436
481
  }
437
- if (n?.ssr) {
438
- let t = e, n = !1;
439
- if (t = t.replace(/import\.meta\.env\.([a-zA-Z_][a-zA-Z0-9_]*)/g, (e, t) => D.has(t) ? e : (n = !0, `process.env.${t}`)), t = t.replace(/import\.meta\.env\[(['"`])([^'"`]+)\1\]/g, (e, t, r) => D.has(r) ? e : (n = !0, `process.env[${t}${r}${t}]`)), n) return {
440
- code: t,
482
+ if (i?.ssr) {
483
+ let e = t, n = !1;
484
+ 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 {
485
+ code: e,
441
486
  map: null
442
487
  };
443
488
  }
@@ -455,6 +500,7 @@ export const actionRegistry = ${JSON.stringify(e)};`;
455
500
  }
456
501
  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
502
  if (e === "\0virtual:l5e-islands") return "export const islandModules = import.meta.glob('/src/**/react/*.{tsx,jsx}');";
503
+ if (e === "\0virtual:l5e-compact-renderer") return "export * as reactDomClient from 'react-dom/client'; export { createElement } from 'react';";
458
504
  if (e === "\0virtual:l5e-island-strategies") {
459
505
  let e = f(r, "src", "island-strategies.ts");
460
506
  return t(e) ? "import '/src/island-strategies.ts';" : "/* no custom island strategies */";
@@ -464,6 +510,6 @@ export const actionRegistry = ${JSON.stringify(e)};`;
464
510
  };
465
511
  }
466
512
  //#endregion
467
- export { L as t };
513
+ export { R as t };
468
514
 
469
- //# sourceMappingURL=vite-plugin-D9qTnleZ.js.map
515
+ //# sourceMappingURL=vite-plugin-BOuzxmb2.js.map