vike 0.4.221-commit-937dbfb → 0.4.221

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 (41) hide show
  1. package/dist/cjs/node/api/prepareViteApiCall.js +16 -18
  2. package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +10 -8
  3. package/dist/cjs/node/plugin/plugins/buildConfig.js +1 -0
  4. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +14 -27
  5. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +5 -0
  6. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +1 -1
  7. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +3 -4
  8. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +5 -11
  9. package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +3 -3
  10. package/dist/cjs/node/runtime-dev/createDevMiddleware.js +3 -3
  11. package/dist/cjs/shared/page-configs/getPageConfigUserFriendly.js +2 -4
  12. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  13. package/dist/cjs/utils/debug.js +6 -9
  14. package/dist/esm/client/client-routing-runtime/prefetch.js +1 -1
  15. package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +2 -2
  16. package/dist/esm/client/server-routing-runtime/getPageContext.d.ts +0 -1
  17. package/dist/esm/client/server-routing-runtime/getPageContext.js +3 -4
  18. package/dist/esm/client/shared/loadUserFilesClientSide.d.ts +2 -3
  19. package/dist/esm/client/shared/loadUserFilesClientSide.js +2 -2
  20. package/dist/esm/node/api/prepareViteApiCall.d.ts +2 -2
  21. package/dist/esm/node/api/prepareViteApiCall.js +16 -18
  22. package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.d.ts +2 -0
  23. package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +10 -8
  24. package/dist/esm/node/plugin/plugins/buildConfig.js +2 -1
  25. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +15 -28
  26. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +3 -0
  27. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +5 -0
  28. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +1 -1
  29. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +1 -1
  30. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +3 -4
  31. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -12
  32. package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +3 -3
  33. package/dist/esm/node/runtime-dev/createDevMiddleware.js +3 -3
  34. package/dist/esm/shared/page-configs/getPageConfigUserFriendly.d.ts +2 -2
  35. package/dist/esm/shared/page-configs/getPageConfigUserFriendly.js +2 -4
  36. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  37. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  38. package/dist/esm/utils/debug.d.ts +1 -1
  39. package/dist/esm/utils/debug.js +6 -9
  40. package/dist/esm/utils/projectInfo.d.ts +1 -1
  41. package/package.json +1 -1
@@ -49,18 +49,18 @@ const utils_js_1 = require("./utils.js");
49
49
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
50
50
  const globalContext_js_1 = require("../runtime/globalContext.js");
51
51
  const globalObject = (0, utils_js_1.getGlobalObject)('prepareViteApiCall.ts', {});
