@vertz/ui-server 0.2.36 → 0.2.37
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/bun-dev-server.js +8 -3
- package/dist/index.d.ts +3 -1
- package/dist/index.js +17 -5
- package/dist/node-handler.js +2 -2
- package/dist/shared/{chunk-9s2dppdh.js → chunk-4qb2xcyb.js} +1 -1
- package/dist/shared/{chunk-hjsbx25c.js → chunk-rwa95knv.js} +1 -1
- package/dist/shared/{chunk-wq2ke61r.js → chunk-vcpk8fs6.js} +21 -10
- package/dist/ssr/index.js +2 -2
- package/package.json +1 -1
package/dist/bun-dev-server.js
CHANGED
|
@@ -1814,7 +1814,8 @@ function createRequestContext(url) {
|
|
|
1814
1814
|
queryCache: new MemoryCache({ maxSize: Infinity }),
|
|
1815
1815
|
inflight: new Map,
|
|
1816
1816
|
queries: [],
|
|
1817
|
-
errors: []
|
|
1817
|
+
errors: [],
|
|
1818
|
+
cssTracker: new Set
|
|
1818
1819
|
};
|
|
1819
1820
|
}
|
|
1820
1821
|
var domShimInstalled = false;
|
|
@@ -1839,7 +1840,9 @@ function collectCSS(themeCss, module) {
|
|
|
1839
1840
|
for (const s of module.styles)
|
|
1840
1841
|
alreadyIncluded.add(s);
|
|
1841
1842
|
}
|
|
1842
|
-
const
|
|
1843
|
+
const ssrCtx = ssrStorage.getStore();
|
|
1844
|
+
const rawComponentCss = ssrCtx?.cssTracker?.size ? Array.from(ssrCtx.cssTracker) : module.getInjectedCSS?.() ?? [];
|
|
1845
|
+
const componentCss = rawComponentCss.filter((s) => !alreadyIncluded.has(s));
|
|
1843
1846
|
const themeTag = themeCss ? `<style data-vertz-css>${themeCss}</style>` : "";
|
|
1844
1847
|
const globalTag = module.styles && module.styles.length > 0 ? `<style data-vertz-css>${module.styles.join(`
|
|
1845
1848
|
`)}</style>` : "";
|
|
@@ -2456,7 +2459,9 @@ function collectCSS2(themeCss, module) {
|
|
|
2456
2459
|
for (const s of module.styles)
|
|
2457
2460
|
alreadyIncluded.add(s);
|
|
2458
2461
|
}
|
|
2459
|
-
const
|
|
2462
|
+
const ssrCtx = ssrStorage.getStore();
|
|
2463
|
+
const rawComponentCss = ssrCtx?.cssTracker?.size ? Array.from(ssrCtx.cssTracker) : module.getInjectedCSS?.() ?? [];
|
|
2464
|
+
const componentCss = rawComponentCss.filter((s) => !alreadyIncluded.has(s));
|
|
2460
2465
|
const themeTag = themeCss ? `<style data-vertz-css>${themeCss}</style>` : "";
|
|
2461
2466
|
const globalTag = module.styles && module.styles.length > 0 ? `<style data-vertz-css>${module.styles.join(`
|
|
2462
2467
|
`)}</style>` : "";
|
package/dist/index.d.ts
CHANGED
|
@@ -513,8 +513,10 @@ interface AotRouteMapEntry {
|
|
|
513
513
|
renderFn: string;
|
|
514
514
|
/** Component names that need runtime fallback rendering. */
|
|
515
515
|
holes: string[];
|
|
516
|
-
/** Query cache keys this route reads via ctx.getData(). */
|
|
516
|
+
/** Query cache keys this route reads via ctx.getData(). May contain ${paramName} placeholders. */
|
|
517
517
|
queryKeys: string[];
|
|
518
|
+
/** Route param names referenced in queryKeys. Present only when queryKeys have ${...} placeholders. */
|
|
519
|
+
paramBindings?: string[];
|
|
518
520
|
}
|
|
519
521
|
interface AotBuildManifest {
|
|
520
522
|
components: Record<string, AotBuildComponentEntry>;
|
package/dist/index.js
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSSRHandler,
|
|
3
3
|
loadAotManifest
|
|
4
|
-
} from "./shared/chunk-
|
|
4
|
+
} from "./shared/chunk-rwa95knv.js";
|
|
5
5
|
import {
|
|
6
6
|
createNodeHandler
|
|
7
|
-
} from "./shared/chunk-
|
|
7
|
+
} from "./shared/chunk-4qb2xcyb.js";
|
|
8
8
|
import {
|
|
9
9
|
collectStreamChunks,
|
|
10
10
|
compileThemeCached,
|
|
@@ -34,7 +34,7 @@ import {
|
|
|
34
34
|
ssrRenderToString,
|
|
35
35
|
streamToString,
|
|
36
36
|
toPrefetchSession
|
|
37
|
-
} from "./shared/chunk-
|
|
37
|
+
} from "./shared/chunk-vcpk8fs6.js";
|
|
38
38
|
import {
|
|
39
39
|
clearGlobalSSRTimeout,
|
|
40
40
|
createSSRAdapter,
|
|
@@ -109,11 +109,22 @@ function buildAotRouteMap(components, routes) {
|
|
|
109
109
|
const comp = components[route.componentName];
|
|
110
110
|
if (!comp || comp.tier === "runtime-fallback")
|
|
111
111
|
continue;
|
|
112
|
-
|
|
112
|
+
const paramNames = new Set;
|
|
113
|
+
for (const key of comp.queryKeys) {
|
|
114
|
+
const matches = key.matchAll(/\$\{(\w+)\}/g);
|
|
115
|
+
for (const m of matches) {
|
|
116
|
+
paramNames.add(m[1]);
|
|
117
|
+
}
|
|
118
|
+
}
|
|
119
|
+
const entry = {
|
|
113
120
|
renderFn: `__ssr_${route.componentName}`,
|
|
114
121
|
holes: comp.holes,
|
|
115
122
|
queryKeys: comp.queryKeys
|
|
116
123
|
};
|
|
124
|
+
if (paramNames.size > 0) {
|
|
125
|
+
entry.paramBindings = [...paramNames];
|
|
126
|
+
}
|
|
127
|
+
routeMap[route.pattern] = entry;
|
|
117
128
|
}
|
|
118
129
|
return routeMap;
|
|
119
130
|
}
|
|
@@ -484,7 +495,8 @@ async function twoPassRender(options) {
|
|
|
484
495
|
}
|
|
485
496
|
const pendingQueries = queries.filter((q) => !q.resolved);
|
|
486
497
|
const vnode = options.app();
|
|
487
|
-
const
|
|
498
|
+
const ssrCtx = ssrStorage.getStore();
|
|
499
|
+
const collectedCSS = ssrCtx?.cssTracker?.size ? Array.from(ssrCtx.cssTracker) : getInjectedCSS();
|
|
488
500
|
const themeCss = options.theme ? compileThemeCached(options.theme, options.fallbackMetrics).css : "";
|
|
489
501
|
const allStyles = [themeCss, ...options.styles ?? [], ...collectedCSS].filter(Boolean);
|
|
490
502
|
const styleTags = allStyles.length > 0 ? `<style>${allStyles.join(`
|
package/dist/node-handler.js
CHANGED
|
@@ -359,7 +359,8 @@ function createRequestContext(url) {
|
|
|
359
359
|
queryCache: new MemoryCache({ maxSize: Infinity }),
|
|
360
360
|
inflight: new Map,
|
|
361
361
|
queries: [],
|
|
362
|
-
errors: []
|
|
362
|
+
errors: [],
|
|
363
|
+
cssTracker: new Set
|
|
363
364
|
};
|
|
364
365
|
}
|
|
365
366
|
var domShimInstalled = false;
|
|
@@ -384,7 +385,9 @@ function collectCSS(themeCss, module) {
|
|
|
384
385
|
for (const s of module.styles)
|
|
385
386
|
alreadyIncluded.add(s);
|
|
386
387
|
}
|
|
387
|
-
const
|
|
388
|
+
const ssrCtx = ssrStorage.getStore();
|
|
389
|
+
const rawComponentCss = ssrCtx?.cssTracker?.size ? Array.from(ssrCtx.cssTracker) : module.getInjectedCSS?.() ?? [];
|
|
390
|
+
const componentCss = rawComponentCss.filter((s) => !alreadyIncluded.has(s));
|
|
388
391
|
const themeTag = themeCss ? `<style data-vertz-css>${themeCss}</style>` : "";
|
|
389
392
|
const globalTag = module.styles && module.styles.length > 0 ? `<style data-vertz-css>${module.styles.join(`
|
|
390
393
|
`)}</style>` : "";
|
|
@@ -1004,7 +1007,9 @@ function collectCSS2(themeCss, module) {
|
|
|
1004
1007
|
for (const s of module.styles)
|
|
1005
1008
|
alreadyIncluded.add(s);
|
|
1006
1009
|
}
|
|
1007
|
-
const
|
|
1010
|
+
const ssrCtx = ssrStorage.getStore();
|
|
1011
|
+
const rawComponentCss = ssrCtx?.cssTracker?.size ? Array.from(ssrCtx.cssTracker) : module.getInjectedCSS?.() ?? [];
|
|
1012
|
+
const componentCss = rawComponentCss.filter((s) => !alreadyIncluded.has(s));
|
|
1008
1013
|
const themeTag = themeCss ? `<style data-vertz-css>${themeCss}</style>` : "";
|
|
1009
1014
|
const globalTag = module.styles && module.styles.length > 0 ? `<style data-vertz-css>${module.styles.join(`
|
|
1010
1015
|
`)}</style>` : "";
|
|
@@ -1076,14 +1081,15 @@ async function ssrRenderAot(module, url, options) {
|
|
|
1076
1081
|
return ssrRenderSinglePass(module, normalizedUrl, fallbackOptions);
|
|
1077
1082
|
}
|
|
1078
1083
|
const queryCache = new Map;
|
|
1079
|
-
|
|
1084
|
+
const resolvedQueryKeys = aotEntry.queryKeys ? resolveParamQueryKeys(aotEntry.queryKeys, match.params) : undefined;
|
|
1085
|
+
if (resolvedQueryKeys && resolvedQueryKeys.length > 0 && manifest?.routeEntries) {
|
|
1080
1086
|
const apiClient = module.api;
|
|
1081
1087
|
if (apiClient) {
|
|
1082
|
-
await prefetchForAot(
|
|
1088
|
+
await prefetchForAot(resolvedQueryKeys, manifest.routeEntries, match, apiClient, ssrTimeout, queryCache);
|
|
1083
1089
|
}
|
|
1084
1090
|
}
|
|
1085
|
-
if (
|
|
1086
|
-
const unresolvedKeys =
|
|
1091
|
+
if (resolvedQueryKeys && resolvedQueryKeys.length > 0 && options.aotDataResolver) {
|
|
1092
|
+
const unresolvedKeys = resolvedQueryKeys.filter((k) => !queryCache.has(k));
|
|
1087
1093
|
if (unresolvedKeys.length > 0) {
|
|
1088
1094
|
try {
|
|
1089
1095
|
const resolved = await options.aotDataResolver(match.pattern, match.params, unresolvedKeys);
|
|
@@ -1095,8 +1101,8 @@ async function ssrRenderAot(module, url, options) {
|
|
|
1095
1101
|
}
|
|
1096
1102
|
}
|
|
1097
1103
|
}
|
|
1098
|
-
if (
|
|
1099
|
-
const allKeysResolved =
|
|
1104
|
+
if (resolvedQueryKeys && resolvedQueryKeys.length > 0) {
|
|
1105
|
+
const allKeysResolved = resolvedQueryKeys.every((k) => queryCache.has(k));
|
|
1100
1106
|
if (!allKeysResolved) {
|
|
1101
1107
|
return ssrRenderSinglePass(module, normalizedUrl, fallbackOptions);
|
|
1102
1108
|
}
|
|
@@ -1180,6 +1186,9 @@ function unwrapResult2(result) {
|
|
|
1180
1186
|
}
|
|
1181
1187
|
return result;
|
|
1182
1188
|
}
|
|
1189
|
+
function resolveParamQueryKeys(queryKeys, params) {
|
|
1190
|
+
return queryKeys.map((key) => key.replace(/\$\{(\w+)\}/g, (_, paramName) => params[paramName] ?? ""));
|
|
1191
|
+
}
|
|
1183
1192
|
function isAotDebugEnabled() {
|
|
1184
1193
|
const env = process.env.VERTZ_DEBUG;
|
|
1185
1194
|
if (!env)
|
|
@@ -1212,7 +1221,9 @@ function collectCSSFromModule(module, fallbackMetrics) {
|
|
|
1212
1221
|
for (const s of module.styles)
|
|
1213
1222
|
alreadyIncluded.add(s);
|
|
1214
1223
|
}
|
|
1215
|
-
const
|
|
1224
|
+
const ssrCtx = ssrStorage.getStore();
|
|
1225
|
+
const rawComponentCss = ssrCtx?.cssTracker?.size ? Array.from(ssrCtx.cssTracker) : module.getInjectedCSS?.() ?? [];
|
|
1226
|
+
const componentCss = rawComponentCss.filter((s) => !alreadyIncluded.has(s));
|
|
1216
1227
|
const themeTag = themeCss ? `<style data-vertz-css>${themeCss}</style>` : "";
|
|
1217
1228
|
const globalTag = module.styles && module.styles.length > 0 ? `<style data-vertz-css>${module.styles.join(`
|
|
1218
1229
|
`)}</style>` : "";
|
package/dist/ssr/index.js
CHANGED
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
import {
|
|
2
2
|
createSSRHandler,
|
|
3
3
|
loadAotManifest
|
|
4
|
-
} from "../shared/chunk-
|
|
4
|
+
} from "../shared/chunk-rwa95knv.js";
|
|
5
5
|
import {
|
|
6
6
|
injectIntoTemplate,
|
|
7
7
|
ssrDiscoverQueries,
|
|
8
8
|
ssrRenderToString
|
|
9
|
-
} from "../shared/chunk-
|
|
9
|
+
} from "../shared/chunk-vcpk8fs6.js";
|
|
10
10
|
import"../shared/chunk-ybftdw1r.js";
|
|
11
11
|
// src/prerender.ts
|
|
12
12
|
async function discoverRoutes(module) {
|