vike 0.4.222 → 0.4.223-commit-586dbfb

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 (161) hide show
  1. package/dist/cjs/client/shared/getPageContextProxyForUser.js +1 -1
  2. package/dist/cjs/node/api/prepareViteApiCall.js +1 -1
  3. package/dist/cjs/node/plugin/index.js +6 -4
  4. package/dist/cjs/node/plugin/plugins/baseUrls.js +9 -2
  5. package/dist/cjs/node/plugin/plugins/buildApp.js +14 -7
  6. package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +49 -19
  7. package/dist/cjs/node/plugin/plugins/buildConfig.js +6 -1
  8. package/dist/cjs/node/plugin/plugins/commonConfig.js +17 -1
  9. package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -1
  10. package/dist/cjs/node/plugin/plugins/envVars.js +2 -18
  11. package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +2 -2
  12. package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +1 -1
  13. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/assertExtensions.js +4 -4
  14. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +6 -1
  15. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +11 -10
  16. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +8 -5
  17. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +36 -71
  18. package/dist/cjs/node/plugin/shared/findPageFiles.js +3 -3
  19. package/dist/cjs/node/plugin/shared/getHttpRequestAsyncStore.js +1 -1
  20. package/dist/cjs/node/plugin/shared/viteIsSSR.js +19 -10
  21. package/dist/cjs/node/prerender/runPrerender.js +3 -1
  22. package/dist/cjs/node/runtime/globalContext.js +19 -8
  23. package/dist/cjs/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +1 -1
  24. package/dist/cjs/node/runtime/renderPage/createHttpResponse.js +24 -0
  25. package/dist/cjs/node/runtime/renderPage/getPageAssets.js +1 -1
  26. package/dist/cjs/node/runtime/renderPage/handlePageContextRequestUrl.js +1 -1
  27. package/dist/cjs/node/runtime/renderPage/isNewError.js +1 -1
  28. package/dist/cjs/node/runtime/renderPage/isVikeConfigInvalid.js +10 -0
  29. package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +1 -1
  30. package/dist/cjs/node/runtime/renderPage/logErrorHint.js +7 -1
  31. package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -4
  32. package/dist/cjs/node/runtime/renderPage.js +63 -49
  33. package/dist/cjs/node/runtime/universal-middleware.js +14 -0
  34. package/dist/cjs/node/shared/resolveBase.js +0 -13
  35. package/dist/cjs/shared/getPageConfigsRuntime.js +2 -8
  36. package/dist/cjs/shared/getPageContextRequestUrl.js +1 -1
  37. package/dist/cjs/shared/getPageContextUrlComputed.js +12 -9
  38. package/dist/cjs/shared/hooks/getHook.js +1 -1
  39. package/dist/cjs/shared/page-configs/getPageConfigUserFriendly.js +44 -12
  40. package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -8
  41. package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +16 -6
  42. package/dist/cjs/shared/route/loadPageRoutes.js +1 -1
  43. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  44. package/dist/cjs/utils/assert.js +1 -1
  45. package/dist/cjs/utils/assertSetup.js +1 -1
  46. package/dist/cjs/utils/assertSingleInstance.js +2 -2
  47. package/dist/cjs/utils/findFile.js +1 -1
  48. package/dist/cjs/utils/getGlobalObject.js +2 -6
  49. package/dist/cjs/utils/parseUrl-extras.js +2 -2
  50. package/dist/cjs/utils/parseUrl.js +5 -5
  51. package/dist/cjs/utils/requireResolve.js +3 -3
  52. package/dist/esm/client/client-routing-runtime/getPageContextCurrent.d.ts +2 -2
  53. package/dist/esm/client/client-routing-runtime/getPageContextCurrent.js +1 -1
  54. package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.d.ts +4 -4
  55. package/dist/esm/client/client-routing-runtime/getPageContextFromHooks.js +1 -1
  56. package/dist/esm/client/client-routing-runtime/history.js +1 -1
  57. package/dist/esm/client/client-routing-runtime/index.d.ts +1 -0
  58. package/dist/esm/client/client-routing-runtime/index.js +1 -0
  59. package/dist/esm/client/client-routing-runtime/prefetch/getPrefetchSettings.d.ts +2 -2
  60. package/dist/esm/client/client-routing-runtime/prefetch.d.ts +2 -2
  61. package/dist/esm/client/client-routing-runtime/prefetch.js +3 -3
  62. package/dist/esm/client/client-routing-runtime/renderPageClientSide.d.ts +8 -0
  63. package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +12 -3
  64. package/dist/esm/client/client-routing-runtime/scrollRestoration.js +1 -1
  65. package/dist/esm/client/client-routing-runtime/skipLink.js +2 -2
  66. package/dist/esm/client/server-routing-runtime/getPageContext.d.ts +1 -1
  67. package/dist/esm/client/shared/executeOnRenderClientHook.d.ts +2 -2
  68. package/dist/esm/client/shared/getPageContextProxyForUser.js +1 -1
  69. package/dist/esm/client/shared/loadUserFilesClientSide.d.ts +2 -2
  70. package/dist/esm/client/shared/loadUserFilesClientSide.js +2 -2
  71. package/dist/esm/client/shared/preparePageContextForUserConsumptionClientSide.d.ts +2 -2
  72. package/dist/esm/node/api/prepareViteApiCall.js +1 -1
  73. package/dist/esm/node/plugin/index.d.ts +6 -2
  74. package/dist/esm/node/plugin/index.js +2 -1
  75. package/dist/esm/node/plugin/plugins/baseUrls.js +9 -2
  76. package/dist/esm/node/plugin/plugins/buildApp.js +14 -7
  77. package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +49 -19
  78. package/dist/esm/node/plugin/plugins/buildConfig.js +6 -1
  79. package/dist/esm/node/plugin/plugins/commonConfig.d.ts +14 -6
  80. package/dist/esm/node/plugin/plugins/commonConfig.js +17 -1
  81. package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +1 -1
  82. package/dist/esm/node/plugin/plugins/envVars.js +2 -18
  83. package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +3 -3
  84. package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +1 -1
  85. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/assertExtensions.js +4 -4
  86. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +6 -1
  87. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +10 -9
  88. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +8 -5
  89. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +5 -5
  90. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +38 -73
  91. package/dist/esm/node/plugin/shared/findPageFiles.js +3 -3
  92. package/dist/esm/node/plugin/shared/getHttpRequestAsyncStore.js +2 -2
  93. package/dist/esm/node/plugin/shared/viteIsSSR.d.ts +7 -4
  94. package/dist/esm/node/plugin/shared/viteIsSSR.js +20 -11
  95. package/dist/esm/node/prerender/runPrerender.js +3 -1
  96. package/dist/esm/node/runtime/globalContext.d.ts +9 -8
  97. package/dist/esm/node/runtime/globalContext.js +19 -8
  98. package/dist/esm/node/runtime/html/injectAssets/getViteDevScript.d.ts +2 -2
  99. package/dist/esm/node/runtime/html/injectAssets.d.ts +2 -2
  100. package/dist/esm/node/runtime/renderPage/analyzePage.d.ts +2 -2
  101. package/dist/esm/node/runtime/renderPage/createHttpResponse/assertNoInfiniteHttpRedirect.js +1 -1
  102. package/dist/esm/node/runtime/renderPage/createHttpResponse.d.ts +2 -0
  103. package/dist/esm/node/runtime/renderPage/createHttpResponse.js +24 -0
  104. package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.d.ts +2 -2
  105. package/dist/esm/node/runtime/renderPage/getPageAssets.d.ts +2 -2
  106. package/dist/esm/node/runtime/renderPage/getPageAssets.js +1 -1
  107. package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.d.ts +2 -2
  108. package/dist/esm/node/runtime/renderPage/handlePageContextRequestUrl.js +1 -1
  109. package/dist/esm/node/runtime/renderPage/isNewError.js +1 -1
  110. package/dist/esm/node/runtime/renderPage/isVikeConfigInvalid.d.ts +6 -0
  111. package/dist/esm/node/runtime/renderPage/isVikeConfigInvalid.js +8 -0
  112. package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.d.ts +3 -3
  113. package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +2 -2
  114. package/dist/esm/node/runtime/renderPage/log404/index.d.ts +2 -2
  115. package/dist/esm/node/runtime/renderPage/logErrorHint.js +7 -1
  116. package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +4 -4
  117. package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +12 -12
  118. package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -4
  119. package/dist/esm/node/runtime/renderPage.d.ts +5 -5
  120. package/dist/esm/node/runtime/renderPage.js +64 -49
  121. package/dist/esm/node/runtime/universal-middleware.d.ts +1 -0
  122. package/dist/esm/node/runtime/universal-middleware.js +11 -0
  123. package/dist/esm/node/shared/resolveBase.d.ts +1 -9
  124. package/dist/esm/node/shared/resolveBase.js +0 -13
  125. package/dist/esm/shared/getPageConfigsRuntime.d.ts +2 -2
  126. package/dist/esm/shared/getPageConfigsRuntime.js +3 -9
  127. package/dist/esm/shared/getPageContextRequestUrl.js +1 -1
  128. package/dist/esm/shared/getPageContextUrlComputed.js +12 -9
  129. package/dist/esm/shared/getPageFiles.d.ts +1 -1
  130. package/dist/esm/shared/hooks/getHook.d.ts +3 -3
  131. package/dist/esm/shared/hooks/getHook.js +1 -1
  132. package/dist/esm/shared/page-configs/Config.d.ts +3 -1
  133. package/dist/esm/shared/page-configs/PageConfig.d.ts +12 -4
  134. package/dist/esm/shared/page-configs/getPageConfigUserFriendly.d.ts +24 -16
  135. package/dist/esm/shared/page-configs/getPageConfigUserFriendly.js +44 -12
  136. package/dist/esm/shared/page-configs/serialize/PageConfigSerialized.d.ts +3 -2
  137. package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +2 -8
  138. package/dist/esm/shared/page-configs/serialize/serializeConfigValues.d.ts +2 -0
  139. package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +16 -6
  140. package/dist/esm/shared/route/executeGuardHook.d.ts +2 -2
  141. package/dist/esm/shared/route/loadPageRoutes.js +1 -1
  142. package/dist/esm/shared/types.d.ts +6 -0
  143. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  144. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  145. package/dist/esm/utils/assert.js +1 -1
  146. package/dist/esm/utils/assertSetup.js +1 -1
  147. package/dist/esm/utils/assertSingleInstance.js +2 -2
  148. package/dist/esm/utils/findFile.js +1 -1
  149. package/dist/esm/utils/getGlobalObject.d.ts +3 -2
  150. package/dist/esm/utils/getGlobalObject.js +2 -6
  151. package/dist/esm/utils/parseUrl-extras.js +2 -2
  152. package/dist/esm/utils/parseUrl.d.ts +3 -4
  153. package/dist/esm/utils/parseUrl.js +5 -5
  154. package/dist/esm/utils/projectInfo.d.ts +1 -1
  155. package/dist/esm/utils/requireResolve.js +3 -3
  156. package/package.json +18 -6
  157. package/universal-middleware.js +3 -0
  158. package/dist/cjs/node/runtime/renderPage/isConfigInvalid.js +0 -10
  159. package/dist/esm/node/runtime/renderPage/isConfigInvalid.d.ts +0 -6
  160. package/dist/esm/node/runtime/renderPage/isConfigInvalid.js +0 -8
  161. package/dist-cjs-fixup.mjs +0 -41