52
- async function prepareViteApiCall(viteConfigFromOptions, operation) {
52
+ async function prepareViteApiCall(viteConfig, operation) {
53
53
  clear();
54
54
  (0, context_js_1.setContextApiOperation)(operation);
55
- return enhanceViteConfig(viteConfigFromOptions, operation);
55
+ return enhanceViteConfig(viteConfig, operation);
56
56
  }
57
57
  // For subsequent API calls, e.g. calling prerender() after build()
58
58
  function clear() {
59
59
  (0, context_js_1.clearContextApiOperation)();
60
60
  (0, globalContext_js_1.clearGlobalContext)();
61
61
  }
62
- async function enhanceViteConfig(viteConfigFromOptions, operation) {
63
- const viteInfo = await getInfoFromVite(viteConfigFromOptions, operation);
62
+ async function enhanceViteConfig(viteConfig, operation) {
63
+ const viteInfo = await getInfoFromVite(viteConfig, operation);
64
64
  await assertViteRoot2(viteInfo.root, viteInfo.viteConfigEnhanced, operation);
65
65
  const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig2)(viteInfo.root, operation === 'dev', viteInfo.vikeVitePluginOptions);
66
66
  const viteConfigEnhanced = addViteSettingsSetByVikeConfig(viteInfo.viteConfigEnhanced, vikeConfig);
@@ -76,7 +76,6 @@ function addViteSettingsSetByVikeConfig(viteConfigEnhanced, vikeConfig) {
76
76
  viteConfigs.values.forEach((v) => {
77
77
  (0, utils_js_1.assertUsage)((0, utils_js_1.isObject)(v.value), `${v.definedAt} should be an object`);
78
78
  viteConfigEnhanced = (0, vite_1.mergeConfig)(viteConfigEnhanced ?? {}, v.value);
79
- (0, utils_js_1.assertUsage)(!findVikeVitePlugin(v.value), "Using the +vite setting to add Vike's Vite plugin is forbidden");
80
79
  });
81
80
  return viteConfigEnhanced;
82
81
  }
@@ -86,14 +85,13 @@ async function getViteRoot(operation) {
86
85
  (0, utils_js_1.assert)(globalObject.root);
87
86
  return globalObject.root;
88
87
  }
89
- async function getInfoFromVite(viteConfigFromOptions, operation) {
90
- const viteConfigFromUserViteFile = await loadViteConfigFile(viteConfigFromOptions, operation);
91
- const root = normalizeViteRoot(viteConfigFromUserViteFile?.root ?? viteConfigFromOptions?.root ?? process.cwd());
88
+ async function getInfoFromVite(viteConfig, operation) {
89
+ const viteConfigFromFile = await loadViteConfigFile(viteConfig, operation);
90
+ const root = normalizeViteRoot(viteConfigFromFile?.root ?? viteConfig?.root ?? process.cwd());
92
91
  globalObject.root = root;
93
92
  let vikeVitePluginOptions;
94
- let viteConfigEnhanced = viteConfigFromOptions;
95
- // If Vike's Vite plugin is found in both viteConfigFromOptions and viteConfigFromUserViteFile then Vike will later throw an error
96
- const found = findVikeVitePlugin(viteConfigFromOptions) || findVikeVitePlugin(viteConfigFromUserViteFile);
93
+ let viteConfigEnhanced = viteConfig;
94
+ const found = findVikeVitePlugin([...(viteConfig?.plugins ?? []), ...(viteConfigFromFile?.plugins ?? [])]);
97
95
  if (found) {
98
96
  vikeVitePluginOptions = found.vikeVitePluginOptions;
99
97
  }
@@ -102,20 +100,20 @@ async function getInfoFromVite(viteConfigFromOptions, operation) {
102
100
  // Using a dynamic import because the script calling the Vike API may not live in the same place as vite.config.js, thus vike/plugin may resolved to two different node_modules/vike directories.
103
101
  const { plugin: vikePlugin } = await Promise.resolve().then(() => __importStar(require('../plugin/index.js')));
104
102
  viteConfigEnhanced = {
105
- ...viteConfigFromOptions,
106
- plugins: [...(viteConfigFromOptions?.plugins ?? []), vikePlugin()]
103
+ ...viteConfig,
104
+ plugins: [...(viteConfig?.plugins ?? []), vikePlugin()]
107
105
  };
108
- const res = findVikeVitePlugin(viteConfigEnhanced);
106
+ const res = findVikeVitePlugin(viteConfigEnhanced.plugins);
109
107
  (0, utils_js_1.assert)(res);
110
108
  vikeVitePluginOptions = res.vikeVitePluginOptions;
111
109
  }
112
110
  (0, utils_js_1.assert)(vikeVitePluginOptions);
113
111
  return { root, vikeVitePluginOptions, viteConfigEnhanced };
114
112
  }
115
- function findVikeVitePlugin(viteConfig) {
113
+ function findVikeVitePlugin(plugins) {
116
114
  let vikeVitePluginOptions;
117
115
  let vikeVitePuginFound = false;
118
- viteConfig?.plugins?.forEach((p) => {
116
+ plugins.forEach((p) => {
119
117
  if (p && '__vikeVitePluginOptions' in p) {
120
118
  vikeVitePuginFound = true;
121
119
  const options = p.__vikeVitePluginOptions;
@@ -128,8 +126,8 @@ function findVikeVitePlugin(viteConfig) {
128
126
  return { vikeVitePluginOptions };
129
127
  }
130
128
  // Copied from https://github.com/vitejs/vite/blob/4f5845a3182fc950eb9cd76d7161698383113b18/packages/vite/src/node/config.ts#L961-L1005
131
- async function loadViteConfigFile(viteConfigFromOptions, operation) {
132
- const [inlineConfig, command, defaultMode, _defaultNodeEnv, isPreview] = getResolveConfigArgs(viteConfigFromOptions, operation);
129
+ async function loadViteConfigFile(viteConfig, operation) {
130
+ const [inlineConfig, command, defaultMode, _defaultNodeEnv, isPreview] = getResolveConfigArgs(viteConfig, operation);
133
131
  let config = inlineConfig;
134
132
  let mode = inlineConfig.mode || defaultMode;
135
133
  const configEnv = {
@@ -7,6 +7,7 @@ exports.fixServerAssets = fixServerAssets;
7
7
  exports.fixServerAssets_isEnabled = fixServerAssets_isEnabled;
8
8
  exports.fixServerAssets_assertCssCodeSplit = fixServerAssets_assertCssCodeSplit;
9
9
  exports.fixServerAssets_assertCssTarget = fixServerAssets_assertCssTarget;
10
+ exports.fixServerAssets_assertCssTarget_populate = fixServerAssets_assertCssTarget_populate;
10
11
  const promises_1 = __importDefault(require("fs/promises"));
11
12
  const fs_1 = __importDefault(require("fs"));
12
13
  const path_1 = __importDefault(require("path"));
@@ -199,15 +200,17 @@ function fixServerAssets_assertCssCodeSplit(config) {
199
200
  (0, utils_js_1.assertWarning)(config.build.cssCodeSplit, `${picocolors_1.default.cyan('build.cssCodeSplit')} shouldn't be set to ${picocolors_1.default.cyan('false')} (https://github.com/vikejs/vike/issues/1993)`, { onlyOnce: true });
200
201
  }
201
202
  const targets = [];
203
+ function fixServerAssets_assertCssTarget_populate(config) {
204
+ const isServerSide = (0, viteIsSSR_js_1.viteIsSSR)(config);
205
+ (0, utils_js_1.assert)(typeof isServerSide === 'boolean');
206
+ (0, utils_js_1.assert)(config.build.target !== undefined);
207
+ targets.push({ global: config.build.target, css: config.build.cssTarget, isServerSide });
208
+ }
202
209
  async function fixServerAssets_assertCssTarget(config) {
203
210
  if (!fixServerAssets_isEnabled())
204
211
  return;
205
212
  if (!(await (0, getVikeConfig_js_1.isV1Design)(config)))
206
213
  return;
207
- const isServerSide = (0, viteIsSSR_js_1.viteIsSSR)(config);
208
- (0, utils_js_1.assert)(typeof isServerSide === 'boolean');
209
- (0, utils_js_1.assert)(config.build.target !== undefined);
210
- targets.push({ global: config.build.target, css: config.build.cssTarget, isServerSide });
211
214
  const targetsServer = targets.filter((t) => t.isServerSide);
212
215
  const targetsClient = targets.filter((t) => !t.isServerSide);
213
216
  targetsClient.forEach((targetClient) => {
@@ -215,10 +218,9 @@ async function fixServerAssets_assertCssTarget(config) {
215
218
  targetsServer.forEach((targetServer) => {
216
219
  const targetCssResolvedServer = resolveCssTarget(targetServer);
217
220
  (0, utils_js_1.assertWarning)((0, utils_js_1.isEqualStringList)(targetCssResolvedClient, targetCssResolvedServer), [
218
- 'The CSS browser target should be the same for both client and server, but we got:',
219
- `Client: ${picocolors_1.default.cyan(JSON.stringify(targetCssResolvedClient))}`,
220
- `Server: ${picocolors_1.default.cyan(JSON.stringify(targetCssResolvedServer))}`,
221
- `Different targets lead to CSS duplication, see ${picocolors_1.default.underline('https://github.com/vikejs/vike/issues/1815#issuecomment-2507002979')} for more information.`
221
+ 'The CSS browser target should be the same for both client-side and server-side (https://github.com/vikejs/vike/issues/1815#issuecomment-2507002979) but we got:',
222
+ `Client-side: ${picocolors_1.default.cyan(JSON.stringify(targetCssResolvedClient))}`,
223
+ `Server-side: ${picocolors_1.default.cyan(JSON.stringify(targetCssResolvedServer))}`
222
224
  ].join('\n'), {
223
225
  showStackTrace: true,
224
226
  onlyOnce: 'different-css-target'
@@ -54,6 +54,7 @@ function buildConfig() {
54
54
  config.build.ssrEmitAssets = true;
55
55
  // Required if `ssrEmitAssets: true`, see https://github.com/vitejs/vite/pull/11430#issuecomment-1454800934
56
56
  config.build.cssMinify = 'esbuild';
57
+ (0, fixServerAssets_js_1.fixServerAssets_assertCssTarget_populate)(config);
57
58
  (0, fixServerAssets_js_1.fixServerAssets_assertCssCodeSplit)(config);
58
59
  }
59
60
  }
@@ -12,7 +12,6 @@ const util_1 = require("util");
12
12
  const transpileAndExecuteFile_js_1 = require("./transpileAndExecuteFile.js");
13
13
  const getEnvVarObject_js_1 = require("../../../../shared/getEnvVarObject.js");
14
14
  const execA = (0, util_1.promisify)(child_process_1.exec);
15
- const debug = (0, utils_js_1.createDebugger)('vike:crawl');
16
15
  (0, utils_js_1.assertIsNotProductionRuntime)();
17
16
  (0, utils_js_1.assertIsSingleModuleInstance)('crawlPlusFiles.ts');
18
17
  let gitIsNotUsable = false;
@@ -36,16 +35,17 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem) {
36
35
  //
37
36
  !outDirRelativeFromUserRootDir.startsWith('../')));
38
37
  // Crawl
39
- const filesGit = !isGitCrawlDisabled() && (await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir));
40
- const filesGitNothingFound = !filesGit || filesGit.length === 0;
41
- const filesGlob = (filesGitNothingFound || debug.isActivated) && (await fastGlob(userRootDir, outDirRelativeFromUserRootDir));
42
- let files = !filesGitNothingFound
43
- ? filesGit
44
- : // Fallback to fast-glob for users that dynamically generate plus files. (Assuming that no plus file is found because of the user's .gitignore list.)
45
- filesGlob;
46
- (0, utils_js_1.assert)(files);
47
- if (debug.isActivated)
48
- (0, utils_js_1.assert)((0, utils_js_1.deepEqual)(filesGlob, filesGit), "Git and glob results aren't matching.");
38
+ let files;
39
+ const res = !isGitCrawlDisabled() && (await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir));
40
+ if (res &&
41
+ // Fallback to fast-glob for users that dynamically generate plus files. (Assuming that no plus file is found because of the user's .gitignore list.)
42
+ res.length > 0) {
43
+ files = res;
44
+ // We cannot find files inside symlink directories with `$ git ls-files` => we use fast-glob
45
+ }
46
+ else {
47
+ files = await fastGlob(userRootDir, outDirRelativeFromUserRootDir);
48
+ }
49
49
  // Filter build files
50
50
  files = files.filter((filePath) => !(0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(filePath));
51
51
  // Normalize
@@ -74,7 +74,7 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
74
74
  preserveUTF8,
75
75
  'ls-files',
76
76
  // Performance gain seems negligible: https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
77
- ...utils_js_1.scriptFileExtensionList.map((ext) => `"**/+*.${ext}" "+*.${ext}"`),
77
+ ...utils_js_1.scriptFileExtensionList.map((ext) => `"**/+*.${ext}"`),
78
78
  // Performance gain is non-negligible.
79
79
  // - https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
80
80
  // - When node_modules/ is untracked the performance gain could be significant?
@@ -101,12 +101,6 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
101
101
  }
102
102
  throw err;
103
103
  }
104
- if (debug.isActivated) {
105
- debug('[git] userRootDir:', userRootDir);
106
- debug('[git] cmd:', cmd);
107
- debug('[git] result:', filesAll);
108
- debug('[git] filesDeleted:', filesDeleted);
109
- }
110
104
  const files = [];
111
105
  for (const filePath of filesAll) {
112
106
  // + file?
@@ -127,21 +121,14 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
127
121
  }
128
122
  // Same as gitLsFiles() but using fast-glob
129
123
  async function fastGlob(userRootDir, outDirRelativeFromUserRootDir) {
130
- const pattern = `**/+*.${utils_js_1.scriptFileExtensions}`;
131
- const options = {
124
+ const files = await (0, fast_glob_1.default)(`**/+*.${utils_js_1.scriptFileExtensions}`, {
132
125
  ignore: getIgnoreAsPatterns(outDirRelativeFromUserRootDir),
133
126
  cwd: userRootDir,
134
127
  dot: false
135
- };
136
- const files = await (0, fast_glob_1.default)(pattern, options);
128
+ });
137
129
  // Make build deterministic, in order to get a stable generated hash for dist/client/assets/entries/entry-client-routing.${hash}.js
138
130
  // https://github.com/vikejs/vike/pull/1750
139
131
  files.sort();
140
- if (debug.isActivated) {
141
- debug('[glob] pattern:', pattern);
142
- debug('[glob] options:', options);
143
- debug('[glob] result:', files);
144
- }
145
132
  return files;
146
133
  }
147
134
  // Same as getIgnoreAsFilterFn() but as glob pattern
@@ -8,6 +8,7 @@ exports.getFilesystemRouteDefinedBy = getFilesystemRouteDefinedBy;
8
8
  exports.isInherited = isInherited;
9
9
  exports.getLocationId = getLocationId;
10
10
  exports.sortAfterInheritanceOrder = sortAfterInheritanceOrder;
11
+ exports.isGlobalLocation = isGlobalLocation;
11
12
  exports.applyFilesystemRoutingRootEffect = applyFilesystemRoutingRootEffect;
12
13
  exports.getLogicalPath = getLogicalPath;
13
14
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
@@ -44,6 +45,10 @@ function getLogicalPath(locationId, ignoredDirs, removeParenthesesDirs) {
44
45
  assertIsPath(logicalPath);
45
46
  return logicalPath;
46
47
  }
48
+ /** Whether configs defined in `locationId` apply in every `locationIds` */
49
+ function isGlobalLocation(locationId, locationIds) {
50
+ return locationIds.every((locId) => isInherited(locationId, locId) || locationIsRendererDir(locId));
51
+ }
47
52
  function sortAfterInheritanceOrder(locationId1, locationId2, locationIdPage) {
48
53
  assertLocationId(locationId1);
49
54
  assertLocationId(locationId2);
@@ -56,7 +56,7 @@ async function loadValueFile(interfaceValueFile, configDefinitions, userRootDir,
56
56
  async function loadConfigFile(configFilePath, userRootDir, visited, isExtensionConfig, esbuildCache) {
57
57
  const { filePathAbsoluteFilesystem } = configFilePath;
58
58
  assertNoInfiniteLoop(visited, filePathAbsoluteFilesystem);
59
- const { fileExports } = await (0, transpileAndExecuteFile_js_1.transpileAndExecuteFile)(configFilePath, userRootDir, isExtensionConfig, esbuildCache);
59
+ const { fileExports } = await (0, transpileAndExecuteFile_js_1.transpileAndExecuteFile)(configFilePath, userRootDir, isExtensionConfig ? 'is-extension-config' : true, esbuildCache);
60
60
  const { extendsConfigs, extendsFilePaths } = await loadExtendsConfigs(fileExports, configFilePath, userRootDir, [...visited, filePathAbsoluteFilesystem], esbuildCache);
61
61
  const configFile = {
62
62
  fileExports,
@@ -26,7 +26,7 @@ const debug = (0, utils_js_1.createDebugger)('vike:pointer-imports');
26
26
  const debugEsbuildResolve = (0, utils_js_1.createDebugger)('vike:esbuild-resolve');
27
27
  if (debugEsbuildResolve.isActivated)
28
28
  debugEsbuildResolve('esbuild version', esbuild_1.version);
29
- async function transpileAndExecuteFile(filePath, userRootDir, isExtensionConfig, esbuildCache) {
29
+ async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile, esbuildCache) {
30
30
  const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
31
31
  const fileExtension = getFileExtension(filePathAbsoluteFilesystem);
32
32
  if (esbuildCache[filePathAbsoluteFilesystem]) {
@@ -40,12 +40,12 @@ async function transpileAndExecuteFile(filePath, userRootDir, isExtensionConfig,
40
40
  (0, utils_js_1.assertWarning)(false, `${picocolors_1.default.cyan('.h.js')} files are deprecated: simply renaming ${filePathToShowToUserResolved} to ${removeHeaderFileExtension(filePathToShowToUserResolved)} is usually enough, although you may occasionally need to use ${picocolors_1.default.cyan("with { type: 'pointer' }")} as explained at https://vike.dev/config#pointer-imports`, { onlyOnce: true });
41
41
  }
42
42
  let fileExports;
43
- if (isExtensionConfig && !isHeader && fileExtension.endsWith('js')) {
43
+ if (isConfigFile === 'is-extension-config' && !isHeader && fileExtension.endsWith('js')) {
44
44
  // This doesn't track dependencies => we should never use this for user land configs
45
45
  fileExports = await executeFile(filePathAbsoluteFilesystem, filePath);
46
46
  }
47
47
  else {
48
- const transformImports = isHeader ? 'all' : true;
48
+ const transformImports = isConfigFile && (isHeader ? 'all' : true);
49
49
  const code = await transpileFile(filePath, transformImports, userRootDir);
50
50
  fileExports = await executeTranspiledFile(filePath, code);
51
51
  }
@@ -338,7 +338,6 @@ function isTemporaryBuildFile(filePath) {
338
338
  const fileName = path_1.default.posix.basename(filePath);
339
339
  return /\.build-[a-z0-9]{12}\.mjs$/.test(fileName);
340
340
  }
341
- // TODO/next-major: remove
342
341
  function isHeaderFile(filePath) {
343
342
  (0, utils_js_1.assertPosixPath)(filePath);
344
343
  const fileExtensions = getFileExtensions(filePath);
@@ -141,7 +141,7 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePlug
141
141
  async function loadVikeConfig(userRootDir, vikeVitePluginOptions) {
142
142
  const esbuildCache = {};
143
143
  const plusFilesAll = await (0, getPlusFilesAll_js_1.getPlusFilesAll)(userRootDir, esbuildCache);
144
- // assertKnownConfigs(plusFilesAll)
144
+ assertKnownConfigs(plusFilesAll);
145
145
  const configDefinitionsResolved = await resolveConfigDefinitions(plusFilesAll, userRootDir, esbuildCache);
146
146
  const { pageConfigGlobal, pageConfigs } = getPageConfigsBuildTime(configDefinitionsResolved, plusFilesAll, userRootDir);
147
147
  // interop vike(options) in vite.config.js
@@ -235,9 +235,10 @@ function assertPageConfigGlobal(pageConfigGlobal, plusFilesAll) {
235
235
  });
236
236
  }
237
237
  function assertGlobalConfigLocation(configName, sources, plusFilesAll, configDefinitionsGlobal) {
238
+ const locationIdsAll = (0, utils_js_1.objectKeys)(plusFilesAll);
238
239
  // Determine existing global +config.js files
239
240
  const configFilePathsGlobal = [];
240
- const plusFilesGlobal = Object.values((0, utils_js_1.objectFromEntries)((0, utils_js_1.objectEntries)(plusFilesAll).filter(([locationId]) => isGlobalLocation(locationId, plusFilesAll)))).flat();
241
+ const plusFilesGlobal = Object.values((0, utils_js_1.objectFromEntries)((0, utils_js_1.objectEntries)(plusFilesAll).filter(([locationId]) => (0, filesystemRouting_js_1.isGlobalLocation)(locationId, locationIdsAll)))).flat();
241
242
  plusFilesGlobal
242
243
  .filter((i) => i.isConfigFile)
243
244
  .forEach((plusFile) => {
@@ -256,7 +257,7 @@ function assertGlobalConfigLocation(configName, sources, plusFilesAll, configDef
256
257
  if (!filePathAbsoluteUserRootDir)
257
258
  return;
258
259
  (0, utils_js_1.assert)(!plusFile.isExtensionConfig);
259
- if (!isGlobalLocation(source.locationId, plusFilesAll)) {
260
+ if (!(0, filesystemRouting_js_1.isGlobalLocation)(source.locationId, locationIdsAll)) {
260
261
  const configDef = configDefinitionsGlobal[configName];
261
262
  (0, utils_js_1.assert)(configDef);
262
263
  const isConditionallyGlobal = (0, utils_js_1.isCallable)(configDef.global);
@@ -359,7 +360,7 @@ function sortForGlobal(plusFilesAll) {
359
360
  const locationIdsAll = (0, utils_js_1.objectKeys)(plusFilesAll);
360
361
  const plusFilesAllSorted = Object.fromEntries((0, utils_js_1.objectEntries)(plusFilesAll)
361
362
  .sort((0, utils_js_1.lowerFirst)(([locationId]) => locationId.split('/').length))
362
- .sort((0, utils_js_1.makeFirst)(([locationId]) => isGlobalLocation(locationId, plusFilesAll))));
363
+ .sort((0, utils_js_1.makeFirst)(([locationId]) => (0, filesystemRouting_js_1.isGlobalLocation)(locationId, locationIdsAll))));
363
364
  return plusFilesAllSorted;
364
365
  }
365
366
  function resolveConfigValueSources(configName, configDef, plusFilesRelevant, userRootDir, isGlobal) {
@@ -931,10 +932,3 @@ function resolveConfigEnv(configEnv, filePath) {
931
932
  }
932
933
  return configEnvResolved;
933
934
  }
934
- /** Whether configs defined in `locationId` apply to every page */
935
- function isGlobalLocation(locationId, plusFilesAll) {
936
- const locationIdsPage = (0, utils_js_1.objectEntries)(plusFilesAll)
937
- .filter(([_locationId, plusFiles]) => isDefiningPage(plusFiles))
938
- .map(([locationId]) => locationId);
939
- return locationIdsPage.every((locId) => (0, filesystemRouting_js_1.isInherited)(locationId, locId));
940
- }
@@ -14,7 +14,7 @@ async function loadUserFilesServerSide(pageContext) {
14
14
  const pageConfig = (0, findPageConfig_js_1.findPageConfig)(pageContext._pageConfigs, pageContext.pageId); // Make pageConfig globally available as pageContext._pageConfig?
15
15
  const globalContext = pageContext._globalContext;
16
16
  const [{ pageFilesLoaded, pageContextExports }] = await Promise.all([
17
- loadPageUserFiles(pageContext._pageFilesAll, pageConfig, globalContext.pageConfigGlobal, pageContext.pageId, !globalContext.isProduction),
17
+ loadPageUserFiles(pageContext._pageFilesAll, pageConfig, pageContext.pageId, !globalContext.isProduction),
18
18
  (0, analyzePageClientSide_js_1.analyzePageClientSideInit)(pageContext._pageFilesAll, pageContext.pageId, { sharedPageFilesAlreadyLoaded: true })
19
19
  ]);
20
20
  const { isHtmlOnly, isClientRouting, clientEntries, clientDependencies, pageFilesClientSide, pageFilesServerSide } = await (0, analyzePage_js_1.analyzePage)(pageContext._pageFilesAll, pageConfig, pageContext.pageId, globalContext);
@@ -98,11 +98,11 @@ async function loadUserFilesServerSide(pageContext) {
98
98
  }
99
99
  return pageContextAddendum;
100
100
  }
101
- async function loadPageUserFiles(pageFilesAll, pageConfig, pageConfigGlobal, pageId, isDev) {
101
+ async function loadPageUserFiles(pageFilesAll, pageConfig, pageId, isDev) {
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.getPageConfigUserFriendlyOld)(pageFilesServerSide, pageConfigLoaded);
106
106
  return {
107
107
  pageContextExports,
108
108
  pageFilesLoaded: pageFilesServerSide
@@ -11,7 +11,7 @@ const globalContext_js_1 = require("../runtime/globalContext.js");
11
11
  */
12
12
  async function createDevMiddleware(options = {}) {
13
13
  (0, globalContext_js_1.setGlobalContext_isProduction)(false);
14
- const viteConfigFromOptions = {
14
+ const viteConfig = {
15
15
  ...options.viteConfig,
16
16
  server: {
17
17
  ...options.viteConfig?.server,
@@ -19,8 +19,8 @@ async function createDevMiddleware(options = {}) {
19
19
  }
20
20
  };
21
21
  if (options.root)
22
- viteConfigFromOptions.root = options.root;
23
- const { viteConfigEnhanced } = await (0, prepareViteApiCall_js_1.prepareViteApiCall)(viteConfigFromOptions, 'dev');
22
+ viteConfig.root = options.root;
23
+ const { viteConfigEnhanced } = await (0, prepareViteApiCall_js_1.prepareViteApiCall)(viteConfig, 'dev');
24
24
  const server = await (0, vite_1.createServer)(viteConfigEnhanced);
25
25
  const devMiddleware = server.middlewares;
26
26
  return { devMiddleware, viteServer: server, viteConfig: server.config };
@@ -19,7 +19,7 @@ function getPageConfigUserFriendlyNew(pageConfig) {
19
19
  _from: res.from
20
20
  };
21
21
  }
22
- function getPageConfigUserFriendlyOld(pageFiles, pageConfig, pageConfigGlobal) {
22
+ function getPageConfigUserFriendlyOld(pageFiles, pageConfig) {
23
23
  const config = {};
24
24
  const configEntries = {}; // TODO/v1-release: remove
25
25
  const exportsAll = {}; // TODO/v1-release: remove
@@ -44,9 +44,7 @@ function getPageConfigUserFriendlyOld(pageFiles, pageConfig, pageConfigGlobal) {
44
44
  let sources;
45
45
  let from;
46
46
  if (pageConfig) {
47
- const res = getPageConfigUserFriendlyV1Desin({
48
- configValues: { ...pageConfigGlobal.configValues, ...pageConfig.configValues }
49
- });
47
+ const res = getPageConfigUserFriendlyV1Desin(pageConfig);
50
48
  source = res.source;
51
49
  sources = res.sources;
52
50
  from = res.from;
@@ -2,4 +2,4 @@
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
3
  exports.PROJECT_VERSION = void 0;
4
4
  // Automatically updated by @brillout/release-me
5
- exports.PROJECT_VERSION = '0.4.221-commit-937dbfb';
5
+ exports.PROJECT_VERSION = '0.4.221';
@@ -17,9 +17,7 @@ const isArray_js_1 = require("./isArray.js");
17
17
  (0, assert_js_1.assert)(!(0, isBrowser_js_1.isBrowser)());
18
18
  globalThis.__brillout_debug_createDebugger = createDebugger;
19
19
  const flags = [
20
- 'vike:crawl',
21
20
  'vike:error',
22
- 'vike:esbuild-resolve',
23
21
  'vike:extractAssets',
24
22
  'vike:extractExportNames',
25
23
  'vike:glob',
@@ -32,9 +30,9 @@ const flags = [
32
30
  'vike:routing',
33
31
  'vike:setup',
34
32
  'vike:stream',
35
- 'vike:virtual-files'
33
+ 'vike:virtual-files',
34
+ 'vike:esbuild-resolve'
36
35
  ];
37
- const flagsSkipWildcard = ['vike:log'];
38
36
  const flagRegex = /\bvike:[a-zA-Z-]+/g;
39
37
  assertFlagsActivated();
40
38
  function createDebugger(flag, optionsGlobal) {
@@ -79,8 +77,8 @@ function debug_(flag, options, ...msgs) {
79
77
  function isDebugActivated(flag) {
80
78
  (0, checkType_js_1.checkType)(flag);
81
79
  (0, assert_js_1.assert)(flags.includes(flag));
82
- const { flagsActivated, all } = getFlagsActivated();
83
- const isActivated = flagsActivated.includes(flag) || (all && !flagsSkipWildcard.includes(flag));
80
+ const flagsActivated = getFlagsActivated();
81
+ const isActivated = flagsActivated.includes(flag);
84
82
  return isActivated;
85
83
  }
86
84
  function formatMsg(info, options, padding, position) {
@@ -144,7 +142,7 @@ function replaceFunctionSerializer(_key, value) {
144
142
  return value;
145
143
  }
146
144
  function assertFlagsActivated() {
147
- const { flagsActivated } = getFlagsActivated();
145
+ const flagsActivated = getFlagsActivated();
148
146
  flagsActivated.forEach((flag) => {
149
147
  (0, assert_js_1.assertUsage)(flags.includes(flag), `Unknown DEBUG flag ${picocolors_1.default.cyan(flag)}. Valid flags:\n${flags.map((f) => ` ${picocolors_1.default.cyan(f)}`).join('\n')}`);
150
148
  });
@@ -152,8 +150,7 @@ function assertFlagsActivated() {
152
150
  function getFlagsActivated() {
153
151
  const DEBUG = getDEBUG() ?? '';
154
152
  const flagsActivated = DEBUG.match(flagRegex) ?? [];
155
- const all = DEBUG.includes('vike:*');
156
- return { flagsActivated, all };
153
+ return flagsActivated;
157
154
  }
158
155
  function getDEBUG() {
159
156
  let DEBUG;
@@ -45,7 +45,7 @@ function getPageContextPrefetched(pageContext) {
45
45
  }
46
46
  async function prefetchAssets(pageContextLink) {
47
47
  try {
48
- await loadUserFilesClientSide(pageContextLink.pageId, pageContextLink._pageFilesAll, pageContextLink._pageConfigs, pageContextLink._pageConfigGlobal);
48
+ await loadUserFilesClientSide(pageContextLink.pageId, pageContextLink._pageFilesAll, pageContextLink._pageConfigs);
49
49
  }
50
50
  catch (err) {
51
51
  if (isErrorFetchingStaticAssets(err)) {
@@ -131,7 +131,7 @@ async function renderPageClientSide(renderArgs) {
131
131
  objectAssign(pageContext, pageContextFromRoute);
132
132
  }
133
133
  try {
134
- objectAssign(pageContext, await loadUserFilesClientSide(pageContext.pageId, pageContext._pageFilesAll, pageContext._pageConfigs, pageContext._pageConfigGlobal));
134
+ objectAssign(pageContext, await loadUserFilesClientSide(pageContext.pageId, pageContext._pageFilesAll, pageContext._pageConfigs));
135
135
  }
136
136
  catch (err) {
137
137
  if (handleErrorFetchingStaticAssets(err, pageContext, isFirstRender)) {
@@ -336,7 +336,7 @@ async function renderPageClientSide(renderArgs) {
336
336
  return;
337
337
  }
338
338
  try {
339
- objectAssign(pageContext, await loadUserFilesClientSide(pageContext.pageId, pageContext._pageFilesAll, pageContext._pageConfigs, pageContext._pageConfigGlobal));
339
+ objectAssign(pageContext, await loadUserFilesClientSide(pageContext.pageId, pageContext._pageFilesAll, pageContext._pageConfigs));
340
340
  }
341
341
  catch (err) {
342
342
  if (handleErrorFetchingStaticAssets(err, pageContext, isFirstRender)) {
@@ -10,7 +10,6 @@ declare function getPageContext(): Promise<{
10
10
  } & {
11
11
  _pageFilesAll: import("../../shared/getPageFiles.js").PageFile[];
12
12
  _pageConfigs: import("../../__internal/index.js").PageConfig[];
13
- _pageConfigGlobal: import("../../shared/page-configs/PageConfig.js").PageConfigGlobalRuntime;
14
13
  } & import("../../shared/getPageFiles.js").PageConfigUserFriendly & {
15
14
  _pageFilesLoaded: import("../../shared/getPageFiles.js").PageFile[];
16
15
  }>;
@@ -6,7 +6,7 @@ import { getCurrentUrl } from '../shared/getCurrentUrl.js';
6
6
  import { getPageConfigsRuntime } from '../../shared/getPageConfigsRuntime.js';
7
7
  // @ts-ignore
8
8
  import * as virtualFileExports from 'virtual:vike:importUserCode:client:server-routing';
9
- const { pageFilesAll, pageConfigs, pageConfigGlobal } = getPageConfigsRuntime(virtualFileExports);
9
+ const { pageFilesAll, pageConfigs } = getPageConfigsRuntime(virtualFileExports);
10
10
  const urlFirst = getCurrentUrl({ withoutHash: true });
11
11
  async function getPageContext() {
12
12
  const pageContext = getPageContextSerializedInHtml();
@@ -28,10 +28,9 @@ async function loadPageUserFiles(pageId) {
28
28
  const pageContextAddendum = {};
29
29
  objectAssign(pageContextAddendum, {
30
30
  _pageFilesAll: pageFilesAll,
31
- _pageConfigs: pageConfigs,
32
- _pageConfigGlobal: pageConfigGlobal
31
+ _pageConfigs: pageConfigs
33
32
  });
34
- objectAssign(pageContextAddendum, await loadUserFilesClientSide(pageId, pageContextAddendum._pageFilesAll, pageContextAddendum._pageConfigs, pageContextAddendum._pageConfigGlobal));
33
+ objectAssign(pageContextAddendum, await loadUserFilesClientSide(pageId, pageContextAddendum._pageFilesAll, pageContextAddendum._pageConfigs));
35
34
  pageFilesAll
36
35
  .filter((p) => p.fileType !== '.page.server')
37
36
  .forEach((p) => {
@@ -2,14 +2,13 @@ export { loadUserFilesClientSide };
2
2
  export { isErrorFetchingStaticAssets };
3
3
  export type { PageContextUserFiles };
4
4
  import { type PageFile, type PageConfigUserFriendly } from '../../shared/getPageFiles.js';
5
- import type { PageConfigGlobalRuntime, PageConfigRuntime } from '../../shared/page-configs/PageConfig.js';
5
+ import type { PageConfigRuntime } from '../../shared/page-configs/PageConfig.js';
6
6
  type PageContextUserFilesLoaded = PageConfigUserFriendly & {
7
7
  _pageFilesLoaded: PageFile[];
8
8
  };
9
9
  type PageContextUserFiles = {
10
10
  _pageFilesAll: PageFile[];
11
11
  _pageConfigs: PageConfigRuntime[];
12
- _pageConfigGlobal: PageConfigGlobalRuntime;
13
12
  };
14
- declare function loadUserFilesClientSide(pageId: string, pageFilesAll: PageFile[], pageConfigs: PageConfigRuntime[], pageConfigGlobal: PageConfigGlobalRuntime): Promise<PageContextUserFilesLoaded>;
13
+ declare function loadUserFilesClientSide(pageId: string, pageFilesAll: PageFile[], pageConfigs: PageConfigRuntime[]): Promise<PageContextUserFilesLoaded>;
15
14
  declare function isErrorFetchingStaticAssets(err: unknown): boolean;
@@ -6,7 +6,7 @@ import { findPageConfig } from '../../shared/page-configs/findPageConfig.js';
6
6
  import { loadConfigValues } from '../../shared/page-configs/loadConfigValues.js';
7
7
  import { objectAssign } from '../server-routing-runtime/utils.js';
8
8
  const stamp = '__whileFetchingAssets';
9
- async function loadUserFilesClientSide(pageId, pageFilesAll, pageConfigs, pageConfigGlobal) {
9
+ async function loadUserFilesClientSide(pageId, pageFilesAll, pageConfigs) {
10
10
  const pageFilesClientSide = getPageFilesClientSide(pageFilesAll, pageId);
11
11
  const pageConfig = findPageConfig(pageConfigs, pageId);
12
12
  let pageConfigLoaded;
@@ -30,7 +30,7 @@ async function loadUserFilesClientSide(pageId, pageFilesAll, pageConfigs, pageCo
30
30
  }
31
31
  throw err;
32
32
  }
33
- const pageContextExports = getPageConfigUserFriendlyOld(pageFilesClientSide, pageConfigLoaded, pageConfigGlobal);
33
+ const pageContextExports = getPageConfigUserFriendlyOld(pageFilesClientSide, pageConfigLoaded);
34
34
  const pageContextAddendum = {};
35
35
  objectAssign(pageContextAddendum, pageContextExports);
36
36
  objectAssign(pageContextAddendum, { _pageFilesLoaded: pageFilesClientSide });
@@ -5,10 +5,10 @@ export { normalizeViteRoot };
5
5
  import type { InlineConfig, ResolvedConfig } from 'vite';
6
6
  import type { Operation } from './types.js';
7
7
  import { type VikeConfigObject } from '../plugin/plugins/importUserCode/v1-design/getVikeConfig.js';
8
- declare function prepareViteApiCall(viteConfigFromOptions: InlineConfig | undefined, operation: Operation): Promise<{
8
+ declare function prepareViteApiCall(viteConfig: InlineConfig | undefined, operation: Operation): Promise<{
9
9
  vikeConfig: VikeConfigObject;
10
10
  viteConfigEnhanced: InlineConfig | undefined;
11
11
  }>;
12
- declare function getViteRoot(operation: Operation): Promise<string>;
12
+ declare function getViteRoot(operation: 'build' | 'dev' | 'preview' | 'prerender'): Promise<string>;
13
13
  declare function normalizeViteRoot(root: string): string;
14
14
  declare function assertViteRoot(root: string, config: ResolvedConfig): void;
@@ -11,18 +11,18 @@ import { assert, assertUsage, getGlobalObject, isObject, toPosixPath } from './u
11
11
  import pc from '@brillout/picocolors';
12
12
  import { clearGlobalContext } from '../runtime/globalContext.js';
13
13
  const globalObject = getGlobalObject('prepareViteApiCall.ts', {});
14
- async function prepareViteApiCall(viteConfigFromOptions, operation) {
14
+ async function prepareViteApiCall(viteConfig, operation) {
15
15
  clear();
16
16
  setContextApiOperation(operation);
17
- return enhanceViteConfig(viteConfigFromOptions, operation);
17
+ return enhanceViteConfig(viteConfig, operation);
18
18
  }
19
19
  // For subsequent API calls, e.g. calling prerender() after build()
20
20
  function clear() {
21
21
  clearContextApiOperation();
22
22
  clearGlobalContext();
23
23
  }
24
- async function enhanceViteConfig(viteConfigFromOptions, operation) {
25
- const viteInfo = await getInfoFromVite(viteConfigFromOptions, operation);
24
+ async function enhanceViteConfig(viteConfig, operation) {
25
+ const viteInfo = await getInfoFromVite(viteConfig, operation);
26
26
  await assertViteRoot2(viteInfo.root, viteInfo.viteConfigEnhanced, operation);
27
27
  const vikeConfig = await getVikeConfig2(viteInfo.root, operation === 'dev', viteInfo.vikeVitePluginOptions);
28
28
  const viteConfigEnhanced = addViteSettingsSetByVikeConfig(viteInfo.viteConfigEnhanced, vikeConfig);
@@ -38,7 +38,6 @@ function addViteSettingsSetByVikeConfig(viteConfigEnhanced, vikeConfig) {
38
38
  viteConfigs.values.forEach((v) => {
39
39
  assertUsage(isObject(v.value), `${v.definedAt} should be an object`);
40
40
  viteConfigEnhanced = mergeConfig(viteConfigEnhanced ?? {}, v.value);
41
- assertUsage(!findVikeVitePlugin(v.value), "Using the +vite setting to add Vike's Vite plugin is forbidden");
42
41
  });
43
42
  return viteConfigEnhanced;
44
43
  }
@@ -48,14 +47,13 @@ async function getViteRoot(operation) {
48
47
  assert(globalObject.root);
49
48
  return globalObject.root;
50
49
  }
51
- async function getInfoFromVite(viteConfigFromOptions, operation) {
52
- const viteConfigFromUserViteFile = await loadViteConfigFile(viteConfigFromOptions, operation);
53
- const root = normalizeViteRoot(viteConfigFromUserViteFile?.root ?? viteConfigFromOptions?.root ?? process.cwd());
50
+ async function getInfoFromVite(viteConfig, operation) {
51
+ const viteConfigFromFile = await loadViteConfigFile(viteConfig, operation);
52
+ const root = normalizeViteRoot(viteConfigFromFile?.root ?? viteConfig?.root ?? process.cwd());
54
53
  globalObject.root = root;
55
54
  let vikeVitePluginOptions;
56
- let viteConfigEnhanced = viteConfigFromOptions;
57
- // If Vike's Vite plugin is found in both viteConfigFromOptions and viteConfigFromUserViteFile then Vike will later throw an error
58
- const found = findVikeVitePlugin(viteConfigFromOptions) || findVikeVitePlugin(viteConfigFromUserViteFile);
55
+ let viteConfigEnhanced = viteConfig;
56
+ const found = findVikeVitePlugin([...(viteConfig?.plugins ?? []), ...(viteConfigFromFile?.plugins ?? [])]);
59
57
  if (found) {
60
58
  vikeVitePluginOptions = found.vikeVitePluginOptions;
61
59
  }
@@ -64,20 +62,20 @@ async function getInfoFromVite(viteConfigFromOptions, operation) {
64
62
  // Using a dynamic import because the script calling the Vike API may not live in the same place as vite.config.js, thus vike/plugin may resolved to two different node_modules/vike directories.
65
63
  const { plugin: vikePlugin } = await import('../plugin/index.js');
66
64
  viteConfigEnhanced = {
67
- ...viteConfigFromOptions,
68
- plugins: [...(viteConfigFromOptions?.plugins ?? []), vikePlugin()]
65
+ ...viteConfig,
66
+ plugins: [...(viteConfig?.plugins ?? []), vikePlugin()]
69
67
  };
70
- const res = findVikeVitePlugin(viteConfigEnhanced);
68
+ const res = findVikeVitePlugin(viteConfigEnhanced.plugins);
71
69
  assert(res);
72
70
  vikeVitePluginOptions = res.vikeVitePluginOptions;
73
71
  }
74
72
  assert(vikeVitePluginOptions);
75
73
  return { root, vikeVitePluginOptions, viteConfigEnhanced };
76
74
  }
77
- function findVikeVitePlugin(viteConfig) {
75
+ function findVikeVitePlugin(plugins) {
78
76
  let vikeVitePluginOptions;
79
77
  let vikeVitePuginFound = false;
80
- viteConfig?.plugins?.forEach((p) => {
78
+ plugins.forEach((p) => {
81
79
  if (p && '__vikeVitePluginOptions' in p) {
82
80
  vikeVitePuginFound = true;
83
81
  const options = p.__vikeVitePluginOptions;
@@ -90,8 +88,8 @@ function findVikeVitePlugin(viteConfig) {
90
88
  return { vikeVitePluginOptions };
91
89
  }
92
90
  // Copied from https://github.com/vitejs/vite/blob/4f5845a3182fc950eb9cd76d7161698383113b18/packages/vite/src/node/config.ts#L961-L1005
93
- async function loadViteConfigFile(viteConfigFromOptions, operation) {
94
- const [inlineConfig, command, defaultMode, _defaultNodeEnv, isPreview] = getResolveConfigArgs(viteConfigFromOptions, operation);
91
+ async function loadViteConfigFile(viteConfig, operation) {
92
+ const [inlineConfig, command, defaultMode, _defaultNodeEnv, isPreview] = getResolveConfigArgs(viteConfig, operation);
95
93
  let config = inlineConfig;
96
94
  let mode = inlineConfig.mode || defaultMode;
97
95
  const configEnv = {
@@ -2,6 +2,7 @@ export { fixServerAssets };
2
2
  export { fixServerAssets_isEnabled };
3
3
  export { fixServerAssets_assertCssCodeSplit };
4
4
  export { fixServerAssets_assertCssTarget };
5
+ export { fixServerAssets_assertCssTarget_populate };
5
6
  import { ViteManifest } from '../../../shared/ViteManifest.js';
6
7
  import { ResolvedConfig } from 'vite';
7
8
  /**
@@ -17,4 +18,5 @@ declare function fixServerAssets(config: ResolvedConfig): Promise<{
17
18
  serverManifestMod: ViteManifest;
18
19
  }>;
19
20
  declare function fixServerAssets_assertCssCodeSplit(config: ResolvedConfig): void;
21
+ declare function fixServerAssets_assertCssTarget_populate(config: ResolvedConfig): void;
20
22
  declare function fixServerAssets_assertCssTarget(config: ResolvedConfig): Promise<void>;
@@ -2,6 +2,7 @@ export { fixServerAssets };
2
2
  export { fixServerAssets_isEnabled };
3
3
  export { fixServerAssets_assertCssCodeSplit };
4
4
  export { fixServerAssets_assertCssTarget };
5
+ export { fixServerAssets_assertCssTarget_populate };
5
6
  import fs from 'fs/promises';
6
7
  import fs_sync from 'fs';
7
8
  import path from 'path';
@@ -194,15 +195,17 @@ function fixServerAssets_assertCssCodeSplit(config) {
194
195
  assertWarning(config.build.cssCodeSplit, `${pc.cyan('build.cssCodeSplit')} shouldn't be set to ${pc.cyan('false')} (https://github.com/vikejs/vike/issues/1993)`, { onlyOnce: true });
195
196
  }
196
197
  const targets = [];
198
+ function fixServerAssets_assertCssTarget_populate(config) {
199
+ const isServerSide = viteIsSSR(config);
200
+ assert(typeof isServerSide === 'boolean');
201
+ assert(config.build.target !== undefined);
202
+ targets.push({ global: config.build.target, css: config.build.cssTarget, isServerSide });
203
+ }
197
204
  async function fixServerAssets_assertCssTarget(config) {
198
205
  if (!fixServerAssets_isEnabled())
199
206
  return;
200
207
  if (!(await isV1Design(config)))
201
208
  return;
202
- const isServerSide = viteIsSSR(config);
203
- assert(typeof isServerSide === 'boolean');
204
- assert(config.build.target !== undefined);
205
- targets.push({ global: config.build.target, css: config.build.cssTarget, isServerSide });
206
209
  const targetsServer = targets.filter((t) => t.isServerSide);
207
210
  const targetsClient = targets.filter((t) => !t.isServerSide);
208
211
  targetsClient.forEach((targetClient) => {
@@ -210,10 +213,9 @@ async function fixServerAssets_assertCssTarget(config) {
210
213
  targetsServer.forEach((targetServer) => {
211
214
  const targetCssResolvedServer = resolveCssTarget(targetServer);
212
215
  assertWarning(isEqualStringList(targetCssResolvedClient, targetCssResolvedServer), [
213
- 'The CSS browser target should be the same for both client and server, but we got:',
214
- `Client: ${pc.cyan(JSON.stringify(targetCssResolvedClient))}`,
215
- `Server: ${pc.cyan(JSON.stringify(targetCssResolvedServer))}`,
216
- `Different targets lead to CSS duplication, see ${pc.underline('https://github.com/vikejs/vike/issues/1815#issuecomment-2507002979')} for more information.`
216
+ 'The CSS browser target should be the same for both client-side and server-side (https://github.com/vikejs/vike/issues/1815#issuecomment-2507002979) but we got:',
217
+ `Client-side: ${pc.cyan(JSON.stringify(targetCssResolvedClient))}`,
218
+ `Server-side: ${pc.cyan(JSON.stringify(targetCssResolvedServer))}`
217
219
  ].join('\n'), {
218
220
  showStackTrace: true,
219
221
  onlyOnce: 'different-css-target'
@@ -10,7 +10,7 @@ import { extractAssetsAddQuery } from '../../shared/extractAssetsQuery.js';
10
10
  import { createRequire } from 'module';
11
11
  import fs from 'fs/promises';
12
12
  import path from 'path';
13
- import { fixServerAssets, fixServerAssets_assertCssCodeSplit, fixServerAssets_assertCssTarget, fixServerAssets_isEnabled } from './buildConfig/fixServerAssets.js';
13
+ import { fixServerAssets, fixServerAssets_assertCssCodeSplit, fixServerAssets_assertCssTarget, fixServerAssets_assertCssTarget_populate, fixServerAssets_isEnabled } from './buildConfig/fixServerAssets.js';
14
14
  import { set_ASSETS_MANIFEST } from './buildEntry/index.js';
15
15
  import { prependEntriesDir } from '../../shared/prependEntriesDir.js';
16
16
  import { getFilePathResolved } from '../shared/getFilePath.js';
@@ -48,6 +48,7 @@ function buildConfig() {
48
48
  config.build.ssrEmitAssets = true;
49
49
  // Required if `ssrEmitAssets: true`, see https://github.com/vitejs/vite/pull/11430#issuecomment-1454800934
50
50
  config.build.cssMinify = 'esbuild';
51
+ fixServerAssets_assertCssTarget_populate(config);
51
52
  fixServerAssets_assertCssCodeSplit(config);
52
53
  }
53
54
  }
@@ -1,5 +1,5 @@
1
1
  export { crawlPlusFiles };
2
- import { assertPosixPath, assert, scriptFileExtensions, assertIsSingleModuleInstance, assertIsNotProductionRuntime, isVersionOrAbove, isScriptFile, scriptFileExtensionList, createDebugger, deepEqual } from '../../../../utils.js';
2
+ import { assertPosixPath, assert, scriptFileExtensions, assertIsSingleModuleInstance, assertIsNotProductionRuntime, isVersionOrAbove, isScriptFile, scriptFileExtensionList } from '../../../../utils.js';
3
3
  import path from 'path';
4
4
  import glob from 'fast-glob';
5
5
  import { exec } from 'child_process';
@@ -7,7 +7,6 @@ import { promisify } from 'util';
7
7
  import { isTemporaryBuildFile } from './transpileAndExecuteFile.js';
8
8
  import { getEnvVarObject } from '../../../../shared/getEnvVarObject.js';
9
9
  const execA = promisify(exec);
10
- const debug = createDebugger('vike:crawl');
11
10
  assertIsNotProductionRuntime();
12
11
  assertIsSingleModuleInstance('crawlPlusFiles.ts');
13
12
  let gitIsNotUsable = false;
@@ -31,16 +30,17 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem) {
31
30
  //
32
31
  !outDirRelativeFromUserRootDir.startsWith('../')));
33
32
  // Crawl
34
- const filesGit = !isGitCrawlDisabled() && (await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir));
35
- const filesGitNothingFound = !filesGit || filesGit.length === 0;
36
- const filesGlob = (filesGitNothingFound || debug.isActivated) && (await fastGlob(userRootDir, outDirRelativeFromUserRootDir));
37
- let files = !filesGitNothingFound
38
- ? filesGit
39
- : // Fallback to fast-glob for users that dynamically generate plus files. (Assuming that no plus file is found because of the user's .gitignore list.)
40
- filesGlob;
41
- assert(files);
42
- if (debug.isActivated)
43
- assert(deepEqual(filesGlob, filesGit), "Git and glob results aren't matching.");
33
+ let files;
34
+ const res = !isGitCrawlDisabled() && (await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir));
35
+ if (res &&
36
+ // Fallback to fast-glob for users that dynamically generate plus files. (Assuming that no plus file is found because of the user's .gitignore list.)
37
+ res.length > 0) {
38
+ files = res;
39
+ // We cannot find files inside symlink directories with `$ git ls-files` => we use fast-glob
40
+ }
41
+ else {
42
+ files = await fastGlob(userRootDir, outDirRelativeFromUserRootDir);
43
+ }
44
44
  // Filter build files
45
45
  files = files.filter((filePath) => !isTemporaryBuildFile(filePath));
46
46
  // Normalize
@@ -69,7 +69,7 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
69
69
  preserveUTF8,
70
70
  'ls-files',
71
71
  // Performance gain seems negligible: https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
72
- ...scriptFileExtensionList.map((ext) => `"**/+*.${ext}" "+*.${ext}"`),
72
+ ...scriptFileExtensionList.map((ext) => `"**/+*.${ext}"`),
73
73
  // Performance gain is non-negligible.
74
74
  // - https://github.com/vikejs/vike/pull/1688#issuecomment-2166206648
75
75
  // - When node_modules/ is untracked the performance gain could be significant?
@@ -96,12 +96,6 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
96
96
  }
97
97
  throw err;
98
98
  }
99
- if (debug.isActivated) {
100
- debug('[git] userRootDir:', userRootDir);
101
- debug('[git] cmd:', cmd);
102
- debug('[git] result:', filesAll);
103
- debug('[git] filesDeleted:', filesDeleted);
104
- }
105
99
  const files = [];
106
100
  for (const filePath of filesAll) {
107
101
  // + file?
@@ -122,21 +116,14 @@ async function gitLsFiles(userRootDir, outDirRelativeFromUserRootDir) {
122
116
  }
123
117
  // Same as gitLsFiles() but using fast-glob
124
118
  async function fastGlob(userRootDir, outDirRelativeFromUserRootDir) {
125
- const pattern = `**/+*.${scriptFileExtensions}`;
126
- const options = {
119
+ const files = await glob(`**/+*.${scriptFileExtensions}`, {
127
120
  ignore: getIgnoreAsPatterns(outDirRelativeFromUserRootDir),
128
121
  cwd: userRootDir,
129
122
  dot: false
130
- };
131
- const files = await glob(pattern, options);
123
+ });
132
124
  // Make build deterministic, in order to get a stable generated hash for dist/client/assets/entries/entry-client-routing.${hash}.js
133
125
  // https://github.com/vikejs/vike/pull/1750
134
126
  files.sort();
135
- if (debug.isActivated) {
136
- debug('[glob] pattern:', pattern);
137
- debug('[glob] options:', options);
138
- debug('[glob] result:', files);
139
- }
140
127
  return files;
141
128
  }
142
129
  // Same as getIgnoreAsFilterFn() but as glob pattern
@@ -3,6 +3,7 @@ export { getFilesystemRouteDefinedBy };
3
3
  export { isInherited };
4
4
  export { getLocationId };
5
5
  export { sortAfterInheritanceOrder };
6
+ export { isGlobalLocation };
6
7
  export { applyFilesystemRoutingRootEffect };
7
8
  export type { LocationId };
8
9
  export { getLogicalPath };
@@ -45,6 +46,8 @@ declare function getFilesystemRouteString(locationId: LocationId): string;
45
46
  * getLogicalPath('/pages/some-page', ['pages']) => '/some-page'
46
47
  */
47
48
  declare function getLogicalPath(locationId: LocationId, ignoredDirs: string[], removeParenthesesDirs?: true): string;
49
+ /** Whether configs defined in `locationId` apply in every `locationIds` */
50
+ declare function isGlobalLocation(locationId: LocationId, locationIds: LocationId[]): boolean;
48
51
  declare function sortAfterInheritanceOrder(locationId1: LocationId, locationId2: LocationId, locationIdPage: LocationId): -1 | 1 | 0;
49
52
  /** Whether configs defined at `locationId1` also apply at `locationId2` */
50
53
  declare function isInherited(locationId1: LocationId, locationId2: LocationId): boolean;
@@ -3,6 +3,7 @@ export { getFilesystemRouteDefinedBy };
3
3
  export { isInherited };
4
4
  export { getLocationId };
5
5
  export { sortAfterInheritanceOrder };
6
+ export { isGlobalLocation };
6
7
  export { applyFilesystemRoutingRootEffect };
7
8
  // For ./filesystemRouting.spec.ts
8
9
  export { getLogicalPath };
@@ -40,6 +41,10 @@ function getLogicalPath(locationId, ignoredDirs, removeParenthesesDirs) {
40
41
  assertIsPath(logicalPath);
41
42
  return logicalPath;
42
43
  }
44
+ /** Whether configs defined in `locationId` apply in every `locationIds` */
45
+ function isGlobalLocation(locationId, locationIds) {
46
+ return locationIds.every((locId) => isInherited(locationId, locId) || locationIsRendererDir(locId));
47
+ }
43
48
  function sortAfterInheritanceOrder(locationId1, locationId2, locationIdPage) {
44
49
  assertLocationId(locationId1);
45
50
  assertLocationId(locationId2);
@@ -51,7 +51,7 @@ async function loadValueFile(interfaceValueFile, configDefinitions, userRootDir,
51
51
  async function loadConfigFile(configFilePath, userRootDir, visited, isExtensionConfig, esbuildCache) {
52
52
  const { filePathAbsoluteFilesystem } = configFilePath;
53
53
  assertNoInfiniteLoop(visited, filePathAbsoluteFilesystem);
54
- const { fileExports } = await transpileAndExecuteFile(configFilePath, userRootDir, isExtensionConfig, esbuildCache);
54
+ const { fileExports } = await transpileAndExecuteFile(configFilePath, userRootDir, isExtensionConfig ? 'is-extension-config' : true, esbuildCache);
55
55
  const { extendsConfigs, extendsFilePaths } = await loadExtendsConfigs(fileExports, configFilePath, userRootDir, [...visited, filePathAbsoluteFilesystem], esbuildCache);
56
56
  const configFile = {
57
57
  fileExports,
@@ -10,7 +10,7 @@ type FileExports = {
10
10
  };
11
11
  type EsbuildCache = Record<string, // filePathAbsoluteFilesystem
12
12
  Promise<FileExports>>;
13
- declare function transpileAndExecuteFile(filePath: FilePathResolved, userRootDir: string, isExtensionConfig: boolean, esbuildCache: EsbuildCache): Promise<FileExports>;
13
+ declare function transpileAndExecuteFile(filePath: FilePathResolved, userRootDir: string, isConfigFile: boolean | 'is-extension-config', esbuildCache: EsbuildCache): Promise<FileExports>;
14
14
  declare function getConfigBuildErrorFormatted(err: unknown): null | string;
15
15
  declare function getConfigExecutionErrorIntroMsg(err: unknown): string | null;
16
16
  declare function isTemporaryBuildFile(filePath: string): boolean;
@@ -21,7 +21,7 @@ const debug = createDebugger('vike:pointer-imports');
21
21
  const debugEsbuildResolve = createDebugger('vike:esbuild-resolve');
22
22
  if (debugEsbuildResolve.isActivated)
23
23
  debugEsbuildResolve('esbuild version', version);
24
- async function transpileAndExecuteFile(filePath, userRootDir, isExtensionConfig, esbuildCache) {
24
+ async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile, esbuildCache) {
25
25
  const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
26
26
  const fileExtension = getFileExtension(filePathAbsoluteFilesystem);
27
27
  if (esbuildCache[filePathAbsoluteFilesystem]) {
@@ -35,12 +35,12 @@ async function transpileAndExecuteFile(filePath, userRootDir, isExtensionConfig,
35
35
  assertWarning(false, `${pc.cyan('.h.js')} files are deprecated: simply renaming ${filePathToShowToUserResolved} to ${removeHeaderFileExtension(filePathToShowToUserResolved)} is usually enough, although you may occasionally need to use ${pc.cyan("with { type: 'pointer' }")} as explained at https://vike.dev/config#pointer-imports`, { onlyOnce: true });
36
36
  }
37
37
  let fileExports;
38
- if (isExtensionConfig && !isHeader && fileExtension.endsWith('js')) {
38
+ if (isConfigFile === 'is-extension-config' && !isHeader && fileExtension.endsWith('js')) {
39
39
  // This doesn't track dependencies => we should never use this for user land configs
40
40
  fileExports = await executeFile(filePathAbsoluteFilesystem, filePath);
41
41
  }
42
42
  else {
43
- const transformImports = isHeader ? 'all' : true;
43
+ const transformImports = isConfigFile && (isHeader ? 'all' : true);
44
44
  const code = await transpileFile(filePath, transformImports, userRootDir);
45
45
  fileExports = await executeTranspiledFile(filePath, code);
46
46
  }
@@ -333,7 +333,6 @@ function isTemporaryBuildFile(filePath) {
333
333
  const fileName = path.posix.basename(filePath);
334
334
  return /\.build-[a-z0-9]{12}\.mjs$/.test(fileName);
335
335
  }
336
- // TODO/next-major: remove
337
336
  function isHeaderFile(filePath) {
338
337
  assertPosixPath(filePath);
339
338
  const fileExtensions = getFileExtensions(filePath);
@@ -7,7 +7,7 @@ export { getConfVal };
7
7
  export { getConfigDefinitionOptional };
8
8
  import { assertPosixPath, assert, isObject, assertUsage, assertWarning, objectEntries, hasProp, includes, assertIsNotProductionRuntime, getMostSimilar, joinEnglish, assertKeys, objectKeys, objectFromEntries, unique, isCallable, makeFirst, lowerFirst } from '../../../utils.js';
9
9
  import { configDefinitionsBuiltIn } from './getVikeConfig/configDefinitionsBuiltIn.js';
10
- import { getLocationId, getFilesystemRouteString, getFilesystemRouteDefinedBy, isInherited, sortAfterInheritanceOrder, applyFilesystemRoutingRootEffect } from './getVikeConfig/filesystemRouting.js';
10
+ import { getLocationId, getFilesystemRouteString, getFilesystemRouteDefinedBy, isInherited, sortAfterInheritanceOrder, isGlobalLocation, applyFilesystemRoutingRootEffect } from './getVikeConfig/filesystemRouting.js';
11
11
  import { isConfigInvalid, isConfigInvalid_set } from '../../../../runtime/renderPage/isConfigInvalid.js';
12
12
  import { getViteDevServer } from '../../../../runtime/globalContext.js';
13
13
  import { logConfigError, logConfigErrorRecover } from '../../../shared/loggerNotProd.js';
@@ -135,7 +135,7 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, vikeVitePlug
135
135
  async function loadVikeConfig(userRootDir, vikeVitePluginOptions) {
136
136
  const esbuildCache = {};
137
137
  const plusFilesAll = await getPlusFilesAll(userRootDir, esbuildCache);
138
- // assertKnownConfigs(plusFilesAll)
138
+ assertKnownConfigs(plusFilesAll);
139
139
  const configDefinitionsResolved = await resolveConfigDefinitions(plusFilesAll, userRootDir, esbuildCache);
140
140
  const { pageConfigGlobal, pageConfigs } = getPageConfigsBuildTime(configDefinitionsResolved, plusFilesAll, userRootDir);
141
141
  // interop vike(options) in vite.config.js
@@ -229,9 +229,10 @@ function assertPageConfigGlobal(pageConfigGlobal, plusFilesAll) {
229
229
  });
230
230
  }
231
231
  function assertGlobalConfigLocation(configName, sources, plusFilesAll, configDefinitionsGlobal) {
232
+ const locationIdsAll = objectKeys(plusFilesAll);
232
233
  // Determine existing global +config.js files
233
234
  const configFilePathsGlobal = [];
234
- const plusFilesGlobal = Object.values(objectFromEntries(objectEntries(plusFilesAll).filter(([locationId]) => isGlobalLocation(locationId, plusFilesAll)))).flat();
235
+ const plusFilesGlobal = Object.values(objectFromEntries(objectEntries(plusFilesAll).filter(([locationId]) => isGlobalLocation(locationId, locationIdsAll)))).flat();
235
236
  plusFilesGlobal
236
237
  .filter((i) => i.isConfigFile)
237
238
  .forEach((plusFile) => {
@@ -250,7 +251,7 @@ function assertGlobalConfigLocation(configName, sources, plusFilesAll, configDef
250
251
  if (!filePathAbsoluteUserRootDir)
251
252
  return;
252
253
  assert(!plusFile.isExtensionConfig);
253
- if (!isGlobalLocation(source.locationId, plusFilesAll)) {
254
+ if (!isGlobalLocation(source.locationId, locationIdsAll)) {
254
255
  const configDef = configDefinitionsGlobal[configName];
255
256
  assert(configDef);
256
257
  const isConditionallyGlobal = isCallable(configDef.global);
@@ -353,7 +354,7 @@ function sortForGlobal(plusFilesAll) {
353
354
  const locationIdsAll = objectKeys(plusFilesAll);
354
355
  const plusFilesAllSorted = Object.fromEntries(objectEntries(plusFilesAll)
355
356
  .sort(lowerFirst(([locationId]) => locationId.split('/').length))
356
- .sort(makeFirst(([locationId]) => isGlobalLocation(locationId, plusFilesAll))));
357
+ .sort(makeFirst(([locationId]) => isGlobalLocation(locationId, locationIdsAll))));
357
358
  return plusFilesAllSorted;
358
359
  }
359
360
  function resolveConfigValueSources(configName, configDef, plusFilesRelevant, userRootDir, isGlobal) {
@@ -925,10 +926,3 @@ function resolveConfigEnv(configEnv, filePath) {
925
926
  }
926
927
  return configEnvResolved;
927
928
  }
928
- /** Whether configs defined in `locationId` apply to every page */
929
- function isGlobalLocation(locationId, plusFilesAll) {
930
- const locationIdsPage = objectEntries(plusFilesAll)
931
- .filter(([_locationId, plusFiles]) => isDefiningPage(plusFiles))
932
- .map(([locationId]) => locationId);
933
- return locationIdsPage.every((locId) => isInherited(locationId, locId));
934
- }
@@ -12,7 +12,7 @@ async function loadUserFilesServerSide(pageContext) {
12
12
  const pageConfig = findPageConfig(pageContext._pageConfigs, pageContext.pageId); // Make pageConfig globally available as pageContext._pageConfig?
13
13
  const globalContext = pageContext._globalContext;
14
14
  const [{ pageFilesLoaded, pageContextExports }] = await Promise.all([
15
- loadPageUserFiles(pageContext._pageFilesAll, pageConfig, globalContext.pageConfigGlobal, pageContext.pageId, !globalContext.isProduction),
15
+ loadPageUserFiles(pageContext._pageFilesAll, pageConfig, pageContext.pageId, !globalContext.isProduction),
16
16
  analyzePageClientSideInit(pageContext._pageFilesAll, pageContext.pageId, { sharedPageFilesAlreadyLoaded: true })
17
17
  ]);
18
18
  const { isHtmlOnly, isClientRouting, clientEntries, clientDependencies, pageFilesClientSide, pageFilesServerSide } = await analyzePage(pageContext._pageFilesAll, pageConfig, pageContext.pageId, globalContext);
@@ -96,11 +96,11 @@ async function loadUserFilesServerSide(pageContext) {
96
96
  }
97
97
  return pageContextAddendum;
98
98
  }
99
- async function loadPageUserFiles(pageFilesAll, pageConfig, pageConfigGlobal, pageId, isDev) {
99
+ async function loadPageUserFiles(pageFilesAll, pageConfig, pageId, isDev) {
100
100
  const pageFilesServerSide = getPageFilesServerSide(pageFilesAll, pageId);
101
101
  const pageConfigLoaded = !pageConfig ? null : await loadConfigValues(pageConfig, isDev);
102
102
  await Promise.all(pageFilesServerSide.map((p) => p.loadFile?.()));
103
- const pageContextExports = getPageConfigUserFriendlyOld(pageFilesServerSide, pageConfigLoaded, pageConfigGlobal);
103
+ const pageContextExports = getPageConfigUserFriendlyOld(pageFilesServerSide, pageConfigLoaded);
104
104
  return {
105
105
  pageContextExports,
106
106
  pageFilesLoaded: pageFilesServerSide
@@ -9,7 +9,7 @@ import { setGlobalContext_isProduction } from '../runtime/globalContext.js';
9
9
  */
10
10
  async function createDevMiddleware(options = {}) {
11
11
  setGlobalContext_isProduction(false);
12
- const viteConfigFromOptions = {
12
+ const viteConfig = {
13
13
  ...options.viteConfig,
14
14
  server: {
15
15
  ...options.viteConfig?.server,
@@ -17,8 +17,8 @@ async function createDevMiddleware(options = {}) {
17
17
  }
18
18
  };
19
19
  if (options.root)
20
- viteConfigFromOptions.root = options.root;
21
- const { viteConfigEnhanced } = await prepareViteApiCall(viteConfigFromOptions, 'dev');
20
+ viteConfig.root = options.root;
21
+ const { viteConfigEnhanced } = await prepareViteApiCall(viteConfig, 'dev');
22
22
  const server = await createServer(viteConfigEnhanced);
23
23
  const devMiddleware = server.middlewares;
24
24
  return { devMiddleware, viteServer: server, viteConfig: server.config };
@@ -9,7 +9,7 @@ export type { ExportsAll };
9
9
  export type { ConfigEntries };
10
10
  import type { FileType } from '../getPageFiles/fileTypes.js';
11
11
  import type { PageFile } from '../getPageFiles/getPageFileObject.js';
12
- import type { ConfigValues, PageConfigGlobalRuntime, PageConfigRuntimeLoaded } from './PageConfig.js';
12
+ import type { ConfigValues, PageConfigRuntimeLoaded } from './PageConfig.js';
13
13
  import { type ConfigDefinedAtOptional } from './getConfigDefinedAt.js';
14
14
  import type { ConfigResolved } from './Config/PageContextConfig.js';
15
15
  type ExportsAll = Record<string, {
@@ -82,4 +82,4 @@ type ConfigUserFriendly = {
82
82
  declare function getPageConfigUserFriendlyNew(pageConfig: {
83
83
  configValues: ConfigValues;
84
84
  }): ConfigUserFriendly;
85
- declare function getPageConfigUserFriendlyOld(pageFiles: PageFile[], pageConfig: PageConfigRuntimeLoaded | null, pageConfigGlobal: PageConfigGlobalRuntime): PageConfigUserFriendly;
85
+ declare function getPageConfigUserFriendlyOld(pageFiles: PageFile[], pageConfig: PageConfigRuntimeLoaded | null): PageConfigUserFriendly;
@@ -14,7 +14,7 @@ function getPageConfigUserFriendlyNew(pageConfig) {
14
14
  _from: res.from
15
15
  };
16
16
  }
17
- function getPageConfigUserFriendlyOld(pageFiles, pageConfig, pageConfigGlobal) {
17
+ function getPageConfigUserFriendlyOld(pageFiles, pageConfig) {
18
18
  const config = {};
19
19
  const configEntries = {}; // TODO/v1-release: remove
20
20
  const exportsAll = {}; // TODO/v1-release: remove
@@ -39,9 +39,7 @@ function getPageConfigUserFriendlyOld(pageFiles, pageConfig, pageConfigGlobal) {
39
39
  let sources;
40
40
  let from;
41
41
  if (pageConfig) {
42
- const res = getPageConfigUserFriendlyV1Desin({
43
- configValues: { ...pageConfigGlobal.configValues, ...pageConfig.configValues }
44
- });
42
+ const res = getPageConfigUserFriendlyV1Desin(pageConfig);
45
43
  source = res.source;
46
44
  sources = res.sources;
47
45
  from = res.from;
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.221-commit-937dbfb";
1
+ export declare const PROJECT_VERSION: "0.4.221";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.221-commit-937dbfb';
2
+ export const PROJECT_VERSION = '0.4.221';
@@ -1,7 +1,7 @@
1
1
  export { createDebugger };
2
2
  export { isDebugActivated };
3
3
  export type { Debug };
4
- declare const flags: readonly ["vike:crawl", "vike:error", "vike:esbuild-resolve", "vike:extractAssets", "vike:extractExportNames", "vike:glob", "vike:globalContext", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:routing", "vike:setup", "vike:stream", "vike:virtual-files"];
4
+ declare const flags: readonly ["vike:error", "vike:extractAssets", "vike:extractExportNames", "vike:glob", "vike:globalContext", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:routing", "vike:setup", "vike:stream", "vike:virtual-files", "vike:esbuild-resolve"];
5
5
  type Flag = (typeof flags)[number];
6
6
  type Debug = ReturnType<typeof createDebugger>;
7
7
  type Options = {
@@ -12,9 +12,7 @@ import { isArray } from './isArray.js';
12
12
  assert(!isBrowser());
13
13
  globalThis.__brillout_debug_createDebugger = createDebugger;
14
14
  const flags = [
15
- 'vike:crawl',
16
15
  'vike:error',
17
- 'vike:esbuild-resolve',
18
16
  'vike:extractAssets',
19
17
  'vike:extractExportNames',
20
18
  'vike:glob',
@@ -27,9 +25,9 @@ const flags = [
27
25
  'vike:routing',
28
26
  'vike:setup',
29
27
  'vike:stream',
30
- 'vike:virtual-files'
28
+ 'vike:virtual-files',
29
+ 'vike:esbuild-resolve'
31
30
  ];
32
- const flagsSkipWildcard = ['vike:log'];
33
31
  const flagRegex = /\bvike:[a-zA-Z-]+/g;
34
32
  assertFlagsActivated();
35
33
  function createDebugger(flag, optionsGlobal) {
@@ -74,8 +72,8 @@ function debug_(flag, options, ...msgs) {
74
72
  function isDebugActivated(flag) {
75
73
  checkType(flag);
76
74
  assert(flags.includes(flag));
77
- const { flagsActivated, all } = getFlagsActivated();
78
- const isActivated = flagsActivated.includes(flag) || (all && !flagsSkipWildcard.includes(flag));
75
+ const flagsActivated = getFlagsActivated();
76
+ const isActivated = flagsActivated.includes(flag);
79
77
  return isActivated;
80
78
  }
81
79
  function formatMsg(info, options, padding, position) {
@@ -139,7 +137,7 @@ function replaceFunctionSerializer(_key, value) {
139
137
  return value;
140
138
  }
141
139
  function assertFlagsActivated() {
142
- const { flagsActivated } = getFlagsActivated();
140
+ const flagsActivated = getFlagsActivated();
143
141
  flagsActivated.forEach((flag) => {
144
142
  assertUsage(flags.includes(flag), `Unknown DEBUG flag ${pc.cyan(flag)}. Valid flags:\n${flags.map((f) => ` ${pc.cyan(f)}`).join('\n')}`);
145
143
  });
@@ -147,8 +145,7 @@ function assertFlagsActivated() {
147
145
  function getFlagsActivated() {
148
146
  const DEBUG = getDEBUG() ?? '';
149
147
  const flagsActivated = DEBUG.match(flagRegex) ?? [];
150
- const all = DEBUG.includes('vike:*');
151
- return { flagsActivated, all };
148
+ return flagsActivated;
152
149
  }
153
150
  function getDEBUG() {
154
151
  let DEBUG;
@@ -1,4 +1,4 @@
1
1
  export declare const projectInfo: {
2
2
  projectName: "Vike";
3
- projectVersion: "0.4.221-commit-937dbfb";
3
+ projectVersion: "0.4.221";
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.221-commit-937dbfb",
3
+ "version": "0.4.221",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {