vike 0.4.160 → 0.4.161-commit-ba539a4

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 (137) hide show
  1. package/dist/cjs/node/cli/bin.js +5 -0
  2. package/dist/cjs/node/client/router.js +4 -2
  3. package/dist/cjs/node/plugin/plugins/autoFullBuild.js +2 -2
  4. package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +148 -0
  5. package/dist/cjs/node/plugin/plugins/buildConfig.js +61 -35
  6. package/dist/cjs/node/plugin/plugins/commonConfig.js +5 -13
  7. package/dist/cjs/node/plugin/plugins/config/stemUtils.js +1 -1
  8. package/dist/cjs/node/plugin/plugins/distFileNames.js +9 -1
  9. package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +7 -2
  10. package/dist/cjs/node/plugin/plugins/importBuild/index.js +4 -7
  11. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +1 -5
  12. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +28 -46
  13. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{loadFileConfigEnv.js → loadFileAtConfigTime.js} +5 -5
  14. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveFilePath.js +33 -0
  15. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +2 -2
  16. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{transformImports.js → transformFileImports.js} +7 -7
  17. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +21 -27
  18. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +155 -111
  19. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +2 -1
  20. package/dist/cjs/node/plugin/utils.js +3 -2
  21. package/dist/cjs/node/prerender/runPrerender.js +12 -5
  22. package/dist/cjs/node/runtime/globalContext.js +7 -4
  23. package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +2 -2
  24. package/dist/cjs/node/runtime/html/renderHtml.js +1 -1
  25. package/dist/cjs/node/runtime/html/stream.js +2 -2
  26. package/dist/cjs/node/runtime/renderPage/analyzePage.js +2 -2
  27. package/dist/cjs/node/runtime/renderPage/executeOnRenderHtmlHook.js +2 -2
  28. package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +39 -39
  29. package/dist/cjs/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +0 -5
  30. package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +8 -7
  31. package/dist/cjs/node/runtime/renderPage/getPageAssets.js +15 -19
  32. package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +1 -1
  33. package/dist/cjs/node/runtime/renderPage/{logHintForCjsEsmError.js → logErrorHint.js} +81 -43
  34. package/dist/cjs/node/runtime/renderPage/loggerProd.js +3 -3
  35. package/dist/cjs/node/runtime/utils.js +1 -1
  36. package/dist/cjs/node/shared/{getClientEntryFilePath.js → getClientEntry.js} +3 -3
  37. package/dist/cjs/node/shared/prependEntriesDir.js +13 -0
  38. package/dist/cjs/shared/page-configs/serialize/parseConfigValuesImported.js +53 -26
  39. package/dist/cjs/shared/route/executeGuardHook.js +3 -2
  40. package/dist/cjs/shared/utils.js +0 -1
  41. package/dist/cjs/utils/assertNodeVersion.js +2 -2
  42. package/dist/cjs/utils/{findUserPackageJsonPath.js → findFile.js} +11 -8
  43. package/dist/cjs/utils/isVersionOrAbove.js +29 -0
  44. package/dist/cjs/utils/nodeEnv.js +23 -1
  45. package/dist/cjs/utils/objectKeys.js +19 -3
  46. package/dist/cjs/utils/projectInfo.js +1 -1
  47. package/dist/cjs/utils/sorter.js +62 -1
  48. package/dist/esm/client/client-routing-runtime/index.d.ts +1 -1
  49. package/dist/esm/client/client-routing-runtime/index.js +1 -1
  50. package/dist/esm/node/cli/bin.js +3 -1
  51. package/dist/esm/node/client/router.d.ts +2 -0
  52. package/dist/esm/node/client/router.js +3 -1
  53. package/dist/esm/node/plugin/plugins/autoFullBuild.js +2 -2
  54. package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.d.ts +13 -0
  55. package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +142 -0
  56. package/dist/esm/node/plugin/plugins/buildConfig.d.ts +2 -0
  57. package/dist/esm/node/plugin/plugins/buildConfig.js +60 -34
  58. package/dist/esm/node/plugin/plugins/commonConfig.js +6 -14
  59. package/dist/esm/node/plugin/plugins/config/stemUtils.js +2 -2
  60. package/dist/esm/node/plugin/plugins/distFileNames.js +9 -1
  61. package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +8 -3
  62. package/dist/esm/node/plugin/plugins/importBuild/index.d.ts +6 -1
  63. package/dist/esm/node/plugin/plugins/importBuild/index.js +4 -7
  64. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +2 -0
  65. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.d.ts +0 -1
  66. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +1 -5
  67. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +39 -12
  68. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +29 -47
  69. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{loadFileConfigEnv.js → loadFileAtConfigTime.js} +4 -4
  70. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveFilePath.d.ts +5 -0
  71. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveFilePath.js +27 -0
  72. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.d.ts +1 -1
  73. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +1 -1
  74. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{transformImports.d.ts → transformFileImports.d.ts} +2 -2
  75. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{transformImports.js → transformFileImports.js} +6 -6
  76. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +1 -1
  77. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +20 -26
  78. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +4 -0
  79. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +153 -109
  80. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +2 -1
  81. package/dist/esm/node/plugin/utils.d.ts +3 -2
  82. package/dist/esm/node/plugin/utils.js +3 -2
  83. package/dist/esm/node/prerender/runPrerender.js +13 -6
  84. package/dist/esm/node/runtime/globalContext.js +8 -5
  85. package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.js +2 -2
  86. package/dist/esm/node/runtime/html/renderHtml.js +1 -1
  87. package/dist/esm/node/runtime/html/stream.js +2 -2
  88. package/dist/esm/node/runtime/renderPage/analyzePage.js +2 -2
  89. package/dist/esm/node/runtime/renderPage/executeOnRenderHtmlHook.js +2 -2
  90. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +6 -5
  91. package/dist/esm/node/runtime/renderPage/getHttpResponseBody.js +39 -39
  92. package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +0 -5
  93. package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.js +8 -7
  94. package/dist/esm/node/runtime/renderPage/getPageAssets.js +16 -20
  95. package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +1 -1
  96. package/dist/esm/node/runtime/renderPage/logErrorHint.d.ts +8 -0
  97. package/dist/esm/node/runtime/renderPage/{logHintForCjsEsmError.js → logErrorHint.js} +80 -42
  98. package/dist/esm/node/runtime/renderPage/loggerProd.js +3 -3
  99. package/dist/esm/node/runtime/utils.d.ts +1 -1
  100. package/dist/esm/node/runtime/utils.js +1 -1
  101. package/dist/esm/node/shared/ViteManifest.d.ts +1 -0
  102. package/dist/esm/node/shared/getClientEntry.d.ts +3 -0
  103. package/dist/esm/node/shared/{getClientEntryFilePath.js → getClientEntry.js} +2 -2
  104. package/dist/esm/node/shared/prependEntriesDir.d.ts +2 -0
  105. package/dist/esm/node/shared/prependEntriesDir.js +10 -0
  106. package/dist/esm/shared/page-configs/Config.d.ts +1 -1
  107. package/dist/esm/shared/page-configs/PageConfig.d.ts +2 -0
  108. package/dist/esm/shared/page-configs/serialize/parseConfigValuesImported.js +53 -26
  109. package/dist/esm/shared/route/executeGuardHook.js +3 -2
  110. package/dist/esm/shared/utils.d.ts +0 -1
  111. package/dist/esm/shared/utils.js +0 -1
  112. package/dist/esm/utils/assertNodeVersion.js +2 -2
  113. package/dist/esm/utils/findFile.d.ts +3 -0
  114. package/dist/esm/utils/findFile.js +21 -0
  115. package/dist/esm/utils/getOutDirs.d.ts +1 -0
  116. package/dist/esm/utils/isVersionOrAbove.d.ts +2 -0
  117. package/dist/esm/utils/isVersionOrAbove.js +26 -0
  118. package/dist/esm/utils/nodeEnv.d.ts +4 -0
  119. package/dist/esm/utils/nodeEnv.js +19 -0
  120. package/dist/esm/utils/objectKeys.d.ts +10 -1
  121. package/dist/esm/utils/objectKeys.js +20 -3
  122. package/dist/esm/utils/projectInfo.d.ts +2 -2
  123. package/dist/esm/utils/projectInfo.js +1 -1
  124. package/dist/esm/utils/sorter.d.ts +59 -0
  125. package/dist/esm/utils/sorter.js +61 -0
  126. package/package.json +2 -2
  127. package/dist/cjs/utils/objectEntries.js +0 -8
  128. package/dist/esm/node/runtime/renderPage/logHintForCjsEsmError.d.ts +0 -13
  129. package/dist/esm/node/shared/getClientEntryFilePath.d.ts +0 -3
  130. package/dist/esm/utils/findUserPackageJsonPath.d.ts +0 -2
  131. package/dist/esm/utils/findUserPackageJsonPath.js +0 -18
  132. package/dist/esm/utils/objectEntries.d.ts +0 -4
  133. package/dist/esm/utils/objectEntries.js +0 -5
  134. /package/dist/cjs/node/runtime/renderPage/{logHintForCjsEsmError → logErrorHint}/errors.js +0 -0
  135. /package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{loadFileConfigEnv.d.ts → loadFileAtConfigTime.d.ts} +0 -0
  136. /package/dist/esm/node/runtime/renderPage/{logHintForCjsEsmError → logErrorHint}/errors.d.ts +0 -0
  137. /package/dist/esm/node/runtime/renderPage/{logHintForCjsEsmError → logErrorHint}/errors.js +0 -0