@@ -13,7 +13,7 @@ exports.getConfigDefinitionOptional = getConfigDefinitionOptional;
13
13
  const utils_js_1 = require("../../../utils.js");
14
14
  const configDefinitionsBuiltIn_js_1 = require("./getVikeConfig/configDefinitionsBuiltIn.js");
15
15
  const filesystemRouting_js_1 = require("./getVikeConfig/filesystemRouting.js");
16
- const isConfigInvalid_js_1 = require("../../../../runtime/renderPage/isConfigInvalid.js");
16
+ const isVikeConfigInvalid_js_1 = require("../../../../runtime/renderPage/isVikeConfigInvalid.js");
17
17
  const globalContext_js_1 = require("../../../../runtime/globalContext.js");
18
18
  const loggerNotProd_js_1 = require("../../../shared/loggerNotProd.js");
19
19
  const removeSuperfluousViteLog_js_1 = require("../../../shared/loggerVite/removeSuperfluousViteLog.js");
@@ -43,7 +43,7 @@ function reloadVikeConfig(config) {
43
43
  handleReloadSideEffects();
44
44
  }
45
45
  async function handleReloadSideEffects() {
46
- wasConfigInvalid = !!isConfigInvalid_js_1.isConfigInvalid;
46
+ wasConfigInvalid = !!isVikeConfigInvalid_js_1.isVikeConfigInvalid;
47
47
  const vikeConfigPromisePrevious = vikeConfigPromise;
48
48
  try {
49
49
  await vikeConfigPromise;
@@ -58,7 +58,7 @@ async function handleReloadSideEffects() {
58
58
  // Let the next handleReloadSideEffects() call handle side effects
59
59
  return;
60
60
  }
61
- if (!isConfigInvalid_js_1.isConfigInvalid) {
61
+ if (!isVikeConfigInvalid_js_1.isVikeConfigInvalid) {
62
62
  if (wasConfigInvalid) {
63
63
  wasConfigInvalid = false;
64
64
  (0, loggerNotProd_js_1.logConfigErrorRecover)();
@@ -111,13 +111,13 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePlug
111
111
  if (!hasError) {
112
112
  (0, utils_js_1.assert)(ret);
113
113
  (0, utils_js_1.assert)(err === undefined);
114
- (0, isConfigInvalid_js_1.isConfigInvalid_set)(false);
114
+ (0, isVikeConfigInvalid_js_1.isVikeConfigInvalid_set)(false);
115
115
  return ret;
116
116
  }
117
117
  else {
118
118
  (0, utils_js_1.assert)(ret === undefined);
119
119
  (0, utils_js_1.assert)(err);
120
- (0, isConfigInvalid_js_1.isConfigInvalid_set)({ err });
120
+ (0, isVikeConfigInvalid_js_1.isVikeConfigInvalid_set)({ err });
121
121
  if (!isDev) {
122
122
  (0, utils_js_1.assert)((0, globalContext_js_1.getViteDevServer)() === null);
123
123
  throw err;
@@ -133,7 +133,7 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePlug
133
133
  configDefinitions: {},
134
134
  configValueSources: {}
135
135
  },
136
- global: (0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendlyNew)({ configValues: {} }),
136
+ global: (0, getPageConfigUserFriendly_js_1.getPageConfigGlobalUserFriendly)({ pageConfigGlobalValues: {} }),
137
137
  pages: {}
138
138
  };
139
139
  return dummyData;
@@ -149,18 +149,12 @@ async function loadVikeConfig(userRootDir, vikeVitePluginOptions) {
149
149
  // interop vike(options) in vite.config.js
150
150
  temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, userRootDir);
151
151
  // global
152
- const configValuesGlobal = getConfigValues(pageConfigGlobal);
153
- const global = (0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendlyNew)({ configValues: configValuesGlobal });
154
- // TODO/now DEDUPE
152
+ const pageConfigGlobalValues = getConfigValues(pageConfigGlobal);
153
+ const global = (0, getPageConfigUserFriendly_js_1.getPageConfigGlobalUserFriendly)({ pageConfigGlobalValues });
155
154
  // pages
156
155
  const pages = (0, utils_js_1.objectFromEntries)(pageConfigs.map((pageConfig) => {
157
- const configValuesLocal = getConfigValues(pageConfig, true);
158
- const configValues = { ...configValuesGlobal, ...configValuesLocal };
159
- const page = {
160
- ...(0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendlyNew)({ configValues }),
161
- route: pageConfig.routeFilesystem?.routeString ?? null
162
- };
163
- return [pageConfig.pageId, page];
156
+ const pageConfigValues = getConfigValues(pageConfig, true);
157
+ return (0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendly)(pageConfigGlobalValues, pageConfig, pageConfigValues);
164
158
  }));
165
159
  return { pageConfigs, pageConfigGlobal, global, pages };
166
160
  }
@@ -225,13 +219,12 @@ function getPageConfigsBuildTime(configDefinitionsResolved, plusFilesAll, userRo
225
219
  return;
226
220
  configValueSources[configName] = sources;
227
221
  });
228
- const { routeFilesystem, isErrorPage } = determineRouteFilesystem(locationId, configValueSources);
222
+ const pageConfigRoute = determineRouteFilesystem(locationId, configValueSources);
229
223
  applyEffectsAll(configValueSources, configDefinitionsLocal);
230
224
  const configValuesComputed = getComputed(configValueSources, configDefinitionsLocal);
231
225
  const pageConfig = {
232
226
  pageId: locationId,
233
- isErrorPage,
234
- routeFilesystem,
227
+ ...pageConfigRoute,
235
228
  configDefinitions: configDefinitionsLocal,
236
229
  plusFiles: plusFilesRelevant,
237
230
  configValueSources,
@@ -365,8 +358,8 @@ function temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, use
365
358
  locationId: '/',
366
359
  plusFile: null,
367
360
  isOverriden: configDef.cumulative ? false : sources.length > 0,
368
- valueIsImportedAtRuntime: false,
369
- valueIsDefinedByPlusFile: false
361
+ valueIsLoadedWithImport: false,
362
+ valueIsDefinedByPlusValueFile: false
370
363
  });
371
364
  });
