@askrjs/askr 0.0.36 → 0.0.38
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 +17 -9
- package/dist/bench/components/benchmark-table.js +2 -2
- package/dist/bench/components/benchmark-table.js.map +1 -1
- package/dist/benchmark.js +3 -3
- package/dist/boot/index.d.ts +1 -7
- package/dist/boot/index.d.ts.map +1 -1
- package/dist/boot/index.js +22 -13
- package/dist/boot/index.js.map +1 -1
- package/dist/components/index.d.ts +2 -0
- package/dist/components/index.js +2 -0
- package/dist/components/link.d.ts +4 -5
- package/dist/components/link.d.ts.map +1 -1
- package/dist/components/link.js +2 -1
- package/dist/components/link.js.map +1 -1
- package/dist/foundations/icon/icon.d.ts.map +1 -1
- package/dist/foundations/icon/icon.js.map +1 -1
- package/dist/foundations/icon/icon.types.d.ts +2 -1
- package/dist/foundations/icon/icon.types.d.ts.map +1 -1
- package/dist/foundations/icon/index.d.ts +3 -0
- package/dist/foundations/icon/index.js +2 -0
- package/dist/foundations/index.d.ts +1 -18
- package/dist/foundations/index.js +2 -18
- package/dist/foundations/interactions/index.d.ts +7 -0
- package/dist/foundations/interactions/index.js +7 -0
- package/dist/foundations/interactions/interaction-policy.js +2 -2
- package/dist/foundations/state/index.d.ts +2 -0
- package/dist/foundations/state/index.js +2 -0
- package/dist/foundations/structures/index.d.ts +8 -0
- package/dist/foundations/structures/index.js +7 -0
- package/dist/foundations/utilities/index.d.ts +7 -0
- package/dist/foundations/utilities/index.js +6 -0
- package/dist/index.d.ts +3 -14
- package/dist/index.js +2 -14
- package/dist/index.js.map +1 -1
- package/dist/jsx-dev-runtime.d.ts +1 -1
- package/dist/jsx-dev-runtime.js.map +1 -1
- package/dist/jsx-runtime.d.ts +1 -1
- package/dist/jsx-runtime.js.map +1 -1
- package/dist/renderer/dom.js +26 -366
- package/dist/renderer/dom.js.map +1 -1
- package/dist/renderer/evaluate.js.map +1 -1
- package/dist/renderer/fastpath.js +20 -18
- package/dist/renderer/fastpath.js.map +1 -1
- package/dist/renderer/for-commit.js +486 -0
- package/dist/renderer/for-commit.js.map +1 -0
- package/dist/renderer/index.js.map +1 -1
- package/dist/renderer/keyed.js +84 -23
- package/dist/renderer/keyed.js.map +1 -1
- package/dist/renderer/reconcile.js +11 -18
- package/dist/renderer/reconcile.js.map +1 -1
- package/dist/renderer/utils.js +5 -1
- package/dist/renderer/utils.js.map +1 -1
- package/dist/resources/index.d.ts +1 -2
- package/dist/resources/index.js +1 -2
- package/dist/router/route.js +1 -1
- package/dist/runtime/for.d.ts.map +1 -1
- package/dist/runtime/for.js +33 -21
- package/dist/runtime/for.js.map +1 -1
- package/dist/runtime/operations.js +1 -1
- package/dist/runtime/selector.d.ts.map +1 -1
- package/dist/runtime/selector.js +180 -103
- package/dist/runtime/selector.js.map +1 -1
- package/dist/runtime/state.d.ts +12 -4
- package/dist/runtime/state.d.ts.map +1 -1
- package/dist/runtime/state.js +1 -1
- package/dist/runtime/state.js.map +1 -1
- package/dist/ssg/index.d.ts +1 -6
- package/dist/ssg/index.js +1 -6
- package/dist/ssr/context.d.ts +2 -1
- package/dist/ssr/context.d.ts.map +1 -1
- package/dist/ssr/context.js +28 -11
- package/dist/ssr/context.js.map +1 -1
- package/dist/ssr/index.d.ts +2 -31
- package/dist/ssr/index.d.ts.map +1 -1
- package/dist/ssr/index.js +4 -46
- package/dist/ssr/index.js.map +1 -1
- package/dist/ssr/render-keys.js +1 -12
- package/dist/ssr/render-keys.js.map +1 -1
- package/dist/ssr/verify-hydration.js +25 -0
- package/dist/ssr/verify-hydration.js.map +1 -0
- package/package.json +39 -16
- package/dist/_virtual/_rolldown/runtime.js +0 -7
- package/dist/foundations/core.d.ts +0 -15
- package/dist/foundations/core.js +0 -13
- package/dist/foundations/structures.d.ts +0 -7
- package/dist/foundations/structures.js +0 -6
- package/dist/ssg/batch-render.d.ts +0 -16
- package/dist/ssg/batch-render.d.ts.map +0 -1
- package/dist/ssg/generate-metadata.d.ts +0 -24
- package/dist/ssg/generate-metadata.d.ts.map +0 -1
- package/dist/ssg/resolve-ssg-data.d.ts +0 -23
- package/dist/ssg/resolve-ssg-data.d.ts.map +0 -1
- package/dist/ssg/route-utils.d.ts +0 -16
- package/dist/ssg/route-utils.d.ts.map +0 -1
- package/dist/ssg/write-static-files.d.ts +0 -15
- package/dist/ssg/write-static-files.d.ts.map +0 -1
- package/dist/ssr/render-keys.d.ts +0 -37
- package/dist/ssr/render-keys.d.ts.map +0 -1
- package/dist/ssr/stream-render.js +0 -88
- package/dist/ssr/stream-render.js.map +0 -1
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@askrjs/askr",
|
|
3
|
-
"version": "0.0.
|
|
3
|
+
"version": "0.0.38",
|
|
4
4
|
"description": "Actor-backed deterministic UI framework",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"askr",
|
|
@@ -40,6 +40,10 @@
|
|
|
40
40
|
"import": "./dist/boot/index.js",
|
|
41
41
|
"types": "./dist/boot/index.d.ts"
|
|
42
42
|
},
|
|
43
|
+
"./components": {
|
|
44
|
+
"import": "./dist/components/index.js",
|
|
45
|
+
"types": "./dist/components/index.d.ts"
|
|
46
|
+
},
|
|
43
47
|
"./control": {
|
|
44
48
|
"import": "./dist/control/index.js",
|
|
45
49
|
"types": "./dist/control/index.d.ts"
|
|
@@ -48,6 +52,26 @@
|
|
|
48
52
|
"import": "./dist/foundations/index.js",
|
|
49
53
|
"types": "./dist/foundations/index.d.ts"
|
|
50
54
|
},
|
|
55
|
+
"./foundations/utilities": {
|
|
56
|
+
"import": "./dist/foundations/utilities/index.js",
|
|
57
|
+
"types": "./dist/foundations/utilities/index.d.ts"
|
|
58
|
+
},
|
|
59
|
+
"./foundations/interactions": {
|
|
60
|
+
"import": "./dist/foundations/interactions/index.js",
|
|
61
|
+
"types": "./dist/foundations/interactions/index.d.ts"
|
|
62
|
+
},
|
|
63
|
+
"./foundations/state": {
|
|
64
|
+
"import": "./dist/foundations/state/index.js",
|
|
65
|
+
"types": "./dist/foundations/state/index.d.ts"
|
|
66
|
+
},
|
|
67
|
+
"./foundations/structures": {
|
|
68
|
+
"import": "./dist/foundations/structures/index.js",
|
|
69
|
+
"types": "./dist/foundations/structures/index.d.ts"
|
|
70
|
+
},
|
|
71
|
+
"./foundations/icon": {
|
|
72
|
+
"import": "./dist/foundations/icon/index.js",
|
|
73
|
+
"types": "./dist/foundations/icon/index.d.ts"
|
|
74
|
+
},
|
|
51
75
|
"./resources": {
|
|
52
76
|
"import": "./dist/resources/index.js",
|
|
53
77
|
"types": "./dist/resources/index.d.ts"
|
|
@@ -85,27 +109,26 @@
|
|
|
85
109
|
"access": "public"
|
|
86
110
|
},
|
|
87
111
|
"scripts": {
|
|
112
|
+
"clean": "npx rimraf node_modules dist",
|
|
88
113
|
"build": "vp pack",
|
|
89
114
|
"dev": "vp dev",
|
|
90
115
|
"fmt": "vp fmt .",
|
|
91
|
-
"lint": "vp lint src tests test-utils
|
|
92
|
-
"test": "npm run test:unit && npm run test:
|
|
93
|
-
"test:
|
|
94
|
-
"test:
|
|
95
|
-
"test:
|
|
96
|
-
"test:jsdom": "vp test run -c vitest.jsdom.config.ts",
|
|
116
|
+
"lint": "vp lint src tests test-utils benches",
|
|
117
|
+
"test": "npm run test:unit && npm run test:checks && npm run test:jsdom && npm run test:browser",
|
|
118
|
+
"test:browser": "vp test run -c vitest.test.browser.config.ts tests/browser",
|
|
119
|
+
"test:checks": "vp test run -c vitest.test.checks.config.ts",
|
|
120
|
+
"test:jsdom": "vp test run -c vitest.test.jsdom.config.ts",
|
|
97
121
|
"test:types": "vp pack && tsd",
|
|
98
|
-
"test:unit": "vp test run -c vitest.unit.config.ts",
|
|
99
|
-
"bench": "
|
|
100
|
-
"bench:tier1": "
|
|
101
|
-
"bench:tier2": "vp test bench
|
|
102
|
-
"bench:tier3": "vp test bench
|
|
103
|
-
"bench:tier4": "vp test bench
|
|
122
|
+
"test:unit": "vp test run -c vitest.test.unit.config.ts",
|
|
123
|
+
"bench": "npm run bench:tier1 && npm run bench:tier2 && npm run bench:tier3 && npm run bench:tier4",
|
|
124
|
+
"bench:tier1": "cross-env NODE_ENV=production vp test bench --run --reporter=default --config vitest.bench.tier1.config.ts",
|
|
125
|
+
"bench:tier2": "cross-env NODE_ENV=production vp test bench --run --reporter=default --config vitest.bench.tier2.config.ts",
|
|
126
|
+
"bench:tier3": "cross-env NODE_ENV=production vp test bench --run --reporter=default --config vitest.bench.tier3.config.ts",
|
|
127
|
+
"bench:tier4": "cross-env NODE_ENV=production vp test bench --run --reporter=default --config vitest.bench.tier4.config.ts"
|
|
104
128
|
},
|
|
105
129
|
"devDependencies": {
|
|
106
|
-
"@
|
|
107
|
-
"
|
|
108
|
-
"@types/node": "^25.7.0",
|
|
130
|
+
"@types/node": "^25.8.0",
|
|
131
|
+
"cross-env": "^10.1.0",
|
|
109
132
|
"jsdom": "^29.1.1",
|
|
110
133
|
"playwright": "^1.60.0",
|
|
111
134
|
"tsd": "^0.33.0",
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
//#region \0rolldown/runtime.js
|
|
2
|
-
var __require = /* @__PURE__ */ ((x) => typeof require !== "undefined" ? require : typeof Proxy !== "undefined" ? new Proxy(x, { get: (a, b) => (typeof require !== "undefined" ? require : a)[b] }) : x)(function(x) {
|
|
3
|
-
if (typeof require !== "undefined") return require.apply(this, arguments);
|
|
4
|
-
throw Error("Calling `require` for \"" + x + "\" in an environment that doesn't expose the `require` function. See https://rolldown.rs/in-depth/bundling-cjs#require-external-modules for more details.");
|
|
5
|
-
});
|
|
6
|
-
//#endregion
|
|
7
|
-
export { __require };
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { ComposeHandlersOptions, composeHandlers } from "./utilities/compose-handlers.js";
|
|
2
|
-
import { mergeProps } from "./utilities/merge-props.js";
|
|
3
|
-
import { ariaDisabled, ariaExpanded, ariaSelected } from "./utilities/aria.js";
|
|
4
|
-
import { Ref, composeRefs, setRef } from "./utilities/compose-ref.js";
|
|
5
|
-
import { FormatIdOptions, formatId } from "./utilities/use-id.js";
|
|
6
|
-
import { DefaultPreventable, FocusLikeEvent, KeyboardLikeEvent, PointerLikeEvent, PropagationStoppable } from "./utilities/event-types.js";
|
|
7
|
-
import { PressableOptions, PressableResult, pressable } from "./interactions/pressable.js";
|
|
8
|
-
import { DismissableOptions, dismissable } from "./interactions/dismissable.js";
|
|
9
|
-
import { FocusableOptions, FocusableResult, focusable } from "./interactions/focusable.js";
|
|
10
|
-
import { HoverableOptions, HoverableResult, hoverable } from "./interactions/hoverable.js";
|
|
11
|
-
import { Orientation, RovingFocusOptions, RovingFocusResult, rovingFocus } from "./interactions/roving-focus.js";
|
|
12
|
-
import { InteractionPolicyInput, applyInteractionPolicy, mergeInteractionProps } from "./interactions/interaction-policy.js";
|
|
13
|
-
import { ControllableState, controllableState, isControlled, makeControllable, resolveControllable } from "./state/controllable.js";
|
|
14
|
-
import { IconOwnProps, IconProps, IconSizeToken, IconStyleObject } from "./icon/icon.types.js";
|
|
15
|
-
import { IconBase, getIconContractProps, isIconSizeToken, joinIconStyle, normalizeIconSizeValue, resolveIconSizeVariable, resolveIconStrokeWidthVariable, serializeIconStyle } from "./icon/icon.js";
|
package/dist/foundations/core.js
DELETED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
import "./utilities/aria.js";
|
|
2
|
-
import "./interactions/pressable.js";
|
|
3
|
-
import "./utilities/compose-handlers.js";
|
|
4
|
-
import "./utilities/compose-ref.js";
|
|
5
|
-
import "./utilities/merge-props.js";
|
|
6
|
-
import "./interactions/interaction-policy.js";
|
|
7
|
-
import "./utilities/use-id.js";
|
|
8
|
-
import "./interactions/dismissable.js";
|
|
9
|
-
import "./interactions/focusable.js";
|
|
10
|
-
import "./interactions/hoverable.js";
|
|
11
|
-
import "./interactions/roving-focus.js";
|
|
12
|
-
import "./state/controllable.js";
|
|
13
|
-
import "./icon/icon.js";
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import { JSXElement } from "../common/jsx.js";
|
|
2
|
-
import { LayoutComponent, layout } from "./structures/layout.js";
|
|
3
|
-
import { Slot, SlotProps } from "./structures/slot.js";
|
|
4
|
-
import { Presence, PresenceProps } from "./structures/presence.js";
|
|
5
|
-
import { DefaultPortal, Portal, PortalProps, definePortal } from "./structures/portal.js";
|
|
6
|
-
import { Collection, CollectionItem, createCollection } from "./structures/collection.js";
|
|
7
|
-
import { Layer, LayerManager, LayerOptions, createLayer } from "./structures/layer.js";
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { RouteConfig, RouteRenderResult } from "./types.js";
|
|
2
|
-
import { SSRData } from "../common/ssr.js";
|
|
3
|
-
|
|
4
|
-
//#region src/ssg/batch-render.d.ts
|
|
5
|
-
interface BatchRenderOptions {
|
|
6
|
-
seed?: number;
|
|
7
|
-
dataMap?: Record<string, SSRData>;
|
|
8
|
-
concurrency?: number;
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Render multiple routes in parallel with error handling
|
|
12
|
-
*/
|
|
13
|
-
declare function batchRenderRoutes(routes: RouteConfig[], options?: BatchRenderOptions): Promise<RouteRenderResult[]>;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { batchRenderRoutes };
|
|
16
|
-
//# sourceMappingURL=batch-render.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"batch-render.d.ts","names":[],"sources":["../../src/ssg/batch-render.ts"],"mappings":";;;;UAWU,kBAAA;EACR,IAAA;EACA,OAAA,GAAU,MAAA,SAAe,OAAA;EACzB,WAAA;AAAA;;;;iBAMoB,iBAAA,CACpB,MAAA,EAAQ,WAAA,IACR,OAAA,GAAS,kBAAA,GACR,OAAA,CAAQ,iBAAA"}
|
|
@@ -1,24 +0,0 @@
|
|
|
1
|
-
import { RouteRenderResult, SSGMetadata, SSGMode, SSGResult } from "./types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/ssg/generate-metadata.d.ts
|
|
4
|
-
interface GenerateResultOptions {
|
|
5
|
-
mode?: SSGMode;
|
|
6
|
-
cacheHits?: number;
|
|
7
|
-
invalidatedKeys?: string[];
|
|
8
|
-
invalidatedRoutes?: string[];
|
|
9
|
-
}
|
|
10
|
-
/**
|
|
11
|
-
* Generate SSGResult from render results
|
|
12
|
-
*/
|
|
13
|
-
declare function generateSSGResult(results: RouteRenderResult[], options?: GenerateResultOptions): SSGResult;
|
|
14
|
-
/**
|
|
15
|
-
* Convert SSGResult to metadata for JSON serialization
|
|
16
|
-
*/
|
|
17
|
-
declare function resultToMetadata(result: SSGResult): SSGMetadata;
|
|
18
|
-
/**
|
|
19
|
-
* Write metadata.json to output directory
|
|
20
|
-
*/
|
|
21
|
-
declare function writeMetadata(metadata: Record<string, unknown>, outputDir: string): Promise<void>;
|
|
22
|
-
//#endregion
|
|
23
|
-
export { generateSSGResult, resultToMetadata, writeMetadata };
|
|
24
|
-
//# sourceMappingURL=generate-metadata.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"generate-metadata.d.ts","names":[],"sources":["../../src/ssg/generate-metadata.ts"],"mappings":";;;UAgBU,qBAAA;EACR,IAAA,GAAO,OAAA;EACP,SAAA;EACA,eAAA;EACA,iBAAA;AAAA;;AAMF;;iBAAgB,iBAAA,CACd,OAAA,EAAS,iBAAA,IACT,OAAA,GAAS,qBAAA,GACR,SAAA;;;;iBA6Ca,gBAAA,CAAiB,MAAA,EAAQ,SAAA,GAAY,WAAA;;;;iBAsC/B,aAAA,CACpB,QAAA,EAAU,MAAA,mBACV,SAAA,WACC,OAAA"}
|
|
@@ -1,23 +0,0 @@
|
|
|
1
|
-
import { RouteConfig } from "./types.js";
|
|
2
|
-
import { SSRData } from "../common/ssr.js";
|
|
3
|
-
|
|
4
|
-
//#region src/ssg/resolve-ssg-data.d.ts
|
|
5
|
-
interface DataResolutionOptions {
|
|
6
|
-
/** User-supplied data overrides per route path */
|
|
7
|
-
dataOverrides?: Record<string, unknown>;
|
|
8
|
-
}
|
|
9
|
-
/**
|
|
10
|
-
* Resolve and validate data for SSG routes
|
|
11
|
-
* Returns a map of route path -> SSRData
|
|
12
|
-
*
|
|
13
|
-
* In phase 1: accepts user-supplied dataOverrides
|
|
14
|
-
* In phase 2: can be extended to auto-discover resources
|
|
15
|
-
*/
|
|
16
|
-
declare function resolveSsgData(routes: RouteConfig[], options?: DataResolutionOptions): Record<string, SSRData>;
|
|
17
|
-
/**
|
|
18
|
-
* Validate routes are properly configured
|
|
19
|
-
*/
|
|
20
|
-
declare function validateRoutes(routes: RouteConfig[]): void;
|
|
21
|
-
//#endregion
|
|
22
|
-
export { resolveSsgData, validateRoutes };
|
|
23
|
-
//# sourceMappingURL=resolve-ssg-data.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"resolve-ssg-data.d.ts","names":[],"sources":["../../src/ssg/resolve-ssg-data.ts"],"mappings":";;;;UAUU,qBAAA;EAYM;EAVd,aAAA,GAAgB,MAAA;AAAA;;;;;;;;iBAUF,cAAA,CACd,MAAA,EAAQ,WAAA,IACR,OAAA,GAAS,qBAAA,GACR,MAAA,SAAe,OAAA;;;;iBAyBF,cAAA,CAAe,MAAA,EAAQ,WAAA"}
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
import { RouteConfig } from "./types.js";
|
|
2
|
-
|
|
3
|
-
//#region src/ssg/route-utils.d.ts
|
|
4
|
-
interface ResolvedRouteDescriptor {
|
|
5
|
-
route: RouteConfig;
|
|
6
|
-
path: string;
|
|
7
|
-
filePath: string;
|
|
8
|
-
routeId: string;
|
|
9
|
-
invalidationKeys: string[];
|
|
10
|
-
}
|
|
11
|
-
declare function getOutputFilePath(pathStr: string): string;
|
|
12
|
-
declare function interpolateRoutePath(routePath: string, params?: Record<string, string>): string;
|
|
13
|
-
declare function resolveRouteDescriptor(route: RouteConfig): ResolvedRouteDescriptor;
|
|
14
|
-
//#endregion
|
|
15
|
-
export { getOutputFilePath };
|
|
16
|
-
//# sourceMappingURL=route-utils.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"route-utils.d.ts","names":[],"sources":["../../src/ssg/route-utils.ts"],"mappings":";;;UAEiB,uBAAA;EACf,KAAA,EAAO,WAAA;EACP,IAAA;EACA,QAAA;EACA,OAAA;EACA,gBAAA;AAAA;AAAA,iBAGc,iBAAA,CAAkB,OAAA;AAAA,iBAQlB,oBAAA,CACd,SAAA,UACA,MAAA,GAAS,MAAA;AAAA,iBASK,sBAAA,CACd,KAAA,EAAO,WAAA,GACN,uBAAA"}
|
|
@@ -1,15 +0,0 @@
|
|
|
1
|
-
import { RouteRenderResult } from "./types.js";
|
|
2
|
-
import { getOutputFilePath } from "./route-utils.js";
|
|
3
|
-
|
|
4
|
-
//#region src/ssg/write-static-files.d.ts
|
|
5
|
-
interface WriteStaticFilesOptions {
|
|
6
|
-
concurrency?: number;
|
|
7
|
-
}
|
|
8
|
-
/**
|
|
9
|
-
* Write rendered routes to disk
|
|
10
|
-
* Creates outputDir/{route-path}/index.html structure
|
|
11
|
-
*/
|
|
12
|
-
declare function writeStaticFiles(results: RouteRenderResult[], outputDir: string, options?: WriteStaticFilesOptions): Promise<void>;
|
|
13
|
-
//#endregion
|
|
14
|
-
export { writeStaticFiles };
|
|
15
|
-
//# sourceMappingURL=write-static-files.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"write-static-files.d.ts","names":[],"sources":["../../src/ssg/write-static-files.ts"],"mappings":";;;;UAYU,uBAAA;EACR,WAAA;AAAA;;;;;iBAOoB,gBAAA,CACpB,OAAA,EAAS,iBAAA,IACT,SAAA,UACA,OAAA,GAAS,uBAAA,GACR,OAAA"}
|
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
import { SSRRoute } from "./index.js";
|
|
2
|
-
|
|
3
|
-
//#region src/ssr/render-keys.d.ts
|
|
4
|
-
type ResourceDescriptor = {
|
|
5
|
-
key: string;
|
|
6
|
-
fn: (opts: {
|
|
7
|
-
signal?: AbortSignal;
|
|
8
|
-
}) => Promise<unknown> | unknown;
|
|
9
|
-
deps: unknown[];
|
|
10
|
-
index: number;
|
|
11
|
-
};
|
|
12
|
-
type ResourcePlan = {
|
|
13
|
-
resources: ResourceDescriptor[];
|
|
14
|
-
};
|
|
15
|
-
declare function getCurrentRenderData(): Record<string, unknown> | null;
|
|
16
|
-
declare function resetKeyCounter(): void;
|
|
17
|
-
declare function getNextKey(): string;
|
|
18
|
-
declare function startRenderPhase(data: Record<string, unknown> | null): void;
|
|
19
|
-
declare function stopRenderPhase(): void;
|
|
20
|
-
/** @deprecated SSR prepass has been removed */
|
|
21
|
-
declare function startCollection(): never;
|
|
22
|
-
/** @deprecated SSR prepass has been removed */
|
|
23
|
-
declare function stopCollection(): ResourcePlan;
|
|
24
|
-
/** @deprecated SSR prepass has been removed */
|
|
25
|
-
declare function registerResourceIntent(_fn: ResourceDescriptor['fn'], _deps: unknown[]): string;
|
|
26
|
-
/** @deprecated SSR prepass has been removed */
|
|
27
|
-
declare function resolvePlan(_plan: ResourcePlan): Promise<Record<string, unknown>>;
|
|
28
|
-
/** @deprecated SSR prepass has been removed */
|
|
29
|
-
declare function collectResources(_opts: {
|
|
30
|
-
url: string;
|
|
31
|
-
routes: SSRRoute[];
|
|
32
|
-
}): ResourcePlan;
|
|
33
|
-
/** @deprecated Alias for resolvePlan */
|
|
34
|
-
declare const resolveResources: typeof resolvePlan;
|
|
35
|
-
//#endregion
|
|
36
|
-
export { ResourcePlan, collectResources, resolvePlan, resolveResources };
|
|
37
|
-
//# sourceMappingURL=render-keys.d.ts.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"render-keys.d.ts","names":[],"sources":["../../src/ssr/render-keys.ts"],"mappings":";;;KAUY,kBAAA;EACV,GAAA;EACA,EAAA,GAAK,IAAA;IAAQ,MAAA,GAAS,WAAA;EAAA,MAAkB,OAAA;EACxC,IAAA;EACA,KAAA;AAAA;AAAA,KAGU,YAAA;EACV,SAAA,EAAW,kBAAA;AAAA;AAAA,iBAGG,oBAAA,CAAA,GAAwB,MAAA;AAAA,iBAKxB,eAAA,CAAA;AAAA,iBAKA,UAAA,CAAA;AAAA,iBAMA,gBAAA,CAAiB,IAAA,EAAM,MAAA;AAAA,iBAQvB,eAAA,CAAA;;iBAcA,eAAA,CAAA;;iBAKA,cAAA,CAAA,GAAkB,YAAA;AAtClC;AAAA,iBA2CgB,sBAAA,CACd,GAAA,EAAK,kBAAA,QACL,KAAA;;iBAQoB,WAAA,CACpB,KAAA,EAAO,YAAA,GACN,OAAA,CAAQ,MAAA;;iBAOK,gBAAA,CAAiB,KAAA;EAC/B,GAAA;EACA,MAAA,EAAQ,QAAA;AAAA,IACN,YAAA;;cAKS,gBAAA,SAAgB,WAAA"}
|
|
@@ -1,88 +0,0 @@
|
|
|
1
|
-
import { Fragment } from "../common/jsx.js";
|
|
2
|
-
import { VOID_ELEMENTS, escapeText } from "./escape.js";
|
|
3
|
-
import { throwSSRDataMissing } from "./context.js";
|
|
4
|
-
import "../jsx/index.js";
|
|
5
|
-
import { renderAttrsDirect } from "./attrs.js";
|
|
6
|
-
//#region src/ssr/stream-render.ts
|
|
7
|
-
function isPromiseLike(x) {
|
|
8
|
-
if (!x || typeof x !== "object") return false;
|
|
9
|
-
return typeof x.then === "function";
|
|
10
|
-
}
|
|
11
|
-
function executeComponent(type, props, ctx) {
|
|
12
|
-
const res = type(props ?? {}, { signal: ctx.signal });
|
|
13
|
-
if (isPromiseLike(res)) throwSSRDataMissing();
|
|
14
|
-
return res;
|
|
15
|
-
}
|
|
16
|
-
function inheritRenderableKey(source, result) {
|
|
17
|
-
const inheritedKey = source.key;
|
|
18
|
-
if (inheritedKey === void 0 || inheritedKey === null) return result;
|
|
19
|
-
if (!result || typeof result !== "object" || !("type" in result)) return result;
|
|
20
|
-
const resultVNode = result;
|
|
21
|
-
if (resultVNode.key === void 0 || resultVNode.key === null) resultVNode.key = inheritedKey;
|
|
22
|
-
if (typeof resultVNode.type === "string") {
|
|
23
|
-
if (!resultVNode.props) resultVNode.props = {};
|
|
24
|
-
if (resultVNode.props["data-key"] === void 0) resultVNode.props["data-key"] = String(inheritedKey);
|
|
25
|
-
}
|
|
26
|
-
return result;
|
|
27
|
-
}
|
|
28
|
-
function renderChildrenDirect(node, sink, ctx) {
|
|
29
|
-
let raw = node.children;
|
|
30
|
-
if (raw === void 0) raw = node.props?.children;
|
|
31
|
-
if (raw === null || raw === void 0 || raw === false) return;
|
|
32
|
-
if (Array.isArray(raw)) {
|
|
33
|
-
for (let i = 0; i < raw.length; i++) renderNodeToSink(raw[i], sink, ctx);
|
|
34
|
-
return;
|
|
35
|
-
}
|
|
36
|
-
renderNodeToSink(raw, sink, ctx);
|
|
37
|
-
}
|
|
38
|
-
function renderNodeToSink(node, sink, ctx) {
|
|
39
|
-
if (node === null || node === void 0) return;
|
|
40
|
-
if (typeof node === "string") {
|
|
41
|
-
sink.write(escapeText(node));
|
|
42
|
-
return;
|
|
43
|
-
}
|
|
44
|
-
if (typeof node === "number") {
|
|
45
|
-
sink.write(String(node));
|
|
46
|
-
return;
|
|
47
|
-
}
|
|
48
|
-
if (typeof node === "boolean") return;
|
|
49
|
-
if (typeof node !== "object") return;
|
|
50
|
-
const vnode = node;
|
|
51
|
-
const type = vnode.type;
|
|
52
|
-
if (type === Fragment) {
|
|
53
|
-
renderChildrenDirect(vnode, sink, ctx);
|
|
54
|
-
return;
|
|
55
|
-
}
|
|
56
|
-
if (typeof type === "symbol") {
|
|
57
|
-
renderChildrenDirect(vnode, sink, ctx);
|
|
58
|
-
return;
|
|
59
|
-
}
|
|
60
|
-
if (typeof type === "function") {
|
|
61
|
-
renderNodeToSink(inheritRenderableKey(vnode, executeComponent(type, vnode.props, ctx)), sink, ctx);
|
|
62
|
-
return;
|
|
63
|
-
}
|
|
64
|
-
const tag = type;
|
|
65
|
-
const props = vnode.props;
|
|
66
|
-
const dangerous = props?.dangerouslySetInnerHTML;
|
|
67
|
-
const dangerousHtml = dangerous && typeof dangerous === "object" && "__html" in dangerous ? String(dangerous.__html) : void 0;
|
|
68
|
-
if (VOID_ELEMENTS.has(tag)) {
|
|
69
|
-
sink.write("<");
|
|
70
|
-
sink.write(tag);
|
|
71
|
-
renderAttrsDirect(props, sink);
|
|
72
|
-
sink.write(" />");
|
|
73
|
-
return;
|
|
74
|
-
}
|
|
75
|
-
sink.write("<");
|
|
76
|
-
sink.write(tag);
|
|
77
|
-
renderAttrsDirect(props, sink);
|
|
78
|
-
sink.write(">");
|
|
79
|
-
if (dangerousHtml !== void 0) sink.write(dangerousHtml);
|
|
80
|
-
else renderChildrenDirect(vnode, sink, ctx);
|
|
81
|
-
sink.write("</");
|
|
82
|
-
sink.write(tag);
|
|
83
|
-
sink.write(">");
|
|
84
|
-
}
|
|
85
|
-
//#endregion
|
|
86
|
-
export { renderNodeToSink };
|
|
87
|
-
|
|
88
|
-
//# sourceMappingURL=stream-render.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"stream-render.js","names":[],"sources":["../../src/ssr/stream-render.ts"],"sourcesContent":["import type { Props } from '../common/props';\nimport type { RenderSink } from './sink';\nimport type { VNode, SSRComponent } from './types';\nimport type { DOMElement } from '../common/vnode';\nimport { Fragment } from '../jsx';\nimport { type RenderContext, throwSSRDataMissing } from './context';\nimport { VOID_ELEMENTS, escapeText } from './escape';\nimport { renderAttrsDirect } from './attrs';\n\n// Re-export for backwards compatibility\nexport type Component = SSRComponent;\n\n// Legacy alias for context type\nexport type SSRContext = RenderContext;\n\nfunction isPromiseLike(x: unknown): x is PromiseLike<unknown> {\n if (!x || typeof x !== 'object') return false;\n return typeof (x as { then?: unknown }).then === 'function';\n}\n\nfunction executeComponent(\n type: Component,\n props: Props | undefined,\n ctx: RenderContext\n): unknown {\n const res = type(props ?? {}, { signal: ctx.signal });\n if (isPromiseLike(res)) {\n throwSSRDataMissing();\n }\n return res;\n}\n\nfunction inheritRenderableKey(source: VNode, result: unknown): unknown {\n const inheritedKey = source.key;\n if (inheritedKey === undefined || inheritedKey === null) {\n return result;\n }\n\n if (!result || typeof result !== 'object' || !('type' in result)) {\n return result;\n }\n\n const resultVNode = result as DOMElement;\n if (resultVNode.key === undefined || resultVNode.key === null) {\n resultVNode.key = inheritedKey;\n }\n\n if (typeof resultVNode.type === 'string') {\n if (!resultVNode.props) {\n resultVNode.props = {};\n }\n\n if (resultVNode.props['data-key'] === undefined) {\n resultVNode.props['data-key'] = String(inheritedKey);\n }\n }\n\n return result;\n}\n\n// Render children directly without allocating wrapper array when possible\nfunction renderChildrenDirect(\n node: Record<string, unknown>,\n sink: RenderSink,\n ctx: RenderContext\n): void {\n // Prefer explicit children; fallback to props.children\n let raw: unknown = node.children;\n if (raw === undefined) {\n raw = (node.props as Record<string, unknown> | undefined)?.children;\n }\n\n if (raw === null || raw === undefined || raw === false) return;\n\n if (Array.isArray(raw)) {\n for (let i = 0; i < raw.length; i++) {\n renderNodeToSink(raw[i], sink, ctx);\n }\n return;\n }\n\n // Single child - no array allocation\n renderNodeToSink(raw, sink, ctx);\n}\n\nexport function renderNodeToSink(\n node: unknown,\n sink: RenderSink,\n ctx: RenderContext\n): void {\n if (node === null || node === undefined) return;\n\n // Fast path: primitive strings\n if (typeof node === 'string') {\n sink.write(escapeText(node));\n return;\n }\n\n // Fast path: numbers\n if (typeof node === 'number') {\n sink.write(String(node));\n return;\n }\n\n // Skip booleans (false is common from conditional rendering)\n if (typeof node === 'boolean') return;\n\n // Must be object at this point\n if (typeof node !== 'object') return;\n\n const vnode = node as VNode;\n const type = vnode.type;\n\n // Fragment: render children directly (canonical check via === is fastest)\n if (type === Fragment) {\n renderChildrenDirect(\n vnode as unknown as Record<string, unknown>,\n sink,\n ctx\n );\n return;\n }\n\n // Symbol type that isn't our Fragment\n if (typeof type === 'symbol') {\n // Unknown symbol - render children as fragment fallback\n renderChildrenDirect(\n vnode as unknown as Record<string, unknown>,\n sink,\n ctx\n );\n return;\n }\n\n // Function component\n if (typeof type === 'function') {\n const out = executeComponent(type as Component, vnode.props, ctx);\n renderNodeToSink(inheritRenderableKey(vnode, out), sink, ctx);\n return;\n }\n\n // Element node (type is string)\n const tag = type as string;\n const props = vnode.props;\n\n // Check for dangerouslySetInnerHTML\n const dangerous = props?.dangerouslySetInnerHTML as\n | { __html: unknown }\n | undefined;\n const dangerousHtml =\n dangerous && typeof dangerous === 'object' && '__html' in dangerous\n ? String(dangerous.__html)\n : undefined;\n\n // Void element - self-closing\n if (VOID_ELEMENTS.has(tag)) {\n sink.write('<');\n sink.write(tag);\n renderAttrsDirect(props, sink);\n sink.write(' />');\n return;\n }\n\n // Regular element\n sink.write('<');\n sink.write(tag);\n renderAttrsDirect(props, sink);\n sink.write('>');\n\n if (dangerousHtml !== undefined) {\n sink.write(dangerousHtml);\n } else {\n renderChildrenDirect(\n vnode as unknown as Record<string, unknown>,\n sink,\n ctx\n );\n }\n\n sink.write('</');\n sink.write(tag);\n sink.write('>');\n}\n"],"mappings":";;;;;;AAeA,SAAS,cAAc,GAAuC;CAC5D,IAAI,CAAC,KAAK,OAAO,MAAM,UAAU,OAAO;CACxC,OAAO,OAAQ,EAAyB,SAAS;;AAGnD,SAAS,iBACP,MACA,OACA,KACS;CACT,MAAM,MAAM,KAAK,SAAS,EAAE,EAAE,EAAE,QAAQ,IAAI,QAAQ,CAAC;CACrD,IAAI,cAAc,IAAI,EACpB,qBAAqB;CAEvB,OAAO;;AAGT,SAAS,qBAAqB,QAAe,QAA0B;CACrE,MAAM,eAAe,OAAO;CAC5B,IAAI,iBAAiB,UAAa,iBAAiB,MACjD,OAAO;CAGT,IAAI,CAAC,UAAU,OAAO,WAAW,YAAY,EAAE,UAAU,SACvD,OAAO;CAGT,MAAM,cAAc;CACpB,IAAI,YAAY,QAAQ,UAAa,YAAY,QAAQ,MACvD,YAAY,MAAM;CAGpB,IAAI,OAAO,YAAY,SAAS,UAAU;EACxC,IAAI,CAAC,YAAY,OACf,YAAY,QAAQ,EAAE;EAGxB,IAAI,YAAY,MAAM,gBAAgB,QACpC,YAAY,MAAM,cAAc,OAAO,aAAa;;CAIxD,OAAO;;AAIT,SAAS,qBACP,MACA,MACA,KACM;CAEN,IAAI,MAAe,KAAK;CACxB,IAAI,QAAQ,QACV,MAAO,KAAK,OAA+C;CAG7D,IAAI,QAAQ,QAAQ,QAAQ,UAAa,QAAQ,OAAO;CAExD,IAAI,MAAM,QAAQ,IAAI,EAAE;EACtB,KAAK,IAAI,IAAI,GAAG,IAAI,IAAI,QAAQ,KAC9B,iBAAiB,IAAI,IAAI,MAAM,IAAI;EAErC;;CAIF,iBAAiB,KAAK,MAAM,IAAI;;AAGlC,SAAgB,iBACd,MACA,MACA,KACM;CACN,IAAI,SAAS,QAAQ,SAAS,QAAW;CAGzC,IAAI,OAAO,SAAS,UAAU;EAC5B,KAAK,MAAM,WAAW,KAAK,CAAC;EAC5B;;CAIF,IAAI,OAAO,SAAS,UAAU;EAC5B,KAAK,MAAM,OAAO,KAAK,CAAC;EACxB;;CAIF,IAAI,OAAO,SAAS,WAAW;CAG/B,IAAI,OAAO,SAAS,UAAU;CAE9B,MAAM,QAAQ;CACd,MAAM,OAAO,MAAM;CAGnB,IAAI,SAAS,UAAU;EACrB,qBACE,OACA,MACA,IACD;EACD;;CAIF,IAAI,OAAO,SAAS,UAAU;EAE5B,qBACE,OACA,MACA,IACD;EACD;;CAIF,IAAI,OAAO,SAAS,YAAY;EAE9B,iBAAiB,qBAAqB,OAD1B,iBAAiB,MAAmB,MAAM,OAAO,IAChB,CAAI,EAAE,MAAM,IAAI;EAC7D;;CAIF,MAAM,MAAM;CACZ,MAAM,QAAQ,MAAM;CAGpB,MAAM,YAAY,OAAO;CAGzB,MAAM,gBACJ,aAAa,OAAO,cAAc,YAAY,YAAY,YACtD,OAAO,UAAU,OAAO,GACxB;CAGN,IAAI,cAAc,IAAI,IAAI,EAAE;EAC1B,KAAK,MAAM,IAAI;EACf,KAAK,MAAM,IAAI;EACf,kBAAkB,OAAO,KAAK;EAC9B,KAAK,MAAM,MAAM;EACjB;;CAIF,KAAK,MAAM,IAAI;CACf,KAAK,MAAM,IAAI;CACf,kBAAkB,OAAO,KAAK;CAC9B,KAAK,MAAM,IAAI;CAEf,IAAI,kBAAkB,QACpB,KAAK,MAAM,cAAc;MAEzB,qBACE,OACA,MACA,IACD;CAGH,KAAK,MAAM,KAAK;CAChB,KAAK,MAAM,IAAI;CACf,KAAK,MAAM,IAAI"}
|