@@ -1,23 +1,29 @@
1
1
  export { buildConfig };
2
2
  export { assertRollupInput };
3
3
  export { analyzeClientEntries };
4
- import { assert, resolveOutDir, viteIsSSR, getFilePathAbsolute, addOnBeforeLogHook, removeFileExtention, unique, assertPosixPath, assertUsage, injectRollupInputs, normalizeRollupInput } from '../utils.js';
5
- import { getVikeConfig } from './importUserCode/v1-design/getVikeConfig.js';
4
+ export { manifestTempFile };
5
+ import { assert, resolveOutDir, viteIsSSR, getFilePathAbsolute, addOnBeforeLogHook, removeFileExtention, unique, assertPosixPath, assertUsage, injectRollupInputs, normalizeRollupInput, assertNodeEnvIsNotDev, getOutDirs, isNpmPackageImport } from '../utils.js';
6
+ import { getVikeConfig, isV1Design } from './importUserCode/v1-design/getVikeConfig.js';
6
7
  import { getConfigValue } from '../../../shared/page-configs/helpers.js';
7
8
  import { findPageFiles } from '../shared/findPageFiles.js';
8
9
  import { getConfigVike } from '../../shared/getConfigVike.js';
9
10
  import { getVirtualFileIdPageConfigValuesAll } from '../../shared/virtual-files/virtualFilePageConfigValuesAll.js';
10
11
  import { extractAssetsAddQuery } from '../../shared/extractAssetsQuery.js';
11
12
  import { createRequire } from 'module';
12
- import { getClientEntryFilePath } from '../../shared/getClientEntryFilePath.js';
13
+ import { getClientEntry } from '../../shared/getClientEntry.js';
13
14
  import fs from 'fs/promises';
14
15
  import path from 'path';
16
+ import { fixServerAssets, fixServerAssets_isEnabled } from './buildConfig/fixServerAssets.js';
17
+ import { set_constant_ASSETS_MAP } from './importBuild/index.js';
18
+ import { prependEntriesDir } from '../../shared/prependEntriesDir.js';
15
19
  // @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
16
20
  const importMetaUrl = import.meta.url;
17
21
  const require_ = createRequire(importMetaUrl);
18
22
  const manifestTempFile = '_temp_manifest.json';