372
365
  }
@@ -430,20 +423,10 @@ function getPlusFilesOrdered(configName, plusFilesRelevant) {
430
423
  const plusFilesConfig = plusFilesForConfigName.filter((plusFile) => plusFile.isConfigFile &&
431
424
  // We consider extensions (e.g. vike-react) later (i.e. with less priority)
432
425
  !plusFile.isExtensionConfig);
433
- // Make this value:
434
- // /pages/some-page/+{configName}.js > `export default`
435
- // override that value:
436
- // /pages/some-page/+config.js > `export default { someConfig }`
437
- const plusFileWinner = plusFilesValue[0] ?? plusFilesConfig[0];
438
- if (plusFileWinner) {
439
- const plusFilesOverriden = [...plusFilesValue, ...plusFilesConfig].filter((f) => f !== plusFileWinner);
440
- // A user-land conflict of plusFiles with the same `locationId` (we are iterating over `plusFilesRelevant: PlusFilesByLocationId`) means that the user has superfluously defined the config twice; the user should remove such redundancy as it makes things unnecessarily ambiguous.
441
- assertOverwrittenConfigFile(plusFileWinner, plusFilesOverriden, configName);
442
- [plusFileWinner, ...plusFilesOverriden].forEach((plusFile) => {
443
- (0, utils_js_1.assert)(plusFile.filePath.filePathAbsoluteUserRootDir); // ensure it's a user-land plus file
444
- populate(plusFile);
445
- });
446
- }
426
+ [...plusFilesValue, ...plusFilesConfig].forEach((plusFile) => {
427
+ (0, utils_js_1.assert)(plusFile.filePath.filePathAbsoluteUserRootDir); // ensure it's a user-land plus file
428
+ populate(plusFile);
429
+ });
447
430
  }
