vue-ssr-lite 0.1.4 → 0.1.6
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/SsrApplicationRuntime.d.ts.map +1 -1
- package/dist/SsrHydrationRuntime.d.ts +57 -0
- package/dist/SsrHydrationRuntime.d.ts.map +1 -0
- package/dist/SsrRequestContext.d.ts +7 -0
- package/dist/SsrRequestContext.d.ts.map +1 -1
- package/dist/SsrRuntimeTypes.d.ts +16 -19
- package/dist/SsrRuntimeTypes.d.ts.map +1 -1
- package/dist/chunks/SsrApplicationRuntime-DB_oRq-_.mjs +92 -0
- package/dist/chunks/SsrServerRuntime-CrpKROBI.mjs +657 -0
- package/dist/cli.mjs +1 -1
- package/dist/client.mjs +8 -8
- package/dist/index.d.ts +1 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +14 -12
- package/dist/server/SsrHostRuntime.d.ts.map +1 -1
- package/dist/server/SsrServerRuntime.d.ts.map +1 -1
- package/dist/server.mjs +1 -1
- package/dist/vite/SsrVitePlugin.d.ts +13 -0
- package/dist/vite/SsrVitePlugin.d.ts.map +1 -1
- package/dist/vite.mjs +39 -48
- package/package.json +2 -11
- package/dist/chunks/SsrApplicationRuntime-lj5EmDGU.mjs +0 -65
- package/dist/chunks/SsrServerRuntime-3f0yAnNL.mjs +0 -671
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsrApplicationRuntime.d.ts","sourceRoot":"","sources":["../src/SsrApplicationRuntime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SsrApplicationRuntime.d.ts","sourceRoot":"","sources":["../src/SsrApplicationRuntime.ts"],"names":[],"mappings":"AAWA,OAAO,KAAK,EACV,wBAAwB,EACxB,qBAAqB,EACrB,iBAAiB,EACjB,gBAAgB,EAEjB,MAAM,mBAAmB,CAAA;AAE1B,MAAM,WAAW,2BAA2B,CAC1C,iBAAiB,EACjB,aAAa;IAEb,MAAM,EAAE,OAAO,CAAA;IACf,OAAO,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;IACxC,cAAc,CAAC,EAAE,iBAAiB,CAAC,iBAAiB,EAAE,aAAa,CAAC,GAAG,IAAI,CAAA;CAC5E;AAED,eAAO,MAAM,oBAAoB,GAC/B,iBAAiB,SAAS,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EACvE,aAAa,GAAG,OAAO,EACvB,UAAU,GAAG,OAAO,EAEpB,YAAY,wBAAwB,CAClC,iBAAiB,EACjB,aAAa,EACb,UAAU,CACX,EACD,SAAS,2BAA2B,CAAC,iBAAiB,EAAE,aAAa,CAAC,KACrE,OAAO,CAAC,qBAAqB,CAAC,iBAAiB,EAAE,aAAa,EAAE,UAAU,CAAC,CAsF7E,CAAA"}
|
|
@@ -0,0 +1,57 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Generic, framework-neutral hydration contract.
|
|
4
|
+
*
|
|
5
|
+
* `vue-ssr-lite` renders a Vue application and serializes a single hydration
|
|
6
|
+
* document. Application plugins (an API client, a store, an i18n cache, …) may
|
|
7
|
+
* need to embed their own serializable state on the server and restore it in
|
|
8
|
+
* the browser before the component tree is created. This contract is the ONLY
|
|
9
|
+
* integration point they use — `vue-ssr-lite` never learns what that state is.
|
|
10
|
+
*
|
|
11
|
+
* A plugin obtains the active context by injecting {@link SSR_HYDRATION_CONTEXT}.
|
|
12
|
+
* The key is created with `Symbol.for(...)` so a plugin can integrate WITHOUT
|
|
13
|
+
* importing this package (it re-derives the identical symbol):
|
|
14
|
+
*
|
|
15
|
+
* ```ts
|
|
16
|
+
* const host = app.runWithContext(() =>
|
|
17
|
+
* inject<SsrHydrationContext | null>(Symbol.for('vue-ssr:hydration-context'), null)
|
|
18
|
+
* )
|
|
19
|
+
* ```
|
|
20
|
+
*/
|
|
21
|
+
export interface SsrHydrationContext {
|
|
22
|
+
/** True while server-rendering, false during browser hydration. */
|
|
23
|
+
readonly server: boolean;
|
|
24
|
+
/**
|
|
25
|
+
* Browser: the serializable state previously embedded under `key`
|
|
26
|
+
* (or `undefined`). Server: always `undefined`.
|
|
27
|
+
*/
|
|
28
|
+
read<T = unknown>(key: string): T | undefined;
|
|
29
|
+
/**
|
|
30
|
+
* Server: register a contributor whose return value is serialized under
|
|
31
|
+
* `key` after `renderToString` completes. Ignored in the browser.
|
|
32
|
+
*/
|
|
33
|
+
contribute(key: string, dehydrate: () => unknown): void;
|
|
34
|
+
/**
|
|
35
|
+
* Register cleanup executed after render (server) or on teardown /
|
|
36
|
+
* hydration failure (browser).
|
|
37
|
+
*/
|
|
38
|
+
onDispose(dispose: () => void): void;
|
|
39
|
+
}
|
|
40
|
+
/**
|
|
41
|
+
* Cross-package-stable injection key for {@link SsrHydrationContext}. Uses the
|
|
42
|
+
* global symbol registry so integrations resolve the same identity whether or
|
|
43
|
+
* not they import `vue-ssr-lite`.
|
|
44
|
+
*/
|
|
45
|
+
export declare const SSR_HYDRATION_CONTEXT: InjectionKey<SsrHydrationContext>;
|
|
46
|
+
export interface SsrHydrationController extends SsrHydrationContext {
|
|
47
|
+
/** Server: run every contributor and return the serializable state map. */
|
|
48
|
+
collect(): Record<string, unknown> | undefined;
|
|
49
|
+
/** Run and clear every registered dispose callback. */
|
|
50
|
+
dispose(): void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Creates the per-request hydration controller. `restored` carries the plugin
|
|
54
|
+
* state map from a previous server render during browser hydration.
|
|
55
|
+
*/
|
|
56
|
+
export declare const createSsrHydrationController: (restored?: Record<string, unknown> | null, server?: boolean) => SsrHydrationController;
|
|
57
|
+
//# sourceMappingURL=SsrHydrationRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SsrHydrationRuntime.d.ts","sourceRoot":"","sources":["../src/SsrHydrationRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAEvC;;;;;;;;;;;;;;;;;;GAkBG;AACH,MAAM,WAAW,mBAAmB;IAClC,mEAAmE;IACnE,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB;;;OAGG;IACH,IAAI,CAAC,CAAC,GAAG,OAAO,EAAE,GAAG,EAAE,MAAM,GAAG,CAAC,GAAG,SAAS,CAAA;IAC7C;;;OAGG;IACH,UAAU,CAAC,GAAG,EAAE,MAAM,EAAE,SAAS,EAAE,MAAM,OAAO,GAAG,IAAI,CAAA;IACvD;;;OAGG;IACH,SAAS,CAAC,OAAO,EAAE,MAAM,IAAI,GAAG,IAAI,CAAA;CACrC;AAED;;;;GAIG;AACH,eAAO,MAAM,qBAAqB,EAE7B,YAAY,CAAC,mBAAmB,CAAC,CAAA;AAEtC,MAAM,WAAW,sBAAuB,SAAQ,mBAAmB;IACjE,2EAA2E;IAC3E,OAAO,IAAI,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,SAAS,CAAA;IAC9C,uDAAuD;IACvD,OAAO,IAAI,IAAI,CAAA;CAChB;AAMD;;;GAGG;AACH,eAAO,MAAM,4BAA4B,GACvC,WAAW,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,EACzC,SAAQ,OAAuC,KAC9C,sBAkCF,CAAA"}
|
|
@@ -1,5 +1,12 @@
|
|
|
1
1
|
import { InjectionKey } from 'vue';
|
|
2
2
|
import { SsrRequestContext } from './SsrRuntimeTypes';
|
|
3
|
+
/**
|
|
4
|
+
* Cross-package-stable request-context injection key.
|
|
5
|
+
*
|
|
6
|
+
* The managed server and a Vite-loaded consumer application can evaluate
|
|
7
|
+
* `vue-ssr-lite` through different module graphs. The global symbol registry
|
|
8
|
+
* keeps the provider and consumer identities equal across those evaluations.
|
|
9
|
+
*/
|
|
3
10
|
export declare const SSR_REQUEST_CONTEXT: InjectionKey<SsrRequestContext<any, any, any>>;
|
|
4
11
|
export declare const useSsrRequestContext: <TApplicationState = Record<string, unknown>, TPublicConfig = unknown, TExtension = unknown>() => SsrRequestContext<TApplicationState, TPublicConfig, TExtension>;
|
|
5
12
|
//# sourceMappingURL=SsrRequestContext.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsrRequestContext.d.ts","sourceRoot":"","sources":["../src/SsrRequestContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D,eAAO,MAAM,mBAAmB,
|
|
1
|
+
{"version":3,"file":"SsrRequestContext.d.ts","sourceRoot":"","sources":["../src/SsrRequestContext.ts"],"names":[],"mappings":"AAAA,OAAO,EAAU,KAAK,YAAY,EAAE,MAAM,KAAK,CAAA;AAC/C,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,mBAAmB,CAAA;AAE1D;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,EAE3B,YAAY,CAAC,iBAAiB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,CAAC,CAAA;AAEnD,eAAO,MAAM,oBAAoB,GAC/B,iBAAiB,GAAG,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,EAC3C,aAAa,GAAG,OAAO,EACvB,UAAU,GAAG,OAAO,OACjB,iBAAiB,CAAC,iBAAiB,EAAE,aAAa,EAAE,UAAU,CAQlE,CAAA"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import { App, Component } from 'vue';
|
|
2
2
|
import { Router, RouteRecordRaw } from 'vue-router';
|
|
3
|
-
import {
|
|
3
|
+
import { SsrHydrationContext, SsrHydrationController } from './SsrHydrationRuntime';
|
|
4
4
|
export type SsrHeaderValue = string | string[] | undefined;
|
|
5
5
|
export type SsrHeaders = Record<string, SsrHeaderValue>;
|
|
6
6
|
export interface SsrHeadPayload {
|
|
@@ -55,8 +55,6 @@ export interface SsrRenderRequest<TPublicConfig = unknown> {
|
|
|
55
55
|
method: string;
|
|
56
56
|
headers: SsrHeaders;
|
|
57
57
|
cookie?: string;
|
|
58
|
-
apolloHeaders?: Record<string, string>;
|
|
59
|
-
apolloRequestTimeoutMs?: number;
|
|
60
58
|
publicConfig: TPublicConfig;
|
|
61
59
|
signal: AbortSignal;
|
|
62
60
|
}
|
|
@@ -65,7 +63,11 @@ export interface SsrHydrationState<TApplicationState = unknown, TPublicConfig =
|
|
|
65
63
|
applicationId: string;
|
|
66
64
|
publicConfig: TPublicConfig;
|
|
67
65
|
application: TApplicationState;
|
|
68
|
-
|
|
66
|
+
/**
|
|
67
|
+
* Serializable state contributed by installed application plugins, keyed by
|
|
68
|
+
* an opaque plugin identifier. `vue-ssr-lite` never inspects the values.
|
|
69
|
+
*/
|
|
70
|
+
plugins?: Record<string, unknown>;
|
|
69
71
|
}
|
|
70
72
|
export interface SsrRequestContext<TApplicationState = Record<string, unknown>, TPublicConfig = unknown, TExtension = unknown> {
|
|
71
73
|
request: SsrRenderRequest<TPublicConfig>;
|
|
@@ -77,21 +79,18 @@ export interface SsrRequestContext<TApplicationState = Record<string, unknown>,
|
|
|
77
79
|
value: SsrHeadPayload | null;
|
|
78
80
|
};
|
|
79
81
|
response: SsrResponseState;
|
|
80
|
-
|
|
82
|
+
/** Generic hydration state contract for installed application plugins. */
|
|
83
|
+
hydration: SsrHydrationContext;
|
|
81
84
|
extension: TExtension;
|
|
82
85
|
}
|
|
83
86
|
export interface SsrApplicationSetup<TApplicationState, TPublicConfig, TExtension> {
|
|
84
87
|
app: App;
|
|
85
88
|
router: Router | null;
|
|
86
89
|
context: SsrRequestContext<TApplicationState, TPublicConfig, TExtension>;
|
|
87
|
-
|
|
90
|
+
/** Generic hydration state contract for installed application plugins. */
|
|
91
|
+
hydration: SsrHydrationContext;
|
|
88
92
|
server: boolean;
|
|
89
93
|
}
|
|
90
|
-
export type SsrApolloOptionsFactory<TPublicConfig> = (input: {
|
|
91
|
-
request: SsrRenderRequest<TPublicConfig>;
|
|
92
|
-
publicConfig: TPublicConfig;
|
|
93
|
-
server: boolean;
|
|
94
|
-
}) => VueApolloClientOptions | Promise<VueApolloClientOptions>;
|
|
95
94
|
export interface SsrApplicationDefinition<TApplicationState = Record<string, unknown>, TPublicConfig = unknown, TExtension = unknown> {
|
|
96
95
|
id: string;
|
|
97
96
|
rootComponent: Component;
|
|
@@ -99,8 +98,6 @@ export interface SsrApplicationDefinition<TApplicationState = Record<string, unk
|
|
|
99
98
|
routes?: RouteRecordRaw[] | (() => RouteRecordRaw[]);
|
|
100
99
|
createInitialState?: () => TApplicationState;
|
|
101
100
|
createExtension?: (context: Omit<SsrRequestContext<TApplicationState, TPublicConfig, TExtension>, 'extension'>) => TExtension | Promise<TExtension>;
|
|
102
|
-
apollo?: VueApolloClientOptions | SsrApolloOptionsFactory<TPublicConfig>;
|
|
103
|
-
apolloRequestTimeoutMs?: number | ((publicConfig: TPublicConfig) => number | undefined);
|
|
104
101
|
install?: (setup: SsrApplicationSetup<TApplicationState, TPublicConfig, TExtension>) => void | Promise<void>;
|
|
105
102
|
resolveHead?: (context: SsrRequestContext<TApplicationState, TPublicConfig, TExtension>) => SsrHeadPayload | null | Promise<SsrHeadPayload | null>;
|
|
106
103
|
cleanup?: (context: SsrRequestContext<TApplicationState, TPublicConfig, TExtension>) => void | Promise<void>;
|
|
@@ -109,7 +106,8 @@ export interface SsrCreatedApplication<TApplicationState = Record<string, unknow
|
|
|
109
106
|
app: App;
|
|
110
107
|
router: Router | null;
|
|
111
108
|
context: SsrRequestContext<TApplicationState, TPublicConfig, TExtension>;
|
|
112
|
-
|
|
109
|
+
/** Per-request hydration controller owning plugin state and disposal. */
|
|
110
|
+
hydration: SsrHydrationController;
|
|
113
111
|
}
|
|
114
112
|
export interface SsrRenderResult<TApplicationState = unknown, TPublicConfig = unknown> {
|
|
115
113
|
html: string;
|
|
@@ -172,10 +170,10 @@ export interface SsrEndpointDefinition<TPublicConfig = unknown> {
|
|
|
172
170
|
handle: (request: SsrHttpRequest<TPublicConfig>, tools: SsrEndpointTools) => SsrHttpResponse | null | Promise<SsrHttpResponse | null>;
|
|
173
171
|
}
|
|
174
172
|
export interface SsrEndpointTools {
|
|
175
|
-
/**
|
|
176
|
-
|
|
177
|
-
/**
|
|
178
|
-
|
|
173
|
+
/** Aborts when the owning request is cancelled. */
|
|
174
|
+
readonly signal: AbortSignal;
|
|
175
|
+
/** Structured runtime logger, when the server was configured with one. */
|
|
176
|
+
readonly logger?: SsrLogger;
|
|
179
177
|
}
|
|
180
178
|
export interface SsrReadinessProbe {
|
|
181
179
|
id: string;
|
|
@@ -202,7 +200,6 @@ export interface SsrServerOptions<TPublicConfig = unknown> {
|
|
|
202
200
|
trustProxy?: boolean;
|
|
203
201
|
clientOutDir?: string;
|
|
204
202
|
requestTimeoutMs?: number;
|
|
205
|
-
apolloRequestTimeoutMs?: number;
|
|
206
203
|
shutdownTimeoutMs?: number;
|
|
207
204
|
cookieAllowlist?: string[];
|
|
208
205
|
cookieDenylist?: string[];
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsrRuntimeTypes.d.ts","sourceRoot":"","sources":["../src/SsrRuntimeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EACV,
|
|
1
|
+
{"version":3,"file":"SsrRuntimeTypes.d.ts","sourceRoot":"","sources":["../src/SsrRuntimeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,KAAK,CAAA;AACzC,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,uBAA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O,CAAA;IACpB,YAAY,CAAC,EAAE,MAAM,CAAA;IACrB,gBAAgB,CAAC,EAAE,MAAM,CAAA;IACzB,iBAAiB,CAAC,EAAE,MAAM,CAAA;IAC1B,eAAe,CAAC,EAAE,MAAM,EAAE,CAAA;IAC1B,cAAc,CAAC,EAAE,MAAM,EAAE,CAAA;IACzB,YAAY,EAAE,aAAa,CAAA;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,MAAM,CAAC,EAAE,SAAS,CAAA;IAClB,SAAS,CAAC,EAAE,CAAC,OAAO,EAAE,gBAAgB,KAAK,IAAI,CAAA;IAC/C,WAAW,CAAC,EAAE,CACZ,OAAO,EAAE,qBAAqB,CAAC,aAAa,CAAC,KAC1C,eAAe,GAAG,IAAI,GAAG,OAAO,CAAC,eAAe,GAAG,IAAI,CAAC,CAAA;CAC9D;AAED,MAAM,WAAW,oBAAoB,CAAC,aAAa,GAAG,OAAO;IAC3D,IAAI,EAAE,MAAM,CAAA;IACZ,OAAO,EAAE,eAAe,EAAE,CAAA;IAC1B,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,MAAM,EAAE,gBAAgB,CAAC,aAAa,CAAC,CAAA;IACvC,SAAS,CAAC,EAAE,qBAAqB,CAAC,aAAa,CAAC,EAAE,CAAA;IAClD,SAAS,CAAC,EAAE,iBAAiB,EAAE,CAAA;CAChC;AAED,MAAM,MAAM,0BAA0B,CAAC,aAAa,GAAG,OAAO,IAC1D,oBAAoB,CAAC,aAAa,CAAC,GACnC,CAAC,MAAM,oBAAoB,CAAC,aAAa,CAAC,GAAG,OAAO,CAAC,oBAAoB,CAAC,aAAa,CAAC,CAAC,CAAC,CAAA"}
|
|
@@ -0,0 +1,92 @@
|
|
|
1
|
+
import { inject as S, ref as y, createSSRApp as f } from "vue";
|
|
2
|
+
import { createRouter as w, createMemoryHistory as v, createWebHistory as x } from "vue-router";
|
|
3
|
+
const p = /* @__PURE__ */ Symbol.for(
|
|
4
|
+
"vue-ssr:request-context"
|
|
5
|
+
), q = () => {
|
|
6
|
+
const e = S(p);
|
|
7
|
+
if (!e) throw new Error("vue-ssr-lite request context is not installed.");
|
|
8
|
+
return e;
|
|
9
|
+
}, C = /* @__PURE__ */ Symbol.for(
|
|
10
|
+
"vue-ssr:hydration-context"
|
|
11
|
+
), b = (e) => {
|
|
12
|
+
console.error("[vue-ssr-lite] hydration dispose failed", e);
|
|
13
|
+
}, m = (e, t = typeof window > "u") => {
|
|
14
|
+
const n = /* @__PURE__ */ new Map(), a = [], c = e ?? null;
|
|
15
|
+
return {
|
|
16
|
+
server: t,
|
|
17
|
+
read: (r) => c ? c[r] : void 0,
|
|
18
|
+
contribute: (r, o) => {
|
|
19
|
+
t && n.set(r, o);
|
|
20
|
+
},
|
|
21
|
+
onDispose: (r) => {
|
|
22
|
+
a.push(r);
|
|
23
|
+
},
|
|
24
|
+
collect: () => {
|
|
25
|
+
if (n.size === 0) return;
|
|
26
|
+
const r = {};
|
|
27
|
+
for (const [o, u] of n)
|
|
28
|
+
r[o] = u();
|
|
29
|
+
return r;
|
|
30
|
+
},
|
|
31
|
+
dispose: () => {
|
|
32
|
+
for (; a.length > 0; ) {
|
|
33
|
+
const r = a.pop();
|
|
34
|
+
try {
|
|
35
|
+
r?.();
|
|
36
|
+
} catch (o) {
|
|
37
|
+
b(o);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}, T = async (e, t) => {
|
|
43
|
+
if (!e?.id || !e.rootComponent)
|
|
44
|
+
throw new Error("An SSR application requires an id and rootComponent.");
|
|
45
|
+
if (t.hydrationState && t.hydrationState.applicationId !== e.id)
|
|
46
|
+
throw new Error("Hydration state belongs to a different SSR application.");
|
|
47
|
+
const n = typeof e.routes == "function" ? e.routes() : e.routes, a = n ? w({
|
|
48
|
+
history: t.server ? v() : x(),
|
|
49
|
+
routes: n,
|
|
50
|
+
scrollBehavior(s, d, i) {
|
|
51
|
+
if (i) return i;
|
|
52
|
+
if (s.hash) return { el: s.hash, top: 24 };
|
|
53
|
+
if (s.fullPath !== d.fullPath)
|
|
54
|
+
return { left: 0, top: 0 };
|
|
55
|
+
}
|
|
56
|
+
}) : null, c = t.hydrationState?.application ?? e.createInitialState?.() ?? {}, r = {
|
|
57
|
+
statusCode: 200,
|
|
58
|
+
headers: {},
|
|
59
|
+
redirect: null
|
|
60
|
+
}, o = m(
|
|
61
|
+
t.hydrationState?.plugins,
|
|
62
|
+
t.server
|
|
63
|
+
), u = {
|
|
64
|
+
request: t.request,
|
|
65
|
+
url: new URL(t.request.url),
|
|
66
|
+
host: t.request.host,
|
|
67
|
+
publicConfig: t.request.publicConfig,
|
|
68
|
+
state: c,
|
|
69
|
+
head: y(null),
|
|
70
|
+
response: r,
|
|
71
|
+
hydration: o
|
|
72
|
+
}, h = e.createExtension ? await e.createExtension(u) : void 0, l = { ...u, extension: h };
|
|
73
|
+
try {
|
|
74
|
+
const s = f(e.rootComponent);
|
|
75
|
+
return a && s.use(a), s.provide(C, o), s.provide(p, l), await e.install?.({
|
|
76
|
+
app: s,
|
|
77
|
+
router: a,
|
|
78
|
+
context: l,
|
|
79
|
+
hydration: o,
|
|
80
|
+
server: t.server
|
|
81
|
+
}), { app: s, router: a, context: l, hydration: o };
|
|
82
|
+
} catch (s) {
|
|
83
|
+
throw o.dispose(), s;
|
|
84
|
+
}
|
|
85
|
+
};
|
|
86
|
+
export {
|
|
87
|
+
C as S,
|
|
88
|
+
p as a,
|
|
89
|
+
m as b,
|
|
90
|
+
T as c,
|
|
91
|
+
q as u
|
|
92
|
+
};
|