19
23
  function buildConfig() {
20
- let generateManifest;
24
+ let isServerAssetsFixEnabled;
25
+ let isSsrBuild;
26
+ let outDirs;
21
27
  return {
22
28
  name: 'vike:buildConfig',
23
29
  apply: 'build',
@@ -25,37 +31,56 @@ function buildConfig() {
25
31
  configResolved: {
26
32
  order: 'post',
27
33
  async handler(config) {
34
+ assertNodeEnv();
28
35
  assertRollupInput(config);
29
36
  const entries = await getEntries(config);
30
37
  assert(Object.keys(entries).length > 0);
31
38
  config.build.rollupOptions.input = injectRollupInputs(entries, config);
32
39
  addLogHook();
40
+ outDirs = getOutDirs(config);
41
+ {
42
+ isServerAssetsFixEnabled = fixServerAssets_isEnabled() && (await isV1Design(config, false));
43
+ if (isServerAssetsFixEnabled) {
44
+ // https://github.com/vikejs/vike/issues/1339
45
+ config.build.ssrEmitAssets = true;
46
+ // Required if `ssrEmitAssets: true`, see https://github.com/vitejs/vite/pull/11430#issuecomment-1454800934
47
+ config.build.cssMinify = 'esbuild';
48
+ }
49
+ }
33
50
  }
34
51
  },
35
52
  config(config) {
36
- generateManifest = !viteIsSSR(config);
53
+ assertNodeEnv();
54
+ isSsrBuild = viteIsSSR(config);
37
55
  return {
38
56
  build: {
39
57
  outDir: resolveOutDir(config),
40
- manifest: generateManifest ? manifestTempFile : false,
41
- copyPublicDir: !viteIsSSR(config)
58
+ manifest: manifestTempFile,
59
+ copyPublicDir: !isSsrBuild
42
60
  }
43
61
  };
44
62
  },
63
+ buildStart() {
64
+ assertNodeEnv();
65
+ },
45
66
  async writeBundle(options, bundle) {
46
- const manifestEntry = bundle[manifestTempFile];
47
- /* Fails with @vitejs/plugin-legacy because writeBundle() is called twice during the client build (once for normal client assets and a second time for legacy assets), see reproduction at https://github.com/vikejs/vike/issues/1154
48
- assert(generateManifest === !!manifestEntry)
49
- */
50
- if (manifestEntry) {
51
- const { dir } = options;
52
- assert(dir);
53
- const manifestFilePathOld = path.join(dir, manifestEntry.fileName);
67
+ if (isSsrBuild) {
54
68
  // Ideally we'd move dist/_temp_manifest.json to dist/server/client-assets.json instead of dist/assets.json
55
69
  // - But we can't because there is no guarentee whether dist/server/ is generated before or after dist/client/ (generating dist/server/ after dist/client/ erases dist/server/client-assets.json)
56
70
  // - We'll able to do so once we replace `$ vite build` with `$ vike build`
57
- const manifestFilePathNew = path.join(dir, '..', 'assets.json');
58
- await fs.rename(manifestFilePathOld, manifestFilePathNew);
71
+ const assetsJsonFilePath = path.posix.join(outDirs.outDirRoot, 'assets.json');
72
+ const clientManifestFilePath = path.posix.join(outDirs.outDirClient, manifestTempFile);
73
+ const serverManifestFilePath = path.posix.join(outDirs.outDirServer, manifestTempFile);
74
+ if (!isServerAssetsFixEnabled) {
75
+ await fs.copyFile(clientManifestFilePath, assetsJsonFilePath);
76
+ }
77
+ else {
78
+ const clientManifestMod = await fixServerAssets(outDirs);
79
+ await fs.writeFile(assetsJsonFilePath, JSON.stringify(clientManifestMod, null, 2), 'utf-8');
80
+ }
81
+ await fs.rm(clientManifestFilePath);
82
+ await fs.rm(serverManifestFilePath);
83
+ await set_constant_ASSETS_MAP(options, bundle);
59
84
  }
60
85
  }
61
86
  };
@@ -108,7 +133,7 @@ function analyzeClientEntries(pageConfigs, config) {
108
133
  let hasClientRouting = false;
109
134
  let hasServerRouting = false;
110
135
  let clientEntries = {};
111
- let clientFilePaths = [];
136
+ let clientEntryList = [];
112
137
  pageConfigs.forEach((pageConfig) => {
113
138
  const configValue = getConfigValue(pageConfig, 'clientRouting', 'boolean');
114
139
  if (configValue?.value) {
@@ -123,15 +148,15 @@ function analyzeClientEntries(pageConfigs, config) {
123
148
  clientEntries[entryName] = entryTarget;
124
149
  }
125
150
  {
126
- const clientFilePath = getClientEntryFilePath(pageConfig);
127
- if (clientFilePath) {
128
- clientFilePaths.push(clientFilePath);
151
+ const clientEntry = getClientEntry(pageConfig);
152
+ if (clientEntry) {
153
+ clientEntryList.push(clientEntry);
129
154
  }
130
155
  }
131
156
  });
132
- clientFilePaths = unique(clientFilePaths);
133
- clientFilePaths.forEach((pageFile) => {
134
- const { entryName, entryTarget } = getEntryFromFilePath(pageFile, config);
157
+ clientEntryList = unique(clientEntryList);
158
+ clientEntryList.forEach((clientEntry) => {
159
+ const { entryName, entryTarget } = getEntryFromClientEntry(clientEntry, config);
135
160
  clientEntries[entryName] = entryTarget;
136
161
  });
137
162
  return { hasClientRouting, hasServerRouting, clientEntries };
@@ -153,12 +178,18 @@ async function getPageFileEntries(config, includeAssetsImportedByServer) {
153
178
  assert(includeAssetsImportedByServer);
154
179
  addExtractAssetsQuery = true;
155
180
  }
156
- const { entryName, entryTarget } = getEntryFromFilePath(pageFile, config, addExtractAssetsQuery);
181
+ const { entryName, entryTarget } = getEntryFromClientEntry(pageFile, config, addExtractAssetsQuery);
157
182
  pageFileEntries[entryName] = entryTarget;
158
183
  });
159
184
  return pageFileEntries;
160
185
  }
161
- function getEntryFromFilePath(filePath, config, addExtractAssetsQuery) {
186
+ function getEntryFromClientEntry(clientEntry, config, addExtractAssetsQuery) {
187
+ if (isNpmPackageImport(clientEntry)) {
188
+ const entryTarget = clientEntry;
189
+ const entryName = prependEntriesDir(clientEntry);
190
+ return { entryName, entryTarget };
191
+ }
192
+ const filePath = clientEntry;
162
193
  assertPosixPath(filePath);
163
194
  assert(filePath.startsWith('/'));
164
195
  let entryTarget = getFilePathAbsolute(filePath, config);
@@ -178,14 +209,6 @@ function getEntryFromPageConfig(pageConfig, isForClientSide) {
178
209
  entryName = prependEntriesDir(entryName);
179
210
  return { entryName, entryTarget };
180
211
  }
181
- function prependEntriesDir(entryName) {
182
- if (entryName.startsWith('/')) {
183
- entryName = entryName.slice(1);
184
- }
185
- assert(!entryName.startsWith('/'));
186
- entryName = `entries/${entryName}`;
187
- return entryName;
188
- }
189
212
  function resolve(filePath) {
190
213
  assert(filePath.startsWith('dist/'));
191
214
  // [RELATIVE_PATH_FROM_DIST] Current directory: node_modules/vike/dist/esm/node/plugin/plugins/
@@ -224,3 +247,6 @@ function assertRollupInput(config) {
224
247
  const htmlInput = htmlInputs[0];
225
248
  assertUsage(htmlInput === undefined, `The entry ${htmlInput} of config build.rollupOptions.input is an HTML entry which is forbidden when using Vike, instead follow https://vike.dev/add`);
226
249
  }
250
+ function assertNodeEnv() {
251
+ assertNodeEnvIsNotDev('building');
252
+ }
@@ -1,5 +1,5 @@
1
1
  export { commonConfig };
2
- import { assert, assertWarning, findUserPackageJsonPath } from '../utils.js';
2
+ import { assert, assertWarning, findFile } from '../utils.js';
3
3
  import { assertRollupInput } from './buildConfig.js';
4
4
  import { installRequireShim_setUserRootDir } from '@brillout/require-shim';
5
5
  import pc from '@brillout/picocolors';
@@ -26,7 +26,7 @@ function commonConfig() {
26
26
  overrideViteDefaultPort(config);
27
27
  /* TODO: do this after implementing vike.config.js and new setting transformLinkedDependencies (or probably a better name like transpileLinkedDependencies/bundleLinkedDependencies or something else)
28
28
  overrideViteDefaultSsrExternal(config)
29
- */
29
+ //*/
30
30
  workaroundCI(config);
31
31
  assertRollupInput(config);
32
32
  assertResolveAlias(config);
@@ -46,21 +46,13 @@ function overrideViteDefaultPort(config) {
46
46
  (_b = config.preview).port ?? (_b.port = 3000);
47
47
  }
48
48
  /*
49
+ import { version } from 'vite'
49
50
  function overrideViteDefaultSsrExternal(config: ResolvedConfig) {
50
- if (!isViteVersionWithSsrExternalTrue()) return
51
+ if (!isVersionOrAbove(version, '5.0.12')) return
51
52
  // @ts-ignore Not released yet: https://github.com/vitejs/vite/pull/10939/files#diff-5a3d42620df2c6b17e25f440ffdb67683dee7ef57317674d19f41d5f30502310L5
52
53
  config.ssr.external ??= true
53
54
  }
54
- import { version } from 'vite'
55
- function isViteVersionWithSsrExternalTrue(): boolean {
56
- const versionParts = version.split('.').map((s) => parseInt(s, 10)) as [number, number, number]
57
- assert(versionParts.length === 3)
58
- if (versionParts[0] > 5) return true
59
- if (versionParts[1] > 0) return true
60
- if (versionParts[2] >= 12) return true
61
- return false
62
- }
63
- */
55
+ //*/
64
56
  // Workaround GitHub Action failing to access the server
65
57
  function workaroundCI(config) {
66
58
  var _a, _b;
@@ -70,7 +62,7 @@ function workaroundCI(config) {
70
62
  }
71
63
  }
72
64
  function assertEsm(userViteRoot) {
73
- const packageJsonPath = findUserPackageJsonPath(userViteRoot);
65
+ const packageJsonPath = findFile('package.json', userViteRoot);
74
66
  if (!packageJsonPath)
75
67
  return;
76
68
  const packageJson = require_(packageJsonPath);
@@ -1,7 +1,7 @@
1
1
  // Move to standalone package? E.g. https://www.npmjs.com/package/stem
2
2
  export { getStemPackages };
3
3
  import path from 'path';
4
- import { assert, assertUsage, assertWarning, toPosixPath, assertPosixPath, getDependencyRootDir, findUserPackageJsonPath } from '../../utils.js';
4
+ import { assert, assertUsage, assertWarning, toPosixPath, assertPosixPath, getDependencyRootDir, findFile } from '../../utils.js';
5
5
  import { import_ } from '@brillout/import';
6
6
  import { createRequire } from 'module';
7
7
  // @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
@@ -48,7 +48,7 @@ async function getStemPackages(userAppRootDir) {
48
48
  return stemPackages;
49
49
  }
50
50
  function findUserRootDir(userAppRootDir) {
51
- const userPkgJsonPath = findUserPackageJsonPath(userAppRootDir);
51
+ const userPkgJsonPath = findFile('package.json', userAppRootDir);
52
52
  assertUsage(userPkgJsonPath, `Couldn't find package.json in any parent directory starting from ${userAppRootDir}`);
53
53
  return toPosixPath(path.dirname(userPkgJsonPath));
54
54
  }
@@ -19,9 +19,17 @@ function distFileNames() {
19
19
  if (!('chunkFileNames' in rollupOutput)) {
20
20
  rollupOutput.chunkFileNames = (chunkInfo) => getChunkFileName(chunkInfo, config);
21
21
  }
22
- if (!('assertUsage' in rollupOutput)) {
22
+ if (!('assetFileNames' in rollupOutput)) {
23
23
  rollupOutput.assetFileNames = (chunkInfo) => getAssetFileName(chunkInfo, config);
24
24
  }
25
+ else {
26
+ // If a user needs this:
27
+ // - assertUsage() that the naming provided by the user ends with `.[hash][extname]`
28
+ // - It's needed for getHash() of fixServerAssets()
29
+ // - Asset URLs should always contain a hash: it's paramount for caching assets.
30
+ // - If rollupOutput.assetFileNames is a function then use a wrapper function to apply the assertUsage()
31
+ assertUsage(false, "Setting config.build.rollupOptions.output.assetFileNames is currently forbidden. (It's possible to support, thus contact a maintainer if you need this.)");
32
+ }
25
33
  });
26
34
  }
27
35
  };
@@ -1,6 +1,6 @@
1
- // Alternative: use `ssrEmitAssets: true`
2
- // - See https://github.com/vitejs/vite/pull/11430
3
- // This plugin makes client-side bundles include the CSS imports living in server-side-only code.
1
+ // Remove this workaround if the other workaround config.build.ssrEmitAssets turns out to be reliable.
2
+ // - Remove this file then revert this commit: https://github.com/vikejs/vike/commit/805a18974f13420a78fcc30fdd676696e405c3ca
3
+ // Workaround to make client-side bundles include the CSS imports living in server-side-only code.
4
4
  // - This is needed for HTML-only pages, and React Server Components.
5
5
  // - We recommend using the debug flag to get an idea of how this plugin works: `$ DEBUG=vike:extractAssets pnpm exec vite build`. Then have a look at `dist/client/manifest.json` and see how `.page.server.js` entries have zero JavaScript but only CSS.
6
6
  // - This appraoch supports import path aliases `vite.config.js#resolve.alias` https://vitejs.dev/config/#resolve-alias
@@ -13,6 +13,8 @@ import { isAsset } from '../shared/isAsset.js';
13
13
  import { getImportStatements } from '../shared/parseEsModule.js';
14
14
  import { removeSourceMap } from '../shared/removeSourceMap.js';
15
15
  import pc from '@brillout/picocolors';
16
+ import { fixServerAssets_isEnabled } from './buildConfig/fixServerAssets.js';
17
+ import { isV1Design } from './importUserCode/v1-design/getVikeConfig.js';
16
18
  const extractAssetsRE = /(\?|&)extractAssets(?:&|$)/;
17
19
  const rawRE = /(\?|&)raw(?:&|$)/;
18
20
  const urlRE = /(\?|&)url(?:&|$)/;
@@ -23,6 +25,7 @@ const debugEnabled = isDebugEnabled(debugNamespace);
23
25
  function extractAssetsPlugin() {
24
26
  let config;
25
27
  let configVike;
28
+ let isServerAssetsFixEnabled;
26
29
  return [
27
30
  // This plugin removes all JavaScript from server-side only code, so that only CSS imports remains. (And also satic files imports e.g. `import logoURL from './logo.svg.js'`).
28
31
  {
@@ -34,6 +37,7 @@ function extractAssetsPlugin() {
34
37
  if (!extractAssetsRE.test(id)) {
35
38
  return;
36
39
  }
40
+ assert(!isServerAssetsFixEnabled);
37
41
  assert(configVike.includeAssetsImportedByServer);
38
42
  assert(!viteIsSSR_options(options));
39
43
  const importStatements = await getImportStatements(src);
@@ -131,6 +135,7 @@ function extractAssetsPlugin() {
131
135
  async configResolved(config_) {
132
136
  configVike = await getConfigVike(config_);
133
137
  config = config_;
138
+ isServerAssetsFixEnabled = fixServerAssets_isEnabled() && (await isV1Design(config, false));
134
139
  },
135
140
  load(id) {
136
141
  if (!isVirtualFileId(id))
@@ -1,3 +1,8 @@
1
1
  export { importBuild };
2
- import type { Plugin } from 'vite';
2
+ export { set_constant_ASSETS_MAP };
3
+ import type { Plugin, Rollup } from 'vite';
4
+ type Bundle = Rollup.OutputBundle;
5
+ type Options = Rollup.NormalizedOutputOptions;
3
6
  declare function importBuild(): Plugin[];
7
+ /** Set the value of the ASSETS_MAP constant inside dist/server/entry.js (or dist/server/index.js) */
8
+ declare function set_constant_ASSETS_MAP(options: Options, bundle: Bundle): Promise<void>;
@@ -1,6 +1,7 @@
1
1
  export { importBuild };
2
+ export { set_constant_ASSETS_MAP };
2
3
  import { serverEntryPlugin, findServerEntry } from '@brillout/vite-plugin-server-entry/plugin.js';
3
- import { assert, getOutDirs, toPosixPath, viteIsSSR } from '../../utils.js';
4
+ import { assert, getOutDirs, toPosixPath } from '../../utils.js';
4
5
  import path from 'path';
5
6
  import { createRequire } from 'module';
6
7
  import { getConfigVike } from '../../../shared/getConfigVike.js';
@@ -21,11 +22,6 @@ function importBuild() {
21
22
  async configResolved(config_) {
22
23
  config = config_;
23
24
  configVike = await getConfigVike(config);
24
- },
25
- async writeBundle(options, bundle) {
26
- if (!viteIsSSR(config))
27
- return;
28
- await replace_ASSETS_MAP(options, bundle);
29
25
  }
30
26
  },
31
27
  ...serverEntryPlugin({
@@ -58,7 +54,8 @@ function getEntryCode(config, configVike) {
58
54
  ].join('\n');
59
55
  return importerCode;
60
56
  }
61
- async function replace_ASSETS_MAP(options, bundle) {
57
+ /** Set the value of the ASSETS_MAP constant inside dist/server/entry.js (or dist/server/index.js) */
58
+ async function set_constant_ASSETS_MAP(options, bundle) {
62
59
  const { dir } = options;
63
60
  assert(dir);
64
61
  // This will probably fail with @vitejs/plugin-legacy
@@ -1,6 +1,7 @@
1
1
  export { configDefinitionsBuiltIn };
2
2
  export { configDefinitionsBuiltInGlobal };
3
3
  export type { ConfigDefinition };
4
+ export type { ConfigDefinitions };
4
5
  export type { ConfigDefinitionInternal };
5
6
  export type { ConfigNameGlobal };
6
7
  export type { ConfigEffect };
@@ -54,6 +55,7 @@ type ConfigDefinitionInternal = Omit<ConfigDefinition, 'env'> & {
54
55
  _userEffectDefinedAt?: DefinedAtFileFullInfo;
55
56
  env: ConfigEnvInternal;
56
57
  };
58
+ type ConfigDefinitions = Record<string, ConfigDefinitionInternal>;
57
59
  type ConfigDefinitionsBuiltIn = Record<ConfigNameBuiltIn, ConfigDefinitionInternal>;
58
60
  declare const configDefinitionsBuiltIn: ConfigDefinitionsBuiltIn;
59
61
  type ConfigNameGlobal = 'onPrerenderStart' | 'onBeforeRoute' | 'prerender' | 'extensions' | 'disableAutoFullBuild' | 'includeAssetsImportedByServer' | 'baseAssets' | 'baseServer' | 'redirects' | 'trailingSlash' | 'disableUrlNormalization';
@@ -1,5 +1,4 @@
1
1
  export { crawlPlusFiles };
2
2
  declare function crawlPlusFiles(userRootDir: string, outDirAbsoluteFilesystem: string, isDev: boolean): Promise<{
3
3
  filePathRelativeToUserRootDir: string;
4
- filePathAbsoluteFilesystem: string;
5
4
  }[]>;
@@ -44,11 +44,7 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
44
44
  p = toPosixPath(p);
45
45
  assert(!p.startsWith(userRootDir));
46
46
  const filePathRelativeToUserRootDir = path.posix.join('/', p);
47
- const filePathAbsoluteFilesystem = path.posix.join(userRootDir, p);
48
- return {
49
- filePathRelativeToUserRootDir,
50
- filePathAbsoluteFilesystem
51
- };
47
+ return { filePathRelativeToUserRootDir };
52
48
  });
53
49
  return plusFiles;
54
50
  }
@@ -5,26 +5,53 @@ export { getLocationId };
5
5
  export { sortAfterInheritanceOrder };
6
6
  export { isGlobalLocation };
7
7
  export { applyFilesystemRoutingRootEffect };
8
+ export type { LocationId };
8
9
  export { getLogicalPath };
9
10
  /**
10
- * getLocationId('/pages/some-page/+Page.js') => '/pages/some-page'
11
- * getLocationId('/pages/some-page') => '/pages/some-page'
12
- * getLocationId('/renderer/+config.js') => '/renderer'
11
+ * The `locationId` value is used for filesystem inheritance.
12
+ *
13
+ * Each config value is assigned with a `locationId` value. That's the source-of-truth for determining inheritance between config values.
14
+ *
15
+ * For Vike extensions, `locationId` is different than the config value's `definedAt`, for example the `onRenderHtml()` hook of `vike-react`:
16
+ * - `locationId === '/pages'` (the directory of `/pages/+config.h.js` which extends `vike-react`)
17
+ * - `definedAt.filePathAbsoluteFilesystem === '/home/rom/code/my-vike-app/node_modules/vike-react/dist/renderer/onRenderHtml.js'` (the file where the value is defined)
18
+ *
19
+ * This is an important distinction because the Vike extension's config should only apply to where it's being extended from, for example:
20
+ * ```js
21
+ * // /pages/admin/+config.h.js
22
+ * import vikeVue from 'vike-vue/config'
23
+ * // Should only apply to /pages/admin/**
24
+ * export default { extends: [vikeVue] }
25
+ * ```
26
+ * ```js
27
+ * // /pages/marketing/+config.h.js
28
+ * import vikeReact from 'vike-react/config'
29
+ * // Should only apply to /pages/marketing/**
30
+ * export default { extends: [vikeReact] }
31
+ * ```
13
32
  */
14
- declare function getLocationId(filePathAbsoluteVite: string): string;
15
- /** Get URL determined by filesystem path */
16
- declare function getFilesystemRouteString(locationId: string): string;
33
+ type LocationId = string & {
34
+ __brand: 'LocationId';
35
+ };
36
+ /**
37
+ * `getLocationId('/pages/some-page/+Page.js')` => `'/pages/some-page'`
38
+ * `getLocationId('/renderer/+config.js')` => `'/renderer'`
39
+ *
40
+ * The value `locationId` is always a user-land path, because Filesystem Routing/Inheritance only applies to the user-land (Vike never uses Filesystem Routing/Inheritance for `node_modules/**`).
41
+ */
42
+ declare function getLocationId(filePathRelativeToUserRootDir: string): LocationId;
43
+ /** Filesystem Routing: get the URL */
44
+ declare function getFilesystemRouteString(locationId: LocationId): string;
17
45
  /**
18
46
  * getLogicalPath('/pages/some-page', ['pages']) => '/some-page'
19
- * getLogicalPath('some-npm-pkg/renderer', ['renderer']) => '/'
20
47
  */
21
- declare function getLogicalPath(someDir: string, removeDirs: string[]): string;
48
+ declare function getLogicalPath(locationId: LocationId, removeDirs: string[]): string;
22
49
  /** Whether configs defined in `locationId` apply in every `locationIds` */
23
- declare function isGlobalLocation(locationId: string, locationIds: string[]): boolean;
24
- declare function sortAfterInheritanceOrder(locationId1: string, locationId2: string, locationIdPage: string): -1 | 1 | 0;
50
+ declare function isGlobalLocation(locationId: LocationId, locationIds: LocationId[]): boolean;
51
+ declare function sortAfterInheritanceOrder(locationId1: LocationId, locationId2: LocationId, locationIdPage: LocationId): -1 | 1 | 0;
25
52
  /** Whether configs defined at `locationId1` also apply at `locationId2` */
26
- declare function isInherited(locationId1: string, locationId2: string): boolean;
27
- declare function getFilesystemRouteDefinedBy(locationId: string): string;
53
+ declare function isInherited(locationId1: LocationId, locationId2: LocationId): boolean;
54
+ declare function getFilesystemRouteDefinedBy(locationId: LocationId): string;
28
55
  declare function applyFilesystemRoutingRootEffect(routeFilesystem: string, filesystemRoutingRootEffect: {
29
56
  before: string;
30
57
  after: string;
@@ -7,40 +7,47 @@ export { isGlobalLocation };
7
7
  export { applyFilesystemRoutingRootEffect };
8
8
  // For ./filesystemRouting.spec.ts
9
9
  export { getLogicalPath };
10
- import { assert, assertPosixPath, getNpmPackageImportPath, isNpmPackageImport, higherFirst } from '../../../../utils.js';
10
+ import { assert, assertPosixPath, higherFirst } from '../../../../utils.js';
11
11
  /**
12
- * getLocationId('/pages/some-page/+Page.js') => '/pages/some-page'
13
- * getLocationId('/pages/some-page') => '/pages/some-page'
14
- * getLocationId('/renderer/+config.js') => '/renderer'
12
+ * `getLocationId('/pages/some-page/+Page.js')` => `'/pages/some-page'`
13
+ * `getLocationId('/renderer/+config.js')` => `'/renderer'`
14
+ *
15
+ * The value `locationId` is always a user-land path, because Filesystem Routing/Inheritance only applies to the user-land (Vike never uses Filesystem Routing/Inheritance for `node_modules/**`).
15
16
  */
16
- function getLocationId(filePathAbsoluteVite) {
17
- const locationId = removeFilename(filePathAbsoluteVite, true);
17
+ function getLocationId(
18
+ // We always determine `locationId` from a real user-land file: the `locationId` for Vike extensions is the `locationId` of the the user's `+config.h.js` that extends the Vike extension.
19
+ filePathRelativeToUserRootDir) {
20
+ assertPosixPath(filePathRelativeToUserRootDir);
21
+ assert(filePathRelativeToUserRootDir.startsWith('/'));
22
+ const locationId = removeFilename(filePathRelativeToUserRootDir);
18
23
  assertLocationId(locationId);
19
24
  return locationId;
20
25
  }
21
- /** Get URL determined by filesystem path */
26
+ /** Filesystem Routing: get the URL */
22
27
  function getFilesystemRouteString(locationId) {
23
28
  return getLogicalPath(locationId, ['renderer', 'pages', 'src', 'index']);
24
29
  }
25
- /** Get apply root for config inheritance */
26
- function getInheritanceRoot(someDir) {
27
- return getLogicalPath(someDir, ['renderer']);
30
+ /** Filesystem Inheritance: get the apply root */
31
+ function getInheritanceRoot(locationId) {
32
+ return getLogicalPath(locationId, ['renderer']);
28
33
  }
29
34
  /**
30
35
  * getLogicalPath('/pages/some-page', ['pages']) => '/some-page'
31
- * getLogicalPath('some-npm-pkg/renderer', ['renderer']) => '/'
32
36
  */
33
- function getLogicalPath(someDir, removeDirs) {
34
- someDir = removeNpmPackageName(someDir);
35
- someDir = removeDirectories(someDir, removeDirs);
36
- assertIsPath(someDir);
37
- return someDir;
37
+ function getLogicalPath(locationId, removeDirs) {
38
+ let logicalPath = removeDirectories(locationId, removeDirs);
39
+ assertIsPath(logicalPath);
40
+ return logicalPath;
38
41
  }
39
42
  /** Whether configs defined in `locationId` apply in every `locationIds` */
40
43
  function isGlobalLocation(locationId, locationIds) {
41
44
  return locationIds.every((locId) => isInherited(locationId, locId) || locationIsRendererDir(locId));
42
45
  }
43
46
  function sortAfterInheritanceOrder(locationId1, locationId2, locationIdPage) {
47
+ assertLocationId(locationId1);
48
+ assertLocationId(locationId2);
49
+ if (locationId1 === locationId2)
50
+ return 0;
44
51
  const inheritanceRoot1 = getInheritanceRoot(locationId1);
45
52
  const inheritanceRoot2 = getInheritanceRoot(locationId2);
46
53
  const inheritanceRootPage = getInheritanceRoot(locationIdPage);
@@ -56,15 +63,10 @@ function sortAfterInheritanceOrder(locationId1, locationId2, locationIdPage) {
56
63
  assert(inheritanceRoot1.length !== inheritanceRoot2.length);
57
64
  return higherFirst((inheritanceRoot) => inheritanceRoot.length)(inheritanceRoot1, inheritanceRoot2);
58
65
  }
59
- // Should be true since we aggregate interface files by locationId
60
- assert(locationId1 !== locationId2);
61
66
  // locationId1 first, i.e. `indexOf(locationId1) < indexOf(locationId2)`
62
67
  const locationId1First = -1;
63
68
  // locationId2 first, i.e. `indexOf(locationId2) < indexOf(locationId1)`
64
69
  const locationId2First = 1;
65
- if (locationIsNpmPackage(locationId1) !== locationIsNpmPackage(locationId2)) {
66
- return locationIsNpmPackage(locationId1) ? locationId2First : locationId1First;
67
- }
68
70
  if (locationIsRendererDir(locationId1) !== locationIsRendererDir(locationId2)) {
69
71
  return locationIsRendererDir(locationId1) ? locationId2First : locationId1First;
70
72
  }
@@ -75,9 +77,6 @@ function sortAfterInheritanceOrder(locationId1, locationId2, locationIdPage) {
75
77
  }
76
78
  return locationId1 > locationId2 ? locationId1First : locationId2First;
77
79
  }
78
- function locationIsNpmPackage(locationId) {
79
- return !locationId.startsWith('/');
80
- }
81
80
  function locationIsRendererDir(locationId) {
82
81
  return locationId.split('/').includes('renderer');
83
82
  }
@@ -87,19 +86,6 @@ function isInherited(locationId1, locationId2) {
87
86
  const inheritanceRoot2 = getInheritanceRoot(locationId2);
88
87
  return startsWith(inheritanceRoot2, inheritanceRoot1);
89
88
  }
90
- function removeNpmPackageName(somePath) {
91
- if (!isNpmPackageImport(somePath)) {
92
- assert(somePath.startsWith('/'));
93
- return somePath;
94
- }
95
- const importPath = getNpmPackageImportPath(somePath);
96
- if (!importPath)
97
- return '/';
98
- assertPosixPath(importPath);
99
- assert(!importPath.startsWith('/'));
100
- somePath = '/' + importPath;
101
- return somePath;
102
- }
103
89
  function removeDirectories(somePath, removeDirs) {
104
90
  assertPosixPath(somePath);
105
91
  somePath = somePath
@@ -110,17 +96,13 @@ function removeDirectories(somePath, removeDirs) {
110
96
  somePath = '/';
111
97
  return somePath;
112
98
  }
113
- function removeFilename(filePathAbsoluteVite, optional) {
114
- assertPosixPath(filePathAbsoluteVite);
115
- assert(filePathAbsoluteVite.startsWith('/') || isNpmPackageImport(filePathAbsoluteVite));
99
+ function removeFilename(filePathRelativeToUserRootDir) {
100
+ const filePathParts = filePathRelativeToUserRootDir.split('/');
116
101
  {
117
- const filename = filePathAbsoluteVite.split('/').slice(-1)[0];
118
- if (!filename.includes('.')) {
119
- assert(optional);
120
- return filePathAbsoluteVite;
121
- }
102
+ const filename = filePathParts.slice(-1)[0];
103
+ assert(filename.includes('.'));
122
104
  }
123
- let locationId = filePathAbsoluteVite.split('/').slice(0, -1).join('/');
105
+ let locationId = filePathParts.slice(0, -1).join('/');
124
106
  if (locationId === '')
125
107
  locationId = '/';
126
108
  assertLocationId(locationId);
@@ -142,7 +124,7 @@ function applyFilesystemRoutingRootEffect(routeFilesystem, filesystemRoutingRoot
142
124
  return routeFilesystem;
143
125
  }
144
126
  function assertLocationId(locationId) {
145
- assert(locationId.startsWith('/') || isNpmPackageImport(locationId));
127
+ assert(locationId.startsWith('/'));
146
128
  assert(!locationId.endsWith('/') || locationId === '/');
147
129
  }
148
130
  function assertIsPath(logicalPath) {
@@ -6,7 +6,7 @@ import { assertPosixPath, assert, assertUsage, assertWarning, hasProp, assertIsN
6
6
  import { transpileAndExecuteFile } from './transpileAndExecuteFile.js';
7
7
  import { assertPlusFileExport } from '../../../../../../shared/page-configs/assertPlusFileExport.js';
8
8
  import pc from '@brillout/picocolors';
9
- import { parseImportData } from './transformImports.js';
9
+ import { parseImportData } from './transformFileImports.js';
10
10
  import { getConfigFileExport } from '../getConfigFileExport.js';
11
11
  import { assertImportPath, resolveImportPath } from './resolveImportPath.js';
12
12
  assertIsNotProductionRuntime();
@@ -14,7 +14,7 @@ assertIsNotProductionRuntime();
14
14
  async function loadImportedFile(import_, userRootDir, importedFilesLoaded) {
15
15
  const f = import_.filePathAbsoluteFilesystem;
16
16
  if (!importedFilesLoaded[f]) {
17
- importedFilesLoaded[f] = transpileAndExecuteFile(import_, true, userRootDir).then((r) => r.fileExports);
17
+ importedFilesLoaded[f] = transpileAndExecuteFile(import_, false, userRootDir).then((r) => r.fileExports);
18
18
  }
19
19
  const fileExports = await importedFilesLoaded[f];
20
20
  const fileExport = fileExports[import_.fileExportName];
@@ -22,7 +22,7 @@ async function loadImportedFile(import_, userRootDir, importedFilesLoaded) {
22
22
  }
23
23
  // Load +{configName}.js
24
24
  async function loadValueFile(interfaceValueFile, configName, userRootDir) {
25
- const { fileExports } = await transpileAndExecuteFile(interfaceValueFile.filePath, true, userRootDir);
25
+ const { fileExports } = await transpileAndExecuteFile(interfaceValueFile.filePath, false, userRootDir);
26
26
  const { filePathToShowToUser } = interfaceValueFile.filePath;
27
27
  assertPlusFileExport(fileExports, filePathToShowToUser, configName);
28
28
  Object.entries(fileExports).forEach(([exportName, configValue]) => {
@@ -34,7 +34,7 @@ async function loadValueFile(interfaceValueFile, configName, userRootDir) {
34
34
  async function loadConfigFile(configFilePath, userRootDir, visited, isConfigOfExtension) {
35
35
  const { filePathAbsoluteFilesystem } = configFilePath;
36
36
  assertNoInfiniteLoop(visited, filePathAbsoluteFilesystem);
37
- const { fileExports } = await transpileAndExecuteFile(configFilePath, false, userRootDir, isConfigOfExtension);
37
+ const { fileExports } = await transpileAndExecuteFile(configFilePath, !isConfigOfExtension, userRootDir, isConfigOfExtension);
38
38
  const { extendsConfigs, extendsFilePaths } = await loadExtendsConfigs(fileExports, configFilePath, userRootDir, [
39
39
  ...visited,
40
40
  filePathAbsoluteFilesystem
@@ -0,0 +1,5 @@
1
+ export { resolveFilePathRelativeToUserRootDir };
2
+ export { resolveFilePathAbsoluteFilesystem };
3
+ import type { FilePathResolved } from '../../../../../../shared/page-configs/PageConfig.js';
4
+ declare function resolveFilePathRelativeToUserRootDir(filePathRelativeToUserRootDir: string, userRootDir: string): FilePathResolved;
5
+ declare function resolveFilePathAbsoluteFilesystem(filePathAbsoluteFilesystem: string, userRootDir: string): FilePathResolved;