@sigx/server-renderer 0.1.5 → 0.1.7
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/builtin-ssr-directives.d.ts +8 -0
- package/dist/builtin-ssr-directives.d.ts.map +1 -0
- package/dist/client/hydrate-component.d.ts +32 -0
- package/dist/client/hydrate-component.d.ts.map +1 -0
- package/dist/client/hydrate-context.d.ts +54 -0
- package/dist/client/hydrate-context.d.ts.map +1 -0
- package/dist/client/hydrate-core.d.ts +33 -0
- package/dist/client/hydrate-core.d.ts.map +1 -0
- package/dist/client/index.d.ts +9 -4
- package/dist/client/index.d.ts.map +1 -1
- package/dist/client/index.js +2 -661
- package/dist/client/plugin.d.ts +52 -0
- package/dist/client/plugin.d.ts.map +1 -0
- package/dist/client-directives.d.ts +4 -37
- package/dist/client-directives.d.ts.map +1 -1
- package/dist/client-ggDL-Wx2.js +309 -0
- package/dist/client-ggDL-Wx2.js.map +1 -0
- package/dist/directive-ssr-types.d.ts +23 -0
- package/dist/directive-ssr-types.d.ts.map +1 -0
- package/dist/head.d.ts +97 -0
- package/dist/head.d.ts.map +1 -0
- package/dist/index.d.ts +26 -19
- package/dist/index.d.ts.map +1 -1
- package/dist/index.js +5 -1170
- package/dist/index.js.map +1 -1
- package/dist/plugin.d.ts +124 -0
- package/dist/plugin.d.ts.map +1 -0
- package/dist/server/context.d.ts +52 -59
- package/dist/server/context.d.ts.map +1 -1
- package/dist/server/index.d.ts +9 -4
- package/dist/server/index.d.ts.map +1 -1
- package/dist/server/index.js +3 -574
- package/dist/server/render-api.d.ts +64 -0
- package/dist/server/render-api.d.ts.map +1 -0
- package/dist/server/render-core.d.ts +46 -0
- package/dist/server/render-core.d.ts.map +1 -0
- package/dist/server/streaming.d.ts +24 -0
- package/dist/server/streaming.d.ts.map +1 -0
- package/dist/server/types.d.ts +40 -0
- package/dist/server/types.d.ts.map +1 -0
- package/dist/server-UBcHtkm-.js +829 -0
- package/dist/server-UBcHtkm-.js.map +1 -0
- package/dist/ssr.d.ts +38 -0
- package/dist/ssr.d.ts.map +1 -0
- package/dist/types-B4Rf1Xot.js +6 -0
- package/dist/types-B4Rf1Xot.js.map +1 -0
- package/package.json +9 -15
- package/dist/client/hydrate.d.ts +0 -19
- package/dist/client/hydrate.d.ts.map +0 -1
- package/dist/client/index.js.map +0 -1
- package/dist/client/registry.d.ts +0 -46
- package/dist/client/registry.d.ts.map +0 -1
- package/dist/client/types.d.ts +0 -43
- package/dist/client/types.d.ts.map +0 -1
- package/dist/server/index.js.map +0 -1
- package/dist/server/stream.d.ts +0 -34
- package/dist/server/stream.d.ts.map +0 -1
- package/src/jsx.d.ts +0 -62
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Initialize SSR support for all built-in directives.
|
|
3
|
+
*
|
|
4
|
+
* Must be called before any SSR rendering occurs.
|
|
5
|
+
* Safe to call multiple times — only patches once.
|
|
6
|
+
*/
|
|
7
|
+
export declare function initDirectivesForSSR(): void;
|
|
8
|
+
//# sourceMappingURL=builtin-ssr-directives.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtin-ssr-directives.d.ts","sourceRoot":"","sources":["../src/builtin-ssr-directives.ts"],"names":[],"mappings":"AA4BA;;;;;GAKG;AACH,wBAAgB,oBAAoB,IAAI,IAAI,CAI3C"}
|
|
@@ -0,0 +1,32 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Component hydration logic — strategy-agnostic
|
|
3
|
+
*
|
|
4
|
+
* Handles running component setup, creating reactive effects,
|
|
5
|
+
* and restoring server state for hydrated components.
|
|
6
|
+
* Does not depend on islands or any specific SSR strategy.
|
|
7
|
+
*/
|
|
8
|
+
import { VNode } from 'sigx';
|
|
9
|
+
/**
|
|
10
|
+
* Minimal type for component factories used in hydration.
|
|
11
|
+
* Compatible with ComponentFactory from runtime-core.
|
|
12
|
+
*/
|
|
13
|
+
export interface ComponentFactory {
|
|
14
|
+
__setup: Function;
|
|
15
|
+
__name?: string;
|
|
16
|
+
__async?: boolean;
|
|
17
|
+
}
|
|
18
|
+
/**
|
|
19
|
+
* Hydrate a component - run setup and create reactive effect
|
|
20
|
+
*
|
|
21
|
+
* With trailing markers, the structure is: <content><!--$c:id-->
|
|
22
|
+
* - dom points to start of content
|
|
23
|
+
* - trailingMarker (if provided) is the anchor at the end
|
|
24
|
+
*
|
|
25
|
+
* @param vnode - The VNode to hydrate
|
|
26
|
+
* @param dom - The DOM node to start from (content starts here)
|
|
27
|
+
* @param parent - The parent node
|
|
28
|
+
* @param serverState - Optional state captured from server for async components
|
|
29
|
+
* @param trailingMarker - Optional trailing marker comment (the component anchor)
|
|
30
|
+
*/
|
|
31
|
+
export declare function hydrateComponent(vnode: VNode, dom: Node | null, parent: Node, serverState?: Record<string, any>, trailingMarker?: Comment | null): Node | null;
|
|
32
|
+
//# sourceMappingURL=hydrate-component.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrate-component.d.ts","sourceRoot":"","sources":["../../src/client/hydrate-component.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,OAAO,EACH,KAAK,EAiBR,MAAM,MAAM,CAAC;AAQd;;;GAGG;AACH,MAAM,WAAW,gBAAgB;IAC7B,OAAO,EAAE,QAAQ,CAAC;IAClB,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,OAAO,CAAC,EAAE,OAAO,CAAC;CACrB;AAED;;;;;;;;;;;;GAYG;AACH,wBAAgB,gBAAgB,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM,EAAE,IAAI,EAAE,WAAW,CAAC,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,EAAE,cAAc,CAAC,EAAE,OAAO,GAAG,IAAI,GAAG,IAAI,GAAG,IAAI,CAwL9J"}
|
|
@@ -0,0 +1,54 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Hydration context and state management
|
|
3
|
+
*
|
|
4
|
+
* Manages server state restoration, app context tracking,
|
|
5
|
+
* client plugin registration, and the SSR context extension for components.
|
|
6
|
+
*
|
|
7
|
+
* Strategy-specific concerns (island data, async hydration) are handled
|
|
8
|
+
* by plugins registered via `registerClientPlugin()`.
|
|
9
|
+
*/
|
|
10
|
+
import { VNode } from 'sigx';
|
|
11
|
+
import type { AppContext } from 'sigx';
|
|
12
|
+
import type { SSRPlugin } from '../plugin';
|
|
13
|
+
import type { SSRSignalFn } from '../server/types';
|
|
14
|
+
export interface InternalVNode extends VNode {
|
|
15
|
+
_subTree?: VNode;
|
|
16
|
+
_effect?: any;
|
|
17
|
+
_componentProps?: any;
|
|
18
|
+
_slots?: any;
|
|
19
|
+
}
|
|
20
|
+
export type { SSRSignalFn };
|
|
21
|
+
/**
|
|
22
|
+
* Register a client-side SSR plugin.
|
|
23
|
+
* Plugins are called during hydration to intercept component processing,
|
|
24
|
+
* skip default hydration walk, or run post-hydration logic.
|
|
25
|
+
*/
|
|
26
|
+
export declare function registerClientPlugin(plugin: SSRPlugin): void;
|
|
27
|
+
/**
|
|
28
|
+
* Get all registered client-side plugins.
|
|
29
|
+
*/
|
|
30
|
+
export declare function getClientPlugins(): SSRPlugin[];
|
|
31
|
+
/**
|
|
32
|
+
* Clear all registered client plugins (useful for testing).
|
|
33
|
+
*/
|
|
34
|
+
export declare function clearClientPlugins(): void;
|
|
35
|
+
/**
|
|
36
|
+
* Set server state that should be used for the next component mount.
|
|
37
|
+
* Used internally when mounting async components after streaming.
|
|
38
|
+
*/
|
|
39
|
+
export declare function setPendingServerState(state: Record<string, any> | null): void;
|
|
40
|
+
/** Get the current app context for deferred hydration */
|
|
41
|
+
export declare function getCurrentAppContext(): AppContext | null;
|
|
42
|
+
/** Set the current app context during hydration */
|
|
43
|
+
export declare function setCurrentAppContext(ctx: AppContext | null): void;
|
|
44
|
+
/**
|
|
45
|
+
* Creates a signal function that restores state from server-captured values.
|
|
46
|
+
* Used during hydration of async components to avoid re-fetching data.
|
|
47
|
+
* Supports both primitive and object signals.
|
|
48
|
+
*/
|
|
49
|
+
export declare function createRestoringSignal(serverState: Record<string, any>): SSRSignalFn;
|
|
50
|
+
/**
|
|
51
|
+
* Normalize any element to VNode
|
|
52
|
+
*/
|
|
53
|
+
export declare function normalizeElement(element: any): VNode | null;
|
|
54
|
+
//# sourceMappingURL=hydrate-context.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrate-context.d.ts","sourceRoot":"","sources":["../../src/client/hydrate-context.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACH,KAAK,EAIR,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AACvC,OAAO,KAAK,EAAE,SAAS,EAAE,MAAM,WAAW,CAAC;AAC3C,OAAO,KAAK,EAAE,WAAW,EAAE,MAAM,iBAAiB,CAAC;AAKnD,MAAM,WAAW,aAAc,SAAQ,KAAK;IACxC,QAAQ,CAAC,EAAE,KAAK,CAAC;IACjB,OAAO,CAAC,EAAE,GAAG,CAAC;IACd,eAAe,CAAC,EAAE,GAAG,CAAC;IACtB,MAAM,CAAC,EAAE,GAAG,CAAC;CAChB;AAGD,YAAY,EAAE,WAAW,EAAE,CAAC;AAgB5B;;;;GAIG;AACH,wBAAgB,oBAAoB,CAAC,MAAM,EAAE,SAAS,GAAG,IAAI,CAE5D;AAED;;GAEG;AACH,wBAAgB,gBAAgB,IAAI,SAAS,EAAE,CAE9C;AAED;;GAEG;AACH,wBAAgB,kBAAkB,IAAI,IAAI,CAEzC;AAID;;;GAGG;AACH,wBAAgB,qBAAqB,CAAC,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,IAAI,GAAG,IAAI,CAE7E;AAED,yDAAyD;AACzD,wBAAgB,oBAAoB,IAAI,UAAU,GAAG,IAAI,CAExD;AAED,mDAAmD;AACnD,wBAAgB,oBAAoB,CAAC,GAAG,EAAE,UAAU,GAAG,IAAI,GAAG,IAAI,CAEjE;AAID;;;;GAIG;AACH,wBAAgB,qBAAqB,CAAC,WAAW,EAAE,MAAM,CAAC,MAAM,EAAE,GAAG,CAAC,GAAG,WAAW,CA0BnF;AAID;;GAEG;AACH,wBAAgB,gBAAgB,CAAC,OAAO,EAAE,GAAG,GAAG,KAAK,GAAG,IAAI,CAiB3D"}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Core hydration logic — strategy-agnostic
|
|
3
|
+
*
|
|
4
|
+
* Walks existing server-rendered DOM and attaches event handlers,
|
|
5
|
+
* creates reactive effects, and delegates components to the component hydrator.
|
|
6
|
+
*
|
|
7
|
+
* Plugins registered via `registerClientPlugin()` can intercept component
|
|
8
|
+
* hydration (e.g., for deferred/island-based hydration strategies).
|
|
9
|
+
*/
|
|
10
|
+
import { VNode } from 'sigx';
|
|
11
|
+
import type { AppContext } from 'sigx';
|
|
12
|
+
/**
|
|
13
|
+
* Hydrate a server-rendered app.
|
|
14
|
+
*
|
|
15
|
+
* This walks the existing DOM to attach event handlers, runs component
|
|
16
|
+
* setup functions to establish reactivity, then uses runtime-dom for updates.
|
|
17
|
+
*
|
|
18
|
+
* Registered client plugins are called at appropriate points:
|
|
19
|
+
* - `beforeHydrate`: before the DOM walk (return false to skip it entirely)
|
|
20
|
+
* - `hydrateComponent`: for each component (return { next } to handle it)
|
|
21
|
+
* - `afterHydrate`: after the DOM walk completes
|
|
22
|
+
*
|
|
23
|
+
* @param element - The root element/VNode to hydrate
|
|
24
|
+
* @param container - The DOM container with SSR content
|
|
25
|
+
* @param appContext - The app context for DI (provides, etc.)
|
|
26
|
+
*/
|
|
27
|
+
export declare function hydrate(element: any, container: Element, appContext?: AppContext): void;
|
|
28
|
+
/**
|
|
29
|
+
* Hydrate a VNode against existing DOM
|
|
30
|
+
* This only attaches event handlers and refs - no DOM creation
|
|
31
|
+
*/
|
|
32
|
+
export declare function hydrateNode(vnode: VNode, dom: Node | null, parent: Node): Node | null;
|
|
33
|
+
//# sourceMappingURL=hydrate-core.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"hydrate-core.d.ts","sourceRoot":"","sources":["../../src/client/hydrate-core.ts"],"names":[],"mappings":"AAAA;;;;;;;;GAQG;AAEH,OAAO,EACH,KAAK,EAOR,MAAM,MAAM,CAAC;AACd,OAAO,KAAK,EAAE,UAAU,EAAE,MAAM,MAAM,CAAC;AAIvC;;;;;;;;;;;;;;GAcG;AACH,wBAAgB,OAAO,CAAC,OAAO,EAAE,GAAG,EAAE,SAAS,EAAE,OAAO,EAAE,UAAU,CAAC,EAAE,UAAU,GAAG,IAAI,CA6BvF;AAED;;;GAGG;AACH,wBAAgB,WAAW,CAAC,KAAK,EAAE,KAAK,EAAE,GAAG,EAAE,IAAI,GAAG,IAAI,EAAE,MAAM,EAAE,IAAI,GAAG,IAAI,GAAG,IAAI,CA+HrF"}
|
package/dist/client/index.d.ts
CHANGED
|
@@ -1,10 +1,15 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* @sigx/server-renderer/client
|
|
3
3
|
*
|
|
4
|
-
* Client-side hydration
|
|
4
|
+
* Client-side hydration — strategy-agnostic core.
|
|
5
|
+
* Plugin-based extension for islands, resumable SSR, etc.
|
|
5
6
|
*/
|
|
6
7
|
import '../client-directives.js';
|
|
7
|
-
|
|
8
|
-
export {
|
|
9
|
-
export
|
|
8
|
+
import './hydrate-context';
|
|
9
|
+
export { ssrClientPlugin, type HydrateFn } from './plugin.js';
|
|
10
|
+
export { hydrate, hydrateNode } from './hydrate-core';
|
|
11
|
+
export { hydrateComponent } from './hydrate-component';
|
|
12
|
+
export type { ComponentFactory } from './hydrate-component';
|
|
13
|
+
export { registerClientPlugin, getClientPlugins, clearClientPlugins, setPendingServerState, getCurrentAppContext, setCurrentAppContext, createRestoringSignal } from './hydrate-context';
|
|
14
|
+
export type { SSRSignalFn, InternalVNode } from './hydrate-context';
|
|
10
15
|
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA
|
|
1
|
+
{"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../../src/client/index.ts"],"names":[],"mappings":"AAAA;;;;;GAKG;AAGH,OAAO,yBAAyB,CAAC;AAGjC,OAAO,mBAAmB,CAAC;AAG3B,OAAO,EAAE,eAAe,EAAE,KAAK,SAAS,EAAE,MAAM,aAAa,CAAC;AAG9D,OAAO,EAAE,OAAO,EAAE,WAAW,EAAE,MAAM,gBAAgB,CAAC;AAGtD,OAAO,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AACvD,YAAY,EAAE,gBAAgB,EAAE,MAAM,qBAAqB,CAAC;AAG5D,OAAO,EACH,oBAAoB,EACpB,gBAAgB,EAChB,kBAAkB,EAClB,qBAAqB,EACrB,oBAAoB,EACpB,oBAAoB,EACpB,qBAAqB,EACxB,MAAM,mBAAmB,CAAC;AAC3B,YAAY,EAAE,WAAW,EAAE,aAAa,EAAE,MAAM,mBAAmB,CAAC"}
|