vike 0.4.166 → 0.4.167-commit-c08a6bb

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 (105) hide show
  1. package/dist/cjs/node/plugin/plugins/buildConfig.js +11 -6
  2. package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +2 -1
  3. package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +17 -22
  4. package/dist/cjs/node/plugin/plugins/envVars.js +3 -2
  5. package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +11 -13
  6. package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +2 -4
  7. package/dist/cjs/node/plugin/plugins/fileEnv.js +6 -3
  8. package/dist/cjs/node/plugin/plugins/importUserCode/index.js +6 -2
  9. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.js +3 -3
  10. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +2 -0
  11. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +5 -1
  12. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +21 -17
  13. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +34 -23
  14. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +33 -10
  15. package/dist/cjs/node/plugin/shared/getFilePath.js +83 -29
  16. package/dist/cjs/node/plugin/shared/isErrorDebug.js +1 -1
  17. package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +3 -8
  18. package/dist/cjs/node/plugin/shared/loggerNotProd.js +2 -1
  19. package/dist/cjs/node/plugin/utils.js +1 -1
  20. package/dist/cjs/node/prerender/runPrerender.js +6 -7
  21. package/dist/cjs/node/prerender/utils.js +2 -1
  22. package/dist/cjs/node/runtime/html/stream.js +5 -5
  23. package/dist/cjs/node/runtime/renderPage/analyzePage.js +1 -1
  24. package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +3 -3
  25. package/dist/cjs/node/runtime/renderPage/executeOnRenderHtmlHook.js +2 -1
  26. package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +5 -9
  27. package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +9 -8
  28. package/dist/cjs/node/runtime/renderPage/getPageAssets.js +6 -12
  29. package/dist/cjs/node/runtime/renderPage/logErrorHint.js +13 -1
  30. package/dist/cjs/node/runtime/utils.js +0 -1
  31. package/dist/cjs/shared/page-configs/assertPlusFileExport.js +1 -3
  32. package/dist/cjs/shared/route/abort.js +2 -1
  33. package/dist/cjs/shared/route/executeGuardHook.js +2 -1
  34. package/dist/cjs/shared/route/executeOnBeforeRouteHook.js +2 -1
  35. package/dist/cjs/shared/route/index.js +2 -3
  36. package/dist/cjs/shared/route/utils.js +0 -1
  37. package/dist/cjs/utils/assertIsNotProductionRuntime.js +5 -5
  38. package/dist/cjs/utils/assertPathIsFilesystemAbsolute.js +1 -0
  39. package/dist/cjs/utils/debug.js +48 -14
  40. package/dist/cjs/utils/isNpmPackage.js +11 -2
  41. package/dist/cjs/utils/projectInfo.js +1 -1
  42. package/dist/cjs/utils/trackLogs.js +1 -1
  43. package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +31 -24
  44. package/dist/esm/node/plugin/plugins/buildConfig.js +12 -7
  45. package/dist/esm/node/plugin/plugins/commonConfig/assertResolveAlias.js +2 -1
  46. package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +18 -23
  47. package/dist/esm/node/plugin/plugins/envVars.js +4 -3
  48. package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +12 -14
  49. package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +3 -5
  50. package/dist/esm/node/plugin/plugins/fileEnv.js +7 -4
  51. package/dist/esm/node/plugin/plugins/importUserCode/index.js +7 -3
  52. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/debug.d.ts +1 -1
  53. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.js +4 -4
  54. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +2 -0
  55. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +5 -1
  56. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +21 -17
  57. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +2 -2
  58. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +33 -22
  59. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +34 -11
  60. package/dist/esm/node/plugin/shared/getFilePath.d.ts +10 -9
  61. package/dist/esm/node/plugin/shared/getFilePath.js +83 -29
  62. package/dist/esm/node/plugin/shared/isErrorDebug.js +2 -2
  63. package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +4 -9
  64. package/dist/esm/node/plugin/shared/loggerNotProd.js +2 -1
  65. package/dist/esm/node/plugin/utils.d.ts +1 -1
  66. package/dist/esm/node/plugin/utils.js +1 -1
  67. package/dist/esm/node/prerender/runPrerender.js +2 -3
  68. package/dist/esm/node/prerender/utils.d.ts +2 -1
  69. package/dist/esm/node/prerender/utils.js +2 -1
  70. package/dist/esm/node/runtime/html/stream.js +5 -5
  71. package/dist/esm/node/runtime/renderPage/analyzePage.js +1 -1
  72. package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +1 -1
  73. package/dist/esm/node/runtime/renderPage/executeOnRenderHtmlHook.js +2 -1
  74. package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.js +6 -10
  75. package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +9 -8
  76. package/dist/esm/node/runtime/renderPage/getPageAssets.js +7 -13
  77. package/dist/esm/node/runtime/renderPage/logErrorHint.js +13 -1
  78. package/dist/esm/node/runtime/utils.d.ts +0 -1
  79. package/dist/esm/node/runtime/utils.js +0 -1
  80. package/dist/esm/shared/addUrlComputedProps.d.ts +2 -2
  81. package/dist/esm/shared/page-configs/FilePath.d.ts +41 -29
  82. package/dist/esm/shared/page-configs/assertPlusFileExport.js +1 -3
  83. package/dist/esm/shared/route/abort.js +2 -1
  84. package/dist/esm/shared/route/executeGuardHook.js +2 -1
  85. package/dist/esm/shared/route/executeOnBeforeRouteHook.js +2 -1
  86. package/dist/esm/shared/route/index.js +2 -3
  87. package/dist/esm/shared/route/utils.d.ts +0 -1
  88. package/dist/esm/shared/route/utils.js +0 -1
  89. package/dist/esm/utils/assertIsNotProductionRuntime.js +5 -5
  90. package/dist/esm/utils/assertPathIsFilesystemAbsolute.js +1 -0
  91. package/dist/esm/utils/debug.d.ts +5 -4
  92. package/dist/esm/utils/debug.js +45 -14
  93. package/dist/esm/utils/debugGlob.d.ts +1 -1
  94. package/dist/esm/utils/isNpmPackage.d.ts +5 -1
  95. package/dist/esm/utils/isNpmPackage.js +10 -1
  96. package/dist/esm/utils/projectInfo.d.ts +2 -2
  97. package/dist/esm/utils/projectInfo.js +1 -1
  98. package/dist/esm/utils/trackLogs.js +2 -2
  99. package/package.json +1 -1
  100. package/dist/cjs/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +0 -19
  101. package/dist/cjs/utils/getFilePathAbsolute.js +0 -70
  102. package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.d.ts +0 -2
  103. package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +0 -16
  104. package/dist/esm/utils/getFilePathAbsolute.d.ts +0 -5
  105. package/dist/esm/utils/getFilePathAbsolute.js +0 -64
