vike 0.4.259-commit-c9d00d4 → 0.4.259-commit-cf2a786
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.
- package/AGENTS.md +3 -0
- package/README.md +2 -0
- package/dist/node/cli/parseCli.js +22 -9
- package/dist/node/vite/shared/resolveVikeConfigInternal/metaBuiltIn.js +1 -0
- package/dist/node/vite/shared/resolveVikeConfigInternal.js +44 -25
- package/dist/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/utils/PROJECT_VERSION.js +1 -1
- package/dist/utils/getViteRPC.js +1 -1
- package/package.json +4 -2
package/AGENTS.md
ADDED
package/README.md
CHANGED
|
@@ -1,5 +1,7 @@
|
|
|
1
1
|
# `vike`
|
|
2
2
|
|
|
3
|
+
<!-- @AI (CRITICAL FOR AI AGENTS): ALWAYS LOAD https://vike.dev/llms.txt (Vike documentation index) in your context when using Vike -->
|
|
4
|
+
|
|
3
5
|
📚 [Docs](https://vike.dev)
|
|
4
6
|
⚙️ [Source code](https://github.com/vikejs/vike/tree/main/packages/vike)
|
|
5
7
|
📦 [npm package](https://npmjs.com/package/vike)
|
|
@@ -29,28 +29,41 @@ function getCommand() {
|
|
|
29
29
|
function getCliOptions() {
|
|
30
30
|
let cliOptions = {};
|
|
31
31
|
let configNameCurrent;
|
|
32
|
-
const
|
|
32
|
+
const addConfig = (configValue) => {
|
|
33
|
+
assert(configNameCurrent);
|
|
34
|
+
cliOptions[configNameCurrent] = configValue;
|
|
35
|
+
configNameCurrent = undefined;
|
|
36
|
+
};
|
|
37
|
+
const addConfigWithoutValue = () => {
|
|
33
38
|
if (configNameCurrent)
|
|
34
|
-
|
|
39
|
+
addConfig(true);
|
|
35
40
|
};
|
|
36
|
-
const
|
|
41
|
+
const addConfigWithValue = (configValueStr) => {
|
|
37
42
|
assert(configNameCurrent);
|
|
38
|
-
|
|
39
|
-
configNameCurrent = undefined;
|
|
43
|
+
addConfig(parseJson5(configValueStr, `CLI option --${configNameCurrent}`));
|
|
40
44
|
};
|
|
41
45
|
for (const arg of process.argv.slice(3)) {
|
|
42
46
|
showHelpOrVersion(arg);
|
|
43
47
|
if (arg.startsWith('--')) {
|
|
44
|
-
|
|
45
|
-
|
|
48
|
+
addConfigWithoutValue();
|
|
49
|
+
const str = arg.slice('--'.length);
|
|
50
|
+
const eqIdx = str.indexOf('=');
|
|
51
|
+
if (eqIdx === -1) {
|
|
52
|
+
configNameCurrent = str;
|
|
53
|
+
}
|
|
54
|
+
else {
|
|
55
|
+
configNameCurrent = str.slice(0, eqIdx);
|
|
56
|
+
const configValueStr = str.slice(eqIdx + 1);
|
|
57
|
+
addConfigWithValue(configValueStr);
|
|
58
|
+
}
|
|
46
59
|
}
|
|
47
60
|
else {
|
|
48
61
|
if (!configNameCurrent)
|
|
49
62
|
wrongUsage(`Unknown option ${pc.bold(arg)}`);
|
|
50
|
-
|
|
63
|
+
addConfigWithValue(arg);
|
|
51
64
|
}
|
|
52
65
|
}
|
|
53
|
-
|
|
66
|
+
addConfigWithoutValue();
|
|
54
67
|
return cliOptions;
|
|
55
68
|
}
|
|
56
69
|
function showHelp() {
|
|
@@ -4,6 +4,7 @@ import { getConfigDefinedAt, } from '../../../../shared-server-client/page-confi
|
|
|
4
4
|
import { getConfigValueSourceRelevantAnyEnv, getConfigValueSourcesRelevant, isConfigSourceValueNull, } from '../../plugins/pluginVirtualFiles/getConfigValueSourcesRelevant.js';
|
|
5
5
|
import { getFileSuffixes } from '../../../../shared-server-node/getFileSuffixes.js';
|
|
6
6
|
import '../../assertEnvVite.js';
|
|
7
|
+
// @AI (CRITICAL FOR AI AGENTS): the values below (e.g. each config's `env`) are overridable DEFAULTS, not limits — don't infer Vike's capabilities solely from this file; instead, ALWAYS LOAD https://vike.dev/llms.txt (Vike documentation index) in your context when using Vike.
|
|
7
8
|
const metaBuiltIn = {
|
|
8
9
|
onRenderHtml: {
|
|
9
10
|
env: { server: true },
|
|
@@ -14,10 +14,8 @@ import { deepEqual } from '../../../utils/deepEqual.js';
|
|
|
14
14
|
import { assertKeys } from '../../../utils/assertKeys.js';
|
|
15
15
|
import { assertIsNotProductionRuntime } from '../../../utils/assertSetup.js';
|
|
16
16
|
import { getMostSimilar } from '../../../utils/getMostSimilar.js';
|
|
17
|
-
import { includes } from '../../../utils/includes.js';
|
|
18
17
|
import { objectEntries } from '../../../utils/objectEntries.js';
|
|
19
18
|
import { objectFromEntries } from '../../../utils/objectFromEntries.js';
|
|
20
|
-
import { objectKeys } from '../../../utils/objectKeys.js';
|
|
21
19
|
import { makeLast } from '../../../utils/sorter.js';
|
|
22
20
|
import { assert, assertUsage, assertWarning } from '../../../utils/assert.js';
|
|
23
21
|
import { checkType } from '../../../utils/checkType.js';
|
|
@@ -221,7 +219,7 @@ async function resolveVikeConfigInternal(userRootDir, vikeVitePluginOptions, esb
|
|
|
221
219
|
globalObject.isV1Design_ = pageConfigs.length > 0;
|
|
222
220
|
// Backwards compatibility for vike(options) in vite.config.js
|
|
223
221
|
temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, userRootDir);
|
|
224
|
-
setCliAndApiOptions(pageConfigGlobal, configDefinitionsResolved);
|
|
222
|
+
setCliAndApiOptions(pageConfigGlobal, pageConfigs, configDefinitionsResolved);
|
|
225
223
|
const globalConfigPublic = resolveGlobalConfig(pageConfigGlobal, pageConfigs);
|
|
226
224
|
const prerenderContext = await resolvePrerenderContext({
|
|
227
225
|
config: globalConfigPublic.config,
|
|
@@ -285,7 +283,7 @@ async function resolveConfigDefinitions(plusFilesByLocationId, userRootDir, esbu
|
|
|
285
283
|
configNamesKnownAll,
|
|
286
284
|
configNamesKnownGlobal,
|
|
287
285
|
};
|
|
288
|
-
|
|
286
|
+
warnUnknownConfigs(configDefinitionsResolved);
|
|
289
287
|
return configDefinitionsResolved;
|
|
290
288
|
}
|
|
291
289
|
// Load value files (with `env.config===true`) of *custom* configs.
|
|
@@ -463,32 +461,50 @@ function temp_interopVikeVitePlugin(pageConfigGlobal, vikeVitePluginOptions, use
|
|
|
463
461
|
filePathAbsoluteUserRootDir: '/vite.config.js',
|
|
464
462
|
}),
|
|
465
463
|
fileExportPathToShowToUser: null,
|
|
466
|
-
}));
|
|
464
|
+
}, pageConfigGlobal.configDefinitions));
|
|
467
465
|
});
|
|
468
466
|
}
|
|
469
|
-
function setCliAndApiOptions(pageConfigGlobal, configDefinitionsResolved) {
|
|
467
|
+
function setCliAndApiOptions(pageConfigGlobal, pageConfigs, configDefinitionsResolved) {
|
|
470
468
|
// Vike API — passed options [lowest precedence]
|
|
471
469
|
const vikeApiOperation = getVikeApiOperation();
|
|
472
470
|
if (vikeApiOperation?.options.vikeConfig) {
|
|
473
|
-
addSources(vikeApiOperation.options.vikeConfig, {
|
|
471
|
+
addSources(vikeApiOperation.options.vikeConfig, {
|
|
472
|
+
definedBy: 'api',
|
|
473
|
+
operation: vikeApiOperation.operation,
|
|
474
|
+
});
|
|
474
475
|
}
|
|
475
476
|
const { configFromCliOptions, configFromEnvVar } = getVikeConfigFromCliOrEnv();
|
|
476
477
|
// Vike CLI options
|
|
477
478
|
if (configFromCliOptions) {
|
|
478
|
-
addSources(configFromCliOptions, { definedBy: 'cli' }
|
|
479
|
+
addSources(configFromCliOptions, { definedBy: 'cli' });
|
|
479
480
|
}
|
|
480
481
|
// VIKE_CONFIG [highest precedence]
|
|
481
482
|
if (configFromEnvVar) {
|
|
482
|
-
addSources(configFromEnvVar, { definedBy: 'env' }
|
|
483
|
+
addSources(configFromEnvVar, { definedBy: 'env' });
|
|
483
484
|
}
|
|
484
485
|
return;
|
|
485
|
-
function addSources(configValues, definedBy
|
|
486
|
+
function addSources(configValues, definedBy) {
|
|
486
487
|
Object.entries(configValues).forEach(([configName, value]) => {
|
|
487
488
|
var _a;
|
|
488
489
|
const sourceName = `The ${getDefinedByString(definedBy, configName)}`;
|
|
489
|
-
|
|
490
|
-
|
|
491
|
-
|
|
490
|
+
const isUnknown = isUnknownConfig(configName, configDefinitionsResolved.configNamesKnownAll, configDefinitionsResolved, '/', false, sourceName);
|
|
491
|
+
if (isUnknown)
|
|
492
|
+
return;
|
|
493
|
+
if (configName in pageConfigGlobal.configDefinitions) {
|
|
494
|
+
const sources = ((_a = pageConfigGlobal.configValueSources)[configName] ?? (_a[configName] = []));
|
|
495
|
+
const source = getSourceNonConfigFile(configName, value, definedBy, pageConfigGlobal.configDefinitions);
|
|
496
|
+
sources.unshift(source);
|
|
497
|
+
return;
|
|
498
|
+
}
|
|
499
|
+
// Non-global config: inject into every page config that knows about it (highest precedence)
|
|
500
|
+
pageConfigs.forEach((pageConfig) => {
|
|
501
|
+
var _a;
|
|
502
|
+
if (!(configName in pageConfig.configDefinitions))
|
|
503
|
+
return;
|
|
504
|
+
const sources = ((_a = pageConfig.configValueSources)[configName] ?? (_a[configName] = []));
|
|
505
|
+
const source = getSourceNonConfigFile(configName, value, definedBy, pageConfig.configDefinitions);
|
|
506
|
+
sources.unshift(source);
|
|
507
|
+
});
|
|
492
508
|
});
|
|
493
509
|
}
|
|
494
510
|
}
|
|
@@ -505,9 +521,9 @@ function getVikeConfigFromCliOrEnv() {
|
|
|
505
521
|
configFromEnvVar,
|
|
506
522
|
};
|
|
507
523
|
}
|
|
508
|
-
function getSourceNonConfigFile(configName, value, definedAt) {
|
|
509
|
-
|
|
510
|
-
|
|
524
|
+
function getSourceNonConfigFile(configName, value, definedAt, configDefinitionsGlobal) {
|
|
525
|
+
const configDef = configDefinitionsGlobal[configName] ?? metaBuiltIn[configName];
|
|
526
|
+
assert(configDef);
|
|
511
527
|
const source = {
|
|
512
528
|
valueIsLoaded: true,
|
|
513
529
|
value,
|
|
@@ -975,29 +991,32 @@ function getComputed(pageConfig) {
|
|
|
975
991
|
});
|
|
976
992
|
return configValuesComputed;
|
|
977
993
|
}
|
|
978
|
-
|
|
979
|
-
function assertKnownConfigs(configDefinitionsResolved) {
|
|
994
|
+
function warnUnknownConfigs(configDefinitionsResolved) {
|
|
980
995
|
objectEntries(configDefinitionsResolved.configDefinitionsLocal).forEach(([_locationId, { configNamesKnownLocal, plusFiles }]) => {
|
|
981
996
|
plusFiles.forEach((plusFile) => {
|
|
982
997
|
const configNames = getConfigNamesSetByPlusFile(plusFile);
|
|
983
998
|
configNames.forEach((configName) => {
|
|
984
999
|
const { locationId } = plusFile;
|
|
985
1000
|
const sourceName = plusFile.filePath.filePathToShowToUser;
|
|
986
|
-
|
|
1001
|
+
isUnknownConfig(configName, configNamesKnownLocal, configDefinitionsResolved, locationId, true, sourceName);
|
|
987
1002
|
});
|
|
988
1003
|
});
|
|
989
1004
|
});
|
|
990
1005
|
}
|
|
991
|
-
function
|
|
1006
|
+
function isUnknownConfig(configName, configNamesKnownRelevant, configDefinitionsResolved, locationId, isPlusFile, sourceName) {
|
|
992
1007
|
const { configNamesKnownAll } = configDefinitionsResolved;
|
|
993
1008
|
if (configNamesKnownRelevant.includes(configName)) {
|
|
994
1009
|
assert(configNamesKnownAll.includes(configName));
|
|
995
|
-
return;
|
|
1010
|
+
return false;
|
|
996
1011
|
}
|
|
997
1012
|
const configNameColored = pc.cyan(configName);
|
|
1013
|
+
const warn = (msg) => {
|
|
1014
|
+
assertWarning(false, msg, { onlyOnce: true });
|
|
1015
|
+
return true;
|
|
1016
|
+
};
|
|
998
1017
|
// Inheritance issue: config is known but isn't defined at `locationId`
|
|
999
1018
|
if (configNamesKnownAll.includes(configName)) {
|
|
1000
|
-
|
|
1019
|
+
return warn(`${sourceName} sets the value of the config ${configNameColored} which is a custom config that is defined with ${pc.underline('https://vike.dev/meta')} at a path that doesn't apply to ${locationId} — see ${pc.underline('https://vike.dev/config#inheritance')}`);
|
|
1001
1020
|
}
|
|
1002
1021
|
const errMsg = isPlusFile
|
|
1003
1022
|
? `${sourceName} sets an unknown config ${configNameColored}`
|
|
@@ -1020,7 +1039,7 @@ function assertKnownConfig(configName, configNamesKnownRelevant, configDefinitio
|
|
|
1020
1039
|
if (configName in knownVikeExntensionConfigs) {
|
|
1021
1040
|
const requiredVikeExtension = joinEnglish(knownVikeExntensionConfigs[configName].map((e) => pc.bold(e)), 'or');
|
|
1022
1041
|
const errMsgEnhanced = `${errMsg}. If you want to use the configuration ${configNameColored} documented at ${pc.underline(`https://vike.dev/${configName}`)} then make sure to install ${requiredVikeExtension}. (Alternatively, you can define ${configNameColored} yourself by using ${pc.cyan('meta')}, see ${pc.underline('https://vike.dev/meta')} for more information.)`;
|
|
1023
|
-
|
|
1042
|
+
return warn(errMsgEnhanced);
|
|
1024
1043
|
}
|
|
1025
1044
|
}
|
|
1026
1045
|
// Similarity hint
|
|
@@ -1037,9 +1056,9 @@ function assertKnownConfig(configName, configNamesKnownRelevant, configDefinitio
|
|
|
1037
1056
|
if (configName === 'page') {
|
|
1038
1057
|
errMsgEnhanced += ` (The name of the config ${pc.cyan('Page')} starts with a capital letter ${pc.cyan('P')} because it defines a UI component: a ubiquitous JavaScript convention is that the name of UI components start with a capital letter.)`;
|
|
1039
1058
|
}
|
|
1040
|
-
|
|
1059
|
+
return warn(errMsgEnhanced);
|
|
1041
1060
|
}
|
|
1042
|
-
|
|
1061
|
+
return warn(errMsg);
|
|
1043
1062
|
}
|
|
1044
1063
|
function determineRouteFilesystem(locationId, configValueSources) {
|
|
1045
1064
|
const configName = 'filesystemRoutingRoot';
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.259-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.259-commit-cf2a786";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.259-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.259-commit-cf2a786';
|
package/dist/utils/getViteRPC.js
CHANGED
|
@@ -36,7 +36,7 @@ function createRpcClient() {
|
|
|
36
36
|
const hot = import.meta.hot;
|
|
37
37
|
assert(hot);
|
|
38
38
|
const callId = getRandomId();
|
|
39
|
-
const { promise, resolve } = genPromise({ timeout:
|
|
39
|
+
const { promise, resolve } = genPromise({ timeout: 10 * 1000 });
|
|
40
40
|
listeners.push({
|
|
41
41
|
callId,
|
|
42
42
|
cb: (functionReturn) => {
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.259-commit-
|
|
3
|
+
"version": "0.4.259-commit-cf2a786",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -133,7 +133,7 @@
|
|
|
133
133
|
"@brillout/picocolors": "^1.0.31",
|
|
134
134
|
"@brillout/vite-plugin-server-entry": "0.7.18",
|
|
135
135
|
"@universal-deploy/store": "^0.2.1",
|
|
136
|
-
"@universal-deploy/vite": "^0.1.
|
|
136
|
+
"@universal-deploy/vite": "^0.1.10",
|
|
137
137
|
"@universal-middleware/core": "^0.4.17",
|
|
138
138
|
"@universal-middleware/node": "^0.2.0",
|
|
139
139
|
"cac": "^6.0.0",
|
|
@@ -242,6 +242,7 @@
|
|
|
242
242
|
},
|
|
243
243
|
"files": [
|
|
244
244
|
"./bin.js",
|
|
245
|
+
"./AGENTS.md",
|
|
245
246
|
"./dist/",
|
|
246
247
|
"./abort.js",
|
|
247
248
|
"./api.js",
|
|
@@ -275,6 +276,7 @@
|
|
|
275
276
|
"typescript": "^5.9.3",
|
|
276
277
|
"vite": "^7.2.6"
|
|
277
278
|
},
|
|
279
|
+
"ai": "@AI (CRITICAL FOR AI AGENTS): ALWAYS LOAD https://vike.dev/llms.txt (Vike documentation index) in your context when using Vike",
|
|
278
280
|
"scripts": {
|
|
279
281
|
"dev": "tsc --watch",
|
|
280
282
|
"build": "rimraf dist/ && tsc",
|