vike 0.4.223-commit-e239e2b → 0.4.223-commit-3502685

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.
Files changed (44) hide show
  1. package/dist/cjs/node/plugin/plugins/commonConfig.js +2 -1
  2. package/dist/cjs/node/plugin/plugins/fileEnv.js +5 -2
  3. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +19 -9
  4. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +2 -1
  5. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +10 -1
  6. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +112 -79
  7. package/dist/cjs/node/plugin/utils.js +1 -0
  8. package/dist/cjs/node/prerender/context.js +3 -8
  9. package/dist/cjs/node/prerender/resolvePrerenderConfig.js +23 -21
  10. package/dist/cjs/node/prerender/runPrerender.js +24 -28
  11. package/dist/cjs/node/prerender/utils.js +1 -0
  12. package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +2 -2
  13. package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +1 -1
  14. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  15. package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +10 -4
  16. package/dist/cjs/utils/path.js +1 -0
  17. package/dist/esm/node/plugin/plugins/commonConfig.js +3 -2
  18. package/dist/esm/node/plugin/plugins/fileEnv.js +5 -2
  19. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +20 -10
  20. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +2 -1
  21. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +0 -1
  22. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +11 -2
  23. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +112 -79
  24. package/dist/esm/node/plugin/utils.d.ts +1 -0
  25. package/dist/esm/node/plugin/utils.js +1 -0
  26. package/dist/esm/node/prerender/context.d.ts +0 -2
  27. package/dist/esm/node/prerender/context.js +4 -9
  28. package/dist/esm/node/prerender/resolvePrerenderConfig.d.ts +10 -6
  29. package/dist/esm/node/prerender/resolvePrerenderConfig.js +24 -22
  30. package/dist/esm/node/prerender/runPrerender.d.ts +7 -25
  31. package/dist/esm/node/prerender/runPrerender.js +25 -29
  32. package/dist/esm/node/prerender/utils.d.ts +1 -0
  33. package/dist/esm/node/prerender/utils.js +1 -0
  34. package/dist/esm/node/runtime/globalContext.d.ts +2 -1
  35. package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +165 -5
  36. package/dist/esm/shared/page-configs/Config.d.ts +8 -0
  37. package/dist/esm/shared/page-configs/getConfigValueBuildTime.js +2 -2
  38. package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +1 -1
  39. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  40. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  41. package/dist/esm/utils/isFilePathAbsoluteFilesystem.js +8 -2
  42. package/dist/esm/utils/path.js +1 -0
  43. package/dist/esm/utils/projectInfo.d.ts +1 -1
  44. package/package.json +1 -1
@@ -48,7 +48,39 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
48
48
  _onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
49
49
  _globalContext: GlobalContextInternal;
50
50
  /** @experimental This is a beta feature https://vike.dev/getGlobalContext */
