@vertz/ui-server 0.2.23 → 0.2.25

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.
@@ -3,6 +3,7 @@ import { setAdapter } from "@vertz/ui/internals";
3
3
 
4
4
  // src/dom-shim/ssr-node.ts
5
5
  class SSRNode {
6
+ nodeType = 1;
6
7
  childNodes = [];
7
8
  parentNode = null;
8
9
  get firstChild() {
@@ -48,6 +49,7 @@ class SSRNode {
48
49
 
49
50
  // src/dom-shim/ssr-comment.ts
50
51
  class SSRComment extends SSRNode {
52
+ nodeType = 8;
51
53
  text;
52
54
  constructor(text) {
53
55
  super();
@@ -71,6 +73,7 @@ function rawHtml(html) {
71
73
 
72
74
  // src/dom-shim/ssr-text-node.ts
73
75
  class SSRTextNode extends SSRNode {
76
+ nodeType = 3;
74
77
  text;
75
78
  constructor(text) {
76
79
  super();
@@ -86,6 +89,7 @@ class SSRTextNode extends SSRNode {
86
89
 
87
90
  // src/dom-shim/ssr-fragment.ts
88
91
  class SSRDocumentFragment extends SSRNode {
92
+ nodeType = 11;
89
93
  children = [];
90
94
  appendChild(child) {
91
95
  if (child instanceof SSRTextNode) {
@@ -568,19 +572,35 @@ function installDomShim() {
568
572
  cookie: ""
569
573
  };
570
574
  globalThis.document = fakeDocument;
575
+ const windowStubs = {
576
+ scrollTo: () => {},
577
+ scroll: () => {},
578
+ addEventListener: () => {},
579
+ removeEventListener: () => {},
580
+ dispatchEvent: () => true,
581
+ getComputedStyle: () => ({}),
582
+ matchMedia: () => ({ matches: false, addListener: () => {}, removeListener: () => {} })
583
+ };
571
584
  if (typeof window === "undefined") {
572
585
  globalThis.window = {
573
586
  location: { pathname: ssrStorage.getStore()?.url || "/", search: "", hash: "" },
574
587
  history: {
575
588
  pushState: () => {},
576
589
  replaceState: () => {}
577
- }
590
+ },
591
+ ...windowStubs
578
592
  };
579
593
  } else {
580
- globalThis.window.location = {
581
- ...globalThis.window.location || {},
594
+ const win = globalThis.window;
595
+ win.location = {
596
+ ...win.location || {},
582
597
  pathname: ssrStorage.getStore()?.url || "/"
583
598
  };
599
+ for (const [key, val] of Object.entries(windowStubs)) {
600
+ if (typeof win[key] !== "function") {
601
+ win[key] = val;
602
+ }
603
+ }
584
604
  }
585
605
  globalThis.Node = SSRNode;
586
606
  globalThis.HTMLElement = SSRElement;
@@ -6,7 +6,7 @@ import {
6
6
  setGlobalSSRTimeout,
7
7
  ssrStorage,
8
8
  toVNode
9
- } from "./chunk-bm16zy8d.js";
9
+ } from "./chunk-gcwqkynf.js";
10
10
 
11
11
  // src/html-serializer.ts
12
12
  var VOID_ELEMENTS = new Set([
@@ -51,6 +51,9 @@ function serializeToHtml(node) {
51
51
  return node.html;
52
52
  }
53
53
  const { tag, attrs, children } = node;
54
+ if (tag === "fragment") {
55
+ return children.map((child) => serializeToHtml(child)).join("");
56
+ }
54
57
  const attrStr = serializeAttrs(attrs);
55
58
  if (VOID_ELEMENTS.has(tag)) {
56
59
  return `<${tag}${attrStr}>`;
@@ -141,6 +144,9 @@ function renderToStream(tree, options) {
141
144
  return serializeToHtml(placeholder);
142
145
  }
143
146
  const { tag, attrs, children } = node;
147
+ if (tag === "fragment") {
148
+ return children.map((child) => walkAndSerialize(child)).join("");
149
+ }
144
150
  const isRawText = RAW_TEXT_ELEMENTS.has(tag);
145
151
  const attrStr = Object.entries(attrs).map(([k, v]) => ` ${k}="${escapeAttr(v)}"`).join("");
146
152
  if (VOID_ELEMENTS.has(tag)) {
@@ -17,6 +17,8 @@ interface SSRModule {
17
17
  getInjectedCSS?: () => string[];
18
18
  /** Compiled routes exported from the app for build-time SSG with generateParams. */
19
19
  routes?: CompiledRoute[];
20
+ /** Code-generated API client for manifest-driven zero-discovery prefetching. */
21
+ api?: Record<string, Record<string, (...args: unknown[]) => unknown>>;
20
22
  }
21
23
  interface SSRRenderResult {
22
24
  html: string;
package/dist/ssr/index.js CHANGED
@@ -3,8 +3,8 @@ import {
3
3
  injectIntoTemplate,
4
4
  ssrDiscoverQueries,
5
5
  ssrRenderToString
6
- } from "../shared/chunk-5cny4vzm.js";
7
- import"../shared/chunk-bm16zy8d.js";
6
+ } from "../shared/chunk-yr65qdge.js";
7
+ import"../shared/chunk-gcwqkynf.js";
8
8
 
9
9
  // src/prerender.ts
10
10
  async function discoverRoutes(module) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@vertz/ui-server",
3
- "version": "0.2.23",
3
+ "version": "0.2.25",
4
4
  "type": "module",
5
5
  "license": "MIT",
6
6
  "description": "Vertz UI server-side rendering runtime",
@@ -58,15 +58,15 @@
58
58
  "@ampproject/remapping": "^2.3.0",
59
59
  "@capsizecss/unpack": "^4.0.0",
60
60
  "@jridgewell/trace-mapping": "^0.3.31",
61
- "@vertz/core": "^0.2.22",
62
- "@vertz/ui": "^0.2.22",
63
- "@vertz/ui-compiler": "^0.2.22",
61
+ "@vertz/core": "^0.2.24",
62
+ "@vertz/ui": "^0.2.24",
63
+ "@vertz/ui-compiler": "^0.2.24",
64
64
  "magic-string": "^0.30.0",
65
65
  "sharp": "^0.34.5",
66
66
  "ts-morph": "^27.0.2"
67
67
  },
68
68
  "devDependencies": {
69
- "@vertz/codegen": "^0.2.22",
69
+ "@vertz/codegen": "^0.2.24",
70
70
  "@vertz/ui-auth": "^0.2.19",
71
71
  "bun-types": "^1.3.10",
72
72
  "bunup": "^0.16.31",