448
431
  // ==========================
449
432
  // Side-effect configs (next)
@@ -495,8 +478,8 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
495
478
  let valueFilePath;
496
479
  if (plusFile.isConfigFile) {
497
480
  // Defined over pointer import
498
- (0, utils_js_1.assert)(confVal.configValueLoaded);
499
- const pointerImport = (0, resolvePointerImport_js_1.resolvePointerImport)(confVal.configValue, plusFile.filePath, userRootDir, configName);
481
+ (0, utils_js_1.assert)(confVal.valueIsLoaded);
482
+ const pointerImport = (0, resolvePointerImport_js_1.resolvePointerImport)(confVal.value, plusFile.filePath, userRootDir, configName);
500
483
  const configDefinedAt = (0, getConfigDefinedAt_js_1.getConfigDefinedAt)('Config', configName, definedAtFilePath_);
501
484
  (0, utils_js_1.assertUsage)(pointerImport, `${configDefinedAt} should be an import`);
502
485
  valueFilePath = pointerImport.fileExportPath.filePathAbsoluteVite;
@@ -517,8 +500,8 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
517
500
  value: valueFilePath,
518
501
  valueIsFilePath: true,
519
502
  configEnv: configDef.env,
520
- valueIsImportedAtRuntime: true,
521
- valueIsDefinedByPlusFile: false,
503
+ valueIsLoadedWithImport: false,
504
+ valueIsDefinedByPlusValueFile: false,
522
505
  isOverriden,
523
506
  definedAtFilePath
524
507
  };
@@ -526,8 +509,7 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
526
509
  }
527
510
  // +config.js
