@vmz/core 0.1.32 → 0.2.0
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{client-nav.d.ts → browser/client-nav.d.ts} +4 -13
- package/dist/{client-nav.js → browser/client-nav.js} +16 -74
- package/dist/browser/direct-api.types.d.ts +58 -0
- package/dist/browser/direct-api.types.js +4 -0
- package/dist/browser/direct-host-box.d.ts +11 -0
- package/dist/{direct-host-box.js → browser/direct-host-box.js} +2 -18
- package/dist/{dom-core.d.ts → browser/dom-core.d.ts} +64 -220
- package/dist/browser/dom-core.js +2453 -0
- package/dist/browser/dom-core.types.d.ts +138 -0
- package/dist/browser/dom-core.types.js +4 -0
- package/dist/{position-context.js → browser/position-context.js} +1 -1
- package/dist/browser/unknown-component.d.ts +14 -0
- package/dist/{unknown-component.js → browser/unknown-component.js} +4 -28
- package/dist/{dom.browser.d.ts → faces/dom.browser.d.ts} +2 -2
- package/dist/{dom.browser.js → faces/dom.browser.js} +2 -3
- package/dist/faces/dom.client.d.ts +4 -0
- package/dist/faces/dom.client.js +4 -0
- package/dist/faces/dom.d.ts +6 -0
- package/dist/faces/dom.js +6 -0
- package/dist/{http.d.ts → faces/http.d.ts} +1 -1
- package/dist/{http.js → faces/http.js} +1 -2
- package/dist/{server.d.ts → faces/server.d.ts} +8 -25
- package/dist/{server.js → faces/server.js} +25 -155
- package/dist/{vmz-dom.d.ts → faces/vmz-dom.d.ts} +1 -1
- package/dist/{vmz-dom.js → faces/vmz-dom.js} +1 -2
- package/dist/{vmz-runtime.d.ts → faces/vmz-runtime.d.ts} +1 -1
- package/dist/{vmz-runtime.js → faces/vmz-runtime.js} +1 -2
- package/dist/host/deployment-registry.d.ts +16 -0
- package/dist/{deployment-registry.js → host/deployment-registry.js} +1 -68
- package/dist/host/list-client-components.d.ts +14 -0
- package/dist/{list-client-components.js → host/list-client-components.js} +0 -37
- package/dist/{localize-body-links.js → host/localize-body-links.js} +0 -1
- package/dist/host/native-addon.d.ts +6 -0
- package/dist/{native-addon.js → host/native-addon.js} +0 -20
- package/dist/host/render-host.d.ts +20 -0
- package/dist/{render-host.js → host/render-host.js} +0 -16
- package/dist/{serve-host.d.ts → host/serve-host.d.ts} +3 -3
- package/dist/{serve-host.mjs → host/serve-host.mjs} +45 -168
- package/dist/shared/host.types.d.ts +67 -0
- package/dist/shared/host.types.js +4 -0
- package/dist/shared/server.types.d.ts +39 -0
- package/dist/shared/server.types.js +4 -0
- package/dist/{dom-ssr.d.ts → ssr/dom-ssr.d.ts} +8 -37
- package/dist/{dom-ssr.js → ssr/dom-ssr.js} +159 -217
- package/package.json +34 -34
- package/dist/deployment-registry.d.ts +0 -70
- package/dist/direct-host-box.d.ts +0 -26
- package/dist/dom-core.js +0 -4815
- package/dist/dom.client.d.ts +0 -4
- package/dist/dom.client.js +0 -5
- package/dist/dom.d.ts +0 -6
- package/dist/dom.js +0 -7
- package/dist/list-client-components.d.ts +0 -62
- package/dist/native-addon.d.ts +0 -12
- package/dist/render-host.d.ts +0 -32
- package/dist/unknown-component.d.ts +0 -40
- /package/dist/{position-context.d.ts → browser/position-context.d.ts} +0 -0
- /package/dist/{index.d.ts → faces/index.d.ts} +0 -0
- /package/dist/{index.js → faces/index.js} +0 -0
- /package/dist/{localize-body-links.d.ts → host/localize-body-links.d.ts} +0 -0
- /package/dist/{route-layout-chain.d.ts → host/route-layout-chain.d.ts} +0 -0
- /package/dist/{route-layout-chain.js → host/route-layout-chain.js} +0 -0
|
@@ -0,0 +1,138 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Internal types for `@vmz/core` browser DOM runtime (`dom-core.ts`).
|
|
3
|
+
*/
|
|
4
|
+
import type { DirectApi, DirectInstance, PatchFn, BindingId } from './direct-api.types.js';
|
|
5
|
+
export type { DirectApi, DirectInstance, PatchFn, BindingId };
|
|
6
|
+
export type ComponentCtor = (new (props?: object) => DirectInstance) & {
|
|
7
|
+
__vmzDirect?: boolean;
|
|
8
|
+
__vmzCreate?: (this: DirectInstance, api: DirectApi) => Node;
|
|
9
|
+
__vmzSerialize?: (this: DirectInstance, api: DirectApi) => unknown;
|
|
10
|
+
__vmzPlan?: unknown;
|
|
11
|
+
__vmzHostBox?: string;
|
|
12
|
+
__vmzTag?: string;
|
|
13
|
+
__vmzState?: string[];
|
|
14
|
+
__vmzProps?: string[];
|
|
15
|
+
__vmzWBInstalled?: boolean;
|
|
16
|
+
__vmzCtorAppliesProps?: boolean;
|
|
17
|
+
name?: string;
|
|
18
|
+
[key: string]: unknown;
|
|
19
|
+
};
|
|
20
|
+
export type VmzDomElement = Element & {
|
|
21
|
+
__vmzEvt?: Record<string, EventListener>;
|
|
22
|
+
__vmzInst?: DirectInstance;
|
|
23
|
+
__vmzPropBindSeq?: number;
|
|
24
|
+
__vmzDispose?: (() => void) | null;
|
|
25
|
+
value?: string;
|
|
26
|
+
options?: HTMLOptionsCollection;
|
|
27
|
+
};
|
|
28
|
+
export type VmzDomNode = Node & {
|
|
29
|
+
__vmzDispose?: (() => void) | null;
|
|
30
|
+
__vmzInst?: DirectInstance;
|
|
31
|
+
};
|
|
32
|
+
export type VmzContainer = Element & {
|
|
33
|
+
__vmzInst?: DirectInstance | null;
|
|
34
|
+
};
|
|
35
|
+
export type ReactiveOwner = {
|
|
36
|
+
report: (segs: string[] | null) => void;
|
|
37
|
+
baseSegs: string[];
|
|
38
|
+
inst?: DirectInstance | null;
|
|
39
|
+
};
|
|
40
|
+
export type ReactiveEntry = {
|
|
41
|
+
proxy: object;
|
|
42
|
+
owners: ReactiveOwner[];
|
|
43
|
+
kind: 'barrier' | 'proxy';
|
|
44
|
+
};
|
|
45
|
+
export type DirtyNotice = {
|
|
46
|
+
type: 'replace';
|
|
47
|
+
root: string;
|
|
48
|
+
} | {
|
|
49
|
+
type: 'path';
|
|
50
|
+
root: string;
|
|
51
|
+
segs: string[];
|
|
52
|
+
};
|
|
53
|
+
export type TraceEvent = {
|
|
54
|
+
kind: string;
|
|
55
|
+
stableId: {
|
|
56
|
+
kind: string;
|
|
57
|
+
id: string;
|
|
58
|
+
};
|
|
59
|
+
dep?: string;
|
|
60
|
+
t?: number;
|
|
61
|
+
chunkId?: string | null;
|
|
62
|
+
};
|
|
63
|
+
export type PrecisionState = {
|
|
64
|
+
enabled: boolean;
|
|
65
|
+
writes: number;
|
|
66
|
+
bindingEvals: number;
|
|
67
|
+
patchExecs: number;
|
|
68
|
+
domCreates: number;
|
|
69
|
+
domMoves: number;
|
|
70
|
+
domRemoves: number;
|
|
71
|
+
componentExecs: number;
|
|
72
|
+
writesByRoot: Record<string, number>;
|
|
73
|
+
bindingEvalsByDep: Record<string, number>;
|
|
74
|
+
patchesByDep: Record<string, number>;
|
|
75
|
+
bindingEvalsByBinding: Record<string, number>;
|
|
76
|
+
patchesByBinding: Record<string, number>;
|
|
77
|
+
};
|
|
78
|
+
export type TraceBuffer = {
|
|
79
|
+
enabled: boolean;
|
|
80
|
+
events: TraceEvent[];
|
|
81
|
+
};
|
|
82
|
+
export type ResumeAdoptCtx = {
|
|
83
|
+
el: (tag: string) => Element;
|
|
84
|
+
text: (value?: unknown) => Text;
|
|
85
|
+
componentHost?: (name: string) => HTMLElement | null;
|
|
86
|
+
enter?: (node: Element) => boolean;
|
|
87
|
+
leave?: () => void;
|
|
88
|
+
scopeDepth?: () => number;
|
|
89
|
+
rewindScope?: (depth: number) => void;
|
|
90
|
+
beginBranchScope?: () => () => void;
|
|
91
|
+
_enterBalance?: number;
|
|
92
|
+
inst?: DirectInstance;
|
|
93
|
+
};
|
|
94
|
+
export type EachCtx = {
|
|
95
|
+
noteItemBind: (bindingId: BindingId, deps: string[], fn: PatchFn) => void;
|
|
96
|
+
needDelegate: (type: string) => void;
|
|
97
|
+
inst?: DirectInstance;
|
|
98
|
+
};
|
|
99
|
+
export type TaskStatus = 'pending' | 'success' | 'error' | 'cancelled';
|
|
100
|
+
export type TaskEntry = {
|
|
101
|
+
generation: number;
|
|
102
|
+
controller: AbortController | {
|
|
103
|
+
signal: {
|
|
104
|
+
aborted: boolean;
|
|
105
|
+
};
|
|
106
|
+
abort: () => void;
|
|
107
|
+
};
|
|
108
|
+
status: TaskStatus;
|
|
109
|
+
result?: unknown;
|
|
110
|
+
error?: unknown;
|
|
111
|
+
promise?: Promise<unknown>;
|
|
112
|
+
};
|
|
113
|
+
export type WbSharedEntry = {
|
|
114
|
+
owners: ReactiveOwner[];
|
|
115
|
+
};
|
|
116
|
+
export type WbDiagnostic = {
|
|
117
|
+
kind: string;
|
|
118
|
+
message: string;
|
|
119
|
+
};
|
|
120
|
+
export type LogicalAssignKind = '||' | '&&' | '??';
|
|
121
|
+
export type LeafDirty = {
|
|
122
|
+
root: string;
|
|
123
|
+
field: string;
|
|
124
|
+
idxs: number[];
|
|
125
|
+
};
|
|
126
|
+
export type UnknownComponentErrorDetail = {
|
|
127
|
+
kind: string;
|
|
128
|
+
component: string;
|
|
129
|
+
via: string;
|
|
130
|
+
};
|
|
131
|
+
export type SerializeTreeNode = {
|
|
132
|
+
__kind: 'el' | 'text';
|
|
133
|
+
tag?: string;
|
|
134
|
+
attrs?: Record<string, string>;
|
|
135
|
+
children?: SerializeTreeNode[];
|
|
136
|
+
value?: string;
|
|
137
|
+
appendChild?: (c: SerializeTreeNode | null | undefined) => void;
|
|
138
|
+
};
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
* PositionContext backed by compiler OffsetIndex via N-API (`offsetIndexLineCol`).
|
|
3
3
|
* `@vmz/diagnostic` stays free of a native dependency — hosts wire this helper.
|
|
4
4
|
*/
|
|
5
|
-
import { requireNativeFn } from '
|
|
5
|
+
import { requireNativeFn } from '../host/native-addon.js';
|
|
6
6
|
/**
|
|
7
7
|
* Build a diagnostic PositionContext for `sourceText` using the native OffsetIndex.
|
|
8
8
|
*/
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Unknown Direct component resilience (`ssr-unknown-component-error-node`).
|
|
3
|
+
* Leaf failure → subtree error node; do not throw out of document SSR.
|
|
4
|
+
*/
|
|
5
|
+
import type { SerializeTreeNode } from './dom-core.types.js';
|
|
6
|
+
export declare const UNKNOWN_COMPONENT_ERROR = "unknown-component";
|
|
7
|
+
/** Append a leaf diagnostic for tooling (does not replace the error node). */
|
|
8
|
+
export declare function noteUnknownComponent(name: string, via?: string): void;
|
|
9
|
+
/** SSR serialize-tree error node (keeps document HTTP 200). */
|
|
10
|
+
export declare function serializeUnknownComponentNode(name: string): SerializeTreeNode;
|
|
11
|
+
/** Live DOM error host (client create / schedule). */
|
|
12
|
+
export declare function createUnknownComponentElement(name: string, via?: string): HTMLElement;
|
|
13
|
+
/** Mark an existing island host as unknown (resume / EventEntry). */
|
|
14
|
+
export declare function markUnknownComponentHost(el: HTMLElement, name: string, via?: string): void;
|
|
@@ -2,11 +2,7 @@
|
|
|
2
2
|
* Unknown Direct component resilience (`ssr-unknown-component-error-node`).
|
|
3
3
|
* Leaf failure → subtree error node; do not throw out of document SSR.
|
|
4
4
|
*/
|
|
5
|
-
/** @type {string} */
|
|
6
5
|
export const UNKNOWN_COMPONENT_ERROR = 'unknown-component';
|
|
7
|
-
/**
|
|
8
|
-
* @returns {boolean}
|
|
9
|
-
*/
|
|
10
6
|
function isDevSurface() {
|
|
11
7
|
try {
|
|
12
8
|
if (typeof process !== 'undefined' && process.env) {
|
|
@@ -21,11 +17,7 @@ function isDevSurface() {
|
|
|
21
17
|
}
|
|
22
18
|
return false;
|
|
23
19
|
}
|
|
24
|
-
/**
|
|
25
|
-
* Append a leaf diagnostic for tooling (does not replace the error node).
|
|
26
|
-
* @param {string} name
|
|
27
|
-
* @param {string} [via]
|
|
28
|
-
*/
|
|
20
|
+
/** Append a leaf diagnostic for tooling (does not replace the error node). */
|
|
29
21
|
export function noteUnknownComponent(name, via = 'ssr') {
|
|
30
22
|
const detail = { kind: UNKNOWN_COMPONENT_ERROR, component: String(name || ''), via };
|
|
31
23
|
try {
|
|
@@ -43,7 +35,6 @@ export function noteUnknownComponent(name, via = 'ssr') {
|
|
|
43
35
|
if (!Array.isArray(g.__VMZ_COMPONENT_ERRORS__)) {
|
|
44
36
|
g.__VMZ_COMPONENT_ERRORS__ = [];
|
|
45
37
|
}
|
|
46
|
-
/** @type {unknown[]} */
|
|
47
38
|
const bag = g.__VMZ_COMPONENT_ERRORS__;
|
|
48
39
|
bag.push(detail);
|
|
49
40
|
}
|
|
@@ -51,18 +42,13 @@ export function noteUnknownComponent(name, via = 'ssr') {
|
|
|
51
42
|
/* ignore */
|
|
52
43
|
}
|
|
53
44
|
}
|
|
54
|
-
/**
|
|
55
|
-
* SSR serialize-tree error node (keeps document HTTP 200).
|
|
56
|
-
* @param {string} name
|
|
57
|
-
*/
|
|
45
|
+
/** SSR serialize-tree error node (keeps document HTTP 200). */
|
|
58
46
|
export function serializeUnknownComponentNode(name) {
|
|
59
47
|
noteUnknownComponent(name, 'ssr');
|
|
60
|
-
/** @type {Record<string, string>} */
|
|
61
48
|
const attrs = {
|
|
62
49
|
'data-vmz-error': UNKNOWN_COMPONENT_ERROR,
|
|
63
50
|
'data-vmz-component': String(name || ''),
|
|
64
51
|
};
|
|
65
|
-
/** @type {any[]} */
|
|
66
52
|
const children = [];
|
|
67
53
|
if (isDevSurface()) {
|
|
68
54
|
children.push({
|
|
@@ -81,12 +67,7 @@ export function serializeUnknownComponentNode(name) {
|
|
|
81
67
|
},
|
|
82
68
|
};
|
|
83
69
|
}
|
|
84
|
-
/**
|
|
85
|
-
* Live DOM error host (client create / schedule).
|
|
86
|
-
* @param {string} name
|
|
87
|
-
* @param {string} [via]
|
|
88
|
-
* @returns {HTMLElement}
|
|
89
|
-
*/
|
|
70
|
+
/** Live DOM error host (client create / schedule). */
|
|
90
71
|
export function createUnknownComponentElement(name, via = 'client') {
|
|
91
72
|
noteUnknownComponent(name, via);
|
|
92
73
|
const host = document.createElement('div');
|
|
@@ -97,12 +78,7 @@ export function createUnknownComponentElement(name, via = 'client') {
|
|
|
97
78
|
}
|
|
98
79
|
return host;
|
|
99
80
|
}
|
|
100
|
-
/**
|
|
101
|
-
* Mark an existing island host as unknown (resume / EventEntry).
|
|
102
|
-
* @param {HTMLElement} el
|
|
103
|
-
* @param {string} name
|
|
104
|
-
* @param {string} [via]
|
|
105
|
-
*/
|
|
81
|
+
/** Mark an existing island host as unknown (resume / EventEntry). */
|
|
106
82
|
export function markUnknownComponentHost(el, name, via = 'resume') {
|
|
107
83
|
if (!el)
|
|
108
84
|
return;
|
|
@@ -3,5 +3,5 @@
|
|
|
3
3
|
* Does NOT re-export Node SSR `renderToString` / `renderToStream`.
|
|
4
4
|
* Full barrel remains `@vmz/core/dom` (`dom.js` / dist `vmz-dom.js`) for Node host.
|
|
5
5
|
*/
|
|
6
|
-
export * from '
|
|
7
|
-
export { attachEventEntries, hydrate, hydrateIslands, hydrateRoute, hydrateRoutePage, resume, resumeIslands, } from '
|
|
6
|
+
export * from '../browser/dom-core.js';
|
|
7
|
+
export { attachEventEntries, hydrate, hydrateIslands, hydrateRoute, hydrateRoutePage, resume, resumeIslands, } from '../ssr/dom-ssr.js';
|
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
// @ts-nocheck
|
|
2
1
|
/**
|
|
3
2
|
* Browser delivery face (0.1.31): DOM core + hydrate/resume/route attach.
|
|
4
3
|
* Does NOT re-export Node SSR `renderToString` / `renderToStream`.
|
|
5
4
|
* Full barrel remains `@vmz/core/dom` (`dom.js` / dist `vmz-dom.js`) for Node host.
|
|
6
5
|
*/
|
|
7
|
-
export * from '
|
|
8
|
-
export { attachEventEntries, hydrate, hydrateIslands, hydrateRoute, hydrateRoutePage, resume, resumeIslands, } from '
|
|
6
|
+
export * from '../browser/dom-core.js';
|
|
7
|
+
export { attachEventEntries, hydrate, hydrateIslands, hydrateRoute, hydrateRoutePage, resume, resumeIslands, } from '../ssr/dom-ssr.js';
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
/** Compile-time HTTP decorators
|
|
1
|
+
/** Compile-time HTTP decorators �?erased from server JS emit; kept for authoring. */
|
|
2
2
|
export declare function Get(path: any): (_target: any, _key: any, descriptor: any) => any;
|
|
3
3
|
export declare function Post(path: any): (_target: any, _key: any, descriptor: any) => any;
|
|
4
4
|
export declare function Put(path: any): (_target: any, _key: any, descriptor: any) => any;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
|
-
|
|
2
|
-
/** Compile-time HTTP decorators — erased from server JS emit; kept for authoring. */
|
|
1
|
+
/** Compile-time HTTP decorators �?erased from server JS emit; kept for authoring. */
|
|
3
2
|
export function Get(path) {
|
|
4
3
|
return function GetDecorator(_target, _key, descriptor) {
|
|
5
4
|
return descriptor;
|
|
@@ -1,46 +1,29 @@
|
|
|
1
1
|
/**
|
|
2
2
|
* Minimal VMZ runtime — `#server` invoke + RPC/REST HTTP + optional static/SSR.
|
|
3
3
|
*
|
|
4
|
-
*
|
|
5
4
|
* Browser-safe: no static `node:*` imports. Node builtins are loaded only inside
|
|
6
5
|
* Node/SSR request handlers so client bundles can `import { callServer }`.
|
|
7
6
|
*/
|
|
7
|
+
import type { Route, ServerModuleResolver } from '../shared/server.types.js';
|
|
8
8
|
/**
|
|
9
|
-
* Map `#server/foo`
|
|
10
|
-
* Only set this in Node/SSR hosts
|
|
11
|
-
*/
|
|
12
|
-
export declare function setServerModuleResolver(fn: any): void;
|
|
13
|
-
/** @param {Route[]} next */
|
|
14
|
-
export declare function setRoutes(next: any): void;
|
|
15
|
-
/**
|
|
16
|
-
* @param {string} moduleId
|
|
17
|
-
* @param {string} method
|
|
18
|
-
* @param {unknown[]} args
|
|
19
|
-
*/
|
|
20
|
-
export declare function callServer(moduleId: any, method: any, args?: any[]): Promise<any>;
|
|
21
|
-
/**
|
|
22
|
-
* @param {RpcRequest} body
|
|
9
|
+
* Map `#server/foo` �?filesystem / URL the host can `import`.
|
|
10
|
+
* Only set this in Node/SSR hosts �?browser bundles must omit it so RPC goes HTTP.
|
|
23
11
|
*/
|
|
12
|
+
export declare function setServerModuleResolver(fn: ServerModuleResolver): void;
|
|
13
|
+
export declare function setRoutes(next: Route[]): void;
|
|
14
|
+
export declare function callServer(moduleId: string, method: string, args?: unknown[]): Promise<unknown>;
|
|
24
15
|
export declare function handleRpc(body: any): Promise<any>;
|
|
25
16
|
/**
|
|
26
17
|
* Match REST route from `vmz-routes.json`.
|
|
27
|
-
* @param {string} verb
|
|
28
|
-
* @param {string} pathname
|
|
29
|
-
* @returns {Route | null}
|
|
30
18
|
*/
|
|
31
|
-
export declare function matchRoute(verb: any, pathname: any):
|
|
19
|
+
export declare function matchRoute(verb: any, pathname: any): Route;
|
|
32
20
|
/**
|
|
33
21
|
* Web Standards Fetch entry for ServerArtifact hosts (Node adapter, worker/edge parity).
|
|
34
22
|
* Handles RPC + public ServerRoute only; static/SSR stay on Node host options.
|
|
35
|
-
* @param {Request} request
|
|
36
|
-
* @returns {Promise<Response>}
|
|
37
23
|
*/
|
|
38
24
|
export declare function handleFetchRequest(request: any): Promise<Response>;
|
|
39
25
|
/**
|
|
40
26
|
* Node `http.createServer` listener: RPC + REST + optional static / SSR index.
|
|
41
27
|
* RPC/REST go through {@link handleFetchRequest} so Node and Fetch hosts share one core.
|
|
42
|
-
* @param {import('node:http').IncomingMessage} req
|
|
43
|
-
* @param {import('node:http').ServerResponse} res
|
|
44
|
-
* @param {NodeRequestOptions} [opts]
|
|
45
28
|
*/
|
|
46
|
-
export declare function handleNodeRequest(req: any, res: any, opts?:
|
|
29
|
+
export declare function handleNodeRequest(req: any, res: any, opts?: any): Promise<void>;
|