vike 0.4.175-commit-fef43b1 → 0.4.176-commit-775d83b
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/filesystemRouting.js +17 -13
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +14 -6
- package/dist/cjs/shared/page-configs/getConfigValueBuildTime.js +0 -1
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +17 -13
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +14 -6
- package/dist/esm/shared/page-configs/getConfigValueBuildTime.js +0 -1
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +1 -1
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js
CHANGED
|
@@ -100,19 +100,7 @@ function removeIgnoredDirectories(somePath, ignoredDirs, removeParenthesesDirs)
|
|
|
100
100
|
return false;
|
|
101
101
|
}
|
|
102
102
|
if (removeParenthesesDirs && dir.startsWith('(') && dir.endsWith(')')) {
|
|
103
|
-
|
|
104
|
-
if (ignoredDirs.includes(dirname)) {
|
|
105
|
-
const dirnameActual = dir;
|
|
106
|
-
const dirnameCorect = dirname;
|
|
107
|
-
const dirpathActual = somePath.slice(0, somePath.indexOf(dirnameActual) + dirnameActual.length);
|
|
108
|
-
const dirpathCorect = dirpathActual.replaceAll(dirnameActual, dirnameCorect);
|
|
109
|
-
const logDir = (d) => picocolors_1.default.bold(d + '/');
|
|
110
|
-
(0, utils_js_1.assertWarning)(false, [
|
|
111
|
-
`The directories ${logDir(dirnameCorect)} are always ignored by Vike's Filesystem Routing`,
|
|
112
|
-
'(https://vike.dev/filesystem-routing):',
|
|
113
|
-
`rename directory ${logDir(dirpathActual)} to ${logDir(dirpathCorect)}`
|
|
114
|
-
].join(' '), { onlyOnce: true });
|
|
115
|
-
}
|
|
103
|
+
assertRedundantParentheses(dir, ignoredDirs, somePath);
|
|
116
104
|
return false;
|
|
117
105
|
}
|
|
118
106
|
return true;
|
|
@@ -122,6 +110,22 @@ function removeIgnoredDirectories(somePath, ignoredDirs, removeParenthesesDirs)
|
|
|
122
110
|
somePath = '/';
|
|
123
111
|
return somePath;
|
|
124
112
|
}
|
|
113
|
+
function assertRedundantParentheses(dir, ignoredDirs, somePath) {
|
|
114
|
+
const dirWithoutParentheses = dir.slice(1, -1);
|
|
115
|
+
if (!ignoredDirs.includes(dirWithoutParentheses)) {
|
|
116
|
+
return;
|
|
117
|
+
}
|
|
118
|
+
const dirnameActual = dir;
|
|
119
|
+
const dirnameCorect = dirWithoutParentheses;
|
|
120
|
+
const dirpathActual = somePath.slice(0, somePath.indexOf(dirnameActual) + dirnameActual.length);
|
|
121
|
+
const dirpathCorect = dirpathActual.replaceAll(dirnameActual, dirnameCorect);
|
|
122
|
+
const logDir = (d) => picocolors_1.default.bold(d + '/');
|
|
123
|
+
(0, utils_js_1.assertWarning)(false, [
|
|
124
|
+
`The directories ${logDir(dirnameCorect)} are always ignored by Vike's Filesystem Routing`,
|
|
125
|
+
'(https://vike.dev/filesystem-routing):',
|
|
126
|
+
`rename directory ${logDir(dirpathActual)} to ${logDir(dirpathCorect)}`
|
|
127
|
+
].join(' '), { onlyOnce: true });
|
|
128
|
+
}
|
|
125
129
|
function removeFilename(filePathAbsoluteUserRootDir) {
|
|
126
130
|
const filePathParts = filePathAbsoluteUserRootDir.split('/');
|
|
127
131
|
{
|
|
@@ -614,7 +614,7 @@ function getConfigDefinitions(interfaceFilesRelevant) {
|
|
|
614
614
|
if (!configMeta)
|
|
615
615
|
return;
|
|
616
616
|
const meta = configMeta.configValue;
|
|
617
|
-
|
|
617
|
+
assertMetaUsage(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 assertMetaUsage(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
|
+
assertMetaUsage(configValue, configDefinedAt);
|
|
713
713
|
(0, utils_js_1.objectEntries)(configValue).forEach(([configTargetName, configTargetDef]) => {
|
|
714
714
|
{
|
|
715
715
|
const keys = Object.keys(configTargetDef);
|
|
@@ -726,8 +726,13 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
726
726
|
}
|
|
727
727
|
else {
|
|
728
728
|
(0, utils_js_1.assertUsage)(false, notSupported);
|
|
729
|
-
|
|
730
|
-
|
|
729
|
+
/* To implement being able to set a config value in an effect:
|
|
730
|
+
* - Copy and append definedAtFile.fileExportPathToShowToUser with ['meta', configName, 'effect']
|
|
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
|
+
*/
|
|
731
736
|
}
|
|
732
737
|
});
|
|
733
738
|
}
|
|
@@ -900,7 +905,10 @@ function getConfigEnvValue(val, errMsgIntro) {
|
|
|
900
905
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(val, 'config', 'undefined') || (0, utils_js_1.hasProp)(val, 'config', 'boolean'), errInvalidValue);
|
|
901
906
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(val, 'server', 'undefined') || (0, utils_js_1.hasProp)(val, 'server', 'boolean'), errInvalidValue);
|
|
902
907
|
(0, utils_js_1.assertUsage)((0, utils_js_1.hasProp)(val, 'client', 'undefined') || (0, utils_js_1.hasProp)(val, 'client', 'boolean'), errInvalidValue);
|
|
903
|
-
/*
|
|
908
|
+
/* To allow users to set an eager config:
|
|
909
|
+
* - Uncomment line below.
|
|
910
|
+
* - Add 'eager' to assertKeys() call above.
|
|
911
|
+
* - Add `eager: boolean` to ConfigEnv type.
|
|
904
912
|
assertUsage(hasProp(val, 'eager', 'undefined') || hasProp(val, 'eager', 'boolean'), errInvalidValue)
|
|
905
913
|
*/
|
|
906
914
|
return val;
|
|
@@ -25,7 +25,6 @@ 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));
|
|
29
28
|
const configDef = configDefinitions[configName];
|
|
30
29
|
(0, utils_js_1.assert)(configDef);
|
|
31
30
|
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.
|
|
4
|
+
const PROJECT_VERSION = '0.4.176-commit-775d83b';
|
|
5
5
|
exports.PROJECT_VERSION = PROJECT_VERSION;
|
|
6
6
|
const projectInfo = {
|
|
7
7
|
projectName: 'Vike',
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js
CHANGED
|
@@ -97,19 +97,7 @@ function removeIgnoredDirectories(somePath, ignoredDirs, removeParenthesesDirs)
|
|
|
97
97
|
return false;
|
|
98
98
|
}
|
|
99
99
|
if (removeParenthesesDirs && dir.startsWith('(') && dir.endsWith(')')) {
|
|
100
|
-
|
|
101
|
-
if (ignoredDirs.includes(dirname)) {
|
|
102
|
-
const dirnameActual = dir;
|
|
103
|
-
const dirnameCorect = dirname;
|
|
104
|
-
const dirpathActual = somePath.slice(0, somePath.indexOf(dirnameActual) + dirnameActual.length);
|
|
105
|
-
const dirpathCorect = dirpathActual.replaceAll(dirnameActual, dirnameCorect);
|
|
106
|
-
const logDir = (d) => pc.bold(d + '/');
|
|
107
|
-
assertWarning(false, [
|
|
108
|
-
`The directories ${logDir(dirnameCorect)} are always ignored by Vike's Filesystem Routing`,
|
|
109
|
-
'(https://vike.dev/filesystem-routing):',
|
|
110
|
-
`rename directory ${logDir(dirpathActual)} to ${logDir(dirpathCorect)}`
|
|
111
|
-
].join(' '), { onlyOnce: true });
|
|
112
|
-
}
|
|
100
|
+
assertRedundantParentheses(dir, ignoredDirs, somePath);
|
|
113
101
|
return false;
|
|
114
102
|
}
|
|
115
103
|
return true;
|
|
@@ -119,6 +107,22 @@ function removeIgnoredDirectories(somePath, ignoredDirs, removeParenthesesDirs)
|
|
|
119
107
|
somePath = '/';
|
|
120
108
|
return somePath;
|
|
121
109
|
}
|
|
110
|
+
function assertRedundantParentheses(dir, ignoredDirs, somePath) {
|
|
111
|
+
const dirWithoutParentheses = dir.slice(1, -1);
|
|
112
|
+
if (!ignoredDirs.includes(dirWithoutParentheses)) {
|
|
113
|
+
return;
|
|
114
|
+
}
|
|
115
|
+
const dirnameActual = dir;
|
|
116
|
+
const dirnameCorect = dirWithoutParentheses;
|
|
117
|
+
const dirpathActual = somePath.slice(0, somePath.indexOf(dirnameActual) + dirnameActual.length);
|
|
118
|
+
const dirpathCorect = dirpathActual.replaceAll(dirnameActual, dirnameCorect);
|
|
119
|
+
const logDir = (d) => pc.bold(d + '/');
|
|
120
|
+
assertWarning(false, [
|
|
121
|
+
`The directories ${logDir(dirnameCorect)} are always ignored by Vike's Filesystem Routing`,
|
|
122
|
+
'(https://vike.dev/filesystem-routing):',
|
|
123
|
+
`rename directory ${logDir(dirpathActual)} to ${logDir(dirpathCorect)}`
|
|
124
|
+
].join(' '), { onlyOnce: true });
|
|
125
|
+
}
|
|
122
126
|
function removeFilename(filePathAbsoluteUserRootDir) {
|
|
123
127
|
const filePathParts = filePathAbsoluteUserRootDir.split('/');
|
|
124
128
|
{
|
|
@@ -610,7 +610,7 @@ function getConfigDefinitions(interfaceFilesRelevant) {
|
|
|
610
610
|
if (!configMeta)
|
|
611
611
|
return;
|
|
612
612
|
const meta = configMeta.configValue;
|
|
613
|
-
|
|
613
|
+
assertMetaUsage(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 assertMetaUsage(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
|
+
assertMetaUsage(configValue, configDefinedAt);
|
|
709
709
|
objectEntries(configValue).forEach(([configTargetName, configTargetDef]) => {
|
|
710
710
|
{
|
|
711
711
|
const keys = Object.keys(configTargetDef);
|
|
@@ -722,8 +722,13 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
722
722
|
}
|
|
723
723
|
else {
|
|
724
724
|
assertUsage(false, notSupported);
|
|
725
|
-
|
|
726
|
-
|
|
725
|
+
/* To implement being able to set a config value in an effect:
|
|
726
|
+
* - Copy and append definedAtFile.fileExportPathToShowToUser with ['meta', configName, 'effect']
|
|
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
|
+
*/
|
|
727
732
|
}
|
|
728
733
|
});
|
|
729
734
|
}
|
|
@@ -895,7 +900,10 @@ function getConfigEnvValue(val, errMsgIntro) {
|
|
|
895
900
|
assertUsage(hasProp(val, 'config', 'undefined') || hasProp(val, 'config', 'boolean'), errInvalidValue);
|
|
896
901
|
assertUsage(hasProp(val, 'server', 'undefined') || hasProp(val, 'server', 'boolean'), errInvalidValue);
|
|
897
902
|
assertUsage(hasProp(val, 'client', 'undefined') || hasProp(val, 'client', 'boolean'), errInvalidValue);
|
|
898
|
-
/*
|
|
903
|
+
/* To allow users to set an eager config:
|
|
904
|
+
* - Uncomment line below.
|
|
905
|
+
* - Add 'eager' to assertKeys() call above.
|
|
906
|
+
* - Add `eager: boolean` to ConfigEnv type.
|
|
899
907
|
assertUsage(hasProp(val, 'eager', 'undefined') || hasProp(val, 'eager', 'boolean'), errInvalidValue)
|
|
900
908
|
*/
|
|
901
909
|
return val;
|
|
@@ -22,7 +22,6 @@ 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));
|
|
26
25
|
const configDef = configDefinitions[configName];
|
|
27
26
|
assert(configDef);
|
|
28
27
|
if (!configDef.cumulative) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
export { PROJECT_VERSION };
|
|
3
|
-
declare const PROJECT_VERSION: "0.4.
|
|
3
|
+
declare const PROJECT_VERSION: "0.4.176-commit-775d83b";
|
|
4
4
|
declare const projectInfo: {
|
|
5
5
|
projectName: "Vike";
|
|
6
|
-
projectVersion: "0.4.
|
|
6
|
+
projectVersion: "0.4.176-commit-775d83b";
|
|
7
7
|
};
|