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

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (44) hide show
  1. package/dist/cjs/node/plugin/plugins/commonConfig.js +2 -1
  2. package/dist/cjs/node/plugin/plugins/fileEnv.js +5 -2
  3. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +19 -9
  4. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +2 -1
  5. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +10 -1
  6. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +112 -79
  7. package/dist/cjs/node/plugin/utils.js +1 -0
  8. package/dist/cjs/node/prerender/context.js +3 -8
  9. package/dist/cjs/node/prerender/resolvePrerenderConfig.js +23 -21
  10. package/dist/cjs/node/prerender/runPrerender.js +24 -28
  11. package/dist/cjs/node/prerender/utils.js +1 -0
  12. package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +2 -2
  13. package/dist/cjs/shared/page-configs/serialize/serializeConfigValues.js +1 -1
  14. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  15. package/dist/cjs/utils/isFilePathAbsoluteFilesystem.js +10 -4
  16. package/dist/cjs/utils/path.js +1 -0
  17. package/dist/esm/node/plugin/plugins/commonConfig.js +3 -2
  18. package/dist/esm/node/plugin/plugins/fileEnv.js +5 -2
  19. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +20 -10
  20. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +2 -1
  21. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +0 -1
  22. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +11 -2
  23. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +112 -79
  24. package/dist/esm/node/plugin/utils.d.ts +1 -0
  25. package/dist/esm/node/plugin/utils.js +1 -0
  26. package/dist/esm/node/prerender/context.d.ts +0 -2
  27. package/dist/esm/node/prerender/context.js +4 -9
  28. package/dist/esm/node/prerender/resolvePrerenderConfig.d.ts +10 -6
  29. package/dist/esm/node/prerender/resolvePrerenderConfig.js +24 -22
  30. package/dist/esm/node/prerender/runPrerender.d.ts +7 -25
  31. package/dist/esm/node/prerender/runPrerender.js +25 -29
  32. package/dist/esm/node/prerender/utils.d.ts +1 -0
  33. package/dist/esm/node/prerender/utils.js +1 -0
  34. package/dist/esm/node/runtime/globalContext.d.ts +2 -1
  35. package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +165 -5
  36. package/dist/esm/shared/page-configs/Config.d.ts +8 -0
  37. package/dist/esm/shared/page-configs/getConfigValueBuildTime.js +2 -2
  38. package/dist/esm/shared/page-configs/serialize/serializeConfigValues.js +1 -1
  39. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  40. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  41. package/dist/esm/utils/isFilePathAbsoluteFilesystem.js +8 -2
  42. package/dist/esm/utils/path.js +1 -0
  43. package/dist/esm/utils/projectInfo.d.ts +1 -1
  44. package/package.json +1 -1
