@withl5e/l5e 0.3.3-alpha.4 → 1.0.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/README.md +1 -1
- package/dist/action.js +10 -9
- package/dist/action.js.map +1 -1
- package/dist/defineMiddleware-D017PWDc.js +8 -0
- package/dist/defineMiddleware-D017PWDc.js.map +1 -0
- package/dist/entry-server.js +161 -176
- package/dist/entry-server.js.map +1 -1
- package/dist/exceptions-D4OdiQjY.js +30 -0
- package/dist/exceptions-D4OdiQjY.js.map +1 -0
- package/dist/generateMetadata-DcdY-XC1.js +303 -0
- package/dist/generateMetadata-DcdY-XC1.js.map +1 -0
- package/dist/global-style-BhiGjxVU.js +21 -0
- package/dist/global-style-BhiGjxVU.js.map +1 -0
- package/dist/i18n.js +8 -11
- package/dist/i18n.js.map +1 -1
- package/dist/index.js +9 -55
- package/dist/island/client.js +2 -5
- package/dist/island/runtime.js +90 -107
- package/dist/island/runtime.js.map +1 -1
- package/dist/island.js +38 -56
- package/dist/island.js.map +1 -1
- package/dist/jsx-runtime-CI0Jmr-C.js +275 -0
- package/dist/jsx-runtime-CI0Jmr-C.js.map +1 -0
- package/dist/jsx-runtime.js +2 -31
- package/dist/middleware-CnDqZobD.js +217 -0
- package/dist/middleware-CnDqZobD.js.map +1 -0
- package/dist/middleware.js +3 -8
- package/dist/render-hUQUreah.js +152 -0
- package/dist/render-hUQUreah.js.map +1 -0
- package/dist/rolldown-runtime-B0aSnxlc.js +20 -0
- package/dist/router.js +72 -68
- package/dist/router.js.map +1 -1
- package/dist/seo.js +3 -7
- package/dist/server-5BEwGAL4.js +461 -0
- package/dist/server-5BEwGAL4.js.map +1 -0
- package/dist/server.js +2 -515
- package/dist/strategy-registry-wmHnsHQb.js +9 -0
- package/dist/strategy-registry-wmHnsHQb.js.map +1 -0
- package/dist/swap/server.js +11 -14
- package/dist/swap/server.js.map +1 -1
- package/dist/swap.js +109 -116
- package/dist/swap.js.map +1 -1
- package/dist/tooltip.js +145 -141
- package/dist/tooltip.js.map +1 -1
- package/dist/vite-plugin.js +315 -372
- package/dist/vite-plugin.js.map +1 -1
- package/package.json +8 -8
- package/src/core/bundler.ts +41 -25
- package/src/core/vite-plugin.ts +14 -15
- package/dist/client-D67hK4Yy.js +0 -9
- package/dist/client-D67hK4Yy.js.map +0 -1
- package/dist/defineMiddleware-VdHQuiUc.js +0 -7
- package/dist/defineMiddleware-VdHQuiUc.js.map +0 -1
- package/dist/exceptions-CHPz01DJ.js +0 -39
- package/dist/exceptions-CHPz01DJ.js.map +0 -1
- package/dist/generateMetadata-Cn8BIxq6.js +0 -144
- package/dist/generateMetadata-Cn8BIxq6.js.map +0 -1
- package/dist/global-style-DFvaBcuR.js +0 -27
- package/dist/global-style-DFvaBcuR.js.map +0 -1
- package/dist/index-CybB8Tdk.js +0 -315
- package/dist/index-CybB8Tdk.js.map +0 -1
- package/dist/index.js.map +0 -1
- package/dist/island/client.js.map +0 -1
- package/dist/jsx-runtime-DqAp8xlt.js +0 -296
- package/dist/jsx-runtime-DqAp8xlt.js.map +0 -1
- package/dist/jsx-runtime.js.map +0 -1
- package/dist/middleware.js.map +0 -1
- package/dist/render-CRag-5V7.js +0 -202
- package/dist/render-CRag-5V7.js.map +0 -1
- package/dist/seo.js.map +0 -1
- package/dist/server.js.map +0 -1
package/dist/server.js
CHANGED
|
@@ -1,515 +1,2 @@
|
|
|
1
|
-
import {
|
|
2
|
-
|
|
3
|
-
import f from "node:path";
|
|
4
|
-
import { pathToFileURL as N } from "node:url";
|
|
5
|
-
import Y from "request-ip";
|
|
6
|
-
import { a as rt, s as V } from "./render-CRag-5V7.js";
|
|
7
|
-
import { c as Q, p as ot, a as lt } from "./index-CybB8Tdk.js";
|
|
8
|
-
import { createHash as ut } from "node:crypto";
|
|
9
|
-
import { createRequire as dt } from "node:module";
|
|
10
|
-
import { r as ft } from "./global-style-DFvaBcuR.js";
|
|
11
|
-
let q = null;
|
|
12
|
-
function pt() {
|
|
13
|
-
return q || (q = (async () => {
|
|
14
|
-
const t = dt(import.meta.url), e = t.resolve("vite"), n = t.resolve("rollup", { paths: [f.dirname(e)] });
|
|
15
|
-
return await import(N(n).href);
|
|
16
|
-
})()), q;
|
|
17
|
-
}
|
|
18
|
-
const K = { hash: "", filename: "", content: "" }, Z = /* @__PURE__ */ new Map(), G = /* @__PURE__ */ new Map();
|
|
19
|
-
function at(t, e) {
|
|
20
|
-
const n = G.get(t);
|
|
21
|
-
if (n)
|
|
22
|
-
return n;
|
|
23
|
-
const s = e().catch((r) => {
|
|
24
|
-
throw G.delete(t), r;
|
|
25
|
-
});
|
|
26
|
-
return G.set(t, s), s;
|
|
27
|
-
}
|
|
28
|
-
function X(t) {
|
|
29
|
-
return ut("sha256").update(t).digest("hex").substring(0, 16);
|
|
30
|
-
}
|
|
31
|
-
const O = "\0l5e:bundle-entry";
|
|
32
|
-
function ht(t) {
|
|
33
|
-
return {
|
|
34
|
-
name: "l5e-virtual-entry",
|
|
35
|
-
resolveId(e) {
|
|
36
|
-
return e === O ? O : null;
|
|
37
|
-
},
|
|
38
|
-
load(e) {
|
|
39
|
-
return e === O ? t : null;
|
|
40
|
-
}
|
|
41
|
-
};
|
|
42
|
-
}
|
|
43
|
-
function mt(t) {
|
|
44
|
-
const e = (n) => "/" + f.relative(t, n).replace(/\\/g, "/");
|
|
45
|
-
return {
|
|
46
|
-
name: "vendor-path-rewriter",
|
|
47
|
-
resolveId(n, s) {
|
|
48
|
-
return !n.includes("vendor-") && !n.includes("chunk-") && !n.includes(".global") ? null : f.isAbsolute(n) ? { id: e(n), external: !0 } : s && n.startsWith(".") ? { id: e(f.resolve(f.dirname(s), n)), external: !0 } : null;
|
|
49
|
-
}
|
|
50
|
-
};
|
|
51
|
-
}
|
|
52
|
-
async function wt(t, e) {
|
|
53
|
-
const n = t.map((c) => {
|
|
54
|
-
const T = c.startsWith("/") ? f.join(e, c.substring(1)) : f.join(e, c);
|
|
55
|
-
return `import ${JSON.stringify(T)};`;
|
|
56
|
-
}).join(`
|
|
57
|
-
`), s = {
|
|
58
|
-
input: O,
|
|
59
|
-
plugins: [ht(n), mt(e)],
|
|
60
|
-
external: (c) => !c.startsWith(".") && !f.isAbsolute(c) && c !== O
|
|
61
|
-
}, r = {
|
|
62
|
-
format: "es",
|
|
63
|
-
inlineDynamicImports: !1,
|
|
64
|
-
entryFileNames: "bundle-[hash].js",
|
|
65
|
-
chunkFileNames: "bundle-[hash].js"
|
|
66
|
-
}, { rollup: l } = await pt(), w = await l(s);
|
|
67
|
-
let p;
|
|
68
|
-
try {
|
|
69
|
-
({ output: p } = await w.generate(r));
|
|
70
|
-
} finally {
|
|
71
|
-
await w.close();
|
|
72
|
-
}
|
|
73
|
-
for (const c of p)
|
|
74
|
-
c.type === "chunk" && Z.set(c.fileName, {
|
|
75
|
-
content: c.code || "",
|
|
76
|
-
hash: X(c.code || ""),
|
|
77
|
-
filename: c.fileName,
|
|
78
|
-
mimeType: "application/javascript"
|
|
79
|
-
});
|
|
80
|
-
const o = p[0];
|
|
81
|
-
if (o?.type !== "chunk")
|
|
82
|
-
throw new Error("[bundler] rollup produced no entry chunk");
|
|
83
|
-
return {
|
|
84
|
-
hash: X(o.code || ""),
|
|
85
|
-
filename: o.fileName,
|
|
86
|
-
content: o.code || ""
|
|
87
|
-
};
|
|
88
|
-
}
|
|
89
|
-
async function gt(t, e) {
|
|
90
|
-
if (t.length === 0)
|
|
91
|
-
return K;
|
|
92
|
-
const n = [...new Set(t)].sort(), s = `scripts:${n.join(",")}`;
|
|
93
|
-
try {
|
|
94
|
-
return await at(s, () => wt(n, e));
|
|
95
|
-
} catch (r) {
|
|
96
|
-
return console.error("[bundler] Error bundling scripts:", r), K;
|
|
97
|
-
}
|
|
98
|
-
}
|
|
99
|
-
async function yt(t, e) {
|
|
100
|
-
const n = [];
|
|
101
|
-
for (const w of t) {
|
|
102
|
-
const p = w.startsWith("/") ? f.join(e, w.substring(1)) : f.join(e, w);
|
|
103
|
-
try {
|
|
104
|
-
const o = await D.readFile(p, "utf-8");
|
|
105
|
-
n.push(`/* ${w} */
|
|
106
|
-
${o}
|
|
107
|
-
`);
|
|
108
|
-
} catch (o) {
|
|
109
|
-
console.warn(`[bundler] Failed to read CSS file: ${w}`, o);
|
|
110
|
-
}
|
|
111
|
-
}
|
|
112
|
-
const s = n.join(`
|
|
113
|
-
|
|
114
|
-
`), r = X(s), l = `bundle-${r}.css`;
|
|
115
|
-
return Z.set(l, {
|
|
116
|
-
content: s,
|
|
117
|
-
hash: r,
|
|
118
|
-
filename: l,
|
|
119
|
-
mimeType: "text/css"
|
|
120
|
-
}), { hash: r, filename: l, content: s };
|
|
121
|
-
}
|
|
122
|
-
async function bt(t, e) {
|
|
123
|
-
if (t.length === 0)
|
|
124
|
-
return K;
|
|
125
|
-
const n = [...new Set(t)].sort(), s = `css:${n.join(",")}`;
|
|
126
|
-
try {
|
|
127
|
-
return await at(s, () => yt(n, e));
|
|
128
|
-
} catch (r) {
|
|
129
|
-
return console.error("[bundler] Error bundling CSS:", r), K;
|
|
130
|
-
}
|
|
131
|
-
}
|
|
132
|
-
function vt(t) {
|
|
133
|
-
return Z.get(t);
|
|
134
|
-
}
|
|
135
|
-
function St(t, e) {
|
|
136
|
-
const n = rt(e);
|
|
137
|
-
return t.replace(/<html\b([^>]*)>/i, (s, r) => /\blang\s*=/i.test(r) ? s.replace(/lang\s*=\s*"[^"]*"/i, () => `lang="${n}"`) : `<html lang="${n}"${r}>`);
|
|
138
|
-
}
|
|
139
|
-
function xt(t) {
|
|
140
|
-
return new URL(`${t.protocol}://${t.get("host")}${t.originalUrl}`);
|
|
141
|
-
}
|
|
142
|
-
function it(t, e) {
|
|
143
|
-
return `${t.pathname}${t.search}`.replace(e, "") || "/";
|
|
144
|
-
}
|
|
145
|
-
function tt(t) {
|
|
146
|
-
const e = {
|
|
147
|
-
method: t.method,
|
|
148
|
-
headers: lt(t)
|
|
149
|
-
};
|
|
150
|
-
return t.method !== "GET" && t.method !== "HEAD" && (e.body = t, e.duplex = "half"), new globalThis.Request(xt(t).href, e);
|
|
151
|
-
}
|
|
152
|
-
function J(t, e, n, s) {
|
|
153
|
-
const r = new URL(e.url), l = it(r, n), w = l.startsWith("/") ? l : `/${l}`, p = {};
|
|
154
|
-
return e.headers.forEach((o, c) => {
|
|
155
|
-
p[c] = o;
|
|
156
|
-
}), {
|
|
157
|
-
url: r,
|
|
158
|
-
path: w,
|
|
159
|
-
pathname: r.pathname,
|
|
160
|
-
method: e.method,
|
|
161
|
-
headers: p,
|
|
162
|
-
cookies: ot(e.headers.get("cookie") ?? void 0),
|
|
163
|
-
query: Object.fromEntries(r.searchParams.entries()),
|
|
164
|
-
ip: Y.getClientIp(t) ?? void 0,
|
|
165
|
-
locals: s
|
|
166
|
-
};
|
|
167
|
-
}
|
|
168
|
-
function et(t, e, n) {
|
|
169
|
-
return t ? t instanceof globalThis.Request ? t : t instanceof URL ? new globalThis.Request(t.href, e.clone()) : new globalThis.Request(new URL(t, n).href, e.clone()) : e;
|
|
170
|
-
}
|
|
171
|
-
async function nt(t, e, n) {
|
|
172
|
-
e.status(n.status);
|
|
173
|
-
const s = Ct(n.headers);
|
|
174
|
-
if (n.headers.forEach((l, w) => {
|
|
175
|
-
w.toLowerCase() !== "set-cookie" && e.setHeader(w, l);
|
|
176
|
-
}), s.length > 0 && e.setHeader("Set-Cookie", s), t.method === "HEAD") {
|
|
177
|
-
e.end();
|
|
178
|
-
return;
|
|
179
|
-
}
|
|
180
|
-
const r = Buffer.from(await n.arrayBuffer());
|
|
181
|
-
e.send(r);
|
|
182
|
-
}
|
|
183
|
-
function Ct(t) {
|
|
184
|
-
const e = t.getSetCookie;
|
|
185
|
-
if (typeof e == "function")
|
|
186
|
-
return e.call(t);
|
|
187
|
-
const n = t.raw?.();
|
|
188
|
-
if (n?.["set-cookie"])
|
|
189
|
-
return n["set-cookie"];
|
|
190
|
-
const s = t.get("set-cookie");
|
|
191
|
-
return s ? $t(s) : [];
|
|
192
|
-
}
|
|
193
|
-
function $t(t) {
|
|
194
|
-
const e = [];
|
|
195
|
-
let n = 0;
|
|
196
|
-
for (let s = 0; s < t.length; s++) {
|
|
197
|
-
if (t[s] !== ",") continue;
|
|
198
|
-
const r = t.slice(s + 1);
|
|
199
|
-
/^\s*[^=;,]+=/.test(r) && (e.push(t.slice(n, s).trim()), n = s + 1);
|
|
200
|
-
}
|
|
201
|
-
return e.push(t.slice(n).trim()), e.filter(Boolean);
|
|
202
|
-
}
|
|
203
|
-
function Rt(t) {
|
|
204
|
-
if (!t.rawResponse)
|
|
205
|
-
return null;
|
|
206
|
-
const { body: e, contentType: n, statusCode: s, headers: r } = t.rawResponse, l = new Headers(r);
|
|
207
|
-
return l.set("Content-Type", n), new globalThis.Response(e, {
|
|
208
|
-
status: s || 200,
|
|
209
|
-
headers: l
|
|
210
|
-
});
|
|
211
|
-
}
|
|
212
|
-
async function jt({
|
|
213
|
-
rendered: t,
|
|
214
|
-
template: e,
|
|
215
|
-
manifest: n,
|
|
216
|
-
root: s,
|
|
217
|
-
distClientDir: r,
|
|
218
|
-
isProduction: l,
|
|
219
|
-
assetBase: w
|
|
220
|
-
}) {
|
|
221
|
-
const p = Rt(t);
|
|
222
|
-
if (p)
|
|
223
|
-
return p;
|
|
224
|
-
if (t.redirect)
|
|
225
|
-
return new globalThis.Response(null, {
|
|
226
|
-
status: t.redirect.statusCode,
|
|
227
|
-
headers: {
|
|
228
|
-
Location: t.redirect.url
|
|
229
|
-
}
|
|
230
|
-
});
|
|
231
|
-
let o = t.scripts || [], c = t.styles || [];
|
|
232
|
-
const T = t.islands || [];
|
|
233
|
-
let I = t.cacheTags || [];
|
|
234
|
-
const H = t.maxAge, W = t.sMaxAge, B = t.swr;
|
|
235
|
-
let a = "";
|
|
236
|
-
const h = /* @__PURE__ */ new Set(), g = (v, u = !1) => {
|
|
237
|
-
h.has(v) || (h.add(v), a += `<link rel="stylesheet"${u ? " crossorigin" : ""} href="${rt(v)}">`);
|
|
238
|
-
};
|
|
239
|
-
let b = [], $ = "";
|
|
240
|
-
const S = ft({
|
|
241
|
-
root: s,
|
|
242
|
-
manifest: n,
|
|
243
|
-
isProduction: l,
|
|
244
|
-
base: w
|
|
245
|
-
});
|
|
246
|
-
S && g(S, l);
|
|
247
|
-
let A = "";
|
|
248
|
-
if (t.islandData && t.islandData.length > 0 && (A = `<script type="application/json" id="_l5e_data_">${V(
|
|
249
|
-
t.islandData,
|
|
250
|
-
{ isJSON: !0 }
|
|
251
|
-
)}<\/script>`), l && n) {
|
|
252
|
-
let v = function(i) {
|
|
253
|
-
const m = n[i];
|
|
254
|
-
return m ? (m.css && m.css.forEach((x) => u.add(x)), m.imports && m.imports.forEach((x) => {
|
|
255
|
-
const P = n[x];
|
|
256
|
-
P?.file && d.add(P.file), P?.css && P.css.forEach((U) => u.add(U)), P?.imports && P.imports.forEach((U) => {
|
|
257
|
-
const z = n[U];
|
|
258
|
-
z?.file && d.add(z.file), z?.css && z.css.forEach((ct) => u.add(ct));
|
|
259
|
-
});
|
|
260
|
-
}), { file: m.file }) : { file: null };
|
|
261
|
-
};
|
|
262
|
-
o = o.filter((i) => !i.includes(".global.")), c = c.filter((i) => !i.includes(".global."));
|
|
263
|
-
const u = /* @__PURE__ */ new Set(), d = /* @__PURE__ */ new Set(), j = [];
|
|
264
|
-
for (const i of o) {
|
|
265
|
-
const m = i.replace(/^\//, ""), { file: x } = v(m);
|
|
266
|
-
x && j.push(`/${x}`);
|
|
267
|
-
}
|
|
268
|
-
const F = [];
|
|
269
|
-
for (const i of c) {
|
|
270
|
-
const m = i.replace(/^\//, ""), { file: x } = v(m);
|
|
271
|
-
x && (F.push(`/${x}`), u.add(x));
|
|
272
|
-
}
|
|
273
|
-
if (j.length > 0) {
|
|
274
|
-
const i = await gt(j, r);
|
|
275
|
-
o = i.filename ? [`/${i.filename}`] : j;
|
|
276
|
-
}
|
|
277
|
-
if (F.length > 0) {
|
|
278
|
-
const i = await bt(F, r);
|
|
279
|
-
i.filename && (c = [`/${i.filename}`]);
|
|
280
|
-
}
|
|
281
|
-
const L = n["src/client.global.ts"];
|
|
282
|
-
if (L && (L.css && L.css.length > 0 && L.css.forEach((i) => {
|
|
283
|
-
g(`/${i}`, !0);
|
|
284
|
-
}), L.file && b.push(`/${L.file}`)), T.length > 0) {
|
|
285
|
-
const i = {};
|
|
286
|
-
for (const m of T) {
|
|
287
|
-
const x = n[m.src];
|
|
288
|
-
x?.file && (i[m.key] = `/${x.file}`);
|
|
289
|
-
}
|
|
290
|
-
Object.keys(i).length > 0 && ($ = `<script>window.__L5E_ISLANDS__=${V(i)}<\/script>`);
|
|
291
|
-
}
|
|
292
|
-
c.length > 0 && c.forEach((i) => g(i, !0));
|
|
293
|
-
}
|
|
294
|
-
l || [...new Set(c)].forEach((v) => g(v));
|
|
295
|
-
let y = [...b, ...o];
|
|
296
|
-
if (!l) {
|
|
297
|
-
const v = f.join(s, "src", "client.global.ts");
|
|
298
|
-
if (st(v) && (y = ["/src/client.global.ts", ...y]), y = [...new Set(y)], T.length > 0) {
|
|
299
|
-
const u = {};
|
|
300
|
-
for (const d of T)
|
|
301
|
-
u[d.key] = `/${d.src}`;
|
|
302
|
-
$ = `<script>window.__L5E_ISLANDS__=${V(u)}<\/script>`;
|
|
303
|
-
}
|
|
304
|
-
}
|
|
305
|
-
const M = A + $ + y.map((v) => `<script type="module" src="${v}"><\/script>`).join(""), E = t.lang ? St(e, t.lang) : e, _ = t.rawHtml ? t.html || "" : E.replace("<!--app-head-->", () => (t.head ?? "") + a).replace("<!--app-html-->", () => t.html ?? "").replace("<!--app-scripts-->", () => M), C = new Headers({
|
|
306
|
-
"Content-Type": "text/html"
|
|
307
|
-
}), k = [], R = [];
|
|
308
|
-
return H !== void 0 && (k.push(`max-age=${H}`), R.push(`max-age=${H}`)), W !== void 0 && R.push(`s-maxage=${W}`), B !== void 0 && R.push(`stale-while-revalidate=${B}`), (k.length > 0 || R.length > 0) && l && (k.push("public"), k.push("must-revalidate"), R.push("public"), C.set("Cache-Control", k.join(", ")), C.set("CDN-Cache-Control", R.join(", "))), process.env.NODE_ENV === "production" && (I = Tt(I)), C.set("Cache-Tag", ["global", ...I].join(",")), new globalThis.Response(_, {
|
|
309
|
-
status: t.statusCode || 200,
|
|
310
|
-
headers: C
|
|
311
|
-
});
|
|
312
|
-
}
|
|
313
|
-
async function At(t = {}) {
|
|
314
|
-
const e = t.root || process.cwd(), n = t.base || "/", s = process.env.NODE_ENV === "production", r = t.externalizeIslandProps ?? !0, l = s ? await D.readFile(f.join(e, "./index.html"), "utf-8") : "", w = (await import("express")).default, p = t.app || w();
|
|
315
|
-
if (t.publicDir) {
|
|
316
|
-
const a = f.isAbsolute(t.publicDir) ? t.publicDir : f.join(e, t.publicDir);
|
|
317
|
-
st(a) && p.use(w.static(a));
|
|
318
|
-
}
|
|
319
|
-
let o;
|
|
320
|
-
const c = f.join(e, "./dist/client");
|
|
321
|
-
if (s) {
|
|
322
|
-
const a = (await import("compression")).default, h = (await import("sirv")).default;
|
|
323
|
-
p.use(a()), p.use(n, h(c, { extensions: [] })), p.get(
|
|
324
|
-
`${n === "/" ? "" : n}/bundle-:hash.:ext`,
|
|
325
|
-
async (g, b) => {
|
|
326
|
-
try {
|
|
327
|
-
const { hash: $, ext: S } = g.params, A = `bundle-${$}.${S}`, y = vt(A);
|
|
328
|
-
if (!y)
|
|
329
|
-
return b.status(404).send("Bundled file not found");
|
|
330
|
-
b.set({
|
|
331
|
-
"Content-Type": y.mimeType,
|
|
332
|
-
"Cache-Control": "public, max-age=31536000, immutable"
|
|
333
|
-
}), b.send(y.content);
|
|
334
|
-
} catch ($) {
|
|
335
|
-
console.error("[server] Error serving bundled file:", $), b.status(500).end("Internal server error");
|
|
336
|
-
}
|
|
337
|
-
}
|
|
338
|
-
);
|
|
339
|
-
} else {
|
|
340
|
-
const { createServer: a } = await import("vite"), h = f.join(e, "vite.config.js");
|
|
341
|
-
o = await a({
|
|
342
|
-
root: e,
|
|
343
|
-
configFile: h,
|
|
344
|
-
server: { middlewareMode: !0 },
|
|
345
|
-
appType: "custom",
|
|
346
|
-
base: n,
|
|
347
|
-
optimizeDeps: {
|
|
348
|
-
exclude: ["@withl5e/l5e", "file-type"]
|
|
349
|
-
},
|
|
350
|
-
ssr: {
|
|
351
|
-
resolve: {
|
|
352
|
-
conditions: ["development", "default"]
|
|
353
|
-
}
|
|
354
|
-
},
|
|
355
|
-
resolve: {
|
|
356
|
-
conditions: ["development", "default"]
|
|
357
|
-
}
|
|
358
|
-
}), p.use(o.middlewares);
|
|
359
|
-
}
|
|
360
|
-
p.use("/_l5e/action", w.json({ limit: "100kb" }));
|
|
361
|
-
const T = /^[a-zA-Z]\w+_[0-9a-f]{1,4}$/;
|
|
362
|
-
let I = null, H = null;
|
|
363
|
-
async function W() {
|
|
364
|
-
if (!s)
|
|
365
|
-
return (await o.ssrLoadModule("virtual:l5e-actions")).actionRegistry || {};
|
|
366
|
-
if (!I) {
|
|
367
|
-
const a = f.join(e, "./dist/server/action-registry.json"), h = await D.readFile(a, "utf-8");
|
|
368
|
-
I = JSON.parse(h);
|
|
369
|
-
}
|
|
370
|
-
return I;
|
|
371
|
-
}
|
|
372
|
-
async function B() {
|
|
373
|
-
if (!s)
|
|
374
|
-
return (await o.ssrLoadModule("virtual:l5e-actions")).viewActions || {};
|
|
375
|
-
if (!H) {
|
|
376
|
-
const a = f.join(e, "./dist/server/entry-server.js");
|
|
377
|
-
H = (await import(N(a).href)).viewActions || {};
|
|
378
|
-
}
|
|
379
|
-
return H;
|
|
380
|
-
}
|
|
381
|
-
return p.all("/_l5e/action/:actionKey", async (a, h) => {
|
|
382
|
-
try {
|
|
383
|
-
const { actionKey: g } = a.params;
|
|
384
|
-
if (!T.test(g))
|
|
385
|
-
return h.status(400).send("Invalid action key");
|
|
386
|
-
const $ = (await W())[g];
|
|
387
|
-
if (!$)
|
|
388
|
-
return h.status(404).send("Action not found");
|
|
389
|
-
const { modulePath: S, actionName: A } = $;
|
|
390
|
-
let y;
|
|
391
|
-
if (s) {
|
|
392
|
-
const i = await B(), m = i[`/src/${S}/actions.tsx`] ? `/src/${S}/actions.tsx` : i[`/src/${S}/actions.ts`] ? `/src/${S}/actions.ts` : null;
|
|
393
|
-
if (!m)
|
|
394
|
-
return h.status(404).send("Action module not found");
|
|
395
|
-
y = await i[m]();
|
|
396
|
-
} else
|
|
397
|
-
try {
|
|
398
|
-
y = await o.ssrLoadModule(`/src/${S}/actions.tsx`);
|
|
399
|
-
} catch {
|
|
400
|
-
y = await o.ssrLoadModule(`/src/${S}/actions.ts`);
|
|
401
|
-
}
|
|
402
|
-
if (!Object.prototype.hasOwnProperty.call(y, A))
|
|
403
|
-
return h.status(404).send("Action not found");
|
|
404
|
-
const M = y[A];
|
|
405
|
-
if (!M || !M.handler)
|
|
406
|
-
return h.status(404).send("Action not found");
|
|
407
|
-
const E = (M.method || "GET").toUpperCase();
|
|
408
|
-
if (a.method.toUpperCase() !== E)
|
|
409
|
-
return h.status(405).set("Allow", E).send("Method Not Allowed");
|
|
410
|
-
const _ = f.join(e, "./dist/server/entry-server.js"), C = s ? await import(N(_).href) : await o.ssrLoadModule("@withl5e/l5e/entry-server"), { runInRenderContext: k } = await (s ? import(N(_).href) : o.ssrLoadModule("@withl5e/l5e/jsx-runtime")), { renderJsxToHtmlString: R } = await (s ? import(N(_).href) : o.ssrLoadModule("@withl5e/l5e")), v = {}, u = tt(a), d = Q({
|
|
411
|
-
request: u,
|
|
412
|
-
locals: v,
|
|
413
|
-
clientAddress: Y.getClientIp(a) ?? void 0
|
|
414
|
-
}), j = await C.loadMiddleware?.(), L = await (typeof j == "function" ? j : (i, m) => m())(d, async (i) => {
|
|
415
|
-
const m = et(i, d.request, d.url), x = {
|
|
416
|
-
...J(a, m, n, v),
|
|
417
|
-
path: a.originalUrl,
|
|
418
|
-
body: a.body
|
|
419
|
-
}, P = await k(
|
|
420
|
-
async () => {
|
|
421
|
-
const U = await M.handler(x);
|
|
422
|
-
return R(U);
|
|
423
|
-
},
|
|
424
|
-
x,
|
|
425
|
-
S
|
|
426
|
-
);
|
|
427
|
-
return new Response(P, { headers: { "Content-Type": "text/html" } });
|
|
428
|
-
});
|
|
429
|
-
await nt(a, h, L);
|
|
430
|
-
} catch (g) {
|
|
431
|
-
o?.ssrFixStacktrace?.(g), console.error("[l5e] Action error:", g.stack || g), h.status(500).send("Internal server error");
|
|
432
|
-
}
|
|
433
|
-
}), p.use(async (a, h) => {
|
|
434
|
-
try {
|
|
435
|
-
const g = a.originalUrl.replace(n, "");
|
|
436
|
-
let b, $, S, A;
|
|
437
|
-
if (s) {
|
|
438
|
-
b = l;
|
|
439
|
-
const u = f.join(e, "./dist/server/entry-server.js"), d = await import(N(u).href);
|
|
440
|
-
$ = d.render, S = d.loadMiddleware;
|
|
441
|
-
const j = await D.readFile(
|
|
442
|
-
f.join(e, "./dist/client/.vite/manifest.json"),
|
|
443
|
-
"utf-8"
|
|
444
|
-
);
|
|
445
|
-
A = JSON.parse(j);
|
|
446
|
-
} else {
|
|
447
|
-
b = await D.readFile(f.join(e, "./index.html"), "utf-8"), b = await o.transformIndexHtml(g, b), b.includes("@vite/client") || (b = b.replace(
|
|
448
|
-
"</head>",
|
|
449
|
-
'<script type="module" src="/@vite/client"><\/script></head>'
|
|
450
|
-
));
|
|
451
|
-
const u = await o.ssrLoadModule(
|
|
452
|
-
"@withl5e/l5e/entry-server"
|
|
453
|
-
);
|
|
454
|
-
$ = u.render, S = u.loadMiddleware;
|
|
455
|
-
}
|
|
456
|
-
const y = await S?.(), M = typeof y == "function" ? y : (u, d) => d(), E = {}, _ = tt(a), C = Q({
|
|
457
|
-
request: _,
|
|
458
|
-
requestInfo: J(a, _, n, E),
|
|
459
|
-
locals: E,
|
|
460
|
-
clientAddress: Y.getClientIp(a)
|
|
461
|
-
}), k = async (u) => {
|
|
462
|
-
const d = J(a, u, n, E), j = it(d.url, n), F = await $(j, d, {
|
|
463
|
-
externalizeIslandProps: r
|
|
464
|
-
});
|
|
465
|
-
return jt({
|
|
466
|
-
rendered: F,
|
|
467
|
-
template: b,
|
|
468
|
-
manifest: A,
|
|
469
|
-
root: e,
|
|
470
|
-
distClientDir: c,
|
|
471
|
-
isProduction: s,
|
|
472
|
-
assetBase: s ? n : o.config.base
|
|
473
|
-
});
|
|
474
|
-
}, R = async (u) => {
|
|
475
|
-
const d = et(u, C.request, C.url);
|
|
476
|
-
return C.request = d, C.url = new URL(d.url), C.cookies = ot(d.headers.get("cookie") ?? void 0), C.requestInfo = J(a, d, n, E), k(d);
|
|
477
|
-
};
|
|
478
|
-
C.rewrite = (u) => R(u);
|
|
479
|
-
const v = await M(C, R);
|
|
480
|
-
await nt(a, h, v);
|
|
481
|
-
} catch (g) {
|
|
482
|
-
o?.ssrFixStacktrace?.(g), console.error(g.stack), h.status(500).end(s ? "Internal Server Error" : g.stack);
|
|
483
|
-
}
|
|
484
|
-
}), { app: p, vite: o };
|
|
485
|
-
}
|
|
486
|
-
async function Ot(t = {}) {
|
|
487
|
-
const e = t.port || 5173, n = (await import("express")).default, s = n();
|
|
488
|
-
t.setupApp && (console.log("setupApp"), await t.setupApp(s));
|
|
489
|
-
const { app: r } = await At({ ...t, app: s });
|
|
490
|
-
r.listen(e, () => {
|
|
491
|
-
console.log(`Server started at http://localhost:${e}`);
|
|
492
|
-
});
|
|
493
|
-
}
|
|
494
|
-
const Et = 1e3;
|
|
495
|
-
function kt(t) {
|
|
496
|
-
if (t === "global")
|
|
497
|
-
return "global";
|
|
498
|
-
let e = 0;
|
|
499
|
-
for (let n = 0; n < t.length; n++) {
|
|
500
|
-
const s = t.charCodeAt(n);
|
|
501
|
-
e = (e << 5) - e + s, e = e & e;
|
|
502
|
-
}
|
|
503
|
-
return Math.abs(e).toString(36).substring(0, 8);
|
|
504
|
-
}
|
|
505
|
-
function Tt(t) {
|
|
506
|
-
return (Array.isArray(t) ? t : [...t]).slice(0, Et).map(kt);
|
|
507
|
-
}
|
|
508
|
-
export {
|
|
509
|
-
St as applyHtmlLang,
|
|
510
|
-
At as createServer,
|
|
511
|
-
kt as hashTag,
|
|
512
|
-
Tt as optimizeCacheTags,
|
|
513
|
-
Ot as startServer
|
|
514
|
-
};
|
|
515
|
-
//# sourceMappingURL=server.js.map
|
|
1
|
+
import { a as e, i as t, n, r, t as i } from "./server-5BEwGAL4.js";
|
|
2
|
+
export { i as applyHtmlLang, n as createServer, r as hashTag, t as optimizeCacheTags, e as startServer };
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
//#region src/island/strategy-registry.ts
|
|
2
|
+
var e = /* @__PURE__ */ new Map();
|
|
3
|
+
function t(t, n) {
|
|
4
|
+
e.has(t) && console.warn(`[l5e-island] Strategy "${t}" already registered, overwriting.`), e.set(t, n);
|
|
5
|
+
}
|
|
6
|
+
//#endregion
|
|
7
|
+
export { e as n, t };
|
|
8
|
+
|
|
9
|
+
//# sourceMappingURL=strategy-registry-wmHnsHQb.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"strategy-registry-wmHnsHQb.js","names":[],"sources":["../src/island/strategy-registry.ts"],"sourcesContent":["import type { MountStrategy } from './types';\n\nexport const strategies = new Map<string, MountStrategy>();\n\nexport function registerMountStrategy(name: string, fn: MountStrategy) {\n if (strategies.has(name)) {\n console.warn(`[l5e-island] Strategy \"${name}\" already registered, overwriting.`);\n }\n strategies.set(name, fn);\n}\n"],"mappings":";AAEA,IAAa,oBAAa,IAAI,IAA2B;AAEzD,SAAgB,EAAsB,GAAc,GAAmB;CAIrE,AAHI,EAAW,IAAI,CAAI,KACrB,QAAQ,KAAK,0BAA0B,EAAK,mCAAmC,GAEjF,EAAW,IAAI,GAAM,CAAE;AACzB"}
|
package/dist/swap/server.js
CHANGED
|
@@ -1,15 +1,12 @@
|
|
|
1
|
-
import { jsxFactory as
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
},
|
|
9
|
-
o
|
|
10
|
-
);
|
|
1
|
+
import { jsxFactory as e } from "@withl5e/l5e/jsx-runtime";
|
|
2
|
+
//#region src/swap/SwapResponse.tsx
|
|
3
|
+
function t({ children: t, hasMore: n, meta: r }) {
|
|
4
|
+
return /* @__PURE__ */ e("div", {
|
|
5
|
+
"data-has-more": n === void 0 ? void 0 : String(n),
|
|
6
|
+
...r && Object.fromEntries(Object.entries(r).map(([e, t]) => [`data-${e}`, t]))
|
|
7
|
+
}, t);
|
|
11
8
|
}
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
//# sourceMappingURL=server.js.map
|
|
9
|
+
//#endregion
|
|
10
|
+
export { t as SwapResponse };
|
|
11
|
+
|
|
12
|
+
//# sourceMappingURL=server.js.map
|
package/dist/swap/server.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.js","sources":["../../src/swap/SwapResponse.tsx"],"sourcesContent":["interface SwapResponseProps {\n children: JSX.Element | JSX.Element[];\n hasMore?: boolean;\n meta?: Record<string, string>;\n}\n\nexport function SwapResponse({ children, hasMore, meta }: SwapResponseProps) {\n return (\n <div\n data-has-more={hasMore !== undefined ? String(hasMore) : undefined}\n {...(meta && Object.fromEntries(Object.entries(meta).map(([k, v]) => [`data-${k}`, v])))}\n >\n {children}\n </div>\n );\n}\n"],"
|
|
1
|
+
{"version":3,"file":"server.js","names":[],"sources":["../../src/swap/SwapResponse.tsx"],"sourcesContent":["interface SwapResponseProps {\n children: JSX.Element | JSX.Element[];\n hasMore?: boolean;\n meta?: Record<string, string>;\n}\n\nexport function SwapResponse({ children, hasMore, meta }: SwapResponseProps) {\n return (\n <div\n data-has-more={hasMore !== undefined ? String(hasMore) : undefined}\n {...(meta && Object.fromEntries(Object.entries(meta).map(([k, v]) => [`data-${k}`, v])))}\n >\n {children}\n </div>\n );\n}\n"],"mappings":";;AAM6E,SAAA,EAAA,EAAA,aAAA,YAAA,WAAA;CAC3E,OACE,kBAAC,OAAD;EACE,iBAAe,MAAY,KAAA,IAA8B,KAAA,IAAlB,OAAO,CAAO;EACrD,GAAK,KAAQ,OAAO,YAAY,OAAO,QAAQ,CAAI,CAAC,CAAC,KAAK,CAAC,GAAG,OAAO,CAAC,QAAQ,KAAK,CAAC,CAAC,CAAC;CAGnF,GADF,CACE;AAET"}
|