@jay-framework/production-server 0.17.2 → 0.17.4
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.
- package/dist/index.d.ts +100 -5
- package/dist/index.js +987 -251
- package/package.json +12 -12
package/dist/index.d.ts
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
import * as _jay_framework_ssr_runtime from '@jay-framework/ssr-runtime';
|
|
2
|
+
import { ActionRegistry } from '@jay-framework/stack-server-runtime';
|
|
2
3
|
|
|
3
4
|
interface RouteManifest {
|
|
4
5
|
version: number;
|
|
5
6
|
buildTimestamp: string;
|
|
6
7
|
sourceHash: string;
|
|
7
|
-
publicBasePath: string;
|
|
8
8
|
projectRoot: string;
|
|
9
9
|
sharedManifest: Record<string, string>;
|
|
10
10
|
routes: RouteEntry[];
|
|
@@ -19,7 +19,6 @@ interface RouteEntry {
|
|
|
19
19
|
pattern: string;
|
|
20
20
|
segments: RouteSegment[];
|
|
21
21
|
serverModule: string;
|
|
22
|
-
jayHtmlPath?: string;
|
|
23
22
|
trackByMap?: Record<string, string>;
|
|
24
23
|
contracts?: string[];
|
|
25
24
|
componentExport?: string;
|
|
@@ -61,7 +60,6 @@ interface BuildOptions {
|
|
|
61
60
|
projectRoot: string;
|
|
62
61
|
pagesRoot: string;
|
|
63
62
|
buildRoot: string;
|
|
64
|
-
publicBasePath: string;
|
|
65
63
|
concurrency: number;
|
|
66
64
|
tsConfigFilePath: string;
|
|
67
65
|
minify?: boolean;
|
|
@@ -79,8 +77,105 @@ interface MainServerOptions {
|
|
|
79
77
|
buildRoot: string;
|
|
80
78
|
version: number;
|
|
81
79
|
port: number;
|
|
82
|
-
publicBasePath
|
|
80
|
+
publicBasePath?: string;
|
|
81
|
+
serveStatic?: boolean;
|
|
82
|
+
testMode?: boolean;
|
|
83
83
|
}
|
|
84
84
|
declare function startMainServer(options: MainServerOptions): Promise<void>;
|
|
85
85
|
|
|
86
|
-
|
|
86
|
+
interface RendererServerOptions {
|
|
87
|
+
buildRoot: string;
|
|
88
|
+
version: number;
|
|
89
|
+
port: number;
|
|
90
|
+
projectRoot: string;
|
|
91
|
+
pagesRoot: string;
|
|
92
|
+
tsConfigFilePath?: string;
|
|
93
|
+
minify?: boolean;
|
|
94
|
+
}
|
|
95
|
+
declare function startRendererServer(options: RendererServerOptions): Promise<void>;
|
|
96
|
+
|
|
97
|
+
type RebuildTarget = {
|
|
98
|
+
mode: 'contract';
|
|
99
|
+
contractName: string;
|
|
100
|
+
params?: Record<string, string>;
|
|
101
|
+
} | {
|
|
102
|
+
mode: 'route';
|
|
103
|
+
routePattern: string;
|
|
104
|
+
params?: Record<string, string>;
|
|
105
|
+
} | {
|
|
106
|
+
mode: 'url';
|
|
107
|
+
url: string;
|
|
108
|
+
};
|
|
109
|
+
interface RebuildOptions {
|
|
110
|
+
projectRoot: string;
|
|
111
|
+
pagesRoot: string;
|
|
112
|
+
buildRoot: string;
|
|
113
|
+
version: number;
|
|
114
|
+
target: RebuildTarget;
|
|
115
|
+
tsConfigFilePath?: string;
|
|
116
|
+
minify?: boolean;
|
|
117
|
+
}
|
|
118
|
+
interface RebuildResult {
|
|
119
|
+
affected: number;
|
|
120
|
+
rebuilt: number;
|
|
121
|
+
errors: Array<{
|
|
122
|
+
route: string;
|
|
123
|
+
params?: Record<string, string>;
|
|
124
|
+
error: string;
|
|
125
|
+
}>;
|
|
126
|
+
}
|
|
127
|
+
declare function resolveContractToRoutes(manifest: RouteManifest, contractName: string): RouteEntry[];
|
|
128
|
+
declare function rebuild(options: RebuildOptions): Promise<RebuildResult>;
|
|
129
|
+
/** Convenience wrapper for contract-based rebuild (used by renderer server webhooks). */
|
|
130
|
+
declare function rebuildContract(options: {
|
|
131
|
+
projectRoot: string;
|
|
132
|
+
pagesRoot: string;
|
|
133
|
+
buildRoot: string;
|
|
134
|
+
version: number;
|
|
135
|
+
contractName: string;
|
|
136
|
+
params?: Record<string, string>;
|
|
137
|
+
tsConfigFilePath?: string;
|
|
138
|
+
minify?: boolean;
|
|
139
|
+
}): Promise<RebuildResult>;
|
|
140
|
+
declare function cleanupOrphanedFiles(buildRoot: string, version: number): Promise<number>;
|
|
141
|
+
|
|
142
|
+
declare class FilesystemArtifactStore {
|
|
143
|
+
private basePath;
|
|
144
|
+
private manifestCache?;
|
|
145
|
+
private metadataMtime?;
|
|
146
|
+
private moduleCache;
|
|
147
|
+
constructor(basePath: string);
|
|
148
|
+
readManifest(): Promise<RouteManifest>;
|
|
149
|
+
readPreRenderedHtml(relativePath: string): Promise<PreRenderedEntry>;
|
|
150
|
+
loadServerElement(relativePath: string): Promise<ServerElementModule>;
|
|
151
|
+
loadPageModule(relativePath: string): Promise<PageModule>;
|
|
152
|
+
readRawFile(relativePath: string): Promise<string>;
|
|
153
|
+
getAssetPath(relativePath: string): string;
|
|
154
|
+
getBuildDir(): string;
|
|
155
|
+
private loadModule;
|
|
156
|
+
}
|
|
157
|
+
|
|
158
|
+
interface MatchResult {
|
|
159
|
+
route: RouteEntry;
|
|
160
|
+
instance: InstanceEntry;
|
|
161
|
+
params: Record<string, string>;
|
|
162
|
+
pathname: string;
|
|
163
|
+
}
|
|
164
|
+
declare function matchRequest(manifest: RouteManifest, pathname: string): MatchResult | undefined;
|
|
165
|
+
|
|
166
|
+
declare function fetchPageRequest(match: MatchResult, manifest: RouteManifest, requestUrl: URL, artifacts: FilesystemArtifactStore, staticBaseUrl: string, cookies?: Record<string, string>): Promise<Response>;
|
|
167
|
+
|
|
168
|
+
declare function isActionRequest(pathname: string): boolean;
|
|
169
|
+
declare function fetchActionRequest(request: Request, registry?: ActionRegistry): Promise<Response>;
|
|
170
|
+
declare function registerActionsFromManifest(actions: Array<{
|
|
171
|
+
serverModule: string;
|
|
172
|
+
isPlugin: boolean;
|
|
173
|
+
actionNames: string[];
|
|
174
|
+
packageName?: string;
|
|
175
|
+
}>, buildDir: string, registry?: ActionRegistry): Promise<void>;
|
|
176
|
+
|
|
177
|
+
declare function fetchStaticFile(pathname: string, frontendDir: string): Promise<Response | null>;
|
|
178
|
+
|
|
179
|
+
declare function initializeServices(buildDir: string, projectRoot: string, label: string): Promise<void>;
|
|
180
|
+
|
|
181
|
+
export { type ActionEntry, type BuildMetadata, type BuildOptions, FilesystemArtifactStore, type InstanceEntry, type MatchResult, type PageModule, type PluginEntry, type PreRenderedEntry, type RebuildOptions, type RebuildResult, type RebuildTarget, type RendererServerOptions, type RouteEntry, type RouteManifest, type RouteSegment, type ServerElementModule, buildVersion, cleanupOrphanedFiles, fetchActionRequest, fetchPageRequest, fetchStaticFile, initializeServices, isActionRequest, matchRequest, rebuild, rebuildContract, registerActionsFromManifest, resolveContractToRoutes, startMainServer, startRendererServer };
|