vike 0.4.176-commit-775d83b → 0.4.176
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/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -14
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +1 -0
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -14
- package/dist/esm/shared/page-configs/getConfigValueBuildTime.js +1 -0
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +1 -1
|
@@ -614,7 +614,7 @@ function getConfigDefinitions(interfaceFilesRelevant) {
|
|
|
614
614
|
if (!configMeta)
|
|
615
615
|
return;
|
|
616
616
|
const meta = configMeta.configValue;
|
|
617
|
-
|
|
617
|
+
assertMetaValue(meta, `Config ${picocolors_1.default.cyan('meta')} defined at ${interfaceFile.filePath.filePathToShowToUser}`);
|
|
618
618
|
// Set configDef._userEffectDefinedAtFilePath
|
|
619
619
|
Object.entries(meta).forEach(([configName, configDef]) => {
|
|
620
620
|
if (!configDef.effect)
|
|
@@ -637,7 +637,7 @@ function getConfigDefinitions(interfaceFilesRelevant) {
|
|
|
637
637
|
const configDefinitions = configDefinitionsMerged;
|
|
638
638
|
return configDefinitions;
|
|
639
639
|
}
|
|
640
|
-
function
|
|
640
|
+
function assertMetaValue(metaVal, metaConfigDefinedAt) {
|
|
641
641
|
if (!(0, utils_js_1.isObject)(metaVal)) {
|
|
642
642
|
(0, utils_js_1.assert)(metaConfigDefinedAt); // We expect internal effects to return a valid meta value
|
|
643
643
|
(0, utils_js_1.assertUsage)(false, `${metaConfigDefinedAt} has an invalid type ${picocolors_1.default.cyan(typeof metaVal)}: it should be an object instead.`);
|
|
@@ -709,7 +709,7 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
709
709
|
else {
|
|
710
710
|
configDefinedAt = null;
|
|
711
711
|
}
|
|
712
|
-
|
|
712
|
+
assertMetaValue(configValue, configDefinedAt);
|
|
713
713
|
(0, utils_js_1.objectEntries)(configValue).forEach(([configTargetName, configTargetDef]) => {
|
|
714
714
|
{
|
|
715
715
|
const keys = Object.keys(configTargetDef);
|
|
@@ -726,13 +726,8 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
726
726
|
}
|
|
727
727
|
else {
|
|
728
728
|
(0, utils_js_1.assertUsage)(false, notSupported);
|
|
729
|
-
|
|
730
|
-
|
|
731
|
-
* - Copying the definedAtFile of the config that defines the effect
|
|
732
|
-
* - Same precedence as the config that sets the value triggering the effect (not the config defining the effect)
|
|
733
|
-
* - Apply sortConfigValueSources() again?
|
|
734
|
-
configValueSources.push()
|
|
735
|
-
*/
|
|
729
|
+
// If we do end implementing being able to set the value of a config:
|
|
730
|
+
// - For setting definedAtFile: we could take the definedAtFile of the effect config while appending '(effect)' to definedAtFile.fileExportPathToShowToUser
|
|
736
731
|
}
|
|
737
732
|
});
|
|
738
733
|
}
|
|
@@ -905,10 +900,7 @@ function getConfigEnvValue(val, errMsgIntro) {
|
|
|
905
900
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(val, 'config', 'undefined') || (0, utils_js_1.hasProp)(val, 'config', 'boolean'), errInvalidValue);
|
|
906
901
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(val, 'server', 'undefined') || (0, utils_js_1.hasProp)(val, 'server', 'boolean'), errInvalidValue);
|
|
907
902
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(val, 'client', 'undefined') || (0, utils_js_1.hasProp)(val, 'client', 'boolean'), errInvalidValue);
|
|
908
|
-
/*
|
|
909
|
-
* - Uncomment line below.
|
|
910
|
-
* - Add 'eager' to assertKeys() call above.
|
|
911
|
-
* - Add `eager: boolean` to ConfigEnv type.
|
|
903
|
+
/* Uncomment to allow users to set an eager config. Same for `{ client: 'if-client-routing' }`.
|
|
912
904
|
assertUsage(hasProp(val, 'eager', 'undefined') || hasProp(val, 'eager', 'boolean'), errInvalidValue)
|
|
913
905
|
*/
|
|
914
906
|
return val;
|
|
@@ -25,6 +25,7 @@ function getConfigValue(pageConfig, configName) {
|
|
|
25
25
|
const sources = configValueSources[configName];
|
|
26
26
|
if (!sources)
|
|
27
27
|
return null;
|
|
28
|
+
(0, utils_js_1.assert)(sources.every((s) => s.configEnv.config === true));
|
|
28
29
|
const configDef = configDefinitions[configName];
|
|
29
30
|
(0, utils_js_1.assert)(configDef);
|
|
30
31
|
if (!configDef.cumulative) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PROJECT_VERSION = exports.projectInfo = void 0;
|
|
4
|
-
const PROJECT_VERSION = '0.4.176
|
|
4
|
+
const PROJECT_VERSION = '0.4.176';
|
|
5
5
|
exports.PROJECT_VERSION = PROJECT_VERSION;
|
|
6
6
|
const projectInfo = {
|
|
7
7
|
projectName: 'Vike',
|
|
@@ -610,7 +610,7 @@ function getConfigDefinitions(interfaceFilesRelevant) {
|
|
|
610
610
|
if (!configMeta)
|
|
611
611
|
return;
|
|
612
612
|
const meta = configMeta.configValue;
|
|
613
|
-
|
|
613
|
+
assertMetaValue(meta, `Config ${pc.cyan('meta')} defined at ${interfaceFile.filePath.filePathToShowToUser}`);
|
|
614
614
|
// Set configDef._userEffectDefinedAtFilePath
|
|
615
615
|
Object.entries(meta).forEach(([configName, configDef]) => {
|
|
616
616
|
if (!configDef.effect)
|
|
@@ -633,7 +633,7 @@ function getConfigDefinitions(interfaceFilesRelevant) {
|
|
|
633
633
|
const configDefinitions = configDefinitionsMerged;
|
|
634
634
|
return configDefinitions;
|
|
635
635
|
}
|
|
636
|
-
function
|
|
636
|
+
function assertMetaValue(metaVal, metaConfigDefinedAt) {
|
|
637
637
|
if (!isObject(metaVal)) {
|
|
638
638
|
assert(metaConfigDefinedAt); // We expect internal effects to return a valid meta value
|
|
639
639
|
assertUsage(false, `${metaConfigDefinedAt} has an invalid type ${pc.cyan(typeof metaVal)}: it should be an object instead.`);
|
|
@@ -705,7 +705,7 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
705
705
|
else {
|
|
706
706
|
configDefinedAt = null;
|
|
707
707
|
}
|
|
708
|
-
|
|
708
|
+
assertMetaValue(configValue, configDefinedAt);
|
|
709
709
|
objectEntries(configValue).forEach(([configTargetName, configTargetDef]) => {
|
|
710
710
|
{
|
|
711
711
|
const keys = Object.keys(configTargetDef);
|
|
@@ -722,13 +722,8 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
722
722
|
}
|
|
723
723
|
else {
|
|
724
724
|
assertUsage(false, notSupported);
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
* - Copying the definedAtFile of the config that defines the effect
|
|
728
|
-
* - Same precedence as the config that sets the value triggering the effect (not the config defining the effect)
|
|
729
|
-
* - Apply sortConfigValueSources() again?
|
|
730
|
-
configValueSources.push()
|
|
731
|
-
*/
|
|
725
|
+
// If we do end implementing being able to set the value of a config:
|
|
726
|
+
// - For setting definedAtFile: we could take the definedAtFile of the effect config while appending '(effect)' to definedAtFile.fileExportPathToShowToUser
|
|
732
727
|
}
|
|
733
728
|
});
|
|
734
729
|
}
|
|
@@ -900,10 +895,7 @@ function getConfigEnvValue(val, errMsgIntro) {
|
|
|
900
895
|
assertUsage(hasProp(val, 'config', 'undefined') || hasProp(val, 'config', 'boolean'), errInvalidValue);
|
|
901
896
|
assertUsage(hasProp(val, 'server', 'undefined') || hasProp(val, 'server', 'boolean'), errInvalidValue);
|
|
902
897
|
assertUsage(hasProp(val, 'client', 'undefined') || hasProp(val, 'client', 'boolean'), errInvalidValue);
|
|
903
|
-
/*
|
|
904
|
-
* - Uncomment line below.
|
|
905
|
-
* - Add 'eager' to assertKeys() call above.
|
|
906
|
-
* - Add `eager: boolean` to ConfigEnv type.
|
|
898
|
+
/* Uncomment to allow users to set an eager config. Same for `{ client: 'if-client-routing' }`.
|
|
907
899
|
assertUsage(hasProp(val, 'eager', 'undefined') || hasProp(val, 'eager', 'boolean'), errInvalidValue)
|
|
908
900
|
*/
|
|
909
901
|
return val;
|
|
@@ -22,6 +22,7 @@ function getConfigValue(pageConfig, configName) {
|
|
|
22
22
|
const sources = configValueSources[configName];
|
|
23
23
|
if (!sources)
|
|
24
24
|
return null;
|
|
25
|
+
assert(sources.every((s) => s.configEnv.config === true));
|
|
25
26
|
const configDef = configDefinitions[configName];
|
|
26
27
|
assert(configDef);
|
|
27
28
|
if (!configDef.cumulative) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
export { PROJECT_VERSION };
|
|
3
|
-
declare const PROJECT_VERSION: "0.4.176
|
|
3
|
+
declare const PROJECT_VERSION: "0.4.176";
|
|
4
4
|
declare const projectInfo: {
|
|
5
5
|
projectName: "Vike";
|
|
6
|
-
projectVersion: "0.4.176
|
|
6
|
+
projectVersion: "0.4.176";
|
|
7
7
|
};
|