@jay-framework/production-server 0.17.4 → 0.18.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.
@@ -0,0 +1,179 @@
1
+ import * as _jay_framework_ssr_runtime from '@jay-framework/ssr-runtime';
2
+ import { ActionRegistry } from '@jay-framework/stack-server-runtime';
3
+
4
+ interface RouteManifest {
5
+ version: string;
6
+ buildTimestamp: string;
7
+ sourceHash: string;
8
+ projectRoot: string;
9
+ sharedManifest: Record<string, string>;
10
+ routes: RouteEntry[];
11
+ actions: ActionEntry[];
12
+ plugins: PluginEntry[];
13
+ }
14
+ interface RouteSegment {
15
+ type: 'static' | 'param' | 'optional' | 'catchAll' | 'optionalCatchAll';
16
+ value: string;
17
+ }
18
+ interface RouteEntry {
19
+ pattern: string;
20
+ segments: RouteSegment[];
21
+ serverModule: string;
22
+ trackByMap?: Record<string, string>;
23
+ contracts?: string[];
24
+ componentExport?: string;
25
+ /** Per-route server element path (DL#144). Shared across all instances. */
26
+ serverElementPath?: string;
27
+ /** Per-route CSS file path (DL#144). Extracted from route-level server element compilation. */
28
+ routeCssPath?: string;
29
+ /** Per-route hydrate script path (DL#144). Shared across all instances. */
30
+ routeHydratePath?: string;
31
+ /** Per-route client bundle path (DL#144). Entry that imports route hydrate script. */
32
+ routeClientBundlePath?: string;
33
+ instances: InstanceEntry[];
34
+ isPlugin?: boolean;
35
+ pluginName?: string;
36
+ }
37
+ interface InstanceEntry {
38
+ params: Record<string, string>;
39
+ cachePath: string;
40
+ serverElementPath: string;
41
+ clientBundlePath: string;
42
+ clientCssPath?: string;
43
+ }
44
+ interface CacheEntry {
45
+ slowViewState: object;
46
+ carryForward: object;
47
+ }
48
+ interface ActionEntry {
49
+ serverModule: string;
50
+ packageName?: string;
51
+ isPlugin: boolean;
52
+ actionNames: string[];
53
+ }
54
+ interface PluginEntry {
55
+ name: string;
56
+ packageName: string;
57
+ }
58
+ interface BuildMetadata {
59
+ version: string;
60
+ sourceHash: string;
61
+ buildTimestamp: string;
62
+ nodeVersion: string;
63
+ instanceCount: number;
64
+ }
65
+ interface BuildOptions {
66
+ version: string;
67
+ projectRoot: string;
68
+ pagesRoot: string;
69
+ buildRoot: string;
70
+ concurrency: number;
71
+ tsConfigFilePath: string;
72
+ minify?: boolean;
73
+ }
74
+ interface ServerElementModule {
75
+ renderToStream: (vs: object, ctx: _jay_framework_ssr_runtime.ServerRenderContext) => void;
76
+ }
77
+ interface PageModule {
78
+ [key: string]: any;
79
+ }
80
+
81
+ interface PagePartsConfigEntry {
82
+ modulePath: string;
83
+ exportName: string;
84
+ source: 'npm' | 'local';
85
+ }
86
+ interface PagePartsConfig {
87
+ parts: Array<PagePartsConfigEntry & {
88
+ key?: string;
89
+ contractInfo?: {
90
+ contractName: string;
91
+ metadata?: Record<string, unknown>;
92
+ };
93
+ }>;
94
+ instanceComponents: Array<PagePartsConfigEntry & {
95
+ contractName: string;
96
+ propNames: string[];
97
+ }>;
98
+ forEachInstances: Array<{
99
+ contractName: string;
100
+ forEachPath: string;
101
+ trackBy: string;
102
+ propBindings: Record<string, string>;
103
+ coordinateSuffix: string;
104
+ }>;
105
+ }
106
+
107
+ /**
108
+ * Interface for reading build artifacts at serve time (DL#143).
109
+ * FilesystemArtifactStore is the default implementation.
110
+ * BaaS deployments provide a custom implementation that fetches from cloud storage.
111
+ */
112
+ interface ArtifactStore {
113
+ readManifest(): Promise<RouteManifest>;
114
+ readCacheData(relativePath: string): Promise<CacheEntry>;
115
+ readPagePartsConfig(relativePath: string): Promise<PagePartsConfig>;
116
+ loadServerElement(relativePath: string): Promise<ServerElementModule>;
117
+ loadModule(modulePath: string, local?: boolean): Promise<any>;
118
+ getAssetPath(relativePath: string): string;
119
+ getBuildDir(): string;
120
+ }
121
+ declare class FilesystemArtifactStore implements ArtifactStore {
122
+ private basePath;
123
+ private manifestCache?;
124
+ private metadataMtime?;
125
+ private moduleCache;
126
+ constructor(basePath: string);
127
+ readManifest(): Promise<RouteManifest>;
128
+ readCacheData(relativePath: string): Promise<CacheEntry>;
129
+ readPagePartsConfig(relativePath: string): Promise<PagePartsConfig>;
130
+ loadServerElement(relativePath: string): Promise<ServerElementModule>;
131
+ getAssetPath(relativePath: string): string;
132
+ getBuildDir(): string;
133
+ loadModule(modulePath: string, local?: boolean): Promise<any>;
134
+ }
135
+
136
+ interface MatchResult {
137
+ route: RouteEntry;
138
+ instance: InstanceEntry;
139
+ params: Record<string, string>;
140
+ pathname: string;
141
+ }
142
+ declare function matchRequest(manifest: RouteManifest, pathname: string): MatchResult | undefined;
143
+
144
+ declare function fetchPageRequest(match: MatchResult, manifest: RouteManifest, requestUrl: URL, artifacts: ArtifactStore, staticBaseUrl: string, cookies?: Record<string, string>): Promise<Response>;
145
+
146
+ declare function isActionRequest(pathname: string): boolean;
147
+ declare function fetchActionRequest(request: Request, registry?: ActionRegistry): Promise<Response>;
148
+ declare function registerActionsFromManifest(actions: Array<{
149
+ serverModule: string;
150
+ isPlugin: boolean;
151
+ actionNames: string[];
152
+ packageName?: string;
153
+ }>, buildDir: string, registry?: ActionRegistry): Promise<void>;
154
+ /**
155
+ * Register actions from pre-imported modules (DL#143).
156
+ * Used by BaaS entry.mjs where action modules are bundled by esbuild.
157
+ */
158
+ declare function registerActionsFromModules(modules: Array<{
159
+ module: Record<string, unknown>;
160
+ name: string;
161
+ }>, registry?: ActionRegistry): Promise<void>;
162
+
163
+ declare function fetchStaticFile(pathname: string, frontendDir: string): Promise<Response | null>;
164
+
165
+ interface PreImportedPlugin {
166
+ name: string;
167
+ init: {
168
+ _serverInit: () => Promise<any>;
169
+ };
170
+ }
171
+ /**
172
+ * Initialize services from pre-imported plugin modules (DL#143).
173
+ * Used by BaaS entry.mjs where plugins are bundled by esbuild
174
+ * and cannot be discovered from the filesystem at runtime.
175
+ */
176
+ declare function initializeServicesFromModules(plugins: PreImportedPlugin[], label: string): Promise<void>;
177
+ declare function initializeServices(buildDir: string, projectRoot: string, label: string): Promise<void>;
178
+
179
+ export { type ActionEntry as A, type BuildOptions as B, type CacheEntry as C, FilesystemArtifactStore as F, type InstanceEntry as I, type MatchResult as M, type PluginEntry as P, type RouteManifest as R, type ServerElementModule as S, type RouteEntry as a, type RouteSegment as b, type BuildMetadata as c, type PageModule as d, type ArtifactStore as e, fetchPageRequest as f, fetchActionRequest as g, registerActionsFromModules as h, isActionRequest as i, fetchStaticFile as j, initializeServices as k, initializeServicesFromModules as l, matchRequest as m, type PreImportedPlugin as n, registerActionsFromManifest as r };
@@ -0,0 +1,3 @@
1
+ export { e as ArtifactStore, C as CacheEntry, F as FilesystemArtifactStore, I as InstanceEntry, M as MatchResult, n as PreImportedPlugin, a as RouteEntry, R as RouteManifest, S as ServerElementModule, g as fetchActionRequest, f as fetchPageRequest, j as fetchStaticFile, k as initializeServices, l as initializeServicesFromModules, i as isActionRequest, m as matchRequest, r as registerActionsFromManifest, h as registerActionsFromModules } from './serve-index-9aAW1pbg.js';
2
+ import '@jay-framework/ssr-runtime';
3
+ import '@jay-framework/stack-server-runtime';
@@ -0,0 +1,23 @@
1
+ import { F, a, f, c, d, e, i, m, r, b } from "./init-services-BKVwxzYb.js";
2
+ import "node:fs/promises";
3
+ import "node:path";
4
+ import "@jay-framework/stack-server-runtime";
5
+ import "@jay-framework/view-state-merge";
6
+ import "@jay-framework/ssr-runtime";
7
+ import "node:module";
8
+ import "@jay-framework/logger";
9
+ import "@jay-framework/compiler-jay-html";
10
+ import "@jay-framework/compiler-shared";
11
+ import "@jay-framework/fullstack-component";
12
+ export {
13
+ F as FilesystemArtifactStore,
14
+ a as fetchActionRequest,
15
+ f as fetchPageRequest,
16
+ c as fetchStaticFile,
17
+ d as initializeServices,
18
+ e as initializeServicesFromModules,
19
+ i as isActionRequest,
20
+ m as matchRequest,
21
+ r as registerActionsFromManifest,
22
+ b as registerActionsFromModules
23
+ };
package/package.json CHANGED
@@ -1,9 +1,20 @@
1
1
  {
2
2
  "name": "@jay-framework/production-server",
3
- "version": "0.17.4",
3
+ "version": "0.18.0",
4
4
  "license": "Apache-2.0",
5
5
  "type": "module",
6
6
  "main": "dist/index.js",
7
+ "types": "dist/index.d.ts",
8
+ "exports": {
9
+ ".": {
10
+ "types": "./dist/index.d.ts",
11
+ "default": "./dist/index.js"
12
+ },
13
+ "./serve": {
14
+ "types": "./dist/serve-index.d.ts",
15
+ "default": "./dist/serve-index.js"
16
+ }
17
+ },
7
18
  "files": [
8
19
  "dist"
9
20
  ],
@@ -11,7 +22,7 @@
11
22
  "build": "npm run build:js && npm run build:types",
12
23
  "build:watch": "npm run build:js -- --watch & npm run build:types -- --watch",
13
24
  "build:js": "vite build",
14
- "build:types": "tsup lib/index.ts --dts-only --format esm",
25
+ "build:types": "tsup lib/index.ts lib/serve-index.ts --dts-only --format esm",
15
26
  "build:check-types": "tsc",
16
27
  "clean": "rimraf dist",
17
28
  "confirm": "npm run clean && npm run build && npm run build:check-types && npm run test",
@@ -19,20 +30,20 @@
19
30
  "test:watch": "vitest"
20
31
  },