51
- globalContext: import("../globalContext.js").GlobalContextPublic;
51
+ globalContext: Pick<{
52
+ viteConfigRuntime: {
53
+ _baseViteOriginal: null | string;
54
+ };
55
+ config: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigUserFriendly["config"];
56
+ pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
57
+ } & import("../../shared/resolveBase.js").BaseUrlsResolved & ({
58
+ pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
59
+ pageConfigs: import("../../../__internal/index.js").PageConfig[];
60
+ pageConfigGlobal: import("../../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
61
+ allPageIds: string[];
62
+ pageRoutes: import("../../../__internal/index.js").PageRoutes;
63
+ onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
64
+ pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
65
+ config: import("../../../shared/page-configs/Config/PageContextConfig.js").ConfigResolved;
66
+ } & ({
67
+ isProduction: false;
68
+ isPrerendering: false;
69
+ viteConfig: import("vite").ResolvedConfig;
70
+ viteDevServer: import("vite").ViteDevServer;
71
+ assetsManifest: null;
72
+ } | ({
73
+ isProduction: true;
74
+ assetsManifest: import("../../shared/ViteManifest.js").ViteManifest;
75
+ viteDevServer: null;
76
+ } & ({
77
+ isPrerendering: false;
78
+ viteConfig: null;
79
+ } | {
80
+ isPrerendering: true;
81
+ usesClientRouter: boolean;
82
+ viteConfig: import("vite").ResolvedConfig;
83
+ })))), "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
52
84
  _pageContextInit: {
53
85
  urlOriginal: string;
54
86
  headersOriginal?: unknown;
@@ -102,7 +134,39 @@ declare function prerenderPage(pageContext: PageContextInitEnhanced & PageFiles
102
134
  _onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
103
135
  _globalContext: GlobalContextInternal;
104
136
  /** @experimental This is a beta feature https://vike.dev/getGlobalContext */
105
- globalContext: import("../globalContext.js").GlobalContextPublic;
137
+ globalContext: Pick<{
138
+ viteConfigRuntime: {
139
+ _baseViteOriginal: null | string;
140
+ };
141
+ config: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigUserFriendly["config"];
142
+ pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
143
+ } & import("../../shared/resolveBase.js").BaseUrlsResolved & ({
144
+ pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
145
+ pageConfigs: import("../../../__internal/index.js").PageConfig[];
146
+ pageConfigGlobal: import("../../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
147
+ allPageIds: string[];
148
+ pageRoutes: import("../../../__internal/index.js").PageRoutes;
149
+ onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
150
+ pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
151
+ config: import("../../../shared/page-configs/Config/PageContextConfig.js").ConfigResolved;
152
+ } & ({
153
+ isProduction: false;
154
+ isPrerendering: false;
155
+ viteConfig: import("vite").ResolvedConfig;
156
+ viteDevServer: import("vite").ViteDevServer;
157
+ assetsManifest: null;
158
+ } | ({
159
+ isProduction: true;
160
+ assetsManifest: import("../../shared/ViteManifest.js").ViteManifest;
161
+ viteDevServer: null;
162
+ } & ({
163
+ isPrerendering: false;
164
+ viteConfig: null;
165
+ } | {
166
+ isPrerendering: true;
167
+ usesClientRouter: boolean;
168
+ viteConfig: import("vite").ResolvedConfig;
169
+ })))), "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
106
170
  _pageContextInit: {
107
171
  urlOriginal: string;
108
172
  headersOriginal?: unknown;
@@ -157,7 +221,39 @@ declare function prerender404Page(pageContextInit_: Record<string, unknown> | nu
157
221
  _onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
158
222
  _globalContext: GlobalContextInternal;
159
223
  /** @experimental This is a beta feature https://vike.dev/getGlobalContext */
160
- globalContext: import("../globalContext.js").GlobalContextPublic;
224
+ globalContext: Pick<{
225
+ viteConfigRuntime: {
226
+ _baseViteOriginal: null | string;
227
+ };
228
+ config: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigUserFriendly["config"];
229
+ pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
230
+ } & import("../../shared/resolveBase.js").BaseUrlsResolved & ({
231
+ pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
232
+ pageConfigs: import("../../../__internal/index.js").PageConfig[];
233
+ pageConfigGlobal: import("../../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
234
+ allPageIds: string[];
235
+ pageRoutes: import("../../../__internal/index.js").PageRoutes;
236
+ onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
237
+ pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
238
+ config: import("../../../shared/page-configs/Config/PageContextConfig.js").ConfigResolved;
239
+ } & ({
240
+ isProduction: false;
241
+ isPrerendering: false;
242
+ viteConfig: import("vite").ResolvedConfig;
243
+ viteDevServer: import("vite").ViteDevServer;
244
+ assetsManifest: null;
245
+ } | ({
246
+ isProduction: true;
247
+ assetsManifest: import("../../shared/ViteManifest.js").ViteManifest;
248
+ viteDevServer: null;
249
+ } & ({
250
+ isPrerendering: false;
251
+ viteConfig: null;
252
+ } | {
253
+ isPrerendering: true;
254
+ usesClientRouter: boolean;
255
+ viteConfig: import("vite").ResolvedConfig;
256
+ })))), "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
161
257
  _pageContextInit: {
162
258
  urlOriginal: string;
163
259
  headersOriginal?: unknown;
@@ -211,7 +307,39 @@ declare function prerender404Page(pageContextInit_: Record<string, unknown> | nu
211
307
  _onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
212
308
  _globalContext: GlobalContextInternal;
213
309
  /** @experimental This is a beta feature https://vike.dev/getGlobalContext */
214
- globalContext: import("../globalContext.js").GlobalContextPublic;
310
+ globalContext: Pick<{
311
+ viteConfigRuntime: {
312
+ _baseViteOriginal: null | string;
313
+ };
314
+ config: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigUserFriendly["config"];
315
+ pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
316
+ } & import("../../shared/resolveBase.js").BaseUrlsResolved & ({
317
+ pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
318
+ pageConfigs: import("../../../__internal/index.js").PageConfig[];
319
+ pageConfigGlobal: import("../../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
320
+ allPageIds: string[];
321
+ pageRoutes: import("../../../__internal/index.js").PageRoutes;
322
+ onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
323
+ pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
324
+ config: import("../../../shared/page-configs/Config/PageContextConfig.js").ConfigResolved;
325
+ } & ({
326
+ isProduction: false;
327
+ isPrerendering: false;
328
+ viteConfig: import("vite").ResolvedConfig;
329
+ viteDevServer: import("vite").ViteDevServer;
330
+ assetsManifest: null;
331
+ } | ({
332
+ isProduction: true;
333
+ assetsManifest: import("../../shared/ViteManifest.js").ViteManifest;
334
+ viteDevServer: null;
335
+ } & ({
336
+ isPrerendering: false;
337
+ viteConfig: null;
338
+ } | {
339
+ isPrerendering: true;
340
+ usesClientRouter: boolean;
341
+ viteConfig: import("vite").ResolvedConfig;
342
+ })))), "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
215
343
  _pageContextInit: {
216
344
  urlOriginal: string;
217
345
  headersOriginal?: unknown;
@@ -274,7 +402,39 @@ declare function getPageContextInitEnhanced(pageContextInit: {
274
402
  _onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
275
403
  _globalContext: GlobalContextInternal;
276
404
  /** @experimental This is a beta feature https://vike.dev/getGlobalContext */
277
- globalContext: import("../globalContext.js").GlobalContextPublic;
405
+ globalContext: Pick<{
406
+ viteConfigRuntime: {
407
+ _baseViteOriginal: null | string;
408
+ };
409
+ config: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigUserFriendly["config"];
410
+ pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
411
+ } & import("../../shared/resolveBase.js").BaseUrlsResolved & ({
412
+ pageFilesAll: import("../../../shared/getPageFiles.js").PageFile[];
413
+ pageConfigs: import("../../../__internal/index.js").PageConfig[];
414
+ pageConfigGlobal: import("../../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
415
+ allPageIds: string[];
416
+ pageRoutes: import("../../../__internal/index.js").PageRoutes;
417
+ onBeforeRouteHook: import("../../../shared/hooks/getHook.js").Hook | null;
418
+ pages: import("../../../shared/page-configs/getPageConfigUserFriendly.js").PageConfigsUserFriendly;
419
+ config: import("../../../shared/page-configs/Config/PageContextConfig.js").ConfigResolved;
420
+ } & ({
421
+ isProduction: false;
422
+ isPrerendering: false;
423
+ viteConfig: import("vite").ResolvedConfig;
424
+ viteDevServer: import("vite").ViteDevServer;
425
+ assetsManifest: null;
426
+ } | ({
427
+ isProduction: true;
428
+ assetsManifest: import("../../shared/ViteManifest.js").ViteManifest;
429
+ viteDevServer: null;
430
+ } & ({
431
+ isPrerendering: false;
432
+ viteConfig: null;
433
+ } | {
434
+ isPrerendering: true;
435
+ usesClientRouter: boolean;
436
+ viteConfig: import("vite").ResolvedConfig;
437
+ })))), "pages" | "baseServer" | "baseAssets" | "config" | "assetsManifest" | "viteConfig">;
278
438
  _pageContextInit: {
279
439
  urlOriginal: string;
280
440
  headersOriginal?: unknown;
@@ -296,6 +296,14 @@ type ConfigBuiltIn = {
296
296
  * @default false
297
297
  */
298
298
  disableAutoRun?: boolean;
299
+ /**
300
+ * Set prerender settings without enabling pre-rendering.
301
+ *
302
+ * https://vike.dev/prerender#value
303
+ *
304
+ * @default true
305
+ */
306
+ value?: boolean | null;
299
307
  };
300
308
  /**
301
309
  * Install Vike extensions.
@@ -29,7 +29,7 @@ function getConfigValue(pageConfig, configName) {
29
29
  assert(configValueSource);
30
30
  assert(configValueSource.isOverriden === false);
31
31
  assert(sources.slice(1).every((s) => s.isOverriden === true));
32
- assert('value' in configValueSource);
32
+ assert(configValueSource.valueIsLoaded);
33
33
  return {
34
34
  type: 'standard',
35
35
  value: configValueSource.value,
@@ -52,7 +52,7 @@ function mergeCumulative(configValueSources) {
52
52
  configValueSources.forEach((configValueSource) => {
53
53
  assert(configValueSource.isOverriden === false);
54
54
  assert(configValueSource.configEnv.config === true);
55
- assert('value' in configValueSource);
55
+ assert(configValueSource.valueIsLoaded);
56
56
  value.push(configValueSource.value);
57
57
  definedAtData.push(getDefinedAtFile(configValueSource));
58
58
  });
@@ -46,7 +46,7 @@ function serializeConfigValues(pageConfig, importStatements, filesEnv, isEnvMatc
46
46
  function getValueSerializedFromSource(configValueSource, configName, importStatements, filesEnv) {
47
47
  assert(configValueSource.isOverriden === false);
48
48
  let valueData;
49
- if ('value' in configValueSource && !configValueSource.valueIsLoadedWithImport) {
49
+ if (configValueSource.valueIsLoaded && !configValueSource.valueIsLoadedWithImport) {
50
50
  valueData = getValueSerializedWithJson(configValueSource.value, configName, configValueSource.definedAtFilePath, importStatements, filesEnv, configValueSource.configEnv);
51
51
  }
52
52
  else {
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.223-commit-e239e2b";
1
+ export declare const PROJECT_VERSION: "0.4.223-commit-3502685";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.223-commit-e239e2b';
2
+ export const PROJECT_VERSION = '0.4.223-commit-3502685';
@@ -1,8 +1,13 @@
1
1
  export { assertFilePathAbsoluteFilesystem };
2
2
  export { isFilePathAbsolute };
3
- import path from 'path';
3
+ import path from 'node:path';
4
4
  import { assert } from './assert.js';
5
5
  import { assertPosixPath } from './path.js';
6
+ import { assertIsNotBrowser } from './assertIsNotBrowser.js';
7
+ import { assertIsNotProductionRuntime } from './assertSetup.js';
8
+ assertIsNotBrowser();
9
+ // Server runtime shouldn't depend on node:path
10
+ assertIsNotProductionRuntime();
6
11
  /**
7
12
  * Asserts that `filePath` is an absolute file path starting from the filesystem root.
8
13
  *
@@ -13,6 +18,7 @@ function assertFilePathAbsoluteFilesystem(filePath) {
13
18
  // - For Windows users, the assert is correct.
14
19
  // - For Linux users assertFilePathAbsoluteFilesystem() will erroneously succeed if `p` is a path absolute from the user root dir.
15
20
  // - But that's okay because the assertion will eventually fail for Windows users.
21
+ // - On Linux there doesn't seem to be a way to distinguish between an absolute path starting from the filesystem root or starting from the user root directory, see comment at isFilePathAbsoluteFilesystem()
16
22
  assert(isFilePathAbsoluteFilesystem(filePath));
17
23
  assertPosixPath(filePath);
18
24
  }
@@ -28,7 +34,7 @@ function isFilePathAbsoluteFilesystem(filePath) {
28
34
  // - File path absolute starting from filesystem root, e.g. /home/rom/code/my-app/pages/about/+Page.js
29
35
  // - File path absolute starting from user root dir (Vite's `config.root`), e.g. /pages/about/+Page.js
30
36
  // - Checking whether `p` starts with the first directory of process.cwd() (or `userRootDir`) can be erroneous, most notably when using docker: https://github.com/vikejs/vike/issues/703
31
- // - Using require.resolve() would be a solution but probably too slow?
37
+ // - Using require.resolve() or node:fs to check wehther the file/dir exsits would be a solution, but maybe too slow?
32
38
  return filePath.startsWith('/');
33
39
  }
34
40
  else {
@@ -7,6 +7,7 @@ export { assertPosixPath };
7
7
  // - Robust shim reference: https://github.com/unjs/pathe
8
8
  import { assert } from './assert.js';
9
9
  import { assertIsNotBrowser } from './assertIsNotBrowser.js';
10
+ // While this path shim also works on the client-side, let's try to not use it on the client-side in order to minimize KBs sent to the browser.
10
11
  assertIsNotBrowser();
11
12
  /**********************/
12
13
  /****** SHIMS *********/
@@ -1,4 +1,4 @@
1
1
  export declare const projectInfo: {
2
2
  projectName: "Vike";
3
- projectVersion: "0.4.223-commit-e239e2b";
3
+ projectVersion: "0.4.223-commit-3502685";
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.223-commit-e239e2b",
3
+ "version": "0.4.223-commit-3502685",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {