@webstir-io/webstir-frontend 0.1.40
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/LICENSE +21 -0
- package/README.md +158 -0
- package/dist/assets/assetManifest.d.ts +16 -0
- package/dist/assets/assetManifest.js +31 -0
- package/dist/assets/imageOptimizer.d.ts +6 -0
- package/dist/assets/imageOptimizer.js +93 -0
- package/dist/assets/precompression.d.ts +1 -0
- package/dist/assets/precompression.js +21 -0
- package/dist/builders/contentBuilder.d.ts +2 -0
- package/dist/builders/contentBuilder.js +1052 -0
- package/dist/builders/cssBuilder.d.ts +2 -0
- package/dist/builders/cssBuilder.js +439 -0
- package/dist/builders/htmlBuilder.d.ts +2 -0
- package/dist/builders/htmlBuilder.js +430 -0
- package/dist/builders/index.d.ts +2 -0
- package/dist/builders/index.js +14 -0
- package/dist/builders/jsBuilder.d.ts +2 -0
- package/dist/builders/jsBuilder.js +300 -0
- package/dist/builders/staticAssetsBuilder.d.ts +2 -0
- package/dist/builders/staticAssetsBuilder.js +158 -0
- package/dist/builders/types.d.ts +12 -0
- package/dist/builders/types.js +1 -0
- package/dist/cli.d.ts +2 -0
- package/dist/cli.js +105 -0
- package/dist/config/manifest.d.ts +7 -0
- package/dist/config/manifest.js +17 -0
- package/dist/config/paths.d.ts +3 -0
- package/dist/config/paths.js +11 -0
- package/dist/config/schema.d.ts +413 -0
- package/dist/config/schema.js +44 -0
- package/dist/config/setup.d.ts +2 -0
- package/dist/config/setup.js +12 -0
- package/dist/config/workspace.d.ts +2 -0
- package/dist/config/workspace.js +131 -0
- package/dist/config/workspaceManifest.d.ts +23 -0
- package/dist/config/workspaceManifest.js +1 -0
- package/dist/core/constants.d.ts +70 -0
- package/dist/core/constants.js +70 -0
- package/dist/core/diagnostics.d.ts +15 -0
- package/dist/core/diagnostics.js +21 -0
- package/dist/core/index.d.ts +3 -0
- package/dist/core/index.js +3 -0
- package/dist/core/pages.d.ts +6 -0
- package/dist/core/pages.js +23 -0
- package/dist/hooks.d.ts +19 -0
- package/dist/hooks.js +115 -0
- package/dist/html/criticalCss.d.ts +4 -0
- package/dist/html/criticalCss.js +192 -0
- package/dist/html/htmlSecurity.d.ts +5 -0
- package/dist/html/htmlSecurity.js +73 -0
- package/dist/html/lazyLoad.d.ts +6 -0
- package/dist/html/lazyLoad.js +21 -0
- package/dist/html/pageScaffold.d.ts +10 -0
- package/dist/html/pageScaffold.js +51 -0
- package/dist/html/resourceHints.d.ts +7 -0
- package/dist/html/resourceHints.js +64 -0
- package/dist/index.d.ts +5 -0
- package/dist/index.js +5 -0
- package/dist/modes/ssg/index.d.ts +4 -0
- package/dist/modes/ssg/index.js +4 -0
- package/dist/modes/ssg/metadata.d.ts +5 -0
- package/dist/modes/ssg/metadata.js +50 -0
- package/dist/modes/ssg/routing.d.ts +2 -0
- package/dist/modes/ssg/routing.js +186 -0
- package/dist/modes/ssg/seo.d.ts +4 -0
- package/dist/modes/ssg/seo.js +208 -0
- package/dist/modes/ssg/validation.d.ts +3 -0
- package/dist/modes/ssg/validation.js +27 -0
- package/dist/modes/ssg/views.d.ts +2 -0
- package/dist/modes/ssg/views.js +236 -0
- package/dist/operations.d.ts +5 -0
- package/dist/operations.js +102 -0
- package/dist/pipeline.d.ts +7 -0
- package/dist/pipeline.js +71 -0
- package/dist/provider.d.ts +2 -0
- package/dist/provider.js +176 -0
- package/dist/types.d.ts +61 -0
- package/dist/types.js +1 -0
- package/dist/utils/changedFile.d.ts +8 -0
- package/dist/utils/changedFile.js +26 -0
- package/dist/utils/fs.d.ts +11 -0
- package/dist/utils/fs.js +39 -0
- package/dist/utils/hash.d.ts +1 -0
- package/dist/utils/hash.js +5 -0
- package/dist/utils/pagePaths.d.ts +5 -0
- package/dist/utils/pagePaths.js +36 -0
- package/dist/utils/pathMatch.d.ts +3 -0
- package/dist/utils/pathMatch.js +29 -0
- package/dist/watch/frontendFiles.d.ts +3 -0
- package/dist/watch/frontendFiles.js +25 -0
- package/dist/watch/hotUpdateTracker.d.ts +51 -0
- package/dist/watch/hotUpdateTracker.js +205 -0
- package/dist/watch/pipelineHelpers.d.ts +26 -0
- package/dist/watch/pipelineHelpers.js +177 -0
- package/dist/watch/types.d.ts +27 -0
- package/dist/watch/types.js +1 -0
- package/dist/watch/watchCoordinator.d.ts +36 -0
- package/dist/watch/watchCoordinator.js +551 -0
- package/dist/watch/watchDaemon.d.ts +17 -0
- package/dist/watch/watchDaemon.js +127 -0
- package/dist/watch/watchReporter.d.ts +21 -0
- package/dist/watch/watchReporter.js +64 -0
- package/package.json +92 -0
- package/scripts/publish.sh +101 -0
- package/scripts/smoke.mjs +35 -0
- package/scripts/update-contract.sh +121 -0
- package/src/assets/assetManifest.ts +51 -0
- package/src/assets/imageOptimizer.ts +112 -0
- package/src/assets/precompression.ts +25 -0
- package/src/builders/contentBuilder.ts +1400 -0
- package/src/builders/cssBuilder.ts +552 -0
- package/src/builders/htmlBuilder.ts +540 -0
- package/src/builders/index.ts +16 -0
- package/src/builders/jsBuilder.ts +358 -0
- package/src/builders/staticAssetsBuilder.ts +174 -0
- package/src/builders/types.ts +15 -0
- package/src/cli.ts +108 -0
- package/src/config/manifest.ts +24 -0
- package/src/config/paths.ts +14 -0
- package/src/config/schema.ts +49 -0
- package/src/config/setup.ts +14 -0
- package/src/config/workspace.ts +150 -0
- package/src/config/workspaceManifest.ts +27 -0
- package/src/core/constants.ts +73 -0
- package/src/core/diagnostics.ts +40 -0
- package/src/core/index.ts +3 -0
- package/src/core/pages.ts +31 -0
- package/src/hooks.ts +175 -0
- package/src/html/criticalCss.ts +214 -0
- package/src/html/htmlSecurity.ts +86 -0
- package/src/html/lazyLoad.ts +30 -0
- package/src/html/pageScaffold.ts +70 -0
- package/src/html/resourceHints.ts +91 -0
- package/src/index.ts +5 -0
- package/src/modes/ssg/index.ts +4 -0
- package/src/modes/ssg/metadata.ts +63 -0
- package/src/modes/ssg/routing.ts +230 -0
- package/src/modes/ssg/seo.ts +261 -0
- package/src/modes/ssg/validation.ts +37 -0
- package/src/modes/ssg/views.ts +309 -0
- package/src/operations.ts +138 -0
- package/src/pipeline.ts +88 -0
- package/src/provider.ts +249 -0
- package/src/types.ts +67 -0
- package/src/utils/changedFile.ts +39 -0
- package/src/utils/fs.ts +48 -0
- package/src/utils/hash.ts +6 -0
- package/src/utils/pagePaths.ts +43 -0
- package/src/utils/pathMatch.ts +36 -0
- package/src/watch/frontendFiles.ts +32 -0
- package/src/watch/hotUpdateTracker.ts +285 -0
- package/src/watch/pipelineHelpers.ts +242 -0
- package/src/watch/types.ts +23 -0
- package/src/watch/watchCoordinator.ts +666 -0
- package/src/watch/watchDaemon.ts +144 -0
- package/src/watch/watchReporter.ts +98 -0
- package/tests/add-page-defaults.test.js +64 -0
- package/tests/content-pages.test.js +81 -0
- package/tests/css-app-imports.test.js +64 -0
- package/tests/css-page-imports.test.js +100 -0
- package/tests/diagnostics.test.js +48 -0
- package/tests/features.test.js +63 -0
- package/tests/hooks.test.js +71 -0
- package/tests/provider.integration.test.js +137 -0
- package/tests/ssg-defaults.test.js +201 -0
- package/tests/ssg-guardrails.test.js +69 -0
- package/tsconfig.json +27 -0
|
@@ -0,0 +1,413 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export declare const frontendPathSchema: z.ZodObject<{
|
|
3
|
+
workspace: z.ZodString;
|
|
4
|
+
src: z.ZodObject<{
|
|
5
|
+
root: z.ZodString;
|
|
6
|
+
frontend: z.ZodString;
|
|
7
|
+
app: z.ZodString;
|
|
8
|
+
pages: z.ZodString;
|
|
9
|
+
content: z.ZodString;
|
|
10
|
+
images: z.ZodString;
|
|
11
|
+
fonts: z.ZodString;
|
|
12
|
+
media: z.ZodString;
|
|
13
|
+
}, "strip", z.ZodTypeAny, {
|
|
14
|
+
frontend: string;
|
|
15
|
+
app: string;
|
|
16
|
+
pages: string;
|
|
17
|
+
images: string;
|
|
18
|
+
fonts: string;
|
|
19
|
+
media: string;
|
|
20
|
+
root: string;
|
|
21
|
+
content: string;
|
|
22
|
+
}, {
|
|
23
|
+
frontend: string;
|
|
24
|
+
app: string;
|
|
25
|
+
pages: string;
|
|
26
|
+
images: string;
|
|
27
|
+
fonts: string;
|
|
28
|
+
media: string;
|
|
29
|
+
root: string;
|
|
30
|
+
content: string;
|
|
31
|
+
}>;
|
|
32
|
+
build: z.ZodObject<{
|
|
33
|
+
root: z.ZodString;
|
|
34
|
+
frontend: z.ZodString;
|
|
35
|
+
app: z.ZodString;
|
|
36
|
+
pages: z.ZodString;
|
|
37
|
+
content: z.ZodString;
|
|
38
|
+
images: z.ZodString;
|
|
39
|
+
fonts: z.ZodString;
|
|
40
|
+
media: z.ZodString;
|
|
41
|
+
}, "strip", z.ZodTypeAny, {
|
|
42
|
+
frontend: string;
|
|
43
|
+
app: string;
|
|
44
|
+
pages: string;
|
|
45
|
+
images: string;
|
|
46
|
+
fonts: string;
|
|
47
|
+
media: string;
|
|
48
|
+
root: string;
|
|
49
|
+
content: string;
|
|
50
|
+
}, {
|
|
51
|
+
frontend: string;
|
|
52
|
+
app: string;
|
|
53
|
+
pages: string;
|
|
54
|
+
images: string;
|
|
55
|
+
fonts: string;
|
|
56
|
+
media: string;
|
|
57
|
+
root: string;
|
|
58
|
+
content: string;
|
|
59
|
+
}>;
|
|
60
|
+
dist: z.ZodObject<{
|
|
61
|
+
root: z.ZodString;
|
|
62
|
+
frontend: z.ZodString;
|
|
63
|
+
app: z.ZodString;
|
|
64
|
+
pages: z.ZodString;
|
|
65
|
+
content: z.ZodString;
|
|
66
|
+
images: z.ZodString;
|
|
67
|
+
fonts: z.ZodString;
|
|
68
|
+
media: z.ZodString;
|
|
69
|
+
}, "strip", z.ZodTypeAny, {
|
|
70
|
+
frontend: string;
|
|
71
|
+
app: string;
|
|
72
|
+
pages: string;
|
|
73
|
+
images: string;
|
|
74
|
+
fonts: string;
|
|
75
|
+
media: string;
|
|
76
|
+
root: string;
|
|
77
|
+
content: string;
|
|
78
|
+
}, {
|
|
79
|
+
frontend: string;
|
|
80
|
+
app: string;
|
|
81
|
+
pages: string;
|
|
82
|
+
images: string;
|
|
83
|
+
fonts: string;
|
|
84
|
+
media: string;
|
|
85
|
+
root: string;
|
|
86
|
+
content: string;
|
|
87
|
+
}>;
|
|
88
|
+
}, "strip", z.ZodTypeAny, {
|
|
89
|
+
src: {
|
|
90
|
+
frontend: string;
|
|
91
|
+
app: string;
|
|
92
|
+
pages: string;
|
|
93
|
+
images: string;
|
|
94
|
+
fonts: string;
|
|
95
|
+
media: string;
|
|
96
|
+
root: string;
|
|
97
|
+
content: string;
|
|
98
|
+
};
|
|
99
|
+
build: {
|
|
100
|
+
frontend: string;
|
|
101
|
+
app: string;
|
|
102
|
+
pages: string;
|
|
103
|
+
images: string;
|
|
104
|
+
fonts: string;
|
|
105
|
+
media: string;
|
|
106
|
+
root: string;
|
|
107
|
+
content: string;
|
|
108
|
+
};
|
|
109
|
+
dist: {
|
|
110
|
+
frontend: string;
|
|
111
|
+
app: string;
|
|
112
|
+
pages: string;
|
|
113
|
+
images: string;
|
|
114
|
+
fonts: string;
|
|
115
|
+
media: string;
|
|
116
|
+
root: string;
|
|
117
|
+
content: string;
|
|
118
|
+
};
|
|
119
|
+
workspace: string;
|
|
120
|
+
}, {
|
|
121
|
+
src: {
|
|
122
|
+
frontend: string;
|
|
123
|
+
app: string;
|
|
124
|
+
pages: string;
|
|
125
|
+
images: string;
|
|
126
|
+
fonts: string;
|
|
127
|
+
media: string;
|
|
128
|
+
root: string;
|
|
129
|
+
content: string;
|
|
130
|
+
};
|
|
131
|
+
build: {
|
|
132
|
+
frontend: string;
|
|
133
|
+
app: string;
|
|
134
|
+
pages: string;
|
|
135
|
+
images: string;
|
|
136
|
+
fonts: string;
|
|
137
|
+
media: string;
|
|
138
|
+
root: string;
|
|
139
|
+
content: string;
|
|
140
|
+
};
|
|
141
|
+
dist: {
|
|
142
|
+
frontend: string;
|
|
143
|
+
app: string;
|
|
144
|
+
pages: string;
|
|
145
|
+
images: string;
|
|
146
|
+
fonts: string;
|
|
147
|
+
media: string;
|
|
148
|
+
root: string;
|
|
149
|
+
content: string;
|
|
150
|
+
};
|
|
151
|
+
workspace: string;
|
|
152
|
+
}>;
|
|
153
|
+
export declare const frontendFeatureFlagsSchema: z.ZodObject<{
|
|
154
|
+
htmlSecurity: z.ZodDefault<z.ZodBoolean>;
|
|
155
|
+
imageOptimization: z.ZodDefault<z.ZodBoolean>;
|
|
156
|
+
precompression: z.ZodDefault<z.ZodBoolean>;
|
|
157
|
+
}, "strip", z.ZodTypeAny, {
|
|
158
|
+
htmlSecurity: boolean;
|
|
159
|
+
imageOptimization: boolean;
|
|
160
|
+
precompression: boolean;
|
|
161
|
+
}, {
|
|
162
|
+
htmlSecurity?: boolean | undefined;
|
|
163
|
+
imageOptimization?: boolean | undefined;
|
|
164
|
+
precompression?: boolean | undefined;
|
|
165
|
+
}>;
|
|
166
|
+
export declare const frontendConfigSchema: z.ZodObject<{
|
|
167
|
+
version: z.ZodLiteral<1>;
|
|
168
|
+
paths: z.ZodObject<{
|
|
169
|
+
workspace: z.ZodString;
|
|
170
|
+
src: z.ZodObject<{
|
|
171
|
+
root: z.ZodString;
|
|
172
|
+
frontend: z.ZodString;
|
|
173
|
+
app: z.ZodString;
|
|
174
|
+
pages: z.ZodString;
|
|
175
|
+
content: z.ZodString;
|
|
176
|
+
images: z.ZodString;
|
|
177
|
+
fonts: z.ZodString;
|
|
178
|
+
media: z.ZodString;
|
|
179
|
+
}, "strip", z.ZodTypeAny, {
|
|
180
|
+
frontend: string;
|
|
181
|
+
app: string;
|
|
182
|
+
pages: string;
|
|
183
|
+
images: string;
|
|
184
|
+
fonts: string;
|
|
185
|
+
media: string;
|
|
186
|
+
root: string;
|
|
187
|
+
content: string;
|
|
188
|
+
}, {
|
|
189
|
+
frontend: string;
|
|
190
|
+
app: string;
|
|
191
|
+
pages: string;
|
|
192
|
+
images: string;
|
|
193
|
+
fonts: string;
|
|
194
|
+
media: string;
|
|
195
|
+
root: string;
|
|
196
|
+
content: string;
|
|
197
|
+
}>;
|
|
198
|
+
build: z.ZodObject<{
|
|
199
|
+
root: z.ZodString;
|
|
200
|
+
frontend: z.ZodString;
|
|
201
|
+
app: z.ZodString;
|
|
202
|
+
pages: z.ZodString;
|
|
203
|
+
content: z.ZodString;
|
|
204
|
+
images: z.ZodString;
|
|
205
|
+
fonts: z.ZodString;
|
|
206
|
+
media: z.ZodString;
|
|
207
|
+
}, "strip", z.ZodTypeAny, {
|
|
208
|
+
frontend: string;
|
|
209
|
+
app: string;
|
|
210
|
+
pages: string;
|
|
211
|
+
images: string;
|
|
212
|
+
fonts: string;
|
|
213
|
+
media: string;
|
|
214
|
+
root: string;
|
|
215
|
+
content: string;
|
|
216
|
+
}, {
|
|
217
|
+
frontend: string;
|
|
218
|
+
app: string;
|
|
219
|
+
pages: string;
|
|
220
|
+
images: string;
|
|
221
|
+
fonts: string;
|
|
222
|
+
media: string;
|
|
223
|
+
root: string;
|
|
224
|
+
content: string;
|
|
225
|
+
}>;
|
|
226
|
+
dist: z.ZodObject<{
|
|
227
|
+
root: z.ZodString;
|
|
228
|
+
frontend: z.ZodString;
|
|
229
|
+
app: z.ZodString;
|
|
230
|
+
pages: z.ZodString;
|
|
231
|
+
content: z.ZodString;
|
|
232
|
+
images: z.ZodString;
|
|
233
|
+
fonts: z.ZodString;
|
|
234
|
+
media: z.ZodString;
|
|
235
|
+
}, "strip", z.ZodTypeAny, {
|
|
236
|
+
frontend: string;
|
|
237
|
+
app: string;
|
|
238
|
+
pages: string;
|
|
239
|
+
images: string;
|
|
240
|
+
fonts: string;
|
|
241
|
+
media: string;
|
|
242
|
+
root: string;
|
|
243
|
+
content: string;
|
|
244
|
+
}, {
|
|
245
|
+
frontend: string;
|
|
246
|
+
app: string;
|
|
247
|
+
pages: string;
|
|
248
|
+
images: string;
|
|
249
|
+
fonts: string;
|
|
250
|
+
media: string;
|
|
251
|
+
root: string;
|
|
252
|
+
content: string;
|
|
253
|
+
}>;
|
|
254
|
+
}, "strip", z.ZodTypeAny, {
|
|
255
|
+
src: {
|
|
256
|
+
frontend: string;
|
|
257
|
+
app: string;
|
|
258
|
+
pages: string;
|
|
259
|
+
images: string;
|
|
260
|
+
fonts: string;
|
|
261
|
+
media: string;
|
|
262
|
+
root: string;
|
|
263
|
+
content: string;
|
|
264
|
+
};
|
|
265
|
+
build: {
|
|
266
|
+
frontend: string;
|
|
267
|
+
app: string;
|
|
268
|
+
pages: string;
|
|
269
|
+
images: string;
|
|
270
|
+
fonts: string;
|
|
271
|
+
media: string;
|
|
272
|
+
root: string;
|
|
273
|
+
content: string;
|
|
274
|
+
};
|
|
275
|
+
dist: {
|
|
276
|
+
frontend: string;
|
|
277
|
+
app: string;
|
|
278
|
+
pages: string;
|
|
279
|
+
images: string;
|
|
280
|
+
fonts: string;
|
|
281
|
+
media: string;
|
|
282
|
+
root: string;
|
|
283
|
+
content: string;
|
|
284
|
+
};
|
|
285
|
+
workspace: string;
|
|
286
|
+
}, {
|
|
287
|
+
src: {
|
|
288
|
+
frontend: string;
|
|
289
|
+
app: string;
|
|
290
|
+
pages: string;
|
|
291
|
+
images: string;
|
|
292
|
+
fonts: string;
|
|
293
|
+
media: string;
|
|
294
|
+
root: string;
|
|
295
|
+
content: string;
|
|
296
|
+
};
|
|
297
|
+
build: {
|
|
298
|
+
frontend: string;
|
|
299
|
+
app: string;
|
|
300
|
+
pages: string;
|
|
301
|
+
images: string;
|
|
302
|
+
fonts: string;
|
|
303
|
+
media: string;
|
|
304
|
+
root: string;
|
|
305
|
+
content: string;
|
|
306
|
+
};
|
|
307
|
+
dist: {
|
|
308
|
+
frontend: string;
|
|
309
|
+
app: string;
|
|
310
|
+
pages: string;
|
|
311
|
+
images: string;
|
|
312
|
+
fonts: string;
|
|
313
|
+
media: string;
|
|
314
|
+
root: string;
|
|
315
|
+
content: string;
|
|
316
|
+
};
|
|
317
|
+
workspace: string;
|
|
318
|
+
}>;
|
|
319
|
+
features: z.ZodObject<{
|
|
320
|
+
htmlSecurity: z.ZodDefault<z.ZodBoolean>;
|
|
321
|
+
imageOptimization: z.ZodDefault<z.ZodBoolean>;
|
|
322
|
+
precompression: z.ZodDefault<z.ZodBoolean>;
|
|
323
|
+
}, "strip", z.ZodTypeAny, {
|
|
324
|
+
htmlSecurity: boolean;
|
|
325
|
+
imageOptimization: boolean;
|
|
326
|
+
precompression: boolean;
|
|
327
|
+
}, {
|
|
328
|
+
htmlSecurity?: boolean | undefined;
|
|
329
|
+
imageOptimization?: boolean | undefined;
|
|
330
|
+
precompression?: boolean | undefined;
|
|
331
|
+
}>;
|
|
332
|
+
}, "strip", z.ZodTypeAny, {
|
|
333
|
+
features: {
|
|
334
|
+
htmlSecurity: boolean;
|
|
335
|
+
imageOptimization: boolean;
|
|
336
|
+
precompression: boolean;
|
|
337
|
+
};
|
|
338
|
+
version: 1;
|
|
339
|
+
paths: {
|
|
340
|
+
src: {
|
|
341
|
+
frontend: string;
|
|
342
|
+
app: string;
|
|
343
|
+
pages: string;
|
|
344
|
+
images: string;
|
|
345
|
+
fonts: string;
|
|
346
|
+
media: string;
|
|
347
|
+
root: string;
|
|
348
|
+
content: string;
|
|
349
|
+
};
|
|
350
|
+
build: {
|
|
351
|
+
frontend: string;
|
|
352
|
+
app: string;
|
|
353
|
+
pages: string;
|
|
354
|
+
images: string;
|
|
355
|
+
fonts: string;
|
|
356
|
+
media: string;
|
|
357
|
+
root: string;
|
|
358
|
+
content: string;
|
|
359
|
+
};
|
|
360
|
+
dist: {
|
|
361
|
+
frontend: string;
|
|
362
|
+
app: string;
|
|
363
|
+
pages: string;
|
|
364
|
+
images: string;
|
|
365
|
+
fonts: string;
|
|
366
|
+
media: string;
|
|
367
|
+
root: string;
|
|
368
|
+
content: string;
|
|
369
|
+
};
|
|
370
|
+
workspace: string;
|
|
371
|
+
};
|
|
372
|
+
}, {
|
|
373
|
+
features: {
|
|
374
|
+
htmlSecurity?: boolean | undefined;
|
|
375
|
+
imageOptimization?: boolean | undefined;
|
|
376
|
+
precompression?: boolean | undefined;
|
|
377
|
+
};
|
|
378
|
+
version: 1;
|
|
379
|
+
paths: {
|
|
380
|
+
src: {
|
|
381
|
+
frontend: string;
|
|
382
|
+
app: string;
|
|
383
|
+
pages: string;
|
|
384
|
+
images: string;
|
|
385
|
+
fonts: string;
|
|
386
|
+
media: string;
|
|
387
|
+
root: string;
|
|
388
|
+
content: string;
|
|
389
|
+
};
|
|
390
|
+
build: {
|
|
391
|
+
frontend: string;
|
|
392
|
+
app: string;
|
|
393
|
+
pages: string;
|
|
394
|
+
images: string;
|
|
395
|
+
fonts: string;
|
|
396
|
+
media: string;
|
|
397
|
+
root: string;
|
|
398
|
+
content: string;
|
|
399
|
+
};
|
|
400
|
+
dist: {
|
|
401
|
+
frontend: string;
|
|
402
|
+
app: string;
|
|
403
|
+
pages: string;
|
|
404
|
+
images: string;
|
|
405
|
+
fonts: string;
|
|
406
|
+
media: string;
|
|
407
|
+
root: string;
|
|
408
|
+
content: string;
|
|
409
|
+
};
|
|
410
|
+
workspace: string;
|
|
411
|
+
};
|
|
412
|
+
}>;
|
|
413
|
+
export type FrontendConfigInput = z.infer<typeof frontendConfigSchema>;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
import { z } from 'zod';
|
|
2
|
+
export const frontendPathSchema = z.object({
|
|
3
|
+
workspace: z.string(),
|
|
4
|
+
src: z.object({
|
|
5
|
+
root: z.string(),
|
|
6
|
+
frontend: z.string(),
|
|
7
|
+
app: z.string(),
|
|
8
|
+
pages: z.string(),
|
|
9
|
+
content: z.string(),
|
|
10
|
+
images: z.string(),
|
|
11
|
+
fonts: z.string(),
|
|
12
|
+
media: z.string()
|
|
13
|
+
}),
|
|
14
|
+
build: z.object({
|
|
15
|
+
root: z.string(),
|
|
16
|
+
frontend: z.string(),
|
|
17
|
+
app: z.string(),
|
|
18
|
+
pages: z.string(),
|
|
19
|
+
content: z.string(),
|
|
20
|
+
images: z.string(),
|
|
21
|
+
fonts: z.string(),
|
|
22
|
+
media: z.string()
|
|
23
|
+
}),
|
|
24
|
+
dist: z.object({
|
|
25
|
+
root: z.string(),
|
|
26
|
+
frontend: z.string(),
|
|
27
|
+
app: z.string(),
|
|
28
|
+
pages: z.string(),
|
|
29
|
+
content: z.string(),
|
|
30
|
+
images: z.string(),
|
|
31
|
+
fonts: z.string(),
|
|
32
|
+
media: z.string()
|
|
33
|
+
})
|
|
34
|
+
});
|
|
35
|
+
export const frontendFeatureFlagsSchema = z.object({
|
|
36
|
+
htmlSecurity: z.boolean().default(true),
|
|
37
|
+
imageOptimization: z.boolean().default(true),
|
|
38
|
+
precompression: z.boolean().default(true)
|
|
39
|
+
});
|
|
40
|
+
export const frontendConfigSchema = z.object({
|
|
41
|
+
version: z.literal(1),
|
|
42
|
+
paths: frontendPathSchema,
|
|
43
|
+
features: frontendFeatureFlagsSchema
|
|
44
|
+
});
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { writeConfigManifest } from './manifest.js';
|
|
2
|
+
import { buildConfig } from './workspace.js';
|
|
3
|
+
import { ensureWebstirDirectory, resolveManifestPath } from './paths.js';
|
|
4
|
+
export async function prepareWorkspaceConfig(workspaceRoot) {
|
|
5
|
+
const config = buildConfig(workspaceRoot);
|
|
6
|
+
await ensureWebstirDirectory(workspaceRoot);
|
|
7
|
+
await writeConfigManifest({
|
|
8
|
+
outputPath: resolveManifestPath(workspaceRoot),
|
|
9
|
+
data: config
|
|
10
|
+
});
|
|
11
|
+
return config;
|
|
12
|
+
}
|
|
@@ -0,0 +1,131 @@
|
|
|
1
|
+
import fs from 'node:fs';
|
|
2
|
+
import path from 'path';
|
|
3
|
+
import { FOLDERS } from '../core/constants.js';
|
|
4
|
+
import { frontendFeatureFlagsSchema } from './schema.js';
|
|
5
|
+
const DEFAULT_FEATURE_FLAGS = {
|
|
6
|
+
htmlSecurity: true,
|
|
7
|
+
imageOptimization: true,
|
|
8
|
+
precompression: true
|
|
9
|
+
};
|
|
10
|
+
export function buildConfig(workspaceRoot) {
|
|
11
|
+
const srcRoot = path.join(workspaceRoot, FOLDERS.src);
|
|
12
|
+
const frontendRoot = path.join(srcRoot, FOLDERS.frontend);
|
|
13
|
+
const buildRoot = path.join(workspaceRoot, FOLDERS.build);
|
|
14
|
+
const distRoot = path.join(workspaceRoot, FOLDERS.dist);
|
|
15
|
+
const buildFrontend = path.join(buildRoot, FOLDERS.frontend);
|
|
16
|
+
const distFrontend = path.join(distRoot, FOLDERS.frontend);
|
|
17
|
+
const srcContentRoot = resolveContentRoot(workspaceRoot, frontendRoot);
|
|
18
|
+
return {
|
|
19
|
+
version: 1,
|
|
20
|
+
paths: {
|
|
21
|
+
workspace: workspaceRoot,
|
|
22
|
+
src: {
|
|
23
|
+
root: srcRoot,
|
|
24
|
+
frontend: frontendRoot,
|
|
25
|
+
app: path.join(frontendRoot, FOLDERS.app),
|
|
26
|
+
pages: path.join(frontendRoot, FOLDERS.pages),
|
|
27
|
+
content: srcContentRoot,
|
|
28
|
+
images: path.join(frontendRoot, FOLDERS.images),
|
|
29
|
+
fonts: path.join(frontendRoot, FOLDERS.fonts),
|
|
30
|
+
media: path.join(frontendRoot, FOLDERS.media)
|
|
31
|
+
},
|
|
32
|
+
build: {
|
|
33
|
+
root: buildRoot,
|
|
34
|
+
frontend: buildFrontend,
|
|
35
|
+
app: path.join(buildFrontend, FOLDERS.app),
|
|
36
|
+
pages: path.join(buildFrontend, FOLDERS.pages),
|
|
37
|
+
content: path.join(buildFrontend, FOLDERS.pages, 'docs'),
|
|
38
|
+
images: path.join(buildFrontend, FOLDERS.images),
|
|
39
|
+
fonts: path.join(buildFrontend, FOLDERS.fonts),
|
|
40
|
+
media: path.join(buildFrontend, FOLDERS.media)
|
|
41
|
+
},
|
|
42
|
+
dist: {
|
|
43
|
+
root: distRoot,
|
|
44
|
+
frontend: distFrontend,
|
|
45
|
+
app: path.join(distFrontend, FOLDERS.app),
|
|
46
|
+
pages: path.join(distFrontend, FOLDERS.pages),
|
|
47
|
+
content: path.join(distFrontend, FOLDERS.pages, 'docs'),
|
|
48
|
+
images: path.join(distFrontend, FOLDERS.images),
|
|
49
|
+
fonts: path.join(distFrontend, FOLDERS.fonts),
|
|
50
|
+
media: path.join(distFrontend, FOLDERS.media)
|
|
51
|
+
}
|
|
52
|
+
},
|
|
53
|
+
features: loadFeatureFlags(frontendRoot)
|
|
54
|
+
};
|
|
55
|
+
}
|
|
56
|
+
function resolveContentRoot(workspaceRoot, frontendRoot) {
|
|
57
|
+
const defaultContentRoot = path.join(frontendRoot, 'content');
|
|
58
|
+
const configPath = path.join(frontendRoot, 'frontend.config.json');
|
|
59
|
+
if (!fs.existsSync(configPath)) {
|
|
60
|
+
return defaultContentRoot;
|
|
61
|
+
}
|
|
62
|
+
try {
|
|
63
|
+
const raw = fs.readFileSync(configPath, 'utf8');
|
|
64
|
+
const parsed = JSON.parse(raw);
|
|
65
|
+
const override = extractContentRoot(parsed);
|
|
66
|
+
if (override === undefined) {
|
|
67
|
+
return defaultContentRoot;
|
|
68
|
+
}
|
|
69
|
+
if (typeof override !== 'string') {
|
|
70
|
+
throw new Error('Expected contentRoot to be a string when specified.');
|
|
71
|
+
}
|
|
72
|
+
const trimmed = override.trim();
|
|
73
|
+
if (!trimmed) {
|
|
74
|
+
return defaultContentRoot;
|
|
75
|
+
}
|
|
76
|
+
if (path.isAbsolute(trimmed)) {
|
|
77
|
+
return trimmed;
|
|
78
|
+
}
|
|
79
|
+
return path.join(workspaceRoot, trimmed);
|
|
80
|
+
}
|
|
81
|
+
catch (error) {
|
|
82
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
83
|
+
throw new Error(`Failed to read frontend content root from ${configPath}: ${message}`);
|
|
84
|
+
}
|
|
85
|
+
}
|
|
86
|
+
function extractContentRoot(value) {
|
|
87
|
+
if (!value || typeof value !== 'object') {
|
|
88
|
+
return undefined;
|
|
89
|
+
}
|
|
90
|
+
const container = value;
|
|
91
|
+
if ('paths' in container && container.paths && typeof container.paths === 'object') {
|
|
92
|
+
const pathsContainer = container.paths;
|
|
93
|
+
if ('contentRoot' in pathsContainer) {
|
|
94
|
+
return pathsContainer.contentRoot;
|
|
95
|
+
}
|
|
96
|
+
}
|
|
97
|
+
if ('contentRoot' in container) {
|
|
98
|
+
return container.contentRoot;
|
|
99
|
+
}
|
|
100
|
+
return undefined;
|
|
101
|
+
}
|
|
102
|
+
function loadFeatureFlags(frontendRoot) {
|
|
103
|
+
const configPath = path.join(frontendRoot, 'frontend.config.json');
|
|
104
|
+
if (!fs.existsSync(configPath)) {
|
|
105
|
+
return DEFAULT_FEATURE_FLAGS;
|
|
106
|
+
}
|
|
107
|
+
try {
|
|
108
|
+
const raw = fs.readFileSync(configPath, 'utf8');
|
|
109
|
+
const parsed = JSON.parse(raw);
|
|
110
|
+
const overridesSource = extractOverrideSource(parsed);
|
|
111
|
+
const overrides = frontendFeatureFlagsSchema.parse(overridesSource);
|
|
112
|
+
return {
|
|
113
|
+
htmlSecurity: overrides.htmlSecurity,
|
|
114
|
+
imageOptimization: overrides.imageOptimization,
|
|
115
|
+
precompression: overrides.precompression
|
|
116
|
+
};
|
|
117
|
+
}
|
|
118
|
+
catch (error) {
|
|
119
|
+
const message = error instanceof Error ? error.message : String(error);
|
|
120
|
+
throw new Error(`Failed to read frontend feature flags from ${configPath}: ${message}`);
|
|
121
|
+
}
|
|
122
|
+
}
|
|
123
|
+
function extractOverrideSource(value) {
|
|
124
|
+
if (value && typeof value === 'object' && 'features' in value) {
|
|
125
|
+
const container = value.features;
|
|
126
|
+
if (container && typeof container === 'object') {
|
|
127
|
+
return container;
|
|
128
|
+
}
|
|
129
|
+
}
|
|
130
|
+
return (value && typeof value === 'object') ? value : {};
|
|
131
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export type RenderMode = 'ssg' | 'ssr' | 'spa';
|
|
2
|
+
export interface WorkspaceModuleView {
|
|
3
|
+
readonly name?: string;
|
|
4
|
+
readonly path?: string;
|
|
5
|
+
readonly renderMode?: RenderMode;
|
|
6
|
+
readonly staticPaths?: readonly string[];
|
|
7
|
+
}
|
|
8
|
+
export interface WorkspaceModuleRouteGuard {
|
|
9
|
+
readonly renderMode?: unknown;
|
|
10
|
+
readonly staticPaths?: unknown;
|
|
11
|
+
readonly ssg?: unknown;
|
|
12
|
+
}
|
|
13
|
+
export interface WorkspaceModuleConfig {
|
|
14
|
+
readonly views?: readonly WorkspaceModuleView[];
|
|
15
|
+
readonly routes?: readonly WorkspaceModuleRouteGuard[];
|
|
16
|
+
}
|
|
17
|
+
export interface WorkspacePackageJson {
|
|
18
|
+
readonly name?: string;
|
|
19
|
+
readonly webstir?: {
|
|
20
|
+
readonly mode?: string;
|
|
21
|
+
readonly moduleManifest?: WorkspaceModuleConfig;
|
|
22
|
+
};
|
|
23
|
+
}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
|
@@ -0,0 +1,70 @@
|
|
|
1
|
+
export declare const FOLDERS: {
|
|
2
|
+
readonly src: "src";
|
|
3
|
+
readonly build: "build";
|
|
4
|
+
readonly dist: "dist";
|
|
5
|
+
readonly webstir: ".webstir";
|
|
6
|
+
readonly tests: "tests";
|
|
7
|
+
readonly frontend: "frontend";
|
|
8
|
+
readonly backend: "backend";
|
|
9
|
+
readonly shared: "shared";
|
|
10
|
+
readonly types: "types";
|
|
11
|
+
readonly app: "app";
|
|
12
|
+
readonly pages: "pages";
|
|
13
|
+
readonly styles: "styles";
|
|
14
|
+
readonly scripts: "scripts";
|
|
15
|
+
readonly images: "images";
|
|
16
|
+
readonly fonts: "fonts";
|
|
17
|
+
readonly media: "media";
|
|
18
|
+
readonly chunks: "chunks";
|
|
19
|
+
readonly home: "home";
|
|
20
|
+
readonly nodeModules: "node_modules";
|
|
21
|
+
readonly seed: "seed";
|
|
22
|
+
readonly demo: "demo";
|
|
23
|
+
readonly temp: "temp";
|
|
24
|
+
};
|
|
25
|
+
export declare const FILES: {
|
|
26
|
+
readonly packageJson: "package.json";
|
|
27
|
+
readonly packageLockJson: "package-lock.json";
|
|
28
|
+
readonly tsBuildInfo: ".tsbuildinfo";
|
|
29
|
+
readonly baseTsConfigJson: "base.tsconfig.json";
|
|
30
|
+
readonly manifestJson: "manifest.json";
|
|
31
|
+
readonly test: ".test";
|
|
32
|
+
readonly index: "index";
|
|
33
|
+
readonly indexHtml: "index.html";
|
|
34
|
+
readonly refreshJs: "refresh.js";
|
|
35
|
+
readonly hmrJs: "hmr.js";
|
|
36
|
+
readonly robotsTxt: "robots.txt";
|
|
37
|
+
};
|
|
38
|
+
export declare const EXTENSIONS: {
|
|
39
|
+
readonly html: ".html";
|
|
40
|
+
readonly css: ".css";
|
|
41
|
+
readonly br: ".br";
|
|
42
|
+
readonly gz: ".gz";
|
|
43
|
+
readonly dts: ".d.ts";
|
|
44
|
+
readonly ts: ".ts";
|
|
45
|
+
readonly js: ".js";
|
|
46
|
+
readonly map: ".map";
|
|
47
|
+
readonly png: ".png";
|
|
48
|
+
readonly jpg: ".jpg";
|
|
49
|
+
readonly jpeg: ".jpeg";
|
|
50
|
+
readonly gif: ".gif";
|
|
51
|
+
readonly svg: ".svg";
|
|
52
|
+
readonly webp: ".webp";
|
|
53
|
+
readonly avif: ".avif";
|
|
54
|
+
readonly ico: ".ico";
|
|
55
|
+
readonly woff: ".woff";
|
|
56
|
+
readonly woff2: ".woff2";
|
|
57
|
+
readonly ttf: ".ttf";
|
|
58
|
+
readonly otf: ".otf";
|
|
59
|
+
readonly eot: ".eot";
|
|
60
|
+
readonly mp3: ".mp3";
|
|
61
|
+
readonly m4a: ".m4a";
|
|
62
|
+
readonly wav: ".wav";
|
|
63
|
+
readonly ogg: ".ogg";
|
|
64
|
+
readonly mp4: ".mp4";
|
|
65
|
+
readonly webm: ".webm";
|
|
66
|
+
readonly mov: ".mov";
|
|
67
|
+
};
|
|
68
|
+
export declare const FILE_NAMES: {
|
|
69
|
+
readonly htmlAppTemplate: "app.html";
|
|
70
|
+
};
|