@vertz/ui-server 0.2.34 → 0.2.35

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.
@@ -2134,11 +2134,12 @@ function resolveQueryBindings(bindings, routeParams) {
2134
2134
  }
2135
2135
 
2136
2136
  // src/ssr-route-matcher.ts
2137
- function matchUrlToPatterns(url, patterns) {
2137
+ function matchUrlToPatterns(url, patterns, options) {
2138
2138
  const path = (url.split("?")[0] ?? "").split("#")[0] ?? "";
2139
+ const exact = options?.exact ?? false;
2139
2140
  const matches = [];
2140
2141
  for (const pattern of patterns) {
2141
- const result = matchPattern(path, pattern);
2142
+ const result = matchPattern(path, pattern, exact);
2142
2143
  if (result) {
2143
2144
  matches.push(result);
2144
2145
  }
@@ -2150,11 +2151,16 @@ function matchUrlToPatterns(url, patterns) {
2150
2151
  });
2151
2152
  return matches;
2152
2153
  }
2153
- function matchPattern(path, pattern) {
2154
+ function matchPattern(path, pattern, exact) {
2154
2155
  const pathSegments = path.split("/").filter(Boolean);
2155
2156
  const patternSegments = pattern.split("/").filter(Boolean);
2156
- if (patternSegments.length > pathSegments.length)
2157
- return;
2157
+ if (exact) {
2158
+ if (patternSegments.length !== pathSegments.length)
2159
+ return;
2160
+ } else {
2161
+ if (patternSegments.length > pathSegments.length)
2162
+ return;
2163
+ }
2158
2164
  const params = {};
2159
2165
  for (let i = 0;i < patternSegments.length; i++) {
2160
2166
  const seg = patternSegments[i];
package/dist/index.d.ts CHANGED
@@ -1069,13 +1069,21 @@ interface MatchedRoute {
1069
1069
  /** Extracted route parameter values (e.g., { projectId: 'abc123' }) */
1070
1070
  params: Record<string, string>;
1071
1071
  }
1072
+ interface MatchOptions {
1073
+ /**
1074
+ * When true, require exact segment count match (no prefix matching).
1075
+ * Use for AOT routes (page-level). When false (default), prefix matching
1076
+ * is used for layout matching where `/` matches all nested routes.
1077
+ */
1078
+ exact?: boolean;
1079
+ }
1072
1080
  /**
1073
1081
  * Match a URL path against a list of route patterns.
1074
1082
  * Returns all matching patterns (layouts + page) ordered from most general to most specific.
1075
1083
  *
1076
1084
  * Patterns use Express-style `:param` syntax.
1077
1085
  */
1078
- declare function matchUrlToPatterns(url: string, patterns: string[]): MatchedRoute[];
1086
+ declare function matchUrlToPatterns(url: string, patterns: string[], options?: MatchOptions): MatchedRoute[];
1079
1087
  /**
1080
1088
  * Serialize data to JSON with `<` escaped as `\u003c`.
1081
1089
  * Prevents `<\/script>` breakout and `<!--` injection in inline scripts.
@@ -1126,4 +1134,4 @@ declare function collectStreamChunks(stream: ReadableStream<Uint8Array>): Promis
1126
1134
  * @param nonce - Optional CSP nonce to add to the inline script tag.
1127
1135
  */
1128
1136
  declare function createTemplateChunk(slotId: number, resolvedHtml: string, nonce?: string): string;
1129
- export { wrapWithHydrationMarkers, toPrefetchSession, streamToString, ssrStorage, ssrRenderToString, ssrRenderSinglePass, ssrRenderAot, ssrDiscoverQueries, setGlobalSSRTimeout, serializeToHtml, safeSerialize, resetSlotCounter, renderToStream, renderToHTMLStream, renderToHTML, renderPage, renderHeadToHtml, renderAssetTags, registerSSRQuery, reconstructDescriptors, rawHtml, matchUrlToPatterns, loadAotManifest, isInSSR, isAotDebugEnabled, inlineCriticalCss, getStreamingRuntimeScript, getSSRUrl, getSSRQueries, getGlobalSSRTimeout, getAccessSetForSSR, generateSSRHtml, generateAotBuildManifest, generateAotBarrel, extractRoutes, extractFontMetrics, evaluateAccessRule, encodeChunk, detectFallbackFont, createTemplateChunk, createSlotPlaceholder, createSessionScript, createSSRHandler, createSSRDataChunk, createSSRAdapter, createPrefetchManifestManager, createNodeHandler, createHoles, createAotManifestManager, createAccessSetScript, collectStreamChunks, clearGlobalSSRTimeout, buildAotRouteMap, __ssr_style_object, __ssr_spread, __esc_attr, __esc, VNode, SessionResolver, SessionData, SerializedAccessRule, SSRSinglePassOptions, SSRSessionInfo, SSRRenderResult, SSRRenderAotOptions, SSRQueryEntry2 as SSRQueryEntry, SSRPrefetchManifest, SSRModule, SSRHandlerOptions, SSRDiscoverResult, SSRAotContext, RenderToStreamOptions, RenderToHTMLStreamOptions, RenderToHTMLOptions, ReconstructedDescriptor, RawHtml, PrefetchSession, PrefetchManifestSnapshot, PrefetchManifestManagerOptions, PrefetchManifestManager, PageOptions, NodeHandlerOptions, MatchedRoute, HydrationOptions, HeadEntry, HeadCollector, GenerateSSRHtmlOptions, FontFallbackMetrics7 as FontFallbackMetrics, FallbackFontName2 as FallbackFontName, ExtractedRoute, EntityAccessMap, AssetDescriptor, AotTier, AotRouteMapEntry, AotRouteEntry, AotRenderFn, AotManifestSnapshot, AotManifestManagerOptions, AotManifestManager, AotManifest, AotDivergenceEntry, AotDiagnosticsSnapshot, AotDiagnostics, AotDevManifest, AotDevComponentEntry, AotComponentDiagnostic, AotCompiledFile, AotBuildManifest, AotBuildComponentEntry, AotBarrelResult };
1137
+ export { wrapWithHydrationMarkers, toPrefetchSession, streamToString, ssrStorage, ssrRenderToString, ssrRenderSinglePass, ssrRenderAot, ssrDiscoverQueries, setGlobalSSRTimeout, serializeToHtml, safeSerialize, resetSlotCounter, renderToStream, renderToHTMLStream, renderToHTML, renderPage, renderHeadToHtml, renderAssetTags, registerSSRQuery, reconstructDescriptors, rawHtml, matchUrlToPatterns, loadAotManifest, isInSSR, isAotDebugEnabled, inlineCriticalCss, getStreamingRuntimeScript, getSSRUrl, getSSRQueries, getGlobalSSRTimeout, getAccessSetForSSR, generateSSRHtml, generateAotBuildManifest, generateAotBarrel, extractRoutes, extractFontMetrics, evaluateAccessRule, encodeChunk, detectFallbackFont, createTemplateChunk, createSlotPlaceholder, createSessionScript, createSSRHandler, createSSRDataChunk, createSSRAdapter, createPrefetchManifestManager, createNodeHandler, createHoles, createAotManifestManager, createAccessSetScript, collectStreamChunks, clearGlobalSSRTimeout, buildAotRouteMap, __ssr_style_object, __ssr_spread, __esc_attr, __esc, VNode, SessionResolver, SessionData, SerializedAccessRule, SSRSinglePassOptions, SSRSessionInfo, SSRRenderResult, SSRRenderAotOptions, SSRQueryEntry2 as SSRQueryEntry, SSRPrefetchManifest, SSRModule, SSRHandlerOptions, SSRDiscoverResult, SSRAotContext, RenderToStreamOptions, RenderToHTMLStreamOptions, RenderToHTMLOptions, ReconstructedDescriptor, RawHtml, PrefetchSession, PrefetchManifestSnapshot, PrefetchManifestManagerOptions, PrefetchManifestManager, PageOptions, NodeHandlerOptions, MatchedRoute, MatchOptions, HydrationOptions, HeadEntry, HeadCollector, GenerateSSRHtmlOptions, FontFallbackMetrics7 as FontFallbackMetrics, FallbackFontName2 as FallbackFontName, ExtractedRoute, EntityAccessMap, AssetDescriptor, AotTier, AotRouteMapEntry, AotRouteEntry, AotRenderFn, AotManifestSnapshot, AotManifestManagerOptions, AotManifestManager, AotManifest, AotDivergenceEntry, AotDiagnosticsSnapshot, AotDiagnostics, AotDevManifest, AotDevComponentEntry, AotComponentDiagnostic, AotCompiledFile, AotBuildManifest, AotBuildComponentEntry, AotBarrelResult };
package/dist/index.js CHANGED
@@ -1,10 +1,10 @@
1
1
  import {
2
2
  createSSRHandler,
3
3
  loadAotManifest
4
- } from "./shared/chunk-2kx402c1.js";
4
+ } from "./shared/chunk-tqa618t8.js";
5
5
  import {
6
6
  createNodeHandler
7
- } from "./shared/chunk-xdb8qn68.js";
7
+ } from "./shared/chunk-fv51ctcf.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-hx7drzm3.js";
37
+ } from "./shared/chunk-bggdy77b.js";
38
38
  import {
39
39
  clearGlobalSSRTimeout,
40
40
  createSSRAdapter,
@@ -137,7 +137,9 @@ function generateAotBarrel(compiledFiles, routeMap) {
137
137
  existing.push(fnName);
138
138
  fileToFns.set(filePath, existing);
139
139
  }
140
- const lines = [];
140
+ const lines = [
141
+ "import { __esc, __esc_attr, __ssr_spread, __ssr_style_object } from '@vertz/ui-server';"
142
+ ];
141
143
  const files = {};
142
144
  let fileIndex = 0;
143
145
  for (const [filePath, fns] of fileToFns) {
@@ -147,7 +149,9 @@ function generateAotBarrel(compiledFiles, routeMap) {
147
149
  lines.push(`export { ${fns.sort().join(", ")} } from '${moduleRef}';`);
148
150
  const compiled = compiledFiles[filePath];
149
151
  if (compiled) {
150
- files[`${tempFileName}.tsx`] = compiled.code;
152
+ const helperImport = `import { __esc, __esc_attr, __ssr_spread, __ssr_style_object } from '@vertz/ui-server';
153
+ `;
154
+ files[`${tempFileName}.tsx`] = helperImport + compiled.code;
151
155
  }
152
156
  fileIndex++;
153
157
  }
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  createNodeHandler
3
- } from "./shared/chunk-xdb8qn68.js";
4
- import"./shared/chunk-hx7drzm3.js";
3
+ } from "./shared/chunk-fv51ctcf.js";
4
+ import"./shared/chunk-bggdy77b.js";
5
5
  import"./shared/chunk-ybftdw1r.js";
6
6
  export {
7
7
  createNodeHandler
@@ -626,11 +626,12 @@ data: ${safeSerialize(entry)}
626
626
  }
627
627
 
628
628
  // src/ssr-route-matcher.ts
629
- function matchUrlToPatterns(url, patterns) {
629
+ function matchUrlToPatterns(url, patterns, options) {
630
630
  const path = (url.split("?")[0] ?? "").split("#")[0] ?? "";
631
+ const exact = options?.exact ?? false;
631
632
  const matches = [];
632
633
  for (const pattern of patterns) {
633
- const result = matchPattern(path, pattern);
634
+ const result = matchPattern(path, pattern, exact);
634
635
  if (result) {
635
636
  matches.push(result);
636
637
  }
@@ -642,11 +643,16 @@ function matchUrlToPatterns(url, patterns) {
642
643
  });
643
644
  return matches;
644
645
  }
645
- function matchPattern(path, pattern) {
646
+ function matchPattern(path, pattern, exact) {
646
647
  const pathSegments = path.split("/").filter(Boolean);
647
648
  const patternSegments = pattern.split("/").filter(Boolean);
648
- if (patternSegments.length > pathSegments.length)
649
- return;
649
+ if (exact) {
650
+ if (patternSegments.length !== pathSegments.length)
651
+ return;
652
+ } else {
653
+ if (patternSegments.length > pathSegments.length)
654
+ return;
655
+ }
650
656
  const params = {};
651
657
  for (let i = 0;i < patternSegments.length; i++) {
652
658
  const seg = patternSegments[i];
@@ -1057,7 +1063,7 @@ async function ssrRenderAot(module, url, options) {
1057
1063
  prefetchSession: options.prefetchSession
1058
1064
  };
1059
1065
  const aotPatterns = Object.keys(aotManifest.routes);
1060
- const matches = matchUrlToPatterns(normalizedUrl, aotPatterns);
1066
+ const matches = matchUrlToPatterns(normalizedUrl, aotPatterns, { exact: true });
1061
1067
  if (matches.length === 0) {
1062
1068
  return ssrRenderSinglePass(module, normalizedUrl, fallbackOptions);
1063
1069
  }
@@ -1076,6 +1082,12 @@ async function ssrRenderAot(module, url, options) {
1076
1082
  await prefetchForAot(aotEntry.queryKeys, manifest.routeEntries, match, apiClient, ssrTimeout, queryCache);
1077
1083
  }
1078
1084
  }
1085
+ if (aotEntry.queryKeys && aotEntry.queryKeys.length > 0) {
1086
+ const allKeysResolved = aotEntry.queryKeys.every((k) => queryCache.has(k));
1087
+ if (!allKeysResolved) {
1088
+ return ssrRenderSinglePass(module, normalizedUrl, fallbackOptions);
1089
+ }
1090
+ }
1079
1091
  try {
1080
1092
  setGlobalSSRTimeout(ssrTimeout);
1081
1093
  const holes = createHoles(aotEntry.holes, module, normalizedUrl, queryCache, options.ssrAuth);
@@ -10,7 +10,7 @@ import {
10
10
  ssrRenderSinglePass,
11
11
  ssrStreamNavQueries,
12
12
  toPrefetchSession
13
- } from "./chunk-hx7drzm3.js";
13
+ } from "./chunk-bggdy77b.js";
14
14
 
15
15
  // src/node-handler.ts
16
16
  function createNodeHandler(options) {
@@ -11,7 +11,7 @@ import {
11
11
  ssrRenderSinglePass,
12
12
  ssrStreamNavQueries,
13
13
  toPrefetchSession
14
- } from "./chunk-hx7drzm3.js";
14
+ } from "./chunk-bggdy77b.js";
15
15
 
16
16
  // src/aot-manifest-loader.ts
17
17
  import { existsSync, readFileSync } from "node:fs";
package/dist/ssr/index.js CHANGED
@@ -1,12 +1,12 @@
1
1
  import {
2
2
  createSSRHandler,
3
3
  loadAotManifest
4
- } from "../shared/chunk-2kx402c1.js";
4
+ } from "../shared/chunk-tqa618t8.js";
5
5
  import {
6
6
  injectIntoTemplate,
7
7
  ssrDiscoverQueries,
8
8
  ssrRenderToString
9
- } from "../shared/chunk-hx7drzm3.js";
9
+ } from "../shared/chunk-bggdy77b.js";
10
10
  import"../shared/chunk-ybftdw1r.js";
11
11
  // src/prerender.ts
12
12
  async function discoverRoutes(module) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/ui-server",
3
- "version": "0.2.34",
3
+ "version": "0.2.35",
4
4
  "description": "Vertz UI server-side rendering runtime",
5
5
  "license": "MIT",
6
6
  "repository": {