vike 0.4.215 → 0.4.217-commit-99ea561

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 (144) hide show
  1. package/dist/cjs/__internal/index.js +2 -2
  2. package/dist/cjs/node/api/build.js +10 -3
  3. package/dist/cjs/node/api/context.js +8 -6
  4. package/dist/cjs/node/api/dev.js +7 -2
  5. package/dist/cjs/node/api/{prepareApiCall.js → prepareViteApiCall.js} +16 -6
  6. package/dist/cjs/node/api/prerender.js +7 -2
  7. package/dist/cjs/node/api/preview.js +7 -2
  8. package/dist/cjs/node/api/utils.js +1 -0
  9. package/dist/cjs/node/plugin/index.js +7 -10
  10. package/dist/cjs/node/plugin/onLoad.js +2 -2
  11. package/dist/cjs/node/plugin/plugins/autoFullBuild.js +15 -12
  12. package/dist/cjs/node/plugin/plugins/baseUrls.js +17 -12
  13. package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +1 -1
  14. package/dist/cjs/node/plugin/plugins/buildConfig.js +10 -10
  15. package/dist/cjs/node/plugin/plugins/commonConfig.js +35 -4
  16. package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +5 -5
  17. package/dist/cjs/node/plugin/plugins/devConfig/index.js +1 -4
  18. package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +4 -7
  19. package/dist/cjs/node/plugin/plugins/importBuild/getVikeManifest.js +2 -2
  20. package/dist/cjs/node/plugin/plugins/importBuild/index.js +8 -6
  21. package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +8 -8
  22. package/dist/cjs/node/plugin/plugins/importUserCode/index.js +9 -13
  23. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +23 -106
  24. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveVikeConfigGlobal.js +128 -0
  25. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +42 -28
  26. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +3 -4
  27. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +1 -1
  28. package/dist/cjs/node/plugin/plugins/previewConfig.js +4 -4
  29. package/dist/cjs/node/plugin/plugins/setGlobalContext.js +35 -17
  30. package/dist/cjs/node/prerender/runPrerender.js +5 -7
  31. package/dist/cjs/node/prerender/utils.js +1 -1
  32. package/dist/cjs/node/runtime/globalContext.js +21 -13
  33. package/dist/cjs/node/runtime/index-common.js +3 -1
  34. package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +1 -1
  35. package/dist/cjs/node/runtime/renderPage.js +4 -2
  36. package/dist/cjs/node/runtime/utils.js +1 -2
  37. package/dist/cjs/node/runtime-dev/createDevMiddleware.js +25 -0
  38. package/dist/cjs/node/runtime-dev/index.js +32 -0
  39. package/dist/cjs/node/shared/resolveBase.js +41 -0
  40. package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +2 -2
  41. package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +2 -2
  42. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  43. package/dist/cjs/utils/assertSetup.js +135 -0
  44. package/dist/cjs/utils/isDocker.js +2 -2
  45. package/dist/cjs/utils/requireResolve.js +2 -2
  46. package/dist/esm/__internal/index.js +2 -2
  47. package/dist/esm/node/api/build.d.ts +5 -0
  48. package/dist/esm/node/api/build.js +10 -3
  49. package/dist/esm/node/api/context.js +9 -7
  50. package/dist/esm/node/api/dev.d.ts +5 -0
  51. package/dist/esm/node/api/dev.js +7 -2
  52. package/dist/esm/node/api/prepareViteApiCall.d.ts +7 -0
  53. package/dist/esm/node/api/{prepareApiCall.js → prepareViteApiCall.js} +16 -6
  54. package/dist/esm/node/api/prerender.d.ts +5 -0
  55. package/dist/esm/node/api/prerender.js +7 -2
  56. package/dist/esm/node/api/preview.d.ts +5 -0
  57. package/dist/esm/node/api/preview.js +7 -2
  58. package/dist/esm/node/api/utils.d.ts +1 -0
  59. package/dist/esm/node/api/utils.js +1 -0
  60. package/dist/esm/node/cli/parseCli.d.ts +1 -1
  61. package/dist/esm/node/plugin/index.d.ts +3 -3
  62. package/dist/esm/node/plugin/index.js +6 -9
  63. package/dist/esm/node/plugin/onLoad.js +1 -1
  64. package/dist/esm/node/plugin/plugins/autoFullBuild.js +15 -12
  65. package/dist/esm/node/plugin/plugins/baseUrls.d.ts +2 -2
  66. package/dist/esm/node/plugin/plugins/baseUrls.js +17 -12
  67. package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +1 -1
  68. package/dist/esm/node/plugin/plugins/buildConfig.js +11 -11
  69. package/dist/esm/node/plugin/plugins/commonConfig.d.ts +7 -1
  70. package/dist/esm/node/plugin/plugins/commonConfig.js +36 -5
  71. package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.d.ts +1 -1
  72. package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +5 -5
  73. package/dist/esm/node/plugin/plugins/devConfig/index.js +2 -5
  74. package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +4 -7
  75. package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.d.ts +3 -2
  76. package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.js +2 -2
  77. package/dist/esm/node/plugin/plugins/importBuild/index.js +8 -6
  78. package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.d.ts +2 -2
  79. package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +8 -8
  80. package/dist/esm/node/plugin/plugins/importUserCode/index.js +11 -15
  81. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.d.ts +1 -1
  82. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +23 -106
  83. package/dist/esm/{shared/ConfigVike.d.ts → node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveVikeConfigGlobal.d.ts} +14 -12
  84. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveVikeConfigGlobal.js +123 -0
  85. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +8 -6
  86. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +43 -29
  87. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +3 -4
  88. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +1 -1
  89. package/dist/esm/node/plugin/plugins/previewConfig.js +5 -5
  90. package/dist/esm/node/plugin/plugins/setGlobalContext.d.ts +1 -1
  91. package/dist/esm/node/plugin/plugins/setGlobalContext.js +37 -19
  92. package/dist/esm/node/plugin/shared/getEnvVarObject.d.ts +1 -1
  93. package/dist/esm/node/prerender/runPrerender.js +6 -8
  94. package/dist/esm/node/prerender/utils.d.ts +1 -1
  95. package/dist/esm/node/prerender/utils.js +1 -1
  96. package/dist/esm/node/runtime/globalContext.d.ts +8 -4
  97. package/dist/esm/node/runtime/globalContext.js +22 -14
  98. package/dist/esm/node/runtime/index-common.d.ts +1 -0
  99. package/dist/esm/node/runtime/index-common.js +1 -0
  100. package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +1 -1
  101. package/dist/esm/node/runtime/renderPage.js +5 -3
  102. package/dist/esm/node/runtime/utils.d.ts +1 -2
  103. package/dist/esm/node/runtime/utils.js +1 -2
  104. package/dist/esm/node/runtime-dev/createDevMiddleware.d.ts +10 -0
  105. package/dist/esm/node/runtime-dev/createDevMiddleware.js +23 -0
  106. package/dist/esm/node/runtime-dev/index.d.ts +3 -0
  107. package/dist/esm/node/runtime-dev/index.js +6 -0
  108. package/dist/esm/node/shared/resolveBase.d.ts +11 -0
  109. package/dist/esm/node/shared/resolveBase.js +36 -0
  110. package/dist/esm/shared/page-configs/Config.d.ts +2 -2
  111. package/dist/esm/shared/page-configs/getConfigValueBuildTime.js +1 -1
  112. package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +1 -1
  113. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  114. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  115. package/dist/esm/utils/assertSetup.d.ts +20 -0
  116. package/dist/esm/utils/assertSetup.js +130 -0
  117. package/dist/esm/utils/isDocker.js +1 -1
  118. package/dist/esm/utils/projectInfo.d.ts +1 -1
  119. package/dist/esm/utils/requireResolve.js +1 -1
  120. package/package.json +1 -1
  121. package/dist/cjs/node/plugin/plugins/config/assertVikeConfig.js +0 -75
  122. package/dist/cjs/node/plugin/plugins/config/index.js +0 -81
  123. package/dist/cjs/node/plugin/plugins/config/pickFirst.js +0 -6
  124. package/dist/cjs/node/plugin/plugins/config/resolveBase.js +0 -47
  125. package/dist/cjs/node/shared/getConfigVike.js +0 -10
  126. package/dist/cjs/shared/ConfigVike.js +0 -2
  127. package/dist/cjs/utils/assertIsNotProductionRuntime.js +0 -62
  128. package/dist/cjs/utils/assertNodeEnv.js +0 -106
  129. package/dist/esm/node/api/prepareApiCall.d.ts +0 -7
  130. package/dist/esm/node/plugin/plugins/config/assertVikeConfig.d.ts +0 -7
  131. package/dist/esm/node/plugin/plugins/config/assertVikeConfig.js +0 -73
  132. package/dist/esm/node/plugin/plugins/config/index.d.ts +0 -3
  133. package/dist/esm/node/plugin/plugins/config/index.js +0 -76
  134. package/dist/esm/node/plugin/plugins/config/pickFirst.d.ts +0 -1
  135. package/dist/esm/node/plugin/plugins/config/pickFirst.js +0 -3
  136. package/dist/esm/node/plugin/plugins/config/resolveBase.d.ts +0 -10
  137. package/dist/esm/node/plugin/plugins/config/resolveBase.js +0 -42
  138. package/dist/esm/node/shared/getConfigVike.d.ts +0 -4
  139. package/dist/esm/node/shared/getConfigVike.js +0 -8
  140. package/dist/esm/shared/ConfigVike.js +0 -1
  141. package/dist/esm/utils/assertIsNotProductionRuntime.d.ts +0 -12
  142. package/dist/esm/utils/assertIsNotProductionRuntime.js +0 -59
  143. package/dist/esm/utils/assertNodeEnv.d.ts +0 -10
  144. package/dist/esm/utils/assertNodeEnv.js +0 -103
