vike 0.4.236-commit-64431e7 → 0.4.236-commit-e752d12
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/cjs/client/shared/createGetGlobalContextClient.js +1 -1
- package/dist/cjs/node/runtime/globalContext.js +17 -79
- package/dist/cjs/node/runtime/html/injectAssets/getViteDevScript.js +1 -8
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +1 -3
- package/dist/cjs/node/runtime/utils.js +0 -1
- package/dist/cjs/node/vite/index.js +0 -2
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginBuildConfig.js +1 -2
- package/dist/cjs/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -2
- package/dist/cjs/node/vite/plugins/pluginCommon.js +0 -1
- package/dist/cjs/node/vite/plugins/pluginEnvVars.js +3 -3
- package/dist/cjs/node/vite/plugins/pluginExtractExportNames.js +2 -2
- package/dist/cjs/node/vite/plugins/pluginReplaceConstants.js +1 -1
- package/dist/cjs/node/vite/shared/applyRegExWithMagicString.js +0 -1
- package/dist/cjs/shared/createGlobalContextShared.js +1 -5
- package/dist/cjs/shared/getProxyForPublicUsage.js +2 -2
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assertSetup.js +0 -3
- package/dist/cjs/utils/debug.js +0 -1
- package/dist/esm/client/runtime-client-routing/createPageContextClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/getPageContextFromHooks.d.ts +2 -2
- package/dist/esm/client/runtime-client-routing/globalContext.d.ts +1 -1
- package/dist/esm/client/runtime-client-routing/history.d.ts +2 -4
- package/dist/esm/client/runtime-client-routing/history.js +35 -13
- package/dist/esm/client/runtime-client-routing/initClientRouter.js +2 -3
- package/dist/esm/client/runtime-client-routing/renderPageClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-server-routing/createPageContextClientSide.d.ts +1 -1
- package/dist/esm/client/runtime-server-routing/globalContext.d.ts +1 -1
- package/dist/esm/client/shared/createGetGlobalContextClient.d.ts +1 -1
- package/dist/esm/node/prerender/runPrerender.d.ts +132 -40
- package/dist/esm/node/runtime/globalContext.d.ts +52 -32
- package/dist/esm/node/runtime/globalContext.js +18 -80
- package/dist/esm/node/runtime/html/injectAssets/getViteDevScript.js +1 -8
- package/dist/esm/node/runtime/renderPage/createPageContextServerSide.d.ts +33 -10
- package/dist/esm/node/runtime/renderPage/getPageAssets.js +2 -4
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +66 -20
- package/dist/esm/node/runtime/renderPage.d.ts +33 -10
- package/dist/esm/node/runtime/utils.d.ts +0 -1
- package/dist/esm/node/runtime/utils.js +0 -1
- package/dist/esm/node/vite/index.js +0 -2
- package/dist/esm/node/vite/plugins/pluginBuild/handleAssetsManifest.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildConfig.d.ts +1 -1
- package/dist/esm/node/vite/plugins/pluginBuild/pluginBuildConfig.js +1 -2
- package/dist/esm/node/vite/plugins/pluginBuild/pluginDistFileNames.js +0 -2
- package/dist/esm/node/vite/plugins/pluginCommon.d.ts +0 -3
- package/dist/esm/node/vite/plugins/pluginCommon.js +0 -1
- package/dist/esm/node/vite/shared/applyRegExWithMagicString.js +0 -1
- package/dist/esm/shared/createGlobalContextShared.d.ts +3 -3
- package/dist/esm/shared/createGlobalContextShared.js +1 -5
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assertSetup.js +0 -3
- package/dist/esm/utils/debug.d.ts +1 -1
- package/dist/esm/utils/debug.js +0 -1
- package/package.json +1 -10
- package/dist/cjs/node/vite/plugins/pluginViteRPC.js +0 -42
- package/dist/cjs/utils/getViteRPC.js +0 -79
- package/dist/esm/node/vite/plugins/pluginViteRPC.d.ts +0 -25
- package/dist/esm/node/vite/plugins/pluginViteRPC.js +0 -40
- package/dist/esm/utils/getViteRPC.d.ts +0 -6
- package/dist/esm/utils/getViteRPC.js +0 -77
|
@@ -92,12 +92,24 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
92
92
|
pages: {
|
|
93
93
|
[k: string]: import("../../shared/page-configs/resolveVikeConfigPublic.js").VikeConfigPublicPageEager;
|
|
94
94
|
};
|
|
95
|
-
} & (
|
|
95
|
+
} & ({
|
|
96
96
|
_isProduction: false;
|
|
97
97
|
_isPrerendering: false;
|
|
98
98
|
assetsManifest: null;
|
|
99
|
-
_viteDevServer: import("vite").ViteDevServer
|
|
100
|
-
viteConfig: ResolvedConfig
|
|
99
|
+
_viteDevServer: import("vite").ViteDevServer;
|
|
100
|
+
viteConfig: ResolvedConfig;
|
|
101
|
+
viteConfigRuntime: {
|
|
102
|
+
root: string;
|
|
103
|
+
build: {
|
|
104
|
+
outDir: string;
|
|
105
|
+
};
|
|
106
|
+
_baseViteOriginal: string;
|
|
107
|
+
vitePluginServerEntry: {
|
|
108
|
+
inject: boolean | undefined;
|
|
109
|
+
};
|
|
110
|
+
};
|
|
111
|
+
baseServer: string;
|
|
112
|
+
baseAssets: string;
|
|
101
113
|
isClientSide: false;
|
|
102
114
|
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
103
115
|
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
@@ -107,7 +119,19 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
107
119
|
_isProduction: true;
|
|
108
120
|
assetsManifest: import("../../types/ViteManifest.js").ViteManifest;
|
|
109
121
|
_viteDevServer: null;
|
|
122
|
+
viteConfigRuntime: {
|
|
123
|
+
root: string;
|
|
124
|
+
build: {
|
|
125
|
+
outDir: string;
|
|
126
|
+
};
|
|
127
|
+
_baseViteOriginal: string;
|
|
128
|
+
vitePluginServerEntry: {
|
|
129
|
+
inject: boolean | undefined;
|
|
130
|
+
};
|
|
131
|
+
};
|
|
110
132
|
_usesClientRouter: boolean;
|
|
133
|
+
baseServer: string;
|
|
134
|
+
baseAssets: string;
|
|
111
135
|
isClientSide: false;
|
|
112
136
|
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
113
137
|
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
@@ -117,13 +141,6 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
117
141
|
_isProduction: true;
|
|
118
142
|
assetsManifest: import("../../types/ViteManifest.js").ViteManifest;
|
|
119
143
|
_viteDevServer: null;
|
|
120
|
-
_usesClientRouter: boolean;
|
|
121
|
-
isClientSide: false;
|
|
122
|
-
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
123
|
-
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
124
|
-
}) & {
|
|
125
|
-
baseServer: string;
|
|
126
|
-
baseAssets: string;
|
|
127
144
|
viteConfigRuntime: {
|
|
128
145
|
root: string;
|
|
129
146
|
build: {
|
|
@@ -134,6 +151,12 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
134
151
|
inject: boolean | undefined;
|
|
135
152
|
};
|
|
136
153
|
};
|
|
154
|
+
_usesClientRouter: boolean;
|
|
155
|
+
baseServer: string;
|
|
156
|
+
baseAssets: string;
|
|
157
|
+
isClientSide: false;
|
|
158
|
+
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
159
|
+
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
137
160
|
});
|
|
138
161
|
_pageFilesAll: PageFile[];
|
|
139
162
|
_baseServer: string;
|
|
@@ -190,12 +213,24 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
190
213
|
pages: {
|
|
191
214
|
[k: string]: import("../../shared/page-configs/resolveVikeConfigPublic.js").VikeConfigPublicPageEager;
|
|
192
215
|
};
|
|
193
|
-
} & (
|
|
216
|
+
} & ({
|
|
194
217
|
_isProduction: false;
|
|
195
218
|
_isPrerendering: false;
|
|
196
219
|
assetsManifest: null;
|
|
197
|
-
_viteDevServer: import("vite").ViteDevServer
|
|
198
|
-
viteConfig: ResolvedConfig
|
|
220
|
+
_viteDevServer: import("vite").ViteDevServer;
|
|
221
|
+
viteConfig: ResolvedConfig;
|
|
222
|
+
viteConfigRuntime: {
|
|
223
|
+
root: string;
|
|
224
|
+
build: {
|
|
225
|
+
outDir: string;
|
|
226
|
+
};
|
|
227
|
+
_baseViteOriginal: string;
|
|
228
|
+
vitePluginServerEntry: {
|
|
229
|
+
inject: boolean | undefined;
|
|
230
|
+
};
|
|
231
|
+
};
|
|
232
|
+
baseServer: string;
|
|
233
|
+
baseAssets: string;
|
|
199
234
|
isClientSide: false;
|
|
200
235
|
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
201
236
|
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
@@ -205,7 +240,19 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
205
240
|
_isProduction: true;
|
|
206
241
|
assetsManifest: import("../../types/ViteManifest.js").ViteManifest;
|
|
207
242
|
_viteDevServer: null;
|
|
243
|
+
viteConfigRuntime: {
|
|
244
|
+
root: string;
|
|
245
|
+
build: {
|
|
246
|
+
outDir: string;
|
|
247
|
+
};
|
|
248
|
+
_baseViteOriginal: string;
|
|
249
|
+
vitePluginServerEntry: {
|
|
250
|
+
inject: boolean | undefined;
|
|
251
|
+
};
|
|
252
|
+
};
|
|
208
253
|
_usesClientRouter: boolean;
|
|
254
|
+
baseServer: string;
|
|
255
|
+
baseAssets: string;
|
|
209
256
|
isClientSide: false;
|
|
210
257
|
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
211
258
|
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
@@ -215,13 +262,6 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
215
262
|
_isProduction: true;
|
|
216
263
|
assetsManifest: import("../../types/ViteManifest.js").ViteManifest;
|
|
217
264
|
_viteDevServer: null;
|
|
218
|
-
_usesClientRouter: boolean;
|
|
219
|
-
isClientSide: false;
|
|
220
|
-
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
221
|
-
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
222
|
-
}) & {
|
|
223
|
-
baseServer: string;
|
|
224
|
-
baseAssets: string;
|
|
225
265
|
viteConfigRuntime: {
|
|
226
266
|
root: string;
|
|
227
267
|
build: {
|
|
@@ -232,6 +272,12 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
232
272
|
inject: boolean | undefined;
|
|
233
273
|
};
|
|
234
274
|
};
|
|
275
|
+
_usesClientRouter: boolean;
|
|
276
|
+
baseServer: string;
|
|
277
|
+
baseAssets: string;
|
|
278
|
+
isClientSide: false;
|
|
279
|
+
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
280
|
+
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
235
281
|
});
|
|
236
282
|
_pageFilesAll: PageFile[];
|
|
237
283
|
_baseServer: string;
|
|
@@ -292,12 +338,24 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
292
338
|
pages: {
|
|
293
339
|
[k: string]: import("../../shared/page-configs/resolveVikeConfigPublic.js").VikeConfigPublicPageEager;
|
|
294
340
|
};
|
|
295
|
-
} & (
|
|
341
|
+
} & ({
|
|
296
342
|
_isProduction: false;
|
|
297
343
|
_isPrerendering: false;
|
|
298
344
|
assetsManifest: null;
|
|
299
|
-
_viteDevServer: import("vite").ViteDevServer
|
|
300
|
-
viteConfig: ResolvedConfig
|
|
345
|
+
_viteDevServer: import("vite").ViteDevServer;
|
|
346
|
+
viteConfig: ResolvedConfig;
|
|
347
|
+
viteConfigRuntime: {
|
|
348
|
+
root: string;
|
|
349
|
+
build: {
|
|
350
|
+
outDir: string;
|
|
351
|
+
};
|
|
352
|
+
_baseViteOriginal: string;
|
|
353
|
+
vitePluginServerEntry: {
|
|
354
|
+
inject: boolean | undefined;
|
|
355
|
+
};
|
|
356
|
+
};
|
|
357
|
+
baseServer: string;
|
|
358
|
+
baseAssets: string;
|
|
301
359
|
isClientSide: false;
|
|
302
360
|
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
303
361
|
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
@@ -307,7 +365,19 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
307
365
|
_isProduction: true;
|
|
308
366
|
assetsManifest: import("../../types/ViteManifest.js").ViteManifest;
|
|
309
367
|
_viteDevServer: null;
|
|
368
|
+
viteConfigRuntime: {
|
|
369
|
+
root: string;
|
|
370
|
+
build: {
|
|
371
|
+
outDir: string;
|
|
372
|
+
};
|
|
373
|
+
_baseViteOriginal: string;
|
|
374
|
+
vitePluginServerEntry: {
|
|
375
|
+
inject: boolean | undefined;
|
|
376
|
+
};
|
|
377
|
+
};
|
|
310
378
|
_usesClientRouter: boolean;
|
|
379
|
+
baseServer: string;
|
|
380
|
+
baseAssets: string;
|
|
311
381
|
isClientSide: false;
|
|
312
382
|
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
313
383
|
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
@@ -317,13 +387,6 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
317
387
|
_isProduction: true;
|
|
318
388
|
assetsManifest: import("../../types/ViteManifest.js").ViteManifest;
|
|
319
389
|
_viteDevServer: null;
|
|
320
|
-
_usesClientRouter: boolean;
|
|
321
|
-
isClientSide: false;
|
|
322
|
-
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
323
|
-
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
324
|
-
}) & {
|
|
325
|
-
baseServer: string;
|
|
326
|
-
baseAssets: string;
|
|
327
390
|
viteConfigRuntime: {
|
|
328
391
|
root: string;
|
|
329
392
|
build: {
|
|
@@ -334,6 +397,12 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
334
397
|
inject: boolean | undefined;
|
|
335
398
|
};
|
|
336
399
|
};
|
|
400
|
+
_usesClientRouter: boolean;
|
|
401
|
+
baseServer: string;
|
|
402
|
+
baseAssets: string;
|
|
403
|
+
isClientSide: false;
|
|
404
|
+
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
405
|
+
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
337
406
|
});
|
|
338
407
|
_pageFilesAll: PageFile[];
|
|
339
408
|
_baseServer: string;
|
|
@@ -390,12 +459,24 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
390
459
|
pages: {
|
|
391
460
|
[k: string]: import("../../shared/page-configs/resolveVikeConfigPublic.js").VikeConfigPublicPageEager;
|
|
392
461
|
};
|
|
393
|
-
} & (
|
|
462
|
+
} & ({
|
|
394
463
|
_isProduction: false;
|
|
395
464
|
_isPrerendering: false;
|
|
396
465
|
assetsManifest: null;
|
|
397
|
-
_viteDevServer: import("vite").ViteDevServer
|
|
398
|
-
viteConfig: ResolvedConfig
|
|
466
|
+
_viteDevServer: import("vite").ViteDevServer;
|
|
467
|
+
viteConfig: ResolvedConfig;
|
|
468
|
+
viteConfigRuntime: {
|
|
469
|
+
root: string;
|
|
470
|
+
build: {
|
|
471
|
+
outDir: string;
|
|
472
|
+
};
|
|
473
|
+
_baseViteOriginal: string;
|
|
474
|
+
vitePluginServerEntry: {
|
|
475
|
+
inject: boolean | undefined;
|
|
476
|
+
};
|
|
477
|
+
};
|
|
478
|
+
baseServer: string;
|
|
479
|
+
baseAssets: string;
|
|
399
480
|
isClientSide: false;
|
|
400
481
|
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
401
482
|
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
@@ -405,7 +486,19 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
405
486
|
_isProduction: true;
|
|
406
487
|
assetsManifest: import("../../types/ViteManifest.js").ViteManifest;
|
|
407
488
|
_viteDevServer: null;
|
|
489
|
+
viteConfigRuntime: {
|
|
490
|
+
root: string;
|
|
491
|
+
build: {
|
|
492
|
+
outDir: string;
|
|
493
|
+
};
|
|
494
|
+
_baseViteOriginal: string;
|
|
495
|
+
vitePluginServerEntry: {
|
|
496
|
+
inject: boolean | undefined;
|
|
497
|
+
};
|
|
498
|
+
};
|
|
408
499
|
_usesClientRouter: boolean;
|
|
500
|
+
baseServer: string;
|
|
501
|
+
baseAssets: string;
|
|
409
502
|
isClientSide: false;
|
|
410
503
|
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
411
504
|
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
@@ -415,13 +508,6 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
415
508
|
_isProduction: true;
|
|
416
509
|
assetsManifest: import("../../types/ViteManifest.js").ViteManifest;
|
|
417
510
|
_viteDevServer: null;
|
|
418
|
-
_usesClientRouter: boolean;
|
|
419
|
-
isClientSide: false;
|
|
420
|
-
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
421
|
-
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
422
|
-
}) & {
|
|
423
|
-
baseServer: string;
|
|
424
|
-
baseAssets: string;
|
|
425
511
|
viteConfigRuntime: {
|
|
426
512
|
root: string;
|
|
427
513
|
build: {
|
|
@@ -432,6 +518,12 @@ declare function createPageContextPrerendering(urlOriginal: string, prerenderCon
|
|
|
432
518
|
inject: boolean | undefined;
|
|
433
519
|
};
|
|
434
520
|
};
|
|
521
|
+
_usesClientRouter: boolean;
|
|
522
|
+
baseServer: string;
|
|
523
|
+
baseAssets: string;
|
|
524
|
+
isClientSide: false;
|
|
525
|
+
_pageRoutes: import("../../shared/route/loadPageRoutes.js").PageRoutes;
|
|
526
|
+
_onBeforeRouteHook: import("../../shared/hooks/getHook.js").Hook | null;
|
|
435
527
|
});
|
|
436
528
|
_pageFilesAll: PageFile[];
|
|
437
529
|
_baseServer: string;
|
|
@@ -51,14 +51,8 @@ declare function getGlobalContextServerInternal(): Promise<{
|
|
|
51
51
|
_isProduction: false;
|
|
52
52
|
_isPrerendering: false;
|
|
53
53
|
assetsManifest: null;
|
|
54
|
-
_viteDevServer: ViteDevServer
|
|
55
|
-
viteConfig: ResolvedConfig
|
|
56
|
-
isClientSide: false;
|
|
57
|
-
_pageRoutes: PageRoutes;
|
|
58
|
-
_onBeforeRouteHook: Hook | null;
|
|
59
|
-
} & {
|
|
60
|
-
baseServer: string;
|
|
61
|
-
baseAssets: string;
|
|
54
|
+
_viteDevServer: ViteDevServer;
|
|
55
|
+
viteConfig: ResolvedConfig;
|
|
62
56
|
viteConfigRuntime: {
|
|
63
57
|
root: string;
|
|
64
58
|
build: {
|
|
@@ -69,6 +63,11 @@ declare function getGlobalContextServerInternal(): Promise<{
|
|
|
69
63
|
inject: boolean | undefined;
|
|
70
64
|
};
|
|
71
65
|
};
|
|
66
|
+
baseServer: string;
|
|
67
|
+
baseAssets: string;
|
|
68
|
+
isClientSide: false;
|
|
69
|
+
_pageRoutes: PageRoutes;
|
|
70
|
+
_onBeforeRouteHook: Hook | null;
|
|
72
71
|
}) | (Record<string, unknown> & {
|
|
73
72
|
isGlobalContext: true;
|
|
74
73
|
_isOriginalObject: true;
|
|
@@ -93,13 +92,6 @@ declare function getGlobalContextServerInternal(): Promise<{
|
|
|
93
92
|
_isProduction: true;
|
|
94
93
|
assetsManifest: ViteManifest;
|
|
95
94
|
_viteDevServer: null;
|
|
96
|
-
_usesClientRouter: boolean;
|
|
97
|
-
isClientSide: false;
|
|
98
|
-
_pageRoutes: PageRoutes;
|
|
99
|
-
_onBeforeRouteHook: Hook | null;
|
|
100
|
-
} & {
|
|
101
|
-
baseServer: string;
|
|
102
|
-
baseAssets: string;
|
|
103
95
|
viteConfigRuntime: {
|
|
104
96
|
root: string;
|
|
105
97
|
build: {
|
|
@@ -110,6 +102,12 @@ declare function getGlobalContextServerInternal(): Promise<{
|
|
|
110
102
|
inject: boolean | undefined;
|
|
111
103
|
};
|
|
112
104
|
};
|
|
105
|
+
_usesClientRouter: boolean;
|
|
106
|
+
baseServer: string;
|
|
107
|
+
baseAssets: string;
|
|
108
|
+
isClientSide: false;
|
|
109
|
+
_pageRoutes: PageRoutes;
|
|
110
|
+
_onBeforeRouteHook: Hook | null;
|
|
113
111
|
}) | (Record<string, unknown> & {
|
|
114
112
|
isGlobalContext: true;
|
|
115
113
|
_isOriginalObject: true;
|
|
@@ -134,13 +132,6 @@ declare function getGlobalContextServerInternal(): Promise<{
|
|
|
134
132
|
_isProduction: true;
|
|
135
133
|
assetsManifest: ViteManifest;
|
|
136
134
|
_viteDevServer: null;
|
|
137
|
-
_usesClientRouter: boolean;
|
|
138
|
-
isClientSide: false;
|
|
139
|
-
_pageRoutes: PageRoutes;
|
|
140
|
-
_onBeforeRouteHook: Hook | null;
|
|
141
|
-
} & {
|
|
142
|
-
baseServer: string;
|
|
143
|
-
baseAssets: string;
|
|
144
135
|
viteConfigRuntime: {
|
|
145
136
|
root: string;
|
|
146
137
|
build: {
|
|
@@ -151,6 +142,12 @@ declare function getGlobalContextServerInternal(): Promise<{
|
|
|
151
142
|
inject: boolean | undefined;
|
|
152
143
|
};
|
|
153
144
|
};
|
|
145
|
+
_usesClientRouter: boolean;
|
|
146
|
+
baseServer: string;
|
|
147
|
+
baseAssets: string;
|
|
148
|
+
isClientSide: false;
|
|
149
|
+
_pageRoutes: PageRoutes;
|
|
150
|
+
_onBeforeRouteHook: Hook | null;
|
|
154
151
|
});
|
|
155
152
|
}>;
|
|
156
153
|
/**
|
|
@@ -208,12 +205,24 @@ declare function setGlobalContext(virtualFileExports: unknown): Promise<{
|
|
|
208
205
|
pages: {
|
|
209
206
|
[k: string]: import("../../shared/page-configs/resolveVikeConfigPublic.js").VikeConfigPublicPageEager;
|
|
210
207
|
};
|
|
211
|
-
} & (
|
|
208
|
+
} & ({
|
|
212
209
|
_isProduction: false;
|
|
213
210
|
_isPrerendering: false;
|
|
214
211
|
assetsManifest: null;
|
|
215
|
-
_viteDevServer: ViteDevServer
|
|
216
|
-
viteConfig: ResolvedConfig
|
|
212
|
+
_viteDevServer: ViteDevServer;
|
|
213
|
+
viteConfig: ResolvedConfig;
|
|
214
|
+
viteConfigRuntime: {
|
|
215
|
+
root: string;
|
|
216
|
+
build: {
|
|
217
|
+
outDir: string;
|
|
218
|
+
};
|
|
219
|
+
_baseViteOriginal: string;
|
|
220
|
+
vitePluginServerEntry: {
|
|
221
|
+
inject: boolean | undefined;
|
|
222
|
+
};
|
|
223
|
+
};
|
|
224
|
+
baseServer: string;
|
|
225
|
+
baseAssets: string;
|
|
217
226
|
isClientSide: false;
|
|
218
227
|
_pageRoutes: PageRoutes;
|
|
219
228
|
_onBeforeRouteHook: Hook | null;
|
|
@@ -223,7 +232,19 @@ declare function setGlobalContext(virtualFileExports: unknown): Promise<{
|
|
|
223
232
|
_isProduction: true;
|
|
224
233
|
assetsManifest: ViteManifest;
|
|
225
234
|
_viteDevServer: null;
|
|
235
|
+
viteConfigRuntime: {
|
|
236
|
+
root: string;
|
|
237
|
+
build: {
|
|
238
|
+
outDir: string;
|
|
239
|
+
};
|
|
240
|
+
_baseViteOriginal: string;
|
|
241
|
+
vitePluginServerEntry: {
|
|
242
|
+
inject: boolean | undefined;
|
|
243
|
+
};
|
|
244
|
+
};
|
|
226
245
|
_usesClientRouter: boolean;
|
|
246
|
+
baseServer: string;
|
|
247
|
+
baseAssets: string;
|
|
227
248
|
isClientSide: false;
|
|
228
249
|
_pageRoutes: PageRoutes;
|
|
229
250
|
_onBeforeRouteHook: Hook | null;
|
|
@@ -233,13 +254,6 @@ declare function setGlobalContext(virtualFileExports: unknown): Promise<{
|
|
|
233
254
|
_isProduction: true;
|
|
234
255
|
assetsManifest: ViteManifest;
|
|
235
256
|
_viteDevServer: null;
|
|
236
|
-
_usesClientRouter: boolean;
|
|
237
|
-
isClientSide: false;
|
|
238
|
-
_pageRoutes: PageRoutes;
|
|
239
|
-
_onBeforeRouteHook: Hook | null;
|
|
240
|
-
}) & {
|
|
241
|
-
baseServer: string;
|
|
242
|
-
baseAssets: string;
|
|
243
257
|
viteConfigRuntime: {
|
|
244
258
|
root: string;
|
|
245
259
|
build: {
|
|
@@ -250,5 +264,11 @@ declare function setGlobalContext(virtualFileExports: unknown): Promise<{
|
|
|
250
264
|
inject: boolean | undefined;
|
|
251
265
|
};
|
|
252
266
|
};
|
|
267
|
+
_usesClientRouter: boolean;
|
|
268
|
+
baseServer: string;
|
|
269
|
+
baseAssets: string;
|
|
270
|
+
isClientSide: false;
|
|
271
|
+
_pageRoutes: PageRoutes;
|
|
272
|
+
_onBeforeRouteHook: Hook | null;
|
|
253
273
|
})>;
|
|
254
274
|
declare function clearGlobalContext(): void;
|
|
@@ -26,7 +26,7 @@ export { vikeConfigErrorRecoverMsg };
|
|
|
26
26
|
// - Without vike-server it's manually loaded here using importServerProductionEntry() which uses @brillout/vite-plugin-server-entry's autoImporter or crawler
|
|
27
27
|
// - In development: globalObject.viteDevServer which is Vite's development server
|
|
28
28
|
// - globalObject.viteDevServer is used by updateUserFiles() which then sets virtualFileExports
|
|
29
|
-
import { assert, onSetupRuntime, assertUsage, assertWarning, isPlainObject, objectReplace, isObject, hasProp, getGlobalObject, genPromise, createDebugger, checkType, PROJECT_VERSION,
|
|
29
|
+
import { assert, onSetupRuntime, assertUsage, assertWarning, isPlainObject, objectReplace, isObject, hasProp, getGlobalObject, genPromise, createDebugger, checkType, PROJECT_VERSION, } from './utils.js';
|
|
30
30
|
import { importServerProductionEntry } from '@brillout/vite-plugin-server-entry/runtime';
|
|
31
31
|
import { virtualFileIdEntryServer } from '../shared/virtualFiles/virtualFileEntry.js';
|
|
32
32
|
import pc from '@brillout/picocolors';
|
|
@@ -151,9 +151,6 @@ function setGlobalContext_isPrerendering() {
|
|
|
151
151
|
setIsProduction(true);
|
|
152
152
|
}
|
|
153
153
|
function setGlobalContext_isProduction(isProduction, tolerateContraditction = false) {
|
|
154
|
-
// TODO/now: try to remove globalObject.isProduction ?
|
|
155
|
-
// TODO/now: `rename tolerateContraditction tolerateContradiction`
|
|
156
|
-
tolerateContraditction = true;
|
|
157
154
|
if (debug.isActivated)
|
|
158
155
|
debug('setGlobalContext_isProduction()', { isProduction, tolerateContraditction });
|
|
159
156
|
if (globalObject.isProduction === undefined) {
|
|
@@ -204,12 +201,7 @@ async function initGlobalContext() {
|
|
|
204
201
|
const { isProduction } = globalObject;
|
|
205
202
|
assert(typeof isProduction === 'boolean');
|
|
206
203
|
if (!isProduction) {
|
|
207
|
-
|
|
208
|
-
await globalObject.viteDevServerPromise;
|
|
209
|
-
}
|
|
210
|
-
else {
|
|
211
|
-
await updateUserFiles();
|
|
212
|
-
}
|
|
204
|
+
await globalObject.viteDevServerPromise;
|
|
213
205
|
assert(globalObject.waitForUserFilesUpdate);
|
|
214
206
|
await globalObject.waitForUserFilesUpdate;
|
|
215
207
|
}
|
|
@@ -343,27 +335,16 @@ async function updateUserFiles() {
|
|
|
343
335
|
// Avoid race condition: abort if there is a new globalObject.viteDevServer (happens when vite.config.js is modified => Vite's dev server is fully reloaded).
|
|
344
336
|
viteDevServer !== globalObject.viteDevServer;
|
|
345
337
|
const { viteDevServer } = globalObject;
|
|
338
|
+
assert(viteDevServer);
|
|
346
339
|
let hasError = false;
|
|
347
340
|
let virtualFileExports;
|
|
348
341
|
let err;
|
|
349
|
-
|
|
350
|
-
|
|
351
|
-
virtualFileExports = await viteDevServer.ssrLoadModule(virtualFileIdEntryServer);
|
|
352
|
-
}
|
|
353
|
-
catch (err_) {
|
|
354
|
-
hasError = true;
|
|
355
|
-
err = err_;
|
|
356
|
-
}
|
|
342
|
+
try {
|
|
343
|
+
virtualFileExports = await viteDevServer.ssrLoadModule(virtualFileIdEntryServer);
|
|
357
344
|
}
|
|
358
|
-
|
|
359
|
-
|
|
360
|
-
|
|
361
|
-
virtualFileExports = await __VIKE__DYNAMIC_IMPORT('virtual:vike:entry:server');
|
|
362
|
-
}
|
|
363
|
-
catch (err_) {
|
|
364
|
-
hasError = true;
|
|
365
|
-
err = err_;
|
|
366
|
-
}
|
|
345
|
+
catch (err_) {
|
|
346
|
+
hasError = true;
|
|
347
|
+
err = err_;
|
|
367
348
|
}
|
|
368
349
|
if (isOutdated())
|
|
369
350
|
return { success: false };
|
|
@@ -389,7 +370,7 @@ async function updateUserFiles() {
|
|
|
389
370
|
async function setGlobalContext(virtualFileExports) {
|
|
390
371
|
debug('setGlobalContext()');
|
|
391
372
|
assert(!getVikeConfigErrorBuild());
|
|
392
|
-
const globalContext = await createGlobalContextShared(virtualFileExports, globalObject, addGlobalContext, addGlobalContextTmp
|
|
373
|
+
const globalContext = await createGlobalContextShared(virtualFileExports, globalObject, addGlobalContext, addGlobalContextTmp);
|
|
393
374
|
assertV1Design(
|
|
394
375
|
// pageConfigs is PageConfigRuntime[] but assertV1Design() requires PageConfigBuildTime[]
|
|
395
376
|
globalContext._pageConfigs.length > 0, globalContext._pageFilesAll);
|
|
@@ -415,18 +396,23 @@ function addGlobalContextCommon(globalContext, pageRoutes, onBeforeRouteHook) {
|
|
|
415
396
|
_pageRoutes: pageRoutes,
|
|
416
397
|
_onBeforeRouteHook: onBeforeRouteHook,
|
|
417
398
|
};
|
|
418
|
-
const { viteDevServer, viteConfig, isPrerendering, isProduction } = globalObject;
|
|
399
|
+
const { viteDevServer, viteConfig, viteConfigRuntime, isPrerendering, isProduction } = globalObject;
|
|
419
400
|
assert(typeof isProduction === 'boolean');
|
|
420
401
|
if (!isProduction) {
|
|
402
|
+
assert(viteDevServer);
|
|
421
403
|
assert(globalContext); // main common requirement
|
|
404
|
+
assert(viteConfig);
|
|
405
|
+
assert(viteConfigRuntime);
|
|
422
406
|
assert(!isPrerendering);
|
|
423
407
|
return {
|
|
424
408
|
...globalContextBase,
|
|
409
|
+
...resolveBaseRuntime(viteConfigRuntime, globalContext.config),
|
|
425
410
|
_isProduction: false,
|
|
426
411
|
_isPrerendering: false,
|
|
427
412
|
assetsManifest: null,
|
|
428
413
|
_viteDevServer: viteDevServer,
|
|
429
414
|
viteConfig,
|
|
415
|
+
viteConfigRuntime,
|
|
430
416
|
};
|
|
431
417
|
}
|
|
432
418
|
else {
|
|
@@ -437,9 +423,11 @@ function addGlobalContextCommon(globalContext, pageRoutes, onBeforeRouteHook) {
|
|
|
437
423
|
assert(assetsManifest);
|
|
438
424
|
const globalContextBase2 = {
|
|
439
425
|
...globalContextBase,
|
|
426
|
+
...resolveBaseRuntime(buildInfo.viteConfigRuntime, globalContext.config),
|
|
440
427
|
_isProduction: true,
|
|
441
428
|
assetsManifest,
|
|
442
429
|
_viteDevServer: null,
|
|
430
|
+
viteConfigRuntime: buildInfo.viteConfigRuntime,
|
|
443
431
|
_usesClientRouter: buildInfo.usesClientRouter,
|
|
444
432
|
};
|
|
445
433
|
if (isPrerendering) {
|
|
@@ -459,45 +447,14 @@ function addGlobalContextCommon(globalContext, pageRoutes, onBeforeRouteHook) {
|
|
|
459
447
|
}
|
|
460
448
|
}
|
|
461
449
|
}
|
|
462
|
-
async function addGlobalContextAsync(globalContext) {
|
|
463
|
-
debug('addGlobalContextAsync()');
|
|
464
|
-
let { viteConfigRuntime, buildInfo } = globalObject;
|
|
465
|
-
if (!viteConfigRuntime) {
|
|
466
|
-
if (buildInfo) {
|
|
467
|
-
viteConfigRuntime = buildInfo.viteConfigRuntime;
|
|
468
|
-
}
|
|
469
|
-
else {
|
|
470
|
-
if (!isProcessSharedWithVite()) {
|
|
471
|
-
if (!globalObject.isProduction) {
|
|
472
|
-
const rpc = getViteRPC();
|
|
473
|
-
viteConfigRuntime = await rpc.getViteConfigRuntimeRPC();
|
|
474
|
-
}
|
|
475
|
-
else {
|
|
476
|
-
assert(false); // production => globalObject.buildInfo should be set
|
|
477
|
-
}
|
|
478
|
-
}
|
|
479
|
-
else {
|
|
480
|
-
assert(false); // process shared with Vite => globalObject.viteConfigRuntime should be set
|
|
481
|
-
}
|
|
482
|
-
}
|
|
483
|
-
}
|
|
484
|
-
assert(viteConfigRuntime);
|
|
485
|
-
return {
|
|
486
|
-
viteConfigRuntime,
|
|
487
|
-
...resolveBaseRuntime(viteConfigRuntime, globalContext.config),
|
|
488
|
-
};
|
|
489
|
-
}
|
|
490
450
|
function clearGlobalContext() {
|
|
491
451
|
debug('clearGlobalContext()');
|
|
492
452
|
objectReplace(globalObject, getInitialGlobalObject(), ['buildEntryPrevious']);
|
|
493
453
|
}
|
|
494
454
|
function getInitialGlobalObject() {
|
|
495
|
-
|
|
496
|
-
if (debug.isActivated)
|
|
497
|
-
debug('getInitialGlobalObject()', { isProduction });
|
|
455
|
+
debug('getInitialGlobalObject()');
|
|
498
456
|
const { promise: viteDevServerPromise, resolve: viteDevServerPromiseResolve } = genPromise();
|
|
499
457
|
return {
|
|
500
|
-
isProduction,
|
|
501
458
|
viteDevServerPromise,
|
|
502
459
|
viteDevServerPromiseResolve,
|
|
503
460
|
};
|
|
@@ -508,22 +465,3 @@ function resolveBaseRuntime(viteConfigRuntime, config) {
|
|
|
508
465
|
const baseAssetsUnresolved = config.baseAssets ?? null;
|
|
509
466
|
return resolveBase(baseViteOriginal, baseServerUnresolved, baseAssetsUnresolved);
|
|
510
467
|
}
|
|
511
|
-
function getIsProductionStatic() {
|
|
512
|
-
// TODO/now add @ts-ignore comments
|
|
513
|
-
// @ts-ignore
|
|
514
|
-
if (!import.meta.env)
|
|
515
|
-
return undefined;
|
|
516
|
-
// @ts-ignore
|
|
517
|
-
const PROD = import.meta.env.PROD;
|
|
518
|
-
return PROD;
|
|
519
|
-
}
|
|
520
|
-
function isProcessSharedWithVite() {
|
|
521
|
-
const ret = globalThis.__VIKE__IS_PROCESS_SHARED_WITH_VITE;
|
|
522
|
-
if (globalObject.isProcessSharedWithVite !== undefined) {
|
|
523
|
-
assert(globalObject.isProcessSharedWithVite === ret);
|
|
524
|
-
}
|
|
525
|
-
else {
|
|
526
|
-
globalObject.isProcessSharedWithVite = ret;
|
|
527
|
-
}
|
|
528
|
-
return ret;
|
|
529
|
-
}
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getViteDevScript };
|
|
2
|
-
import { getViteRPC } from '../../../../utils/getViteRPC.js';
|
|
3
2
|
import { assert, assertUsage, assertWarning } from '../../utils.js';
|
|
4
3
|
import pc from '@brillout/picocolors';
|
|
5
4
|
const reachOutCTA = 'Create a new GitHub issue to discuss a solution.';
|
|
@@ -12,13 +11,7 @@ async function getViteDevScript(pageContext) {
|
|
|
12
11
|
const fakeHtmlBegin = '<html> <head>'; // White space to test whether user is using a minifier
|
|
13
12
|
const fakeHtmlEnd = '</head><body></body></html>';
|
|
14
13
|
let fakeHtml = fakeHtmlBegin + fakeHtmlEnd;
|
|
15
|
-
|
|
16
|
-
fakeHtml = await viteDevServer.transformIndexHtml('/', fakeHtml);
|
|
17
|
-
}
|
|
18
|
-
else {
|
|
19
|
-
const rpc = getViteRPC();
|
|
20
|
-
fakeHtml = await rpc.transformIndexHtmlRPC(fakeHtml);
|
|
21
|
-
}
|
|
14
|
+
fakeHtml = await viteDevServer.transformIndexHtml('/', fakeHtml);
|
|
22
15
|
assertUsage(!fakeHtml.includes('vite-plugin-pwa'), `The HTML transformer of ${pc.cyan('vite-plugin-pwa')} cannot be applied, see workaround at https://github.com/vikejs/vike/issues/388#issuecomment-1199280084`);
|
|
23
16
|
assertUsage(!fakeHtml.startsWith(fakeHtmlBegin.replace(' ', '')), `Vite plugins that minify the HTML cannot be applied, see https://github.com/vikejs/vike/issues/224`);
|
|
24
17
|
assertUsage(fakeHtml.startsWith(fakeHtmlBegin) && fakeHtml.endsWith(fakeHtmlEnd), `You are using a Vite Plugin that transforms the HTML in a way that conflicts with Vike. ${reachOutCTA}`);
|