@@ -18,6 +18,7 @@ const path_1 = __importDefault(require("path"));
18
18
  const fixServerAssets_js_1 = require("./buildConfig/fixServerAssets.js");
19
19
  const index_js_1 = require("./importBuild/index.js");
20
20
  const prependEntriesDir_js_1 = require("../../shared/prependEntriesDir.js");
21
+ const getFilePath_js_1 = require("../shared/getFilePath.js");
21
22
  // @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
22
23
  const importMetaUrl = `file://${__filename}`;
23
24
  const require_ = (0, module_1.createRequire)(importMetaUrl);
@@ -205,18 +206,22 @@ async function getPageFileEntries(config, includeAssetsImportedByServer) {
205
206
  return pageFileEntries;
206
207
  }
207
208
  function getEntryFromClientEntry(clientEntry, config, addExtractAssetsQuery) {
208
- if ((0, utils_js_1.isNpmPackageImport)(clientEntry)) {
209
+ if (!clientEntry.startsWith('/')) {
210
+ (0, utils_js_1.assertIsNpmPackageImport)(clientEntry);
209
211
  const entryTarget = clientEntry;
210
212
  const entryName = (0, prependEntriesDir_js_1.prependEntriesDir)(clientEntry);
211
213
  return { entryName, entryTarget };
212
214
  }
213
- const filePath = clientEntry;
214
- (0, utils_js_1.assertPosixPath)(filePath);
215
- (0, utils_js_1.assert)(filePath.startsWith('/'));
216
- let entryTarget = (0, utils_js_1.getFilePathAbsoluteFilesystem)(filePath, config);
215
+ const filePathAbsoluteUserRootDir = clientEntry;
216
+ (0, utils_js_1.assert)(filePathAbsoluteUserRootDir.startsWith('/'));
217
+ const filePath = (0, getFilePath_js_1.getFilePathResolved)({
218
+ filePathAbsoluteUserRootDir,
219
+ userRootDir: config.root
220
+ });
221
+ let entryTarget = filePath.filePathAbsoluteFilesystem;
217
222
  if (addExtractAssetsQuery)
218
223
  entryTarget = (0, extractAssetsQuery_js_1.extractAssetsAddQuery)(entryTarget);
219
- let entryName = filePath;
224
+ let entryName = filePathAbsoluteUserRootDir;
220
225
  if (addExtractAssetsQuery)
221
226
  entryName = (0, extractAssetsQuery_js_1.extractAssetsAddQuery)(entryName);
222
227
  entryName = (0, utils_js_1.removeFileExtention)(entryName);
@@ -18,8 +18,9 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
18
18
  // - Aliases react imports
19
19
  // - @vitejs/plugin-vue2
20
20
  // - https://github.com/vikejs/vike/issues/1329
21
- // TODO/v1-release: replace assertWarning() with assertUsage()
22
21
  function assertResolveAlias(config) {
22
+ // TODO: re-implement warning https://github.com/vikejs/vike/issues/1567
23
+ return;
23
24
  const aliases = getAliases(config);
24
25
  const errPrefix = config.configFile || 'Your Vite configuration';
25
26
  const errSuffix1 = 'see https://vike.dev/path-aliases#vite';
@@ -7,6 +7,8 @@ const getVikeConfig_js_1 = require("../importUserCode/v1-design/getVikeConfig.js
7
7
  const getConfigValueSourcesNotOverriden_js_1 = require("../../shared/getConfigValueSourcesNotOverriden.js");
8
8
  const buildConfig_js_1 = require("../buildConfig.js");
9
9
  const virtualFileImportUserCode_js_1 = require("../../../shared/virtual-files/virtualFileImportUserCode.js");
10
+ const getFilePath_js_1 = require("../../shared/getFilePath.js");
11
+ const debug = (0, utils_js_1.createDebugger)('vike:optimizeDeps');
10
12
  async function determineOptimizeDeps(config, isDev) {
11
13
  const { pageConfigs } = await (0, getVikeConfig_js_1.getVikeConfig)(config, isDev);
12
14
  const { entries, include } = await getPageDeps(config, pageConfigs, isDev);
@@ -23,7 +25,11 @@ async function determineOptimizeDeps(config, isDev) {
23
25
  */
24
26
  config.optimizeDeps.include = [...include, ...normalizeInclude(config.optimizeDeps.include)];
25
27
  config.optimizeDeps.entries = [...entries, ...normalizeEntries(config.optimizeDeps.entries)];
26
- // console.log('config.optimizeDeps', { entries: config.optimizeDeps.entries, include: config.optimizeDeps.include })
28
+ if (debug.isActivated)
29
+ debug('config.optimizeDeps', {
30
+ 'config.optimizeDeps.entries': config.optimizeDeps.entries,
31
+ 'config.optimizeDeps.include': config.optimizeDeps.include
32
+ });
27
33
  }
28
34
  exports.determineOptimizeDeps = determineOptimizeDeps;
29
35
  async function getPageDeps(config, pageConfigs, isDev) {
@@ -47,24 +53,10 @@ async function getPageDeps(config, pageConfigs, isDev) {
47
53
  else {
48
54
  // Adding definedAt.filePathAbsoluteFilesystem doesn't work for npm packages, I guess because of Vite's config.server.fs.allow
49
55
  const { importPathAbsolute } = definedAt;
50
- (0, utils_js_1.assert)(importPathAbsolute);
51
- // We need to differentiate between npm package imports and path aliases.
52
- // There are path aliases that cannot be distinguished from npm package names.
53
- // We recommend users to use the '#' prefix convention for path aliases, see https://vike.dev/path-aliases#vite and assertResolveAlias()
54
- if ((0, utils_js_1.isNpmPackageImport)(importPathAbsolute)) {
55
- // isNpmPackageImport() returns false for a path alias like #root/renderer/onRenderClient
56
- (0, utils_js_1.assert)(!importPathAbsolute.startsWith('#'));
57
- include.push(importPathAbsolute);
58
- }
59
- else {
60
- /* Path aliases, e.g.:
61
- * ```js
62
- * // /renderer/+config.js
63
- * import onRenderClient from '#root/renderer/onRenderClient'
64
- * ```
65
- */
66
- entries.push(importPathAbsolute);
67
- }
56
+ (0, utils_js_1.assert)(importPathAbsolute); // Help TS
57
+ // Shouldn't be a path alias, as path aliases would need to be added to config.optimizeDeps.entries instead of config.optimizeDeps.include
58
+ (0, utils_js_1.assertIsNpmPackageImport)(importPathAbsolute);
59
+ include.push(importPathAbsolute);
68
60
  }
69
61
  });
70
62
  });
@@ -72,9 +64,12 @@ async function getPageDeps(config, pageConfigs, isDev) {
72
64
  // V0.4 design
73
65
  {
74
66
  const pageFiles = await (0, findPageFiles_js_1.findPageFiles)(config, ['.page', '.page.client'], isDev);
75
- pageFiles.forEach((filePath) => {
76
- const entry = (0, utils_js_1.getFilePathAbsoluteFilesystem)(filePath, config);
77
- entries.push(entry);
67
+ const userRootDir = config.root;
68
+ pageFiles.forEach((filePathAbsoluteUserRootDir) => {
69
+ const entry = (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir });
70
+ const { filePathAbsoluteFilesystem } = entry;
71
+ (0, utils_js_1.assert)(filePathAbsoluteFilesystem);
72
+ entries.push(filePathAbsoluteFilesystem);
78
73
  });
79
74
  }
80
75
  entries = (0, utils_js_1.unique)(entries);
@@ -4,6 +4,7 @@ exports.applyEnvVar = exports.envVarsPlugin = void 0;
4
4
  const vite_1 = require("vite");
5
5
  const utils_js_1 = require("../utils.js");
6
6
  const rollupSourceMap_js_1 = require("../shared/rollupSourceMap.js");
7
+ const getFilePath_js_1 = require("../shared/getFilePath.js");
7
8
  function envVarsPlugin() {
8
9
  let envsAll;
9
10
  let config;
@@ -45,10 +46,10 @@ function envVarsPlugin() {
45
46
  if (isPrivate && isClientSide) {
46
47
  if (!code.includes(envStatement))
47
48
  return;
48
- const filePathToShowToUser = (0, utils_js_1.getFilePathAbsoluteUserRootDir)(id, config.root);
49
+ const modulePath = (0, getFilePath_js_1.getModuleFilePath)(id, config);
49
50
  const errMsgAddendum = isBuild ? '' : ' (Vike will prevent your app from building for production)';
50
51
  const keyPublic = `${publicPrefix}${envName}`;
51
- const errMsg = `${envStatement} is used in client-side file ${filePathToShowToUser} which means that the environment variable ${envName} will be included in client-side bundles and, therefore, ${envName} will be publicly exposed which can be a security leak${errMsgAddendum}. Use ${envStatement} only in server-side files, or rename ${envName} to ${keyPublic}, see https://vike.dev/env`;
52
+ const errMsg = `${envStatement} is used in client-side file ${modulePath} which means that the environment variable ${envName} will be included in client-side bundles and, therefore, ${envName} will be publicly exposed which can be a security leak${errMsgAddendum}. Use ${envStatement} only in server-side files, or rename ${envName} to ${keyPublic}, see https://vike.dev/env`;
52
53
  if (isBuild) {
53
54
  (0, utils_js_1.assertUsage)(false, errMsg);
54
55
  }
@@ -21,9 +21,7 @@ exports.extractAssetsRE = extractAssetsRE;
21
21
  const rawRE = /(\?|&)raw(?:&|$)/;
22
22
  const urlRE = /(\?|&)url(?:&|$)/;
23
23
  const EMPTY_MODULE_ID = 'virtual:vike:empty-module';
24
- const debugNamespace = 'vike:extractAssets';
25
- const debug = (0, utils_js_1.createDebugger)(debugNamespace);
26
- const debugEnabled = (0, utils_js_1.isDebugEnabled)(debugNamespace);
24
+ const debug = (0, utils_js_1.createDebugger)('vike:extractAssets');
27
25
  function extractAssetsPlugin() {
28
26
  let config;
29
27
  let configVike;
@@ -120,12 +118,6 @@ function extractAssetsPlugin() {
120
118
  {
121
119
  name: 'vike:extractAssets-3',
122
120
  apply: 'build',
123
- async configResolved(config_) {
124
- configVike = await (0, getConfigVike_js_1.getConfigVike)(config_);
125
- config = config_;
126
- vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config, false);
127
- isServerAssetsFixEnabled = (0, fixServerAssets_js_1.fixServerAssets_isEnabled)() && (await (0, getVikeConfig_js_1.isV1Design)(config, false));
128
- },
129
121
  load(id) {
130
122
  if (!(0, utils_js_1.isVirtualFileId)(id))
131
123
  return undefined;
@@ -135,16 +127,22 @@ function extractAssetsPlugin() {
135
127
  }
136
128
  },
137
129
  config() {
138
- if (debugEnabled) {
130
+ if (debug.isActivated) {
139
131
  return { logLevel: 'silent' };
140
132
  }
141
133
  }
142
134
  },
143
135
  {
144
136
  name: 'vike:extractAssets-4',
145
- configResolved(config) {
146
- // https://github.com/vikejs/vike/issues/1060
147
- (0, utils_js_1.assertUsage)(!config.plugins.find((p) => p.name === 'vite-tsconfig-paths'), 'vite-tsconfig-paths not supported, remove it and use vite.config.js#resolve.alias instead');
137
+ async configResolved(config_) {
138
+ configVike = await (0, getConfigVike_js_1.getConfigVike)(config_);
139
+ config = config_;
140
+ vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config, false);
141
+ isServerAssetsFixEnabled = (0, fixServerAssets_js_1.fixServerAssets_isEnabled)() && (await (0, getVikeConfig_js_1.isV1Design)(config, false));
142
+ if (!isServerAssetsFixEnabled) {
143
+ // https://github.com/vikejs/vike/issues/1060
144
+ (0, utils_js_1.assertUsage)(!config.plugins.find((p) => p.name === 'vite-tsconfig-paths'), 'vite-tsconfig-paths not supported, remove it and use vite.config.js#resolve.alias instead');
145
+ }
148
146
  }
149
147
  }
150
148
  ];
@@ -6,9 +6,7 @@ const parseEsModule_js_1 = require("../shared/parseEsModule.js");
6
6
  const rollupSourceMap_js_1 = require("../shared/rollupSourceMap.js");
7
7
  const extractExportNamesRE = /(\?|&)extractExportNames(?:&|$)/;
8
8
  exports.extractExportNamesRE = extractExportNamesRE;
9
- const debugNamespace = 'vike:extractExportNames';
10
- const debug = (0, utils_js_1.createDebugger)(debugNamespace);
11
- const debugEnabled = (0, utils_js_1.isDebugEnabled)(debugNamespace);
9
+ const debug = (0, utils_js_1.createDebugger)('vike:extractExportNames');
12
10
  const globalObject = (0, utils_js_1.getGlobalObject)('extractExportNamesPlugin.ts', {});
13
11
  function extractExportNamesPlugin() {
14
12
  let isDev = false;
@@ -27,7 +25,7 @@ function extractExportNamesPlugin() {
27
25
  isDev = true;
28
26
  },
29
27
  config() {
30
- if (debugEnabled) {
28
+ if (debug.isActivated) {
31
29
  return { logLevel: 'silent' };
32
30
  }
33
31
  }
@@ -8,6 +8,7 @@ const utils_js_1 = require("../utils.js");
8
8
  const extractAssetsPlugin_js_1 = require("./extractAssetsPlugin.js");
9
9
  const extractExportNamesPlugin_js_1 = require("./extractExportNamesPlugin.js");
10
10
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
11
+ const getFilePath_js_1 = require("../shared/getFilePath.js");
11
12
  function fileEnv() {
12
13
  let config;
13
14
  let isDev = false;
@@ -44,11 +45,13 @@ function fileEnv() {
44
45
  // resolved is null when import path is erroneous and doesn't actually point to a file
45
46
  if (!resolved)
46
47
  return;
47
- const modulePath = resolved.id.split('?')[0];
48
+ const moduleId = resolved.id;
49
+ const modulePath = moduleId.split('?')[0];
48
50
  // `.server.js` and `.client.js` should only apply to user files
49
51
  if (modulePath.includes('/node_modules/'))
50
52
  return;
51
53
  // TODO/v1-release: remove
54
+ // - I don't remember exactly, but I think I've added `TODO/v1-release: remove` because I vaguely remember that we can remove this after we remove the 0.4 design.
52
55
  if (modulePath.endsWith('.css'))
53
56
  return;
54
57
  const isServerSide = options?.ssr;
@@ -60,7 +63,7 @@ function fileEnv() {
60
63
  return;
61
64
  // Show error message
62
65
  let errMsg;
63
- let modulePathPretty = (0, utils_js_1.getFilePathAbsoluteUserRootDir)(modulePath, config.root);
66
+ let modulePathPretty = (0, getFilePath_js_1.getModuleFilePath)(moduleId, config);
64
67
  modulePathPretty = modulePathPretty.replaceAll(suffix, picocolors_1.default.bold(suffix));
65
68
  errMsg = `${(0, utils_js_1.capitalizeFirstLetter)(envExpect)}-only module ${modulePathPretty} (https://vike.dev/file-env) imported on the ${envActual}-side`;
66
69
  if (importer &&
@@ -68,7 +71,7 @@ function fileEnv() {
68
71
  !importer.includes('virtual:vike:') &&
69
72
  // I don't know why and who sets importer to '<stdin>' (I guess Vite?)
70
73
  importer !== '<stdin>') {
71
- const importerPath = (0, utils_js_1.getFilePathAbsoluteUserRootDir)(importer.split('?')[0], config.root);
74
+ const importerPath = (0, getFilePath_js_1.getModuleFilePath)(importer, config);
72
75
  errMsg += ` by ${importerPath}`;
73
76
  }
74
77
  if (isDev) {
@@ -14,6 +14,7 @@ const virtualFileImportUserCode_js_1 = require("../../../shared/virtual-files/vi
14
14
  const getVikeConfig_js_1 = require("./v1-design/getVikeConfig.js");
15
15
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
16
16
  const loggerNotProd_js_1 = require("../../shared/loggerNotProd.js");
17
+ const getFilePath_js_1 = require("../../shared/getFilePath.js");
17
18
  function importUserCode() {
18
19
  let config;
19
20
  let configVike;
@@ -124,8 +125,11 @@ function isVikeConfigModule(filePathAbsoluteFilesystem) {
124
125
  }
125
126
  function reloadConfig(filePath, config, op) {
126
127
  {
127
- const filePathToShowToUser = picocolors_1.default.dim((0, utils_js_1.getFilePathAbsoluteUserRootDir)(filePath, config.root, true));
128
- const msg = `${op} ${filePathToShowToUser}`;
128
+ const { filePathToShowToUserResolved } = (0, getFilePath_js_1.getFilePathResolved)({
129
+ filePathAbsoluteFilesystem: filePath,
130
+ userRootDir: config.root
131
+ });
132
+ const msg = `${op} ${picocolors_1.default.dim(filePathToShowToUserResolved)}`;
129
133
  (0, loggerNotProd_js_1.logConfigInfo)(msg, 'info');
130
134
  }
131
135
  (0, getVikeConfig_js_1.reloadVikeConfig)(config.root, (0, utils_js_1.getOutDirs)(config).outDirRoot);
@@ -9,9 +9,9 @@ const assertPlusFileExport_js_1 = require("../../../../../shared/page-configs/as
9
9
  const utils_js_1 = require("../../../utils.js");
10
10
  function getConfigFileExport(fileExports, filePathToShowToUser) {
11
11
  (0, assertPlusFileExport_js_1.assertPlusFileExport)(fileExports, filePathToShowToUser, 'config');
12
- const fileExport = fileExports.default || fileExports.config;
13
- (0, utils_js_1.assert)('default' in fileExports !== 'config' in fileExports);
14
- const exportName = picocolors_1.default.cyan('default' in fileExports ? 'export default' : 'export { config }');
12
+ const usesNamedExport = !!fileExports.config;
13
+ const fileExport = usesNamedExport ? fileExports.config : fileExports.default;
14
+ const exportName = picocolors_1.default.cyan(usesNamedExport ? 'export { config }' : 'export default');
15
15
  (0, utils_js_1.assertUsage)((0, utils_js_1.isObject)(fileExport), `The ${exportName} of ${filePathToShowToUser} should be an object (but it's ${picocolors_1.default.cyan(`typeof exportedValue === ${JSON.stringify(typeof fileExport)}`)} instead)`);
16
16
  return fileExport;
17
17
  }
@@ -10,6 +10,7 @@ const fast_glob_1 = __importDefault(require("fast-glob"));
10
10
  const child_process_1 = require("child_process");
11
11
  const util_1 = require("util");
12
12
  const picocolors_1 = __importDefault(require("@brillout/picocolors"));
13
+ const transpileAndExecuteFile_js_1 = require("./transpileAndExecuteFile.js");
13
14
  const execA = (0, util_1.promisify)(child_process_1.exec);
14
15
  (0, utils_js_1.assertIsNotProductionRuntime)();
15
16
  (0, utils_js_1.assertIsSingleModuleInstance)('crawlPlusFiles.ts');
@@ -34,6 +35,7 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
34
35
  else {
35
36
  files = await fastGlob(userRootDir, outDirRelativeFromUserRootDir);
36
37
  }
38
+ files = files.filter((file) => !(0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(file));
37
39
  {
38
40
  const timeAfter = new Date().getTime();
39
41
  const timeSpent = timeAfter - timeBefore;
@@ -82,7 +82,11 @@ async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir
82
82
  return { extendsConfigs, extendsFilePaths };
83
83
  }
84
84
  function warnUserLandExtension(importPath, configFilePath) {
85
- (0, utils_js_1.assertWarning)((0, utils_js_1.isNpmPackageImport)(importPath), `${configFilePath.filePathToShowToUser} uses ${picocolors_1.default.cyan('extends')} to inherit from ${picocolors_1.default.cyan(importPath)} which is a user-land file: this is experimental and may be remove at any time. Reach out to a maintainer if you need this.`, { onlyOnce: true });
85
+ // We preserve this feature because we may need it for eject
86
+ (0, utils_js_1.assertWarning)((0, utils_js_1.isNpmPackageImport)(importPath, {
87
+ // Vike config files don't support path aliases. (If they do one day, then Vike will/should be able to resolve path aliases.)
88
+ cannotBePathAlias: true
89
+ }) || importPath.includes('/node_modules/'), `${configFilePath.filePathToShowToUser} uses ${picocolors_1.default.cyan('extends')} to inherit from ${picocolors_1.default.cyan(importPath)} which is a user-land file: this is experimental and may be remove at any time. Reach out to a maintainer if you need this.`, { onlyOnce: true });
86
90
  }
87
91
  function getExtendsImportData(configFileExports, configFilePath) {
88
92
  const { filePathToShowToUser } = configFilePath;
@@ -20,6 +20,7 @@ function resolveImport(configValue, importerFilePath, userRootDir, configEnv, co
20
20
  const filePathAbsoluteFilesystem = resolveImportPath(importData, importerFilePath);
21
21
  assertFileEnv(filePathAbsoluteFilesystem ?? importPath, configEnv, configName);
22
22
  const fileExportPathToShowToUser = exportName === 'default' || exportName === configName ? [] : [exportName];
23
+ let filePath;
23
24
  if (importPath.startsWith('.')) {
24
25
  // We need to resolve relative paths into absolute paths. Because the import paths are included in virtual files:
25
26
  // ```
@@ -27,28 +28,30 @@ function resolveImport(configValue, importerFilePath, userRootDir, configEnv, co
27
28
  // ```
28
29
  assertImportPath(filePathAbsoluteFilesystem, importData, importerFilePath);
29
30
  const filePathAbsoluteUserRootDir = resolveImportPath_absoluteUserRootDir(filePathAbsoluteFilesystem, importData, importerFilePath, userRootDir);
30
- const filePath = (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir, importPathAbsolute: null });
31
- return {
32
- ...filePath,
33
- fileExportName: exportName,
34
- fileExportPathToShowToUser
35
- };
31
+ filePath = (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir });
36
32
  }
37
33
  else {
38
34
  // importPath can be:
39
35
  // - an npm package import
40
36
  // - a path alias
41
- const filePath = (0, getFilePath_js_1.getFilePathUnresolved)({
42
- filePathAbsoluteFilesystem,
43
- filePathAbsoluteUserRootDir: null,
44
- importPathAbsolute: importPath
45
- });
46
- return {
47
- ...filePath,
48
- fileExportName: exportName,
49
- fileExportPathToShowToUser
50
- };
37
+ if (filePathAbsoluteFilesystem) {
38
+ filePath = (0, getFilePath_js_1.getFilePathResolved)({
39
+ userRootDir,
40
+ filePathAbsoluteFilesystem,
41
+ importPathAbsolute: importPath
42
+ });
43
+ }
44
+ else {
45
+ filePath = (0, getFilePath_js_1.getFilePathUnresolved)({
46
+ importPathAbsolute: importPath
47
+ });
48
+ }
51
49
  }
50
+ return {
51
+ ...filePath,
52
+ fileExportName: exportName,
53
+ fileExportPathToShowToUser
54
+ };
52
55
  }
53
56
  exports.resolveImport = resolveImport;
54
57
  function resolveImportPath_absoluteUserRootDir(filePathAbsoluteFilesystem, importData, configFilePath, userRootDir) {
@@ -77,7 +80,8 @@ function resolveImportPath(importData, importerFilePath) {
77
80
  const importerFilePathAbsolute = importerFilePath.filePathAbsoluteFilesystem;
78
81
  (0, utils_js_1.assertPosixPath)(importerFilePathAbsolute);
79
82
  const cwd = path_1.default.posix.dirname(importerFilePathAbsolute);
80
- // We can't use import.meta.resolve() as of Junary 2023 (and probably for a lot longer): https://stackoverflow.com/questions/54977743/do-require-resolve-for-es-modules#comment137174954_62272600:~:text=But%20the%20argument%20parent%20(aka%20cwd)%20still%20requires%20a%20flag
83
+ // We can't use import.meta.resolve() as of Junary 2023 (and probably for a lot longer)
84
+ // https://stackoverflow.com/questions/54977743/do-require-resolve-for-es-modules#comment137174954_62272600:~:text=But%20the%20argument%20parent%20(aka%20cwd)%20still%20requires%20a%20flag
81
85
  // filePathAbsoluteFilesystem is expected to be null when importData.importPath is a Vite path alias
82
86
  const filePathAbsoluteFilesystem = (0, utils_js_1.requireResolve)(importData.importPath, cwd);
83
87
  return filePathAbsoluteFilesystem;
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.isTmpFile = exports.getConfigExecutionErrorIntroMsg = exports.getConfigBuildErrorFormatted = exports.transpileAndExecuteFile = void 0;
6
+ exports.isTemporaryBuildFile = exports.getConfigExecutionErrorIntroMsg = exports.getConfigBuildErrorFormatted = exports.transpileAndExecuteFile = void 0;
7
7
  const esbuild_1 = require("esbuild");
8
8
  const fs_1 = __importDefault(require("fs"));
9
9
  const path_1 = __importDefault(require("path"));
@@ -40,10 +40,10 @@ async function transpileFile(filePath, transformImports, userRootDir) {
40
40
  const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
41
41
  (0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
42
42
  getVikeConfig_js_1.vikeConfigDependencies.add(filePathAbsoluteFilesystem);
43
- if (debug.isEnabled)
43
+ if (debug.isActivated)
44
44
  debug('transpile', filePathToShowToUserResolved);
45
45
  let { code, pointerImports } = await transpileWithEsbuild(filePath, userRootDir, transformImports);
46
- if (debug.isEnabled)
46
+ if (debug.isActivated)
47
47
  debug(`code, post esbuild (${filePathToShowToUserResolved})`, code);
48
48
  let isImportTransformed = false;
49
49
  if (transformImports) {
@@ -51,12 +51,12 @@ async function transpileFile(filePath, transformImports, userRootDir) {
51
51
  if (codeMod) {
52
52
  code = codeMod;
53
53
  isImportTransformed = true;
54
- if (debug.isEnabled)
54
+ if (debug.isActivated)
55
55
  debug(`code, post transformImports() (${filePathToShowToUserResolved})`, code);
56
56
  }
57
57
  }
58
58
  if (!isImportTransformed) {
59
- if (debug.isEnabled)
59
+ if (debug.isActivated)
60
60
  debug(`code, no transformImports() (${filePathToShowToUserResolved})`);
61
61
  }
62
62
  return code;
@@ -73,7 +73,7 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
73
73
  outfile: path_1.default.posix.join(
74
74
  // Needed for correct inline source map
75
75
  entryFileDir,
76
- // `write: false` => no file is actually be emitted
76
+ // `write: false` => no file is actually emitted
77
77
  'NEVER_EMITTED.js'),
78
78
  logLevel: 'silent',
79
79
  format: 'esm',
@@ -93,9 +93,11 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
93
93
  else {
94
94
  const pointerImports_ = (pointerImports = {});
95
95
  options.plugins = [
96
- // Determine what import should be externalized (and then transformed to a pointer/fake import)
96
+ // Determine whether an import should be:
97
+ // - A pointer import
98
+ // - Externalized
97
99
  {
98
- name: 'vike:externalize-heuristic',
100
+ name: 'vike-esbuild-plugin',
99
101
  setup(build) {
100
102
  // https://github.com/evanw/esbuild/issues/3095#issuecomment-1546916366
101
103
  const useEsbuildResolver = 'useEsbuildResolver';
@@ -105,10 +107,19 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
105
107
  return;
106
108
  if (args.pluginData?.[useEsbuildResolver])
107
109
  return;
108
- const isImportAbsolute = !args.path.startsWith('.');
109
110
  const { path, ...opts } = args;
110
111
  opts.pluginData = { [useEsbuildResolver]: true };
111
112
  const resolved = await build.resolve(path, opts);
113
+ if (resolved.errors.length > 0) {
114
+ /* We could do the following to let Node.js throw the error, but we don't because the error shown by esbuild is prettier: the Node.js error refers to the transpiled [build-f7i251e0iwnw]+config.ts.mjs file which isn't that nice, whereas esbuild refers to the source +config.ts file.
115
+ pointerImports_[args.path] = false
116
+ return { external: true }
117
+ */
118
+ // Let esbuild throw the error. (It throws a nice & pretty error.)
119
+ return resolved;
120
+ }
121
+ (0, utils_js_1.assert)(resolved.path);
122
+ resolved.path = (0, utils_js_1.toPosixPath)(resolved.path);
112
123
  // vike-{react,vue,solid} follow the convention that their config export resolves to a file named +config.js
113
124
  // - This is temporary, see comment below.
114
125
  const isVikeExtensionConfigImport = resolved.path.endsWith('+config.js');
@@ -123,14 +134,15 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
123
134
  // - For example if esbuild cannot resolve a path alias while Vite can.
124
135
  // - When tsconfig.js#compilerOptions.paths is set, then esbuild is able to resolve the path alias.
125
136
  resolved.errors.length > 0;
126
- pointerImports_[args.path] = isPointerImport;
137
+ pointerImports_[resolved.path] = isPointerImport;
138
+ (0, utils_js_1.assertPosixPath)(resolved.path);
127
139
  const isExternal = isPointerImport ||
128
- // npm package imports that aren't pointer imports (e.g. Vite plugin import)
129
- isImportAbsolute;
130
- if (debug.isEnabled)
140
+ // Performance: npm package imports that aren't pointer imports can be externalized. For example, if Vike eventually adds support for setting Vite configs in the vike.config.js file, then the user may import a Vite plugin in his vike.config.js file. (We could as well let esbuild always transpile /node_modules/ code but it would be useless and would unnecessarily slow down transpilation.)
141
+ resolved.path.includes('/node_modules/');
142
+ if (debug.isActivated)
131
143
  debug('onResolved()', { args, resolved, isPointerImport, isExternal });
132
144
  if (isExternal) {
133
- return { external: true, path: args.path };
145
+ return { external: true, path: resolved.path };
134
146
  }
135
147
  else {
136
148
  return resolved;
@@ -188,7 +200,7 @@ async function executeTranspiledFile(filePath, code) {
188
200
  const { filePathAbsoluteFilesystem } = filePath;
189
201
  // Alternative to using a temporary file: https://github.com/vitejs/vite/pull/13269
190
202
  // - But seems to break source maps, so I don't think it's worth it
191
- const filePathTmp = getFilePathTmp(filePathAbsoluteFilesystem);
203
+ const filePathTmp = getTemporaryBuildFilePath(filePathAbsoluteFilesystem);
192
204
  fs_1.default.writeFileSync(filePathTmp, code);
193
205
  const clean = () => fs_1.default.unlinkSync(filePathTmp);
194
206
  let fileExports = {};
@@ -247,22 +259,21 @@ function getConfigExecutionErrorIntroMsg(err) {
247
259
  return errIntroMsg ?? null;
248
260
  }
249
261
  exports.getConfigExecutionErrorIntroMsg = getConfigExecutionErrorIntroMsg;
250
- const tmpPrefix = `[build-`;
251
- function getFilePathTmp(filePathAbsoluteFilesystem) {
262
+ function getTemporaryBuildFilePath(filePathAbsoluteFilesystem) {
252
263
  (0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
253
264
  const dirname = path_1.default.posix.dirname(filePathAbsoluteFilesystem);
254
265
  const filename = path_1.default.posix.basename(filePathAbsoluteFilesystem);
255
- // Syntax with semicolon `[build:${/*...*/}]` doesn't work on Windows: https://github.com/vikejs/vike/issues/800#issuecomment-1517329455
256
- const tag = `${tmpPrefix}${(0, utils_js_1.getRandomId)(12)}]`;
257
- const filePathTmp = path_1.default.posix.join(dirname, `${tag}${filename}.mjs`);
266
+ // Syntax with semicolon `build:${/*...*/}` doesn't work on Windows: https://github.com/vikejs/vike/issues/800#issuecomment-1517329455
267
+ const filePathTmp = path_1.default.posix.join(dirname, `${filename}.build-${(0, utils_js_1.getRandomId)(12)}.mjs`);
268
+ (0, utils_js_1.assert)(isTemporaryBuildFile(filePathTmp));
258
269
  return filePathTmp;
259
270
  }
260
- function isTmpFile(filePath) {
271
+ function isTemporaryBuildFile(filePath) {
261
272
  (0, utils_js_1.assertPosixPath)(filePath);
262
273
  const fileName = path_1.default.posix.basename(filePath);
263
- return fileName.startsWith(tmpPrefix);
274
+ return /\.build-[a-z0-9]{12}\.mjs$/.test(fileName);
264
275
  }
265
- exports.isTmpFile = isTmpFile;
276
+ exports.isTemporaryBuildFile = isTemporaryBuildFile;
266
277
  function isHeaderFile(filePath) {
267
278
  (0, utils_js_1.assertPosixPath)(filePath);
268
279
  const fileExtensions = getFileExtensions(filePath);
@@ -745,12 +745,12 @@ function getComputed(configValueSources, configDefinitions) {
745
745
  }
746
746
  async function findPlusFiles(userRootDir, outDirRoot, isDev) {
747
747
  const files = await (0, crawlPlusFiles_js_1.crawlPlusFiles)(userRootDir, outDirRoot, isDev);
748
- const plusFiles = files.map(({ filePathAbsoluteUserRootDir }) => (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir, importPathAbsolute: null }));
748
+ const plusFiles = files.map(({ filePathAbsoluteUserRootDir }) => (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir }));
749
749
  return plusFiles;
750
750
  }
751
751
  function getConfigName(filePath) {
752
752
  (0, utils_js_1.assertPosixPath)(filePath);
753
- if ((0, transpileAndExecuteFile_js_1.isTmpFile)(filePath))
753
+ if ((0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(filePath))
754
754
  return null;
755
755
  const fileName = path_1.default.posix.basename(filePath);
756
756
  // assertNoUnexpectedPlusSign(filePath, fileName)
@@ -781,7 +781,30 @@ function assertNoUnexpectedPlusSign(filePath: string, fileName: string) {
781
781
  }
782
782
  */
783
783
  function handleUnknownConfig(configName, configNames, filePathToShowToUser) {
784
- let errMsg = `${filePathToShowToUser} defines an unknown config ${picocolors_1.default.cyan(configName)}`;
784
+ {
785
+ const ui = ['vike-react', 'vike-vue', 'vike-solid'];
786
+ const knownVikeExntensionConfigs = {
787
+ description: ui,
788
+ favicon: ui,
789
+ Head: ui,
790
+ Layout: ui,
791
+ onCreateApp: ['vike-vue'],
792
+ title: ui,
793
+ ssr: ui,
794
+ stream: ui,
795
+ Wrapper: ui
796
+ };
797
+ if (configName in knownVikeExntensionConfigs) {
798
+ const requiredVikeExtension = knownVikeExntensionConfigs[configName];
799
+ (0, utils_js_1.assertUsage)(false, [
800
+ `${filePathToShowToUser} uses the config ${picocolors_1.default.cyan(configName)} (https://vike.dev/${configName})`,
801
+ `which requires the Vike extension ${requiredVikeExtension.map((e) => picocolors_1.default.bold(e)).join('/')}.`,
802
+ `Make sure to install the Vike extension,`,
803
+ `and make sure it applies to ${filePathToShowToUser} as explained at https://vike.dev/extends#inheritance.`
804
+ ].join(' '));
805
+ }
806
+ }
807
+ let errMsg = `${filePathToShowToUser} sets an unknown config ${picocolors_1.default.cyan(configName)}`;
785
808
  let configNameSimilar = null;
786
809
  if (configName === 'page') {
787
810
  configNameSimilar = 'Page';
@@ -789,17 +812,13 @@ function handleUnknownConfig(configName, configNames, filePathToShowToUser) {
789
812
  else {
790
813
  configNameSimilar = (0, utils_js_1.getMostSimilar)(configName, configNames);
791
814
  }
792
- if (configNameSimilar || configName === 'page') {
793
- (0, utils_js_1.assert)(configNameSimilar);
815
+ if (configNameSimilar) {
794
816
  (0, utils_js_1.assert)(configNameSimilar !== configName);
795
- errMsg += `, did you mean to define ${picocolors_1.default.cyan(configNameSimilar)} instead?`;
817
+ errMsg += `, did you mean to set ${picocolors_1.default.cyan(configNameSimilar)} instead?`;
796
818
  if (configName === 'page') {
797
819
  errMsg += ` (The name of the config ${picocolors_1.default.cyan('Page')} starts with a capital letter ${picocolors_1.default.cyan('P')} because it usually defines a UI component: a ubiquitous JavaScript convention is to start the name of UI components with a capital letter.)`;
798
820
  }
799
821
  }
800
- else {
801
- errMsg += `, you need to define the config ${picocolors_1.default.cyan(configName)} by using ${picocolors_1.default.cyan('config.meta')} https://vike.dev/meta`;
802
- }
803
822
  (0, utils_js_1.assertUsage)(false, errMsg);
804
823
  }
805
824
  function determineRouteFilesystem(locationId, configValueSources) {
@@ -1013,7 +1032,11 @@ function sortConfigValueSources(configValueSources, locationIdPage) {
1013
1032
  // Sort after whether the config value was defined by an npm package
1014
1033
  .sort((0, utils_js_1.makeFirst)(([, [source]]) => {
1015
1034
  const { importPathAbsolute } = source.definedAt;
1016
- return !!importPathAbsolute && (0, utils_js_1.isNpmPackageImport)(importPathAbsolute);
1035
+ return (!!importPathAbsolute &&
1036
+ (0, utils_js_1.isNpmPackageImport)(importPathAbsolute, {
1037
+ // Vike config files don't support path aliases. (If they do one day, then Vike will/should be able to resolve path aliases.)
1038
+ cannotBePathAlias: true
1039
+ }));
1017
1040
  }))
1018
1041
  // Sort after the filesystem inheritance of the config value
1019
1042
  .sort(([, [source1]], [, [source2]]) => (0, utils_js_1.reverse)((0, filesystemRouting_js_1.sortAfterInheritanceOrder)(source1.locationId, source2.locationId, locationIdPage))));