@vertz/ui-server 0.2.15 → 0.2.17

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.
@@ -1,6 +1,6 @@
1
1
  type ErrorCategory = "build" | "resolve" | "runtime" | "ssr";
2
2
  import { CSSExtractionResult } from "@vertz/ui-compiler";
3
- type DebugCategory = "manifest" | "plugin" | "ssr" | "watcher" | "ws";
3
+ type DebugCategory = "fields" | "manifest" | "plugin" | "ssr" | "watcher" | "ws";
4
4
  interface DebugLogger {
5
5
  log(category: DebugCategory, message: string, data?: Record<string, unknown>): void;
6
6
  isEnabled(category: DebugCategory): boolean;
@@ -39,6 +39,10 @@ interface DiagnosticsSnapshot {
39
39
  type: string;
40
40
  message: string;
41
41
  }[];
42
+ hmrUpdateCount: number;
43
+ lastHmrUpdate: string | null;
44
+ lastHmrFile: string | null;
45
+ lastHmrChanged: boolean | null;
42
46
  };
43
47
  errors: {
44
48
  current: ErrorCategory | null;
@@ -53,6 +57,27 @@ interface DiagnosticsSnapshot {
53
57
  lastChangeTime: string | null;
54
58
  };
55
59
  runtimeErrors: RuntimeErrorEntry[];
60
+ fieldSelection: {
61
+ manifestFileCount: number;
62
+ entries: Record<string, FieldSelectionDiagEntry>;
63
+ misses: FieldMissEntry[];
64
+ };
65
+ }
66
+ interface FieldMissEntry {
67
+ type: string;
68
+ id: string;
69
+ field: string;
70
+ querySource: string;
71
+ timestamp: string;
72
+ }
73
+ interface FieldSelectionDiagEntry {
74
+ queries: {
75
+ queryVar: string;
76
+ fields: string[];
77
+ hasOpaqueAccess: boolean;
78
+ crossFileFields: string[];
79
+ injected: boolean;
80
+ }[];
56
81
  }
57
82
  declare class DiagnosticsCollector {
58
83
  private startTime;
@@ -72,6 +97,10 @@ declare class DiagnosticsCollector {
72
97
  private manifestFileCount;
73
98
  private manifestDurationMs;
74
99
  private manifestWarnings;
100
+ private manifestHmrUpdateCount;
101
+ private manifestLastHmrUpdate;
102
+ private manifestLastHmrFile;
103
+ private manifestLastHmrChanged;
75
104
  private errorCurrent;
76
105
  private errorLastCategory;
77
106
  private errorLastMessage;
@@ -80,6 +109,10 @@ declare class DiagnosticsCollector {
80
109
  private watcherLastChangeTime;
81
110
  private static readonly MAX_RUNTIME_ERRORS;
82
111
  private runtimeErrorsBuffer;
112
+ private fieldSelectionManifestFileCount;
113
+ private fieldSelectionEntries;
114
+ private static readonly MAX_FIELD_MISSES;
115
+ private fieldMissesBuffer;
83
116
  recordPluginConfig(filter: string, hmr: boolean, fastRefresh: boolean): void;
84
117
  recordPluginProcess(file: string): void;
85
118
  recordSSRReload(success: boolean, durationMs: number, error?: string): void;
@@ -87,6 +120,7 @@ declare class DiagnosticsCollector {
87
120
  type: string;
88
121
  message: string;
89
122
  }[]): void;
123
+ recordManifestUpdate(file: string, changed: boolean, _durationMs: number): void;
90
124
  recordHMRAssets(bundledScriptUrl: string | null, bootstrapDiscovered: boolean): void;
91
125
  recordError(category: ErrorCategory, message: string): void;
92
126
  recordErrorClear(): void;
@@ -94,6 +128,9 @@ declare class DiagnosticsCollector {
94
128
  recordFileChange(file: string): void;
95
129
  recordRuntimeError(message: string, source: string | null): void;
96
130
  clearRuntimeErrors(): void;
131
+ recordFieldSelectionManifest(fileCount: number): void;
132
+ recordFieldSelection(file: string, entry: FieldSelectionDiagEntry): void;
133
+ recordFieldMiss(type: string, id: string, field: string, querySource: string): void;
97
134
  getSnapshot(): DiagnosticsSnapshot;
98
135
  }
99
136
  import { BunPlugin as BunPlugin_seob6 } from "bun";
@@ -124,11 +161,30 @@ interface VertzBunPluginOptions {
124
161
  logger?: DebugLogger;
125
162
  /** Diagnostics collector for the health check endpoint. */
126
163
  diagnostics?: DiagnosticsCollector;
164
+ /**
165
+ * Path to entity-schema.json from codegen.
166
+ * When provided, enables relation-aware field selection injection
167
+ * (include for relations, hidden field filtering, custom primary keys).
168
+ * Defaults to `<projectRoot>/.vertz/generated/entity-schema.json`.
169
+ */
170
+ entitySchemaPath?: string;
171
+ /**
172
+ * Auto-split route component factories into lazy imports for code splitting.
173
+ * When true, `defineRoutes()` component factories referencing static imports
174
+ * are rewritten to `import()` calls at build time.
175
+ * Defaults to false (enabled explicitly for production client builds).
176
+ */
177
+ routeSplitting?: boolean;
127
178
  }
128
179
  /** CSS extractions tracked across all transformed files (for dead CSS elimination). */
129
180
  type FileExtractionsMap = Map<string, CSSExtractionResult>;
130
181
  /** Map of source file path to CSS sidecar file path (for debugging). */
131
182
  type CSSSidecarMap = Map<string, string>;
183
+ /** Result of updating a single file's manifest during HMR. */
184
+ interface ManifestUpdateResult {
185
+ /** Whether the manifest's reactivity shape changed compared to the previous version. */
186
+ changed: boolean;
187
+ }
132
188
  interface VertzBunPluginResult {
133
189
  /** The Bun plugin to pass to Bun.build or bunfig.toml. */
134
190
  plugin: BunPlugin_seob6;
@@ -136,6 +192,22 @@ interface VertzBunPluginResult {
136
192
  fileExtractions: FileExtractionsMap;
137
193
  /** Map of source file to CSS sidecar file path (for debugging). */
138
194
  cssSidecarMap: CSSSidecarMap;
195
+ /**
196
+ * Regenerate a single file's manifest during HMR.
197
+ * Returns whether the manifest shape changed (triggering cache invalidation).
198
+ */
199
+ updateManifest(filePath: string, sourceText: string): ManifestUpdateResult;
200
+ /**
201
+ * Remove a file's manifest when the file is deleted.
202
+ * Returns whether the file had a manifest entry.
203
+ */
204
+ deleteManifest(filePath: string): boolean;
205
+ /**
206
+ * Reload the entity schema manifest from disk.
207
+ * Call this when entity-schema.json changes (e.g., after codegen re-runs).
208
+ * Returns whether the schema changed.
209
+ */
210
+ reloadEntitySchema(): boolean;
139
211
  }
140
212
  /**
141
213
  * Create a Vertz Bun plugin with CSS sidecar support and optional Fast Refresh.