528
511
  if (plusFile.isConfigFile) {
529
- (0, utils_js_1.assert)(confVal.configValueLoaded);
530
- const { configValue } = confVal;
512
+ (0, utils_js_1.assert)(confVal.valueIsLoaded);
531
513
  // Defined over pointer import
532
514
  const pointerImport = plusFile.pointerImportsByConfigName[configName];
533
515
  if (pointerImport) {
@@ -543,8 +525,8 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
543
525
  ...configValueSourceCommon,
544
526
  ...value,
545
527
  configEnv: resolveConfigEnv(configDef.env, pointerImport.fileExportPath),
546
- valueIsImportedAtRuntime: true,
547
- valueIsDefinedByPlusFile: false,
528
+ valueIsLoadedWithImport: true,
529
+ valueIsDefinedByPlusValueFile: false,
548
530
  isOverriden,
549
531
  definedAtFilePath: pointerImport.fileExportPath
550
532
  };
@@ -554,10 +536,10 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
554
536
  const configValueSource = {
555
537
  ...configValueSourceCommon,
556
538
  valueIsLoaded: true,
557
- value: configValue,
539
+ value: confVal.value,
558
540
  configEnv: configDef.env,
559
- valueIsImportedAtRuntime: false,
560
- valueIsDefinedByPlusFile: false,
541
+ valueIsLoadedWithImport: false,
542
+ valueIsDefinedByPlusValueFile: false,
561
543
  isOverriden,
562
544
  definedAtFilePath: definedAtFilePath_
563
545
  };
@@ -566,22 +548,13 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
566
548
  // Defined by value file, i.e. +{configName}.js
567
549
  if (!plusFile.isConfigFile) {
568
550
  const configEnvResolved = resolveConfigEnv(configDef.env, plusFile.filePath);
569
- const valueAlreadyLoaded = confVal.configValueLoaded;
570
- (0, utils_js_1.assert)(valueAlreadyLoaded === !!configEnvResolved.config);
571
- const value = valueAlreadyLoaded
572
- ? {
573
- valueIsLoaded: true,
574
- value: confVal.configValue
575
- }
576
- : {
577
- valueIsLoaded: false
578
- };
551
+ (0, utils_js_1.assert)(confVal.valueIsLoaded === !!configEnvResolved.config);
579
552
  const configValueSource = {
580
553
  ...configValueSourceCommon,
581
- ...value,
554
+ ...confVal,
582
555
  configEnv: configEnvResolved,
583
- valueIsImportedAtRuntime: !valueAlreadyLoaded,
584
- valueIsDefinedByPlusFile: true,
556
+ valueIsLoadedWithImport: !confVal.valueIsLoaded || !(0, serializeConfigValues_js_1.isJsonValue)(confVal.value),
557
+ valueIsDefinedByPlusValueFile: true,
585
558
  isOverriden,
586
559
  definedAtFilePath: {
587
560
  ...plusFile.filePath,
@@ -595,14 +568,6 @@ function getConfigValueSource(configName, plusFile, configDef, userRootDir, isHi
595
568
  }
596
569
  (0, utils_js_1.assert)(false);
597
570
  }
598
- function assertOverwrittenConfigFile(plusFileWinner, plusFilesOverriden, configName) {
599
- plusFilesOverriden.forEach((plusFileLoser) => {
600
- const loserFilePath = plusFileLoser.filePath.filePathToShowToUser;
601
- const winnerFilePath = plusFileWinner.filePath.filePathToShowToUser;
602
- const confName = picocolors_1.default.cyan(configName);
603
- (0, utils_js_1.assertWarning)(false, `The value of the config ${confName} defined at ${loserFilePath} is always overwritten by the value defined at ${winnerFilePath}, remove the superfluous value defined at ${loserFilePath}`, { onlyOnce: true });
604
- });
605
- }
606
571
  function isDefiningPage(plusFiles) {
607
572
  for (const plusFile of plusFiles) {
608
573
  const configNames = getDefiningConfigNames(plusFile);
@@ -636,8 +601,8 @@ function getConfigDefinitions(plusFilesRelevant, filter) {
636
601
  const confVal = getConfVal(plusFile, 'meta');
637
602
  if (!confVal)
638
603
  return;
639
- (0, utils_js_1.assert)(confVal.configValueLoaded);
640
- const meta = confVal.configValue;
604
+ (0, utils_js_1.assert)(confVal.valueIsLoaded);
605
+ const meta = confVal.value;
641
606
  assertMetaUsage(meta, `Config ${picocolors_1.default.cyan('meta')} defined at ${plusFile.filePath.filePathToShowToUser}`);
642
607
  // Set configDef._userEffectDefinedAtFilePath
643
608
  Object.entries(meta).forEach(([configName, configDef]) => {
@@ -933,8 +898,8 @@ function getConfVal(plusFile, configName) {
933
898
  if (!configNames.includes(configName))
934
899
  return null;
935
900
  if (plusFile.isNotLoaded)
936
- return { configValueLoaded: false };
937
- const confVal = { configValue: plusFile.fileExportsByConfigName[configName], configValueLoaded: true };
901
+ return { valueIsLoaded: false };
902
+ const confVal = { value: plusFile.fileExportsByConfigName[configName], valueIsLoaded: true };
938
903
  return confVal;
939
904
  }
940
905
  function resolveConfigEnv(configEnv, filePath) {
@@ -4,7 +4,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.findPageFiles = findPageFiles;
7
- const fast_glob_1 = __importDefault(require("fast-glob"));
7
+ const tinyglobby_1 = require("tinyglobby");
8
8
  const utils_js_1 = require("../utils.js");
9
9
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
10
10
  const getOutDirs_js_1 = require("./getOutDirs.js");
@@ -12,11 +12,11 @@ async function findPageFiles(config, fileTypes, isDev) {
12
12
  const cwd = config.root;
13
13
  const { outDirRoot } = (0, getOutDirs_js_1.getOutDirs)(config);
14
14
  const timeBase = new Date().getTime();
15
- let pageFiles = await (0, fast_glob_1.default)(fileTypes.map((fileType) => `**/*${fileType}.${utils_js_1.scriptFileExtensions}`), { ignore: ['**/node_modules/**', `${outDirRoot}/**`], cwd, dot: false });
15
+ let pageFiles = await (0, tinyglobby_1.glob)(fileTypes.map((fileType) => `**/*${fileType}.${utils_js_1.scriptFileExtensions}`), { ignore: ['**/node_modules/**', `${outDirRoot}/**`], cwd, dot: false, expandDirectories: false });
16
16
  pageFiles = pageFiles.map((p) => '/' + (0, utils_js_1.toPosixPath)(p));
17
17
  const time = new Date().getTime() - timeBase;
18
18
  if (isDev) {
19
- // We only warn in dev, because while building it's expected to take a long time as fast-glob is competing for resources with other tasks
19
+ // We only warn in dev, because while building it's expected to take a long time as tinyglobby is competing for resources with other tasks
20
20
  (0, utils_js_1.assertWarning)(time < 1.5 * 1000, `Finding your page files ${picocolors_1.default.cyan('**/*.page.*')} took an unexpected long time (${time}ms). Reach out to the vike maintainer.`, {
21
21
  onlyOnce: 'slow-page-files-search'
22
22
  });
@@ -55,7 +55,7 @@ async function installHttpRequestAsyncStore() {
55
55
  return;
56
56
  }
57
57
  asyncLocalStorage = new mod.AsyncLocalStorage();
58
- (0, renderPage_js_1.renderPage_addWrapper)(async (httpRequestId, renderPage) => {
58
+ (0, renderPage_js_1.renderPage_addAsyncHookwrapper)(async (httpRequestId, renderPage) => {
59
59
  (0, utils_js_1.assert)(asyncLocalStorage);
60
60
  const loggedErrors = new Set();
61
61
  const markErrorAsLogged = (err) => {
@@ -2,21 +2,30 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.viteIsSSR = viteIsSSR;
4
4
  exports.viteIsSSR_options = viteIsSSR_options;
5
+ exports.viteIsSSR_safe = viteIsSSR_safe;
5
6
  const assert_js_1 = require("../../../utils/assert.js");
6
- const isObject_js_1 = require("../../../utils/isObject.js");
7
7
  function viteIsSSR(config) {
8
8
  return !!config?.build?.ssr;
9
9
  }
10
- // https://github.com/vitejs/vite/discussions/5109#discussioncomment-1450726
11
10
  function viteIsSSR_options(options) {
12
- if (options === undefined) {
13
- return false;
14
- }
15
- if (typeof options === 'boolean') {
16
- return options;
11
+ return !!options?.ssr;
12
+ }
13
+ // Vite is quite messy about setting `ssr: boolean`, thus we use an extra safe implemention for security purposes.
14
+ // It's used for .client.js and .server.js guarantee thus we use agressive assert() calls for added safety.
15
+ function viteIsSSR_safe(config, options) {
16
+ if (config.command === 'build') {
17
+ (0, assert_js_1.assert)(typeof config.build.ssr === 'boolean');
18
+ const val = config.build.ssr;
19
+ if (options?.ssr !== undefined)
20
+ (0, assert_js_1.assert)(val === options.ssr);
21
+ return val;
17
22
  }
18
- if ((0, isObject_js_1.isObject)(options)) {
19
- return !!options.ssr;
23
+ else {
24
+ (0, assert_js_1.assert)(typeof options?.ssr === 'boolean');
25
+ const val = options.ssr;
26
+ /* This assert() fails (which is very unexpected).
27
+ if (typeof config.build.ssr === 'boolean') assert(val === config.build.ssr)
28
+ //*/
29
+ return val;
20
30
  }
21
- (0, assert_js_1.assert)(false);
22
31
  }
@@ -68,6 +68,7 @@ const resolvePrerenderConfig_js_1 = require("./resolvePrerenderConfig.js");
68
68
  const getOutDirs_js_1 = require("../plugin/shared/getOutDirs.js");
69
69
  const context_js_2 = require("../cli/context.js");
70
70
  const isViteCliCall_js_1 = require("../plugin/shared/isViteCliCall.js");
71
+ const commonConfig_js_1 = require("../plugin/plugins/commonConfig.js");
71
72
  async function runPrerenderFromAPI(options = {}) {
72
73
  return await runPrerender(options, 'prerender()');
73
74
  // - We purposely propagate the error to the user land, so that the error interrupts the user land. It's also, I guess, a nice-to-have that the user has control over the error.
@@ -98,7 +99,8 @@ async function runPrerenderFromAutoRun(viteConfig, config) {
98
99
  (0, logErrorHint_js_1.logErrorHint)(err);
99
100
  process.exit(1);
100
101
  }
101
- config.vike.prerenderContext = prerenderContextPublic;
102
+ const vike = (0, commonConfig_js_1.getVikeConfigPublic)(config);
103
+ vike.prerenderContext = prerenderContextPublic;
102
104
  const forceExit = (0, context_js_2.isVikeCli)() || (0, isViteCliCall_js_1.isViteCliCall)();
103
105
  return { forceExit };
104
106
  }
@@ -21,7 +21,7 @@ exports.assertBuildInfo = assertBuildInfo;
21
21
  exports.getViteConfigRuntime = getViteConfigRuntime;
22
22
  exports.updateUserFiles = updateUserFiles;
23
23
  // The core logic revolves around:
24
- // - globalObject.userFiles which is the main requirement for assembleGlobalContext()
24
+ // - globalObject.userFiles which is the main requirement for resolveGlobalContext()
25
25
  // - In production: globalObject.buildEntry which is the production entry set by @brillout/vite-plugin-server-entry
26
26
  // - loadBuildEntry() sets globalObject.buildEntry and then sets globalObject.userFiles
27
27
  // - With vike-server it's set at server start: @brillout/vite-plugin-server-entry injects `import './entry.mjs'` (the production entry generated by @brillout/vite-plugin-server-entry) as first line of code of dist/server/index.mjs while dist/server/entry.mjs calls setGlobalContext_buildEntry()
@@ -35,8 +35,9 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
35
35
  const loadPageRoutes_js_1 = require("../../shared/route/loadPageRoutes.js");
36
36
  const assertV1Design_js_1 = require("../shared/assertV1Design.js");
37
37
  const getPageConfigsRuntime_js_1 = require("../../shared/getPageConfigsRuntime.js");
38
+ const resolveBase_js_1 = require("../shared/resolveBase.js");
38
39
  const debug = (0, utils_js_1.createDebugger)('vike:globalContext');
39
- const globalObject = (0, utils_js_1.getGlobalObject)('globalContext.ts', getInitialGlobalContext());
40
+ const globalObject = (0, utils_js_1.getGlobalObject)('runtime/globalContext.ts', getInitialGlobalContext());
40
41
  async function getGlobalContextInternal() {
41
42
  // getGlobalContextInternal() should always be called after initGlobalContext()
42
43
  (0, utils_js_1.assert)(globalObject.isInitialized);
@@ -82,7 +83,9 @@ function makePublic(globalContext) {
82
83
  'assetsManifest',
83
84
  'config',
84
85
  'viteConfig',
85
- 'pages'
86
+ 'pages',
87
+ 'baseServer',
88
+ 'baseAssets'
86
89
  ]);
87
90
  return globalContextPublic;
88
91
  }
@@ -124,7 +127,7 @@ function getViteConfig() {
124
127
  }
125
128
  async function initGlobalContext_renderPage() {
126
129
  debug('initGlobalContext_renderPage()');
127
- // globalObject.isProduction isn't set upon production server without vike-server (there isn't any signal we can use)
130
+ // `globalObject.isProduction === undefined` when using production server without `vike-server`. (There isn't any reliable signal we can use to determine early whether the environement is production or development.)
128
131
  if (globalObject.isProduction === undefined)
129
132
  setIsProduction(true);
130
133
  await initGlobalContext();
@@ -187,7 +190,7 @@ function setIsProduction(isProduction) {
187
190
  globalObject.isProduction = isProduction;
188
191
  }
189
192
  function defineGlobalContext() {
190
- const globalContext = assembleGlobalContext();
193
+ const globalContext = resolveGlobalContext();
191
194
  assertIsDefined(globalContext);
192
195
  const globalContext_public = makePublic(globalContext);
193
196
  (0, utils_js_1.objectAssign)(globalContext, { globalContext_public });
@@ -196,7 +199,7 @@ function defineGlobalContext() {
196
199
  assertGlobalContextIsDefined();
197
200
  (0, utils_js_1.onSetupRuntime)();
198
201
  }
199
- function assembleGlobalContext() {
202
+ function resolveGlobalContext() {
200
203
  const { viteDevServer, viteConfig, isPrerendering, isProduction, userFiles } = globalObject;
201
204
  (0, utils_js_1.assert)(typeof isProduction === 'boolean');
202
205
  let globalContext;
@@ -215,7 +218,8 @@ function assembleGlobalContext() {
215
218
  viteDevServer,
216
219
  viteConfig,
217
220
  ...userFiles,
218
- viteConfigRuntime
221
+ viteConfigRuntime,
222
+ ...resolveBaseRuntime(viteConfigRuntime, userFiles.config)
219
223
  };
220
224
  }
221
225
  else {
@@ -232,7 +236,8 @@ function assembleGlobalContext() {
232
236
  ...userFiles,
233
237
  viteDevServer: null,
234
238
  viteConfigRuntime: buildInfo.viteConfigRuntime,
235
- usesClientRouter: buildInfo.usesClientRouter
239
+ usesClientRouter: buildInfo.usesClientRouter,
240
+ ...resolveBaseRuntime(buildInfo.viteConfigRuntime, userFiles.config)
236
241
  };
237
242
  if (isPrerendering) {
238
243
  (0, utils_js_1.assert)(viteConfig);
@@ -401,3 +406,9 @@ function getInitialGlobalContext() {
401
406
  viteDevServerPromiseResolve
402
407
  };
403
408
  }
409
+ function resolveBaseRuntime(viteConfigRuntime, config) {
410
+ const baseViteOriginal = viteConfigRuntime._baseViteOriginal;
411
+ const baseServerUnresolved = config.baseServer ?? null;
412
+ const baseAssetsUnresolved = config.baseAssets ?? null;
413
+ return (0, resolveBase_js_1.resolveBase)(baseViteOriginal, baseServerUnresolved, baseAssetsUnresolved);
414
+ }
@@ -6,7 +6,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.assertNoInfiniteHttpRedirect = assertNoInfiniteHttpRedirect;
7
7
  const utils_js_1 = require("../../utils.js");
8
8
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
9
- const globalObject = (0, utils_js_1.getGlobalObject)('assertNoInfiniteHttpRedirect.ts', {
9
+ const globalObject = (0, utils_js_1.getGlobalObject)('createHttpResponse/assertNoInfiniteHttpRedirect.ts', {
10
10
  redirectGraph: {}
11
11
  });
12
12
  function assertNoInfiniteHttpRedirect(urlRedirectTarget, urlLogical) {
@@ -5,6 +5,7 @@ exports.createHttpResponsePageContextJson = createHttpResponsePageContextJson;
5
5
  exports.createHttpResponseError = createHttpResponseError;
6
6
  exports.createHttpResponseRedirect = createHttpResponseRedirect;
7
7
  exports.createHttpResponseFavicon404 = createHttpResponseFavicon404;
8
+ exports.createHttpResponseBaseIsMissing = createHttpResponseBaseIsMissing;
8
9
  const utils_js_1 = require("../utils.js");
9
10
  const error_page_js_1 = require("../../../shared/error-page.js");
10
11
  const getHttpResponseBody_js_1 = require("./getHttpResponseBody.js");
@@ -40,6 +41,29 @@ function createHttpResponseFavicon404() {
40
41
  const httpResponse = createHttpResponse(404, 'text/html;charset=utf-8', [], "<p>No favicon.ico found.</p><script>console.log('This HTTP response was generated by Vike.')</script>");
41
42
  return httpResponse;
42
43
  }
44
+ function createHttpResponseBaseIsMissing(urlOriginal, baseServer) {
45
+ const httpResponse = createHttpResponse(
46
+ // We use the error code `500` to signal a failing state because this HTTP response should never be used, see https://vike.dev/base-url#setup
47
+ // In other words: this HTTP response is expected to be generated but isn't expected to be actually used.
48
+ 500, 'text/html;charset=utf-8', [], `
49
+ <h1>Error: Base URL is missing</h1>
50
+ <p>
51
+ <a href="https://vike.dev/renderPage"><code>renderPage(pageContextInit)</code></a> called with <code>pageContextInit.urlOriginal===${JSON.stringify(urlOriginal)}</code> which doesn't start with the Base URL <code>${baseServer}</code>.
52
+ </p>
53
+ <p>
54
+ See <a href="https://vike.dev/base-url#setup">vike.dev/base-url#setup</a> for how to properly setup your server while using a Base URL.
55
+ </p>
56
+ <style>
57
+ code {
58
+ font-family: monospace;
59
+ background-color: #eaeaea;
60
+ padding: 3px 5px;
61
+ border-radius: 4px;
62
+ }
63
+ </style>
64
+ `);
65
+ return httpResponse;
66
+ }
43
67
  function createHttpResponseError(pageContext) {
44
68
  const reason = (() => {
45
69
  if (!pageContext) {
@@ -8,7 +8,7 @@ const retrieveAssetsProd_js_1 = require("./getPageAssets/retrieveAssetsProd.js")
8
8
  const inferMediaType_js_1 = require("./inferMediaType.js");
9
9
  const getManifestEntry_js_1 = require("./getPageAssets/getManifestEntry.js");
10
10
  const sortPageAssetsForEarlyHintsHeader_js_1 = require("./getPageAssets/sortPageAssetsForEarlyHintsHeader.js");
11
- const globalObject = (0, utils_js_1.getGlobalObject)('getPageAssets.ts', {
11
+ const globalObject = (0, utils_js_1.getGlobalObject)('renderPage/getPageAssets.ts', {
12
12
  resolveClientEntriesDev: null
13
13
  });
14
14
  async function getPageAssets(pageContext, clientDependencies, clientEntries) {
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.handlePageContextRequestUrl = handlePageContextRequestUrl;
4
4
  const getPageContextRequestUrl_js_1 = require("../../../shared/getPageContextRequestUrl.js");
5
5
  const utils_js_1 = require("../utils.js");
6
- // See shared/getPageContextRequestUrl.ts
6
+ // See also shared/getPageContextRequestUrl.ts
7
7
  function handlePageContextRequestUrl(url) {
8
8
  if (!hasSuffix(url)) {
9
9
  return { urlWithoutPageContextRequestSuffix: url, isPageContextRequest: false };
@@ -3,7 +3,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isNewError = isNewError;
4
4
  exports.setAlreadyLogged = setAlreadyLogged;
5
5
  const utils_js_1 = require("../utils.js");
6
- const globalObject = (0, utils_js_1.getGlobalObject)('runtime/renderPage/isNewError.ts', {
6
+ const globalObject = (0, utils_js_1.getGlobalObject)('renderPage/isNewError.ts', {
7
7
  wasAlreadyLogged: new WeakSet()
8
8
  });
9
9
  function isNewError(errErrorPage, errNominalPage) {
@@ -0,0 +1,10 @@
1
+ "use strict";
2
+ Object.defineProperty(exports, "__esModule", { value: true });
3
+ exports.isVikeConfigInvalid_set = exports.isVikeConfigInvalid = void 0;
4
+ const utils_js_1 = require("../utils.js");
5
+ let isVikeConfigInvalid;
6
+ const isVikeConfigInvalid_set = (val) => {
7
+ (0, utils_js_1.assert)(val === false || val.err);
8
+ exports.isVikeConfigInvalid = isVikeConfigInvalid = val;
9
+ };
10
+ exports.isVikeConfigInvalid_set = isVikeConfigInvalid_set;
@@ -102,7 +102,7 @@ async function loadPageUserFiles(pageFilesAll, pageConfig, pageConfigGlobal, pag
102
102
  const pageFilesServerSide = (0, getPageFiles_js_1.getPageFilesServerSide)(pageFilesAll, pageId);
103
103
  const pageConfigLoaded = !pageConfig ? null : await (0, loadConfigValues_js_1.loadConfigValues)(pageConfig, isDev);
104
104
  await Promise.all(pageFilesServerSide.map((p) => p.loadFile?.()));
105
- const pageContextExports = (0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendlyOld)(pageFilesServerSide, pageConfigLoaded, pageConfigGlobal);
105
+ const pageContextExports = (0, getPageConfigUserFriendly_js_1.getPageConfigUserFriendly_oldDesign)(pageFilesServerSide, pageConfigLoaded, pageConfigGlobal);
106
106
  return {
107
107
  pageContextExports,
108
108
  pageFilesLoaded: pageFilesServerSide
@@ -29,13 +29,19 @@ const errorsMisc = [
29
29
  mustMentionNodeModules: false
30
30
  }
31
31
  ];
32
+ const reactInvalidEelement = 'https://vike.dev/broken-npm-package#react-invalid-component';
32
33
  const errorsReact = [
33
34
  {
34
35
  errMsg: 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)',
35
- link: 'https://vike.dev/broken-npm-package#react-invalid-component',
36
+ link: reactInvalidEelement,
36
37
  // The stack trace can be user-land while the import is coming from node_modules
37
38
  mustMentionNodeModules: false
38
39
  },
40
+ {
41
+ errMsg: 'Objects are not valid as a React child',
42
+ link: reactInvalidEelement,
43
+ mustMentionNodeModules: false
44
+ },
39
45
  {
40
46
  // React's "Invalid hook call.", see https://github.com/vikejs/vike/discussions/1637#discussioncomment-9424712
41
47
  errMsg: "Cannot read properties of null (reading 'useContext')"
@@ -22,7 +22,6 @@ const preparePageContextForUserConsumptionServerSide_js_1 = require("./preparePa
22
22
  const executeGuardHook_js_1 = require("../../../shared/route/executeGuardHook.js");
23
23
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
24
24
  const isServerSideError_js_1 = require("../../../shared/misc/isServerSideError.js");
25
- const resolveBase_js_1 = require("../../shared/resolveBase.js");
26
25
  async function renderPageAlreadyRouted(pageContext) {
27
26
  // pageContext.pageId can either be the:
28
27
  // - ID of the page matching the routing, or the
@@ -117,14 +116,13 @@ async function getPageContextInitEnhanced(pageContextInit, globalContext, { ssr:
117
116
  isClientSideNavigation: false
118
117
  } } = {}) {
119
118
  (0, utils_js_1.assert)(pageContextInit.urlOriginal);
120
- const { baseServer, baseAssets } = (0, resolveBase_js_1.resolveBaseRuntime)(globalContext);
121
119
  const pageContextInitEnhanced = {};
122
120
  (0, utils_js_1.objectAssign)(pageContextInitEnhanced, pageContextInit);
123
121
  (0, utils_js_1.objectAssign)(pageContextInitEnhanced, {
124
122
  _objectCreatedByVike: true,
125
123
  // The following is defined on `pageContext` because we can eventually make these non-global
126
- _baseServer: baseServer,
127
- _baseAssets: baseAssets,
124
+ _baseServer: globalContext.baseServer,
125
+ _baseAssets: globalContext.baseAssets,
128
126
  // TODO/now: add meta.default
129
127
  _includeAssetsImportedByServer: globalContext.config.includeAssetsImportedByServer ?? true,
130
128
  // TODO/soon: use GloablContext instead