@@ -120,15 +120,16 @@ async function runPrerender(options = {}, standaloneTrigger) {
120
120
  const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(viteConfig);
121
121
  const { outDirClient } = (0, getOutDirs_js_1.getOutDirs)(viteConfig);
122
122
  const { root } = viteConfig;
123
- const prerenderConfig = (0, resolvePrerenderConfig_js_1.resolvePrerenderConfig)(vikeConfig);
124
- validatePrerenderConfig(prerenderConfig);
125
- if (!prerenderConfig) {
123
+ const prerenderConfigGlobal = (0, resolvePrerenderConfig_js_1.resolvePrerenderConfigGlobal)(vikeConfig);
124
+ validatePrerenderConfig(prerenderConfigGlobal);
125
+ const { partial, noExtraDir, parallel, defaultLocalValue, isEnabled } = prerenderConfigGlobal;
126
+ if (!isEnabled) {
126
127
  (0, utils_js_1.assert)(standaloneTrigger);
127
- (0, utils_js_1.assertWarning)(prerenderConfig, `You're executing ${picocolors_1.default.cyan(standaloneTrigger)} but the config ${picocolors_1.default.cyan('prerender')} isn't set to true`, {
128
+ // TODO/now: make it assertUsage() and remove dist/server/entry.mjs whenever possible
129
+ (0, utils_js_1.assertWarning)(prerenderConfigGlobal, `You're executing ${picocolors_1.default.cyan(standaloneTrigger)} but you didn't enable pre-rendering. Use the config ${picocolors_1.default.cyan('prerender')} (${picocolors_1.default.underline('https://vike.dev/prerender')}) to enable it.`, {
128
130
  onlyOnce: true
129
131
  });
130
132
  }
131
- const { partial = false, noExtraDir = false, parallel = true } = prerenderConfig || {};
132
133
  const concurrencyLimit = (0, utils_js_1.pLimit)(parallel === false || parallel === 0 ? 1 : parallel === true || parallel === undefined ? (0, os_1.cpus)().length : parallel);
133
134
  await (0, globalContext_js_1.initGlobalContext_runPrerender)();
134
135
  const globalContext = await (0, globalContext_js_1.getGlobalContextInternal)();
@@ -141,7 +142,7 @@ async function runPrerender(options = {}, standaloneTrigger) {
141
142
  output: []
142
143
  };
143
144
  const doNotPrerenderList = [];
144
- await collectDoNoPrerenderList(vikeConfig.pageConfigs, doNotPrerenderList, concurrencyLimit, globalContext);
145
+ await collectDoNoPrerenderList(vikeConfig.pageConfigs, doNotPrerenderList, defaultLocalValue, concurrencyLimit, globalContext);
145
146
  await callOnBeforePrerenderStartHooks(prerenderContext, globalContext, concurrencyLimit, doNotPrerenderList);
146
147
  await handlePagesWithStaticRoutes(prerenderContext, globalContext, doNotPrerenderList, concurrencyLimit);
147
148
  await callOnPrerenderStartHook(prerenderContext, globalContext);
@@ -164,20 +165,21 @@ async function runPrerender(options = {}, standaloneTrigger) {
164
165
  const prerenderContextPublic = makePublic(prerenderContext);
165
166
  return { viteConfig, prerenderContextPublic };
166
167
  }
167
- async function collectDoNoPrerenderList(pageConfigs, doNotPrerenderList, concurrencyLimit, globalContext) {
168
+ async function collectDoNoPrerenderList(pageConfigs, doNotPrerenderList, defaultLocalValue, concurrencyLimit, globalContext) {
168
169
  // V1 design
169
170
  pageConfigs.forEach((pageConfig) => {
170
- const configValue = (0, resolvePrerenderConfig_js_1.resolvePrerenderConfigLocal)(pageConfig);
171
- if (!configValue)
172
- return;
173
- const { value, configValueFilePathToShowToUser } = configValue;
174
- if (value === false) {
175
- doNotPrerenderList.push({
176
- pageId: pageConfig.pageId,
177
- setByConfigName: 'prerender',
178
- setByConfigValue: false,
179
- setByConfigFile: configValueFilePathToShowToUser
180
- });
171
+ const prerenderConfigLocal = (0, resolvePrerenderConfig_js_1.resolvePrerenderConfigLocal)(pageConfig);
172
+ const { pageId } = pageConfig;
173
+ if (!prerenderConfigLocal) {
174
+ if (!defaultLocalValue) {
175
+ doNotPrerenderList.push({ pageId });
176
+ }
177
+ }
178
+ else {
179
+ const { value } = prerenderConfigLocal;
180
+ if (value === false) {
181
+ doNotPrerenderList.push({ pageId });
182
+ }
181
183
  }
182
184
  });
183
185
  // Old design
@@ -210,12 +212,7 @@ async function collectDoNoPrerenderList(pageConfigs, doNotPrerenderList, concurr
210
212
  }
211
213
  else {
212
214
  // Don't pre-render `pageId`
213
- doNotPrerenderList.push({
214
- pageId,
215
- setByConfigFile: p.filePath,
216
- setByConfigName: 'doNotPrerender',
217
- setByConfigValue: doNotPrerender
218
- });
215
+ doNotPrerenderList.push({ pageId });
219
216
  }
220
217
  }
221
218
  });
@@ -568,8 +565,7 @@ function warnContradictoryNoPrerenderList(prerenderedPageContexts, doNotPrerende
568
565
  if (!isContradictory)
569
566
  return;
570
567
  }
571
- const { setByConfigName, setByConfigValue, setByConfigFile } = doNotPrerenderListEntry;
572
- (0, utils_js_1.assertWarning)(false, `The ${providedByHook.hookName}() hook defined by ${providedByHook.hookFilePath} returns the URL ${picocolors_1.default.cyan(urlOriginal)}, while ${setByConfigFile} sets the config ${picocolors_1.default.cyan(setByConfigName)} to ${picocolors_1.default.cyan(String(setByConfigValue))}. This is contradictory: either don't set the config ${picocolors_1.default.cyan(setByConfigName)} to ${picocolors_1.default.cyan(String(setByConfigValue))} or remove the URL ${picocolors_1.default.cyan(urlOriginal)} from the list of URLs to be pre-rendered.`, { onlyOnce: true });
568
+ (0, utils_js_1.assertWarning)(false, `The ${providedByHook.hookName}() hook defined by ${providedByHook.hookFilePath} returns the URL ${picocolors_1.default.cyan(urlOriginal)} matching the route of the page ${picocolors_1.default.cyan(pageId)} which isn't configured to be pre-rendered. This is contradictory: either enable pre-rendering for ${picocolors_1.default.cyan(pageId)} or remove the URL ${picocolors_1.default.cyan(urlOriginal)} from the list of URLs to be pre-rendered.`, { onlyOnce: true });
573
569
  });
574
570
  }
575
571
  async function warnMissingPages(prerenderedPageContexts, globalContext, doNotPrerenderList, partial) {
@@ -816,8 +812,8 @@ prerenderConfig) {
816
812
  }
817
813
  function makePublic(prerenderContext) {
818
814
  const prerenderContextPublic = (0, utils_js_1.makePublicCopy)(prerenderContext, 'prerenderContext', [
819
- 'pageContexts',
820
- 'output'
815
+ 'output', // vite-plugin-vercel
816
+ 'pageContexts' // https://vike.dev/i18n#pre-rendering
821
817
  ]);
822
818
  return prerenderContextPublic;
823
819
  }
@@ -33,3 +33,4 @@ __exportStar(require("../../utils/isArray.js"), exports);
33
33
  __exportStar(require("../../utils/isObject.js"), exports);
34
34
  __exportStar(require("../../utils/changeEnumerable.js"), exports);
35
35
  __exportStar(require("../../utils/makePublicCopy.js"), exports);
36
+ __exportStar(require("../../utils/isNotNullish.js"), exports);
@@ -31,7 +31,7 @@ function getConfigValue(pageConfig, configName) {
31
31
  (0, utils_js_1.assert)(configValueSource);
32
32
  (0, utils_js_1.assert)(configValueSource.isOverriden === false);
33
33
  (0, utils_js_1.assert)(sources.slice(1).every((s) => s.isOverriden === true));
34
- (0, utils_js_1.assert)('value' in configValueSource);
34
+ (0, utils_js_1.assert)(configValueSource.valueIsLoaded);
35
35
  return {
36
36
  type: 'standard',
37
37
  value: configValueSource.value,
@@ -54,7 +54,7 @@ function mergeCumulative(configValueSources) {
54
54
  configValueSources.forEach((configValueSource) => {
55
55
  (0, utils_js_1.assert)(configValueSource.isOverriden === false);
56
56
  (0, utils_js_1.assert)(configValueSource.configEnv.config === true);
57
- (0, utils_js_1.assert)('value' in configValueSource);
57
+ (0, utils_js_1.assert)(configValueSource.valueIsLoaded);
58
58
  value.push(configValueSource.value);
59
59
  definedAtData.push(getDefinedAtFile(configValueSource));
60
60
  });
@@ -51,7 +51,7 @@ function serializeConfigValues(pageConfig, importStatements, filesEnv, isEnvMatc
51
51
  function getValueSerializedFromSource(configValueSource, configName, importStatements, filesEnv) {
52
52
  (0, utils_js_1.assert)(configValueSource.isOverriden === false);
53
53
  let valueData;
54
- if ('value' in configValueSource && !configValueSource.valueIsLoadedWithImport) {
54
+ if (configValueSource.valueIsLoaded && !configValueSource.valueIsLoadedWithImport) {
55
55
  valueData = getValueSerializedWithJson(configValueSource.value, configName, configValueSource.definedAtFilePath, importStatements, filesEnv, configValueSource.configEnv);
56
56
  }
57
57
  else {
@@ -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.223-commit-e239e2b';
5
+ exports.PROJECT_VERSION = '0.4.223-commit-3502685';
@@ -5,9 +5,14 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.assertFilePathAbsoluteFilesystem = assertFilePathAbsoluteFilesystem;
7
7
  exports.isFilePathAbsolute = isFilePathAbsolute;
8
- const path_1 = __importDefault(require("path"));
8
+ const node_path_1 = __importDefault(require("node:path"));
9
9
  const assert_js_1 = require("./assert.js");
10
10
  const path_js_1 = require("./path.js");
11
+ const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
12
+ const assertSetup_js_1 = require("./assertSetup.js");
13
+ (0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
14
+ // Server runtime shouldn't depend on node:path
15
+ (0, assertSetup_js_1.assertIsNotProductionRuntime)();
11
16
  /**
12
17
  * Asserts that `filePath` is an absolute file path starting from the filesystem root.
13
18
  *
@@ -18,6 +23,7 @@ function assertFilePathAbsoluteFilesystem(filePath) {
18
23
  // - For Windows users, the assert is correct.
19
24
  // - For Linux users assertFilePathAbsoluteFilesystem() will erroneously succeed if `p` is a path absolute from the user root dir.
20
25
  // - But that's okay because the assertion will eventually fail for Windows users.
26
+ // - On Linux there doesn't seem to be a way to distinguish between an absolute path starting from the filesystem root or starting from the user root directory, see comment at isFilePathAbsoluteFilesystem()
21
27
  (0, assert_js_1.assert)(isFilePathAbsoluteFilesystem(filePath));
22
28
  (0, path_js_1.assertPosixPath)(filePath);
23
29
  }
@@ -33,11 +39,11 @@ function isFilePathAbsoluteFilesystem(filePath) {
33
39
  // - File path absolute starting from filesystem root, e.g. /home/rom/code/my-app/pages/about/+Page.js
34
40
  // - File path absolute starting from user root dir (Vite's `config.root`), e.g. /pages/about/+Page.js
35
41
  // - Checking whether `p` starts with the first directory of process.cwd() (or `userRootDir`) can be erroneous, most notably when using docker: https://github.com/vikejs/vike/issues/703
36
- // - Using require.resolve() would be a solution but probably too slow?
42
+ // - Using require.resolve() or node:fs to check wehther the file/dir exsits would be a solution, but maybe too slow?
37
43
  return filePath.startsWith('/');
38
44
  }
39
45
  else {
40
- const yes = path_1.default.win32.isAbsolute(filePath);
46
+ const yes = node_path_1.default.win32.isAbsolute(filePath);
41
47
  // Ensure isFilePathAbsoluteFilesystem() returns `false` if path is absolute starting from the user root dir (see comments above).
42
48
  if (yes)
43
49
  (0, assert_js_1.assert)(!filePath.startsWith('/'));
@@ -55,5 +61,5 @@ function isFilePathAbsolute(filePath) {
55
61
  if (filePath.startsWith('/'))
56
62
  return true;
57
63
  // Seems to be reliable: https://nodejs.org/api/path.html#pathisabsolutepath
58
- return path_1.default.isAbsolute(filePath);
64
+ return node_path_1.default.isAbsolute(filePath);
59
65
  }
@@ -9,6 +9,7 @@ exports.assertPosixPath = assertPosixPath;
9
9
  // - Robust shim reference: https://github.com/unjs/pathe
10
10
  const assert_js_1 = require("./assert.js");
11
11
  const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
12
+ // While this path shim also works on the client-side, let's try to not use it on the client-side in order to minimize KBs sent to the browser.
12
13
  (0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
13
14
  /**********************/
14
15
  /****** SHIMS *********/
@@ -12,7 +12,8 @@ import { isViteCliCall } from '../shared/isViteCliCall.js';
12
12
  import { isVikeCliOrApi } from '../../api/context.js';
13
13
  import { getVikeConfig2 } from './importUserCode/v1-design/getVikeConfig.js';
14
14
  import { assertViteRoot, getViteRoot, normalizeViteRoot } from '../../api/prepareViteApiCall.js';
15
- import { isPrerenderEnabled, temp_disablePrerenderAutoRun } from '../../prerender/context.js';
15
+ import { temp_disablePrerenderAutoRun } from '../../prerender/context.js';
16
+ import { resolvePrerenderConfigGlobal } from '../../prerender/resolvePrerenderConfig.js';
16
17
  const pluginName = 'vike:commonConfig';
17
18
  function commonConfig(vikeVitePluginOptions) {
18
19
  return [
@@ -38,7 +39,7 @@ function commonConfig(vikeVitePluginOptions) {
38
39
  },
39
40
  // TODO/v1-release: remove https://github.com/vikejs/vike/issues/2122
40
41
  configVikePromise: Promise.resolve({
41
- prerender: isPrerenderEnabled(vikeConfig)
42
+ prerender: resolvePrerenderConfigGlobal(vikeConfig).isEnabled
42
43
  })
43
44
  };
44
45
  }
@@ -55,10 +55,13 @@ function fileEnv() {
55
55
  Array.from(this.getModuleIds())
56
56
  .filter((id) => !skip(id))
57
57
  .forEach((moduleId) => {
58
- const { importers, dynamicImporters } = this.getModuleInfo(moduleId);
58
+ const mod = this.getModuleInfo(moduleId);
59
+ const { importers } = mod;
59
60
  if (importers.length === 0) {
60
61
  // Dynamic imports can only be verified at runtime
61
- assert(dynamicImporters.length > 0);
62
+ /* This assertion can fail: https://github.com/vikejs/vike/issues/2227
63
+ assert(dynamicImporters.length > 0)
64
+ */
62
65
  return;
63
66
  }
64
67
  assertFileEnv(moduleId, !!config.build.ssr, importers, false);
@@ -1,13 +1,14 @@
1
1
  export { crawlPlusFiles };
2
2
  export { isPlusFile };
3
3
  export { getPlusFileValueConfigName };
4
- import { assertPosixPath, assert, scriptFileExtensions, assertIsSingleModuleInstance, assertIsNotProductionRuntime, isVersionOrAbove, isScriptFile, scriptFileExtensionList, createDebugger, deepEqual, assertUsage } from '../../../../utils.js';
4
+ import { assertPosixPath, assert, scriptFileExtensions, assertIsSingleModuleInstance, assertIsNotProductionRuntime, isVersionOrAbove, isScriptFile, scriptFileExtensionList, createDebugger, deepEqual, assertUsage, assertFilePathAbsoluteFilesystem, assertWarning, hasProp } from '../../../../utils.js';
5
5
  import path from 'path';
6
6
  import { glob } from 'tinyglobby';
7
7
  import { exec } from 'child_process';
8
8
  import { promisify } from 'util';
9
9
  import { isTemporaryBuildFile } from './transpileAndExecuteFile.js';
10
10
  import { getEnvVarObject } from '../../../../shared/getEnvVarObject.js';
11
+ import pc from '@brillout/picocolors';
11
12
  const execA = promisify(exec);
12
13
  const debug = createDebugger('vike:crawl');
13
14
  assertIsNotProductionRuntime();
@@ -15,6 +16,7 @@ assertIsSingleModuleInstance('getVikeConfig/crawlPlusFiles.ts');
15
16
  let gitIsNotUsable = false;
16
17
  async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem) {
17
18
  assertPosixPath(userRootDir);
19
+ assertFilePathAbsoluteFilesystem(userRootDir);
18
20
  //*/
19
21
  const outDirRelativeFromUserRootDir = null;
20
22
  /*/
@@ -32,8 +34,9 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem) {
32
34
  (!outDirRelativeFromUserRootDir.startsWith('./') &&
33
35
  //
34
36
  !outDirRelativeFromUserRootDir.startsWith('../')));
37
+ const crawSettings = getCrawlSettings();
35
38
  // Crawl
36
- const filesGit = !isGitCrawlDisabled() && (await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir));
39
+ const filesGit = crawSettings.git !== false && (await gitLsFiles(userRootDir, outDirRelativeFromUserRootDir));
37
40
  const filesGitNothingFound = !filesGit || filesGit.length === 0;
38
41
  const filesGlob = (filesGitNothingFound || debug.isActivated) && (await tinyglobby(userRootDir, outDirRelativeFromUserRootDir));
39
42
  let files = !filesGitNothingFound
@@ -41,8 +44,11 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem) {
41
44
  : // Fallback to tinyglobby for users that dynamically generate plus files. (Assuming that no plus file is found because of the user's .gitignore list.)
42
45
  filesGlob;
43
46
  assert(files);
44
- if (debug.isActivated)
45
- assert(deepEqual(filesGlob, filesGit), "Git and glob results aren't matching.");
47
+ if (debug.isActivated) {
48
+ assert(filesGit);
49
+ assert(filesGlob);
50
+ assertWarning(deepEqual(filesGlob.slice().sort(), filesGit.slice().sort()), "Git and glob results aren't matching.", { onlyOnce: false });
51
+ }
46
52
  // Filter build files
47
53
  files = files.filter((filePath) => !isTemporaryBuildFile(filePath));
48
54
  // Normalize
@@ -129,8 +135,7 @@ async function tinyglobby(userRootDir, outDirRelativeFromUserRootDir) {
129
135
  const options = {
130
136
  ignore: getIgnoreAsPatterns(outDirRelativeFromUserRootDir),
131
137
  cwd: userRootDir,
132
- dot: false,
133
- expandDirectories: false
138
+ dot: false
134
139
  };
135
140
  const files = await glob(pattern, options);
136
141
  // Make build deterministic, in order to get a stable generated hash for dist/client/assets/entries/entry-client-routing.${hash}.js
@@ -153,7 +158,9 @@ function getIgnoreAsPatterns(outDirRelativeFromUserRootDir) {
153
158
  // +Page.js
154
159
  // +Page.telefunc.js
155
160
  // ```
156
- '**/*.telefunc.*'
161
+ '**/*.telefunc.*',
162
+ // https://github.com/vikejs/vike/discussions/2222
163
+ '**/*.generated.*'
157
164
  ];
158
165
  if (outDirRelativeFromUserRootDir) {
159
166
  assert(!outDirRelativeFromUserRootDir.startsWith('/'));
@@ -167,6 +174,7 @@ function getIgnoreAsFilterFn(outDirRelativeFromUserRootDir) {
167
174
  return (file) => !file.includes('node_modules/') &&
168
175
  !file.includes('ejected/') &&
169
176
  !file.includes('.telefunc.') &&
177
+ !file.includes('.generated.') &&
170
178
  (outDirRelativeFromUserRootDir === null || !file.startsWith(`${outDirRelativeFromUserRootDir}/`));
171
179
  }
172
180
  // Whether Git is installed and whether we can use it
@@ -223,9 +231,11 @@ async function runCmd2(cmd, cwd) {
223
231
  stderr = stderr.toString().trim();
224
232
  return { stdout, stderr };
225
233
  }
226
- function isGitCrawlDisabled() {
227
- const crawSettings = getEnvVarObject('VIKE_CRAWL');
228
- return crawSettings?.git === false;
234
+ function getCrawlSettings() {
235
+ const crawlSettings = getEnvVarObject('VIKE_CRAWL') ?? {};
236
+ const wrongUsage = (settingName, settingType) => `Setting ${pc.cyan(settingName)} in VIKE_CRAWL should be a ${pc.cyan(settingType)}`;
237
+ assertUsage(hasProp(crawlSettings, 'git', 'boolean') || hasProp(crawlSettings, 'git', 'undefined'), wrongUsage('git', 'boolean'));
238
+ return crawlSettings;
229
239
  }
230
240
  function isPlusFile(filePath) {
231
241
  assertPosixPath(filePath);
@@ -40,6 +40,7 @@ function getLogicalPath(locationId, ignoredDirs, removeParenthesesDirs) {
40
40
  assertIsPath(logicalPath);
41
41
  return logicalPath;
42
42
  }
43
+ // See getPlusFilesRelevant() and getPlusFilesOrdered()
43
44
  function sortAfterInheritanceOrder(locationId1, locationId2, locationIdPage) {
44
45
  assertLocationId(locationId1);
45
46
  assertLocationId(locationId2);
@@ -48,7 +49,7 @@ function sortAfterInheritanceOrder(locationId1, locationId2, locationIdPage) {
48
49
  const inheritanceRoot1 = getInheritanceRoot(locationId1);
49
50
  const inheritanceRoot2 = getInheritanceRoot(locationId2);
50
51
  const inheritanceRootPage = getInheritanceRoot(locationIdPage);
51
- // sortAfterInheritanceOrder() only works if both locationId1 and locationId2 are inherited by the same page
52
+ // Only works if both locationId1 and locationId2 are inherited by the same page
52
53
  assert(isInherited(locationId1, locationIdPage));
53
54
  assert(isInherited(locationId2, locationIdPage));
54
55
  // Equivalent assertion (see isInherited() implementation)
@@ -3,7 +3,6 @@ export { getConfigBuildErrorFormatted };
3
3
  export { getConfigExecutionErrorIntroMsg };
4
4
  export { isTemporaryBuildFile };
5
5
  export type { EsbuildCache };
6
- import 'source-map-support/register.js';
7
6
  import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js';
8
7
  type FileExports = {
9
8
  fileExports: Record<string, unknown>;
@@ -7,16 +7,17 @@ import fs from 'fs';
7
7
  import path from 'path';
8
8
  import pc from '@brillout/picocolors';
9
9
  import { import_ } from '@brillout/import';
10
- import { assertPosixPath, getRandomId, assertIsNotProductionRuntime, assert, assertWarning, isObject, toPosixPath, assertUsage, isPlainJavaScriptFile, createDebugger, assertFilePathAbsoluteFilesystem, assertIsNpmPackageImport, genPromise } from '../../../../utils.js';
10
+ import { assertPosixPath, getRandomId, assertIsNotProductionRuntime, assert, assertWarning, isObject, toPosixPath, assertUsage, isPlainJavaScriptFile, createDebugger, assertFilePathAbsoluteFilesystem, assertIsNpmPackageImport, genPromise, isVitest } from '../../../../utils.js';
11
11
  import { transformPointerImports } from './transformPointerImports.js';
12
12
  import { vikeConfigDependencies } from '../getVikeConfig.js';
13
- import 'source-map-support/register.js';
13
+ import sourceMapSupport from 'source-map-support';
14
14
  import { getFilePathAbsoluteUserRootDir } from '../../../../shared/getFilePath.js';
15
15
  import { createRequire } from 'module';
16
16
  // @ts-ignore import.meta.url is shimmed at dist/cjs by dist-cjs-fixup.js.
17
17
  const importMetaUrl = import.meta.url;
18
18
  const require_ = createRequire(importMetaUrl);
19
19
  assertIsNotProductionRuntime();
20
+ installSourceMapSupport();
20
21
  const debug = createDebugger('vike:pointer-imports');
21
22
  const debugEsbuildResolve = createDebugger('vike:esbuild-resolve');
22
23
  if (debugEsbuildResolve.isActivated)
@@ -401,3 +402,11 @@ function cleanEsbuildErrors(errors) {
401
402
  // ```
402
403
  !note.text.includes('as external to exclude it from the bundle'))));
403
404
  }
405
+ function installSourceMapSupport() {
406
+ // Don't break Vitest's source mapping
407
+ if (isVitest())
408
+ return;
409
+ // How about other test runners?
410
+ // Should we call installSourceMapSupport() lazily in transpileAndExecuteFile() instead?
411
+ sourceMapSupport.install();
412
+ }