vike 0.4.201 → 0.4.203-commit-d47722f

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 (21) hide show
  1. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/assertExtensions.js +9 -34
  2. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +2 -0
  3. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +31 -21
  4. package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +9 -8
  5. package/dist/cjs/shared/page-configs/assertPlusFileExport.js +2 -4
  6. package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -1
  7. package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
  8. package/dist/esm/client/client-routing-runtime/entry.js +1 -1
  9. package/dist/esm/client/client-routing-runtime/history.d.ts +4 -0
  10. package/dist/esm/client/client-routing-runtime/history.js +2 -5
  11. package/dist/esm/client/client-routing-runtime/initClientRouter.js +3 -0
  12. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/assertExtensions.js +9 -34
  13. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +2 -0
  14. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +32 -22
  15. package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +9 -8
  16. package/dist/esm/shared/page-configs/assertPlusFileExport.js +2 -4
  17. package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +2 -1
  18. package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
  19. package/dist/esm/utils/PROJECT_VERSION.js +1 -1
  20. package/dist/esm/utils/projectInfo.d.ts +1 -1
  21. package/package.json +1 -1
@@ -16,47 +16,22 @@ function assertExtensionsConventions(interfaceFile) {
16
16
  assertConfigExportPath(interfaceFile);
17
17
  }
18
18
  function assertConfigExportPath(interfaceFile) {
19
- const { importPathAbsolute } = interfaceFile.filePath;
20
- (0, utils_js_1.assert)(importPathAbsolute);
19
+ const { importPathAbsolute, filePathAbsoluteFilesystem } = interfaceFile.filePath;
20
+ // Ejected Vike extension
21
+ if (!importPathAbsolute) {
22
+ const p = filePathAbsoluteFilesystem;
23
+ (0, utils_js_1.assert)(!p.includes('node_modules'));
24
+ return;
25
+ }
21
26
  const name = getConfigNameValue(interfaceFile);
22
27
  (0, utils_js_1.assert)(name); // already asserted in assertExtensionName()
23
28
  const importPathAbsoluteExpected = `${name}/config`;
24
29
  (0, utils_js_1.assertWarning)(importPathAbsolute === importPathAbsoluteExpected, `The Vike configuration of ${picocolors_1.default.bold(name)} is exported at ${picocolors_1.default.bold(importPathAbsolute)}, but it should be exported at ${picocolors_1.default.bold(importPathAbsoluteExpected)} instead.`, { onlyOnce: true });
25
30
  }
26
31
  function assertExtensionName(interfaceFile) {
27
- let nameDeduced;
28
- {
29
- const { importPathAbsolute } = interfaceFile.filePath;
30
- (0, utils_js_1.assert)(importPathAbsolute);
31
- nameDeduced = importPathAbsolute
32
- .split('/')
33
- .slice(0, importPathAbsolute.startsWith('@') ? 2 : 1)
34
- .join('/');
35
- }
36
- const name = getConfigNameValue(interfaceFile);
37
32
  const filePathToShowToUser = getFilePathToShowToUser(interfaceFile);
38
- if (name) {
39
- (0, utils_js_1.assertWarning)(name === nameDeduced, `The setting ${picocolors_1.default.bold('name')} defined at ${filePathToShowToUser} is ${picocolors_1.default.bold(name)}, but it should be ${picocolors_1.default.bold(nameDeduced)} instead (the name of the npm package).`, { onlyOnce: true });
40
- }
41
- else {
42
- if (
43
- // Let's eventually remove this
44
- [
45
- 'vike-react',
46
- 'vike-react-query',
47
- 'vike-react-zustand',
48
- 'vike-vue',
49
- 'vike-vue-query',
50
- 'vike-vue-pinia',
51
- 'vike-pinia',
52
- 'vike-solid'
53
- ].includes(nameDeduced)) {
54
- (0, utils_js_1.assertUsage)(false, `Update ${nameDeduced} to its latest version.`);
55
- }
56
- else {
57
- (0, utils_js_1.assertUsage)(false, `The setting ${picocolors_1.default.bold('name')} is missing: it should be set by the config ${filePathToShowToUser} of ${picocolors_1.default.bold(nameDeduced)}.`);
58
- }
59
- }
33
+ const name = getConfigNameValue(interfaceFile);
34
+ (0, utils_js_1.assertUsage)(name, `Vike extension name missing: the config ${filePathToShowToUser} must define the setting ${picocolors_1.default.cyan('name')}`);
60
35
  }
