@withl5e/l5e 1.0.1-rc.0 → 1.1.0-alpha.0
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/{server-DPBLtja1.js → server-CvsOU9cg.js} +74 -53
- package/dist/server-CvsOU9cg.js.map +1 -0
- package/dist/server.js +1 -1
- package/dist/vite-plugin-D9qTnleZ.js +469 -0
- package/dist/vite-plugin-D9qTnleZ.js.map +1 -0
- package/dist/vite-plugin.js +2 -333
- package/package.json +1 -1
- package/src/core/bundler.ts +11 -9
- package/src/core/chunking.ts +199 -0
- package/src/core/script-bundle-policy.ts +23 -0
- package/src/core/server.ts +20 -20
- package/src/core/vite-plugin.ts +68 -3
- package/dist/server-DPBLtja1.js.map +0 -1
- package/dist/vite-plugin.js.map +0 -1
package/dist/index.js
CHANGED
|
@@ -4,6 +4,6 @@ import { a as j, i as M, n as N, o as P, r as F, t as I } from "./exceptions-D4O
|
|
|
4
4
|
import { render as L } from "./entry-server.js";
|
|
5
5
|
import { n as R, t as z } from "./middleware-CnDqZobD.js";
|
|
6
6
|
import { t as B } from "./defineMiddleware-D017PWDc.js";
|
|
7
|
-
import { a as V, n as H } from "./server-
|
|
8
|
-
import {
|
|
7
|
+
import { a as V, n as H } from "./server-CvsOU9cg.js";
|
|
8
|
+
import { t as U } from "./vite-plugin-D9qTnleZ.js";
|
|
9
9
|
export { I as BadRequestException, T as Fragment, _ as HEAD_PRIORITY, b as Head, N as HttpException, F as InternalServerErrorException, M as NotFoundException, j as RedirectException, P as ServiceUnavailableException, C as addCacheTag, g as cloneElement, U as coreVite, z as createContext, H as createServer, B as defineMiddleware, r as escapeHTML, t as escapeProp, l as getCacheTags, x as getClientJsEntries, w as getCssEntries, d as getHeadContent, v as getIslandEntries, E as getIslandProps, f as getSchemas, p as getSsrIslands, S as isIslandPropsExternalized, y as isValidElement, h as jsxFactory, m as pushIslandProps, c as pushMetadata, D as pushSchema, A as registerIsland, u as registerSsrIsland, L as render, n as renderJsxToHtmlString, e as renderToRenderedNode, k as resolveMetadata, o as runInRenderContext, R as sequence, i as setViewName, V as startServer, O as useClientJs, s as useCss, a as useRequest };
|
|
@@ -63,46 +63,43 @@ function E(e) {
|
|
|
63
63
|
};
|
|
64
64
|
}
|
|
65
65
|
async function D(e, t) {
|
|
66
|
-
let n = {
|
|
66
|
+
let n = e.map((e) => t.fileForScript(e)), r = t.inlineableRoots(n), i = new Map(n.flatMap((e, n) => !t.isPreserved(e) && !r.has(e) ? [[e, `entry-${n}`]] : [])), a = {
|
|
67
67
|
input: w,
|
|
68
|
-
plugins: [T(
|
|
69
|
-
let n = t.fileForScript(e);
|
|
70
|
-
return `import ${JSON.stringify(n)};`;
|
|
71
|
-
}).join("\n")), E(t)],
|
|
68
|
+
plugins: [T(n.map((e) => `import ${JSON.stringify(e)};`).join("\n")), E(t)],
|
|
72
69
|
platform: "neutral",
|
|
73
70
|
tsconfig: !1,
|
|
74
71
|
treeshake: { moduleSideEffects: () => !0 },
|
|
75
72
|
external: (e) => !e.startsWith(".") && !u.isAbsolute(e) && e !== w
|
|
76
|
-
},
|
|
73
|
+
}, o = {
|
|
77
74
|
format: "es",
|
|
78
|
-
codeSplitting:
|
|
75
|
+
codeSplitting: { groups: [{ name: (e) => i.get(e) ?? null }] },
|
|
79
76
|
minify: !1,
|
|
80
77
|
entryFileNames: "bundle-[hash].js",
|
|
81
|
-
chunkFileNames:
|
|
82
|
-
}, { rolldown:
|
|
78
|
+
chunkFileNames: `bundle-${C(JSON.stringify(n))}-[hash].js`
|
|
79
|
+
}, { rolldown: s } = await v(), c = await s(a), l;
|
|
83
80
|
try {
|
|
84
|
-
({output:
|
|
81
|
+
({output: l} = await c.generate(o));
|
|
85
82
|
} finally {
|
|
86
|
-
await
|
|
83
|
+
await c.close();
|
|
87
84
|
}
|
|
88
|
-
for (let e of
|
|
85
|
+
for (let e of l) e.type === "chunk" && b.set(e.fileName, {
|
|
89
86
|
content: e.code || "",
|
|
90
87
|
hash: C(e.code || ""),
|
|
91
88
|
filename: e.fileName,
|
|
92
89
|
mimeType: "application/javascript"
|
|
93
90
|
});
|
|
94
|
-
let
|
|
95
|
-
if (!
|
|
91
|
+
let d = l.find((e) => e.type === "chunk" && e.isEntry && e.facadeModuleId === w);
|
|
92
|
+
if (!d) throw Error("[bundler] rolldown produced no entry chunk");
|
|
96
93
|
return {
|
|
97
|
-
hash: C(
|
|
98
|
-
filename:
|
|
99
|
-
content:
|
|
94
|
+
hash: C(d.code || ""),
|
|
95
|
+
filename: d.fileName,
|
|
96
|
+
content: d.code || ""
|
|
100
97
|
};
|
|
101
98
|
}
|
|
102
99
|
async function O(e, t, n) {
|
|
103
100
|
if (e.length === 0) return y;
|
|
104
101
|
if (!n || n.directory !== u.resolve(t)) return console.warn("[bundler] No matching build manifest; serving original script entries."), y;
|
|
105
|
-
let r = [...new Set(e)]
|
|
102
|
+
let r = [...new Set(e)], i = `scripts:${n.cacheKey}:${JSON.stringify(r)}`;
|
|
106
103
|
try {
|
|
107
104
|
return await S(i, () => D(r, n));
|
|
108
105
|
} catch (e) {
|
|
@@ -147,20 +144,23 @@ function j(e) {
|
|
|
147
144
|
//#endregion
|
|
148
145
|
//#region src/core/script-bundle-policy.ts
|
|
149
146
|
function M(e, t, n = "/") {
|
|
150
|
-
let r = u.resolve(t), i = h(r), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), c = Object.entries(e).filter(([, e]) => /\.[cm]?js$/.test(e.file));
|
|
151
|
-
function
|
|
147
|
+
let r = u.resolve(t), i = h(r), a = /* @__PURE__ */ new Set(), o = /* @__PURE__ */ new Set(), c = /* @__PURE__ */ new Map(), l = Object.entries(e).filter(([, e]) => /\.[cm]?js$/.test(e.file));
|
|
148
|
+
function d(e) {
|
|
152
149
|
let t = u.resolve(i, e), n = u.relative(i, t);
|
|
153
150
|
if (!n || n === ".." || n.startsWith(`..${u.sep}`) || u.isAbsolute(n)) throw Error(`[bundler] Asset is outside the client output: ${e}`);
|
|
154
151
|
return t;
|
|
155
152
|
}
|
|
156
|
-
for (let [e, t] of
|
|
157
|
-
let n =
|
|
153
|
+
for (let [e, t] of l) {
|
|
154
|
+
let n = d(t.file);
|
|
158
155
|
a.add(n), (!t.isEntry || t.isDynamicEntry || e === "src/client.global.ts" || /(?:^|\/)react\//.test(t.src || e)) && o.add(n);
|
|
159
156
|
}
|
|
160
|
-
for (let [, t] of
|
|
161
|
-
let t
|
|
162
|
-
|
|
163
|
-
|
|
157
|
+
for (let [, t] of l) {
|
|
158
|
+
for (let n of [...t.imports || [], ...t.dynamicImports || []]) {
|
|
159
|
+
let t = e[n];
|
|
160
|
+
if (!t || !a.has(d(t.file))) throw Error(`[bundler] Missing JavaScript manifest dependency: ${n}`);
|
|
161
|
+
o.add(d(t.file));
|
|
162
|
+
}
|
|
163
|
+
c.set(d(t.file), (t.imports || []).map((t) => d(e[t].file)));
|
|
164
164
|
}
|
|
165
165
|
return {
|
|
166
166
|
cacheKey: p("sha256").update(JSON.stringify([
|
|
@@ -171,13 +171,26 @@ function M(e, t, n = "/") {
|
|
|
171
171
|
])).digest("hex"),
|
|
172
172
|
directory: r,
|
|
173
173
|
fileForScript(e) {
|
|
174
|
-
let t =
|
|
174
|
+
let t = d(e.replace(/^\/+/, ""));
|
|
175
175
|
if (!a.has(t)) throw Error(`[bundler] Script is missing from manifest: ${e}`);
|
|
176
176
|
return t;
|
|
177
177
|
},
|
|
178
178
|
isPreserved(e) {
|
|
179
179
|
return o.has(e);
|
|
180
180
|
},
|
|
181
|
+
inlineableRoots(e) {
|
|
182
|
+
let t = /* @__PURE__ */ new Set(), n = 0;
|
|
183
|
+
function r(e, i) {
|
|
184
|
+
if (!t.has(e)) {
|
|
185
|
+
t.add(e);
|
|
186
|
+
for (let t of c.get(e) || []) r(t, i);
|
|
187
|
+
o.has(e) && (n = i);
|
|
188
|
+
}
|
|
189
|
+
}
|
|
190
|
+
return e.forEach((e, t) => {
|
|
191
|
+
r(e, t), o.has(e) && (n = t + 1);
|
|
192
|
+
}), new Set(e.slice(n).filter((e) => !o.has(e)));
|
|
193
|
+
},
|
|
181
194
|
assetUrl(e) {
|
|
182
195
|
if (!a.has(e)) throw Error(`[bundler] Import is missing from manifest: ${e}`);
|
|
183
196
|
return s(n, u.relative(i, e).replace(/\\/g, "/"));
|
|
@@ -278,39 +291,47 @@ async function U({ rendered: e, template: t, manifest: r, root: i, distClientDir
|
|
|
278
291
|
let k = "";
|
|
279
292
|
if (e.islandData && e.islandData.length > 0 && (k = `<script type="application/json" id="_l5e_data_">${(0, g.default)(e.islandData, { isJSON: !0 })}<\/script>`), l && r) {
|
|
280
293
|
m = m.filter((e) => e.replace(/^\//, "") !== "src/client.global.ts"), h = h.filter((e) => !e.includes(".global."));
|
|
281
|
-
let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set();
|
|
282
|
-
function
|
|
283
|
-
let
|
|
284
|
-
|
|
285
|
-
|
|
286
|
-
i
|
|
287
|
-
|
|
288
|
-
|
|
289
|
-
|
|
290
|
-
|
|
294
|
+
let e = /* @__PURE__ */ new Set(), t = /* @__PURE__ */ new Set(), i = /* @__PURE__ */ new Set();
|
|
295
|
+
function o(n) {
|
|
296
|
+
let a = r[n];
|
|
297
|
+
if (!a) return { file: null };
|
|
298
|
+
if (!i.has(n)) {
|
|
299
|
+
i.add(n);
|
|
300
|
+
for (let t of a.css || []) e.add(t);
|
|
301
|
+
for (let e of a.imports || []) {
|
|
302
|
+
let n = o(e);
|
|
303
|
+
n.file && t.add(n.file);
|
|
304
|
+
}
|
|
305
|
+
}
|
|
306
|
+
return { file: a.file };
|
|
291
307
|
}
|
|
292
|
-
let
|
|
308
|
+
let c = [];
|
|
293
309
|
for (let e of m) {
|
|
294
|
-
let { file: t } =
|
|
295
|
-
t &&
|
|
310
|
+
let { file: t } = o(e.replace(/^\//, ""));
|
|
311
|
+
t && c.push(`/${t}`);
|
|
296
312
|
}
|
|
297
|
-
let
|
|
313
|
+
let l = [];
|
|
298
314
|
for (let t of h) {
|
|
299
|
-
let { file:
|
|
300
|
-
|
|
315
|
+
let { file: n } = o(t.replace(/^\//, ""));
|
|
316
|
+
n && (l.push(`/${n}`), e.add(n));
|
|
301
317
|
}
|
|
302
|
-
if (
|
|
303
|
-
let e = await O(
|
|
304
|
-
m = e.filename ? [s(d, e.filename)] :
|
|
318
|
+
if (c.length > 0) {
|
|
319
|
+
let e = await O(c, a, f);
|
|
320
|
+
m = e.filename ? [s(d, e.filename)] : c.map((e) => s(d, e));
|
|
305
321
|
}
|
|
306
|
-
if (
|
|
307
|
-
let
|
|
308
|
-
|
|
322
|
+
if (e.size > 0) {
|
|
323
|
+
let t = await A([...e].map((e) => `/${e}`), a);
|
|
324
|
+
t.filename && (h = [s(d, t.filename)]);
|
|
309
325
|
}
|
|
310
|
-
|
|
311
|
-
|
|
326
|
+
e.clear();
|
|
327
|
+
let u = r["src/client.global.ts"];
|
|
328
|
+
o("src/client.global.ts");
|
|
329
|
+
for (let t of e) w(s(d, t), !0);
|
|
330
|
+
u && (u.css && u.css.length > 0 && u.css.forEach((e) => {
|
|
312
331
|
w(s(d, e), !0);
|
|
313
|
-
}),
|
|
332
|
+
}), u.file && T.push(s(d, u.file)));
|
|
333
|
+
for (let e of t) S += `<link rel="modulepreload" crossorigin href="${n(s(d, e))}">`;
|
|
334
|
+
if (_.length > 0) {
|
|
314
335
|
let e = {};
|
|
315
336
|
for (let t of _) {
|
|
316
337
|
let n = r[t.src];
|
|
@@ -502,4 +523,4 @@ function J(e) {
|
|
|
502
523
|
//#endregion
|
|
503
524
|
export { G as a, J as i, W as n, q as r, N as t };
|
|
504
525
|
|
|
505
|
-
//# sourceMappingURL=server-
|
|
526
|
+
//# sourceMappingURL=server-CvsOU9cg.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"server-CvsOU9cg.js","names":["serialize"],"sources":["../src/core/bundler.ts","../src/core/script-bundle-policy.ts","../src/core/server.ts"],"sourcesContent":["/// <reference path=\"./jsx-types.d.ts\" />\nimport { createHash } from 'node:crypto';\nimport fs from 'node:fs/promises';\nimport { createRequire } from 'node:module';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport type { InputOptions, OutputChunk, OutputOptions, Plugin } from 'rolldown';\nimport type { ScriptBundlePolicy } from './script-bundle-policy';\n\nlet rolldownModulePromise: Promise<typeof import('rolldown')> | null = null;\n\n/**\n * Resolve Rolldown lazily from the installed framework package. A bare static\n * import can be hoisted when the framework is bundled into a consumer's SSR\n * output, which breaks pnpm's strict dependency layout. Anchoring resolution at\n * @withl5e/l5e keeps the runtime dependency owned by the package that declares it.\n */\nfunction loadRolldown(): Promise<typeof import('rolldown')> {\n if (!rolldownModulePromise) {\n rolldownModulePromise = (async () => {\n const require = createRequire(import.meta.url);\n const frameworkEntry = require.resolve('@withl5e/l5e/server');\n const frameworkRequire = createRequire(frameworkEntry);\n const rolldownPath = frameworkRequire.resolve('rolldown');\n return (await import(\n /* @vite-ignore */ pathToFileURL(rolldownPath).href\n )) as typeof import('rolldown');\n })();\n }\n return rolldownModulePromise;\n}\n\ninterface BundledFile {\n content: string;\n hash: string;\n filename: string;\n mimeType: string;\n}\n\ninterface BundleResult {\n hash: string;\n filename: string;\n content: string;\n}\n\nconst EMPTY_RESULT: BundleResult = { hash: '', filename: '', content: '' };\n\n// Memory map để lưu bundled files\nconst bundledFilesMap = new Map<string, BundledFile>();\n\n/**\n * Single-flight map: cacheKey → promise của lần bundle đang chạy (hoặc đã xong).\n * Vì promise được giữ lại sau khi resolve, map này vừa là in-flight dedup vừa là\n * result cache. Bundle lỗi bị xoá khỏi map để request sau được thử lại.\n */\nconst bundlePromises = new Map<string, Promise<BundleResult>>();\n\n/**\n * Chạy `work` đúng một lần cho mỗi cacheKey, kể cả khi nhiều request đến đồng thời.\n */\nfunction dedupe(cacheKey: string, work: () => Promise<BundleResult>): Promise<BundleResult> {\n const pending = bundlePromises.get(cacheKey);\n if (pending) {\n return pending;\n }\n\n const promise = work().catch((error) => {\n bundlePromises.delete(cacheKey);\n throw error;\n });\n bundlePromises.set(cacheKey, promise);\n return promise;\n}\n\n/**\n * Generate hash từ content\n */\nfunction generateHash(content: string): string {\n return createHash('sha256').update(content).digest('hex').substring(0, 16);\n}\n\n// Rolldown coi id bắt đầu bằng \\0 là virtual — nó sẽ không cố đọc từ đĩa.\nconst VIRTUAL_ENTRY_ID = '\\0l5e:bundle-entry';\n\n/**\n * Entry của mỗi lần bundle chỉ là một danh sách import. Giữ nó trong memory thay\n * vì ghi ra đĩa: hai request đồng thời cùng một tập script sinh ra cùng nội dung\n * entry, nên file tạm dùng chung path sẽ bị request này xoá trong lúc Rolldown của\n * request kia còn đang đọc.\n */\nfunction virtualEntryPlugin(entryContent: string): Plugin {\n return {\n name: 'l5e-virtual-entry',\n resolveId(source) {\n return source === VIRTUAL_ENTRY_ID ? VIRTUAL_ENTRY_ID : null;\n },\n load(id) {\n return id === VIRTUAL_ENTRY_ID ? entryContent : null;\n },\n };\n}\n\n/** Inline page roots only; their emitted dependencies retain canonical URLs. */\nfunction preserveBuildChunksPlugin(policy: ScriptBundlePolicy): Plugin {\n return {\n name: 'preserve-build-chunks',\n resolveId(source, importer) {\n if (!importer || source === VIRTUAL_ENTRY_ID) return null;\n const file = path.isAbsolute(source)\n ? path.normalize(source)\n : source.startsWith('.')\n ? path.resolve(path.dirname(importer), source)\n : null;\n if (!file) return null;\n // The virtual entry is the only place where an unshared page entry may\n // be inlined. Never traverse an emitted dependency to re-bundle its body.\n if (importer === VIRTUAL_ENTRY_ID && !policy.isPreserved(file)) return null;\n return { id: policy.assetUrl(file), external: 'absolute' };\n },\n };\n}\n\nasync function runScriptBundle(\n uniquePaths: string[],\n policy: ScriptBundlePolicy,\n): Promise<BundleResult> {\n const roots = uniquePaths.map((p) => policy.fileForScript(p));\n const suffix = policy.inlineableRoots(roots);\n const prefixChunks = new Map(\n roots.flatMap((file, index) =>\n !policy.isPreserved(file) && !suffix.has(file) ? [[file, `entry-${index}`] as const] : [],\n ),\n );\n const entryContent = roots.map((filePath) => `import ${JSON.stringify(filePath)};`).join('\\n');\n\n const rolldownOptions: InputOptions = {\n input: VIRTUAL_ENTRY_ID,\n plugins: [virtualEntryPlugin(entryContent), preserveBuildChunksPlugin(policy)],\n platform: 'neutral',\n tsconfig: false,\n // Runtime scripts are imported for their side effects. Do not let an app's\n // package.json sideEffects flag erase those entry imports.\n // Rolldown 1.2 still consults package metadata for boolean `true`, so use\n // an explicit callback to override consumer `sideEffects: false`.\n treeshake: { moduleSideEffects: () => true },\n external: (id) => {\n // External node_modules\n if (!id.startsWith('.') && !path.isAbsolute(id) && id !== VIRTUAL_ENTRY_ID) {\n return true;\n }\n\n // Emitted file imports are resolved by preserveBuildChunksPlugin.\n return false;\n },\n };\n\n const outputOptions: OutputOptions = {\n format: 'es',\n codeSplitting: { groups: [{ name: (id) => prefixChunks.get(id) ?? null }] },\n minify: false,\n entryFileNames: 'bundle-[hash].js',\n chunkFileNames: `bundle-${generateHash(JSON.stringify(roots))}-[hash].js`,\n };\n\n const { rolldown } = await loadRolldown();\n const bundle = await rolldown(rolldownOptions);\n let output;\n try {\n ({ output } = await bundle.generate(outputOptions));\n } finally {\n await bundle.close();\n }\n\n for (const chunk of output) {\n if (chunk.type !== 'chunk') {\n continue;\n }\n bundledFilesMap.set(chunk.fileName, {\n content: chunk.code || '',\n hash: generateHash(chunk.code || ''),\n filename: chunk.fileName,\n mimeType: 'application/javascript',\n });\n }\n\n const entryChunk = output.find(\n (item): item is OutputChunk =>\n item.type === 'chunk' && item.isEntry && item.facadeModuleId === VIRTUAL_ENTRY_ID,\n );\n if (!entryChunk) {\n throw new Error('[bundler] rolldown produced no entry chunk');\n }\n\n return {\n hash: generateHash(entryChunk.code || ''),\n filename: entryChunk.fileName,\n content: entryChunk.code || '',\n };\n}\n\n/**\n * Bundle JavaScript files từ dist/client thành 1 file\n * Trong production, các file đã được build sẵn trong dist/client\n */\nexport async function bundleScripts(\n scriptPaths: string[],\n distClientDir: string,\n policy?: ScriptBundlePolicy,\n): Promise<BundleResult> {\n if (scriptPaths.length === 0) {\n return EMPTY_RESULT;\n }\n\n if (!policy || policy.directory !== path.resolve(distClientDir)) {\n console.warn('[bundler] No matching build manifest; serving original script entries.');\n return EMPTY_RESULT;\n }\n\n const uniquePaths = [...new Set(scriptPaths)];\n const cacheKey = `scripts:${policy.cacheKey}:${JSON.stringify(uniquePaths)}`;\n\n try {\n return await dedupe(cacheKey, () => runScriptBundle(uniquePaths, policy));\n } catch (error) {\n console.error('[bundler] Error bundling scripts:', error);\n return EMPTY_RESULT;\n }\n}\n\nasync function runCssBundle(uniquePaths: string[], distClientDir: string): Promise<BundleResult> {\n const cssContents: string[] = [];\n\n for (const cssPath of uniquePaths) {\n // cssPath có thể là \"/assets/xxx.css\" hoặc từ manifest\n const filePath = cssPath.startsWith('/')\n ? path.join(distClientDir, cssPath.substring(1))\n : path.join(distClientDir, cssPath);\n\n try {\n const content = await fs.readFile(filePath, 'utf-8');\n cssContents.push(`/* ${cssPath} */\\n${content}\\n`);\n } catch (err) {\n console.warn(`[bundler] Failed to read CSS file: ${cssPath}`, err);\n }\n }\n\n const bundledContent = cssContents.join('\\n\\n');\n const hash = generateHash(bundledContent);\n const filename = `bundle-${hash}.css`;\n\n bundledFilesMap.set(filename, {\n content: bundledContent,\n hash,\n filename,\n mimeType: 'text/css',\n });\n\n return { hash, filename, content: bundledContent };\n}\n\n/**\n * Bundle CSS files từ dist/client thành 1 file\n * Trong production, các file đã được build sẵn trong dist/client\n */\nexport async function bundleCss(cssPaths: string[], distClientDir: string): Promise<BundleResult> {\n if (cssPaths.length === 0) {\n return EMPTY_RESULT;\n }\n\n const uniquePaths = [...new Set(cssPaths)].sort();\n const cacheKey = `css:${JSON.stringify([path.resolve(distClientDir), uniquePaths])}`;\n\n try {\n return await dedupe(cacheKey, () => runCssBundle(uniquePaths, distClientDir));\n } catch (error) {\n console.error('[bundler] Error bundling CSS:', error);\n return EMPTY_RESULT;\n }\n}\n\n/**\n * Get bundled file từ map\n */\nexport function getBundledFile(filename: string): BundledFile | undefined {\n return bundledFilesMap.get(filename);\n}\n\n/**\n * Clear bundled files map (useful for testing)\n */\nexport function clearBundledFiles(): void {\n bundledFilesMap.clear();\n bundlePromises.clear();\n}\n","import { createHash } from 'node:crypto';\nimport { realpathSync } from 'node:fs';\nimport path from 'node:path';\nimport type { Manifest } from 'vite';\nimport { withAssetBase } from './global-style';\n\n/** Preserve the emitted module boundaries chosen by the application's build. */\nexport function createScriptBundlePolicy(manifest: Manifest, distClientDir: string, base = '/') {\n const directory = path.resolve(distClientDir);\n // Rolldown resolves entry importers through symlinks/junctions. Use the same\n // physical directory for identity while retaining the caller's output scope.\n const assetDirectory = realpathSync(directory);\n const files = new Set<string>();\n const preserved = new Set<string>();\n const staticImports = new Map<string, string[]>();\n const jsEntries = Object.entries(manifest).filter(([, entry]) => /\\.[cm]?js$/.test(entry.file));\n\n function absoluteFile(file: string) {\n const absolute = path.resolve(assetDirectory, file);\n const relative = path.relative(assetDirectory, absolute);\n if (\n !relative ||\n relative === '..' ||\n relative.startsWith(`..${path.sep}`) ||\n path.isAbsolute(relative)\n ) {\n throw new Error(`[bundler] Asset is outside the client output: ${file}`);\n }\n return absolute;\n }\n\n for (const [key, entry] of jsEntries) {\n const file = absoluteFile(entry.file);\n files.add(file);\n if (\n !entry.isEntry ||\n entry.isDynamicEntry ||\n key === 'src/client.global.ts' ||\n /(?:^|\\/)react\\//.test(entry.src || key)\n )\n preserved.add(file);\n }\n\n // Index the whole build, not just this request's roots. This also protects an\n // entry imported by another entry, even when both are selected on this page.\n for (const [, entry] of jsEntries) {\n for (const key of [...(entry.imports || []), ...(entry.dynamicImports || [])]) {\n const dependency = manifest[key];\n if (!dependency || !files.has(absoluteFile(dependency.file))) {\n throw new Error(`[bundler] Missing JavaScript manifest dependency: ${key}`);\n }\n preserved.add(absoluteFile(dependency.file));\n }\n staticImports.set(\n absoluteFile(entry.file),\n (entry.imports || []).map((key) => absoluteFile(manifest[key].file)),\n );\n }\n\n const cacheKey = createHash('sha256')\n .update(JSON.stringify([directory, assetDirectory, base, manifest]))\n .digest('hex');\n\n return {\n cacheKey,\n directory,\n fileForScript(script: string) {\n const file = absoluteFile(script.replace(/^\\/+/, ''));\n if (!files.has(file)) throw new Error(`[bundler] Script is missing from manifest: ${script}`);\n return file;\n },\n isPreserved(file: string) {\n return preserved.has(file);\n },\n inlineableRoots(roots: string[]) {\n // External ESM imports execute before any inlined body. Isolate prefix\n // roots in runtime chunks when a later root introduces a dependency effect;\n // only the suffix after the last such boundary can share the entry chunk.\n const visited = new Set<string>();\n let suffixStart = 0;\n function visit(file: string, rootIndex: number) {\n if (visited.has(file)) return;\n visited.add(file);\n for (const dependency of staticImports.get(file) || []) visit(dependency, rootIndex);\n if (preserved.has(file)) suffixStart = rootIndex;\n }\n roots.forEach((file, index) => {\n visit(file, index);\n if (preserved.has(file)) suffixStart = index + 1;\n });\n return new Set(roots.slice(suffixStart).filter((file) => !preserved.has(file)));\n },\n assetUrl(file: string) {\n if (!files.has(file)) throw new Error(`[bundler] Import is missing from manifest: ${file}`);\n return withAssetBase(base, path.relative(assetDirectory, file).replace(/\\\\/g, '/'));\n },\n };\n}\n\nexport type ScriptBundlePolicy = ReturnType<typeof createScriptBundlePolicy>;\n","import type { Request as ExpressRequest, Response as ExpressResponse } from 'express';\nimport { existsSync } from 'fs';\nimport fs from 'node:fs/promises';\nimport path from 'node:path';\nimport { pathToFileURL } from 'node:url';\nimport requestIp from 'request-ip';\nimport serialize from 'serialize-javascript';\nimport type { ViteDevServer } from 'vite';\nimport { createContext, type MiddlewareHandler, type RewritePayload } from '../middleware';\nimport { bundleCss, bundleScripts, getBundledFile } from './bundler';\nimport type { RenderResult, RequestInfo } from './entry-server';\nimport { resolveGlobalStyleHref, withAssetBase } from './global-style';\nimport { createScriptBundlePolicy, type ScriptBundlePolicy } from './script-bundle-policy';\nimport type { Manifest } from 'vite';\nimport { escapeProp } from './render';\nimport { createHeadersFromExpressRequest, parseCookies } from './request';\n\nexport interface ServerOptions {\n root?: string;\n port?: number;\n base?: string;\n publicDir?: string;\n setupApp?: (app: any) => void | Promise<void>;\n app?: any; // Express\n /**\n * Externalize React island props into a single `<script id=\"_l5e_data_\">` at\n * the end of the document (referenced by `data-island-idx`) instead of inlining\n * a large `data-island-props` attribute on each element — keeps the SSR HTML\n * lean so crawlers read content first. Default true; set false for the legacy\n * inline behavior.\n */\n externalizeIslandProps?: boolean;\n}\n\nexport interface ServerContext {\n app: any; // Express app\n vite?: ViteDevServer;\n}\n\n/**\n * Apply or replace lang attribute on <html> tag\n */\nexport function applyHtmlLang(template: string, lang: string): string {\n // Escape so a loader-supplied lang (possibly derived from user input) cannot\n // break out of the attribute / <html> tag (XSS). escapeProp handles \", <, >, &.\n const safeLang = escapeProp(lang);\n return template.replace(/<html\\b([^>]*)>/i, (match, attrs) => {\n // Check if lang already exists\n if (/\\blang\\s*=/i.test(attrs)) {\n // Replace existing lang value (function replacer avoids $-pattern issues)\n return match.replace(/lang\\s*=\\s*\"[^\"]*\"/i, () => `lang=\"${safeLang}\"`);\n } else {\n // Add lang attribute\n return `<html lang=\"${safeLang}\"${attrs}>`;\n }\n });\n}\n\ntype EntryServerModule = {\n render: (\n url: string,\n requestInfo?: RequestInfo,\n options?: { externalizeIslandProps?: boolean },\n ) => Promise<RenderResult>;\n loadMiddleware?: () => Promise<MiddlewareHandler | undefined>;\n};\n\nfunction getRequestUrl(req: ExpressRequest): URL {\n return new URL(`${req.protocol}://${req.get('host')}${req.originalUrl}`);\n}\n\nfunction getRenderUrl(urlObject: URL, base: string): string {\n const requestPath = `${urlObject.pathname}${urlObject.search}`;\n return requestPath.replace(base, '') || '/';\n}\n\nfunction createWebRequestFromExpress(req: ExpressRequest): globalThis.Request {\n const init: RequestInit & { duplex?: 'half' } = {\n method: req.method,\n headers: createHeadersFromExpressRequest(req),\n };\n\n if (req.method !== 'GET' && req.method !== 'HEAD') {\n init.body = req as unknown as BodyInit;\n init.duplex = 'half';\n }\n\n return new globalThis.Request(getRequestUrl(req).href, init);\n}\n\nfunction createRequestInfo(\n req: ExpressRequest,\n webRequest: globalThis.Request,\n base: string,\n locals: Record<string, unknown>,\n): RequestInfo {\n const urlObject = new URL(webRequest.url);\n const renderUrl = getRenderUrl(urlObject, base);\n const normalizedPath = renderUrl.startsWith('/') ? renderUrl : `/${renderUrl}`;\n const headers: Record<string, string> = {};\n webRequest.headers.forEach((value, key) => {\n headers[key] = value;\n });\n\n return {\n url: urlObject,\n path: normalizedPath,\n pathname: urlObject.pathname,\n method: webRequest.method,\n headers,\n cookies: parseCookies(webRequest.headers.get('cookie') ?? undefined),\n query: Object.fromEntries(urlObject.searchParams.entries()),\n ip: requestIp.getClientIp(req) ?? undefined,\n locals,\n };\n}\n\nfunction createRewriteRequest(\n payload: RewritePayload | undefined,\n currentRequest: globalThis.Request,\n currentUrl: URL,\n): globalThis.Request {\n if (!payload) {\n return currentRequest;\n }\n\n if (payload instanceof globalThis.Request) {\n return payload;\n }\n\n if (payload instanceof URL) {\n return new globalThis.Request(payload.href, currentRequest.clone());\n }\n\n return new globalThis.Request(new URL(payload, currentUrl).href, currentRequest.clone());\n}\n\nasync function sendWebResponse(\n req: ExpressRequest,\n res: ExpressResponse,\n response: globalThis.Response,\n): Promise<void> {\n res.status(response.status);\n const setCookieValues = getSetCookieHeaders(response.headers);\n response.headers.forEach((value, key) => {\n if (key.toLowerCase() === 'set-cookie') {\n return;\n }\n res.setHeader(key, value);\n });\n if (setCookieValues.length > 0) {\n res.setHeader('Set-Cookie', setCookieValues);\n }\n\n if (req.method === 'HEAD') {\n res.end();\n return;\n }\n\n const body = Buffer.from(await response.arrayBuffer());\n res.send(body);\n}\n\nfunction getSetCookieHeaders(headers: Headers): string[] {\n const getSetCookie = (headers as Headers & { getSetCookie?: () => string[] }).getSetCookie;\n if (typeof getSetCookie === 'function') {\n return getSetCookie.call(headers);\n }\n\n const raw = (headers as Headers & { raw?: () => Record<string, string[]> }).raw?.();\n if (raw?.['set-cookie']) {\n return raw['set-cookie'];\n }\n\n const value = headers.get('set-cookie');\n return value ? splitSetCookieHeader(value) : [];\n}\n\nfunction splitSetCookieHeader(value: string): string[] {\n const cookies: string[] = [];\n let start = 0;\n\n for (let i = 0; i < value.length; i++) {\n if (value[i] !== ',') continue;\n\n const rest = value.slice(i + 1);\n if (/^\\s*[^=;,]+=/.test(rest)) {\n cookies.push(value.slice(start, i).trim());\n start = i + 1;\n }\n }\n\n cookies.push(value.slice(start).trim());\n return cookies.filter(Boolean);\n}\n\nfunction createRawResponse(rendered: RenderResult): globalThis.Response | null {\n if (!rendered.rawResponse) {\n return null;\n }\n\n const { body, contentType, statusCode, headers } = rendered.rawResponse;\n const responseHeaders = new Headers(headers);\n responseHeaders.set('Content-Type', contentType);\n\n return new globalThis.Response(body as BodyInit, {\n status: statusCode || 200,\n headers: responseHeaders,\n });\n}\n\nasync function createPageResponse({\n rendered,\n template,\n manifest,\n root,\n distClientDir,\n isProduction,\n assetBase,\n scriptPolicy,\n}: {\n rendered: RenderResult;\n template: string;\n manifest?: Record<string, any>;\n root: string;\n distClientDir: string;\n isProduction: boolean;\n assetBase: string;\n scriptPolicy?: ScriptBundlePolicy;\n}): Promise<globalThis.Response> {\n const rawResponse = createRawResponse(rendered);\n if (rawResponse) {\n return rawResponse;\n }\n\n if (rendered.redirect) {\n return new globalThis.Response(null, {\n status: rendered.redirect.statusCode,\n headers: {\n Location: rendered.redirect.url,\n },\n });\n }\n\n let scriptSrcList: string[] = rendered.scripts || [];\n let cssSrcList: string[] = rendered.styles || [];\n const islandEntries = rendered.islands || [];\n let cacheTags: string[] = rendered.cacheTags || [];\n const maxAge: number | undefined = rendered.maxAge;\n const sMaxAge: number | undefined = rendered.sMaxAge;\n const swr: number | undefined = rendered.swr;\n\n let extraHead = '';\n const emittedStyles = new Set<string>();\n const appendStylesheet = (href: string, crossorigin = false) => {\n if (emittedStyles.has(href)) return;\n emittedStyles.add(href);\n extraHead += `<link rel=\"stylesheet\"${crossorigin ? ' crossorigin' : ''} href=\"${escapeProp(href)}\">`;\n };\n let globalScripts: string[] = [];\n let islandRegistryScript = '';\n\n const globalStyleHref = resolveGlobalStyleHref({\n root,\n manifest,\n isProduction,\n base: assetBase,\n });\n if (globalStyleHref) appendStylesheet(globalStyleHref, isProduction);\n\n // Externalized island props → a single JSON script at the end of the document.\n // serialize-javascript with isJSON escapes `<`, `>`, `&` (and U+2028/2029) so the\n // props can't break out of the <script> block or inject markup (XSS). The runtime\n // reads it via `document.getElementById('_l5e_data_')` + JSON.parse.\n let islandDataScript = '';\n if (rendered.islandData && rendered.islandData.length > 0) {\n islandDataScript = `<script type=\"application/json\" id=\"_l5e_data_\">${serialize(\n rendered.islandData,\n { isJSON: true },\n )}</script>`;\n }\n\n if (isProduction && manifest) {\n scriptSrcList = scriptSrcList.filter(\n (src) => src.replace(/^\\//, '') !== 'src/client.global.ts',\n );\n cssSrcList = cssSrcList.filter((src) => !src.includes('.global.'));\n\n const cssFiles = new Set<string>();\n const preloadFiles = new Set<string>();\n\n const visitedEntries = new Set<string>();\n function collectFromEntry(entryKey: string): { file: string | null } {\n const entry = manifest![entryKey];\n if (!entry) return { file: null };\n if (!visitedEntries.has(entryKey)) {\n visitedEntries.add(entryKey);\n for (const css of entry.css || []) cssFiles.add(css);\n for (const key of entry.imports || []) {\n const dependency = collectFromEntry(key);\n if (dependency.file) preloadFiles.add(dependency.file);\n }\n }\n return { file: entry.file };\n }\n\n const mappedScripts: string[] = [];\n for (const src of scriptSrcList) {\n const entryKey = src.replace(/^\\//, '');\n const { file } = collectFromEntry(entryKey);\n if (file) mappedScripts.push(`/${file}`);\n }\n\n const mappedCssFiles: string[] = [];\n for (const src of cssSrcList) {\n const entryKey = src.replace(/^\\//, '');\n const { file } = collectFromEntry(entryKey);\n if (file) {\n mappedCssFiles.push(`/${file}`);\n cssFiles.add(file);\n }\n }\n\n if (mappedScripts.length > 0) {\n const bundledScript = await bundleScripts(mappedScripts, distClientDir, scriptPolicy);\n scriptSrcList = bundledScript.filename\n ? [withAssetBase(assetBase, bundledScript.filename)]\n : mappedScripts.map((file) => withAssetBase(assetBase, file));\n }\n\n if (cssFiles.size > 0) {\n const bundledCss = await bundleCss(\n [...cssFiles].map((file) => `/${file}`),\n distClientDir,\n );\n if (bundledCss.filename) {\n cssSrcList = [withAssetBase(assetBase, bundledCss.filename)];\n }\n }\n\n cssFiles.clear();\n const globalEntry = manifest['src/client.global.ts'];\n collectFromEntry('src/client.global.ts');\n for (const cssFile of cssFiles) appendStylesheet(withAssetBase(assetBase, cssFile), true);\n if (globalEntry) {\n if (globalEntry.css && globalEntry.css.length > 0) {\n globalEntry.css.forEach((cssFile: string) => {\n appendStylesheet(withAssetBase(assetBase, cssFile), true);\n });\n }\n if (globalEntry.file) {\n globalScripts.push(withAssetBase(assetBase, globalEntry.file));\n }\n }\n\n for (const file of preloadFiles) {\n extraHead += `<link rel=\"modulepreload\" crossorigin href=\"${escapeProp(withAssetBase(assetBase, file))}\">`;\n }\n\n if (islandEntries.length > 0) {\n const islandMap: Record<string, string> = {};\n for (const island of islandEntries) {\n const entry = manifest[island.src];\n if (entry?.file) {\n islandMap[island.key] = withAssetBase(assetBase, entry.file);\n }\n }\n if (Object.keys(islandMap).length > 0) {\n islandRegistryScript = `<script>window.__L5E_ISLANDS__=${serialize(islandMap)}</script>`;\n }\n }\n\n if (cssSrcList.length > 0) {\n cssSrcList.forEach((file) => appendStylesheet(file, true));\n }\n }\n\n if (!isProduction) {\n // Registry đã dedupe, nhưng vẫn lọc lại ở đây để dev không bao giờ ra thẻ trùng\n [...new Set(cssSrcList)].forEach((src) => appendStylesheet(src));\n }\n\n let allScripts = [...globalScripts, ...scriptSrcList];\n\n if (!isProduction) {\n const globalTsPath = path.join(root, 'src', 'client.global.ts');\n if (existsSync(globalTsPath)) {\n allScripts = ['/src/client.global.ts', ...allScripts];\n }\n\n // useClientJs('/src/client.global.ts') do user tự gọi sẽ trùng với entry\n // được prepend ở trên — registry không bắt được ca này nên dedupe lại\n allScripts = [...new Set(allScripts)];\n\n if (islandEntries.length > 0) {\n const islandMap: Record<string, string> = {};\n for (const island of islandEntries) {\n islandMap[island.key] = `/${island.src}`;\n }\n islandRegistryScript = `<script>window.__L5E_ISLANDS__=${serialize(islandMap)}</script>`;\n }\n }\n\n const scriptsHtml =\n islandDataScript +\n islandRegistryScript +\n allScripts.map((src) => `<script type=\"module\" src=\"${src}\"></script>`).join('');\n\n const templateWithLang = rendered.lang ? applyHtmlLang(template, rendered.lang) : template;\n\n // Replacer fns (not strings) so `$`-sequences in rendered HTML — e.g. an SSR\n // island body or user text containing \"$$\" / \"$&\" — aren't interpreted as\n // special String.replace replacement patterns.\n const html = rendered.rawHtml\n ? rendered.html || ''\n : templateWithLang\n .replace(`<!--app-head-->`, () => (rendered.head ?? '') + extraHead)\n .replace(`<!--app-html-->`, () => rendered.html ?? '')\n .replace(`<!--app-scripts-->`, () => scriptsHtml);\n\n const headers = new Headers({\n 'Content-Type': 'text/html',\n });\n\n const cacheControlParts: string[] = [];\n const cdnCacheControlParts: string[] = [];\n if (maxAge !== undefined) {\n cacheControlParts.push(`max-age=${maxAge}`);\n cdnCacheControlParts.push(`max-age=${maxAge}`);\n }\n\n if (sMaxAge !== undefined) {\n cdnCacheControlParts.push(`s-maxage=${sMaxAge}`);\n }\n\n // ko cho phép browser swr\n if (swr !== undefined) {\n cdnCacheControlParts.push(`stale-while-revalidate=${swr}`);\n }\n\n if ((cacheControlParts.length > 0 || cdnCacheControlParts.length > 0) && isProduction) {\n cacheControlParts.push('public');\n cacheControlParts.push('must-revalidate');\n\n cdnCacheControlParts.push('public');\n\n headers.set('Cache-Control', cacheControlParts.join(', '));\n headers.set('CDN-Cache-Control', cdnCacheControlParts.join(', '));\n }\n\n if (process.env.NODE_ENV === 'production') {\n cacheTags = optimizeCacheTags(cacheTags);\n }\n headers.set('Cache-Tag', ['global', ...cacheTags].join(','));\n\n return new globalThis.Response(html, {\n status: rendered.statusCode || 200,\n headers,\n });\n}\n\nexport async function createServer(options: ServerOptions = {}): Promise<ServerContext> {\n const root = options.root || process.cwd();\n const base = options.base || '/';\n const isProduction = process.env.NODE_ENV === 'production';\n const externalizeIslandProps = options.externalizeIslandProps ?? true;\n\n // Cached production assets\n const templateHtml = isProduction\n ? await fs.readFile(path.join(root, './index.html'), 'utf-8')\n : '';\n\n // Create http server\n // @ts-ignore\n const express = (await import('express')).default;\n const app = options.app || express();\n\n // Serve static files from public directory\n if (options.publicDir) {\n const publicPath = path.isAbsolute(options.publicDir)\n ? options.publicDir\n : path.join(root, options.publicDir);\n\n if (existsSync(publicPath)) {\n app.use(express.static(publicPath));\n }\n }\n\n // Add Vite or respective production middlewares\n let vite: ViteDevServer | undefined;\n const distClientDir = path.join(root, './dist/client');\n // A production server owns one immutable build. Share its manifest/policy\n // across requests, just like its cached HTML template and SSR module.\n const productionManifest: Manifest | undefined = isProduction\n ? JSON.parse(await fs.readFile(path.join(distClientDir, '.vite/manifest.json'), 'utf-8'))\n : undefined;\n let scriptPolicy: ScriptBundlePolicy | undefined;\n if (productionManifest) {\n try {\n scriptPolicy = createScriptBundlePolicy(productionManifest, distClientDir, base);\n } catch (error) {\n console.warn('[bundler] Invalid build manifest; serving original script entries.', error);\n }\n }\n\n if (!isProduction) {\n const { createServer } = await import('vite');\n const configFile = path.join(root, 'vite.config.js');\n vite = await createServer({\n root,\n configFile,\n server: { middlewareMode: true },\n appType: 'custom',\n base,\n optimizeDeps: {\n exclude: ['@withl5e/l5e', 'file-type'],\n },\n ssr: {\n resolve: {\n conditions: ['development', 'default'],\n },\n },\n resolve: {\n conditions: ['development', 'default'],\n },\n });\n app.use(vite.middlewares);\n } else {\n // @ts-ignore\n const compression = (await import('compression')).default;\n // @ts-ignore\n const sirv = (await import('sirv')).default;\n app.use(compression());\n app.use(base, sirv(distClientDir, { extensions: [] }));\n\n // Route để serve bundled files từ memory map\n // Äặt route nà y trước route HTML để catch request trước\n app.get(\n withAssetBase(base, 'bundle-:hash.:ext'),\n async (req: ExpressRequest, res: ExpressResponse) => {\n try {\n const { hash, ext } = req.params;\n const filename = `bundle-${hash}.${ext}`;\n const bundledFile = getBundledFile(filename);\n\n if (!bundledFile) {\n return res.status(404).send('Bundled file not found');\n }\n\n res.set({\n 'Content-Type': bundledFile.mimeType,\n 'Cache-Control': 'public, max-age=31536000, immutable',\n });\n res.send(bundledFile.content);\n } catch (e: any) {\n console.error('[server] Error serving bundled file:', e);\n res.status(500).end('Internal server error');\n }\n },\n );\n }\n\n // Action routes — JSON body parsing scoped to action endpoints only\n app.use('/_l5e/action', express.json({ limit: '100kb' }));\n\n // Validate action key format: actionName_hexHash\n const ACTION_KEY_RE = /^[a-zA-Z]\\w+_[0-9a-f]{1,4}$/;\n\n // Load action registry and viewActions glob from virtual module (dev) or built bundle (prod)\n let prodActionRegistry: Record<string, { modulePath: string; actionName: string }> | null = null;\n let prodViewActions: Record<string, () => Promise<any>> | null = null;\n\n async function getActionRegistry(): Promise<\n Record<string, { modulePath: string; actionName: string }>\n > {\n if (!isProduction) {\n const mod = await vite!.ssrLoadModule('virtual:l5e-actions');\n return mod.actionRegistry || {};\n }\n if (!prodActionRegistry) {\n const registryPath = path.join(root, './dist/server/action-registry.json');\n const json = await fs.readFile(registryPath, 'utf-8');\n prodActionRegistry = JSON.parse(json);\n }\n return prodActionRegistry!;\n }\n\n async function getViewActions(): Promise<Record<string, () => Promise<any>>> {\n if (!isProduction) {\n const mod = await vite!.ssrLoadModule('virtual:l5e-actions');\n return mod.viewActions || {};\n }\n if (!prodViewActions) {\n const entryServerPath = path.join(root, './dist/server/entry-server.js');\n const mod = await import(pathToFileURL(entryServerPath).href);\n prodViewActions = mod.viewActions || {};\n }\n return prodViewActions!;\n }\n\n // Action route handler — hashed action keys\n // URL: /_l5e/action/:actionKey (e.g., /_l5e/action/loadMoreComments_a1b2)\n app.all('/_l5e/action/:actionKey', async (req: ExpressRequest, res: ExpressResponse) => {\n try {\n const { actionKey } = req.params;\n\n // Validate action key format\n if (!ACTION_KEY_RE.test(actionKey)) {\n return res.status(400).send('Invalid action key');\n }\n\n // Look up action in registry\n const registry = await getActionRegistry();\n const entry = registry[actionKey];\n if (!entry) {\n return res.status(404).send('Action not found');\n }\n\n const { modulePath, actionName } = entry;\n\n // Import action module via viewActions glob (works in both dev and prod)\n let actionModule: any;\n if (!isProduction) {\n try {\n actionModule = await vite!.ssrLoadModule(`/src/${modulePath}/actions.tsx`);\n } catch {\n actionModule = await vite!.ssrLoadModule(`/src/${modulePath}/actions.ts`);\n }\n } else {\n const viewActions = await getViewActions();\n // Find matching glob entry by modulePath\n const globKey = viewActions[`/src/${modulePath}/actions.tsx`]\n ? `/src/${modulePath}/actions.tsx`\n : viewActions[`/src/${modulePath}/actions.ts`]\n ? `/src/${modulePath}/actions.ts`\n : null;\n if (!globKey) {\n return res.status(404).send('Action module not found');\n }\n actionModule = await viewActions[globKey]();\n }\n\n // Look up exported action — use hasOwnProperty to avoid prototype pollution\n if (!Object.prototype.hasOwnProperty.call(actionModule, actionName)) {\n return res.status(404).send('Action not found');\n }\n const action = actionModule[actionName];\n if (!action || !action.handler) {\n return res.status(404).send('Action not found');\n }\n\n // Enforce the action's declared HTTP method. Previously `app.all` accepted\n // any method and `action.method` was ignored, so a state-changing POST\n // action could be triggered via GET (e.g. <img src>) — a CSRF vector.\n const allowedMethod = (action.method || 'GET').toUpperCase();\n if (req.method.toUpperCase() !== allowedMethod) {\n return res.status(405).set('Allow', allowedMethod).send('Method Not Allowed');\n }\n\n // Run the request through the middleware chain first — same as the HTML\n // handler — so `locals` (locale, country, preview flags, ...) is\n // populated for actions too. Previously this endpoint built its own\n // bare `requestInfo` and never invoked middleware at all, so `locals`\n // (and thus `getLocale()`) was always empty inside an action handler.\n //\n // Crucially, the action must run *inside* the `next` callback passed to\n // the middleware — not after `await`ing the middleware call — because a\n // middleware like `fromFetchMiddleware(paraglideMiddleware)` calls\n // `next()` synchronously inside a library-owned `AsyncLocalStorage.run()`\n // scope. Running the action afterward, once that scope has already\n // closed, would silently lose the library's own ambient `getLocale()`.\n const entryServerPath = path.join(root, './dist/server/entry-server.js');\n const entryServerModule: EntryServerModule = isProduction\n ? await import(pathToFileURL(entryServerPath).href)\n : await vite!.ssrLoadModule('@withl5e/l5e/entry-server');\n const { runInRenderContext } = await (isProduction\n ? import(pathToFileURL(entryServerPath).href)\n : vite!.ssrLoadModule('@withl5e/l5e/jsx-runtime'));\n const { renderJsxToHtmlString } = await (isProduction\n ? import(pathToFileURL(entryServerPath).href)\n : vite!.ssrLoadModule('@withl5e/l5e'));\n\n const locals: Record<string, unknown> = {};\n const initialRequest = createWebRequestFromExpress(req);\n const middlewareContext = createContext({\n request: initialRequest,\n locals,\n clientAddress: requestIp.getClientIp(req) ?? undefined,\n });\n\n const loadedMiddleware = await entryServerModule.loadMiddleware?.();\n const middlewareHandler: MiddlewareHandler =\n typeof loadedMiddleware === 'function'\n ? loadedMiddleware\n : (_ctx, dummyNext) => dummyNext();\n\n // If middleware short-circuits (returns its own Response — a redirect, a\n // 403, ...) instead of calling `next`, this callback never runs and that\n // response wins, same as it would for a page request.\n const response = await middlewareHandler(middlewareContext, async (payload) => {\n const nextRequest = createRewriteRequest(\n payload,\n middlewareContext.request,\n middlewareContext.url,\n );\n const requestInfo = {\n ...createRequestInfo(req, nextRequest, base, locals),\n path: req.originalUrl,\n body: req.body,\n };\n\n const html = await runInRenderContext(\n async () => {\n const jsx = await action.handler(requestInfo);\n return renderJsxToHtmlString(jsx);\n },\n requestInfo,\n modulePath,\n );\n\n return new Response(html, { headers: { 'Content-Type': 'text/html' } });\n });\n\n await sendWebResponse(req, res, response);\n } catch (e: any) {\n vite?.ssrFixStacktrace?.(e);\n console.error('[l5e] Action error:', e.stack || e);\n res.status(500).send('Internal server error');\n }\n });\n\n // Serve HTML\n app.use(async (req: ExpressRequest, res: ExpressResponse) => {\n try {\n const url = req.originalUrl.replace(base, '');\n\n let template: string;\n let render: (\n url: string,\n requestInfo?: any,\n options?: { externalizeIslandProps?: boolean },\n ) => Promise<any>;\n let loadMiddleware: EntryServerModule['loadMiddleware'];\n let manifest: Record<string, any> | undefined;\n\n if (!isProduction) {\n // Always read fresh template in development\n template = await fs.readFile(path.join(root, './index.html'), 'utf-8');\n template = await vite!.transformIndexHtml(url, template);\n\n // Inject Vite HMR client for hot reload\n if (!template.includes('@vite/client')) {\n template = template.replace(\n '</head>',\n '<script type=\"module\" src=\"/@vite/client\"></script></head>',\n );\n }\n\n const entryServer = (await vite!.ssrLoadModule(\n '@withl5e/l5e/entry-server',\n )) as EntryServerModule;\n render = entryServer.render;\n loadMiddleware = entryServer.loadMiddleware;\n } else {\n template = templateHtml;\n const entryServerPath = path.join(root, './dist/server/entry-server.js');\n const entryServer = (await import(\n pathToFileURL(entryServerPath).href\n )) as EntryServerModule;\n render = entryServer.render;\n loadMiddleware = entryServer.loadMiddleware;\n manifest = productionManifest;\n }\n\n const loadedMiddleware = await loadMiddleware?.();\n const handler: MiddlewareHandler =\n typeof loadedMiddleware === 'function' ? loadedMiddleware : (_ctx, next) => next();\n\n const locals: Record<string, unknown> = {};\n const initialRequest = createWebRequestFromExpress(req);\n const context = createContext({\n request: initialRequest,\n requestInfo: createRequestInfo(req, initialRequest, base, locals),\n locals,\n clientAddress: requestIp.getClientIp(req),\n });\n\n const renderResponse = async (webRequest: globalThis.Request) => {\n const nextRequestInfo = createRequestInfo(req, webRequest, base, locals);\n const nextUrl = getRenderUrl(nextRequestInfo.url!, base);\n const nextRendered = await render(nextUrl, nextRequestInfo, {\n externalizeIslandProps,\n });\n return createPageResponse({\n rendered: nextRendered,\n template,\n manifest,\n root,\n distClientDir,\n isProduction,\n assetBase: isProduction ? base : vite!.config.base,\n scriptPolicy,\n });\n };\n\n const next = async (payload?: RewritePayload) => {\n const nextRequest = createRewriteRequest(payload, context.request, context.url);\n context.request = nextRequest;\n context.url = new URL(nextRequest.url);\n context.cookies = parseCookies(nextRequest.headers.get('cookie') ?? undefined);\n context.requestInfo = createRequestInfo(req, nextRequest, base, locals);\n return renderResponse(nextRequest);\n };\n\n context.rewrite = (payload: RewritePayload) => next(payload);\n\n const response = await handler(context, next);\n await sendWebResponse(req, res, response);\n } catch (e: any) {\n vite?.ssrFixStacktrace?.(e);\n console.error(e.stack);\n // Never leak stack traces to the client in production (info disclosure).\n res.status(500).end(isProduction ? 'Internal Server Error' : e.stack);\n }\n });\n\n return { app, vite };\n}\n\nexport async function startServer(options: ServerOptions = {}): Promise<void> {\n const port = options.port || 5173;\n\n // Create Express app first\n // @ts-ignore\n const express = (await import('express')).default;\n const app = express();\n\n // Call callback if provided to allow custom routes before setting up L5E server\n if (options.setupApp) {\n console.log('setupApp');\n await options.setupApp(app);\n }\n\n const { app: serverApp } = await createServer({ ...options, app });\n\n serverApp.listen(port, () => {\n console.log(`Server started at http://localhost:${port}`);\n });\n}\n\nconst MAX_TAGS = 1000;\n\nexport function hashTag(tag: string): string {\n // global tag is not hashed, better for ci/cd\n if (tag === 'global') {\n return 'global';\n }\n\n let hash = 0;\n for (let i = 0; i < tag.length; i++) {\n const char = tag.charCodeAt(i);\n hash = (hash << 5) - hash + char;\n hash = hash & hash; // Convert to 32bit integer\n }\n return Math.abs(hash).toString(36).substring(0, 8);\n}\n\nexport function optimizeCacheTags(tags: Set<string> | string[]): string[] {\n const _tags = Array.isArray(tags) ? tags : [...tags];\n const result = _tags.slice(0, MAX_TAGS).map(hashTag);\n return result;\n}\n"],"mappings":";;;;;;;;;;;;;mCASI,IAAmE;AAQvE,SAAS,IAAmD;CAY1D,OAXA,AACE,OAAyB,YAAY;EAEnC,IAAM,IADU,EAAc,YAAY,GACb,CAAC,CAAC,QAAQ,qBAAqB,GAEtD,IADmB,EAAc,CACH,CAAC,CAAC,QAAQ,UAAU;EACxD,OAAQ,MAAM;;GACO,EAAc,CAAY,CAAC,CAAC;;CAEnD,EAAA,CAAG,GAEE;AACT;AAeA,IAAM,IAA6B;CAAE,MAAM;CAAI,UA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C,IAAI,CAChC;AACd"}
|
package/dist/server.js
CHANGED
|
@@ -1,2 +1,2 @@
|
|
|
1
|
-
import { a as e, i as t, n, r, t as i } from "./server-
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./server-CvsOU9cg.js";
|
|
2
2
|
export { i as applyHtmlLang, n as createServer, r as hashTag, t as optimizeCacheTags, e as startServer };
|