vue-ssr-lite 0.1.8 → 0.1.10
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 +5 -1
- package/dist/SsrApplicationRuntime.d.ts +16 -0
- package/dist/SsrApplicationRuntime.d.ts.map +1 -1
- package/dist/SsrBrowserRuntime.d.ts +21 -0
- package/dist/SsrBrowserRuntime.d.ts.map +1 -1
- package/dist/SsrDiagnosticsRuntime.d.ts +22 -0
- package/dist/SsrDiagnosticsRuntime.d.ts.map +1 -0
- package/dist/SsrReactivityRuntime.d.ts +52 -0
- package/dist/SsrReactivityRuntime.d.ts.map +1 -0
- package/dist/SsrRenderRuntime.d.ts +16 -2
- package/dist/SsrRenderRuntime.d.ts.map +1 -1
- package/dist/SsrRequestResolution.d.ts +79 -0
- package/dist/SsrRequestResolution.d.ts.map +1 -0
- package/dist/SsrRuntimeTypes.d.ts +33 -0
- package/dist/SsrRuntimeTypes.d.ts.map +1 -1
- package/dist/chunks/SsrApplicationRuntime-DtsbOe2m.mjs +154 -0
- package/dist/chunks/SsrDiagnosticsRuntime-B5VbSgsA.mjs +28 -0
- package/dist/chunks/SsrReactivityRuntime-CUbPx7ew.mjs +9 -0
- package/dist/chunks/SsrServerRuntime-DVjCA0ul.mjs +731 -0
- package/dist/cli/SsrCliHmrPort.d.ts +4 -0
- package/dist/cli/SsrCliHmrPort.d.ts.map +1 -0
- package/dist/cli.mjs +72 -46
- package/dist/client.d.ts +2 -0
- package/dist/client.d.ts.map +1 -1
- package/dist/client.mjs +79 -31
- package/dist/index.d.ts +3 -0
- package/dist/index.d.ts.map +1 -1
- package/dist/index.mjs +18 -11
- package/dist/server/SsrRuntimeConfigRuntime.d.ts +54 -0
- package/dist/server/SsrRuntimeConfigRuntime.d.ts.map +1 -0
- package/dist/server/SsrServerRuntime.d.ts.map +1 -1
- package/dist/server.d.ts +1 -0
- package/dist/server.d.ts.map +1 -1
- package/dist/server.mjs +123 -23
- package/package.json +1 -1
- package/dist/chunks/SsrApplicationRuntime-BFebmWyk.mjs +0 -95
- package/dist/chunks/SsrServerRuntime-ChrpJneS.mjs +0 -670
package/README.md
CHANGED
|
@@ -45,11 +45,15 @@ It includes routing, browser hydration, production builds, a managed Node server
|
|
|
45
45
|
CLI binary:
|
|
46
46
|
|
|
47
47
|
```bash
|
|
48
|
-
vue-ssr-lite <dev|build|start> [--root .] [--runtime src/SsrRuntime.ts] [--server-output dist/server/SsrRuntime.js]
|
|
48
|
+
vue-ssr-lite <dev|build|start> [--root .] [--runtime src/SsrRuntime.ts] [--server-output dist/server/SsrRuntime.js] [--hmr-port 31001]
|
|
49
49
|
```
|
|
50
50
|
|
|
51
51
|
Requires Node.js 20 or newer.
|
|
52
52
|
|
|
53
|
+
Development servers use an operating-system-assigned HMR WebSocket port, so
|
|
54
|
+
multiple `vue-ssr-lite dev` processes can run concurrently. Use `--hmr-port`
|
|
55
|
+
or `VUE_SSR_LITE_HMR_PORT` when a proxy or container requires a fixed port.
|
|
56
|
+
|
|
53
57
|
## Installation
|
|
54
58
|
|
|
55
59
|
```bash
|
|
@@ -1,8 +1,24 @@
|
|
|
1
|
+
import { SsrResolutionController } from './SsrRequestResolution';
|
|
1
2
|
import { SsrApplicationDefinition, SsrCreatedApplication, SsrHydrationState, SsrRenderRequest } from './SsrRuntimeTypes';
|
|
2
3
|
export interface SsrCreateApplicationOptions<TApplicationState, TPublicConfig> {
|
|
3
4
|
server: boolean;
|
|
4
5
|
request: SsrRenderRequest<TPublicConfig>;
|
|
5
6
|
hydrationState?: SsrHydrationState<TApplicationState, TPublicConfig> | null;
|
|
7
|
+
/**
|
|
8
|
+
* Pure client-side SPA mount (no server markup to hydrate). Uses `createApp`
|
|
9
|
+
* instead of `createSSRApp` so Vue performs a full client render.
|
|
10
|
+
*/
|
|
11
|
+
spa?: boolean;
|
|
12
|
+
/**
|
|
13
|
+
* Server re-render only: opaque plugin state carried from the previous pass,
|
|
14
|
+
* restored so plugins (an API client cache, an i18n loader) resume warm.
|
|
15
|
+
*/
|
|
16
|
+
resumeState?: Record<string, unknown> | null;
|
|
17
|
+
/**
|
|
18
|
+
* Reuse a resolution controller across render passes of the same request.
|
|
19
|
+
* A fresh one is created when omitted.
|
|
20
|
+
*/
|
|
21
|
+
resolution?: SsrResolutionController;
|
|
6
22
|
}
|
|
7
23
|
export declare const createSsrApplication: <TApplicationState extends Record<string, any> = Record<string, unknown>, TPublicConfig = unknown, TExtension = unknown>(definition: SsrApplicationDefinition<TApplicationState, TPublicConfig, TExtension>, options: SsrCreateApplicationOptions<TApplicationState, TPublicConfig>) => Promise<SsrCreatedApplication<TApplicationState, TPublicConfig, TExtension>>;
|
|
8
24
|
//# sourceMappingURL=SsrApplicationRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
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;
|
|
1
|
+
{"version":3,"file":"SsrApplicationRuntime.d.ts","sourceRoot":"","sources":["../src/SsrApplicationRuntime.ts"],"names":[],"mappings":"AAWA,OAAO,EAGL,KAAK,uBAAuB,EAC7B,MAAM,wBAAwB,CAAA;AAC/B,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;IAC3E;;;OAGG;IACH,GAAG,CAAC,EAAE,OAAO,CAAA;IACb;;;OAGG;IACH,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,OAAO,CAAC,GAAG,IAAI,CAAA;IAC5C;;;OAGG;IACH,UAAU,CAAC,EAAE,uBAAuB,CAAA;CACrC;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,CAmG7E,CAAA"}
|
|
@@ -1,8 +1,29 @@
|
|
|
1
|
+
import { App } from 'vue';
|
|
1
2
|
import { SsrApplicationDefinition } from './SsrRuntimeTypes';
|
|
2
3
|
export interface SsrHydrateOptions {
|
|
3
4
|
mountSelector?: string;
|
|
4
5
|
stateElementId?: string;
|
|
5
6
|
removeHeadSelector?: string;
|
|
6
7
|
}
|
|
8
|
+
export interface SsrSpaMountOptions<TPublicConfig = unknown> {
|
|
9
|
+
mountSelector?: string;
|
|
10
|
+
/** Client-side public config. Defaults to `{}` for a self-contained SPA. */
|
|
11
|
+
publicConfig?: TPublicConfig;
|
|
12
|
+
/** Initial URL to route to. Defaults to `window.location`. */
|
|
13
|
+
url?: string;
|
|
14
|
+
}
|
|
15
|
+
export interface SsrMountedApplication {
|
|
16
|
+
app: App;
|
|
17
|
+
/** Unmount the app and dispose per-request resources. */
|
|
18
|
+
unmount: () => void;
|
|
19
|
+
}
|
|
7
20
|
export declare const hydrateSsrApplication: (definition: SsrApplicationDefinition<any, any, any>, options?: SsrHydrateOptions) => Promise<void>;
|
|
21
|
+
/**
|
|
22
|
+
* Mounts an {@link SsrApplicationDefinition} as a pure client-side SPA — the
|
|
23
|
+
* third mode alongside server render and browser hydration. The SAME definition
|
|
24
|
+
* (root component, routes, plugins, install hook, public config delivery) drives
|
|
25
|
+
* all three, so a consumer's SPA entry and SSR entry cannot drift. No server
|
|
26
|
+
* markup is required: Vue performs a full client render.
|
|
27
|
+
*/
|
|
28
|
+
export declare const mountSpaApplication: <TApplicationState extends Record<string, any> = Record<string, unknown>, TPublicConfig = unknown, TExtension = unknown>(definition: SsrApplicationDefinition<TApplicationState, TPublicConfig, TExtension>, options?: SsrSpaMountOptions<TPublicConfig>) => Promise<SsrMountedApplication>;
|
|
8
29
|
//# sourceMappingURL=SsrBrowserRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsrBrowserRuntime.d.ts","sourceRoot":"","sources":["../src/SsrBrowserRuntime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SsrBrowserRuntime.d.ts","sourceRoot":"","sources":["../src/SsrBrowserRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,MAAM,KAAK,CAAA;AAG9B,OAAO,KAAK,EACV,wBAAwB,EAGzB,MAAM,mBAAmB,CAAA;AAE1B,MAAM,WAAW,iBAAiB;IAChC,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,cAAc,CAAC,EAAE,MAAM,CAAA;IACvB,kBAAkB,CAAC,EAAE,MAAM,CAAA;CAC5B;AAED,MAAM,WAAW,kBAAkB,CAAC,aAAa,GAAG,OAAO;IACzD,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB,4EAA4E;IAC5E,YAAY,CAAC,EAAE,aAAa,CAAA;IAC5B,8DAA8D;IAC9D,GAAG,CAAC,EAAE,MAAM,CAAA;CACb;AAED,MAAM,WAAW,qBAAqB;IACpC,GAAG,EAAE,GAAG,CAAA;IACR,yDAAyD;IACzD,OAAO,EAAE,MAAM,IAAI,CAAA;CACpB;AAkBD,eAAO,MAAM,qBAAqB,GAChC,YAAY,wBAAwB,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,CAAC,EACnD,UAAS,iBAAsB,KAC9B,OAAO,CAAC,IAAI,CAkDd,CAAA;AAED;;;;;;GAMG;AACH,eAAO,MAAM,mBAAmB,GAC9B,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,UAAS,kBAAkB,CAAC,aAAa,CAAM,KAC9C,OAAO,CAAC,qBAAqB,CA8C/B,CAAA"}
|
|
@@ -0,0 +1,22 @@
|
|
|
1
|
+
import { Router } from 'vue-router';
|
|
2
|
+
/**
|
|
3
|
+
* Development-only render diagnostics.
|
|
4
|
+
*
|
|
5
|
+
* These surface the failure modes that otherwise ship silently to search
|
|
6
|
+
* engines: a server render that still shows a spinner, a route that matched no
|
|
7
|
+
* component, or a body that resolved to nothing. Every check is a pure string /
|
|
8
|
+
* route inspection with no side effects, and the caller only runs them when
|
|
9
|
+
* diagnostics are enabled, so production render paths are untouched.
|
|
10
|
+
*/
|
|
11
|
+
export interface SsrRenderDiagnosticInput {
|
|
12
|
+
html: string;
|
|
13
|
+
route?: Router['currentRoute']['value'] | null;
|
|
14
|
+
requestUrl: string;
|
|
15
|
+
applicationId: string;
|
|
16
|
+
}
|
|
17
|
+
export interface SsrRenderDiagnostic {
|
|
18
|
+
code: 'loading-placeholder' | 'empty-route' | 'empty-content' | 'busy-attribute';
|
|
19
|
+
message: string;
|
|
20
|
+
}
|
|
21
|
+
export declare const collectSsrRenderDiagnostics: (input: SsrRenderDiagnosticInput) => SsrRenderDiagnostic[];
|
|
22
|
+
//# sourceMappingURL=SsrDiagnosticsRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SsrDiagnosticsRuntime.d.ts","sourceRoot":"","sources":["../src/SsrDiagnosticsRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,MAAM,EAAE,MAAM,YAAY,CAAA;AAExC;;;;;;;;GAQG;AAEH,MAAM,WAAW,wBAAwB;IACvC,IAAI,EAAE,MAAM,CAAA;IACZ,KAAK,CAAC,EAAE,MAAM,CAAC,cAAc,CAAC,CAAC,OAAO,CAAC,GAAG,IAAI,CAAA;IAC9C,UAAU,EAAE,MAAM,CAAA;IAClB,aAAa,EAAE,MAAM,CAAA;CACtB;AAED,MAAM,WAAW,mBAAmB;IAClC,IAAI,EACA,qBAAqB,GACrB,aAAa,GACb,eAAe,GACf,gBAAgB,CAAA;IACpB,OAAO,EAAE,MAAM,CAAA;CAChB;AAoBD,eAAO,MAAM,2BAA2B,GACtC,OAAO,wBAAwB,KAC9B,mBAAmB,EAgCrB,CAAA"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { watchEffect, WatchCallback, WatchOptions, WatchSource, WatchStopHandle } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* SSR-safe reactivity.
|
|
4
|
+
*
|
|
5
|
+
* # Which Vue reactivity APIs are server-safe
|
|
6
|
+
*
|
|
7
|
+
* During server-side rendering Vue does NOT flush the scheduler, so any effect
|
|
8
|
+
* queued to run later is created and then discarded. This is the single most
|
|
9
|
+
* common cause of "the shell renders but the content is missing" bugs.
|
|
10
|
+
*
|
|
11
|
+
* | API | Server behaviour |
|
|
12
|
+
* | ------------------------------------- | -------------------------------------------------- |
|
|
13
|
+
* | `computed` | ✅ Safe. Lazily evaluated during render. |
|
|
14
|
+
* | `watch(src, cb, { flush: 'sync' })` | ✅ Safe. Runs synchronously, stays active in render.|
|
|
15
|
+
* | `watch(src, cb)` / `{ flush:'pre' }` | ⚠️ Discarded. `immediate` runs once, then nothing.|
|
|
16
|
+
* | `watch(src, cb, { flush: 'post' })` | ⚠️ Discarded. Never runs on the server. |
|
|
17
|
+
* | `watchEffect(fn)` | ⚠️ Runs once at setup, then discarded. |
|
|
18
|
+
* | `onServerPrefetch(async fn)` | ✅ Safe. Awaited before the component renders. |
|
|
19
|
+
* | `onMounted` / `onUpdated` | ❌ Browser only. Never runs on the server. |
|
|
20
|
+
*
|
|
21
|
+
* # The primitive
|
|
22
|
+
*
|
|
23
|
+
* {@link ssrWatch} and {@link ssrWatchEffect} force `flush: 'sync'`, so the
|
|
24
|
+
* effect is active during the server render and reacts to state that settles
|
|
25
|
+
* mid-render (for example a ref written by an awaited `onServerPrefetch`). They
|
|
26
|
+
* behave identically on the server and in the browser, which is exactly what an
|
|
27
|
+
* application needs to derive state from resolved data without reinventing a
|
|
28
|
+
* broken watcher workaround.
|
|
29
|
+
*
|
|
30
|
+
* Prefer a `computed` when you only need to DERIVE a value for the template.
|
|
31
|
+
* Reach for {@link ssrWatch} when resolved data must drive an imperative side
|
|
32
|
+
* effect (populating an external store, setting a status code) that has to
|
|
33
|
+
* happen during the server render.
|
|
34
|
+
*/
|
|
35
|
+
export type SsrWatchOptions<Immediate extends boolean = boolean> = Omit<WatchOptions<Immediate>, 'flush'>;
|
|
36
|
+
/**
|
|
37
|
+
* `watch`, pinned to `flush: 'sync'` so the callback is active during SSR.
|
|
38
|
+
*
|
|
39
|
+
* Identical semantics to Vue's `watch` otherwise: pass `{ immediate: true }` to
|
|
40
|
+
* run once on setup, and use the returned handle to stop it. Because the flush
|
|
41
|
+
* is synchronous, avoid mutating the watched source from inside the callback.
|
|
42
|
+
*/
|
|
43
|
+
export declare function ssrWatch<T, Immediate extends boolean = false>(source: WatchSource<T>, callback: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: SsrWatchOptions<Immediate>): WatchStopHandle;
|
|
44
|
+
export declare function ssrWatch<T extends readonly unknown[], Immediate extends boolean = false>(source: readonly [...T] | (() => T), callback: WatchCallback<T, Immediate extends true ? T | undefined : T>, options?: SsrWatchOptions<Immediate>): WatchStopHandle;
|
|
45
|
+
/**
|
|
46
|
+
* `watchEffect`, pinned to `flush: 'sync'` so the effect is active during SSR.
|
|
47
|
+
* The effect runs immediately and re-runs synchronously whenever a tracked
|
|
48
|
+
* dependency changes — including changes that happen while the server render is
|
|
49
|
+
* still in progress.
|
|
50
|
+
*/
|
|
51
|
+
export declare const ssrWatchEffect: (effect: Parameters<typeof watchEffect>[0], options?: Omit<NonNullable<Parameters<typeof watchEffect>[1]>, "flush">) => WatchStopHandle;
|
|
52
|
+
//# sourceMappingURL=SsrReactivityRuntime.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SsrReactivityRuntime.d.ts","sourceRoot":"","sources":["../src/SsrReactivityRuntime.ts"],"names":[],"mappings":"AAAA,OAAO,EAEL,WAAW,EACX,KAAK,aAAa,EAClB,KAAK,YAAY,EACjB,KAAK,WAAW,EAChB,KAAK,eAAe,EACrB,MAAM,KAAK,CAAA;AAEZ;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GAgCG;AAEH,MAAM,MAAM,eAAe,CAAC,SAAS,SAAS,OAAO,GAAG,OAAO,IAAI,IAAI,CACrE,YAAY,CAAC,SAAS,CAAC,EACvB,OAAO,CACR,CAAA;AAED;;;;;;GAMG;AACH,wBAAgB,QAAQ,CAAC,CAAC,EAAE,SAAS,SAAS,OAAO,GAAG,KAAK,EAC3D,MAAM,EAAE,WAAW,CAAC,CAAC,CAAC,EACtB,QAAQ,EAAE,aAAa,CAAC,CAAC,EAAE,SAAS,SAAS,IAAI,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,EACtE,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,GACnC,eAAe,CAAA;AAClB,wBAAgB,QAAQ,CAAC,CAAC,SAAS,SAAS,OAAO,EAAE,EAAE,SAAS,SAAS,OAAO,GAAG,KAAK,EACtF,MAAM,EAAE,SAAS,CAAC,GAAG,CAAC,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,EACnC,QAAQ,EAAE,aAAa,CAAC,CAAC,EAAE,SAAS,SAAS,IAAI,GAAG,CAAC,GAAG,SAAS,GAAG,CAAC,CAAC,EACtE,OAAO,CAAC,EAAE,eAAe,CAAC,SAAS,CAAC,GACnC,eAAe,CAAA;AASlB;;;;;GAKG;AACH,eAAO,MAAM,cAAc,GACzB,QAAQ,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,EACzC,UAAU,IAAI,CAAC,WAAW,CAAC,UAAU,CAAC,OAAO,WAAW,CAAC,CAAC,CAAC,CAAC,CAAC,EAAE,OAAO,CAAC,KACtE,eAAqE,CAAA"}
|
|
@@ -1,3 +1,17 @@
|
|
|
1
|
-
import { SsrApplicationDefinition, SsrRenderRequest, SsrRenderResult } from './SsrRuntimeTypes';
|
|
2
|
-
export
|
|
1
|
+
import { SsrApplicationDefinition, SsrLogger, SsrRenderRequest, SsrRenderResult } from './SsrRuntimeTypes';
|
|
2
|
+
export interface SsrRenderOptions {
|
|
3
|
+
/**
|
|
4
|
+
* Maximum render passes. The first always runs; further passes only occur
|
|
5
|
+
* when a plugin left resolution work pending or asked for another pass.
|
|
6
|
+
* Defaults to 4, clamped to at least 1.
|
|
7
|
+
*/
|
|
8
|
+
maxResolutionPasses?: number;
|
|
9
|
+
/** Bound, in ms, for awaiting registered work between passes. */
|
|
10
|
+
resolutionDeadlineMs?: number;
|
|
11
|
+
/** Enables development-only render diagnostics. Inert in production. */
|
|
12
|
+
diagnostics?: boolean;
|
|
13
|
+
/** Structured logger for diagnostics and pass reporting. */
|
|
14
|
+
logger?: SsrLogger;
|
|
15
|
+
}
|
|
16
|
+
export declare const renderSsrApplication: <TApplicationState extends Record<string, any> = Record<string, unknown>, TPublicConfig = unknown, TExtension = unknown>(definition: SsrApplicationDefinition<TApplicationState, TPublicConfig, TExtension>, request: SsrRenderRequest<TPublicConfig>, options?: SsrRenderOptions) => Promise<SsrRenderResult<TApplicationState, TPublicConfig>>;
|
|
3
17
|
//# sourceMappingURL=SsrRenderRuntime.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"SsrRenderRuntime.d.ts","sourceRoot":"","sources":["../src/SsrRenderRuntime.ts"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"SsrRenderRuntime.d.ts","sourceRoot":"","sources":["../src/SsrRenderRuntime.ts"],"names":[],"mappings":"AAKA,OAAO,KAAK,EACV,wBAAwB,EAExB,SAAS,EACT,gBAAgB,EAChB,eAAe,EAChB,MAAM,mBAAmB,CAAA;AAK1B,MAAM,WAAW,gBAAgB;IAC/B;;;;OAIG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B,iEAAiE;IACjE,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B,wEAAwE;IACxE,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,4DAA4D;IAC5D,MAAM,CAAC,EAAE,SAAS,CAAA;CACnB;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,gBAAgB,CAAC,aAAa,CAAC,EACxC,UAAS,gBAAqB,KAC7B,OAAO,CAAC,eAAe,CAAC,iBAAiB,EAAE,aAAa,CAAC,CAkK3D,CAAA"}
|
|
@@ -0,0 +1,79 @@
|
|
|
1
|
+
import { InjectionKey } from 'vue';
|
|
2
|
+
/**
|
|
3
|
+
* Generic, framework-neutral server-render resolution contract.
|
|
4
|
+
*
|
|
5
|
+
* `renderToString` makes a single pass and awaits each component's native
|
|
6
|
+
* `onServerPrefetch`. That covers data consumed reactively inside the component
|
|
7
|
+
* that declared it, but it offers no way to:
|
|
8
|
+
*
|
|
9
|
+
* 1. await asynchronous work that was started OUTSIDE a component's own
|
|
10
|
+
* prefetch lifecycle (a store action, an i18n loader, a lazy query), or
|
|
11
|
+
* 2. tell the renderer that application state settled AFTER the first pass and
|
|
12
|
+
* the tree should be produced again.
|
|
13
|
+
*
|
|
14
|
+
* This contract closes both gaps without `vue-ssr-lite` learning anything about
|
|
15
|
+
* the plugin doing the work. An installed plugin — an API client, a store, an
|
|
16
|
+
* i18n cache — obtains the active resolution by injecting
|
|
17
|
+
* {@link SSR_REQUEST_RESOLUTION}. The key is created with `Symbol.for(...)` so a
|
|
18
|
+
* plugin integrates WITHOUT importing this package (it re-derives the identical
|
|
19
|
+
* symbol):
|
|
20
|
+
*
|
|
21
|
+
* ```ts
|
|
22
|
+
* const resolution = app.runWithContext(() =>
|
|
23
|
+
* inject<SsrRequestResolution | null>(
|
|
24
|
+
* Symbol.for('vue-ssr:request-resolution'),
|
|
25
|
+
* null,
|
|
26
|
+
* )
|
|
27
|
+
* )
|
|
28
|
+
* resolution?.track(client.query(...))
|
|
29
|
+
* ```
|
|
30
|
+
*
|
|
31
|
+
* The contract is API-client neutral: it never inspects the work it is handed.
|
|
32
|
+
*/
|
|
33
|
+
export interface SsrRequestResolution {
|
|
34
|
+
/** True while server-rendering, false during browser hydration / SPA mount. */
|
|
35
|
+
readonly server: boolean;
|
|
36
|
+
/** Zero-based index of the render pass currently in progress. */
|
|
37
|
+
readonly pass: number;
|
|
38
|
+
/**
|
|
39
|
+
* Register in-flight async work the renderer must await before it serializes
|
|
40
|
+
* the response. Returns the same promise for convenient chaining. Ignored in
|
|
41
|
+
* the browser, where there is no server render to gate. Rejections are
|
|
42
|
+
* swallowed by the renderer's await — the component tree owns error surfacing.
|
|
43
|
+
*/
|
|
44
|
+
track<T>(work: Promise<T>): Promise<T>;
|
|
45
|
+
/**
|
|
46
|
+
* Request one additional render pass even when no tracked promise is pending.
|
|
47
|
+
* Use when work mutated shared state synchronously in a way the current tree
|
|
48
|
+
* did not observe. Honoured up to the configured pass bound.
|
|
49
|
+
*/
|
|
50
|
+
requestAdditionalPass(): void;
|
|
51
|
+
}
|
|
52
|
+
/**
|
|
53
|
+
* Cross-package-stable injection key for {@link SsrRequestResolution}. Uses the
|
|
54
|
+
* global symbol registry so integrations resolve the same identity whether or
|
|
55
|
+
* not they import `vue-ssr-lite`.
|
|
56
|
+
*/
|
|
57
|
+
export declare const SSR_REQUEST_RESOLUTION: InjectionKey<SsrRequestResolution>;
|
|
58
|
+
export interface SsrResolutionController extends SsrRequestResolution {
|
|
59
|
+
/** Begin a new render pass: clears the additional-pass request flag. */
|
|
60
|
+
beginPass(pass: number): void;
|
|
61
|
+
/** Promises registered during the current request that are not yet settled. */
|
|
62
|
+
pendingWork(): Promise<unknown>[];
|
|
63
|
+
/** True when a plugin explicitly asked for another pass this render. */
|
|
64
|
+
additionalPassRequested(): boolean;
|
|
65
|
+
/**
|
|
66
|
+
* Await all currently-tracked work, bounded by `deadlineMs` and aborted by
|
|
67
|
+
* `signal`. Returns `true` when everything settled within the deadline.
|
|
68
|
+
*/
|
|
69
|
+
drain(deadlineMs: number, signal?: AbortSignal): Promise<boolean>;
|
|
70
|
+
/** Clear all state. Called once per request after the final pass. */
|
|
71
|
+
dispose(): void;
|
|
72
|
+
}
|
|
73
|
+
/**
|
|
74
|
+
* Creates the per-request resolution controller. Reused across every render
|
|
75
|
+
* pass of a single request so tracked work and pass requests accumulate
|
|
76
|
+
* coherently while the Vue application itself is recreated per pass.
|
|
77
|
+
*/
|
|
78
|
+
export declare const createSsrResolutionController: (server?: boolean) => SsrResolutionController;
|
|
79
|
+
//# sourceMappingURL=SsrRequestResolution.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"SsrRequestResolution.d.ts","sourceRoot":"","sources":["../src/SsrRequestResolution.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,KAAK,CAAA;AAEvC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA8BG;AACH,MAAM,WAAW,oBAAoB;IACnC,+EAA+E;IAC/E,QAAQ,CAAC,MAAM,EAAE,OAAO,CAAA;IACxB,iEAAiE;IACjE,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB;;;;;OAKG;IACH,KAAK,CAAC,CAAC,EAAE,IAAI,EAAE,OAAO,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,CAAC,CAAC,CAAA;IACtC;;;;OAIG;IACH,qBAAqB,IAAI,IAAI,CAAA;CAC9B;AAED;;;;GAIG;AACH,eAAO,MAAM,sBAAsB,EAE9B,YAAY,CAAC,oBAAoB,CAAC,CAAA;AAEvC,MAAM,WAAW,uBAAwB,SAAQ,oBAAoB;IACnE,wEAAwE;IACxE,SAAS,CAAC,IAAI,EAAE,MAAM,GAAG,IAAI,CAAA;IAC7B,+EAA+E;IAC/E,WAAW,IAAI,OAAO,CAAC,OAAO,CAAC,EAAE,CAAA;IACjC,wEAAwE;IACxE,uBAAuB,IAAI,OAAO,CAAA;IAClC;;;OAGG;IACH,KAAK,CAAC,UAAU,EAAE,MAAM,EAAE,MAAM,CAAC,EAAE,WAAW,GAAG,OAAO,CAAC,OAAO,CAAC,CAAA;IACjE,qEAAqE;IACrE,OAAO,IAAI,IAAI,CAAA;CAChB;AAYD;;;;GAIG;AACH,eAAO,MAAM,6BAA6B,GACxC,SAAQ,OAAuC,KAC9C,uBA4EF,CAAA"}
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
import { App, Component, Plugin } from 'vue';
|
|
2
2
|
import { Router, RouteRecordRaw } from 'vue-router';
|
|
3
3
|
import { SsrHydrationContext, SsrHydrationController } from './SsrHydrationRuntime';
|
|
4
|
+
import { SsrRequestResolution, SsrResolutionController } from './SsrRequestResolution';
|
|
4
5
|
export type SsrHeaderValue = string | string[] | undefined;
|
|
5
6
|
export type SsrHeaders = Record<string, SsrHeaderValue>;
|
|
6
7
|
export interface SsrHeadPayload {
|
|
@@ -46,6 +47,8 @@ export interface SsrRenderMetrics {
|
|
|
46
47
|
totalDurationMs: number;
|
|
47
48
|
htmlBytes: number;
|
|
48
49
|
stateBytes: number;
|
|
50
|
+
/** Number of render passes the resolution contract required. Usually 1. */
|
|
51
|
+
renderPasses: number;
|
|
49
52
|
}
|
|
50
53
|
export interface SsrRenderRequest<TPublicConfig = unknown> {
|
|
51
54
|
requestId: string;
|
|
@@ -83,6 +86,12 @@ export interface SsrRequestContext<TApplicationState = Record<string, unknown>,
|
|
|
83
86
|
response: SsrResponseState;
|
|
84
87
|
/** Generic hydration state contract for installed application plugins. */
|
|
85
88
|
hydration: SsrHydrationContext;
|
|
89
|
+
/**
|
|
90
|
+
* Generic server-render resolution contract. Installed plugins register
|
|
91
|
+
* in-flight work so the renderer can await it and re-render when resolution
|
|
92
|
+
* changes the tree. Present in every mode; a no-op outside the server render.
|
|
93
|
+
*/
|
|
94
|
+
resolution: SsrRequestResolution;
|
|
86
95
|
extension: TExtension;
|
|
87
96
|
}
|
|
88
97
|
export interface SsrApplicationSetup<TApplicationState, TPublicConfig, TExtension> {
|
|
@@ -91,6 +100,8 @@ export interface SsrApplicationSetup<TApplicationState, TPublicConfig, TExtensio
|
|
|
91
100
|
context: SsrRequestContext<TApplicationState, TPublicConfig, TExtension>;
|
|
92
101
|
/** Generic hydration state contract for installed application plugins. */
|
|
93
102
|
hydration: SsrHydrationContext;
|
|
103
|
+
/** Generic server-render resolution contract for installed plugins. */
|
|
104
|
+
resolution: SsrRequestResolution;
|
|
94
105
|
server: boolean;
|
|
95
106
|
}
|
|
96
107
|
export interface SsrApplicationDefinition<TApplicationState = Record<string, unknown>, TPublicConfig = unknown, TExtension = unknown> {
|
|
@@ -112,6 +123,8 @@ export interface SsrCreatedApplication<TApplicationState = Record<string, unknow
|
|
|
112
123
|
context: SsrRequestContext<TApplicationState, TPublicConfig, TExtension>;
|
|
113
124
|
/** Per-request hydration controller owning plugin state and disposal. */
|
|
114
125
|
hydration: SsrHydrationController;
|
|
126
|
+
/** Per-request resolution controller, shared across render passes. */
|
|
127
|
+
resolution: SsrResolutionController;
|
|
115
128
|
}
|
|
116
129
|
export interface SsrRenderResult<TApplicationState = unknown, TPublicConfig = unknown> {
|
|
117
130
|
html: string;
|
|
@@ -210,6 +223,26 @@ export interface SsrServerOptions<TPublicConfig = unknown> {
|
|
|
210
223
|
publicConfig: TPublicConfig;
|
|
211
224
|
healthPath?: string;
|
|
212
225
|
readinessPath?: string;
|
|
226
|
+
/**
|
|
227
|
+
* Maximum server render passes per request. The first pass always runs; extra
|
|
228
|
+
* passes only occur when an installed plugin left work pending or asked for
|
|
229
|
+
* another pass through the resolution contract. A fully resolvable page
|
|
230
|
+
* completes in one pass. Defaults to 4. Clamped to at least 1.
|
|
231
|
+
*/
|
|
232
|
+
maxResolutionPasses?: number;
|
|
233
|
+
/**
|
|
234
|
+
* Upper bound, in milliseconds, for awaiting registered resolution work
|
|
235
|
+
* BETWEEN passes. Independent of — and additionally capped by — the overall
|
|
236
|
+
* `requestTimeoutMs` and the request abort signal. Defaults to
|
|
237
|
+
* `requestTimeoutMs` when unset.
|
|
238
|
+
*/
|
|
239
|
+
resolutionDeadlineMs?: number;
|
|
240
|
+
/**
|
|
241
|
+
* Enables development-only render diagnostics (loading-placeholder detection,
|
|
242
|
+
* empty-route detection, discarded-watcher hints). Defaults to
|
|
243
|
+
* `NODE_ENV !== 'production'` when unset. Always inert in production.
|
|
244
|
+
*/
|
|
245
|
+
diagnostics?: boolean;
|
|
213
246
|
logger?: SsrLogger;
|
|
214
247
|
onMetrics?: (metrics: SsrRenderMetrics) => void;
|
|
215
248
|
renderError?: (context: SsrErrorRenderContext<TPublicConfig>) => SsrHttpResponse | null | Promise<SsrHttpResponse | null>;
|
|
@@ -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,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,uBAAuB,CAAA;
|
|
1
|
+
{"version":3,"file":"SsrRuntimeTypes.d.ts","sourceRoot":"","sources":["../src/SsrRuntimeTypes.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,GAAG,EAAE,SAAS,EAAE,MAAM,EAAE,MAAM,KAAK,CAAA;AACjD,OAAO,KAAK,EAAE,MAAM,EAAE,cAAc,EAAE,MAAM,YAAY,CAAA;AACxD,OAAO,KAAK,EACV,mBAAmB,EACnB,sBAAsB,EACvB,MAAM,uBAAuB,CAAA;AAC9B,OAAO,KAAK,EACV,oBAAoB,EACpB,uBAAuB,EACxB,MAAM,wBAAwB,CAAA;AAE/B,MAAM,MAAM,cAAc,GAAG,MAAM,GAAG,MAAM,EAAE,GAAG,SAAS,CAAA;AAC1D,MAAM,MAAM,UAAU,GAAG,MAAM,CAAC,MAAM,EAAE,cAAc,CAAC,CAAA;AAEvD,MAAM,WAAW,cAAc;IAC7B,KAAK,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACrB,WAAW,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC3B,QAAQ,CAAC,EAAE,MAAM,GAAG,SAAS,MAAM,EAAE,GAAG,IAAI,CAAA;IAC5C,MAAM,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACtB,YAAY,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IAC5B,OAAO,CAAC,EAAE,MAAM,GAAG,IAAI,CAAA;IACvB,OAAO,CAAC,EAAE,MAAM,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AA;IAC3B,UAAU,CAAC,EAAE,MAAM,CAAA;IACnB,aAAa,CAAC,EAAE,MAAM,CAAA;IACtB;;;;;OAKG;IACH,mBAAmB,CAAC,EAAE,MAAM,CAAA;IAC5B;;;;;OAKG;IACH,oBAAoB,CAAC,EAAE,MAAM,CAAA;IAC7B;;;;OAIG;IACH,WAAW,CAAC,EAAE,OAAO,CAAA;IACrB,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,154 @@
|
|
|
1
|
+
import { inject as y, ref as S, createApp as m, createSSRApp as b } from "vue";
|
|
2
|
+
import { createRouter as w, createMemoryHistory as R, createWebHistory as E } from "vue-router";
|
|
3
|
+
const h = /* @__PURE__ */ Symbol.for(
|
|
4
|
+
"vue-ssr:request-context"
|
|
5
|
+
), H = () => {
|
|
6
|
+
const e = y(h);
|
|
7
|
+
if (!e) throw new Error("vue-ssr-lite request context is not installed.");
|
|
8
|
+
return e;
|
|
9
|
+
}, q = /* @__PURE__ */ Symbol.for(
|
|
10
|
+
"vue-ssr:hydration-context"
|
|
11
|
+
), C = (e) => {
|
|
12
|
+
console.error("[vue-ssr-lite] hydration dispose failed", e);
|
|
13
|
+
}, g = (e, r = typeof window > "u") => {
|
|
14
|
+
const a = /* @__PURE__ */ new Map(), n = [], u = e ?? null;
|
|
15
|
+
return {
|
|
16
|
+
server: r,
|
|
17
|
+
read: (t) => u ? u[t] : void 0,
|
|
18
|
+
contribute: (t, o) => {
|
|
19
|
+
r && a.set(t, o);
|
|
20
|
+
},
|
|
21
|
+
onDispose: (t) => {
|
|
22
|
+
n.push(t);
|
|
23
|
+
},
|
|
24
|
+
collect: () => {
|
|
25
|
+
if (a.size === 0) return;
|
|
26
|
+
const t = {};
|
|
27
|
+
for (const [o, c] of a)
|
|
28
|
+
t[o] = c();
|
|
29
|
+
return t;
|
|
30
|
+
},
|
|
31
|
+
dispose: () => {
|
|
32
|
+
for (; n.length > 0; ) {
|
|
33
|
+
const t = n.pop();
|
|
34
|
+
try {
|
|
35
|
+
t?.();
|
|
36
|
+
} catch (o) {
|
|
37
|
+
C(o);
|
|
38
|
+
}
|
|
39
|
+
}
|
|
40
|
+
}
|
|
41
|
+
};
|
|
42
|
+
}, v = /* @__PURE__ */ Symbol.for(
|
|
43
|
+
"vue-ssr:request-resolution"
|
|
44
|
+
), x = (e) => !!e && (typeof e == "object" || typeof e == "function") && typeof e.then == "function", T = (e = typeof window > "u") => {
|
|
45
|
+
const r = /* @__PURE__ */ new Set();
|
|
46
|
+
let a = 0, n = !1;
|
|
47
|
+
const u = {
|
|
48
|
+
server: e,
|
|
49
|
+
get pass() {
|
|
50
|
+
return a;
|
|
51
|
+
},
|
|
52
|
+
track: (t) => {
|
|
53
|
+
if (!e || !x(t)) return t;
|
|
54
|
+
const o = { promise: t, settled: !1 };
|
|
55
|
+
return r.add(o), t.then(
|
|
56
|
+
() => {
|
|
57
|
+
o.settled = !0;
|
|
58
|
+
},
|
|
59
|
+
() => {
|
|
60
|
+
o.settled = !0;
|
|
61
|
+
}
|
|
62
|
+
), t;
|
|
63
|
+
},
|
|
64
|
+
requestAdditionalPass: () => {
|
|
65
|
+
e && (n = !0);
|
|
66
|
+
},
|
|
67
|
+
beginPass: (t) => {
|
|
68
|
+
a = t, n = !1;
|
|
69
|
+
},
|
|
70
|
+
pendingWork: () => [...r].filter((t) => !t.settled).map((t) => t.promise),
|
|
71
|
+
additionalPassRequested: () => n,
|
|
72
|
+
drain: async (t, o) => {
|
|
73
|
+
const c = async () => {
|
|
74
|
+
for (; ; ) {
|
|
75
|
+
const s = u.pendingWork();
|
|
76
|
+
if (s.length === 0) return !0;
|
|
77
|
+
await Promise.allSettled(s);
|
|
78
|
+
}
|
|
79
|
+
};
|
|
80
|
+
if (!Number.isFinite(t) || t <= 0)
|
|
81
|
+
return o?.aborted ? u.pendingWork().length === 0 : c();
|
|
82
|
+
let l, i;
|
|
83
|
+
const d = new Promise((s) => {
|
|
84
|
+
l = setTimeout(() => s(!1), t), o && (i = () => s(!1), o.aborted ? s(!1) : o.addEventListener("abort", i, { once: !0 }));
|
|
85
|
+
});
|
|
86
|
+
try {
|
|
87
|
+
return await Promise.race([c(), d]);
|
|
88
|
+
} finally {
|
|
89
|
+
l && clearTimeout(l), o && i && o.removeEventListener("abort", i);
|
|
90
|
+
}
|
|
91
|
+
},
|
|
92
|
+
dispose: () => {
|
|
93
|
+
r.clear(), n = !1, a = 0;
|
|
94
|
+
}
|
|
95
|
+
};
|
|
96
|
+
return u;
|
|
97
|
+
}, I = async (e, r) => {
|
|
98
|
+
if (!e?.id || !e.rootComponent)
|
|
99
|
+
throw new Error("An SSR application requires an id and rootComponent.");
|
|
100
|
+
if (r.hydrationState && r.hydrationState.applicationId !== e.id)
|
|
101
|
+
throw new Error("Hydration state belongs to a different SSR application.");
|
|
102
|
+
const a = typeof e.routes == "function" ? e.routes() : e.routes, n = a ? w({
|
|
103
|
+
history: r.server ? R() : E(),
|
|
104
|
+
routes: a,
|
|
105
|
+
scrollBehavior(s, p, f) {
|
|
106
|
+
if (f) return f;
|
|
107
|
+
if (s.hash) return { el: s.hash, top: 24 };
|
|
108
|
+
if (s.fullPath !== p.fullPath)
|
|
109
|
+
return { left: 0, top: 0 };
|
|
110
|
+
}
|
|
111
|
+
}) : null, u = r.hydrationState?.application ?? e.createInitialState?.() ?? {}, t = {
|
|
112
|
+
statusCode: 200,
|
|
113
|
+
headers: {},
|
|
114
|
+
redirect: null
|
|
115
|
+
}, o = g(
|
|
116
|
+
r.hydrationState?.plugins ?? r.resumeState,
|
|
117
|
+
r.server
|
|
118
|
+
), c = r.resolution ?? T(r.server), l = {
|
|
119
|
+
applicationId: e.id,
|
|
120
|
+
request: r.request,
|
|
121
|
+
url: new URL(r.request.url),
|
|
122
|
+
host: r.request.host,
|
|
123
|
+
publicConfig: r.request.publicConfig,
|
|
124
|
+
state: u,
|
|
125
|
+
head: S(null),
|
|
126
|
+
response: t,
|
|
127
|
+
hydration: o,
|
|
128
|
+
resolution: c
|
|
129
|
+
}, i = e.createExtension ? await e.createExtension(l) : void 0, d = { ...l, extension: i };
|
|
130
|
+
try {
|
|
131
|
+
const s = r.spa ? m(e.rootComponent) : b(e.rootComponent);
|
|
132
|
+
n && s.use(n), s.provide(q, o), s.provide(v, c), s.provide(h, d);
|
|
133
|
+
for (const p of e.plugins ?? []) s.use(p);
|
|
134
|
+
return await e.install?.({
|
|
135
|
+
app: s,
|
|
136
|
+
router: n,
|
|
137
|
+
context: d,
|
|
138
|
+
hydration: o,
|
|
139
|
+
resolution: c,
|
|
140
|
+
server: r.server
|
|
141
|
+
}), { app: s, router: n, context: d, hydration: o, resolution: c };
|
|
142
|
+
} catch (s) {
|
|
143
|
+
throw o.dispose(), s;
|
|
144
|
+
}
|
|
145
|
+
};
|
|
146
|
+
export {
|
|
147
|
+
v as S,
|
|
148
|
+
q as a,
|
|
149
|
+
h as b,
|
|
150
|
+
I as c,
|
|
151
|
+
g as d,
|
|
152
|
+
T as e,
|
|
153
|
+
H as u
|
|
154
|
+
};
|
|
@@ -0,0 +1,28 @@
|
|
|
1
|
+
const a = [
|
|
2
|
+
/\baria-busy=["']true["']/i,
|
|
3
|
+
/\brole=["']status["'][^>]*>\s*(?:<[^>]+>\s*)*(?:loading|please wait)/i,
|
|
4
|
+
/\b(?:class|data-testid)=["'][^"']*\bspinner\b[^"']*["']/i,
|
|
5
|
+
/\bclass=["'][^"']*\banimate-pulse\b[^"']*["']/i,
|
|
6
|
+
/>\s*Loading(?:\s|<|\.|…|…)/i
|
|
7
|
+
], n = (e) => e.replace(/<script[\s\S]*?<\/script>/gi, "").replace(/<style[\s\S]*?<\/style>/gi, "").replace(/<[^>]+>/g, " ").replace(/\s+/g, " ").trim(), c = (e) => {
|
|
8
|
+
const t = [], { html: r } = e;
|
|
9
|
+
for (const o of a)
|
|
10
|
+
if (o.test(r)) {
|
|
11
|
+
const s = /\baria-busy=["']true["']/i.test(r);
|
|
12
|
+
t.push({
|
|
13
|
+
code: s ? "busy-attribute" : "loading-placeholder",
|
|
14
|
+
message: s ? 'Server output still contains aria-busy="true"; a live region is reporting a busy state that will be absent for crawlers. Resolve the data before the render completes (see ssrWatch / onServerPrefetch).' : "Server output still contains a loading placeholder after resolution completed. A non-sync watcher or onMounted hook likely started the work; move it to onServerPrefetch or the ssrWatch primitive so the server awaits it."
|
|
15
|
+
});
|
|
16
|
+
break;
|
|
17
|
+
}
|
|
18
|
+
return e.route && e.route.matched.length === 0 && t.push({
|
|
19
|
+
code: "empty-route",
|
|
20
|
+
message: `No route matched "${e.requestUrl}" for application "${e.applicationId}". The renderer produced a 404; add a catch-all route record or a not-found component so matched components render real content.`
|
|
21
|
+
}), n(r).length === 0 && t.push({
|
|
22
|
+
code: "empty-content",
|
|
23
|
+
message: `Server render for "${e.applicationId}" produced no textual content. Verify the root component's data resolved during the server render rather than in a discarded watcher.`
|
|
24
|
+
}), t;
|
|
25
|
+
};
|
|
26
|
+
export {
|
|
27
|
+
c
|
|
28
|
+
};
|