61
36
  function assertExtensionsPeerDependencies(interfaceFilesRelevantList) {
62
37
  // Get installed extensions
@@ -167,6 +167,7 @@ async function fastGlob(userRootDir, outDirRelativeFromUserRootDir) {
167
167
  function getIgnoreAsPatterns(outDirRelativeFromUserRootDir) {
168
168
  const ignoreAsPatterns = [
169
169
  '**/node_modules/**',
170
+ '**/ejected/**',
170
171
  // Allow:
171
172
  // ```
172
173
  // +Page.js
@@ -184,6 +185,7 @@ function getIgnoreAsPatterns(outDirRelativeFromUserRootDir) {
184
185
  function getIgnoreAsFilterFn(outDirRelativeFromUserRootDir) {
185
186
  (0, utils_js_1.assert)(outDirRelativeFromUserRootDir === null || !outDirRelativeFromUserRootDir.startsWith('/'));
186
187
  return (file) => !file.includes('node_modules/') &&
188
+ !file.includes('ejected/') &&
187
189
  !file.includes('.telefunc.') &&
188
190
  (outDirRelativeFromUserRootDir === null || !file.startsWith(`${outDirRelativeFromUserRootDir}/`));
189
191
  }
@@ -60,14 +60,13 @@ function assertNoInfiniteLoop(visited, filePathAbsoluteFilesystem) {
60
60
  (0, utils_js_1.assertUsage)(idx === -1, `Infinite extends loop ${[...loop, filePathAbsoluteFilesystem].join('>')}`);
61
61
  }
62
62
  async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir, visited) {
63
- const extendsPointerImportData = getExtendsPointerImportData(configFileExports, configFilePath);
63
+ const { extendsPointerImportData, extendsConfigs } = getExtendsPointerImportData(configFileExports, configFilePath);
64
64
  const extendsConfigFiles = [];
65
65
  extendsPointerImportData.map((pointerImportData) => {
66
66
  const filePath = (0, resolvePointerImport_js_1.resolvePointerImport)(pointerImportData, configFilePath, userRootDir);
67
67
  (0, utils_js_1.assert)(filePath.filePathAbsoluteFilesystem);
68
68
  extendsConfigFiles.push(filePath);
69
69
  });
70
- const extendsConfigs = [];
71
70
  await Promise.all(extendsConfigFiles.map(async (configFilePath) => {
72
71
  const result = await loadConfigFile(configFilePath, userRootDir, visited, true);
73
72
  extendsConfigs.push(result.configFile);
@@ -79,24 +78,35 @@ async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir
79
78
  function getExtendsPointerImportData(configFileExports, configFilePath) {
80
79
  const { filePathToShowToUser } = configFilePath;
81
80
  const configFileExport = (0, getConfigFileExport_js_1.getConfigFileExport)(configFileExports, filePathToShowToUser);
82
- const wrongUsage = `${filePathToShowToUser} sets the config ${picocolors_1.default.cyan('extends')} to an invalid value, see https://vike.dev/extends`;
83
- let extendList;
84
- if (!('extends' in configFileExport)) {
85
- return [];
86
- }
87
- else if ((0, utils_js_1.hasProp)(configFileExport, 'extends', 'string')) {
88
- extendList = [configFileExport.extends];
89
- }
90
- else if ((0, utils_js_1.hasProp)(configFileExport, 'extends', 'string[]')) {
91
- extendList = configFileExport.extends;
92
- }
93
- else {
94
- (0, utils_js_1.assertUsage)(false, wrongUsage);
81
+ const extendsConfigs = [];
82
+ const extendsPointerImportData = [];
83
+ if ('extends' in configFileExport) {
84
+ const extendsValue = configFileExport.extends;
85
+ const extendList = [];
86
+ const wrongUsage = `${filePathToShowToUser} sets the config ${picocolors_1.default.cyan('extends')} to an invalid value, see https://vike.dev/extends`;
87
+ if (typeof extendsValue === 'string') {
88
+ extendList.push(extendsValue);
89
+ }
90
+ else if ((0, utils_js_1.isArrayOfStrings)(extendsValue)) {
91
+ extendList.push(...extendsValue);
92
+ }
93
+ else if ((0, utils_js_1.isObject)(extendsValue)) {
94
+ /* If we want to implement this then we need to make filePath optional
95
+ extendsConfigs.push({
96
+ fileExports: extendsValue,
97
+ filePath: null,
98
+ })
99
+ */
100
+ (0, utils_js_1.assertUsage)(false, wrongUsage);
101
+ }
102
+ else {
103
+ (0, utils_js_1.assertUsage)(false, wrongUsage);
104
+ }
105
+ extendsPointerImportData.push(...extendList.map((importString) => {
106
+ const pointerImportData = (0, transformPointerImports_js_1.parsePointerImportData)(importString);
107
+ (0, utils_js_1.assertUsage)(pointerImportData, wrongUsage);
108
+ return pointerImportData;
109
+ }));
95
110
  }
96
- const extendsPointerImportData = extendList.map((importString) => {
97
- const pointerImportData = (0, transformPointerImports_js_1.parsePointerImportData)(importString);
98
- (0, utils_js_1.assertUsage)(pointerImportData, wrongUsage);
99
- return pointerImportData;
100
- });
101
- return extendsPointerImportData;
111
+ return { extendsPointerImportData, extendsConfigs };
102
112
  }
@@ -118,9 +118,9 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
118
118
  let resolved = await build.resolve(path, opts);
119
119
  if (debugEsbuildResolve.isActivated)
120
120
  debugEsbuildResolve('resolved', resolved);
121
- // Temporary workaround for https://github.com/vikejs/vike/issues/1729
122
- // - Required for esbuild@0.24.0 (November 2024).
123
- // - Let's try to remove this workaround after some time.
121
+ // Temporary workaround for https://github.com/evanw/esbuild/issues/3973
122
+ // - Sitll required for esbuild@0.24.0 (November 2024).
123
+ // - Let's try to remove this workaround again later.
124
124
  if (resolved.errors.length > 0) {
125
125
  let resolvedWithNode;
126
126
  try {
@@ -149,15 +149,16 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
149
149
  // - assertIsNpmPackageImport()
150
150
  // - isNpmPackageImport(str, { cannotBePathAlias: true })
151
151
  (0, utils_js_1.assertFilePathAbsoluteFilesystem)(importPathResolved);
152
- // vike-{react,vue,solid} follow the convention that their config export resolves to a file named +config.js
153
- // - This is temporary, see comment below.
154
- const isVikeExtensionImport = importPathResolved.endsWith('+config.js');
152
+ // Should be remove this? See comment below.
153
+ const isVikeExtensionImport = (path.startsWith('vike-') && path.endsWith('/config')) || importPathResolved.endsWith('+config.js');
155
154
  const isPointerImport = transformImports === 'all' ||
156
155
  // .jsx, .vue, .svg, ... => obviously not config code => pointer import
157
156
  !(0, utils_js_1.isPlainJavaScriptFile)(importPathResolved) ||
158
157
  // Import of a Vike extension config => make it a pointer import because we want to show nice error messages (that can display whether a config has been set by the user or by a Vike extension).
159
- // - TODO/eventually: stop doing this and, instead, let Node.js directly load vike-{react,vue,solid} while enforcing Vike extensions to set 'name' in their +config.js file.
160
- // - vike@0.4.162 already started soft-requiring Vike extensions to set the name config
158
+ // - Should we stop doing this? (And instead let Node.js directly load Vike extensions.)
159
+ // - In principle, we can use the setting 'name' value of Vike extensions.
160
+ // - vike@0.4.162 started soft-requiring Vike extensions to set the name config.
161
+ // - In practice, it seems like it requires some (non-trivial?) refactoring.
161
162
  isVikeExtensionImport;
162
163
  (0, utils_js_1.assertPosixPath)(importPathResolved);
163
164
  const isNodeModules = importPathResolved.includes('/node_modules/');
@@ -26,12 +26,10 @@ function assertPlusFileExport(fileExports, filePathToShowToUser, configName) {
26
26
  const exportNamed = picocolors_1.default.code(`export { ${configName} }`);
27
27
  (0, utils_js_1.assert)(exportNamesValid.length <= 2);
28
28
  if (exportNamesValid.length === 0) {
29
- (0, utils_js_1.assertUsage)(false, `${filePathToShowToUser} should have a ${exportNamed} or ${exportDefault}`);
29
+ (0, utils_js_1.assertUsage)(false, `${filePathToShowToUser} should have ${exportNamed} or ${exportDefault}`);
30
30
  }
31
31
  if (exportNamesValid.length === 2) {
32
- (0, utils_js_1.assertWarning)(false, `${filePathToShowToUser} is ambiguous: remove ${exportDefault} or ${exportNamed}`, {
33
- onlyOnce: true
34
- });
32
+ (0, utils_js_1.assertUsage)(false, `${filePathToShowToUser} is ambiguous: remove ${exportDefault} or ${exportNamed}`);
35
33
  }
36
34
  if (!TOLERATE_SIDE_EXPORTS.some((ext) => filePathToShowToUser.endsWith(ext))) {
37
35
  exportNamesInvalid.forEach((exportInvalid) => {
@@ -114,6 +114,7 @@ function parseValueSerialized(valueSerialized, configName, getDefinedAtFile) {
114
114
  const isSideExport = exportName !== 'default' && exportName !== configName;
115
115
  if (!isSideExport) {
116
116
  value = exportValue;
117
+ // Already asserted by assertPlusFileExport() call above.
117
118
  (0, utils_js_1.assert)(!valueWasFound);
118
119
  valueWasFound = true;
119
120
  }
@@ -131,7 +132,7 @@ function parseValueSerialized(valueSerialized, configName, getDefinedAtFile) {
131
132
  });
132
133
  }
133
134
  });
134
- // Already validated by assertPlusFileExport() call above.
135
+ // Already asserted by assertPlusFileExport() call above.
135
136
  (0, utils_js_1.assert)(valueWasFound);
136
137
  return { value, sideExports };
137
138
  }
@@ -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.201';
5
+ exports.PROJECT_VERSION = '0.4.203-commit-d47722f';
@@ -7,6 +7,6 @@ import { removeFoucBuster } from '../shared/removeFoucBuster.js';
7
7
  // @ts-ignore Since dist/cjs/client/ is never used, we can ignore this error.
8
8
  const isProd = import.meta.env.PROD;
9
9
  assertSingleInstance_onClientEntryClientRouting(isProd);
10
+ initClientRouter();
10
11
  if (import.meta.env.DEV)
11
12
  removeFoucBuster();
12
- initClientRouter();
@@ -1,6 +1,8 @@
1
1
  export { pushHistoryState };
2
2
  export { onPopStateBegin };
3
3
  export { saveScrollPosition };
4
+ export { enhanceHistoryState };
5
+ export { monkeyPatchHistoryAPI };
4
6
  export type { HistoryInfo };
5
7
  export type { ScrollPosition };
6
8
  type StateEnhanced = {
@@ -13,8 +15,10 @@ type ScrollPosition = {
13
15
  x: number;
14
16
  y: number;
15
17
  };
18
+ declare function enhanceHistoryState(): void;
16
19
  declare function saveScrollPosition(): void;
17
20
  declare function pushHistoryState(url: string, overwriteLastHistoryEntry: boolean): void;
21
+ declare function monkeyPatchHistoryAPI(): void;
18
22
  type HistoryInfo = {
19
23
  url: `/${string}`;
20
24
  state: StateEnhanced;
@@ -1,8 +1,9 @@
1
1
  export { pushHistoryState };
2
2
  export { onPopStateBegin };
3
3
  export { saveScrollPosition };
4
+ export { enhanceHistoryState };
5
+ export { monkeyPatchHistoryAPI };
4
6
  import { assert, assertUsage, getCurrentUrl, getGlobalObject, hasProp, isObject } from './utils.js';
5
- init();
6
7
  const globalObject = getGlobalObject('history.ts', { previous: getHistoryInfo() });
7
8
  // `window.history.state === null` when:
8
9
  // - The very first render
@@ -129,10 +130,6 @@ function assertStateVikeEnhanced(state) {
129
130
  assert(hasProp(state.scrollPosition, 'x', 'number') && hasProp(state.scrollPosition, 'y', 'number'));
130
131
  }
131
132
  }
132
- function init() {
133
- enhanceHistoryState();
134
- monkeyPatchHistoryAPI();
135
- }
136
133
  function getHistoryInfo() {
137
134
  return {
138
135
  url: getCurrentUrl(),
@@ -6,6 +6,7 @@ import { initOnLinkClick } from './initOnLinkClick.js';
6
6
  import { setupNativeScrollRestoration } from './scrollRestoration.js';
7
7
  import { autoSaveScrollPosition } from './setScrollPosition.js';
8
8
  import { initLinkPrefetchHandlers } from './prefetch.js';
9
+ import { enhanceHistoryState, monkeyPatchHistoryAPI } from './history.js';
9
10
  async function initClientRouter() {
10
11
  // Init navigation history and scroll restoration
11
12
  initHistoryAndScroll();
@@ -27,6 +28,8 @@ async function renderFirstPage() {
27
28
  });
28
29
  }
29
30
  function initHistoryAndScroll() {
31
+ monkeyPatchHistoryAPI();
32
+ enhanceHistoryState();
30
33
  setupNativeScrollRestoration();
31
34
  autoSaveScrollPosition();
32
35
  // Handle back-/forward navigation
@@ -11,47 +11,22 @@ function assertExtensionsConventions(interfaceFile) {
11
11
  assertConfigExportPath(interfaceFile);
12
12
  }
13
13
  function assertConfigExportPath(interfaceFile) {
14
- const { importPathAbsolute } = interfaceFile.filePath;
15
- assert(importPathAbsolute);
14
+ const { importPathAbsolute, filePathAbsoluteFilesystem } = interfaceFile.filePath;
15
+ // Ejected Vike extension
16
+ if (!importPathAbsolute) {
17
+ const p = filePathAbsoluteFilesystem;
18
+ assert(!p.includes('node_modules'));
19
+ return;
20
+ }
16
21
  const name = getConfigNameValue(interfaceFile);
17
22
  assert(name); // already asserted in assertExtensionName()
18
23
  const importPathAbsoluteExpected = `${name}/config`;
19
24
  assertWarning(importPathAbsolute === importPathAbsoluteExpected, `The Vike configuration of ${pc.bold(name)} is exported at ${pc.bold(importPathAbsolute)}, but it should be exported at ${pc.bold(importPathAbsoluteExpected)} instead.`, { onlyOnce: true });
20
25
  }
21
26
  function assertExtensionName(interfaceFile) {
22
- let nameDeduced;
23
- {
24
- const { importPathAbsolute } = interfaceFile.filePath;
25
- assert(importPathAbsolute);
26
- nameDeduced = importPathAbsolute
27
- .split('/')
28
- .slice(0, importPathAbsolute.startsWith('@') ? 2 : 1)
29
- .join('/');
30
- }
31
- const name = getConfigNameValue(interfaceFile);
32
27
  const filePathToShowToUser = getFilePathToShowToUser(interfaceFile);
33
- if (name) {
34
- assertWarning(name === nameDeduced, `The setting ${pc.bold('name')} defined at ${filePathToShowToUser} is ${pc.bold(name)}, but it should be ${pc.bold(nameDeduced)} instead (the name of the npm package).`, { onlyOnce: true });
35
- }
36
- else {
37
- if (
38
- // Let's eventually remove this
39
- [
40
- 'vike-react',
41
- 'vike-react-query',
42
- 'vike-react-zustand',
43
- 'vike-vue',
44
- 'vike-vue-query',
45
- 'vike-vue-pinia',
46
- 'vike-pinia',
47
- 'vike-solid'
48
- ].includes(nameDeduced)) {
49
- assertUsage(false, `Update ${nameDeduced} to its latest version.`);
50
- }
51
- else {
52
- assertUsage(false, `The setting ${pc.bold('name')} is missing: it should be set by the config ${filePathToShowToUser} of ${pc.bold(nameDeduced)}.`);
53
- }
54
- }
28
+ const name = getConfigNameValue(interfaceFile);
29
+ assertUsage(name, `Vike extension name missing: the config ${filePathToShowToUser} must define the setting ${pc.cyan('name')}`);
55
30
  }
56
31
  function assertExtensionsPeerDependencies(interfaceFilesRelevantList) {
57
32
  // Get installed extensions
@@ -162,6 +162,7 @@ async function fastGlob(userRootDir, outDirRelativeFromUserRootDir) {
162
162
  function getIgnoreAsPatterns(outDirRelativeFromUserRootDir) {
163
163
  const ignoreAsPatterns = [
164
164
  '**/node_modules/**',
165
+ '**/ejected/**',
165
166
  // Allow:
166
167
  // ```
167
168
  // +Page.js
@@ -179,6 +180,7 @@ function getIgnoreAsPatterns(outDirRelativeFromUserRootDir) {
179
180
  function getIgnoreAsFilterFn(outDirRelativeFromUserRootDir) {
180
181
  assert(outDirRelativeFromUserRootDir === null || !outDirRelativeFromUserRootDir.startsWith('/'));
181
182
  return (file) => !file.includes('node_modules/') &&
183
+ !file.includes('ejected/') &&
182
184
  !file.includes('.telefunc.') &&
183
185
  (outDirRelativeFromUserRootDir === null || !file.startsWith(`${outDirRelativeFromUserRootDir}/`));
184
186
  }
@@ -2,7 +2,7 @@
2
2
  export { loadImportedFile };
3
3
  export { loadValueFile };
4
4
  export { loadConfigFile };
5
- import { assert, assertUsage, hasProp, assertIsNotProductionRuntime } from '../../../../utils.js';
5
+ import { assert, assertUsage, assertIsNotProductionRuntime, isArrayOfStrings, isObject } from '../../../../utils.js';
6
6
  import { transpileAndExecuteFile } from './transpileAndExecuteFile.js';
7
7
  import { assertPlusFileExport } from '../../../../../../shared/page-configs/assertPlusFileExport.js';
8
8
  import pc from '@brillout/picocolors';
@@ -55,14 +55,13 @@ function assertNoInfiniteLoop(visited, filePathAbsoluteFilesystem) {
55
55
  assertUsage(idx === -1, `Infinite extends loop ${[...loop, filePathAbsoluteFilesystem].join('>')}`);
56
56
  }
57
57
  async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir, visited) {
58
- const extendsPointerImportData = getExtendsPointerImportData(configFileExports, configFilePath);
58
+ const { extendsPointerImportData, extendsConfigs } = getExtendsPointerImportData(configFileExports, configFilePath);
59
59
  const extendsConfigFiles = [];
60
60
  extendsPointerImportData.map((pointerImportData) => {
61
61
  const filePath = resolvePointerImport(pointerImportData, configFilePath, userRootDir);
62
62
  assert(filePath.filePathAbsoluteFilesystem);
63
63
  extendsConfigFiles.push(filePath);
64
64
  });
65
- const extendsConfigs = [];
66
65
  await Promise.all(extendsConfigFiles.map(async (configFilePath) => {
67
66
  const result = await loadConfigFile(configFilePath, userRootDir, visited, true);
68
67
  extendsConfigs.push(result.configFile);
@@ -74,24 +73,35 @@ async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir
74
73
  function getExtendsPointerImportData(configFileExports, configFilePath) {
75
74
  const { filePathToShowToUser } = configFilePath;
76
75
  const configFileExport = getConfigFileExport(configFileExports, filePathToShowToUser);
77
- const wrongUsage = `${filePathToShowToUser} sets the config ${pc.cyan('extends')} to an invalid value, see https://vike.dev/extends`;
78
- let extendList;
79
- if (!('extends' in configFileExport)) {
80
- return [];
81
- }
82
- else if (hasProp(configFileExport, 'extends', 'string')) {
83
- extendList = [configFileExport.extends];
84
- }
85
- else if (hasProp(configFileExport, 'extends', 'string[]')) {
86
- extendList = configFileExport.extends;
87
- }
88
- else {
89
- assertUsage(false, wrongUsage);
76
+ const extendsConfigs = [];
77
+ const extendsPointerImportData = [];
78
+ if ('extends' in configFileExport) {
79
+ const extendsValue = configFileExport.extends;
80
+ const extendList = [];
81
+ const wrongUsage = `${filePathToShowToUser} sets the config ${pc.cyan('extends')} to an invalid value, see https://vike.dev/extends`;
82
+ if (typeof extendsValue === 'string') {
83
+ extendList.push(extendsValue);
84
+ }
85
+ else if (isArrayOfStrings(extendsValue)) {
86
+ extendList.push(...extendsValue);
87
+ }
88
+ else if (isObject(extendsValue)) {
89
+ /* If we want to implement this then we need to make filePath optional
90
+ extendsConfigs.push({
91
+ fileExports: extendsValue,
92
+ filePath: null,
93
+ })
94
+ */
95
+ assertUsage(false, wrongUsage);
96
+ }
97
+ else {
98
+ assertUsage(false, wrongUsage);
99
+ }
100
+ extendsPointerImportData.push(...extendList.map((importString) => {
101
+ const pointerImportData = parsePointerImportData(importString);
102
+ assertUsage(pointerImportData, wrongUsage);
103
+ return pointerImportData;
104
+ }));
90
105
  }
91
- const extendsPointerImportData = extendList.map((importString) => {
92
- const pointerImportData = parsePointerImportData(importString);
93
- assertUsage(pointerImportData, wrongUsage);
94
- return pointerImportData;
95
- });
96
- return extendsPointerImportData;
106
+ return { extendsPointerImportData, extendsConfigs };
97
107
  }
@@ -113,9 +113,9 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
113
113
  let resolved = await build.resolve(path, opts);
114
114
  if (debugEsbuildResolve.isActivated)
115
115
  debugEsbuildResolve('resolved', resolved);
116
- // Temporary workaround for https://github.com/vikejs/vike/issues/1729
117
- // - Required for esbuild@0.24.0 (November 2024).
118
- // - Let's try to remove this workaround after some time.
116
+ // Temporary workaround for https://github.com/evanw/esbuild/issues/3973
117
+ // - Sitll required for esbuild@0.24.0 (November 2024).
118
+ // - Let's try to remove this workaround again later.
119
119
  if (resolved.errors.length > 0) {
120
120
  let resolvedWithNode;
121
121
  try {
@@ -144,15 +144,16 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
144
144
  // - assertIsNpmPackageImport()
145
145
  // - isNpmPackageImport(str, { cannotBePathAlias: true })
146
146
  assertFilePathAbsoluteFilesystem(importPathResolved);
147
- // vike-{react,vue,solid} follow the convention that their config export resolves to a file named +config.js
148
- // - This is temporary, see comment below.
149
- const isVikeExtensionImport = importPathResolved.endsWith('+config.js');
147
+ // Should be remove this? See comment below.
148
+ const isVikeExtensionImport = (path.startsWith('vike-') && path.endsWith('/config')) || importPathResolved.endsWith('+config.js');
150
149
  const isPointerImport = transformImports === 'all' ||
151
150
  // .jsx, .vue, .svg, ... => obviously not config code => pointer import
152
151
  !isPlainJavaScriptFile(importPathResolved) ||
153
152
  // Import of a Vike extension config => make it a pointer import because we want to show nice error messages (that can display whether a config has been set by the user or by a Vike extension).
154
- // - TODO/eventually: stop doing this and, instead, let Node.js directly load vike-{react,vue,solid} while enforcing Vike extensions to set 'name' in their +config.js file.
155
- // - vike@0.4.162 already started soft-requiring Vike extensions to set the name config
153
+ // - Should we stop doing this? (And instead let Node.js directly load Vike extensions.)
154
+ // - In principle, we can use the setting 'name' value of Vike extensions.
155
+ // - vike@0.4.162 started soft-requiring Vike extensions to set the name config.
156
+ // - In practice, it seems like it requires some (non-trivial?) refactoring.
156
157
  isVikeExtensionImport;
157
158
  assertPosixPath(importPathResolved);
158
159
  const isNodeModules = importPathResolved.includes('/node_modules/');
@@ -21,12 +21,10 @@ function assertPlusFileExport(fileExports, filePathToShowToUser, configName) {
21
21
  const exportNamed = pc.code(`export { ${configName} }`);
22
22
  assert(exportNamesValid.length <= 2);
23
23
  if (exportNamesValid.length === 0) {
24
- assertUsage(false, `${filePathToShowToUser} should have a ${exportNamed} or ${exportDefault}`);
24
+ assertUsage(false, `${filePathToShowToUser} should have ${exportNamed} or ${exportDefault}`);
25
25
  }
26
26
  if (exportNamesValid.length === 2) {
27
- assertWarning(false, `${filePathToShowToUser} is ambiguous: remove ${exportDefault} or ${exportNamed}`, {
28
- onlyOnce: true
29
- });
27
+ assertUsage(false, `${filePathToShowToUser} is ambiguous: remove ${exportDefault} or ${exportNamed}`);
30
28
  }
31
29
  if (!TOLERATE_SIDE_EXPORTS.some((ext) => filePathToShowToUser.endsWith(ext))) {
32
30
  exportNamesInvalid.forEach((exportInvalid) => {
@@ -112,6 +112,7 @@ function parseValueSerialized(valueSerialized, configName, getDefinedAtFile) {
112
112
  const isSideExport = exportName !== 'default' && exportName !== configName;
113
113
  if (!isSideExport) {
114
114
  value = exportValue;
115
+ // Already asserted by assertPlusFileExport() call above.
115
116
  assert(!valueWasFound);
116
117
  valueWasFound = true;
117
118
  }
@@ -129,7 +130,7 @@ function parseValueSerialized(valueSerialized, configName, getDefinedAtFile) {
129
130
  });
130
131
  }
131
132
  });
132
- // Already validated by assertPlusFileExport() call above.
133
+ // Already asserted by assertPlusFileExport() call above.
133
134
  assert(valueWasFound);
134
135
  return { value, sideExports };
135
136
  }
@@ -1 +1 @@
1
- export declare const PROJECT_VERSION: "0.4.201";
1
+ export declare const PROJECT_VERSION: "0.4.203-commit-d47722f";
@@ -1,2 +1,2 @@
1
1
  // Automatically updated by @brillout/release-me
2
- export const PROJECT_VERSION = '0.4.201';
2
+ export const PROJECT_VERSION = '0.4.203-commit-d47722f';
@@ -1,4 +1,4 @@
1
1
  export declare const projectInfo: {
2
2
  projectName: "Vike";
3
- projectVersion: "0.4.201";
3
+ projectVersion: "0.4.203-commit-d47722f";
4
4
  };
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "vike",
3
- "version": "0.4.201",
3
+ "version": "0.4.203-commit-d47722f",
4
4
  "repository": "https://github.com/vikejs/vike",
5
5
  "exports": {
6
6
  "./server": {