@jay-framework/production-server 0.25.5 → 0.26.0

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,260 +0,0 @@
1
- import * as _jay_framework_ssr_runtime from '@jay-framework/ssr-runtime';
2
- import { JayHtmlHeadMeta, JayHtmlScript, DevServerPagePart, HeadlessInstanceComponent, ForEachHeadlessInstance, ActionRegistry } from '@jay-framework/stack-server-runtime';
3
- import { HeadTag } from '@jay-framework/fullstack-component';
4
-
5
- interface RouteManifest {
6
- version: string;
7
- projectRoot: string;
8
- sharedManifest: Record<string, string>;
9
- routes: RouteEntry[];
10
- actions: ActionEntry[];
11
- plugins: PluginEntry[];
12
- /**
13
- * Site-level JSON-LD (Organization + WebSite) head tags, generated once at build from
14
- * `.jay` `site` config and injected into every served page's `<head>` (DL#213). Empty/absent
15
- * when `site.name` is not configured.
16
- */
17
- siteHeadTags?: HeadTag[];
18
- /**
19
- * Compiled error pages keyed by status token (`"404"`, `"502"`, `"5xx"`, …) (DL#218).
20
- * Resolved by status (exact → family), never by URL — kept out of `routes[]` so they are
21
- * non-navigable and excluded from sitemap/llms.txt/robots/internal-link validation.
22
- */
23
- errorPages?: Record<string, ErrorPageEntry>;
24
- }
25
- /**
26
- * A compiled error page (DL#218). Mirrors the per-route compiled refs of a single-instance
27
- * route, minus URL/param machinery: an error page is resolved by status, not by matching a URL.
28
- */
29
- interface ErrorPageEntry {
30
- /** Status token this page serves — exact (`"404"`, `"502"`) or family (`"4xx"`, `"5xx"`). */
31
- token: string;
32
- /** Per-page server element path (relative to backend dir). */
33
- serverElementPath: string;
34
- /** Per-page CSS file path (relative to frontend dir). */
35
- routeCssPath?: string;
36
- /** Per-page hydrate script path (relative to frontend dir). */
37
- routeHydratePath?: string;
38
- /** Per-page client bundle path (relative to frontend dir). */
39
- routeClientBundlePath?: string;
40
- /** External @import URLs extracted from CSS at build time. */
41
- cssImports?: string[];
42
- /** Head metadata from the error page's jay-html <head>. */
43
- headMeta?: JayHtmlHeadMeta;
44
- /** Passthrough `<script jay-script="allow">` tags from the template. */
45
- scripts?: JayHtmlScript[];
46
- /** Shared chunk package names this page's hydrate/client bundle imports (DL#177). */
47
- sharedDeps?: string[];
48
- /** trackBy map threaded to the client hydration entry. */
49
- trackByMap?: Record<string, string>;
50
- /**
51
- * Optional pre-rendered slow (static chrome) ViewState. Unused in v1 — an error page is a
52
- * pass-through of the injected `error` ViewState (DL#218 Q6); its static chrome renders
53
- * from the template without slow data. The renderer merges `slowCache?.slowViewState ?? {}`.
54
- */
55
- slowCache?: CacheEntry;
56
- }
57
- interface RouteSegment {
58
- type: 'static' | 'param' | 'optional' | 'catchAll' | 'optionalCatchAll';
59
- value: string;
60
- }
61
- interface RouteEntry {
62
- pattern: string;
63
- segments: RouteSegment[];
64
- serverModule: string;
65
- trackByMap?: Record<string, string>;
66
- contracts?: string[];
67
- componentExport?: string;
68
- /** Per-route server element path (DL#144). Shared across all instances. */
69
- serverElementPath?: string;
70
- /** Per-route CSS file path (DL#144). Extracted from route-level server element compilation. */
71
- routeCssPath?: string;
72
- /** Per-route hydrate script path (DL#144). Shared across all instances. */
73
- routeHydratePath?: string;
74
- /** Per-route client bundle path (DL#144). Entry that imports route hydrate script. */
75
- routeClientBundlePath?: string;
76
- /** External @import URLs extracted from CSS at build time (DL#146). Used for preload hints. */
77
- cssImports?: string[];
78
- /** Head metadata from jay-html <head> (title, meta tags). */
79
- headMeta?: JayHtmlHeadMeta;
80
- /** Passthrough `<script jay-script="allow">` tags from the jay-html template (DL#149 Phase 2). */
81
- scripts?: JayHtmlScript[];
82
- /** True when page has static <meta name="robots" content="noindex"> */
83
- noIndex?: boolean;
84
- instances: InstanceEntry[];
85
- isPlugin?: boolean;
86
- pluginName?: string;
87
- /** Shared chunk package names this route's hydrate script imports (DL#177). */
88
- sharedDeps?: string[];
89
- /** When true, dev-server tooling route (future: excluded from production builds). */
90
- devOnly?: boolean;
91
- }
92
- interface InstanceEntry {
93
- params: Record<string, string>;
94
- cachePath: string;
95
- serverElementPath: string;
96
- clientBundlePath: string;
97
- clientCssPath?: string;
98
- }
99
- interface CacheEntry {
100
- slowViewState: object;
101
- carryForward: object;
102
- }
103
- interface ActionEntry {
104
- serverModule: string;
105
- packageName?: string;
106
- isPlugin: boolean;
107
- actionNames: string[];
108
- }
109
- interface PluginEntry {
110
- name: string;
111
- packageName: string;
112
- }
113
- interface BuildMetadata {
114
- version: string;
115
- sourceHash: string;
116
- buildTimestamp: string;
117
- nodeVersion: string;
118
- instanceCount: number;
119
- }
120
- interface BuildOptions {
121
- version: string;
122
- projectRoot: string;
123
- pagesRoot: string;
124
- buildRoot: string;
125
- concurrency: number;
126
- tsConfigFilePath: string;
127
- minify?: boolean;
128
- /** Site base URL for sitemap generation (e.g. "https://example.com"). */
129
- siteBaseUrl?: string;
130
- /** Site identity for Organization + WebSite JSON-LD generation (DL#213). */
131
- site?: {
132
- name?: string;
133
- baseUrl?: string;
134
- logo?: string;
135
- description?: string;
136
- sameAs?: string[];
137
- };
138
- }
139
- interface ServerElementModule {
140
- renderToStream: (vs: object, ctx: _jay_framework_ssr_runtime.ServerRenderContext) => void;
141
- }
142
- interface PageModule {
143
- [key: string]: any;
144
- }
145
-
146
- interface PagePartsConfigEntry {
147
- modulePath: string;
148
- exportName: string;
149
- source: 'local' | 'npm';
150
- structural?: boolean;
151
- }
152
- interface PagePartsConfig {
153
- parts: Array<PagePartsConfigEntry & {
154
- key?: string;
155
- contractInfo?: {
156
- contractName: string;
157
- metadata?: Record<string, unknown>;
158
- };
159
- headlessProps?: Record<string, string>;
160
- }>;
161
- instanceComponents: Array<PagePartsConfigEntry & {
162
- contractName: string;
163
- propNames: string[];
164
- structuralTags?: Array<{
165
- name: string;
166
- phase?: string;
167
- }>;
168
- }>;
169
- forEachInstances: Array<{
170
- contractName: string;
171
- forEachPath: string;
172
- trackBy: string;
173
- propBindings: Record<string, string>;
174
- coordinateSuffix: string;
175
- }>;
176
- }
177
- interface ProductionPageParts {
178
- parts: DevServerPagePart[];
179
- headlessContracts: any[];
180
- headlessInstanceComponents: HeadlessInstanceComponent[];
181
- discoveredInstances: any[];
182
- forEachInstances: ForEachHeadlessInstance[];
183
- keyedPartModules: any[];
184
- headlessModuleInfos: any[];
185
- }
186
- declare function loadPagePartsFromConfig(configPath: string, artifacts: ArtifactStore): Promise<ProductionPageParts>;
187
-
188
- /**
189
- * Interface for reading build artifacts at serve time (DL#143).
190
- * FilesystemArtifactStore is the default implementation.
191
- * BaaS deployments provide a custom implementation that fetches from cloud storage.
192
- */
193
- interface ArtifactStore {
194
- readManifest(): Promise<RouteManifest>;
195
- readCacheData(relativePath: string): Promise<CacheEntry>;
196
- readPagePartsConfig(relativePath: string): Promise<PagePartsConfig>;
197
- loadServerElement(relativePath: string): Promise<ServerElementModule>;
198
- loadModule(modulePath: string, local?: boolean): Promise<any>;
199
- getAssetPath(relativePath: string): string;
200
- getBuildDir(): string;
201
- }
202
- declare class FilesystemArtifactStore implements ArtifactStore {
203
- private basePath;
204
- private manifestCache?;
205
- private metadataMtime?;
206
- private moduleCache;
207
- constructor(basePath: string);
208
- readManifest(): Promise<RouteManifest>;
209
- readCacheData(relativePath: string): Promise<CacheEntry>;
210
- readPagePartsConfig(relativePath: string): Promise<PagePartsConfig>;
211
- loadServerElement(relativePath: string): Promise<ServerElementModule>;
212
- getAssetPath(relativePath: string): string;
213
- getBuildDir(): string;
214
- loadModule(modulePath: string, local?: boolean): Promise<any>;
215
- }
216
-
217
- interface MatchResult {
218
- route: RouteEntry;
219
- instance: InstanceEntry;
220
- params: Record<string, string>;
221
- pathname: string;
222
- }
223
- declare function matchRequest(manifest: RouteManifest, pathname: string): MatchResult | undefined;
224
-
225
- declare function fetchPageRequest(match: MatchResult, manifest: RouteManifest, requestUrl: URL, artifacts: ArtifactStore, staticBaseUrl: string, cookies?: Record<string, string>): Promise<Response>;
226
-
227
- declare function isActionRequest(pathname: string): boolean;
228
- declare function fetchActionRequest(request: Request, registry?: ActionRegistry): Promise<Response>;
229
- declare function registerActionsFromManifest(actions: Array<{
230
- serverModule: string;
231
- isPlugin: boolean;
232
- actionNames: string[];
233
- packageName?: string;
234
- }>, buildDir: string, registry?: ActionRegistry): Promise<void>;
235
- /**
236
- * Register actions from pre-imported modules (DL#143).
237
- * Used by BaaS entry.mjs where action modules are bundled by esbuild.
238
- */
239
- declare function registerActionsFromModules(modules: Array<{
240
- module: Record<string, unknown>;
241
- name: string;
242
- }>, registry?: ActionRegistry): Promise<void>;
243
-
244
- declare function fetchStaticFile(pathname: string, frontendDir: string): Promise<Response | null>;
245
-
246
- interface PreImportedPlugin {
247
- name: string;
248
- init: {
249
- _serverInit: () => Promise<any>;
250
- };
251
- }
252
- /**
253
- * Initialize services from pre-imported plugin modules (DL#143).
254
- * Used by BaaS entry.mjs where plugins are bundled by esbuild
255
- * and cannot be discovered from the filesystem at runtime.
256
- */
257
- declare function initializeServicesFromModules(plugins: PreImportedPlugin[], label: string): Promise<void>;
258
- declare function initializeServices(buildDir: string, projectRoot: string, label: string): Promise<void>;
259
-
260
- export { type ArtifactStore as A, type BuildMetadata as B, type CacheEntry as C, type ErrorPageEntry as E, FilesystemArtifactStore as F, type InstanceEntry as I, type MatchResult as M, type PageModule as P, type RouteManifest as R, type ServerElementModule as S, type RouteEntry as a, type ActionEntry as b, type BuildOptions as c, type PluginEntry as d, type PreImportedPlugin as e, type RouteSegment as f, fetchActionRequest as g, fetchPageRequest as h, fetchStaticFile as i, initializeServices as j, initializeServicesFromModules as k, isActionRequest as l, loadPagePartsFromConfig as m, matchRequest as n, registerActionsFromModules as o, registerActionsFromManifest as r };