@@ -6,7 +6,7 @@ exports.getMiddlewares = getMiddlewares;
6
6
  const index_js_1 = require("../shared/route/index.js");
7
7
  const getPageFiles_js_1 = require("../shared/getPageFiles.js");
8
8
  const globalContext_js_1 = require("../node/runtime/globalContext.js");
9
- const assertNodeEnv_js_1 = require("../utils/assertNodeEnv.js");
9
+ const assertSetup_js_1 = require("../utils/assertSetup.js");
10
10
  const renderPageAlreadyRouted_js_1 = require("../node/runtime/renderPage/renderPageAlreadyRouted.js");
11
11
  /**
12
12
  * Used by {@link https://github.com/magne4000/vite-plugin-vercel|vite-plugin-vercel}
@@ -15,7 +15,7 @@ const renderPageAlreadyRouted_js_1 = require("../node/runtime/renderPage/renderP
15
15
  * @param config
16
16
  */
17
17
  async function getPagesAndRoutes() {
18
- (0, assertNodeEnv_js_1.handleNodeEnv_vitePluginVercel)();
18
+ (0, assertSetup_js_1.setNodeEnvProduction)();
19
19
  const renderContext = await (0, renderPageAlreadyRouted_js_1.getRenderContext)();
20
20
  const {
21
21
  //
@@ -24,16 +24,23 @@ var __importStar = (this && this.__importStar) || function (mod) {
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
26
  exports.build = build;
27
- const prepareApiCall_js_1 = require("./prepareApiCall.js");
27
+ const prepareViteApiCall_js_1 = require("./prepareViteApiCall.js");
28
28
  const vite_1 = require("vite");
29
+ /**
30
+ * Programmatically trigger `$ vike build`
31
+ *
32
+ * https://vike.dev/api#build
33
+ */
29
34
  async function build(options = {}) {
30
- const { viteConfigEnhanced, configVike } = await (0, prepareApiCall_js_1.prepareApiCall)(options.viteConfig, 'build');
35
+ const { viteConfigEnhanced, vikeConfigGlobal } = await (0, prepareViteApiCall_js_1.prepareViteApiCall)(options.viteConfig, 'build');
31
36
  // Build client-side
32
37
  const outputClient = await (0, vite_1.build)(viteConfigEnhanced);
33
38
  // Build server-side
34
39
  const outputServer = await (0, vite_1.build)(setSSR(viteConfigEnhanced));
35
40
  // Pre-render
36
- if (configVike.prerender && !configVike.prerender.disableAutoRun && configVike.disableAutoFullBuild !== 'prerender') {
41
+ if (vikeConfigGlobal.prerender &&
42
+ !vikeConfigGlobal.prerender.disableAutoRun &&
43
+ vikeConfigGlobal.disableAutoFullBuild !== 'prerender') {
37
44
  const { runPrerenderFromAutoRun } = await Promise.resolve().then(() => __importStar(require('../prerender/runPrerender.js')));
38
45
  await runPrerenderFromAutoRun(viteConfigEnhanced, true);
39
46
  }
@@ -3,16 +3,18 @@ Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.isVikeCliOrApi = isVikeCliOrApi;
4
4
  exports.setOperation = setOperation;
5
5
  const utils_js_1 = require("./utils.js");
6
- let apiOperation;
6
+ const globalObject = (0, utils_js_1.getGlobalObject)('context.ts', {
7
+ apiOperation: undefined
8
+ });
7
9
  function getOperation() {
8
- (0, utils_js_1.assert)(apiOperation);
9
- return apiOperation;
10
+ (0, utils_js_1.assert)(globalObject.apiOperation);
11
+ return globalObject.apiOperation;
10
12
  }
11
13
  function isVikeCliOrApi() {
12
14
  // The CLI uses the API
13
- return !!apiOperation;
15
+ return !!globalObject.apiOperation;
14
16
  }
15
17
  function setOperation(operation) {
16
- (0, utils_js_1.assert)(!apiOperation);
17
- apiOperation = operation;
18
+ (0, utils_js_1.assert)(!globalObject.apiOperation);
19
+ globalObject.apiOperation = operation;
18
20
  }
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.dev = dev;
4
- const prepareApiCall_js_1 = require("./prepareApiCall.js");
4
+ const prepareViteApiCall_js_1 = require("./prepareViteApiCall.js");
5
5
  const vite_1 = require("vite");
6
+ /**
7
+ * Programmatically trigger `$ vike dev`
8
+ *
9
+ * https://vike.dev/api#dev
10
+ */
6
11
  async function dev(options = {}) {
7
- const { viteConfigEnhanced } = await (0, prepareApiCall_js_1.prepareApiCall)(options.viteConfig, 'dev');
12
+ const { viteConfigEnhanced } = await (0, prepareViteApiCall_js_1.prepareViteApiCall)(options.viteConfig, 'dev');
8
13
  const server = await (0, vite_1.createServer)(viteConfigEnhanced);
9
14
  return {
10
15
  viteServer: server,
@@ -23,12 +23,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.prepareApiCall = prepareApiCall;
26
+ exports.prepareViteApiCall = prepareViteApiCall;
27
27
  const vite_1 = require("vite");
28
- const getConfigVike_js_1 = require("../shared/getConfigVike.js");
29
28
  const pluginName_js_1 = require("../plugin/plugins/commonConfig/pluginName.js");
30
29
  const context_js_1 = require("./context.js");
31
- async function prepareApiCall(viteConfig = {}, operation) {
30
+ const getVikeConfig_js_1 = require("../plugin/plugins/importUserCode/v1-design/getVikeConfig.js");
31
+ async function prepareViteApiCall(viteConfig = {}, operation) {
32
32
  (0, context_js_1.setOperation)(operation);
33
33
  return enhanceViteConfig(viteConfig, operation);
34
34
  }
@@ -45,13 +45,23 @@ async function enhanceViteConfig(viteConfig = {}, operation) {
45
45
  };
46
46
  viteConfigResolved = await resolveViteConfig(viteConfigEnhanced, operation);
47
47
  }
48
- const configVike = await (0, getConfigVike_js_1.getConfigVike)(viteConfigResolved);
48
+ // TODO: use loadConfigFromFile() instead of viteConfigResolved
49
+ const { vikeConfigGlobal } = await (0, getVikeConfig_js_1.getVikeConfig2)(viteConfigResolved.root, operation === 'dev', viteConfigResolved._vikeVitePluginOptions);
49
50
  // TODO: enable Vike extensions to add Vite plugins
50
51
  return {
51
52
  viteConfigEnhanced,
52
- configVike
53
+ vikeConfigGlobal
53
54
  };
54
55
  }
55
56
  async function resolveViteConfig(viteConfig, operation) {
56
- return await (0, vite_1.resolveConfig)(viteConfig, operation === 'build' || operation === 'prerender' ? 'build' : 'serve', 'custom', operation === 'dev' ? 'development' : 'production', operation === 'preview');
57
+ const args = getResolveConfigArgs(viteConfig, operation);
58
+ return await (0, vite_1.resolveConfig)(...args);
59
+ }
60
+ function getResolveConfigArgs(viteConfig, operation) {
61
+ const inlineConfig = viteConfig;
62
+ const command = operation === 'build' || operation === 'prerender' ? 'build' : 'serve';
63
+ const defaultMode = operation === 'dev' ? 'development' : 'production';
64
+ const defaultNodeEnv = defaultMode;
65
+ const isPreview = operation === 'preview';
66
+ return [inlineConfig, command, defaultMode, defaultNodeEnv, isPreview];
57
67
  }
@@ -2,9 +2,14 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.prerender = prerender;
4
4
  const runPrerender_js_1 = require("../prerender/runPrerender.js");
5
- const prepareApiCall_js_1 = require("./prepareApiCall.js");
5
+ const prepareViteApiCall_js_1 = require("./prepareViteApiCall.js");
6
+ /**
7
+ * Programmatically trigger `$ vike prerender`
8
+ *
9
+ * https://vike.dev/api#prerender
10
+ */
6
11
  async function prerender(options = {}) {
7
- const { viteConfigEnhanced } = await (0, prepareApiCall_js_1.prepareApiCall)(options.viteConfig, 'prerender');
12
+ const { viteConfigEnhanced } = await (0, prepareViteApiCall_js_1.prepareViteApiCall)(options.viteConfig, 'prerender');
8
13
  options.viteConfig = viteConfigEnhanced;
9
14
  const { viteConfig } = await (0, runPrerender_js_1.runPrerenderFromAPI)(options);
10
15
  return {
@@ -1,10 +1,15 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.preview = preview;
4
- const prepareApiCall_js_1 = require("./prepareApiCall.js");
4
+ const prepareViteApiCall_js_1 = require("./prepareViteApiCall.js");
5
5
  const vite_1 = require("vite");
6
+ /**
7
+ * Programmatically trigger `$ vike preview`
8
+ *
9
+ * https://vike.dev/api#preview
10
+ */
6
11
  async function preview(options = {}) {
7
- const { viteConfigEnhanced } = await (0, prepareApiCall_js_1.prepareApiCall)(options.viteConfig, 'preview');
12
+ const { viteConfigEnhanced } = await (0, prepareViteApiCall_js_1.prepareViteApiCall)(options.viteConfig, 'preview');
8
13
  const server = await (0, vite_1.preview)(viteConfigEnhanced);
9
14
  return {
10
15
  viteServer: server,
@@ -19,3 +19,4 @@ Object.defineProperty(exports, "__esModule", { value: true });
19
19
  const onLoad_js_1 = require("./onLoad.js");
20
20
  (0, onLoad_js_1.onLoad)();
21
21
  __exportStar(require("../../utils/assert.js"), exports);
22
+ __exportStar(require("../../utils/getGlobalObject.js"), exports);
@@ -18,13 +18,12 @@ const index_js_1 = require("./plugins/devConfig/index.js");
18
18
  const packageJsonFile_js_1 = require("./plugins/packageJsonFile.js");
19
19
  const removeRequireHookPlugin_js_1 = require("./plugins/removeRequireHookPlugin.js");
20
20
  const index_js_2 = require("./plugins/importUserCode/index.js");
21
- const index_js_3 = require("./plugins/config/index.js");
22
21
  const distFileNames_js_1 = require("./plugins/distFileNames.js");
23
22
  const extractAssetsPlugin_js_1 = require("./plugins/extractAssetsPlugin.js");
24
23
  const extractExportNamesPlugin_js_1 = require("./plugins/extractExportNamesPlugin.js");
25
24
  const suppressRollupWarning_js_1 = require("./plugins/suppressRollupWarning.js");
26
25
  const setGlobalContext_js_1 = require("./plugins/setGlobalContext.js");
27
- const index_js_4 = require("./plugins/importBuild/index.js");
26
+ const index_js_3 = require("./plugins/importBuild/index.js");
28
27
  const commonConfig_js_1 = require("./plugins/commonConfig.js");
29
28
  const baseUrls_js_1 = require("./plugins/baseUrls.js");
30
29
  const envVars_js_1 = require("./plugins/envVars.js");
@@ -34,15 +33,13 @@ const getPageAssets_js_1 = require("../runtime/renderPage/getPageAssets.js");
34
33
  const resolveClientEntriesDev_js_1 = require("./resolveClientEntriesDev.js");
35
34
  const workaroundCssModuleHmr_js_1 = require("./plugins/workaroundCssModuleHmr.js");
36
35
  const vite6HmrRegressionWorkaround_js_1 = require("./plugins/vite6HmrRegressionWorkaround.js");
37
- (0, utils_js_2.assertNodeEnv_onVikePluginLoad)();
38
- (0, utils_js_2.markEnvAsVikePluginLoaded)();
36
+ (0, utils_js_2.markSetup_vikeVitePlugin)();
39
37
  assertViteVersion();
40
38
  (0, getPageAssets_js_1.setResolveClientEntriesDev)(resolveClientEntriesDev_js_1.resolveClientEntriesDev);
41
39
  // Return as `any` to avoid Plugin type mismatches when there are multiple Vite versions installed
42
- function plugin(vikeConfig) {
40
+ function plugin(vikeVitePluginOptions) {
43
41
  const plugins = [
44
- (0, index_js_3.resolveVikeConfig)(vikeConfig), // The configResolved() hook of resolveVikeConfig() should be the first called
45
- ...(0, commonConfig_js_1.commonConfig)(),
42
+ ...(0, commonConfig_js_1.commonConfig)(vikeVitePluginOptions),
46
43
  (0, index_js_2.importUserCode)(),
47
44
  ...(0, index_js_1.devConfig)(),
48
45
  ...(0, buildConfig_js_1.buildConfig)(),
@@ -54,9 +51,9 @@ function plugin(vikeConfig) {
54
51
  ...(0, extractAssetsPlugin_js_1.extractAssetsPlugin)(),
55
52
  (0, extractExportNamesPlugin_js_1.extractExportNamesPlugin)(),
56
53
  (0, suppressRollupWarning_js_1.suppressRollupWarning)(),
57
- (0, setGlobalContext_js_1.setGlobalContext)(),
58
- ...(0, index_js_4.importBuild)(),
59
- (0, baseUrls_js_1.baseUrls)(vikeConfig),
54
+ ...(0, setGlobalContext_js_1.setGlobalContext)(),
55
+ ...(0, index_js_3.importBuild)(),
56
+ (0, baseUrls_js_1.baseUrls)(vikeVitePluginOptions),
60
57
  (0, envVars_js_1.envVarsPlugin)(),
61
58
  (0, fileEnv_js_1.fileEnv)(),
62
59
  (0, workaroundCssModuleHmr_js_1.workaroundCssModuleHmr)(),
@@ -2,11 +2,11 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.onLoad = onLoad;
4
4
  const assertIsNotBrowser_js_1 = require("../../utils/assertIsNotBrowser.js");
5
- const assertIsNotProductionRuntime_js_1 = require("../../utils/assertIsNotProductionRuntime.js");
5
+ const assertSetup_js_1 = require("../../utils/assertSetup.js");
6
6
  const assertNodeVersion_js_1 = require("../../utils/assertNodeVersion.js");
7
7
  function onLoad() {
8
8
  (0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
9
9
  (0, assertNodeVersion_js_1.assertNodeVersion)();
10
10
  // Ensure we don't bloat the server runtime with heavy plugin dependencies such as esbuild
11
- (0, assertIsNotProductionRuntime_js_1.assertIsNotProductionRuntime)();
11
+ (0, assertSetup_js_1.assertIsNotProductionRuntime)();
12
12
  }
@@ -8,24 +8,25 @@ exports.autoFullBuild = autoFullBuild;
8
8
  const vite_1 = require("vite");
9
9
  const utils_js_1 = require("../utils.js");
10
10
  const runPrerender_js_1 = require("../../prerender/runPrerender.js");
11
- const getConfigVike_js_1 = require("../../shared/getConfigVike.js");
12
11
  const isViteCliCall_js_1 = require("../shared/isViteCliCall.js");
13
12
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
14
13
  const logErrorHint_js_1 = require("../../runtime/renderPage/logErrorHint.js");
15
14
  const buildConfig_js_1 = require("./buildConfig.js");
15
+ const getVikeConfig_js_1 = require("./importUserCode/v1-design/getVikeConfig.js");
16
16
  let forceExit = false;
17
17
  function autoFullBuild() {
18
18
  let config;
19
- let configVike;
19
+ let vikeConfigGlobal;
20
20
  return [
21
21
  {
22
22
  name: 'vike:autoFullBuild',
23
23
  apply: 'build',
24
24
  enforce: 'pre',
25
25
  async configResolved(config_) {
26
- configVike = await (0, getConfigVike_js_1.getConfigVike)(config_);
26
+ const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config_);
27
+ vikeConfigGlobal = vikeConfig.vikeConfigGlobal;
27
28
  config = config_;
28
- abortViteBuildSsr(configVike);
29
+ abortViteBuildSsr(vikeConfigGlobal);
29
30
  },
30
31
  writeBundle: {
31
32
  /* We can't use this because it breaks Vite's logging. TODO: try again with latest Vite version.
@@ -34,7 +35,7 @@ function autoFullBuild() {
34
35
  */
35
36
  async handler(_options, bundle) {
36
37
  try {
37
- await triggerFullBuild(config, configVike, bundle);
38
+ await triggerFullBuild(config, vikeConfigGlobal, bundle);
38
39
  }
39
40
  catch (err) {
40
41
  // Avoid Rollup prefixing the error with [vike:autoFullBuild], for example see https://github.com/vikejs/vike/issues/472#issuecomment-1276274203
@@ -60,10 +61,10 @@ function autoFullBuild() {
60
61
  }
61
62
  ];
62
63
  }
63
- async function triggerFullBuild(config, configVike, bundle) {
64
+ async function triggerFullBuild(config, vikeConfigGlobal, bundle) {
64
65
  if (config.build.ssr)
65
66
  return; // already triggered
66
- if (isDisabled(configVike))
67
+ if (isDisabled(vikeConfigGlobal))
67
68
  return;
68
69
  // Workaround for @vitejs/plugin-legacy
69
70
  // - The legacy plugin triggers its own Rollup build for the client-side.
@@ -94,19 +95,21 @@ async function triggerFullBuild(config, configVike, bundle) {
94
95
  (0, logErrorHint_js_1.logErrorHint)(err);
95
96
  process.exit(1);
96
97
  }
97
- if (configVike.prerender && !configVike.prerender.disableAutoRun && configVike.disableAutoFullBuild !== 'prerender') {
98
+ if (vikeConfigGlobal.prerender &&
99
+ !vikeConfigGlobal.prerender.disableAutoRun &&
100
+ vikeConfigGlobal.disableAutoFullBuild !== 'prerender') {
98
101
  await (0, runPrerender_js_1.runPrerenderFromAutoRun)(configInline, false);
99
102
  forceExit = true;
100
103
  }
101
104
  }
102
- function abortViteBuildSsr(configVike) {
103
- if (configVike.disableAutoFullBuild !== true && (0, isViteCliCall_js_1.isViteCliCall)() && (0, isViteCliCall_js_1.getViteConfigFromCli)()?.build.ssr) {
105
+ function abortViteBuildSsr(vikeConfigGlobal) {
106
+ if (vikeConfigGlobal.disableAutoFullBuild !== true && (0, isViteCliCall_js_1.isViteCliCall)() && (0, isViteCliCall_js_1.getViteConfigFromCli)()?.build.ssr) {
104
107
  (0, utils_js_1.assertWarning)(false, `The CLI call ${picocolors_1.default.cyan('$ vite build --ssr')} is superfluous since ${picocolors_1.default.cyan('$ vite build')} also builds the server-side. If you want two separate build steps then use https://vike.dev/disableAutoFullBuild or use Vite's ${picocolors_1.default.cyan('build()')} API.`, { onlyOnce: true });
105
108
  process.exit(0);
106
109
  }
107
110
  }
108
- function isDisabled(configVike) {
109
- const { disableAutoFullBuild } = configVike;
111
+ function isDisabled(vikeConfigGlobal) {
112
+ const { disableAutoFullBuild } = vikeConfigGlobal;
110
113
  if (disableAutoFullBuild === null || disableAutoFullBuild === 'prerender') {
111
114
  return !(0, isViteCliCall_js_1.isViteCliCall)();
112
115
  }
@@ -1,19 +1,18 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.baseUrls = baseUrls;
4
- const resolveBase_js_1 = require("../plugins/config/resolveBase.js");
4
+ const resolveBase_js_1 = require("../../shared/resolveBase.js");
5
5
  const utils_js_1 = require("../utils.js");
6
- const getConfigVike_js_1 = require("../../shared/getConfigVike.js");
7
- function baseUrls(configVike) {
8
- let baseServer;
9
- let baseAssets;
6
+ const getVikeConfig_js_1 = require("./importUserCode/v1-design/getVikeConfig.js");
7
+ function baseUrls(vikeVitePluginOptions) {
8
+ let bases;
10
9
  return {
11
10
  name: 'vike:baseUrls',
12
11
  enforce: 'post',
13
12
  async config(config) {
14
- const bases = (0, resolveBase_js_1.resolveBaseFromUserConfig)(config, configVike);
15
- baseServer = bases.baseServer;
16
- baseAssets = bases.baseAssets;
13
+ // TODO: fix bug: use getVikeConfig2() and udpate check below
14
+ bases = resolveBaseFromUserConfig(config, vikeVitePluginOptions);
15
+ const { baseServer, baseAssets } = bases;
17
16
  // We cannot define these in configResolved() because Vite picks up the env variables before any configResolved() hook is called
18
17
  process.env.BASE_SERVER = baseServer;
19
18
  process.env.BASE_ASSETS = baseAssets;
@@ -24,14 +23,16 @@ function baseUrls(configVike) {
24
23
  'BASE_ASSETS'
25
24
  ],
26
25
  base: baseAssets, // Make Vite inject baseAssets to imports e.g. `import logoUrl from './logo.svg.js'`
27
- _baseOriginal: config.base ?? '/__UNSET__' // Vite resolves `_baseOriginal: null` to `undefined`
26
+ _baseViteOriginal: config.base ?? '/__UNSET__' // Vite resolves `_baseViteOriginal: null` to `undefined`
28
27
  };
29
28
  },
30
29
  async configResolved(config) {
31
- const configVike = await (0, getConfigVike_js_1.getConfigVike)(config);
30
+ const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config);
31
+ const { baseServer, baseAssets } = vikeConfig.vikeConfigGlobal;
32
+ const basesResolved = (0, resolveBase_js_1.resolveBaseFromResolvedConfig)(baseServer, baseAssets, config);
32
33
  // Ensure that the premature base URL resolving we did in config() isn't erroneous
33
- (0, utils_js_1.assert)(configVike.baseServer === baseServer);
34
- (0, utils_js_1.assert)(configVike.baseAssets === baseAssets);
34
+ (0, utils_js_1.assert)(basesResolved.baseServer === bases.baseServer);
35
+ (0, utils_js_1.assert)(basesResolved.baseAssets === bases.baseAssets);
35
36
  /* In dev, Vite seems buggy around setting vite.config.js#base to an absolute URL (e.g. http://localhost:8080/cdn/)
36
37
  * - In dev, Vite removes the URL origin. (I.e. it resolves the user config `vite.config.js#base: 'http://localhost:8080/cdn/'` to resolved config `config.base === '/cdn/'`.)
37
38
  * - Instead of having an internal Vike assertion fail, we let the user discover Vite's buggy behavior.
@@ -40,3 +41,7 @@ function baseUrls(configVike) {
40
41
  }
41
42
  };
42
43
  }
44
+ function resolveBaseFromUserConfig(config, vikeVitePluginOptions) {
45
+ const baseViteOriginal = config.base ?? null;
46
+ return (0, resolveBase_js_1.resolveBase)(baseViteOriginal, vikeVitePluginOptions?.baseServer ?? null, vikeVitePluginOptions?.baseAssets ?? null);
47
+ }
@@ -207,7 +207,7 @@ function fixServerAssets_assertCssTarget_populate(config) {
207
207
  async function fixServerAssets_assertCssTarget(config) {
208
208
  if (!fixServerAssets_isEnabled())
209
209
  return;
210
- if (!(await (0, getVikeConfig_js_1.isV1Design)(config, false)))
210
+ if (!(await (0, getVikeConfig_js_1.isV1Design)(config)))
211
211
  return;
212
212
  const targetsServer = targets.filter((t) => t.isServerSide);
213
213
  const targetsClient = targets.filter((t) => !t.isServerSide);
@@ -10,7 +10,6 @@ exports.analyzeClientEntries = analyzeClientEntries;
10
10
  const utils_js_1 = require("../utils.js");
11
11
  const getVikeConfig_js_1 = require("./importUserCode/v1-design/getVikeConfig.js");
12
12
  const findPageFiles_js_1 = require("../shared/findPageFiles.js");
13
- const getConfigVike_js_1 = require("../../shared/getConfigVike.js");
14
13
  const virtualFilePageConfigValuesAll_js_1 = require("../../shared/virtual-files/virtualFilePageConfigValuesAll.js");
15
14
  const extractAssetsQuery_js_1 = require("../../shared/extractAssetsQuery.js");
16
15
  const module_1 = require("module");
@@ -33,14 +32,14 @@ function buildConfig() {
33
32
  let config;
34
33
  return [
35
34
  {
36
- name: 'vike:buildConfig:configResolved',
35
+ name: 'vike:buildConfig:post',
37
36
  apply: 'build',
38
37
  enforce: 'post',
39
38
  configResolved: {
40
39
  order: 'post',
41
40
  async handler(config_) {
42
41
  config = config_;
43
- (0, utils_js_1.assertNodeEnv_build)();
42
+ (0, utils_js_1.onSetupBuild)();
44
43
  assertRollupInput(config);
45
44
  const entries = await getEntries(config);
46
45
  (0, utils_js_1.assert)(Object.keys(entries).length > 0);
@@ -48,7 +47,7 @@ function buildConfig() {
48
47
  addLogHook();
49
48
  outDirs = (0, utils_js_1.getOutDirs)(config);
50
49
  {
51
- isServerAssetsFixEnabled = (0, fixServerAssets_js_1.fixServerAssets_isEnabled)() && (await (0, getVikeConfig_js_1.isV1Design)(config, false));
50
+ isServerAssetsFixEnabled = (0, fixServerAssets_js_1.fixServerAssets_isEnabled)() && (await (0, getVikeConfig_js_1.isV1Design)(config));
52
51
  if (isServerAssetsFixEnabled) {
53
52
  // https://github.com/vikejs/vike/issues/1339
54
53
  config.build.ssrEmitAssets = true;
@@ -63,7 +62,7 @@ function buildConfig() {
63
62
  config: {
64
63
  order: 'post',
65
64
  handler(config) {
66
- (0, utils_js_1.assertNodeEnv_build)();
65
+ (0, utils_js_1.onSetupBuild)();
67
66
  isSsrBuild = (0, utils_js_1.viteIsSSR)(config);
68
67
  return {
69
68
  build: {
@@ -75,14 +74,15 @@ function buildConfig() {
75
74
  }
76
75
  },
77
76
  buildStart() {
78
- (0, utils_js_1.assertNodeEnv_build)();
77
+ (0, utils_js_1.onSetupBuild)();
79
78
  },
80
79
  async closeBundle() {
80
+ (0, utils_js_1.onSetupBuild)();
81
81
  await (0, fixServerAssets_js_1.fixServerAssets_assertCssTarget)(config);
82
82
  }
83
83
  },
84
84
  {
85
- name: 'vike:buildConfig:writeBundle',
85
+ name: 'vike:buildConfig:pre',
86
86
  apply: 'build',
87
87
  // Make sure other writeBundle() hooks are called after this writeBundle() hook.
88
88
  // - set_ASSETS_MAP() needs to be called before dist/server/ code is executed.
@@ -116,9 +116,9 @@ function buildConfig() {
116
116
  ];
117
117
  }
118
118
  async function getEntries(config) {
119
- const configVike = await (0, getConfigVike_js_1.getConfigVike)(config);
120
- const pageFileEntries = await getPageFileEntries(config, configVike.includeAssetsImportedByServer); // TODO/v1-release: remove
121
- const { pageConfigs } = await (0, getVikeConfig_js_1.getVikeConfig)(config, false);
119
+ const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config);
120
+ const { pageConfigs } = vikeConfig;
121
+ const pageFileEntries = await getPageFileEntries(config, vikeConfig.vikeConfigGlobal.includeAssetsImportedByServer); // TODO/v1-release: remove
122
122
  (0, utils_js_1.assertUsage)(Object.keys(pageFileEntries).length !== 0 || pageConfigs.length !== 0, 'At least one page should be defined, see https://vike.dev/add');
123
123
  if ((0, utils_js_1.viteIsSSR)(config)) {
124
124
  const pageEntries = getPageEntries(pageConfigs);
@@ -14,11 +14,22 @@ const assertResolveAlias_js_1 = require("./commonConfig/assertResolveAlias.js");
14
14
  const pluginName_js_1 = require("./commonConfig/pluginName.js");
15
15
  const getEnvVarObject_js_1 = require("../shared/getEnvVarObject.js");
16
16
  const isViteCliCall_js_1 = require("../shared/isViteCliCall.js");
17
- (0, utils_js_1.assertWarning)(!(0, isViteCliCall_js_1.isViteCliCall)(), `Vite's CLI is deprecated ${picocolors_1.default.underline('https://vike.dev/migration/cli')}`, {
18
- onlyOnce: true
19
- });
20
- function commonConfig() {
17
+ const context_js_1 = require("../../api/context.js");
18
+ function commonConfig(vikeVitePluginOptions = {}) {
21
19
  return [
20
+ {
21
+ name: `${pluginName_js_1.pluginName}:pre`,
22
+ enforce: 'pre',
23
+ config: {
24
+ order: 'pre',
25
+ handler(_config, env) {
26
+ return {
27
+ _isDev: (0, utils_js_1.isDevCheck)(env),
28
+ _vikeVitePluginOptions: vikeVitePluginOptions
29
+ };
30
+ }
31
+ }
32
+ },
22
33
  {
23
34
  name: pluginName_js_1.pluginName,
24
35
  configResolved(config) {
@@ -39,6 +50,7 @@ function commonConfig() {
39
50
  (0, buildConfig_js_1.assertRollupInput)(config);
40
51
  (0, assertResolveAlias_js_1.assertResolveAlias)(config);
41
52
  assertEsm(config.root);
53
+ assertVikeCliOrApi(config);
42
54
  }
43
55
  },
44
56
  config: {
@@ -102,3 +114,22 @@ function assertSingleInstance(config) {
102
114
  const numberOfInstances = config.plugins.filter((o) => o.name === pluginName_js_1.pluginName).length;
103
115
  (0, utils_js_1.assertUsage)(numberOfInstances === 1, `Vike's Vite plugin (${picocolors_1.default.cyan("import vike from 'vike/plugin'")}) is being added ${numberOfInstances} times to the list of Vite plugins. Make sure to add it only once instead.`);
104
116
  }
117
+ function assertVikeCliOrApi(config) {
118
+ if ((0, context_js_1.isVikeCliOrApi)())
119
+ return;
120
+ if ((0, isViteCliCall_js_1.isViteCliCall)()) {
121
+ (0, utils_js_1.assertWarning)(false, `Vite's CLI is deprecated ${picocolors_1.default.underline('https://vike.dev/migration/cli')}`, {
122
+ onlyOnce: true
123
+ });
124
+ return;
125
+ }
126
+ if (config.server.middlewareMode) {
127
+ (0, utils_js_1.assertWarning)(false, `${picocolors_1.default.cyan('vite.createServer()')} is deprecated ${picocolors_1.default.underline('https://vike.dev/migration/cli#api')}`, {
128
+ onlyOnce: true
129
+ });
130
+ return;
131
+ }
132
+ (0, utils_js_1.assertWarning)(false, `Vite's JavaScript API is deprecated ${picocolors_1.default.underline('https://vike.dev/migration/cli#api')}`, {
133
+ onlyOnce: true
134
+ });
135
+ }
@@ -8,9 +8,9 @@ const buildConfig_js_1 = require("../buildConfig.js");
8
8
  const virtualFileImportUserCode_js_1 = require("../../../shared/virtual-files/virtualFileImportUserCode.js");
9
9
  const getFilePath_js_1 = require("../../shared/getFilePath.js");
10
10
  const debug = (0, utils_js_1.createDebugger)('vike:optimizeDeps');
11
- async function determineOptimizeDeps(config, isDev) {
12
- const { pageConfigs } = await (0, getVikeConfig_js_1.getVikeConfig)(config, isDev);
13
- const { entries, include } = await getPageDeps(config, pageConfigs, isDev);
11
+ async function determineOptimizeDeps(config) {
12
+ const { pageConfigs } = await (0, getVikeConfig_js_1.getVikeConfig)(config);
13
+ const { entries, include } = await getPageDeps(config, pageConfigs);
14
14
  {
15
15
  // This actually doesn't work: Vite's dep optimizer doesn't seem to be able to crawl virtual files.
16
16
  // - Should we make it work? E.g. by creating a temporary file at node_modules/.vike/virtualFiles.js
@@ -30,7 +30,7 @@ async function determineOptimizeDeps(config, isDev) {
30
30
  'config.optimizeDeps.include': config.optimizeDeps.include
31
31
  });
32
32
  }
33
- async function getPageDeps(config, pageConfigs, isDev) {
33
+ async function getPageDeps(config, pageConfigs) {
34
34
  let entries = [];
35
35
  let include = [];
36
36
  const addEntry = (e) => {
@@ -69,7 +69,7 @@ async function getPageDeps(config, pageConfigs, isDev) {
69
69
  }
70
70
  // V0.4 design
71
71
  {
72
- const pageFiles = await (0, findPageFiles_js_1.findPageFiles)(config, ['.page', '.page.client'], isDev);
72
+ const pageFiles = await (0, findPageFiles_js_1.findPageFiles)(config, ['.page', '.page.client'], true);
73
73
  const userRootDir = config.root;
74
74
  pageFiles.forEach((filePathAbsoluteUserRootDir) => {
75
75
  const entry = (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir });
@@ -63,16 +63,13 @@ function devConfig() {
63
63
  },
64
64
  async configResolved(config_) {
65
65
  config = config_;
66
- await (0, determineOptimizeDeps_js_1.determineOptimizeDeps)(config, true);
66
+ await (0, determineOptimizeDeps_js_1.determineOptimizeDeps)(config);
67
67
  await (0, determineFsAllowList_js_1.determineFsAllowList)(config);
68
68
  if (!(0, isErrorDebug_js_1.isErrorDebug)()) {
69
69
  await (0, getHttpRequestAsyncStore_js_1.installHttpRequestAsyncStore)();
70
70
  (0, loggerVite_js_1.improveViteLogs)(config);
71
71
  }
72
72
  logDockerHint(config.server.host);
73
- },
74
- configureServer() {
75
- (0, utils_js_1.markEnvAsViteDev)();
76
73
  }
77
74
  },
78
75
  {
@@ -10,7 +10,6 @@ exports.extractAssetsPlugin = extractAssetsPlugin;
10
10
  const utils_js_1 = require("../utils.js");
11
11
  const virtual_files_js_1 = require("../../shared/virtual-files.js");
12
12
  const extractAssetsQuery_js_1 = require("../../shared/extractAssetsQuery.js");
13
- const getConfigVike_js_1 = require("../../shared/getConfigVike.js");
14
13
  const isAsset_js_1 = require("../shared/isAsset.js");
15
14
  const parseEsModule_js_1 = require("../shared/parseEsModule.js");
16
15
  const rollupSourceMap_js_1 = require("../shared/rollupSourceMap.js");
@@ -27,7 +26,6 @@ const EMPTY_MODULE_ID = 'virtual:vike:empty-module';
27
26
  const debug = (0, utils_js_1.createDebugger)('vike:extractAssets');
28
27
  function extractAssetsPlugin() {
29
28
  let config;
30
- let configVike;
31
29
  let vikeConfig;
32
30
  let isServerAssetsFixEnabled;
33
31
  return [
@@ -47,7 +45,7 @@ function extractAssetsPlugin() {
47
45
  (0, assertV1Design_js_1.assertV1Design)(vikeConfig.pageConfigs, true);
48
46
  (0, utils_js_1.assert)(false);
49
47
  }
50
- (0, utils_js_1.assert)(configVike.includeAssetsImportedByServer);
48
+ (0, utils_js_1.assert)(vikeConfig.vikeConfigGlobal.includeAssetsImportedByServer);
51
49
  (0, utils_js_1.assert)(!(0, utils_js_1.viteIsSSR_options)(options));
52
50
  const importStatements = await (0, parseEsModule_js_1.getImportStatements)(src);
53
51
  const moduleNames = getImportedModules(importStatements);
@@ -80,7 +78,7 @@ function extractAssetsPlugin() {
80
78
  if (!extractAssetsRE.test(importer)) {
81
79
  return;
82
80
  }
83
- (0, utils_js_1.assert)(configVike.includeAssetsImportedByServer);
81
+ (0, utils_js_1.assert)(vikeConfig.vikeConfigGlobal.includeAssetsImportedByServer);
84
82
  let resolution = null;
85
83
  try {
86
84
  resolution = await this.resolve(source, importer, { skipSelf: true, ...options });
@@ -139,10 +137,9 @@ function extractAssetsPlugin() {
139
137
  {
140
138
  name: 'vike:extractAssets-4',
141
139
  async configResolved(config_) {
142
- configVike = await (0, getConfigVike_js_1.getConfigVike)(config_);
143
140
  config = config_;
144
- vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config, false);
145
- isServerAssetsFixEnabled = (0, fixServerAssets_js_1.fixServerAssets_isEnabled)() && (await (0, getVikeConfig_js_1.isV1Design)(config, false));
141
+ vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config);
142
+ isServerAssetsFixEnabled = (0, fixServerAssets_js_1.fixServerAssets_isEnabled)() && (await (0, getVikeConfig_js_1.isV1Design)(config));
146
143
  if (!isServerAssetsFixEnabled) {
147
144
  // https://github.com/vikejs/vike/issues/1060
148
145
  (0, utils_js_1.assertUsage)(!config.plugins.find((p) => p.name === 'vite-tsconfig-paths'), 'vite-tsconfig-paths not supported, remove it and use vite.config.js#resolve.alias instead');
@@ -5,8 +5,8 @@ const utils_js_1 = require("../../utils.js");
5
5
  const assertPluginManifest_js_1 = require("../../../shared/assertPluginManifest.js");
6
6
  const extractExportNamesPlugin_js_1 = require("../extractExportNamesPlugin.js");
7
7
  const globalContext_js_1 = require("../../../runtime/globalContext.js");
8
- function getVikeManifest(configVike) {
9
- const runtimeManifest = (0, globalContext_js_1.getRuntimeManifest)(configVike);
8
+ function getVikeManifest(vikeConfigGlobal, viteConfig) {
9
+ const runtimeManifest = (0, globalContext_js_1.getRuntimeManifest)(vikeConfigGlobal, viteConfig);
10
10
  const manifest = {
11
11
  version: utils_js_1.projectInfo.projectVersion,
12
12
  usesClientRouter: (0, extractExportNamesPlugin_js_1.isUsingClientRouter)(), // TODO/v1-release: remove