vue-ssr-lite 0.1.13 → 0.2.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.
- package/README.md +169 -159
- package/dist/SsrApplicationRuntime.d.ts.map +1 -1
- package/dist/SsrBrowserRuntime.d.ts +7 -6
- package/dist/SsrBrowserRuntime.d.ts.map +1 -1
- package/dist/SsrConfigCompileRuntime.d.ts +40 -0
- package/dist/SsrConfigCompileRuntime.d.ts.map +1 -0
- package/dist/SsrConfigRuntime.d.ts +4 -0
- package/dist/SsrConfigRuntime.d.ts.map +1 -0
- package/dist/SsrConfigTypes.d.ts +106 -0
- package/dist/SsrConfigTypes.d.ts.map +1 -0
- package/dist/SsrDomainRuntime.d.ts +38 -0
- package/dist/SsrDomainRuntime.d.ts.map +1 -0
- package/dist/SsrReactivityRuntime.d.ts +8 -1
- package/dist/SsrReactivityRuntime.d.ts.map +1 -1
- package/dist/SsrRenderRuntime.d.ts.map +1 -1
- package/dist/SsrRequestResolution.d.ts +3 -1
- package/dist/SsrRequestResolution.d.ts.map +1 -1
- package/dist/SsrRuntimeTypes.d.ts +6 -21
- package/dist/SsrRuntimeTypes.d.ts.map +1 -1
- package/dist/SsrTestFixtures.d.ts +8 -0
- package/dist/SsrTestFixtures.d.ts.map +1 -0
- package/dist/chunks/SsrApplicationRuntime-D4arUtsy.mjs +238 -0
- package/dist/chunks/SsrConfigRuntime-D0DkOrVQ.mjs +4 -0
- package/dist/chunks/SsrReactivityRuntime-CroM1WJG.mjs +28 -0
- package/dist/chunks/SsrServerRuntime-D7cDSFNm.mjs +1004 -0
- package/dist/cli.mjs +34 -34
- package/dist/client.d.ts +1 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.mjs +79 -56
- package/dist/index.d.ts +4 -2
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +25 -19
- package/dist/server/SsrHostRuntime.d.ts +52 -2
- package/dist/server/SsrHostRuntime.d.ts.map +1 -1
- package/dist/server/SsrServerRuntime.d.ts.map +1 -1
- package/dist/server.d.ts +3 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.mjs +73 -60
- package/package.json +1 -1
- package/dist/chunks/SsrApplicationRuntime-lMR_sMdk.mjs +0 -155
- package/dist/chunks/SsrReactivityRuntime-CUbPx7ew.mjs +0 -9
- package/dist/chunks/SsrServerRuntime-nBan8KxD.mjs +0 -731
package/dist/cli.mjs
CHANGED
|
@@ -1,19 +1,19 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { resolve as
|
|
3
|
-
import { pathToFileURL as
|
|
4
|
-
import {
|
|
5
|
-
import { createServer as
|
|
6
|
-
const
|
|
2
|
+
import { resolve as c, relative as f } from "node:path";
|
|
3
|
+
import { pathToFileURL as w } from "node:url";
|
|
4
|
+
import { r as S, c as b } from "./chunks/SsrServerRuntime-D7cDSFNm.mjs";
|
|
5
|
+
import { createServer as g } from "node:net";
|
|
6
|
+
const i = 1, a = 65535, h = (r) => {
|
|
7
7
|
const e = r?.trim();
|
|
8
8
|
if (!e) return;
|
|
9
9
|
if (!/^\d+$/.test(e))
|
|
10
|
-
throw new Error(`HMR port must be an integer between ${
|
|
10
|
+
throw new Error(`HMR port must be an integer between ${i} and ${a}.`);
|
|
11
11
|
const t = Number(e);
|
|
12
|
-
if (!Number.isInteger(t) || t <
|
|
13
|
-
throw new Error(`HMR port must be an integer between ${
|
|
12
|
+
if (!Number.isInteger(t) || t < i || t > a)
|
|
13
|
+
throw new Error(`HMR port must be an integer between ${i} and ${a}.`);
|
|
14
14
|
return t;
|
|
15
|
-
},
|
|
16
|
-
const t =
|
|
15
|
+
}, P = () => new Promise((r, e) => {
|
|
16
|
+
const t = g();
|
|
17
17
|
t.once("error", e), t.listen({ port: 0, exclusive: !0 }, () => {
|
|
18
18
|
const o = t.address();
|
|
19
19
|
if (!o || typeof o == "string") {
|
|
@@ -24,64 +24,64 @@ const a = 1, c = 65535, R = (r) => {
|
|
|
24
24
|
s ? e(s) : r(o.port);
|
|
25
25
|
});
|
|
26
26
|
});
|
|
27
|
-
}),
|
|
27
|
+
}), R = async (r) => h(r) ?? P(), n = (r, e) => {
|
|
28
28
|
const t = r.indexOf(e);
|
|
29
29
|
return t >= 0 ? r[t + 1] : void 0;
|
|
30
|
-
}, T = (r) => {
|
|
30
|
+
}, T = async (r) => {
|
|
31
31
|
const e = r[0];
|
|
32
32
|
if (!["dev", "build", "start"].includes(e))
|
|
33
33
|
throw new Error(
|
|
34
|
-
"Usage: vue-ssr-lite <dev|build|start> [--root .] [--
|
|
34
|
+
"Usage: vue-ssr-lite <dev|build|start> [--root .] [--config ssr.config.ts] [--hmr-port 31001]"
|
|
35
35
|
);
|
|
36
|
-
const t =
|
|
36
|
+
const t = c(n(r, "--root") || process.cwd()), o = await S(t, n(r, "--config"));
|
|
37
37
|
return {
|
|
38
38
|
command: e,
|
|
39
39
|
root: t,
|
|
40
|
-
|
|
41
|
-
serverOutput:
|
|
40
|
+
config: o,
|
|
41
|
+
serverOutput: c(
|
|
42
42
|
t,
|
|
43
43
|
n(r, "--server-output") || "dist/server/SsrRuntime.js"
|
|
44
44
|
),
|
|
45
45
|
hmrPort: n(r, "--hmr-port") || process.env.VUE_SSR_LITE_HMR_PORT
|
|
46
46
|
};
|
|
47
|
-
},
|
|
48
|
-
const t = e ? void 0 : await
|
|
47
|
+
}, y = async (r, e) => {
|
|
48
|
+
const t = e ? void 0 : await R(r.hmrPort), o = e ? void 0 : (await import("vite")).createServer, s = e ? void 0 : await o({
|
|
49
49
|
root: r.root,
|
|
50
50
|
server: {
|
|
51
51
|
middlewareMode: !0,
|
|
52
52
|
hmr: { port: t, clientPort: t }
|
|
53
53
|
},
|
|
54
54
|
appType: "custom"
|
|
55
|
-
}),
|
|
55
|
+
}), m = `/${f(r.root, r.config).replaceAll("\\", "/")}`, l = await b({
|
|
56
56
|
production: e,
|
|
57
57
|
root: r.root,
|
|
58
58
|
vite: s,
|
|
59
|
-
loadRuntime: e ? () => import(
|
|
59
|
+
loadRuntime: e ? () => import(w(r.serverOutput).href) : () => s.ssrLoadModule(m)
|
|
60
60
|
});
|
|
61
61
|
await l.listen();
|
|
62
|
-
let
|
|
63
|
-
const
|
|
64
|
-
if (!
|
|
65
|
-
|
|
62
|
+
let d = !1;
|
|
63
|
+
const u = async (v) => {
|
|
64
|
+
if (!d) {
|
|
65
|
+
d = !0;
|
|
66
66
|
try {
|
|
67
|
-
await l.close(), console.log(`stopped after ${
|
|
68
|
-
} catch (
|
|
69
|
-
console.error("graceful shutdown failed",
|
|
67
|
+
await l.close(), console.log(`stopped after ${v}`), process.exitCode = 0;
|
|
68
|
+
} catch (p) {
|
|
69
|
+
console.error("graceful shutdown failed", p), process.exitCode = 1;
|
|
70
70
|
}
|
|
71
71
|
}
|
|
72
72
|
};
|
|
73
73
|
process.once("SIGINT", () => {
|
|
74
|
-
|
|
74
|
+
u("SIGINT");
|
|
75
75
|
}), process.once("SIGTERM", () => {
|
|
76
|
-
|
|
76
|
+
u("SIGTERM");
|
|
77
77
|
});
|
|
78
|
-
},
|
|
78
|
+
}, M = async (r) => {
|
|
79
79
|
const { build: e } = await import("vite");
|
|
80
80
|
await e({ root: r.root }), await e({
|
|
81
81
|
root: r.root,
|
|
82
82
|
build: {
|
|
83
|
-
ssr: r.
|
|
84
|
-
outDir:
|
|
83
|
+
ssr: r.config,
|
|
84
|
+
outDir: c(r.root, "dist/server"),
|
|
85
85
|
emptyOutDir: !0,
|
|
86
86
|
rollupOptions: {
|
|
87
87
|
output: { entryFileNames: "SsrRuntime.js" }
|
|
@@ -89,8 +89,8 @@ const a = 1, c = 65535, R = (r) => {
|
|
|
89
89
|
}
|
|
90
90
|
});
|
|
91
91
|
}, I = async () => {
|
|
92
|
-
const r = T(process.argv.slice(2));
|
|
93
|
-
return r.command === "build" ?
|
|
92
|
+
const r = await T(process.argv.slice(2));
|
|
93
|
+
return r.command === "build" ? M(r) : y(r, r.command === "start");
|
|
94
94
|
};
|
|
95
95
|
I().catch((r) => {
|
|
96
96
|
console.error("fatal error", r), process.exitCode = 1;
|
package/dist/client.d.ts
CHANGED
package/dist/client.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,oBAAoB,GAC1B,MAAM,wBAAwB,CAAA;AAC/B,mBAAmB,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"client.d.ts","sourceRoot":"","sources":["../src/client.ts"],"names":[],"mappings":"AAAA,cAAc,qBAAqB,CAAA;AACnC,cAAc,oBAAoB,CAAA;AAClC,cAAc,wBAAwB,CAAA;AACtC,OAAO,EACL,sBAAsB,EACtB,gBAAgB,EAChB,KAAK,oBAAoB,GAC1B,MAAM,wBAAwB,CAAA;AAC/B,mBAAmB,mBAAmB,CAAA"}
|
package/dist/client.mjs
CHANGED
|
@@ -1,94 +1,117 @@
|
|
|
1
|
-
import { c as
|
|
2
|
-
import { S as
|
|
3
|
-
import { g as
|
|
4
|
-
import { s as
|
|
5
|
-
const
|
|
6
|
-
requestId: `${
|
|
7
|
-
url:
|
|
1
|
+
import { c as u } from "./chunks/SsrApplicationRuntime-D4arUtsy.mjs";
|
|
2
|
+
import { S as g, a as b, b as C, i as x, r as R, u as A, d as I } from "./chunks/SsrApplicationRuntime-D4arUtsy.mjs";
|
|
3
|
+
import { g as h } from "./chunks/SsrSerialization-k-3aCFYt.mjs";
|
|
4
|
+
import { s as q, a as D } from "./chunks/SsrReactivityRuntime-CroM1WJG.mjs";
|
|
5
|
+
const d = (e, o, s, a, r) => ({
|
|
6
|
+
requestId: `${a}-${Date.now().toString(36)}`,
|
|
7
|
+
url: s,
|
|
8
8
|
host: window.location.host,
|
|
9
9
|
protocol: window.location.protocol === "https:" ? "https" : "http",
|
|
10
10
|
method: "GET",
|
|
11
11
|
headers: {},
|
|
12
|
-
publicConfig:
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
12
|
+
publicConfig: e,
|
|
13
|
+
domain: o,
|
|
14
|
+
signal: r
|
|
15
|
+
}), p = () => {
|
|
16
|
+
const e = document.getElementById("vue-ssr-lite-domain");
|
|
17
|
+
if (!e?.textContent) return null;
|
|
18
|
+
try {
|
|
19
|
+
return JSON.parse(e.textContent);
|
|
20
|
+
} catch {
|
|
21
|
+
return null;
|
|
22
|
+
}
|
|
23
|
+
}, y = async (e, o = {}) => {
|
|
24
|
+
const s = o.stateElementId ?? h(e.id), a = document.getElementById(s);
|
|
25
|
+
if (!a?.textContent)
|
|
26
|
+
throw new Error(`SSR hydration state element "${s}" is missing.`);
|
|
27
|
+
const r = JSON.parse(
|
|
28
|
+
a.textContent
|
|
20
29
|
);
|
|
21
|
-
if (
|
|
30
|
+
if (r.version !== 1)
|
|
22
31
|
throw new Error("Unsupported SSR hydration state version.");
|
|
23
|
-
|
|
24
|
-
|
|
32
|
+
if (!r.domain)
|
|
33
|
+
throw new Error("SSR hydration state is missing domain context.");
|
|
34
|
+
const i = new AbortController(), l = d(
|
|
35
|
+
r.publicConfig,
|
|
36
|
+
r.domain,
|
|
25
37
|
window.location.href,
|
|
26
38
|
"browser",
|
|
27
|
-
|
|
39
|
+
i.signal
|
|
28
40
|
);
|
|
29
|
-
let
|
|
41
|
+
let t;
|
|
30
42
|
try {
|
|
31
|
-
|
|
43
|
+
t = await u(e, {
|
|
32
44
|
server: !1,
|
|
33
|
-
request:
|
|
34
|
-
hydrationState:
|
|
35
|
-
}),
|
|
45
|
+
request: l,
|
|
46
|
+
hydrationState: r
|
|
47
|
+
}), t.router && (await t.router.push(
|
|
36
48
|
`${window.location.pathname}${window.location.search}${window.location.hash}`
|
|
37
|
-
), await
|
|
38
|
-
|
|
39
|
-
).forEach((
|
|
40
|
-
} catch (
|
|
41
|
-
|
|
49
|
+
), await t.router.isReady()), t.app.mount(o.mountSelector ?? e.mountSelector ?? "#app"), document.head.querySelectorAll(
|
|
50
|
+
o.removeHeadSelector ?? "[data-vue-ssr-lite-head]"
|
|
51
|
+
).forEach((n) => n.remove()), a.remove();
|
|
52
|
+
} catch (n) {
|
|
53
|
+
i.abort();
|
|
42
54
|
try {
|
|
43
|
-
|
|
44
|
-
} catch (
|
|
45
|
-
console.error("[vue-ssr-lite] hydration cleanup failed",
|
|
55
|
+
t?.hydration.dispose();
|
|
56
|
+
} catch (c) {
|
|
57
|
+
console.error("[vue-ssr-lite] hydration cleanup failed", c);
|
|
46
58
|
}
|
|
47
|
-
throw
|
|
59
|
+
throw n;
|
|
48
60
|
}
|
|
49
|
-
},
|
|
50
|
-
const
|
|
51
|
-
|
|
52
|
-
|
|
61
|
+
}, f = async (e, o = {}) => {
|
|
62
|
+
const s = p(), a = o.domain ?? s?.domain;
|
|
63
|
+
if (!a)
|
|
64
|
+
throw new Error(
|
|
65
|
+
"vue-ssr-lite SPA mount requires domain context. Ensure the managed server injected #vue-ssr-lite-domain."
|
|
66
|
+
);
|
|
67
|
+
const r = o.publicConfig ?? s?.publicConfig ?? {}, i = new AbortController(), l = d(
|
|
68
|
+
r,
|
|
69
|
+
a,
|
|
70
|
+
o.url ?? window.location.href,
|
|
53
71
|
"spa",
|
|
54
|
-
|
|
72
|
+
i.signal
|
|
55
73
|
);
|
|
56
74
|
let t;
|
|
57
75
|
try {
|
|
58
|
-
t = await
|
|
76
|
+
t = await u(e, {
|
|
59
77
|
server: !1,
|
|
60
78
|
spa: !0,
|
|
61
|
-
request:
|
|
79
|
+
request: l
|
|
62
80
|
}), t.router && (await t.router.push(
|
|
63
|
-
|
|
81
|
+
o.url ?? `${window.location.pathname}${window.location.search}${window.location.hash}`
|
|
64
82
|
), await t.router.isReady());
|
|
65
|
-
const
|
|
66
|
-
return
|
|
67
|
-
app:
|
|
83
|
+
const n = t.app, c = t;
|
|
84
|
+
return n.mount(o.mountSelector ?? e.mountSelector ?? "#app"), document.getElementById("vue-ssr-lite-domain")?.remove(), {
|
|
85
|
+
app: n,
|
|
68
86
|
unmount: () => {
|
|
69
|
-
|
|
87
|
+
i.abort(), n.unmount();
|
|
70
88
|
try {
|
|
71
89
|
c.hydration.dispose();
|
|
72
|
-
} catch (
|
|
73
|
-
console.error("[vue-ssr-lite] SPA cleanup failed",
|
|
90
|
+
} catch (m) {
|
|
91
|
+
console.error("[vue-ssr-lite] SPA cleanup failed", m);
|
|
74
92
|
}
|
|
75
93
|
}
|
|
76
94
|
};
|
|
77
|
-
} catch (
|
|
78
|
-
|
|
95
|
+
} catch (n) {
|
|
96
|
+
i.abort();
|
|
79
97
|
try {
|
|
80
98
|
t?.hydration.dispose();
|
|
81
99
|
} catch (c) {
|
|
82
100
|
console.error("[vue-ssr-lite] SPA cleanup failed", c);
|
|
83
101
|
}
|
|
84
|
-
throw
|
|
102
|
+
throw n;
|
|
85
103
|
}
|
|
86
104
|
};
|
|
87
105
|
export {
|
|
88
|
-
|
|
89
|
-
|
|
90
|
-
|
|
91
|
-
|
|
92
|
-
|
|
93
|
-
|
|
106
|
+
g as SSR_DOMAIN_CONTEXT,
|
|
107
|
+
b as SSR_REQUEST_RESOLUTION,
|
|
108
|
+
C as buildSsrSubdomainUrl,
|
|
109
|
+
y as hydrateSsrApplication,
|
|
110
|
+
x as installSsrDomainContext,
|
|
111
|
+
f as mountSpaApplication,
|
|
112
|
+
R as resolveSsrDomainContext,
|
|
113
|
+
q as ssrWatch,
|
|
114
|
+
D as ssrWatchEffect,
|
|
115
|
+
A as useSsrDomain,
|
|
116
|
+
I as useSsrResolution
|
|
94
117
|
};
|
package/dist/index.d.ts
CHANGED
|
@@ -1,5 +1,8 @@
|
|
|
1
|
-
import { SsrApplicationDefinition
|
|
1
|
+
import { SsrApplicationDefinition } from './SsrRuntimeTypes';
|
|
2
2
|
export * from './SsrApplicationRuntime';
|
|
3
|
+
export * from './SsrConfigRuntime';
|
|
4
|
+
export * from './SsrConfigTypes';
|
|
5
|
+
export * from './SsrDomainRuntime';
|
|
3
6
|
export * from './SsrHydrationRuntime';
|
|
4
7
|
export * from './SsrReactivityRuntime';
|
|
5
8
|
export * from './SsrRequestContext';
|
|
@@ -8,5 +11,4 @@ export * from './SsrRuntimeTypes';
|
|
|
8
11
|
export * from './SsrSerialization';
|
|
9
12
|
export * from './SsrDiagnosticsRuntime';
|
|
10
13
|
export declare const defineSsrApplication: <T extends SsrApplicationDefinition<any, any, any>>(definition: T) => T;
|
|
11
|
-
export declare const defineSsrRuntime: <T extends SsrRuntimeDefinition<any>>(definition: T) => T;
|
|
12
14
|
//# sourceMappingURL=index.d.ts.map
|
package/dist/index.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AAEvC,OAAO,KAAK,
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,cAAc,yBAAyB,CAAA;AACvC,cAAc,oBAAoB,CAAA;AAClC,cAAc,kBAAkB,CAAA;AAChC,cAAc,oBAAoB,CAAA;AAClC,cAAc,uBAAuB,CAAA;AACrC,cAAc,wBAAwB,CAAA;AACtC,cAAc,qBAAqB,CAAA;AACnC,cAAc,wBAAwB,CAAA;AACtC,cAAc,mBAAmB,CAAA;AACjC,cAAc,oBAAoB,CAAA;AAClC,cAAc,yBAAyB,CAAA;AAEvC,OAAO,KAAK,EAAE,wBAAwB,EAAE,MAAM,mBAAmB,CAAA;AAEjE,eAAO,MAAM,oBAAoB,GAAI,CAAC,SAAS,wBAAwB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACpF,YAAY,CAAC,KACZ,CAAe,CAAA"}
|
package/dist/index.mjs
CHANGED
|
@@ -1,25 +1,31 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import {
|
|
3
|
-
import {
|
|
4
|
-
import {
|
|
5
|
-
|
|
1
|
+
import { S as t, e as o, f as S, a as i, b as n, c as l, g as c, h as d, i as f, r as R, u as m, j as p, d as E } from "./chunks/SsrApplicationRuntime-D4arUtsy.mjs";
|
|
2
|
+
import { d as u } from "./chunks/SsrConfigRuntime-D0DkOrVQ.mjs";
|
|
3
|
+
import { s as C, a as _ } from "./chunks/SsrReactivityRuntime-CroM1WJG.mjs";
|
|
4
|
+
import { e as D, g as N, r as g, s as I, a as A } from "./chunks/SsrSerialization-k-3aCFYt.mjs";
|
|
5
|
+
import { c as U } from "./chunks/SsrDiagnosticsRuntime-B5VbSgsA.mjs";
|
|
6
|
+
const e = (s) => s;
|
|
6
7
|
export {
|
|
8
|
+
t as SSR_DOMAIN_CONTEXT,
|
|
7
9
|
o as SSR_HYDRATION_CONTEXT,
|
|
8
10
|
S as SSR_REQUEST_CONTEXT,
|
|
9
|
-
|
|
10
|
-
|
|
11
|
-
|
|
11
|
+
i as SSR_REQUEST_RESOLUTION,
|
|
12
|
+
n as buildSsrSubdomainUrl,
|
|
13
|
+
U as collectSsrRenderDiagnostics,
|
|
14
|
+
l as createSsrApplication,
|
|
12
15
|
c as createSsrHydrationController,
|
|
13
|
-
|
|
16
|
+
d as createSsrResolutionController,
|
|
14
17
|
e as defineSsrApplication,
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
18
|
+
u as defineSsrConfig,
|
|
19
|
+
D as escapeSsrHtml,
|
|
20
|
+
N as getSsrStateElementId,
|
|
21
|
+
f as installSsrDomainContext,
|
|
22
|
+
g as renderSsrHead,
|
|
23
|
+
R as resolveSsrDomainContext,
|
|
24
|
+
I as sanitizeSsrIdentifier,
|
|
25
|
+
A as serializeSsrState,
|
|
26
|
+
C as ssrWatch,
|
|
27
|
+
_ as ssrWatchEffect,
|
|
28
|
+
m as useSsrDomain,
|
|
29
|
+
p as useSsrRequestContext,
|
|
30
|
+
E as useSsrResolution
|
|
25
31
|
};
|
|
@@ -1,10 +1,60 @@
|
|
|
1
|
-
import { SsrHeaderValue
|
|
1
|
+
import { SsrHeaderValue } from '../SsrRuntimeTypes';
|
|
2
|
+
/** Minimal host-owning application shape used by the matcher. */
|
|
3
|
+
export interface SsrHostApplication {
|
|
4
|
+
id: string;
|
|
5
|
+
hosts: string[];
|
|
6
|
+
}
|
|
7
|
+
export type SsrHostMatchCategory = 'exact' | 'wildcard' | 'catch-all' | 'default';
|
|
8
|
+
export interface SsrHostMatchScore {
|
|
9
|
+
category: SsrHostMatchCategory;
|
|
10
|
+
/** Higher wins. Exact > longer wildcard suffix > shorter wildcard > catch-all. */
|
|
11
|
+
specificity: number;
|
|
12
|
+
pattern: string;
|
|
13
|
+
}
|
|
14
|
+
export interface SsrHostResolution<T extends SsrHostApplication = SsrHostApplication> {
|
|
15
|
+
entry: T;
|
|
16
|
+
matchedPattern: string | null;
|
|
17
|
+
normalizedHostname: string;
|
|
18
|
+
category: SsrHostMatchCategory;
|
|
19
|
+
specificity: number;
|
|
20
|
+
}
|
|
21
|
+
export declare class SsrHostConfigurationError extends Error {
|
|
22
|
+
constructor(message: string);
|
|
23
|
+
}
|
|
2
24
|
export declare const normalizeSsrHost: (host: SsrHeaderValue) => string;
|
|
3
25
|
export declare const stripSsrHostPort: (host: SsrHeaderValue) => string;
|
|
4
26
|
export declare const normalizeSsrHostPattern: (pattern: string) => string;
|
|
5
27
|
export declare const matchesSsrHostPattern: (host: string, pattern: string) => boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Score a single host pattern against a request host.
|
|
30
|
+
* Returns null when the pattern is invalid or does not match.
|
|
31
|
+
*
|
|
32
|
+
* Precedence (higher specificity wins):
|
|
33
|
+
* exact hostname > longer wildcard suffix > shorter wildcard suffix > `*`
|
|
34
|
+
*/
|
|
35
|
+
export declare const scoreSsrHostMatch: (host: string, pattern: string) => SsrHostMatchScore | null;
|
|
36
|
+
/**
|
|
37
|
+
* Validate host patterns across compiled applications at startup.
|
|
38
|
+
*
|
|
39
|
+
* Rejects duplicate exact/wildcard ownership, invalid syntax, patterns that
|
|
40
|
+
* carry protocols/paths/ports, and multiple catch-all applications. Overlapping
|
|
41
|
+
* patterns with different specificity are allowed; the more specific pattern
|
|
42
|
+
* wins at request time.
|
|
43
|
+
*/
|
|
44
|
+
export declare const validateSsrHostEntries: (applications: readonly SsrHostApplication[]) => void;
|
|
45
|
+
/**
|
|
46
|
+
* Resolve the application entry for a request host using specificity, not
|
|
47
|
+
* declaration order.
|
|
48
|
+
*
|
|
49
|
+
* Precedence:
|
|
50
|
+
* exact hostname >
|
|
51
|
+
* longest matching wildcard suffix >
|
|
52
|
+
* shorter matching wildcard suffix >
|
|
53
|
+
* catch-all `*` >
|
|
54
|
+
* `defaultEntryId`
|
|
55
|
+
*/
|
|
56
|
+
export declare const resolveSsrHostEntry: <T extends SsrHostApplication>(applications: readonly T[], host: string, defaultApplicationId?: string) => SsrHostResolution<T> | null;
|
|
6
57
|
export declare const resolveSsrForwardedHost: (forwardedHost: SsrHeaderValue, host: SsrHeaderValue, trustProxy?: boolean) => string;
|
|
7
58
|
export declare const resolveSsrForwardedProtocol: (forwardedProtocol: SsrHeaderValue, fallback: "http" | "https", trustProxy?: boolean) => "http" | "https";
|
|
8
|
-
export declare const resolveSsrEntry: (entries: SsrRuntimeEntry[], host: string, defaultEntryId?: string) => SsrRuntimeEntry | null;
|
|
9
59
|
export declare const filterSsrCookieHeader: (cookieHeader: SsrHeaderValue, allowlist?: readonly string[], denylist?: readonly string[]) => string | undefined;
|
|
10
60
|
//# sourceMappingURL=SsrHostRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsrHostRuntime.d.ts","sourceRoot":"","sources":["../../src/server/SsrHostRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,
|
|
1
|
+
{"version":3,"file":"SsrHostRuntime.d.ts","sourceRoot":"","sources":["../../src/server/SsrHostRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,cAAc,EAAE,MAAM,oBAAoB,CAAA;AAExD,iEAAiE;AACjE,MAAM,WAAW,kBAAkB;IACjC,EAAE,EAAE,MAAM,CAAA;IACV,KAAK,EAAE,MAAM,EAAE,CAAA;CAChB;AAUD,MAAM,MAAM,oBAAoB,GAAG,OAAO,GAAG,UAAU,GAAG,WAAW,GAAG,SAAS,CAAA;AAEjF,MAAM,WAAW,iBAAiB;IAChC,QAAQ,EAAE,oBAAoB,CAAA;IAC9B,kFAAkF;IAClF,WAAW,EAAE,MAAM,CAAA;IACnB,OAAO,EAAE,MAAM,CAAA;CAChB;AAED,MAAM,WAAW,iBAAiB,CAAC,CAAC,SAAS,kBAAkB,GAAG,kBAAkB;IAClF,KAAK,EAAE,CAAC,CAAA;IACR,cAAc,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,kBAAkB,EAAE,MAAM,CAAA;IAC1B,QAAQ,EAAE,oBAAoB,CAAA;IAC9B,WAAW,EAAE,MAAM,CAAA;CACpB;AAED,qBAAa,yBAA0B,SAAQ,KAAK;gBACtC,OAAO,EAAE,MAAM;CAI5B;AAED,eAAO,MAAM,gBAAgB,GAAI,MAAM,cAAc,KAAG,MAmCvD,CAAA;AAED,eAAO,MAAM,gBAAgB,GAAI,MAAM,cAAc,KAAG,MAQvD,CAAA;AAED,eAAO,MAAM,uBAAuB,GAAI,SAAS,MAAM,KAAG,MAYzD,CAAA;AAED,eAAO,MAAM,qBAAqB,GAAI,MAAM,MAAM,EAAE,SAAS,MAAM,KAAG,OAYrE,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,iBAAiB,GAC5B,MAAM,MAAM,EACZ,SAAS,MAAM,KACd,iBAAiB,GAAG,IAuBtB,CAAA;AAED;;;;;;;GAOG;AACH,eAAO,MAAM,sBAAsB,GACjC,cAAc,SAAS,kBAAkB,EAAE,KAC1C,IAiEF,CAAA;AAED;;;;;;;;;;GAUG;AACH,eAAO,MAAM,mBAAmB,GAAI,CAAC,SAAS,kBAAkB,EAC9D,cAAc,SAAS,CAAC,EAAE,EAC1B,MAAM,MAAM,EACZ,uBAAuB,MAAM,KAC5B,iBAAiB,CAAC,CAAC,CAAC,GAAG,IA6CzB,CAAA;AAED,eAAO,MAAM,uBAAuB,GAClC,eAAe,cAAc,EAC7B,MAAM,cAAc,EACpB,oBAAkB,KACjB,MAC4E,CAAA;AAE/E,eAAO,MAAM,2BAA2B,GACtC,mBAAmB,cAAc,EACjC,UAAU,MAAM,GAAG,OAAO,EAC1B,oBAAkB,KACjB,MAAM,GAAG,OAIX,CAAA;AAID,eAAO,MAAM,qBAAqB,GAChC,cAAc,cAAc,EAC5B,YAAW,SAAS,MAAM,EAAO,EACjC,WAAU,SAAS,MAAM,EAAO,KAC/B,MAAM,GAAG,SAeX,CAAA"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsrServerRuntime.d.ts","sourceRoot":"","sources":["../../src/server/SsrServerRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAA;AAGnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;
|
|
1
|
+
{"version":3,"file":"SsrServerRuntime.d.ts","sourceRoot":"","sources":["../../src/server/SsrServerRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,YAAY,EAA6C,MAAM,WAAW,CAAA;AAGnF,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,MAAM,CAAA;AA+BzC,MAAM,WAAW,uBAAuB;IACtC,UAAU,EAAE,OAAO,CAAA;IACnB,IAAI,EAAE,MAAM,CAAA;IACZ,WAAW,EAAE,MAAM,OAAO,CAAC,OAAO,CAAC,CAAA;IACnC,IAAI,CAAC,EAAE,aAAa,CAAA;CACrB;AAED,MAAM,WAAW,gBAAgB;IAC/B,UAAU,EAAE,UAAU,CAAC,OAAO,YAAY,CAAC,CAAA;IAC3C,MAAM,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC3B,KAAK,EAAE,MAAM,OAAO,CAAC,IAAI,CAAC,CAAA;IAC1B,OAAO,EAAE,MAAM;QAAE,IAAI,EAAE,MAAM,CAAC;QAAC,IAAI,EAAE,MAAM,CAAA;KAAE,CAAA;CAC9C;AAwJD,eAAO,MAAM,sBAAsB,GACjC,SAAS,uBAAuB,KAC/B,OAAO,CAAC,gBAAgB,CA4gB1B,CAAA"}
|
package/dist/server.d.ts
CHANGED
|
@@ -4,6 +4,9 @@ export * from './server/SsrHtmlRuntime';
|
|
|
4
4
|
export * from './server/SsrResponseCacheRuntime';
|
|
5
5
|
export * from './server/SsrRuntimeConfigRuntime';
|
|
6
6
|
export * from './server/SsrServerRuntime';
|
|
7
|
+
export * from './SsrConfigCompileRuntime';
|
|
8
|
+
export * from './SsrDomainRuntime';
|
|
7
9
|
export * from './SsrRenderRuntime';
|
|
8
10
|
export type * from './SsrRuntimeTypes';
|
|
11
|
+
export type * from './SsrConfigTypes';
|
|
9
12
|
//# sourceMappingURL=server.d.ts.map
|
package/dist/server.d.ts.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,mBAAmB,mBAAmB,CAAA"}
|
|
1
|
+
{"version":3,"file":"server.d.ts","sourceRoot":"","sources":["../src/server.ts"],"names":[],"mappings":"AAAA,cAAc,0BAA0B,CAAA;AACxC,cAAc,yBAAyB,CAAA;AACvC,cAAc,yBAAyB,CAAA;AACvC,cAAc,kCAAkC,CAAA;AAChD,cAAc,kCAAkC,CAAA;AAChD,cAAc,2BAA2B,CAAA;AACzC,cAAc,2BAA2B,CAAA;AACzC,cAAc,oBAAoB,CAAA;AAClC,cAAc,oBAAoB,CAAA;AAClC,mBAAmB,mBAAmB,CAAA;AACtC,mBAAmB,kBAAkB,CAAA"}
|