21
32
  "dependencies": {
22
- "@jay-framework/compiler-jay-html": "^0.17.4",
23
- "@jay-framework/compiler-jay-stack": "^0.17.4",
24
- "@jay-framework/compiler-shared": "^0.17.4",
25
- "@jay-framework/fullstack-component": "^0.17.4",
26
- "@jay-framework/logger": "^0.17.4",
27
- "@jay-framework/ssr-runtime": "^0.17.4",
28
- "@jay-framework/stack-route-scanner": "^0.17.4",
29
- "@jay-framework/stack-server-runtime": "^0.17.4",
30
- "@jay-framework/view-state-merge": "^0.17.4",
31
- "@jay-framework/vite-plugin": "^0.17.4",
33
+ "@jay-framework/compiler-jay-html": "^0.18.0",
34
+ "@jay-framework/compiler-jay-stack": "^0.18.0",
35
+ "@jay-framework/compiler-shared": "^0.18.0",
36
+ "@jay-framework/fullstack-component": "^0.18.0",
37
+ "@jay-framework/logger": "^0.18.0",
38
+ "@jay-framework/ssr-runtime": "^0.18.0",
39
+ "@jay-framework/stack-route-scanner": "^0.18.0",
40
+ "@jay-framework/stack-server-runtime": "^0.18.0",
41
+ "@jay-framework/view-state-merge": "^0.18.0",
42
+ "@jay-framework/vite-plugin": "^0.18.0",
32
43
  "vite": "^5.0.11"
33
44
  },
34
45
  "devDependencies": {
35
- "@jay-framework/dev-environment": "^0.17.4",
46
+ "@jay-framework/dev-environment": "^0.18.0",
36
47
  "@types/node": "^22.15.21",
37
48
  "rimraf": "^5.0.5",
38
49
  "tsup": "^8.0.1",