vike 0.4.143 → 0.4.144-commit-e40e9b1
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/index.js +2 -2
- package/dist/cjs/node/plugin/plugins/buildConfig.js +1 -1
- package/dist/cjs/node/plugin/plugins/config/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +31 -30
- package/dist/cjs/node/plugin/plugins/importUserCode/generateEagerImport.js +19 -8
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +19 -10
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +2 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.js +6 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +4 -4
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +228 -186
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +11 -35
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +60 -95
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/helpers.js +12 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.js +18 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/replaceImportStatements.js +25 -25
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/transpileAndExecuteFile.js +14 -13
- package/dist/cjs/node/plugin/shared/findPageFiles.js +2 -1
- package/dist/cjs/node/plugin/shared/{getConfigValueSource.js → getConfigValueSourcesRelevant.js} +1 -12
- package/dist/cjs/node/plugin/shared/loggerNotProd.js +1 -1
- package/dist/cjs/node/plugin/utils.js +2 -3
- package/dist/cjs/node/prerender/runPrerender.js +18 -20
- package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +1 -1
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +2 -2
- package/dist/cjs/node/runtime/renderPage/loadPageFilesServerSide.js +2 -2
- package/dist/cjs/node/runtime/renderPage/log404/index.js +10 -5
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +3 -2
- package/dist/cjs/node/runtime/renderPage.js +1 -1
- package/dist/cjs/node/shared/getClientEntryFilePath.js +1 -7
- package/dist/cjs/shared/assertPageContextProvidedByUser.js +1 -1
- package/dist/cjs/shared/error-page.js +1 -1
- package/dist/cjs/shared/getPageFiles/getExports.js +8 -11
- package/dist/cjs/shared/getPageFiles/parseGlobResults.js +10 -44
- package/dist/cjs/shared/hooks/getHook.js +3 -1
- package/dist/cjs/shared/page-configs/assertExports.js +60 -0
- package/dist/cjs/shared/page-configs/getExportPath.js +9 -10
- package/dist/cjs/shared/page-configs/loadConfigValues.js +18 -0
- package/dist/cjs/shared/page-configs/serialize/PageConfigSerialized.js +2 -0
- package/dist/cjs/shared/page-configs/serialize/assertPageConfigs.js +19 -0
- package/dist/cjs/shared/page-configs/serialize/parseConfigValuesImported.js +56 -0
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +65 -0
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValue.js +58 -0
- package/dist/cjs/shared/page-configs/utils.js +65 -42
- package/dist/cjs/shared/route/loadPageRoutes.js +12 -15
- package/dist/cjs/shared/route/resolveRedirects.js +1 -1
- package/dist/cjs/shared/route/resolveRouteFunction.js +1 -0
- package/dist/cjs/shared/utils.js +0 -1
- package/dist/cjs/utils/getOutDirs.js +25 -18
- package/dist/cjs/utils/getValuePrintable.js +1 -1
- package/dist/cjs/utils/objectAssign.js +3 -1
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/cjs/utils/{resolve.js → requireResolve.js} +3 -3
- package/dist/cjs/utils/warnIfErrorIsNotObject.js +1 -1
- package/dist/esm/__internal/index.d.ts +3 -3
- package/dist/esm/client/client-routing-runtime/createPageContext.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/getPageContext.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/getPageId.d.ts +2 -2
- package/dist/esm/client/client-routing-runtime/useClientRouter.js +3 -3
- package/dist/esm/client/server-routing-runtime/getPageContext.d.ts +1 -1
- package/dist/esm/client/shared/executeOnRenderClientHook.d.ts +2 -2
- package/dist/esm/client/shared/loadPageFilesClientSide.d.ts +2 -2
- package/dist/esm/client/shared/loadPageFilesClientSide.js +2 -2
- package/dist/esm/client/shared/preparePageContextForUserConsumptionClientSide.d.ts +2 -2
- package/dist/esm/node/plugin/index.js +3 -2
- package/dist/esm/node/plugin/plugins/buildConfig.js +2 -2
- package/dist/esm/node/plugin/plugins/config/index.js +2 -2
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +31 -30
- package/dist/esm/node/plugin/plugins/importUserCode/generateEagerImport.d.ts +13 -2
- package/dist/esm/node/plugin/plugins/importUserCode/generateEagerImport.js +19 -8
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +20 -11
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.d.ts +19 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.js +6 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +5 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +4 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +4 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +229 -187
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +11 -32
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.d.ts +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +60 -95
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/helpers.d.ts +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/helpers.js +12 -5
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.d.ts +7 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.js +15 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/replaceImportStatements.d.ts +18 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/replaceImportStatements.js +25 -25
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/transpileAndExecuteFile.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/transpileAndExecuteFile.js +14 -13
- package/dist/esm/node/plugin/shared/findPageFiles.js +3 -2
- package/dist/esm/node/plugin/shared/{getConfigValueSource.d.ts → getConfigValueSourcesRelevant.d.ts} +0 -2
- package/dist/esm/node/plugin/shared/{getConfigValueSource.js → getConfigValueSourcesRelevant.js} +0 -11
- package/dist/esm/node/plugin/shared/loggerNotProd.js +2 -2
- package/dist/esm/node/plugin/utils.d.ts +1 -2
- package/dist/esm/node/plugin/utils.js +2 -3
- package/dist/esm/node/prerender/runPrerender.js +20 -22
- package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.js +1 -1
- package/dist/esm/node/runtime/html/injectAssets.d.ts +2 -2
- package/dist/esm/node/runtime/html/serializePageContextClientSide.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/analyzePage.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/analyzePage.js +2 -2
- package/dist/esm/node/runtime/renderPage/createHttpResponseObject.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/debugPageFiles.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/executeOnRenderHtmlHook.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/handleErrorWithoutErrorPage.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/loadPageFilesServerSide.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/loadPageFilesServerSide.js +2 -2
- package/dist/esm/node/runtime/renderPage/log404/index.js +10 -5
- package/dist/esm/node/runtime/renderPage/preparePageContextForUserConsumptionServerSide.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.d.ts +13 -13
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +3 -2
- package/dist/esm/node/runtime/renderPage.js +1 -1
- package/dist/esm/node/shared/getClientEntryFilePath.d.ts +2 -2
- package/dist/esm/node/shared/getClientEntryFilePath.js +2 -8
- package/dist/esm/shared/addIs404ToPageProps.d.ts +2 -2
- package/dist/esm/shared/addUrlComputedProps.d.ts +4 -2
- package/dist/esm/shared/assertPageContextProvidedByUser.js +1 -1
- package/dist/esm/shared/error-page.d.ts +3 -3
- package/dist/esm/shared/error-page.js +1 -1
- package/dist/esm/shared/getPageFiles/analyzeClientSide.d.ts +2 -2
- package/dist/esm/shared/getPageFiles/getExports.d.ts +3 -4
- package/dist/esm/shared/getPageFiles/getExports.js +7 -10
- package/dist/esm/shared/getPageFiles/parseGlobResults.d.ts +3 -3
- package/dist/esm/shared/getPageFiles/parseGlobResults.js +9 -43
- package/dist/esm/shared/getPageFiles/setPageFiles.d.ts +3 -3
- package/dist/esm/shared/hooks/getHook.js +3 -1
- package/dist/esm/shared/page-configs/Config.d.ts +201 -14
- package/dist/esm/shared/page-configs/PageConfig.d.ts +80 -73
- package/dist/esm/shared/page-configs/assertExports.d.ts +6 -0
- package/dist/esm/shared/page-configs/assertExports.js +54 -0
- package/dist/esm/shared/page-configs/findPageConfig.d.ts +2 -2
- package/dist/esm/shared/page-configs/getExportPath.d.ts +1 -1
- package/dist/esm/shared/page-configs/getExportPath.js +9 -10
- package/dist/esm/shared/page-configs/loadConfigValues.d.ts +3 -0
- package/dist/esm/shared/page-configs/loadConfigValues.js +15 -0
- package/dist/esm/shared/page-configs/serialize/PageConfigSerialized.d.ts +32 -0
- package/dist/esm/shared/page-configs/serialize/PageConfigSerialized.js +1 -0
- package/dist/esm/shared/page-configs/serialize/assertPageConfigs.d.ts +5 -0
- package/dist/esm/shared/page-configs/serialize/assertPageConfigs.js +16 -0
- package/dist/esm/shared/page-configs/serialize/parseConfigValuesImported.d.ts +4 -0
- package/dist/esm/shared/page-configs/serialize/parseConfigValuesImported.js +50 -0
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.d.ts +7 -0
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +62 -0
- package/dist/esm/shared/page-configs/serialize/serializeConfigValue.d.ts +8 -0
- package/dist/esm/shared/page-configs/serialize/serializeConfigValue.js +52 -0
- package/dist/esm/shared/page-configs/utils.d.ts +21 -14
- package/dist/esm/shared/page-configs/utils.js +64 -41
- package/dist/esm/shared/route/executeGuardHook.d.ts +2 -2
- package/dist/esm/shared/route/index.d.ts +3 -3
- package/dist/esm/shared/route/loadPageRoutes.d.ts +2 -2
- package/dist/esm/shared/route/loadPageRoutes.js +13 -16
- package/dist/esm/shared/route/resolveRedirects.js +1 -1
- package/dist/esm/shared/route/resolveRouteFunction.js +1 -0
- package/dist/esm/shared/types.d.ts +8 -6
- package/dist/esm/shared/utils.d.ts +0 -1
- package/dist/esm/shared/utils.js +0 -1
- package/dist/esm/types/index.d.ts +2 -1
- package/dist/esm/utils/getOutDirs.d.ts +0 -2
- package/dist/esm/utils/getOutDirs.js +24 -17
- package/dist/esm/utils/getValuePrintable.js +1 -1
- package/dist/esm/utils/objectAssign.js +3 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/dist/esm/utils/projectInfo.js +1 -1
- package/dist/esm/utils/requireResolve.d.ts +2 -0
- package/dist/esm/utils/{resolve.js → requireResolve.js} +2 -2
- package/dist/esm/utils/warnIfErrorIsNotObject.js +1 -1
- package/package.json +2 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/isConfigEnvMatch.js +0 -13
- package/dist/cjs/shared/getPageFiles/assertPageConfigs.js +0 -19
- package/dist/cjs/shared/page-configs/loadPageCode.js +0 -63
- package/dist/cjs/utils/assertDefaultExport.js +0 -53
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/isConfigEnvMatch.d.ts +0 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/isConfigEnvMatch.js +0 -10
- package/dist/esm/shared/getPageFiles/assertPageConfigs.d.ts +0 -5
- package/dist/esm/shared/getPageFiles/assertPageConfigs.js +0 -16
- package/dist/esm/shared/page-configs/loadPageCode.d.ts +0 -3
- package/dist/esm/shared/page-configs/loadPageCode.js +0 -57
- package/dist/esm/utils/assertDefaultExport.d.ts +0 -8
- package/dist/esm/utils/assertDefaultExport.js +0 -47
- package/dist/esm/utils/resolve.d.ts +0 -2
- /package/dist/cjs/shared/getPageFiles/{assertExports.js → assert_exports_old_design.js} +0 -0
- /package/dist/esm/shared/getPageFiles/{assertExports.d.ts → assert_exports_old_design.d.ts} +0 -0
- /package/dist/esm/shared/getPageFiles/{assertExports.js → assert_exports_old_design.js} +0 -0
|
@@ -18,6 +18,7 @@ const removeSuperfluousViteLog_js_1 = require("../../../shared/loggerVite/remove
|
|
|
18
18
|
const getFilePathToShowToUser_js_1 = require("./getFilePathToShowToUser.js");
|
|
19
19
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
20
20
|
const utils_js_2 = require("../../../../../shared/page-configs/utils.js");
|
|
21
|
+
const assertExports_js_1 = require("../../../../../shared/page-configs/assertExports.js");
|
|
21
22
|
const getVirtualFilePageConfigs_js_1 = require("./getVirtualFilePageConfigs.js");
|
|
22
23
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
23
24
|
let devServerIsCorrupt = false;
|
|
@@ -25,11 +26,11 @@ let wasConfigInvalid = null;
|
|
|
25
26
|
let vikeConfigPromise = null;
|
|
26
27
|
const vikeConfigDependencies = new Set();
|
|
27
28
|
exports.vikeConfigDependencies = vikeConfigDependencies;
|
|
28
|
-
const
|
|
29
|
-
function reloadVikeConfig(userRootDir, extensions) {
|
|
29
|
+
const filesEnv = new Map();
|
|
30
|
+
function reloadVikeConfig(userRootDir, outDirRoot, extensions) {
|
|
30
31
|
vikeConfigDependencies.clear();
|
|
31
|
-
|
|
32
|
-
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, true, extensions, true);
|
|
32
|
+
filesEnv.clear();
|
|
33
|
+
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, true, extensions, true);
|
|
33
34
|
handleReloadSideEffects();
|
|
34
35
|
}
|
|
35
36
|
exports.reloadVikeConfig = reloadVikeConfig;
|
|
@@ -64,15 +65,15 @@ async function handleReloadSideEffects() {
|
|
|
64
65
|
}
|
|
65
66
|
}
|
|
66
67
|
}
|
|
67
|
-
async function getVikeConfig(userRootDir, isDev, extensions, tolerateInvalidConfig = false) {
|
|
68
|
+
async function getVikeConfig(userRootDir, outDirRoot, isDev, extensions, tolerateInvalidConfig = false) {
|
|
68
69
|
if (!vikeConfigPromise) {
|
|
69
|
-
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, isDev, extensions, tolerateInvalidConfig);
|
|
70
|
+
vikeConfigPromise = loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, isDev, extensions, tolerateInvalidConfig);
|
|
70
71
|
}
|
|
71
72
|
return await vikeConfigPromise;
|
|
72
73
|
}
|
|
73
74
|
exports.getVikeConfig = getVikeConfig;
|
|
74
|
-
async function loadInterfaceFiles(userRootDir, isDev, extensions) {
|
|
75
|
-
const plusFiles = await findPlusFiles(userRootDir, isDev, extensions);
|
|
75
|
+
async function loadInterfaceFiles(userRootDir, outDirRoot, isDev, extensions) {
|
|
76
|
+
const plusFiles = await findPlusFiles(userRootDir, [outDirRoot], isDev, extensions);
|
|
76
77
|
const configFiles = [];
|
|
77
78
|
const valueFiles = [];
|
|
78
79
|
plusFiles.forEach((f) => {
|
|
@@ -88,7 +89,8 @@ async function loadInterfaceFiles(userRootDir, isDev, extensions) {
|
|
|
88
89
|
await Promise.all(configFiles.map(async ({ filePathAbsolute, filePathRelativeToUserRootDir }) => {
|
|
89
90
|
const configFilePath = {
|
|
90
91
|
filePathAbsolute: filePathAbsolute,
|
|
91
|
-
filePathRelativeToUserRootDir: filePathRelativeToUserRootDir
|
|
92
|
+
filePathRelativeToUserRootDir: filePathRelativeToUserRootDir,
|
|
93
|
+
importPathAbsolute: null
|
|
92
94
|
};
|
|
93
95
|
const { configFile, extendsConfigs } = await loadConfigFile(configFilePath, userRootDir, []);
|
|
94
96
|
const interfaceFile = getInterfaceFileFromConfigFile(configFile, false);
|
|
@@ -102,27 +104,28 @@ async function loadInterfaceFiles(userRootDir, isDev, extensions) {
|
|
|
102
104
|
}));
|
|
103
105
|
// Value files
|
|
104
106
|
await Promise.all(valueFiles.map(async ({ filePathAbsolute, filePathRelativeToUserRootDir }) => {
|
|
105
|
-
const
|
|
106
|
-
(0, utils_js_1.assert)(
|
|
107
|
+
const configName = getConfigName(filePathRelativeToUserRootDir);
|
|
108
|
+
(0, utils_js_1.assert)(configName);
|
|
107
109
|
const interfaceFile = {
|
|
108
110
|
filePath: {
|
|
109
111
|
filePathRelativeToUserRootDir,
|
|
110
|
-
filePathAbsolute
|
|
112
|
+
filePathAbsolute,
|
|
113
|
+
importPathAbsolute: null
|
|
111
114
|
},
|
|
112
115
|
configMap: {
|
|
113
|
-
[
|
|
116
|
+
[configName]: {}
|
|
114
117
|
},
|
|
115
118
|
isConfigFile: false,
|
|
116
119
|
isValueFile: true,
|
|
117
|
-
|
|
120
|
+
configName
|
|
118
121
|
};
|
|
119
122
|
{
|
|
120
123
|
// We don't have access to custom config definitions yet
|
|
121
|
-
// - We load +
|
|
124
|
+
// - We load +{configName}.js later
|
|
122
125
|
// - But we do need to eagerly load +meta.js (to get all the custom config definitions)
|
|
123
|
-
const configDef = getConfigDefinitionOptional(configDefinitionsBuiltIn_js_1.configDefinitionsBuiltIn,
|
|
126
|
+
const configDef = getConfigDefinitionOptional(configDefinitionsBuiltIn_js_1.configDefinitionsBuiltIn, configName);
|
|
124
127
|
if (configDef?.env === 'config-only') {
|
|
125
|
-
await loadValueFile(interfaceFile,
|
|
128
|
+
await loadValueFile(interfaceFile, configName, userRootDir);
|
|
126
129
|
}
|
|
127
130
|
}
|
|
128
131
|
{
|
|
@@ -142,14 +145,13 @@ function getConfigDefinition(configDefinitionsRelevant, configName, definedByFil
|
|
|
142
145
|
function getConfigDefinitionOptional(configDefinitions, configName) {
|
|
143
146
|
return configDefinitions[configName] ?? null;
|
|
144
147
|
}
|
|
145
|
-
async function loadValueFile(interfaceValueFile,
|
|
148
|
+
async function loadValueFile(interfaceValueFile, configName, userRootDir) {
|
|
146
149
|
const { fileExports } = await (0, transpileAndExecuteFile_js_1.transpileAndExecuteFile)(interfaceValueFile.filePath, true, userRootDir);
|
|
147
|
-
|
|
148
|
-
|
|
149
|
-
|
|
150
|
-
|
|
151
|
-
}
|
|
152
|
-
interfaceValueFile.configMap[configName] = { configValue };
|
|
150
|
+
const filePathToShowToUser = (0, getFilePathToShowToUser_js_1.getFilePathToShowToUser)(interfaceValueFile.filePath);
|
|
151
|
+
(0, assertExports_js_1.assertExportsOfValueFile)(fileExports, filePathToShowToUser, configName);
|
|
152
|
+
Object.entries(fileExports).forEach(([exportName, configValue]) => {
|
|
153
|
+
const configName_ = exportName === 'default' ? configName : exportName;
|
|
154
|
+
interfaceValueFile.configMap[configName_] = { configValue };
|
|
153
155
|
});
|
|
154
156
|
}
|
|
155
157
|
function getInterfaceFileFromConfigFile(configFile, isConfigExtend) {
|
|
@@ -162,19 +164,19 @@ function getInterfaceFileFromConfigFile(configFile, isConfigExtend) {
|
|
|
162
164
|
isConfigExtend,
|
|
163
165
|
extendsFilePaths
|
|
164
166
|
};
|
|
165
|
-
const
|
|
166
|
-
(0,
|
|
167
|
+
const filePathToShowToUser = (0, getFilePathToShowToUser_js_1.getFilePathToShowToUser)(filePath);
|
|
168
|
+
(0, assertExports_js_1.assertExportsOfConfigFile)(fileExports, filePathToShowToUser);
|
|
167
169
|
Object.entries(fileExports.default).forEach(([configName, configValue]) => {
|
|
168
170
|
interfaceFile.configMap[configName] = { configValue };
|
|
169
171
|
});
|
|
170
172
|
return interfaceFile;
|
|
171
173
|
}
|
|
172
|
-
async function loadVikeConfig_withErrorHandling(userRootDir, isDev, extensions, tolerateInvalidConfig) {
|
|
174
|
+
async function loadVikeConfig_withErrorHandling(userRootDir, outDirRoot, isDev, extensions, tolerateInvalidConfig) {
|
|
173
175
|
let hasError = false;
|
|
174
176
|
let ret;
|
|
175
177
|
let err;
|
|
176
178
|
try {
|
|
177
|
-
ret = await loadVikeConfig(userRootDir, isDev, extensions);
|
|
179
|
+
ret = await loadVikeConfig(userRootDir, outDirRoot, isDev, extensions);
|
|
178
180
|
}
|
|
179
181
|
catch (err_) {
|
|
180
182
|
hasError = true;
|
|
@@ -202,8 +204,7 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, extensions,
|
|
|
202
204
|
const dummyData = {
|
|
203
205
|
pageConfigs: [],
|
|
204
206
|
pageConfigGlobal: {
|
|
205
|
-
|
|
206
|
-
onBeforeRoute: null
|
|
207
|
+
configValueSources: {}
|
|
207
208
|
},
|
|
208
209
|
globalVikeConfig: {}
|
|
209
210
|
};
|
|
@@ -211,8 +212,8 @@ async function loadVikeConfig_withErrorHandling(userRootDir, isDev, extensions,
|
|
|
211
212
|
}
|
|
212
213
|
}
|
|
213
214
|
}
|
|
214
|
-
async function loadVikeConfig(userRootDir, isDev, extensions) {
|
|
215
|
-
const interfaceFilesByLocationId = await loadInterfaceFiles(userRootDir, isDev, extensions);
|
|
215
|
+
async function loadVikeConfig(userRootDir, outDirRoot, isDev, extensions) {
|
|
216
|
+
const interfaceFilesByLocationId = await loadInterfaceFiles(userRootDir, outDirRoot, isDev, extensions);
|
|
216
217
|
const { globalVikeConfig, pageConfigGlobal } = getGlobalConfigs(interfaceFilesByLocationId, userRootDir);
|
|
217
218
|
const pageConfigs = await Promise.all(Object.entries(interfaceFilesByLocationId)
|
|
218
219
|
.filter(([_pageId, interfaceFiles]) => isDefiningPage(interfaceFiles))
|
|
@@ -223,18 +224,18 @@ async function loadVikeConfig(userRootDir, isDev, extensions) {
|
|
|
223
224
|
await Promise.all(getInterfaceFileList(interfaceFilesRelevant).map(async (interfaceFile) => {
|
|
224
225
|
if (!interfaceFile.isValueFile)
|
|
225
226
|
return;
|
|
226
|
-
const {
|
|
227
|
-
if (isGlobalConfig(
|
|
227
|
+
const { configName } = interfaceFile;
|
|
228
|
+
if (isGlobalConfig(configName))
|
|
228
229
|
return;
|
|
229
|
-
const configDef = getConfigDefinition(configDefinitionsRelevant,
|
|
230
|
+
const configDef = getConfigDefinition(configDefinitionsRelevant, configName, (0, getFilePathToShowToUser_js_1.getFilePathToShowToUser)(interfaceFile.filePath));
|
|
230
231
|
if (configDef.env !== 'config-only')
|
|
231
232
|
return;
|
|
232
233
|
const isAlreadyLoaded = interfacefileIsAlreaydLoaded(interfaceFile);
|
|
233
234
|
if (isAlreadyLoaded)
|
|
234
235
|
return;
|
|
235
236
|
// Value files for built-in confg-only configs should have already been loaded at loadInterfaceFiles()
|
|
236
|
-
(0, utils_js_1.assert)(!(
|
|
237
|
-
await loadValueFile(interfaceFile,
|
|
237
|
+
(0, utils_js_1.assert)(!(configName in configDefinitionsBuiltIn_js_1.configDefinitionsBuiltIn));
|
|
238
|
+
await loadValueFile(interfaceFile, configName, userRootDir);
|
|
238
239
|
}));
|
|
239
240
|
const configValueSources = {};
|
|
240
241
|
(0, utils_js_1.objectEntries)(configDefinitionsRelevant)
|
|
@@ -246,17 +247,17 @@ async function loadVikeConfig(userRootDir, isDev, extensions) {
|
|
|
246
247
|
configValueSources[configName] = sources;
|
|
247
248
|
});
|
|
248
249
|
const { routeFilesystem, isErrorPage } = determineRouteFilesystem(locationId, configValueSources);
|
|
250
|
+
applyEffectsAll(configValueSources, configDefinitionsRelevant);
|
|
251
|
+
const configValuesComputed = getComputed(configValueSources, configDefinitionsRelevant);
|
|
252
|
+
const configValues = getConfigValues(configValueSources, configValuesComputed, configDefinitionsRelevant);
|
|
249
253
|
const pageConfig = {
|
|
250
254
|
pageId: locationId,
|
|
251
255
|
isErrorPage,
|
|
252
256
|
routeFilesystem,
|
|
253
257
|
configValueSources,
|
|
254
|
-
|
|
258
|
+
configValuesComputed,
|
|
259
|
+
configValues
|
|
255
260
|
};
|
|
256
|
-
applyEffects(pageConfig, configDefinitionsRelevant);
|
|
257
|
-
pageConfig.configValues = getConfigValues(configValueSources, configDefinitionsRelevant);
|
|
258
|
-
applyComputed(pageConfig, configDefinitionsRelevant);
|
|
259
|
-
pageConfig.configValues = getConfigValues(configValueSources, configDefinitionsRelevant);
|
|
260
261
|
return pageConfig;
|
|
261
262
|
}));
|
|
262
263
|
// Show error message upon unknown config
|
|
@@ -328,24 +329,24 @@ function getGlobalConfigs(interfaceFilesByLocationId, userRootDir) {
|
|
|
328
329
|
}
|
|
329
330
|
const globalVikeConfig = {};
|
|
330
331
|
const pageConfigGlobal = {
|
|
331
|
-
|
|
332
|
-
onPrerenderStart: null
|
|
332
|
+
configValueSources: {}
|
|
333
333
|
};
|
|
334
334
|
(0, utils_js_1.objectEntries)(configDefinitionsBuiltIn_js_1.configDefinitionsBuiltInGlobal).forEach(([configName, configDef]) => {
|
|
335
335
|
const sources = resolveConfigValueSources(configName, configDef, interfaceFilesGlobal, userRootDir);
|
|
336
336
|
const configValueSource = sources?.[0];
|
|
337
337
|
if (!configValueSource)
|
|
338
338
|
return;
|
|
339
|
-
if (
|
|
339
|
+
if (configName === 'onBeforeRoute' || configName === 'onPrerenderStart') {
|
|
340
340
|
(0, utils_js_1.assert)(!('value' in configValueSource));
|
|
341
|
-
pageConfigGlobal[configName] = configValueSource;
|
|
341
|
+
pageConfigGlobal.configValueSources[configName] = [configValueSource];
|
|
342
342
|
}
|
|
343
343
|
else {
|
|
344
344
|
(0, utils_js_1.assert)('value' in configValueSource);
|
|
345
345
|
if (configName === 'prerender' && typeof configValueSource.value === 'boolean')
|
|
346
346
|
return;
|
|
347
|
-
|
|
348
|
-
(0, utils_js_1.
|
|
347
|
+
const sourceFilePath = getDefinedAtFilePathToShowToUser(configValueSource.definedAtInfo);
|
|
348
|
+
(0, utils_js_1.assert)(sourceFilePath);
|
|
349
|
+
(0, utils_js_1.assertWarning)(false, `Being able to define config ${picocolors_1.default.cyan(configName)} in ${sourceFilePath} is experimental and will likely be removed. Define the config ${picocolors_1.default.cyan(configName)} in Vike's Vite plugin options instead.`, { onlyOnce: true });
|
|
349
350
|
globalVikeConfig[configName] = configValueSource.value;
|
|
350
351
|
}
|
|
351
352
|
});
|
|
@@ -370,8 +371,8 @@ function resolveConfigValueSources(configName, configDef, interfaceFilesRelevant
|
|
|
370
371
|
{
|
|
371
372
|
const interfaceValueFiles = interfaceFilesDefiningConfig
|
|
372
373
|
.filter((interfaceFile) => interfaceFile.isValueFile &&
|
|
373
|
-
// We consider side-effect
|
|
374
|
-
interfaceFile.
|
|
374
|
+
// We consider side-effect configs (e.g. `export { frontmatter }` of .mdx files) later (i.e. with less priority)
|
|
375
|
+
interfaceFile.configName === configName)
|
|
375
376
|
.sort(makeOrderDeterministic);
|
|
376
377
|
const interfaceConfigFiles = interfaceFilesDefiningConfig
|
|
377
378
|
.filter((interfaceFile) => interfaceFile.isConfigFile &&
|
|
@@ -381,9 +382,9 @@ function resolveConfigValueSources(configName, configDef, interfaceFilesRelevant
|
|
|
381
382
|
const interfaceValueFile = interfaceValueFiles[0];
|
|
382
383
|
const interfaceConfigFile = interfaceConfigFiles[0];
|
|
383
384
|
// Make this value:
|
|
384
|
-
// /pages/some-page/+
|
|
385
|
+
// /pages/some-page/+{configName}.js > `export default`
|
|
385
386
|
// override that value:
|
|
386
|
-
// /pages/some-page/+config > `export default { someConfig }`
|
|
387
|
+
// /pages/some-page/+config.h.js > `export default { someConfig }`
|
|
387
388
|
const interfaceFileWinner = interfaceValueFile ?? interfaceConfigFile;
|
|
388
389
|
if (interfaceFileWinner) {
|
|
389
390
|
const interfaceFilesOverriden = [...interfaceValueFiles, ...interfaceConfigFiles].filter((f) => f !== interfaceFileWinner);
|
|
@@ -397,8 +398,8 @@ function resolveConfigValueSources(configName, configDef, interfaceFilesRelevant
|
|
|
397
398
|
// Side-effect configs such as `export { frontmatter }` in .mdx files
|
|
398
399
|
interfaceFilesDefiningConfig
|
|
399
400
|
.filter((interfaceFile) => interfaceFile.isValueFile &&
|
|
400
|
-
// Is side-effect
|
|
401
|
-
interfaceFile.
|
|
401
|
+
// Is side-effect config
|
|
402
|
+
interfaceFile.configName !== configName)
|
|
402
403
|
.forEach((interfaceValueFileSideEffect) => {
|
|
403
404
|
add(interfaceValueFileSideEffect);
|
|
404
405
|
});
|
|
@@ -428,66 +429,57 @@ function warnOverridenConfigValues(interfaceFileWinner, interfaceFilesOverriden,
|
|
|
428
429
|
interfaceFilesOverriden.forEach((interfaceFileLoser) => {
|
|
429
430
|
const configValueSourceWinner = getConfigValueSource(configName, interfaceFileWinner, configDef, userRootDir);
|
|
430
431
|
const configValueSourceLoser = getConfigValueSource(configName, interfaceFileLoser, configDef, userRootDir);
|
|
431
|
-
(0, utils_js_1.assertWarning)(false, `${(
|
|
432
|
+
(0, utils_js_1.assertWarning)(false, `${getConfigSourceDefinedAtString(configName, configValueSourceLoser, undefined, true)} overriden by another ${getConfigSourceDefinedAtString(configName, configValueSourceWinner, undefined, false)}, remove one of the two`, { onlyOnce: false });
|
|
432
433
|
});
|
|
433
434
|
}
|
|
434
435
|
function isInterfaceFileUserLand(interfaceFile) {
|
|
435
436
|
return (interfaceFile.isConfigFile && !interfaceFile.isConfigExtend) || interfaceFile.isValueFile;
|
|
436
437
|
}
|
|
437
438
|
function getConfigValueSource(configName, interfaceFile, configDef, userRootDir) {
|
|
438
|
-
// TODO: rethink file paths of ConfigElement
|
|
439
|
-
const configFilePath = interfaceFile.filePath.filePathRelativeToUserRootDir ?? interfaceFile.filePath.filePathAbsolute;
|
|
440
439
|
const conf = interfaceFile.configMap[configName];
|
|
441
440
|
(0, utils_js_1.assert)(conf);
|
|
442
441
|
const configEnv = configDef.env;
|
|
443
|
-
const
|
|
444
|
-
filePath
|
|
442
|
+
const definedAtConfigFile = {
|
|
443
|
+
...interfaceFile.filePath,
|
|
445
444
|
fileExportPath: ['default', configName]
|
|
446
445
|
};
|
|
447
446
|
if (configDef._valueIsFilePath) {
|
|
448
|
-
let
|
|
447
|
+
let definedAtInfo;
|
|
448
|
+
let valueFilePath;
|
|
449
449
|
if (interfaceFile.isConfigFile) {
|
|
450
450
|
const { configValue } = conf;
|
|
451
|
-
const import_ =
|
|
452
|
-
const configDefinedAt = (
|
|
451
|
+
const import_ = resolveImport(configValue, interfaceFile.filePath, userRootDir, configEnv, configName);
|
|
452
|
+
const configDefinedAt = getConfigSourceDefinedAtString(configName, { definedAtInfo: definedAtConfigFile });
|
|
453
453
|
(0, utils_js_1.assertUsage)(import_, `${configDefinedAt} should be an import`);
|
|
454
|
-
|
|
454
|
+
valueFilePath = import_.filePathRelativeToUserRootDir ?? import_.importPathAbsolute;
|
|
455
|
+
definedAtInfo = import_;
|
|
455
456
|
}
|
|
456
457
|
else {
|
|
457
458
|
(0, utils_js_1.assert)(interfaceFile.isValueFile);
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
459
|
+
valueFilePath = interfaceFile.filePath.filePathRelativeToUserRootDir;
|
|
460
|
+
definedAtInfo = {
|
|
461
|
+
...interfaceFile.filePath,
|
|
462
|
+
fileExportPath: []
|
|
463
|
+
};
|
|
462
464
|
}
|
|
463
465
|
const configValueSource = {
|
|
464
|
-
value:
|
|
466
|
+
value: valueFilePath,
|
|
465
467
|
valueIsFilePath: true,
|
|
466
468
|
configEnv,
|
|
467
469
|
valueIsImportedAtRuntime: true,
|
|
468
|
-
|
|
469
|
-
definedAtInfo: {
|
|
470
|
-
filePath,
|
|
471
|
-
fileExportPath: []
|
|
472
|
-
}
|
|
470
|
+
definedAtInfo
|
|
473
471
|
};
|
|
474
472
|
return configValueSource;
|
|
475
473
|
}
|
|
476
474
|
if (interfaceFile.isConfigFile) {
|
|
477
475
|
(0, utils_js_1.assert)('configValue' in conf);
|
|
478
476
|
const { configValue } = conf;
|
|
479
|
-
const import_ =
|
|
477
|
+
const import_ = resolveImport(configValue, interfaceFile.filePath, userRootDir, configEnv, configName);
|
|
480
478
|
if (import_) {
|
|
481
|
-
const { importFilePath, importFileExportName } = import_;
|
|
482
|
-
assertCodeFileEnv(importFilePath, configEnv, configName);
|
|
483
479
|
const configValueSource = {
|
|
484
480
|
configEnv,
|
|
485
481
|
valueIsImportedAtRuntime: true,
|
|
486
|
-
|
|
487
|
-
definedAtInfo: {
|
|
488
|
-
filePath: importFilePath,
|
|
489
|
-
fileExportPath: [importFileExportName]
|
|
490
|
-
}
|
|
482
|
+
definedAtInfo: import_
|
|
491
483
|
};
|
|
492
484
|
return configValueSource;
|
|
493
485
|
}
|
|
@@ -496,24 +488,22 @@ function getConfigValueSource(configName, interfaceFile, configDef, userRootDir)
|
|
|
496
488
|
value: configValue,
|
|
497
489
|
configEnv,
|
|
498
490
|
valueIsImportedAtRuntime: false,
|
|
499
|
-
|
|
500
|
-
definedAtInfo: definedAtInfoConfigFile
|
|
491
|
+
definedAtInfo: definedAtConfigFile
|
|
501
492
|
};
|
|
502
493
|
return configValueSource;
|
|
503
494
|
}
|
|
504
495
|
}
|
|
505
496
|
else if (interfaceFile.isValueFile) {
|
|
506
|
-
// TODO: rethink file paths of ConfigElement
|
|
507
|
-
const importFilePath = interfaceFile.filePath.filePathRelativeToUserRootDir ?? interfaceFile.filePath.filePathAbsolute;
|
|
508
|
-
const importFileExportName = configName === interfaceFile.configNameDefault ? 'default' : configName;
|
|
509
497
|
const valueAlreadyLoaded = 'configValue' in conf;
|
|
510
498
|
const configValueSource = {
|
|
511
499
|
configEnv,
|
|
512
500
|
valueIsImportedAtRuntime: !valueAlreadyLoaded,
|
|
513
|
-
isComputed: false,
|
|
514
501
|
definedAtInfo: {
|
|
515
|
-
filePath
|
|
516
|
-
fileExportPath:
|
|
502
|
+
...interfaceFile.filePath,
|
|
503
|
+
fileExportPath: configName === interfaceFile.configName
|
|
504
|
+
? []
|
|
505
|
+
: // Side-effect config (e.g. `export { frontmatter }` of .md files)
|
|
506
|
+
[configName]
|
|
517
507
|
}
|
|
518
508
|
};
|
|
519
509
|
if (valueAlreadyLoaded) {
|
|
@@ -526,16 +516,17 @@ function getConfigValueSource(configName, interfaceFile, configDef, userRootDir)
|
|
|
526
516
|
}
|
|
527
517
|
(0, utils_js_1.assert)(false);
|
|
528
518
|
}
|
|
529
|
-
function
|
|
530
|
-
|
|
531
|
-
|
|
519
|
+
function assertFileEnv(filePathForEnvCheck, configEnv, configName) {
|
|
520
|
+
(0, utils_js_1.assertPosixPath)(filePathForEnvCheck);
|
|
521
|
+
if (!filesEnv.has(filePathForEnvCheck)) {
|
|
522
|
+
filesEnv.set(filePathForEnvCheck, []);
|
|
532
523
|
}
|
|
533
|
-
const
|
|
534
|
-
|
|
535
|
-
const configDifferentEnv =
|
|
524
|
+
const fileEnv = filesEnv.get(filePathForEnvCheck);
|
|
525
|
+
fileEnv.push({ configEnv, configName });
|
|
526
|
+
const configDifferentEnv = fileEnv.filter((c) => c.configEnv !== configEnv)[0];
|
|
536
527
|
if (configDifferentEnv) {
|
|
537
528
|
(0, utils_js_1.assertUsage)(false, [
|
|
538
|
-
`${
|
|
529
|
+
`${filePathForEnvCheck} defines the value of configs living in different environments:`,
|
|
539
530
|
...[configDifferentEnv, { configName, configEnv }].map((c) => ` - config ${picocolors_1.default.cyan(c.configName)} which value lives in environment ${picocolors_1.default.cyan(c.configEnv)}`),
|
|
540
531
|
'Defining config values in the same file is allowed only if they live in the same environment, see https://vike.dev/header-file/import-from-same-file'
|
|
541
532
|
].join('\n'));
|
|
@@ -553,53 +544,65 @@ function isDefiningPage(interfaceFiles) {
|
|
|
553
544
|
function isDefiningPageConfig(configName) {
|
|
554
545
|
return ['Page', 'route'].includes(configName);
|
|
555
546
|
}
|
|
556
|
-
function
|
|
547
|
+
function resolveImport(configValue, importerFilePath, userRootDir, configEnv, configName) {
|
|
557
548
|
if (typeof configValue !== 'string')
|
|
558
549
|
return null;
|
|
559
550
|
const importData = (0, replaceImportStatements_js_1.parseImportData)(configValue);
|
|
560
551
|
if (!importData)
|
|
561
552
|
return null;
|
|
562
|
-
|
|
563
|
-
|
|
553
|
+
const { importPath, exportName } = importData;
|
|
554
|
+
const filePathAbsolute = resolveImportPath(importData, importerFilePath);
|
|
555
|
+
assertFileEnv(filePathAbsolute ?? importPath, configEnv, configName);
|
|
556
|
+
const fileExportPath = exportName === 'default' || exportName === configName ? [] : [exportName];
|
|
557
|
+
if (importPath.startsWith('.')) {
|
|
564
558
|
// We need to resolve relative paths into absolute paths. Because the import paths are included in virtual files:
|
|
565
559
|
// ```
|
|
566
560
|
// [vite] Internal server error: Failed to resolve import "./onPageTransitionHooks" from "virtual:vike:pageConfigValuesAll:client:/pages/index". Does the file exist?
|
|
567
561
|
// ```
|
|
568
|
-
|
|
562
|
+
assertImportPath(filePathAbsolute, importData, importerFilePath);
|
|
563
|
+
const filePathRelativeToUserRootDir = resolveImportPath_relativeToUserRootDir(filePathAbsolute, importData, importerFilePath, userRootDir);
|
|
564
|
+
return {
|
|
565
|
+
exportName,
|
|
566
|
+
fileExportPath,
|
|
567
|
+
filePathAbsolute,
|
|
568
|
+
filePathRelativeToUserRootDir,
|
|
569
|
+
importPathAbsolute: null
|
|
570
|
+
};
|
|
569
571
|
}
|
|
570
572
|
else {
|
|
571
|
-
//
|
|
573
|
+
// importPath can be:
|
|
572
574
|
// - an npm package import
|
|
573
575
|
// - a path alias
|
|
576
|
+
return {
|
|
577
|
+
exportName,
|
|
578
|
+
fileExportPath,
|
|
579
|
+
filePathAbsolute,
|
|
580
|
+
filePathRelativeToUserRootDir: null,
|
|
581
|
+
importPathAbsolute: importPath
|
|
582
|
+
};
|
|
574
583
|
}
|
|
575
|
-
return {
|
|
576
|
-
importFilePath,
|
|
577
|
-
importFileExportName
|
|
578
|
-
};
|
|
579
584
|
}
|
|
580
|
-
function
|
|
581
|
-
let importFilePath = resolveImport(importData, configFilePath);
|
|
582
|
-
// Make it a Vite path
|
|
585
|
+
function resolveImportPath_relativeToUserRootDir(filePathAbsolute, importData, configFilePath, userRootDir) {
|
|
583
586
|
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
584
|
-
|
|
585
|
-
if (
|
|
586
|
-
|
|
587
|
+
let filePathRelativeToUserRootDir;
|
|
588
|
+
if (filePathAbsolute.startsWith(userRootDir)) {
|
|
589
|
+
filePathRelativeToUserRootDir = getVitePathFromAbsolutePath(filePathAbsolute, userRootDir);
|
|
587
590
|
}
|
|
588
591
|
else {
|
|
589
|
-
(0, utils_js_1.assertUsage)(false, `${(0, getFilePathToShowToUser_js_1.getFilePathToShowToUser)(configFilePath)} imports from a relative path ${picocolors_1.default.cyan(importData.
|
|
592
|
+
(0, utils_js_1.assertUsage)(false, `${(0, getFilePathToShowToUser_js_1.getFilePathToShowToUser)(configFilePath)} imports from a relative path ${picocolors_1.default.cyan(importData.importPath)} outside of ${userRootDir} which is forbidden: import from a relative path inside ${userRootDir}, or import from a dependency's package.json#exports entry instead`);
|
|
590
593
|
// None of the following works. Seems to be a Vite bug?
|
|
591
594
|
// /*
|
|
592
|
-
// assert(
|
|
593
|
-
//
|
|
595
|
+
// assert(filePathAbsolute.startsWith('/'))
|
|
596
|
+
// filePath = `/@fs${filePathAbsolute}`
|
|
594
597
|
// /*/
|
|
595
|
-
//
|
|
596
|
-
// assert(
|
|
597
|
-
//
|
|
598
|
+
// filePathRelativeToUserRootDir = path.posix.relative(userRootDir, filePathAbsolute)
|
|
599
|
+
// assert(filePathRelativeToUserRootDir.startsWith('../'))
|
|
600
|
+
// filePathRelativeToUserRootDir = '/' + filePathRelativeToUserRootDir
|
|
598
601
|
// //*/
|
|
599
602
|
}
|
|
600
|
-
(0, utils_js_1.assertPosixPath)(
|
|
601
|
-
(0, utils_js_1.assert)(
|
|
602
|
-
return
|
|
603
|
+
(0, utils_js_1.assertPosixPath)(filePathRelativeToUserRootDir);
|
|
604
|
+
(0, utils_js_1.assert)(filePathRelativeToUserRootDir.startsWith('/'));
|
|
605
|
+
return filePathRelativeToUserRootDir;
|
|
603
606
|
}
|
|
604
607
|
function getVitePathFromAbsolutePath(filePathAbsolute, root) {
|
|
605
608
|
(0, utils_js_1.assertPosixPath)(filePathAbsolute);
|
|
@@ -660,34 +663,36 @@ function assertMetaValue(metaVal, configMetaDefinedAt) {
|
|
|
660
663
|
}
|
|
661
664
|
});
|
|
662
665
|
}
|
|
663
|
-
function
|
|
666
|
+
function applyEffectsAll(configValueSources, configDefinitionsRelevant) {
|
|
664
667
|
(0, utils_js_1.objectEntries)(configDefinitionsRelevant).forEach(([configName, configDef]) => {
|
|
665
668
|
if (!configDef.effect)
|
|
666
669
|
return;
|
|
667
670
|
// The value needs to be loaded at config time, that's why we only support effect for configs that are config-only for now.
|
|
668
671
|
// (We could support effect for non config-only by always loading its value at config time, regardless of the config's `env` value.)
|
|
669
|
-
(0, utils_js_1.
|
|
670
|
-
`
|
|
671
|
-
|
|
672
|
-
|
|
673
|
-
|
|
674
|
-
if (!configValue)
|
|
672
|
+
(0, utils_js_1.assertUsage)(configDef.env === 'config-only', [
|
|
673
|
+
`Cannot add effect to ${picocolors_1.default.cyan(configName)} because its ${picocolors_1.default.cyan('env')} is ${picocolors_1.default.cyan(configDef.env)}: effects can only be added to configs with an env that is ${picocolors_1.default.cyan('config-only')}.`
|
|
674
|
+
].join(' '));
|
|
675
|
+
const source = configValueSources[configName]?.[0];
|
|
676
|
+
if (!source)
|
|
675
677
|
return;
|
|
678
|
+
// The config value is eagerly loaded since `configDef.env === 'config-only``
|
|
679
|
+
(0, utils_js_1.assert)('value' in source);
|
|
680
|
+
// Call effect
|
|
676
681
|
const configModFromEffect = configDef.effect({
|
|
677
|
-
configValue:
|
|
678
|
-
configDefinedAt: (
|
|
682
|
+
configValue: source.value,
|
|
683
|
+
configDefinedAt: getConfigSourceDefinedAtString(configName, source)
|
|
679
684
|
});
|
|
680
685
|
if (!configModFromEffect)
|
|
681
686
|
return;
|
|
682
|
-
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(
|
|
683
|
-
applyEffect(configModFromEffect,
|
|
687
|
+
(0, utils_js_1.assert)((0, utils_js_1.hasProp)(source, 'value')); // We need to assume that the config value is loaded at build-time
|
|
688
|
+
applyEffect(configModFromEffect, source, configValueSources);
|
|
684
689
|
});
|
|
685
690
|
}
|
|
686
691
|
function applyEffect(configModFromEffect, configValueEffectSource, configValueSources) {
|
|
687
|
-
const notSupported = `
|
|
692
|
+
const notSupported = `Effects currently only supports modifying the the ${picocolors_1.default.cyan('env')} of a config.`;
|
|
688
693
|
(0, utils_js_1.objectEntries)(configModFromEffect).forEach(([configName, configValue]) => {
|
|
689
694
|
if (configName === 'meta') {
|
|
690
|
-
assertMetaValue(configValue, (
|
|
695
|
+
assertMetaValue(configValue, getConfigSourceDefinedAtString(configName, configValueEffectSource, true));
|
|
691
696
|
(0, utils_js_1.objectEntries)(configValue).forEach(([configTargetName, configTargetDef]) => {
|
|
692
697
|
{
|
|
693
698
|
const keys = Object.keys(configTargetDef);
|
|
@@ -697,6 +702,7 @@ function applyEffect(configModFromEffect, configValueEffectSource, configValueSo
|
|
|
697
702
|
const envOverriden = configTargetDef.env;
|
|
698
703
|
const sources = configValueSources[configTargetName];
|
|
699
704
|
sources?.forEach((configValueSource) => {
|
|
705
|
+
// Apply effect
|
|
700
706
|
configValueSource.configEnv = envOverriden;
|
|
701
707
|
});
|
|
702
708
|
});
|
|
@@ -708,30 +714,29 @@ function applyEffect(configModFromEffect, configValueEffectSource, configValueSo
|
|
|
708
714
|
}
|
|
709
715
|
});
|
|
710
716
|
}
|
|
711
|
-
function
|
|
717
|
+
function getComputed(configValueSources, configDefinitionsRelevant) {
|
|
718
|
+
const configValuesComputed = {};
|
|
712
719
|
(0, utils_js_1.objectEntries)(configDefinitionsRelevant).forEach(([configName, configDef]) => {
|
|
713
|
-
|
|
714
|
-
const computed = configDef._computed;
|
|
715
|
-
if (!computed)
|
|
720
|
+
if (!configDef._computed)
|
|
716
721
|
return;
|
|
717
|
-
const value =
|
|
722
|
+
const value = configDef._computed(configValueSources);
|
|
718
723
|
if (value === undefined)
|
|
719
724
|
return;
|
|
720
|
-
|
|
725
|
+
configValuesComputed[configName] = {
|
|
721
726
|
value,
|
|
722
|
-
configEnv: configDef.env
|
|
723
|
-
definedAtInfo: null,
|
|
724
|
-
isComputed: true,
|
|
725
|
-
valueIsImportedAtRuntime: false
|
|
727
|
+
configEnv: configDef.env
|
|
726
728
|
};
|
|
727
|
-
(_a = pageConfig.configValueSources)[configName] ?? (_a[configName] = []);
|
|
728
|
-
// Computed values are inserted last: they have the least priority (i.e. computed can be overriden)
|
|
729
|
-
pageConfig.configValueSources[configName].push(configValueSource);
|
|
730
729
|
});
|
|
730
|
+
return configValuesComputed;
|
|
731
731
|
}
|
|
732
|
-
async function findPlusFiles(userRootDir, isDev, extensions) {
|
|
732
|
+
async function findPlusFiles(userRootDir, ignoreDirs, isDev, extensions) {
|
|
733
733
|
const timeBase = new Date().getTime();
|
|
734
734
|
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
735
|
+
const ignorePatterns = [];
|
|
736
|
+
for (const dir of ignoreDirs) {
|
|
737
|
+
(0, utils_js_1.assertPosixPath)(dir);
|
|
738
|
+
ignorePatterns.push(`${path_1.default.posix.relative(userRootDir, dir)}/**`);
|
|
739
|
+
}
|
|
735
740
|
const result = await (0, fast_glob_1.default)(`**/+*.${utils_js_1.scriptFileExtensions}`, {
|
|
736
741
|
ignore: [
|
|
737
742
|
'**/node_modules/**',
|
|
@@ -740,7 +745,8 @@ async function findPlusFiles(userRootDir, isDev, extensions) {
|
|
|
740
745
|
// +Page.js
|
|
741
746
|
// +Page.telefunc.js
|
|
742
747
|
// ```
|
|
743
|
-
'**/*.telefunc.*'
|
|
748
|
+
'**/*.telefunc.*',
|
|
749
|
+
...ignorePatterns
|
|
744
750
|
],
|
|
745
751
|
cwd: userRootDir,
|
|
746
752
|
dot: false
|
|
@@ -748,7 +754,7 @@ async function findPlusFiles(userRootDir, isDev, extensions) {
|
|
|
748
754
|
const time = new Date().getTime() - timeBase;
|
|
749
755
|
if (isDev) {
|
|
750
756
|
// We only warn in dev, because while building it's expected to take a long time as fast-glob is competing for resources with other tasks
|
|
751
|
-
(0, utils_js_1.assertWarning)(time < 2 * 1000, `Crawling your user files took an unexpected long time (${time}ms). Create a new issue on
|
|
757
|
+
(0, utils_js_1.assertWarning)(time < 2 * 1000, `Crawling your user files took an unexpected long time (${time}ms). Create a new issue on Vike's GitHub.`, {
|
|
752
758
|
onlyOnce: 'slow-page-files-search'
|
|
753
759
|
});
|
|
754
760
|
}
|
|
@@ -798,7 +804,7 @@ function assertNoUnexpectedPlusSign(filePath, fileName) {
|
|
|
798
804
|
(0, utils_js_1.assertUsage)(!fileName.slice(1).includes('+'), `Character '+' is only allowed at the beginning of filenames: make sure ${filePath} doesn't contain any '+' in its filename other than its first letter`);
|
|
799
805
|
}
|
|
800
806
|
async function loadConfigFile(configFilePath, userRootDir, visited) {
|
|
801
|
-
const { filePathAbsolute
|
|
807
|
+
const { filePathAbsolute } = configFilePath;
|
|
802
808
|
assertNoInfiniteLoop(visited, filePathAbsolute);
|
|
803
809
|
const { fileExports } = await (0, transpileAndExecuteFile_js_1.transpileAndExecuteFile)(configFilePath, false, userRootDir);
|
|
804
810
|
const { extendsConfigs, extendsFilePaths } = await loadExtendsConfigs(fileExports, configFilePath, userRootDir, [
|
|
@@ -807,10 +813,7 @@ async function loadConfigFile(configFilePath, userRootDir, visited) {
|
|
|
807
813
|
]);
|
|
808
814
|
const configFile = {
|
|
809
815
|
fileExports,
|
|
810
|
-
filePath:
|
|
811
|
-
filePathRelativeToUserRootDir,
|
|
812
|
-
filePathAbsolute
|
|
813
|
-
},
|
|
816
|
+
filePath: configFilePath,
|
|
814
817
|
extendsFilePaths
|
|
815
818
|
};
|
|
816
819
|
return { configFile, extendsConfigs };
|
|
@@ -827,16 +830,20 @@ async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir
|
|
|
827
830
|
const extendsImportData = getExtendsImportData(configFileExports, configFilePath);
|
|
828
831
|
const extendsConfigFiles = [];
|
|
829
832
|
extendsImportData.map((importData) => {
|
|
830
|
-
const {
|
|
833
|
+
const { importPath: importPath } = importData;
|
|
831
834
|
// TODO
|
|
832
835
|
// - validate extends configs
|
|
833
|
-
const filePathAbsolute =
|
|
836
|
+
const filePathAbsolute = resolveImportPath(importData, configFilePath);
|
|
837
|
+
assertImportPath(filePathAbsolute, importData, configFilePath);
|
|
834
838
|
assertExtendsImportPath(importPath, filePathAbsolute, configFilePath);
|
|
839
|
+
// - filePathRelativeToUserRootDir has no functionality beyond nicer error messages for user
|
|
840
|
+
// - Using importPath would be visually nicer but it's ambigous => we rather pick filePathAbsolute for added clarity
|
|
841
|
+
const filePathRelativeToUserRootDir = determineFilePathRelativeToUserDir(filePathAbsolute, userRootDir);
|
|
835
842
|
extendsConfigFiles.push({
|
|
836
843
|
filePathAbsolute,
|
|
837
|
-
//
|
|
838
|
-
|
|
839
|
-
|
|
844
|
+
// TODO: fix type cast
|
|
845
|
+
filePathRelativeToUserRootDir: filePathRelativeToUserRootDir,
|
|
846
|
+
importPathAbsolute: importPath
|
|
840
847
|
});
|
|
841
848
|
});
|
|
842
849
|
const extendsConfigs = [];
|
|
@@ -876,7 +883,7 @@ function assertExtendsImportPath(importPath, filePath, configFilePath) {
|
|
|
876
883
|
}
|
|
877
884
|
function getExtendsImportData(configFileExports, configFilePath) {
|
|
878
885
|
const filePathToShowToUser = (0, getFilePathToShowToUser_js_1.getFilePathToShowToUser)(configFilePath);
|
|
879
|
-
(0,
|
|
886
|
+
(0, assertExports_js_1.assertExportsOfConfigFile)(configFileExports, filePathToShowToUser);
|
|
880
887
|
const defaultExports = configFileExports.default;
|
|
881
888
|
const wrongUsage = `${filePathToShowToUser} sets the config 'extends' to an invalid value, see https://vike.dev/extends`;
|
|
882
889
|
let extendList;
|
|
@@ -974,7 +981,7 @@ function determineRouteFilesystem(locationId, configValueSources) {
|
|
|
974
981
|
const configFilesystemRoutingRoot = configValueSources[configName]?.[0];
|
|
975
982
|
let filesystemRouteString = (0, filesystemRouting_js_1.getFilesystemRouteString)(locationId);
|
|
976
983
|
if (determineIsErrorPage(filesystemRouteString)) {
|
|
977
|
-
return { isErrorPage: true, routeFilesystem:
|
|
984
|
+
return { isErrorPage: true, routeFilesystem: undefined };
|
|
978
985
|
}
|
|
979
986
|
let filesystemRouteDefinedBy = (0, filesystemRouting_js_1.getFilesystemRouteDefinedBy)(locationId); // for log404()
|
|
980
987
|
if (configFilesystemRoutingRoot) {
|
|
@@ -992,18 +999,19 @@ function determineRouteFilesystem(locationId, configValueSources) {
|
|
|
992
999
|
routeString: filesystemRouteString,
|
|
993
1000
|
definedBy: filesystemRouteDefinedBy
|
|
994
1001
|
};
|
|
995
|
-
return { routeFilesystem, isErrorPage:
|
|
1002
|
+
return { routeFilesystem, isErrorPage: undefined };
|
|
996
1003
|
}
|
|
997
1004
|
function getFilesystemRoutingRootEffect(configFilesystemRoutingRoot, configName) {
|
|
998
1005
|
(0, utils_js_1.assert)(configFilesystemRoutingRoot.configEnv === 'config-only');
|
|
999
1006
|
// Eagerly loaded since it's config-only
|
|
1000
1007
|
(0, utils_js_1.assert)('value' in configFilesystemRoutingRoot);
|
|
1001
1008
|
const { value } = configFilesystemRoutingRoot;
|
|
1002
|
-
const configDefinedAt = (
|
|
1009
|
+
const configDefinedAt = getConfigSourceDefinedAtString(configName, configFilesystemRoutingRoot);
|
|
1003
1010
|
(0, utils_js_1.assertUsage)(typeof value === 'string', `${configDefinedAt} should be a string`);
|
|
1004
1011
|
(0, utils_js_1.assertUsage)(value.startsWith('/'), `${configDefinedAt} is ${picocolors_1.default.cyan(value)} but it should start with a leading slash ${picocolors_1.default.cyan('/')}`);
|
|
1005
|
-
|
|
1006
|
-
|
|
1012
|
+
const { filePathRelativeToUserRootDir } = configFilesystemRoutingRoot.definedAtInfo;
|
|
1013
|
+
(0, utils_js_1.assert)(filePathRelativeToUserRootDir);
|
|
1014
|
+
const before = (0, filesystemRouting_js_1.getFilesystemRouteString)((0, filesystemRouting_js_1.getLocationId)(filePathRelativeToUserRootDir));
|
|
1007
1015
|
const after = value;
|
|
1008
1016
|
const filesystemRoutingRootEffect = { before, after };
|
|
1009
1017
|
return { filesystemRoutingRootEffect, filesystemRoutingRootDefinedAt: configDefinedAt };
|
|
@@ -1012,22 +1020,22 @@ function determineIsErrorPage(routeFilesystem) {
|
|
|
1012
1020
|
(0, utils_js_1.assertPosixPath)(routeFilesystem);
|
|
1013
1021
|
return routeFilesystem.split('/').includes('_error');
|
|
1014
1022
|
}
|
|
1015
|
-
function
|
|
1016
|
-
const
|
|
1017
|
-
(0, utils_js_1.assertPosixPath)(
|
|
1018
|
-
const
|
|
1019
|
-
|
|
1020
|
-
|
|
1021
|
-
return
|
|
1023
|
+
function resolveImportPath(importData, importerFilePath) {
|
|
1024
|
+
const importerFilePathAbsolute = importerFilePath.filePathAbsolute;
|
|
1025
|
+
(0, utils_js_1.assertPosixPath)(importerFilePathAbsolute);
|
|
1026
|
+
const cwd = path_1.default.posix.dirname(importerFilePathAbsolute);
|
|
1027
|
+
// filePathAbsolute is expected to be null when importData.importPath is a Vite path alias
|
|
1028
|
+
const filePathAbsolute = (0, utils_js_1.requireResolve)(importData.importPath, cwd);
|
|
1029
|
+
return filePathAbsolute;
|
|
1022
1030
|
}
|
|
1023
|
-
function
|
|
1024
|
-
const {
|
|
1031
|
+
function assertImportPath(filePathAbsolute, importData, importerFilePath) {
|
|
1032
|
+
const { importPath: importPath, importStringWasGenerated, importString } = importData;
|
|
1025
1033
|
const filePathToShowToUser = (0, getFilePathToShowToUser_js_1.getFilePathToShowToUser)(importerFilePath);
|
|
1026
|
-
if (!
|
|
1034
|
+
if (!filePathAbsolute) {
|
|
1027
1035
|
const importPathString = picocolors_1.default.cyan(`'${importPath}'`);
|
|
1028
|
-
const errIntro =
|
|
1036
|
+
const errIntro = importStringWasGenerated
|
|
1029
1037
|
? `The import path ${importPathString} in ${filePathToShowToUser}`
|
|
1030
|
-
: `The import ${picocolors_1.default.cyan(
|
|
1038
|
+
: `The import ${picocolors_1.default.cyan(importString)} defined in ${filePathToShowToUser}`;
|
|
1031
1039
|
const errIntro2 = `${errIntro} couldn't be resolved: does ${importPathString}`;
|
|
1032
1040
|
if (importPath.startsWith('.')) {
|
|
1033
1041
|
(0, utils_js_1.assertUsage)(false, `${errIntro2} point to an existing file?`);
|
|
@@ -1041,18 +1049,23 @@ function isVikeConfigFile(filePath) {
|
|
|
1041
1049
|
return !!getConfigName(filePath);
|
|
1042
1050
|
}
|
|
1043
1051
|
exports.isVikeConfigFile = isVikeConfigFile;
|
|
1044
|
-
function getConfigValues(configValueSources, configDefinitionsRelevant) {
|
|
1052
|
+
function getConfigValues(configValueSources, configValuesComputed, configDefinitionsRelevant) {
|
|
1045
1053
|
const configValues = {};
|
|
1054
|
+
Object.entries(configValuesComputed).forEach(([configName, configValueComputed]) => {
|
|
1055
|
+
configValues[configName] = {
|
|
1056
|
+
value: configValueComputed.value,
|
|
1057
|
+
definedAt: { isComputed: true }
|
|
1058
|
+
};
|
|
1059
|
+
});
|
|
1046
1060
|
Object.entries(configValueSources).forEach(([configName, sources]) => {
|
|
1047
1061
|
const configDef = configDefinitionsRelevant[configName];
|
|
1048
1062
|
(0, utils_js_1.assert)(configDef);
|
|
1049
1063
|
if (!configDef.cumulative) {
|
|
1050
1064
|
const configValueSource = sources[0];
|
|
1051
1065
|
if ('value' in configValueSource) {
|
|
1052
|
-
const { value, definedAtInfo } = configValueSource;
|
|
1053
1066
|
configValues[configName] = {
|
|
1054
|
-
value,
|
|
1055
|
-
|
|
1067
|
+
value: configValueSource.value,
|
|
1068
|
+
definedAt: getDefinedAt(configValueSource)
|
|
1056
1069
|
};
|
|
1057
1070
|
}
|
|
1058
1071
|
}
|
|
@@ -1060,7 +1073,10 @@ function getConfigValues(configValueSources, configDefinitionsRelevant) {
|
|
|
1060
1073
|
const value = mergeCumulative(configName, sources);
|
|
1061
1074
|
configValues[configName] = {
|
|
1062
1075
|
value,
|
|
1063
|
-
|
|
1076
|
+
definedAt: {
|
|
1077
|
+
isCumulative: true,
|
|
1078
|
+
files: sources.map((source) => getDefinedAtFile(source))
|
|
1079
|
+
}
|
|
1064
1080
|
};
|
|
1065
1081
|
}
|
|
1066
1082
|
});
|
|
@@ -1071,8 +1087,7 @@ function mergeCumulative(configName, configValueSources) {
|
|
|
1071
1087
|
const valuesSet = [];
|
|
1072
1088
|
let configValueSourcePrevious = null;
|
|
1073
1089
|
configValueSources.forEach((configValueSource) => {
|
|
1074
|
-
(
|
|
1075
|
-
const configDefinedAt = (0, utils_js_2.getConfigDefinedAtString)(configName, configValueSource, true);
|
|
1090
|
+
const configDefinedAt = getConfigSourceDefinedAtString(configName, configValueSource);
|
|
1076
1091
|
const configNameColored = picocolors_1.default.cyan(configName);
|
|
1077
1092
|
// We could, in principle, also support cumulative values to be defined in +${configName}.js but it ins't completely trivial to implement
|
|
1078
1093
|
(0, utils_js_1.assertUsage)('value' in configValueSource, `${configDefinedAt} is only allowed to be defined in a +config.h.js file. (Because the values of ${configNameColored} are cumulative.)`);
|
|
@@ -1080,7 +1095,7 @@ function mergeCumulative(configName, configValueSources) {
|
|
|
1080
1095
|
const explanation = `(Because the values of ${configNameColored} are cumulative and therefore merged together.)` as const
|
|
1081
1096
|
*/
|
|
1082
1097
|
// Make sure configValueSource.value is serializable
|
|
1083
|
-
(0, getVirtualFilePageConfigs_js_1.getConfigValueSerialized)(configValueSource.value, configName, configValueSource
|
|
1098
|
+
(0, getVirtualFilePageConfigs_js_1.getConfigValueSerialized)(configValueSource.value, configName, getDefinedAt(configValueSource));
|
|
1084
1099
|
const assertNoMixing = (isSet) => {
|
|
1085
1100
|
const vals1 = isSet ? valuesSet : valuesArr;
|
|
1086
1101
|
const t1 = isSet ? 'a Set' : 'an array';
|
|
@@ -1090,7 +1105,7 @@ function mergeCumulative(configName, configValueSources) {
|
|
|
1090
1105
|
if (vals2.length === 0)
|
|
1091
1106
|
return;
|
|
1092
1107
|
(0, utils_js_1.assert)(configValueSourcePrevious);
|
|
1093
|
-
const configPreviousDefinedAt = (
|
|
1108
|
+
const configPreviousDefinedAt = getConfigSourceDefinedAtString(configName, configValueSourcePrevious, undefined, false);
|
|
1094
1109
|
(0, utils_js_1.assertUsage)(false, `${configDefinedAt} sets ${t1} but another ${configPreviousDefinedAt} sets ${t2} which is forbidden: the values must be all arrays or all sets (you cannot mix).`);
|
|
1095
1110
|
};
|
|
1096
1111
|
const { value } = configValueSource;
|
|
@@ -1121,3 +1136,30 @@ function mergeCumulative(configName, configValueSources) {
|
|
|
1121
1136
|
}
|
|
1122
1137
|
(0, utils_js_1.assert)(false);
|
|
1123
1138
|
}
|
|
1139
|
+
// TODO: rename
|
|
1140
|
+
// TODO: refactor
|
|
1141
|
+
function getConfigSourceDefinedAtString(configName, { definedAtInfo }, isEffect = undefined, sentenceBegin = true) {
|
|
1142
|
+
return (0, utils_js_2.getConfigDefinedAtString)(configName, {
|
|
1143
|
+
definedAt: {
|
|
1144
|
+
isEffect,
|
|
1145
|
+
file: {
|
|
1146
|
+
filePathToShowToUser: getDefinedAtFilePathToShowToUser(definedAtInfo),
|
|
1147
|
+
fileExportPath: definedAtInfo.fileExportPath
|
|
1148
|
+
}
|
|
1149
|
+
}
|
|
1150
|
+
}, sentenceBegin);
|
|
1151
|
+
}
|
|
1152
|
+
function getDefinedAtFilePathToShowToUser(definedAtInfo) {
|
|
1153
|
+
return definedAtInfo.filePathRelativeToUserRootDir ?? definedAtInfo.importPathAbsolute;
|
|
1154
|
+
}
|
|
1155
|
+
function getDefinedAtFile(source) {
|
|
1156
|
+
return {
|
|
1157
|
+
filePathToShowToUser: getDefinedAtFilePathToShowToUser(source.definedAtInfo),
|
|
1158
|
+
fileExportPath: source.definedAtInfo.fileExportPath
|
|
1159
|
+
};
|
|
1160
|
+
}
|
|
1161
|
+
function getDefinedAt(configValueSource) {
|
|
1162
|
+
return {
|
|
1163
|
+
file: getDefinedAtFile(configValueSource)
|
|
1164
|
+
};
|
|
1165
|
+
}
|