vike 0.4.144-commit-756f5d7 → 0.4.144-commit-f7ab002
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/buildConfig.js +2 -2
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +5 -5
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +3 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +4 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +12 -12
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +152 -152
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +2 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +13 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/helpers.js +1 -14
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/transpileAndExecuteFile.js +2 -4
- package/dist/cjs/node/plugin/plugins/previewConfig.js +6 -2
- package/dist/cjs/node/prerender/runPrerender.js +8 -8
- package/dist/cjs/node/runtime/html/serializePageContextClientSide.js +19 -6
- package/dist/cjs/node/runtime/renderPage/log404/index.js +27 -17
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -2
- package/dist/cjs/node/shared/getClientEntryFilePath.js +2 -2
- package/dist/cjs/shared/getPageFiles/analyzeClientSide.js +4 -6
- package/dist/cjs/shared/getPageFiles/getExports.js +3 -3
- package/dist/cjs/shared/hooks/getHook.js +1 -1
- package/dist/cjs/shared/page-configs/getExportPath.js +3 -3
- package/dist/cjs/shared/page-configs/helpers/getConfigDefinedAtString.js +43 -0
- package/dist/cjs/shared/page-configs/helpers/getConfigValue.js +44 -0
- package/dist/cjs/shared/page-configs/helpers.js +33 -0
- package/dist/cjs/shared/page-configs/loadConfigValues.js +2 -2
- package/dist/cjs/shared/page-configs/serialize/parseConfigValuesImported.js +6 -8
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +2 -2
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValue.js +9 -10
- package/dist/cjs/shared/route/abort.js +1 -1
- package/dist/cjs/shared/route/loadPageRoutes.js +11 -10
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/cjs/utils/truncateString.js +12 -7
- package/dist/esm/client/client-routing-runtime/getPageContext.js +1 -1
- package/dist/esm/node/plugin/plugins/buildConfig.js +1 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +5 -5
- package/dist/esm/node/plugin/plugins/importBuild/index.js +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +2 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +4 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +12 -12
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +152 -152
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +14 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/helpers.js +1 -14
- 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 +2 -4
- package/dist/esm/node/plugin/plugins/previewConfig.js +6 -2
- package/dist/esm/node/prerender/runPrerender.js +2 -2
- package/dist/esm/node/runtime/html/serializePageContextClientSide.js +20 -7
- package/dist/esm/node/runtime/renderPage/log404/index.d.ts +2 -2
- package/dist/esm/node/runtime/renderPage/log404/index.js +27 -16
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +1 -1
- package/dist/esm/node/shared/getClientEntryFilePath.js +1 -1
- package/dist/esm/shared/getPageFiles/analyzeClientSide.js +2 -4
- package/dist/esm/shared/getPageFiles/getExports.js +2 -2
- package/dist/esm/shared/hooks/getHook.js +1 -1
- package/dist/esm/shared/page-configs/PageConfig.d.ts +53 -31
- package/dist/esm/shared/page-configs/getExportPath.d.ts +1 -1
- package/dist/esm/shared/page-configs/getExportPath.js +3 -3
- package/dist/esm/shared/page-configs/helpers/getConfigDefinedAtString.d.ts +7 -0
- package/dist/esm/shared/page-configs/helpers/getConfigDefinedAtString.js +37 -0
- package/dist/esm/shared/page-configs/helpers/getConfigValue.d.ts +14 -0
- package/dist/esm/shared/page-configs/helpers/getConfigValue.js +38 -0
- package/dist/esm/shared/page-configs/helpers.d.ts +13 -0
- package/dist/esm/shared/page-configs/helpers.js +27 -0
- package/dist/esm/shared/page-configs/loadConfigValues.js +2 -2
- package/dist/esm/shared/page-configs/serialize/PageConfigSerialized.d.ts +4 -4
- package/dist/esm/shared/page-configs/serialize/parseConfigValuesImported.js +6 -8
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +2 -2
- package/dist/esm/shared/page-configs/serialize/serializeConfigValue.js +9 -10
- package/dist/esm/shared/route/abort.js +1 -1
- package/dist/esm/shared/route/loadPageRoutes.js +8 -7
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/dist/esm/utils/projectInfo.js +1 -1
- package/dist/esm/utils/truncateString.d.ts +2 -1
- package/dist/esm/utils/truncateString.js +10 -7
- package/package.json +2 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.js +0 -16
- package/dist/cjs/shared/page-configs/utils.js +0 -103
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.d.ts +0 -24
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getFilePathToShowToUser.js +0 -13
- package/dist/esm/shared/page-configs/utils.d.ts +0 -35
- package/dist/esm/shared/page-configs/utils.js +0 -97
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js
CHANGED
|
@@ -6,7 +6,7 @@ const virtualFilePageConfigValuesAll_js_1 = require("../../../../shared/virtual-
|
|
|
6
6
|
const getVikeConfig_js_1 = require("./getVikeConfig.js");
|
|
7
7
|
const extractAssetsQuery_js_1 = require("../../../../shared/extractAssetsQuery.js");
|
|
8
8
|
const debug_js_1 = require("./debug.js");
|
|
9
|
-
const
|
|
9
|
+
const helpers_js_1 = require("../../../../../shared/page-configs/helpers.js");
|
|
10
10
|
const getConfigValueSourcesRelevant_js_1 = require("../../../shared/getConfigValueSourcesRelevant.js");
|
|
11
11
|
const isRuntimeEnvMatch_js_1 = require("./isRuntimeEnvMatch.js");
|
|
12
12
|
const serializeConfigValue_js_1 = require("../../../../../shared/page-configs/serialize/serializeConfigValue.js");
|
|
@@ -29,7 +29,7 @@ async function getVirtualFilePageConfigValuesAll(id, userRootDir, outDirRoot, is
|
|
|
29
29
|
}
|
|
30
30
|
exports.getVirtualFilePageConfigValuesAll = getVirtualFilePageConfigValuesAll;
|
|
31
31
|
function getLoadConfigValuesAll(pageConfig, isForClientSide, pageId, includeAssetsImportedByServer, isDev) {
|
|
32
|
-
const configValue = (0,
|
|
32
|
+
const configValue = (0, helpers_js_1.getConfigValue)(pageConfig, 'clientRouting', 'boolean');
|
|
33
33
|
const isClientRouting = configValue?.value ?? false;
|
|
34
34
|
const lines = [];
|
|
35
35
|
const importStatements = [];
|
|
@@ -12,7 +12,7 @@ const helpers_js_1 = require("./helpers.js");
|
|
|
12
12
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
13
13
|
const getVikeConfig_js_1 = require("./getVikeConfig.js");
|
|
14
14
|
const isRuntimeEnvMatch_js_1 = require("./isRuntimeEnvMatch.js");
|
|
15
|
-
const
|
|
15
|
+
const helpers_js_2 = require("../../../../../shared/page-configs/helpers.js");
|
|
16
16
|
const serializeConfigValue_js_1 = require("../../../../../shared/page-configs/serialize/serializeConfigValue.js");
|
|
17
17
|
async function getVirtualFilePageConfigs(userRootDir, outDirRoot, isForClientSide, isDev, id, configVike, isClientRouting) {
|
|
18
18
|
const { pageConfigs, pageConfigGlobal } = await (0, getVikeConfig_js_1.getVikeConfig)(userRootDir, outDirRoot, isDev, configVike.extensions, true);
|
|
@@ -110,15 +110,23 @@ function getConfigValueSerialized(value, configName, definedAt) {
|
|
|
110
110
|
const valueName = `config${(0, utils_js_1.getPropAccessNotation)(configName)}`;
|
|
111
111
|
let configValueSerialized;
|
|
112
112
|
try {
|
|
113
|
-
configValueSerialized = (0, stringify_1.stringify)(value, { valueName });
|
|
113
|
+
configValueSerialized = (0, stringify_1.stringify)(value, { valueName, forbidReactElements: true });
|
|
114
114
|
}
|
|
115
115
|
catch (err) {
|
|
116
|
-
|
|
117
|
-
|
|
116
|
+
let serializationErrMsg = '';
|
|
117
|
+
if ((0, stringify_1.isJsonSerializerError)(err)) {
|
|
118
|
+
serializationErrMsg = err.messageCore;
|
|
119
|
+
}
|
|
120
|
+
else {
|
|
121
|
+
console.error('Serialization error:');
|
|
122
|
+
console.error(err);
|
|
123
|
+
serializationErrMsg = 'see serialization error printed above';
|
|
124
|
+
}
|
|
125
|
+
const configValueFilePathToShowToUser = (0, helpers_js_2.getConfigValueFilePathToShowToUser)({ definedAt });
|
|
118
126
|
(0, utils_js_1.assert)(configValueFilePathToShowToUser);
|
|
119
127
|
(0, utils_js_1.assertUsage)(false, [
|
|
120
128
|
`The value of the config ${picocolors_1.default.cyan(configName)} cannot be defined inside the file ${configValueFilePathToShowToUser}:`,
|
|
121
|
-
`its value must be defined in an another file and then imported by ${configValueFilePathToShowToUser}. (Because
|
|
129
|
+
`its value must be defined in an another file and then imported by ${configValueFilePathToShowToUser}. (Because its value isn't serializable: ${serializationErrMsg}.)`,
|
|
122
130
|
`Only serializable config values can be defined inside +config.h.js files, see https://vike.dev/header-file.`
|
|
123
131
|
].join(' '));
|
|
124
132
|
}
|
|
@@ -7,20 +7,7 @@ function getConfigEnv(configValueSources, configName) {
|
|
|
7
7
|
const configValueSource = getConfigValueSource(configValueSources, configName);
|
|
8
8
|
if (!configValueSource)
|
|
9
9
|
return null;
|
|
10
|
-
|
|
11
|
-
return configValueSource.configEnv;
|
|
12
|
-
}
|
|
13
|
-
else {
|
|
14
|
-
// In case of effect/computed config values, there isn't any configValueSource
|
|
15
|
-
// TODO: make it work for custom config definitions
|
|
16
|
-
// - Ideally set configValueSource also for effect/computed config values?
|
|
17
|
-
(0, utils_js_1.assert)(false, 'TODO');
|
|
18
|
-
/*
|
|
19
|
-
const configDef = configDefinitionsBuiltIn[configName as keyof typeof configDefinitionsBuiltIn]
|
|
20
|
-
if (!configDef) return null
|
|
21
|
-
return configDef.env
|
|
22
|
-
*/
|
|
23
|
-
}
|
|
10
|
+
return configValueSource.configEnv;
|
|
24
11
|
}
|
|
25
12
|
exports.getConfigEnv = getConfigEnv;
|
|
26
13
|
function isConfigSet(configValueSources, configName) {
|
|
@@ -13,7 +13,6 @@ const utils_js_1 = require("../../../utils.js");
|
|
|
13
13
|
const replaceImportStatements_js_1 = require("./replaceImportStatements.js");
|
|
14
14
|
const getVikeConfig_js_1 = require("./getVikeConfig.js");
|
|
15
15
|
require("source-map-support/register.js");
|
|
16
|
-
const getFilePathToShowToUser_js_1 = require("./getFilePathToShowToUser.js");
|
|
17
16
|
const assertExports_js_1 = require("../../../../../shared/page-configs/assertExports.js");
|
|
18
17
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
19
18
|
async function transpileAndExecuteFile(filePath, isValueFile, userRootDir) {
|
|
@@ -39,14 +38,13 @@ async function transpileFile(filePath, isValueFile, userRootDir) {
|
|
|
39
38
|
}
|
|
40
39
|
function transpileImports(codeOriginal, filePath, isValueFile) {
|
|
41
40
|
// Do we need to remove the imports?
|
|
42
|
-
const { filePathAbsoluteFilesystem } = filePath;
|
|
41
|
+
const { filePathAbsoluteFilesystem, filePathToShowToUser } = filePath;
|
|
43
42
|
(0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
|
|
44
43
|
const isHeader = isHeaderFile(filePathAbsoluteFilesystem);
|
|
45
44
|
const isPageConfigFile = !isValueFile;
|
|
46
45
|
if (!isHeader && !isPageConfigFile) {
|
|
47
46
|
return null;
|
|
48
47
|
}
|
|
49
|
-
const filePathToShowToUser = (0, getFilePathToShowToUser_js_1.getFilePathToShowToUser)(filePath);
|
|
50
48
|
(0, utils_js_1.assertWarning)(isPageConfigFile, `${filePathToShowToUser} is a JavaScript header file (.h.js), but JavaScript header files should only be used for +config.h.js, see https://vike.dev/header-file`, { onlyOnce: true });
|
|
51
49
|
// Remove the imports
|
|
52
50
|
const res = (0, replaceImportStatements_js_1.replaceImportStatements)(codeOriginal, filePathToShowToUser);
|
|
@@ -279,7 +277,7 @@ function triggerPrepareStackTrace(err) {
|
|
|
279
277
|
function getErrIntroMsg(operation, filePath) {
|
|
280
278
|
const msg = [
|
|
281
279
|
picocolors_1.default.red(`Failed to ${operation}`),
|
|
282
|
-
picocolors_1.default.bold(picocolors_1.default.red(
|
|
280
|
+
picocolors_1.default.bold(picocolors_1.default.red(filePath.filePathToShowToUser)),
|
|
283
281
|
picocolors_1.default.red(`because:`)
|
|
284
282
|
].join(' ');
|
|
285
283
|
return msg;
|
|
@@ -31,9 +31,13 @@ function previewConfig() {
|
|
|
31
31
|
(0, utils_js_1.markEnvAsPreview)();
|
|
32
32
|
return () => {
|
|
33
33
|
assertDist();
|
|
34
|
-
|
|
35
|
-
|
|
34
|
+
/* We don't use this condition (we wrongfully always use the SSR middleware) because of the regression introduced by https://github.com/vitejs/vite/pull/14756 which stops servering .html files when `appType: 'custom'`.
|
|
35
|
+
if (!configVike.prerender || configVike.prerender.partial) {
|
|
36
|
+
addSsrMiddleware(server.middlewares)
|
|
36
37
|
}
|
|
38
|
+
/*/
|
|
39
|
+
(0, addSsrMiddleware_js_1.addSsrMiddleware)(server.middlewares);
|
|
40
|
+
//*/
|
|
37
41
|
addStatic404Middleware(server.middlewares);
|
|
38
42
|
};
|
|
39
43
|
}
|
|
@@ -41,7 +41,7 @@ const getConfigVike_js_1 = require("../shared/getConfigVike.js");
|
|
|
41
41
|
const getPageFiles_js_1 = require("../../shared/getPageFiles.js");
|
|
42
42
|
const getPageContextRequestUrl_js_1 = require("../../shared/getPageContextRequestUrl.js");
|
|
43
43
|
const resolveRouteString_js_1 = require("../../shared/route/resolveRouteString.js");
|
|
44
|
-
const
|
|
44
|
+
const helpers_js_1 = require("../../shared/page-configs/helpers.js");
|
|
45
45
|
const loadConfigValues_js_1 = require("../../shared/page-configs/loadConfigValues.js");
|
|
46
46
|
const error_page_js_1 = require("../../shared/error-page.js");
|
|
47
47
|
const addUrlComputedProps_js_1 = require("../../shared/addUrlComputedProps.js");
|
|
@@ -113,9 +113,9 @@ async function runPrerender(options, manuallyTriggered) {
|
|
|
113
113
|
async function collectDoNoPrerenderList(renderContext, doNotPrerenderList, concurrencyLimit) {
|
|
114
114
|
renderContext.pageConfigs.forEach((pageConfig) => {
|
|
115
115
|
const configName = 'prerender';
|
|
116
|
-
const configValue = (0,
|
|
116
|
+
const configValue = (0, helpers_js_1.getConfigValue)(pageConfig, configName, 'boolean');
|
|
117
117
|
if (configValue?.value === false) {
|
|
118
|
-
const configValueFilePathToShowToUser = (0,
|
|
118
|
+
const configValueFilePathToShowToUser = (0, helpers_js_1.getConfigValueFilePathToShowToUser)(configValue);
|
|
119
119
|
(0, utils_js_1.assert)(configValueFilePathToShowToUser);
|
|
120
120
|
doNotPrerenderList.push({
|
|
121
121
|
pageId: pageConfig.pageId,
|
|
@@ -173,11 +173,11 @@ async function callOnBeforePrerenderStartHooks(prerenderContext, renderContext,
|
|
|
173
173
|
await Promise.all(renderContext.pageConfigs.map((pageConfig) => concurrencyLimit(async () => {
|
|
174
174
|
const hookName = 'onBeforePrerenderStart';
|
|
175
175
|
const pageConfigLoaded = await (0, loadConfigValues_js_1.loadConfigValues)(pageConfig, false);
|
|
176
|
-
const configValue = (0,
|
|
176
|
+
const configValue = (0, helpers_js_1.getConfigValue)(pageConfigLoaded, hookName);
|
|
177
177
|
if (!configValue)
|
|
178
178
|
return;
|
|
179
179
|
const hookFn = configValue.value;
|
|
180
|
-
const hookFilePath = (0,
|
|
180
|
+
const hookFilePath = (0, helpers_js_1.getHookFilePathToShowToUser)(configValue);
|
|
181
181
|
(0, utils_js_1.assert)(hookFilePath);
|
|
182
182
|
(0, getHook_js_1.assertHookFn)(hookFn, { hookName, hookFilePath });
|
|
183
183
|
onBeforePrerenderStartHooks.push({
|
|
@@ -313,8 +313,8 @@ async function callOnPrerenderStartHook(prerenderContext, renderContext) {
|
|
|
313
313
|
const configValue = pageConfigGlobal.configValues.onPrerenderStart;
|
|
314
314
|
if (configValue?.value) {
|
|
315
315
|
const { value: hookFn } = configValue;
|
|
316
|
-
// config.onPrerenderStart isn't a computed nor a cumulative config =>
|
|
317
|
-
const hookFilePath = (0,
|
|
316
|
+
// config.onPrerenderStart isn't a computed nor a cumulative config => definedAt should always be defined
|
|
317
|
+
const hookFilePath = (0, helpers_js_1.getHookFilePathToShowToUser)(configValue);
|
|
318
318
|
(0, utils_js_1.assert)(hookFilePath);
|
|
319
319
|
onPrerenderStartHook = {
|
|
320
320
|
hookFn,
|
|
@@ -469,7 +469,7 @@ async function routeAndPrerender(prerenderContext, htmlFiles, prerenderPageIds,
|
|
|
469
469
|
if (pageContext._pageConfigs.length > 0) {
|
|
470
470
|
const pageConfig = pageContext._pageConfigs.find((p) => p.pageId === pageId);
|
|
471
471
|
(0, utils_js_1.assert)(pageConfig);
|
|
472
|
-
usesClientRouter = (0,
|
|
472
|
+
usesClientRouter = (0, helpers_js_1.getConfigValue)(pageConfig, 'clientRouting', 'boolean')?.value ?? false;
|
|
473
473
|
}
|
|
474
474
|
else {
|
|
475
475
|
usesClientRouter = globalContext.pluginManifest.usesClientRouter;
|
|
@@ -50,19 +50,32 @@ function serializePageContextClientSide(pageContext) {
|
|
|
50
50
|
catch (err) {
|
|
51
51
|
hasWarned = true;
|
|
52
52
|
propsNonSerializable.push(prop);
|
|
53
|
-
|
|
54
|
-
(0, utils_js_1.assertWarning)(false, [
|
|
53
|
+
let msg = [
|
|
55
54
|
`${varName} cannot be serialized and, therefore, cannot be passed to the client.`,
|
|
56
|
-
`Make sure that ${varName} is serializable, or remove ${h(propName)} from ${h('passToClient')}
|
|
57
|
-
|
|
58
|
-
|
|
55
|
+
`Make sure that ${varName} is serializable, or remove ${h(propName)} from ${h('passToClient')}.`
|
|
56
|
+
].join(' ');
|
|
57
|
+
if ((0, stringify_1.isJsonSerializerError)(err)) {
|
|
58
|
+
msg = `${msg} Serialization error: ${err.messageCore}.`;
|
|
59
|
+
}
|
|
60
|
+
else {
|
|
61
|
+
console.warn('Serialization error:');
|
|
62
|
+
console.warn(err);
|
|
63
|
+
msg = `${msg} The serialization failed because of the error printed above.`;
|
|
64
|
+
}
|
|
65
|
+
// We warn (instead of throwing an error) since Vike's client runtime throws an error (with `assertUsage()`) if the user's client code tries to access the property that cannot be serialized
|
|
66
|
+
(0, utils_js_1.assertWarning)(false, msg, { onlyOnce: false });
|
|
59
67
|
}
|
|
60
68
|
});
|
|
61
69
|
(0, utils_js_1.assert)(hasWarned);
|
|
62
70
|
propsNonSerializable.forEach((prop) => {
|
|
63
71
|
pageContextClient[prop] = notSerializable_js_1.notSerializable;
|
|
64
72
|
});
|
|
65
|
-
|
|
73
|
+
try {
|
|
74
|
+
pageContextSerialized = serialize(pageContextClient);
|
|
75
|
+
}
|
|
76
|
+
catch (err) {
|
|
77
|
+
(0, utils_js_1.assert)(false);
|
|
78
|
+
}
|
|
66
79
|
}
|
|
67
80
|
return pageContextSerialized;
|
|
68
81
|
}
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.getRoutesInfo = exports.log404 = void 0;
|
|
7
7
|
const globalContext_js_1 = require("../../globalContext.js");
|
|
8
8
|
const utils_js_1 = require("../../utils.js");
|
|
9
9
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
@@ -17,15 +17,20 @@ async function log404(pageContext) {
|
|
|
17
17
|
);
|
|
18
18
|
const globalContext = (0, globalContext_js_1.getGlobalContext)();
|
|
19
19
|
if (!globalContext.isProduction && !isFileRequest(urlPathname) && !pageContext.isClientSideNavigation) {
|
|
20
|
-
(
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
20
|
+
const routesInfo = getRoutesInfo(pageRoutes);
|
|
21
|
+
let msg = `URL ${picocolors_1.default.cyan(urlPathname)} doesn't match the route of any of your pages`;
|
|
22
|
+
const outro = 'See https://vike.dev/routing for more information about routing.';
|
|
23
|
+
if (!routesInfo) {
|
|
24
|
+
msg = `${msg}. ${picocolors_1.default.dim(outro)}`;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
msg = `${msg}:\n${routesInfo}\n${outro}`;
|
|
28
|
+
}
|
|
29
|
+
(0, utils_js_1.assertInfo)(false, msg, { onlyOnce: false });
|
|
25
30
|
}
|
|
26
31
|
}
|
|
27
32
|
exports.log404 = log404;
|
|
28
|
-
function
|
|
33
|
+
function getRoutesInfo(pageRoutes) {
|
|
29
34
|
const entries = pageRoutes
|
|
30
35
|
.map((pageRoute) => {
|
|
31
36
|
let routeStr;
|
|
@@ -74,19 +79,24 @@ function getPagesAndRoutesInfo(pageRoutes) {
|
|
|
74
79
|
const terminalWidth = (0, utils_js_1.getTerminalWidth)() || 134;
|
|
75
80
|
let width2 = Math.max(...linesContent.map(({ routeTypeSrc }) => (0, utils_js_1.stripAnsi)(routeTypeSrc).length));
|
|
76
81
|
let width3 = Math.max(...linesContent.map(({ routeDefinedBy }) => (0, utils_js_1.stripAnsi)(routeDefinedBy).length));
|
|
77
|
-
|
|
82
|
+
const width1_max = terminalWidth -
|
|
83
|
+
width3 -
|
|
84
|
+
width2 -
|
|
85
|
+
// Total width of table border & padding
|
|
86
|
+
10;
|
|
87
|
+
if (width1_max < 10)
|
|
88
|
+
return null;
|
|
78
89
|
linesContent.forEach((lineContent) => {
|
|
79
90
|
let { routeStr } = lineContent;
|
|
80
|
-
if (lineContent.routeTypeSrc
|
|
81
|
-
routeStr = (
|
|
82
|
-
|
|
83
|
-
else {
|
|
84
|
-
routeStr = truncateRouteFunction(routeStr, width1);
|
|
91
|
+
if (lineContent.routeTypeSrc === 'Route Function') {
|
|
92
|
+
routeStr = truncateRouteFunction(routeStr, width1_max);
|
|
93
|
+
(0, utils_js_1.assert)((0, utils_js_1.stripAnsi)(routeStr).length <= width1_max);
|
|
85
94
|
}
|
|
86
|
-
(0, utils_js_1.assert)((0, utils_js_1.stripAnsi)(routeStr).length <= width1);
|
|
87
95
|
lineContent.routeStr = routeStr;
|
|
88
96
|
});
|
|
89
|
-
width1 = Math.max(...linesContent.map(({ routeStr }) => (0, utils_js_1.stripAnsi)(routeStr).length));
|
|
97
|
+
let width1 = Math.max(...linesContent.map(({ routeStr }) => (0, utils_js_1.stripAnsi)(routeStr).length));
|
|
98
|
+
if (width1 > width1_max)
|
|
99
|
+
return null;
|
|
90
100
|
let lines = linesContent.map(({ routeStr, routeTypeSrc, routeDefinedBy }, i) => {
|
|
91
101
|
let cell1 = padEnd(routeStr, width1 + ((0, utils_js_1.stripAnsi)(routeStr).length - (0, utils_js_1.stripAnsi)(routeStr).length));
|
|
92
102
|
let cell2 = padEnd(routeTypeSrc, width2);
|
|
@@ -117,12 +127,12 @@ function getPagesAndRoutesInfo(pageRoutes) {
|
|
|
117
127
|
});
|
|
118
128
|
return lines.join('\n');
|
|
119
129
|
}
|
|
120
|
-
exports.
|
|
130
|
+
exports.getRoutesInfo = getRoutesInfo;
|
|
121
131
|
function truncateRouteFunction(routeStr, lenMax) {
|
|
122
132
|
routeStr = (0, utils_js_1.stripAnsi)(routeStr);
|
|
123
133
|
routeStr = removeNonAscii(routeStr);
|
|
124
134
|
routeStr = routeStr.split(/\s/).filter(Boolean).join(' ');
|
|
125
|
-
routeStr = (0, utils_js_1.truncateString)(routeStr, lenMax
|
|
135
|
+
routeStr = (0, utils_js_1.truncateString)(routeStr, lenMax);
|
|
126
136
|
return routeStr;
|
|
127
137
|
}
|
|
128
138
|
/** Same as String.prototype.padEnd but with stripAnsi() */
|
|
@@ -21,7 +21,7 @@ const preparePageContextForUserConsumptionServerSide_js_1 = require("./preparePa
|
|
|
21
21
|
const executeGuardHook_js_1 = require("../../../shared/route/executeGuardHook.js");
|
|
22
22
|
const loadPageRoutes_js_1 = require("../../../shared/route/loadPageRoutes.js");
|
|
23
23
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
24
|
-
const
|
|
24
|
+
const helpers_js_1 = require("../../../shared/page-configs/helpers.js");
|
|
25
25
|
async function renderPageAlreadyRouted(pageContext) {
|
|
26
26
|
// pageContext._pageId can either be the:
|
|
27
27
|
// - ID of the page matching the routing, or the
|
|
@@ -173,7 +173,7 @@ function assertNonMixedDesign(pageFilesAll, pageConfigs) {
|
|
|
173
173
|
const indent = '- ';
|
|
174
174
|
const v1Files = (0, utils_js_1.unique)(pageConfigs
|
|
175
175
|
.map((p) => Object.values(p.configValues)
|
|
176
|
-
.map(
|
|
176
|
+
.map(helpers_js_1.getConfigValueFilePathToShowToUser)
|
|
177
177
|
.filter(utils_js_1.isNotNullish)
|
|
178
178
|
.map((filePathToShowToUser) => indent + filePathToShowToUser))
|
|
179
179
|
.flat(2));
|
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getClientEntryFilePath = void 0;
|
|
4
|
-
const
|
|
4
|
+
const helpers_js_1 = require("../../shared/page-configs/helpers.js");
|
|
5
5
|
function getClientEntryFilePath(pageConfig) {
|
|
6
6
|
const configName = 'client';
|
|
7
|
-
const configValue = (0,
|
|
7
|
+
const configValue = (0, helpers_js_1.getConfigValue)(pageConfig, configName, 'string');
|
|
8
8
|
if (!configValue)
|
|
9
9
|
return null;
|
|
10
10
|
return configValue.value;
|
|
@@ -1,19 +1,17 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.analyzeClientSide = void 0;
|
|
4
|
-
const
|
|
4
|
+
const helpers_js_1 = require("../page-configs/helpers.js");
|
|
5
5
|
const analyzePageClientSide_js_1 = require("./analyzePageClientSide.js");
|
|
6
6
|
function analyzeClientSide(pageConfig, pageFilesAll, pageId) {
|
|
7
7
|
// V1 design
|
|
8
8
|
if (pageConfig) {
|
|
9
|
-
const isClientRouting = (0,
|
|
10
|
-
const isClientSideRenderable = (0,
|
|
9
|
+
const isClientRouting = (0, helpers_js_1.getConfigValue)(pageConfig, 'clientRouting', 'boolean')?.value ?? false;
|
|
10
|
+
const isClientSideRenderable = (0, helpers_js_1.getConfigValue)(pageConfig, 'isClientSideRenderable', 'boolean')?.value ?? false;
|
|
11
11
|
return { isClientSideRenderable, isClientRouting };
|
|
12
12
|
}
|
|
13
13
|
else {
|
|
14
|
-
// TODO/v1-release:
|
|
15
|
-
// - remove V0.4 implementation
|
|
16
|
-
// - globally rename isHtmlOnly to !isClientSideRenderable
|
|
14
|
+
// TODO/v1-release: remove
|
|
17
15
|
// V0.4 design
|
|
18
16
|
const { isHtmlOnly, isClientRouting } = (0, analyzePageClientSide_js_1.analyzePageClientSide)(pageFilesAll, pageId);
|
|
19
17
|
return { isClientSideRenderable: !isHtmlOnly, isClientRouting };
|
|
@@ -7,7 +7,7 @@ exports.getExports = exports.getExportUnion = void 0;
|
|
|
7
7
|
const isScriptFile_js_1 = require("../../utils/isScriptFile.js");
|
|
8
8
|
const utils_js_1 = require("../utils.js");
|
|
9
9
|
const assert_exports_old_design_js_1 = require("./assert_exports_old_design.js");
|
|
10
|
-
const
|
|
10
|
+
const helpers_js_1 = require("../page-configs/helpers.js");
|
|
11
11
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
12
12
|
function getExports(pageFiles, pageConfig) {
|
|
13
13
|
const configEntries = {};
|
|
@@ -34,8 +34,8 @@ function getExports(pageFiles, pageConfig) {
|
|
|
34
34
|
if (pageConfig) {
|
|
35
35
|
Object.entries(pageConfig.configValues).forEach(([configName, configValue]) => {
|
|
36
36
|
const { value } = configValue;
|
|
37
|
-
const configValueFilePathToShowToUser = (0,
|
|
38
|
-
const configDefinedAt = (0,
|
|
37
|
+
const configValueFilePathToShowToUser = (0, helpers_js_1.getConfigValueFilePathToShowToUser)(configValue);
|
|
38
|
+
const configDefinedAt = (0, helpers_js_1.getConfigDefinedAtString)('Config', configName, configValue);
|
|
39
39
|
config[configName] = config[configName] ?? value;
|
|
40
40
|
configEntries[configName] = configEntries[configName] ?? [];
|
|
41
41
|
// Currently each configName has only one entry. Adding an entry for each overriden config value isn't implemented yet. (This is an isomorphic file and it isn't clear whether this can/should be implemented on the client-side. We should load a minimum amount of code on the client-side.)
|
|
@@ -25,7 +25,7 @@ exports.assertHook = assertHook;
|
|
|
25
25
|
function assertHookFn(hookFn, { hookName, hookFilePath }) {
|
|
26
26
|
(0, utils_js_1.assert)(hookName && hookFilePath);
|
|
27
27
|
(0, utils_js_1.assert)(!hookName.endsWith(')'));
|
|
28
|
-
(0, utils_js_1.assertUsage)((0, utils_js_1.isCallable)(hookFn), `
|
|
28
|
+
(0, utils_js_1.assertUsage)((0, utils_js_1.isCallable)(hookFn), `Hook ${hookName}() defined by ${hookFilePath} should be a function`);
|
|
29
29
|
(0, utils_js_1.checkType)(hookFn);
|
|
30
30
|
}
|
|
31
31
|
exports.assertHookFn = assertHookFn;
|
|
@@ -2,10 +2,10 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.getExportPath = void 0;
|
|
4
4
|
const utils_js_1 = require("../utils.js");
|
|
5
|
-
function getExportPath(
|
|
6
|
-
if (!
|
|
5
|
+
function getExportPath(fileExportPathToShowToUser, configName) {
|
|
6
|
+
if (!fileExportPathToShowToUser)
|
|
7
7
|
return null;
|
|
8
|
-
let [exportName, ...exportObjectPath] =
|
|
8
|
+
let [exportName, ...exportObjectPath] = fileExportPathToShowToUser;
|
|
9
9
|
if (!exportName)
|
|
10
10
|
return null;
|
|
11
11
|
if (exportObjectPath.length === 0 && ['*', 'default', configName].includes(exportName))
|
|
@@ -0,0 +1,43 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getDefinedAtString = exports.getConfigDefinedAtString = void 0;
|
|
7
|
+
const utils_js_1 = require("../../utils.js");
|
|
8
|
+
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
|
+
const getExportPath_js_1 = require("../getExportPath.js");
|
|
10
|
+
function getConfigDefinedAtString(sentenceBegin, configName, { definedAt }) {
|
|
11
|
+
const definedAtString = getDefinedAtString(definedAt, configName);
|
|
12
|
+
const definedAtStr = definedAtString === 'internally' ? definedAtString : `at ${definedAtString}`;
|
|
13
|
+
let configNameStr = `${configName}${sentenceBegin === 'Hook' ? '()' : ''}`;
|
|
14
|
+
const configDefinedAt = `${sentenceBegin} ${picocolors_1.default.cyan(configNameStr)} defined ${definedAtStr}`;
|
|
15
|
+
return configDefinedAt;
|
|
16
|
+
}
|
|
17
|
+
exports.getConfigDefinedAtString = getConfigDefinedAtString;
|
|
18
|
+
function getDefinedAtString(definedAt, configName) {
|
|
19
|
+
if ('isComputed' in definedAt) {
|
|
20
|
+
return 'internally';
|
|
21
|
+
}
|
|
22
|
+
let files;
|
|
23
|
+
if ('files' in definedAt) {
|
|
24
|
+
files = definedAt.files;
|
|
25
|
+
}
|
|
26
|
+
else {
|
|
27
|
+
files = [definedAt];
|
|
28
|
+
}
|
|
29
|
+
(0, utils_js_1.assert)(files.length >= 1);
|
|
30
|
+
const definedAtString = files
|
|
31
|
+
.map((source) => {
|
|
32
|
+
const { filePathToShowToUser, fileExportPathToShowToUser } = source;
|
|
33
|
+
let s = filePathToShowToUser;
|
|
34
|
+
const exportPath = (0, getExportPath_js_1.getExportPath)(fileExportPathToShowToUser, configName);
|
|
35
|
+
if (exportPath) {
|
|
36
|
+
s = `${s} > ${picocolors_1.default.cyan(exportPath)}`;
|
|
37
|
+
}
|
|
38
|
+
return s;
|
|
39
|
+
})
|
|
40
|
+
.join(' / ');
|
|
41
|
+
return definedAtString;
|
|
42
|
+
}
|
|
43
|
+
exports.getDefinedAtString = getDefinedAtString;
|
|
@@ -0,0 +1,44 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.getConfigValue = void 0;
|
|
7
|
+
const utils_js_1 = require("../../utils.js");
|
|
8
|
+
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
9
|
+
const getConfigDefinedAtString_js_1 = require("./getConfigDefinedAtString.js");
|
|
10
|
+
// prettier-ignore
|
|
11
|
+
function getConfigValue(pageConfig, configName, type) {
|
|
12
|
+
const configValue = getConfigValueEntry(pageConfig, configName);
|
|
13
|
+
if (configValue === null)
|
|
14
|
+
return null;
|
|
15
|
+
const { value, definedAt } = configValue;
|
|
16
|
+
if (type)
|
|
17
|
+
assertConfigValueType(value, type, configName, definedAt);
|
|
18
|
+
return configValue;
|
|
19
|
+
}
|
|
20
|
+
exports.getConfigValue = getConfigValue;
|
|
21
|
+
function assertConfigValueType(value, type, configName, definedAt) {
|
|
22
|
+
(0, utils_js_1.assert)(value !== null);
|
|
23
|
+
const typeActual = typeof value;
|
|
24
|
+
if (typeActual === type)
|
|
25
|
+
return;
|
|
26
|
+
const valuePrintable = (0, utils_js_1.getValuePrintable)(value);
|
|
27
|
+
const problem = valuePrintable !== null
|
|
28
|
+
? `value ${picocolors_1.default.cyan(valuePrintable)}`
|
|
29
|
+
: `type ${picocolors_1.default.cyan(typeActual)}`;
|
|
30
|
+
const configDefinedAt = (0, getConfigDefinedAtString_js_1.getConfigDefinedAtString)('Config', configName, {
|
|
31
|
+
definedAt
|
|
32
|
+
});
|
|
33
|
+
const errMsg = `${configDefinedAt} has an invalid ${problem}: it should be a ${picocolors_1.default.cyan(type)} instead`;
|
|
34
|
+
(0, utils_js_1.assertUsage)(false, errMsg);
|
|
35
|
+
}
|
|
36
|
+
function getConfigValueEntry(pageConfig, configName) {
|
|
37
|
+
const configValue = pageConfig.configValues[configName];
|
|
38
|
+
if (!configValue)
|
|
39
|
+
return null;
|
|
40
|
+
// Enable users to suppress global config values by setting the local config value to null
|
|
41
|
+
if (configValue.value === null)
|
|
42
|
+
return null;
|
|
43
|
+
return configValue;
|
|
44
|
+
}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.getConfigValue = exports.getDefinedAtString = exports.getConfigDefinedAtString = exports.getHookFilePathToShowToUser = exports.getConfigValueFilePathToShowToUser = exports.getPageConfig = void 0;
|
|
4
|
+
var getConfigDefinedAtString_js_1 = require("./helpers/getConfigDefinedAtString.js");
|
|
5
|
+
Object.defineProperty(exports, "getConfigDefinedAtString", { enumerable: true, get: function () { return getConfigDefinedAtString_js_1.getConfigDefinedAtString; } });
|
|
6
|
+
Object.defineProperty(exports, "getDefinedAtString", { enumerable: true, get: function () { return getConfigDefinedAtString_js_1.getDefinedAtString; } });
|
|
7
|
+
var getConfigValue_js_1 = require("./helpers/getConfigValue.js");
|
|
8
|
+
Object.defineProperty(exports, "getConfigValue", { enumerable: true, get: function () { return getConfigValue_js_1.getConfigValue; } });
|
|
9
|
+
const utils_js_1 = require("../utils.js");
|
|
10
|
+
function getPageConfig(pageId, pageConfigs) {
|
|
11
|
+
const pageConfig = pageConfigs.find((p) => p.pageId === pageId);
|
|
12
|
+
(0, utils_js_1.assert)(pageConfigs.length > 0);
|
|
13
|
+
(0, utils_js_1.assert)(pageConfig);
|
|
14
|
+
return pageConfig;
|
|
15
|
+
}
|
|
16
|
+
exports.getPageConfig = getPageConfig;
|
|
17
|
+
function getConfigValueFilePathToShowToUser({ definedAt }) {
|
|
18
|
+
// A unique file path only exists if the config value isn't cumulative nor computed:
|
|
19
|
+
// - cumulative config values have multiple file paths
|
|
20
|
+
// - computed values don't have any file path
|
|
21
|
+
if ('isComputed' in definedAt || 'files' in definedAt)
|
|
22
|
+
return null;
|
|
23
|
+
const { filePathToShowToUser } = definedAt;
|
|
24
|
+
(0, utils_js_1.assert)(filePathToShowToUser);
|
|
25
|
+
return filePathToShowToUser;
|
|
26
|
+
}
|
|
27
|
+
exports.getConfigValueFilePathToShowToUser = getConfigValueFilePathToShowToUser;
|
|
28
|
+
function getHookFilePathToShowToUser({ definedAt }) {
|
|
29
|
+
const filePathToShowToUser = getConfigValueFilePathToShowToUser({ definedAt });
|
|
30
|
+
(0, utils_js_1.assert)(filePathToShowToUser);
|
|
31
|
+
return filePathToShowToUser;
|
|
32
|
+
}
|
|
33
|
+
exports.getHookFilePathToShowToUser = getHookFilePathToShowToUser;
|
|
@@ -4,7 +4,7 @@ exports.loadConfigValues = void 0;
|
|
|
4
4
|
const utils_js_1 = require("../utils.js");
|
|
5
5
|
const parseConfigValuesImported_js_1 = require("./serialize/parseConfigValuesImported.js");
|
|
6
6
|
async function loadConfigValues(pageConfig, isDev) {
|
|
7
|
-
if ('
|
|
7
|
+
if ('isAllLoaded' in pageConfig &&
|
|
8
8
|
// We don't need to cache in dev, since Vite already caches the virtual module
|
|
9
9
|
!isDev) {
|
|
10
10
|
return pageConfig;
|
|
@@ -12,7 +12,7 @@ async function loadConfigValues(pageConfig, isDev) {
|
|
|
12
12
|
const configValuesImported = await pageConfig.loadConfigValuesAll();
|
|
13
13
|
const configValuesAddendum = (0, parseConfigValuesImported_js_1.parseConfigValuesImported)(configValuesImported);
|
|
14
14
|
Object.assign(pageConfig.configValues, configValuesAddendum);
|
|
15
|
-
(0, utils_js_1.objectAssign)(pageConfig, {
|
|
15
|
+
(0, utils_js_1.objectAssign)(pageConfig, { isAllLoaded: true });
|
|
16
16
|
return pageConfig;
|
|
17
17
|
}
|
|
18
18
|
exports.loadConfigValues = loadConfigValues;
|
|
@@ -13,14 +13,12 @@ function parseConfigValuesImported(configValuesImported) {
|
|
|
13
13
|
configValues[configName] = {
|
|
14
14
|
value,
|
|
15
15
|
definedAt: {
|
|
16
|
-
file
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
[exportName]
|
|
23
|
-
}
|
|
16
|
+
// importPath cannot be relative to the current file, since the current file is a virtual file
|
|
17
|
+
filePathToShowToUser: importPath,
|
|
18
|
+
fileExportPathToShowToUser: [configName, 'default'].includes(exportName)
|
|
19
|
+
? []
|
|
20
|
+
: // Side-effect config
|
|
21
|
+
[exportName]
|
|
24
22
|
}
|
|
25
23
|
};
|
|
26
24
|
assertIsNotNull(value, configName, importPath);
|
|
@@ -4,7 +4,7 @@ exports.parsePageConfigs = void 0;
|
|
|
4
4
|
const parse_1 = require("@brillout/json-serializer/parse");
|
|
5
5
|
const parseConfigValuesImported_js_1 = require("./parseConfigValuesImported.js");
|
|
6
6
|
const utils_js_1 = require("../../utils.js");
|
|
7
|
-
const
|
|
7
|
+
const helpers_js_1 = require("../helpers.js");
|
|
8
8
|
function parsePageConfigs(pageConfigsSerialized, pageConfigGlobalSerialized) {
|
|
9
9
|
const pageConfigs = pageConfigsSerialized.map((pageConfigSerialized) => {
|
|
10
10
|
const configValues = {};
|
|
@@ -52,7 +52,7 @@ function assertRouteConfigValue(configValues) {
|
|
|
52
52
|
return;
|
|
53
53
|
const { value } = configValue;
|
|
54
54
|
const configValueType = typeof value;
|
|
55
|
-
const configDefinedAt = (0,
|
|
55
|
+
const configDefinedAt = (0, helpers_js_1.getConfigDefinedAtString)('Config', configName, configValue);
|
|
56
56
|
(0, utils_js_1.assertUsage)(configValueType === 'string' || (0, utils_js_1.isCallable)(value), `${configDefinedAt} has an invalid type '${configValueType}': it should be a string or a function instead, see https://vike.dev/route`);
|
|
57
57
|
/* We don't use assertRouteString() in order to avoid unnecessarily bloating the client-side bundle when using Server Routing:
|
|
58
58
|
* - When using Server Routing, this file is loaded => loading assertRouteString() would bloat the client bundle.
|