@jay-framework/production-build 0.24.2
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 +210 -0
- package/dist/index.js +1592 -0
- package/package.json +45 -0
package/dist/index.d.ts
ADDED
|
@@ -0,0 +1,210 @@
|
|
|
1
|
+
import { BuildOptions, RouteManifest, InstanceEntry, RouteEntry, ActionEntry, PluginEntry } from '@jay-framework/production-server';
|
|
2
|
+
export * from '@jay-framework/production-server';
|
|
3
|
+
import { JayRollupConfig } from '@jay-framework/compiler-jay-stack';
|
|
4
|
+
import { JayRoute, JayRoutes } from '@jay-framework/stack-route-scanner';
|
|
5
|
+
import { JayHtmlHeadMeta } from '@jay-framework/compiler-shared';
|
|
6
|
+
import { HeadlessContractInfo, DiscoveredHeadlessInstance, ForEachHeadlessInstance } from '@jay-framework/compiler-jay-html';
|
|
7
|
+
import { DevServerPagePart, HeadlessInstanceComponent } from '@jay-framework/stack-server-runtime';
|
|
8
|
+
|
|
9
|
+
declare function buildVersion(options: BuildOptions): Promise<RouteManifest>;
|
|
10
|
+
|
|
11
|
+
interface ClientInitEntry {
|
|
12
|
+
modulePath: string;
|
|
13
|
+
exportName: string;
|
|
14
|
+
key: string;
|
|
15
|
+
}
|
|
16
|
+
interface InstanceBuildContext {
|
|
17
|
+
projectRoot: string;
|
|
18
|
+
pagesRoot: string;
|
|
19
|
+
buildDir: string;
|
|
20
|
+
backendDir: string;
|
|
21
|
+
frontendDir: string;
|
|
22
|
+
jayOptions: JayRollupConfig;
|
|
23
|
+
tsConfigFilePath?: string;
|
|
24
|
+
minify?: boolean;
|
|
25
|
+
clientInits?: ClientInitEntry[];
|
|
26
|
+
/** When set, appended to instance ID hash to produce unique filenames per rebuild. */
|
|
27
|
+
rebuildSuffix?: string;
|
|
28
|
+
}
|
|
29
|
+
type InstanceBuildResult = {
|
|
30
|
+
status: 'success';
|
|
31
|
+
instanceEntry: InstanceEntry;
|
|
32
|
+
slowViewState: object;
|
|
33
|
+
carryForward: object;
|
|
34
|
+
contracts: string[];
|
|
35
|
+
} | {
|
|
36
|
+
status: 'skipped';
|
|
37
|
+
reason: string;
|
|
38
|
+
};
|
|
39
|
+
declare function buildInstance(route: JayRoute, params: Record<string, string>, pageModule: any, ctx: InstanceBuildContext, routeServerElementPath?: string, routeCssPath?: string, routeHydratePath?: string, routeClientBundlePath?: string): Promise<InstanceBuildResult>;
|
|
40
|
+
|
|
41
|
+
interface InstanceClientBuildResult {
|
|
42
|
+
jsFile: string;
|
|
43
|
+
cssFile?: string;
|
|
44
|
+
}
|
|
45
|
+
declare function buildInstanceClient(hydrateEntryPath: string, instanceId: string, outputDir: string, projectRoot: string, jayOptions: JayRollupConfig, minify?: boolean, pagesRoot?: string, buildDir?: string): Promise<InstanceClientBuildResult>;
|
|
46
|
+
|
|
47
|
+
interface ServerElementCompileResult {
|
|
48
|
+
cssFile?: string;
|
|
49
|
+
/** External URLs extracted from @import rules (e.g., Google Fonts) */
|
|
50
|
+
cssImports?: string[];
|
|
51
|
+
headMeta?: JayHtmlHeadMeta;
|
|
52
|
+
}
|
|
53
|
+
/**
|
|
54
|
+
* Compile a per-route server element from the original jay-html (DL#144).
|
|
55
|
+
* All bindings (slow, fast, interactive) are dynamic — read from ViewState at render time.
|
|
56
|
+
*
|
|
57
|
+
* Unlike per-instance compilation where jayHtmlDir === outputDir, here the source
|
|
58
|
+
* directory differs from the output directory. We resolve all relative paths in the
|
|
59
|
+
* jay-html to absolute before parsing, so the generated TypeScript imports are
|
|
60
|
+
* resolvable from the output directory.
|
|
61
|
+
*/
|
|
62
|
+
declare function compileRouteServerElement(jayHtmlPath: string, outputPath: string, projectRoot: string, tsConfigFilePath?: string, minifyCss?: boolean): Promise<ServerElementCompileResult>;
|
|
63
|
+
interface RouteHydrateCompileResult {
|
|
64
|
+
jsFile: string;
|
|
65
|
+
}
|
|
66
|
+
/**
|
|
67
|
+
* Compile a per-route hydrate script from the original jay-html (DL#144).
|
|
68
|
+
* Phase-aware: only interactive bindings get coordinates and adoption code.
|
|
69
|
+
* Produces a client-side ES module that exports `hydrate()`.
|
|
70
|
+
*/
|
|
71
|
+
declare function compileRouteHydrateScript(jayHtmlPath: string, outputDir: string, projectRoot: string, tsConfigFilePath?: string, minify?: boolean): Promise<RouteHydrateCompileResult>;
|
|
72
|
+
|
|
73
|
+
interface SharedChunksBuildResult {
|
|
74
|
+
manifest: Record<string, string>;
|
|
75
|
+
outputDir: string;
|
|
76
|
+
}
|
|
77
|
+
declare function buildSharedChunks(outputDir: string, _projectRoot: string, minify?: boolean, pluginClientPackages?: string[]): Promise<SharedChunksBuildResult>;
|
|
78
|
+
|
|
79
|
+
interface ServerBuildEntries {
|
|
80
|
+
init?: string;
|
|
81
|
+
pages: Record<string, string>;
|
|
82
|
+
actions: Record<string, string>;
|
|
83
|
+
}
|
|
84
|
+
declare function discoverServerEntries(projectRoot: string, pagesRoot: string): Promise<{
|
|
85
|
+
entries: ServerBuildEntries;
|
|
86
|
+
routes: JayRoute[];
|
|
87
|
+
}>;
|
|
88
|
+
declare function buildServerCode(entries: ServerBuildEntries, jayOptions: JayRollupConfig, outputDir: string, projectRoot: string): Promise<void>;
|
|
89
|
+
|
|
90
|
+
interface KeyedPartModule {
|
|
91
|
+
key: string;
|
|
92
|
+
modulePath: string;
|
|
93
|
+
exportName: string;
|
|
94
|
+
}
|
|
95
|
+
interface HeadlessModuleInfo {
|
|
96
|
+
modulePath: string;
|
|
97
|
+
exportName: string;
|
|
98
|
+
isLocal: boolean;
|
|
99
|
+
contractName?: string;
|
|
100
|
+
key?: string;
|
|
101
|
+
propNames?: string[];
|
|
102
|
+
contractInfo?: {
|
|
103
|
+
contractName: string;
|
|
104
|
+
metadata?: Record<string, unknown>;
|
|
105
|
+
};
|
|
106
|
+
headlessProps?: Record<string, string>;
|
|
107
|
+
structural?: boolean;
|
|
108
|
+
}
|
|
109
|
+
interface ProductionPageParts {
|
|
110
|
+
parts: DevServerPagePart[];
|
|
111
|
+
headlessContracts: HeadlessContractInfo[];
|
|
112
|
+
headlessInstanceComponents: HeadlessInstanceComponent[];
|
|
113
|
+
discoveredInstances: DiscoveredHeadlessInstance[];
|
|
114
|
+
forEachInstances: ForEachHeadlessInstance[];
|
|
115
|
+
keyedPartModules: KeyedPartModule[];
|
|
116
|
+
headlessModuleInfos: HeadlessModuleInfo[];
|
|
117
|
+
serverTrackByMap?: Record<string, string>;
|
|
118
|
+
clientTrackByMap?: Record<string, string>;
|
|
119
|
+
}
|
|
120
|
+
declare function loadProductionPageParts(route: JayRoute | {
|
|
121
|
+
jayHtmlPath: string;
|
|
122
|
+
componentExport?: string;
|
|
123
|
+
}, pageModule: any, jayHtmlContent: string, projectRoot: string, tsConfigFilePath?: string, serverBuildDir?: string): Promise<ProductionPageParts>;
|
|
124
|
+
interface PagePartsConfigEntry {
|
|
125
|
+
modulePath: string;
|
|
126
|
+
exportName: string;
|
|
127
|
+
source: 'npm' | 'local';
|
|
128
|
+
structural?: boolean;
|
|
129
|
+
}
|
|
130
|
+
interface PagePartsConfig {
|
|
131
|
+
parts: Array<PagePartsConfigEntry & {
|
|
132
|
+
key?: string;
|
|
133
|
+
contractInfo?: {
|
|
134
|
+
contractName: string;
|
|
135
|
+
metadata?: Record<string, unknown>;
|
|
136
|
+
};
|
|
137
|
+
headlessProps?: Record<string, string>;
|
|
138
|
+
}>;
|
|
139
|
+
instanceComponents: Array<PagePartsConfigEntry & {
|
|
140
|
+
contractName: string;
|
|
141
|
+
propNames: string[];
|
|
142
|
+
}>;
|
|
143
|
+
forEachInstances: Array<{
|
|
144
|
+
contractName: string;
|
|
145
|
+
forEachPath: string;
|
|
146
|
+
trackBy: string;
|
|
147
|
+
propBindings: Record<string, string>;
|
|
148
|
+
coordinateSuffix: string;
|
|
149
|
+
}>;
|
|
150
|
+
}
|
|
151
|
+
declare function buildPagePartsConfig(pageParts: ProductionPageParts, pageServerModule: string, pageExportName: string, buildDir: string, pageIsPlugin?: boolean): PagePartsConfig;
|
|
152
|
+
|
|
153
|
+
interface RouteInfo {
|
|
154
|
+
rawRoute: string;
|
|
155
|
+
inferredParams?: Record<string, string>;
|
|
156
|
+
optionalSegments?: Set<string>;
|
|
157
|
+
hasDynamicParams: boolean;
|
|
158
|
+
}
|
|
159
|
+
interface ParamPart {
|
|
160
|
+
keys: Set<string>;
|
|
161
|
+
values: Record<string, string>[];
|
|
162
|
+
}
|
|
163
|
+
interface MaterializedEntry<R extends RouteInfo = RouteInfo> {
|
|
164
|
+
route: R;
|
|
165
|
+
params: Record<string, string>;
|
|
166
|
+
url: string;
|
|
167
|
+
specificity: number;
|
|
168
|
+
}
|
|
169
|
+
declare function crossProductParams(parts: ParamPart[]): Record<string, string>[];
|
|
170
|
+
declare function computeSpecificity(route: RouteInfo): number;
|
|
171
|
+
declare function buildUrl(route: RouteInfo, params: Record<string, string>): string;
|
|
172
|
+
declare function materializeRouteParams<R extends RouteInfo>(routes: R[], loadParamsResults: Map<R, Record<string, string>[]>): MaterializedEntry<R>[];
|
|
173
|
+
declare function dedupeByUrl<R extends RouteInfo>(entries: MaterializedEntry<R>[]): MaterializedEntry<R>[];
|
|
174
|
+
|
|
175
|
+
declare function buildRouteEntry(route: JayRoute, serverModulePath: string): RouteEntry;
|
|
176
|
+
declare function discoverActions(actionPaths: Record<string, string>, serverOutputDir: string, buildDir: string, projectRoot: string): Promise<{
|
|
177
|
+
actions: ActionEntry[];
|
|
178
|
+
plugins: PluginEntry[];
|
|
179
|
+
}>;
|
|
180
|
+
declare function writeRouteManifest(manifest: RouteManifest, buildDir: string): Promise<void>;
|
|
181
|
+
|
|
182
|
+
interface KeyedPartInfo {
|
|
183
|
+
key: string;
|
|
184
|
+
modulePath: string;
|
|
185
|
+
exportName: string;
|
|
186
|
+
}
|
|
187
|
+
interface ClientInitInfo {
|
|
188
|
+
modulePath: string;
|
|
189
|
+
exportName: string;
|
|
190
|
+
key: string;
|
|
191
|
+
}
|
|
192
|
+
interface RouteHydrationEntryOptions {
|
|
193
|
+
hydrateImport: string;
|
|
194
|
+
pageModulePath: string;
|
|
195
|
+
pageExportName?: string;
|
|
196
|
+
trackByMap: Record<string, string>;
|
|
197
|
+
outputPath: string;
|
|
198
|
+
keyedParts?: KeyedPartInfo[];
|
|
199
|
+
clientInits?: ClientInitInfo[];
|
|
200
|
+
}
|
|
201
|
+
/**
|
|
202
|
+
* Generate a per-route hydration entry (DL#144).
|
|
203
|
+
* slowViewState is received as a parameter to init() instead of baked as a literal.
|
|
204
|
+
* This makes the entry identical across all instances of a route.
|
|
205
|
+
*/
|
|
206
|
+
declare function generateRouteHydrationEntry(options: RouteHydrationEntryOptions): Promise<void>;
|
|
207
|
+
|
|
208
|
+
declare function scanPluginRoutes(projectRoot: string, projectRoutes: JayRoutes): Promise<JayRoutes>;
|
|
209
|
+
|
|
210
|
+
export { type InstanceBuildContext, type InstanceBuildResult, type InstanceClientBuildResult, type MaterializedEntry, type ParamPart, type RouteInfo, buildInstance, buildInstanceClient, buildPagePartsConfig, buildRouteEntry, buildServerCode, buildSharedChunks, buildUrl, buildVersion, compileRouteHydrateScript, compileRouteServerElement, computeSpecificity, crossProductParams, dedupeByUrl, discoverActions, discoverServerEntries, generateRouteHydrationEntry, loadProductionPageParts, materializeRouteParams, scanPluginRoutes, writeRouteManifest };
|