vike 0.4.143-commit-fa295e1 → 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/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 +3 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +17 -8
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +2 -2
- 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 +69 -87
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +7 -42
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +24 -26
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/helpers.js +6 -8
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/isRuntimeEnvMatch.js +18 -0
- package/dist/cjs/node/plugin/shared/findPageFiles.js +2 -1
- package/dist/cjs/node/plugin/utils.js +1 -1
- package/dist/cjs/node/prerender/runPrerender.js +4 -4
- package/dist/cjs/node/runtime/renderPage.js +1 -1
- package/dist/cjs/shared/assertPageContextProvidedByUser.js +1 -1
- package/dist/cjs/shared/getPageFiles/getExports.js +4 -4
- package/dist/cjs/shared/getPageFiles/parseGlobResults.js +3 -3
- package/dist/cjs/shared/page-configs/getExportPath.js +7 -8
- package/dist/cjs/shared/page-configs/loadConfigValues.js +1 -1
- package/dist/cjs/shared/page-configs/serialize/PageConfigSerialized.js +2 -0
- package/dist/cjs/shared/{getPageFiles → page-configs/serialize}/assertPageConfigs.js +1 -1
- package/dist/cjs/shared/page-configs/{parseConfigValuesImported.js → serialize/parseConfigValuesImported.js} +13 -10
- package/dist/cjs/shared/{getPageFiles/parsePageConfigsSerialized.js → page-configs/serialize/parsePageConfigs.js} +6 -6
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValue.js +58 -0
- package/dist/cjs/shared/page-configs/utils.js +11 -12
- package/dist/cjs/shared/route/loadPageRoutes.js +1 -1
- package/dist/cjs/utils/getOutDirs.js +25 -18
- package/dist/cjs/utils/getValuePrintable.js +1 -1
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/cjs/utils/warnIfErrorIsNotObject.js +1 -1
- package/dist/esm/client/client-routing-runtime/useClientRouter.js +1 -1
- 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 +4 -6
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +18 -9
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +2 -2
- 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 +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +69 -87
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.d.ts +1 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +6 -38
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigs.js +21 -23
- 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 +6 -8
- 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/shared/findPageFiles.js +3 -2
- package/dist/esm/node/plugin/utils.js +1 -1
- package/dist/esm/node/prerender/runPrerender.js +5 -5
- package/dist/esm/node/runtime/renderPage.js +1 -1
- package/dist/esm/shared/assertPageContextProvidedByUser.js +1 -1
- package/dist/esm/shared/getPageFiles/getExports.js +4 -4
- package/dist/esm/shared/getPageFiles/parseGlobResults.js +3 -3
- package/dist/esm/shared/page-configs/PageConfig.d.ts +25 -62
- package/dist/esm/shared/page-configs/getExportPath.d.ts +1 -1
- package/dist/esm/shared/page-configs/getExportPath.js +7 -8
- package/dist/esm/shared/page-configs/loadConfigValues.js +1 -1
- 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/{getPageFiles → page-configs/serialize}/assertPageConfigs.d.ts +1 -1
- package/dist/esm/shared/{getPageFiles → page-configs/serialize}/assertPageConfigs.js +1 -1
- package/dist/esm/shared/page-configs/{parseConfigValuesImported.d.ts → serialize/parseConfigValuesImported.d.ts} +2 -1
- package/dist/esm/shared/page-configs/{parseConfigValuesImported.js → serialize/parseConfigValuesImported.js} +13 -10
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.d.ts +7 -0
- package/dist/esm/shared/{getPageFiles/parsePageConfigsSerialized.js → page-configs/serialize/parsePageConfigs.js} +5 -5
- 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 +3 -3
- package/dist/esm/shared/page-configs/utils.js +11 -12
- package/dist/esm/shared/route/loadPageRoutes.js +1 -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/projectInfo.d.ts +1 -1
- package/dist/esm/utils/projectInfo.js +1 -1
- package/dist/esm/utils/warnIfErrorIsNotObject.js +1 -1
- package/package.json +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/isConfigEnvMatch.js +0 -13
- 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/parsePageConfigsSerialized.d.ts +0 -6
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { parseConfigValuesImported };
|
|
2
|
-
import { assert, assertUsage } from '
|
|
3
|
-
import { assertExportsOfValueFile } from '
|
|
2
|
+
import { assert, assertUsage } from '../../utils.js';
|
|
3
|
+
import { assertExportsOfValueFile } from '../assertExports.js';
|
|
4
4
|
import pc from '@brillout/picocolors';
|
|
5
5
|
function parseConfigValuesImported(configValuesImported) {
|
|
6
6
|
const configValues = {};
|
|
@@ -8,10 +8,13 @@ function parseConfigValuesImported(configValuesImported) {
|
|
|
8
8
|
configValues[configName] = {
|
|
9
9
|
value,
|
|
10
10
|
definedAt: {
|
|
11
|
-
|
|
12
|
-
// importPath
|
|
11
|
+
file: {
|
|
12
|
+
// importPath cannot be relative to the current file, since the current file is a virtual file
|
|
13
13
|
filePathToShowToUser: importPath,
|
|
14
|
-
fileExportPath: [exportName
|
|
14
|
+
fileExportPath: [configName, 'default'].includes(exportName)
|
|
15
|
+
? []
|
|
16
|
+
: // Side-effect config
|
|
17
|
+
[exportName]
|
|
15
18
|
}
|
|
16
19
|
}
|
|
17
20
|
};
|
|
@@ -19,11 +22,11 @@ function parseConfigValuesImported(configValuesImported) {
|
|
|
19
22
|
};
|
|
20
23
|
configValuesImported.forEach((configValueLoaded) => {
|
|
21
24
|
if (configValueLoaded.isValueFile) {
|
|
22
|
-
const {
|
|
25
|
+
const { exportValues, importPath, configName } = configValueLoaded;
|
|
23
26
|
if (configName !== 'client') {
|
|
24
|
-
assertExportsOfValueFile(
|
|
27
|
+
assertExportsOfValueFile(exportValues, importPath, configName);
|
|
25
28
|
}
|
|
26
|
-
Object.entries(
|
|
29
|
+
Object.entries(exportValues).forEach(([exportName, exportValue]) => {
|
|
27
30
|
const isSideExport = exportName !== 'default'; // .md files may have "side-exports" such as `export { frontmatter }`
|
|
28
31
|
const configName = isSideExport ? exportName : configValueLoaded.configName;
|
|
29
32
|
if (isSideExport && configName in configValues) {
|
|
@@ -35,8 +38,8 @@ function parseConfigValuesImported(configValuesImported) {
|
|
|
35
38
|
});
|
|
36
39
|
}
|
|
37
40
|
else {
|
|
38
|
-
const { configName, importPath,
|
|
39
|
-
addConfigValue(configName,
|
|
41
|
+
const { configName, importPath, exportValue, exportName } = configValueLoaded;
|
|
42
|
+
addConfigValue(configName, exportValue, importPath, exportName);
|
|
40
43
|
}
|
|
41
44
|
});
|
|
42
45
|
return configValues;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export { parsePageConfigs };
|
|
2
|
+
import type { PageConfigRuntime, PageConfigGlobalRuntime } from '../PageConfig.js';
|
|
3
|
+
import type { PageConfigGlobalRuntimeSerialized, PageConfigRuntimeSerialized } from './PageConfigSerialized.js';
|
|
4
|
+
declare function parsePageConfigs(pageConfigsSerialized: PageConfigRuntimeSerialized[], pageConfigGlobalSerialized: PageConfigGlobalRuntimeSerialized): {
|
|
5
|
+
pageConfigs: PageConfigRuntime[];
|
|
6
|
+
pageConfigGlobal: PageConfigGlobalRuntime;
|
|
7
|
+
};
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { parsePageConfigs };
|
|
2
2
|
import { parse } from '@brillout/json-serializer/parse';
|
|
3
|
-
import { parseConfigValuesImported } from '
|
|
4
|
-
import { assert, assertUsage, isCallable } from '
|
|
5
|
-
import { getConfigDefinedAtString } from '../
|
|
6
|
-
function
|
|
3
|
+
import { parseConfigValuesImported } from './parseConfigValuesImported.js';
|
|
4
|
+
import { assert, assertUsage, isCallable } from '../../utils.js';
|
|
5
|
+
import { getConfigDefinedAtString } from '../utils.js';
|
|
6
|
+
function parsePageConfigs(pageConfigsSerialized, pageConfigGlobalSerialized) {
|
|
7
7
|
const pageConfigs = pageConfigsSerialized.map((pageConfigSerialized) => {
|
|
8
8
|
const configValues = {};
|
|
9
9
|
{
|
|
@@ -0,0 +1,8 @@
|
|
|
1
|
+
export { serializeConfigValue };
|
|
2
|
+
export { serializeConfigValueImported };
|
|
3
|
+
import { ConfigValueSource } from '../PageConfig.js';
|
|
4
|
+
import { ConfigValueSerialized } from './PageConfigSerialized.js';
|
|
5
|
+
declare function serializeConfigValue(lines: string[], configName: string, configValueSerialized: ConfigValueSerialized): void;
|
|
6
|
+
declare function serializeConfigValueImported(configValueSource: ConfigValueSource, configName: string, whitespace: string, varCounterContainer: {
|
|
7
|
+
varCounter: number;
|
|
8
|
+
}, importStatements: string[]): string[];
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
export { serializeConfigValue };
|
|
2
|
+
export { serializeConfigValueImported };
|
|
3
|
+
// This file is never loaded on the client-side but we save it under the vike/shared/ directory in order to collocate it with:
|
|
4
|
+
// - vike/shared/page-configs/serialize/parsePageConfigs.ts
|
|
5
|
+
// - vike/shared/page-configs/serialize/parseConfigValuesImported.ts
|
|
6
|
+
// Both parsePageConfigs() parseConfigValuesImported() and are loaded on the client-side and server-side
|
|
7
|
+
import { assertIsNotProductionRuntime } from '../../../utils/assertIsNotProductionRuntime.js';
|
|
8
|
+
assertIsNotProductionRuntime();
|
|
9
|
+
import path from 'path';
|
|
10
|
+
import { assert, assertPosixPath } from '../../utils.js';
|
|
11
|
+
import { generateEagerImport } from '../../../node/plugin/plugins/importUserCode/generateEagerImport.js';
|
|
12
|
+
function serializeConfigValue(lines, configName, configValueSerialized) {
|
|
13
|
+
let whitespace = ' ';
|
|
14
|
+
lines.push(`${whitespace}['${configName}']: {`);
|
|
15
|
+
whitespace += ' ';
|
|
16
|
+
Object.entries(configValueSerialized).forEach(([key, val]) => {
|
|
17
|
+
const valSerialized = key === 'definedAt' ? JSON.stringify(val) : val;
|
|
18
|
+
lines.push(`${whitespace} ${key}: ${valSerialized},`);
|
|
19
|
+
});
|
|
20
|
+
whitespace = whitespace.slice(2);
|
|
21
|
+
lines.push(`${whitespace}},`);
|
|
22
|
+
}
|
|
23
|
+
function serializeConfigValueImported(configValueSource, configName, whitespace, varCounterContainer, importStatements) {
|
|
24
|
+
assert(!configValueSource.valueIsFilePath);
|
|
25
|
+
assert(whitespace.replaceAll(' ', '').length === 0);
|
|
26
|
+
const { valueIsImportedAtRuntime, definedAtInfo } = configValueSource;
|
|
27
|
+
assert(valueIsImportedAtRuntime);
|
|
28
|
+
const { filePathRelativeToUserRootDir, importPathAbsolute, exportName } = definedAtInfo;
|
|
29
|
+
const importPath = filePathRelativeToUserRootDir ?? importPathAbsolute;
|
|
30
|
+
assertPosixPath(importPath);
|
|
31
|
+
const fileName = path.posix.basename(importPath);
|
|
32
|
+
const isValueFile = fileName.startsWith('+');
|
|
33
|
+
if (isValueFile)
|
|
34
|
+
assert(exportName === undefined);
|
|
35
|
+
const { importName, importStatement } = generateEagerImport(importPath, varCounterContainer.varCounter++, exportName);
|
|
36
|
+
importStatements.push(importStatement);
|
|
37
|
+
const lines = [];
|
|
38
|
+
lines.push(` {`);
|
|
39
|
+
lines.push(` configName: '${configName}',`);
|
|
40
|
+
lines.push(` importPath: '${importPath}',`);
|
|
41
|
+
lines.push(` isValueFile: ${JSON.stringify(isValueFile)},`);
|
|
42
|
+
if (isValueFile) {
|
|
43
|
+
lines.push(` exportValues: ${importName},`);
|
|
44
|
+
}
|
|
45
|
+
else {
|
|
46
|
+
lines.push(` exportValue: ${importName},`);
|
|
47
|
+
assert(exportName);
|
|
48
|
+
lines.push(` exportName: ${JSON.stringify(exportName)},`);
|
|
49
|
+
}
|
|
50
|
+
lines.push(` },`);
|
|
51
|
+
return lines;
|
|
52
|
+
}
|
|
@@ -18,15 +18,15 @@ declare function getConfigValue(pageConfig: PageConfigCommon, configName: Config
|
|
|
18
18
|
value: unknown;
|
|
19
19
|
};
|
|
20
20
|
declare function getPageConfig(pageId: string, pageConfigs: PageConfigRuntime[]): PageConfigRuntime;
|
|
21
|
-
type ConfigDefinedAtUppercase<ConfigName extends string> = `Config ${ConfigName} defined ${string}`;
|
|
22
|
-
type ConfigDefinedAtLowercase<ConfigName extends string> = `config ${ConfigName} defined ${string}`;
|
|
21
|
+
type ConfigDefinedAtUppercase<ConfigName extends string> = `Config ${ConfigName} defined ${'internally' | `at ${string}`}`;
|
|
22
|
+
type ConfigDefinedAtLowercase<ConfigName extends string> = `config ${ConfigName} defined ${'internally' | `at ${string}`}`;
|
|
23
23
|
declare function getConfigDefinedAtString<ConfigName extends string>(configName: ConfigName, { definedAt }: {
|
|
24
24
|
definedAt: DefinedAt;
|
|
25
25
|
}, sentenceBegin: true, append?: 'effect'): ConfigDefinedAtUppercase<ConfigName>;
|
|
26
26
|
declare function getConfigDefinedAtString<ConfigName extends string>(configName: ConfigName, { definedAt }: {
|
|
27
27
|
definedAt: DefinedAt;
|
|
28
28
|
}, sentenceBegin: false, append?: 'effect'): ConfigDefinedAtLowercase<ConfigName>;
|
|
29
|
-
declare function getDefinedAtString(configValue: ConfigValue): string;
|
|
29
|
+
declare function getDefinedAtString(configValue: ConfigValue, configName: string): string;
|
|
30
30
|
declare function getConfigValueFilePathToShowToUser({ definedAt }: {
|
|
31
31
|
definedAt: DefinedAt;
|
|
32
32
|
}): null | string;
|
|
@@ -43,26 +43,26 @@ function getPageConfig(pageId, pageConfigs) {
|
|
|
43
43
|
return pageConfig;
|
|
44
44
|
}
|
|
45
45
|
function getConfigDefinedAtString(configName, { definedAt }, sentenceBegin) {
|
|
46
|
-
const configDefinedAt = `${sentenceBegin ? `Config` : `config`} ${pc.cyan(configName)} defined ${getSourceString(definedAt)}`;
|
|
46
|
+
const configDefinedAt = `${sentenceBegin ? `Config` : `config`} ${pc.cyan(configName)} defined ${getSourceString(definedAt, configName)}`;
|
|
47
47
|
return configDefinedAt;
|
|
48
48
|
}
|
|
49
|
-
function getSourceString(definedAt) {
|
|
49
|
+
function getSourceString(definedAt, configName) {
|
|
50
50
|
if (definedAt.isComputed) {
|
|
51
51
|
return 'internally';
|
|
52
52
|
}
|
|
53
|
-
let
|
|
53
|
+
let files;
|
|
54
54
|
if (definedAt.isCumulative) {
|
|
55
|
-
|
|
55
|
+
files = definedAt.files;
|
|
56
56
|
}
|
|
57
57
|
else {
|
|
58
|
-
|
|
58
|
+
files = [definedAt.file];
|
|
59
59
|
}
|
|
60
|
-
assert(
|
|
61
|
-
const sourceString =
|
|
60
|
+
assert(files.length >= 1);
|
|
61
|
+
const sourceString = files
|
|
62
62
|
.map((source) => {
|
|
63
63
|
const { filePathToShowToUser, fileExportPath } = source;
|
|
64
64
|
let s = filePathToShowToUser;
|
|
65
|
-
const exportPath = getExportPath(fileExportPath);
|
|
65
|
+
const exportPath = getExportPath(fileExportPath, configName);
|
|
66
66
|
if (exportPath) {
|
|
67
67
|
s = `${s} > ${pc.cyan(exportPath)}`;
|
|
68
68
|
}
|
|
@@ -74,8 +74,8 @@ function getSourceString(definedAt) {
|
|
|
74
74
|
.join(' / ');
|
|
75
75
|
return `at ${sourceString}`;
|
|
76
76
|
}
|
|
77
|
-
function getDefinedAtString(configValue) {
|
|
78
|
-
let sourceString = getSourceString(configValue.definedAt);
|
|
77
|
+
function getDefinedAtString(configValue, configName) {
|
|
78
|
+
let sourceString = getSourceString(configValue.definedAt, configName);
|
|
79
79
|
if (sourceString.startsWith('at '))
|
|
80
80
|
sourceString = sourceString.slice('at '.length);
|
|
81
81
|
return sourceString;
|
|
@@ -86,8 +86,7 @@ function getConfigValueFilePathToShowToUser({ definedAt }) {
|
|
|
86
86
|
// - computed values don't have any file path
|
|
87
87
|
if (definedAt.isComputed || definedAt.isCumulative)
|
|
88
88
|
return null;
|
|
89
|
-
const {
|
|
90
|
-
const { filePathToShowToUser } = source;
|
|
89
|
+
const { filePathToShowToUser } = definedAt.file;
|
|
91
90
|
assert(filePathToShowToUser);
|
|
92
91
|
return filePathToShowToUser;
|
|
93
92
|
}
|
|
@@ -31,7 +31,7 @@ function getPageRoutes(filesystemRoots, pageFilesAll, pageConfigs, allPageIds) {
|
|
|
31
31
|
const configValue = getConfigValue(pageConfig, configName);
|
|
32
32
|
if (configValue) {
|
|
33
33
|
const route = configValue.value;
|
|
34
|
-
const definedAt = getDefinedAtString(configValue);
|
|
34
|
+
const definedAt = getDefinedAtString(configValue, configName);
|
|
35
35
|
if (typeof route === 'string') {
|
|
36
36
|
pageRoute = {
|
|
37
37
|
pageId,
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getOutDirs };
|
|
2
|
-
export { getOutDirs_prerender };
|
|
3
2
|
export { resolveOutDir };
|
|
4
3
|
import type { UserConfig, ResolvedConfig } from 'vite';
|
|
5
4
|
type OutDirs = {
|
|
@@ -11,6 +10,5 @@ type OutDirs = {
|
|
|
11
10
|
outDirServer: string;
|
|
12
11
|
};
|
|
13
12
|
declare function getOutDirs(config: ResolvedConfig): OutDirs;
|
|
14
|
-
declare function getOutDirs_prerender(config: ResolvedConfig): OutDirs;
|
|
15
13
|
/** Appends `client/` or `server/` to `config.build.outDir` */
|
|
16
14
|
declare function resolveOutDir(config: UserConfig): string;
|
|
@@ -1,5 +1,4 @@
|
|
|
1
1
|
export { getOutDirs };
|
|
2
|
-
export { getOutDirs_prerender };
|
|
3
2
|
export { resolveOutDir };
|
|
4
3
|
import { viteIsSSR } from './viteIsSSR.js';
|
|
5
4
|
import { assert, assertUsage } from './assert.js';
|
|
@@ -7,21 +6,24 @@ import { pathJoin } from './path-shim.js';
|
|
|
7
6
|
import { assertPosixPath, toPosixPath } from './filesystemPathHandling.js';
|
|
8
7
|
import pc from '@brillout/picocolors';
|
|
9
8
|
function getOutDirs(config) {
|
|
10
|
-
|
|
11
|
-
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
15
|
-
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
9
|
+
let outDirRoot;
|
|
10
|
+
{
|
|
11
|
+
const outDir = getOutDirFromViteResolvedConfig(config);
|
|
12
|
+
if (isOutDirRoot(outDir)) {
|
|
13
|
+
outDirRoot = outDir;
|
|
14
|
+
}
|
|
15
|
+
else {
|
|
16
|
+
assertOutDirResolved(outDir, config);
|
|
17
|
+
assert(outDir.endsWith('/server') || outDir.endsWith('/client'));
|
|
18
|
+
assert('/client'.length === '/server'.length);
|
|
19
|
+
outDirRoot = outDir.slice(0, -1 * '/client'.length);
|
|
20
|
+
}
|
|
21
|
+
}
|
|
20
22
|
return getOutDirsAll(outDirRoot, config.root);
|
|
21
23
|
}
|
|
22
24
|
/** Appends `client/` or `server/` to `config.build.outDir` */
|
|
23
25
|
function resolveOutDir(config) {
|
|
24
|
-
const outDir =
|
|
26
|
+
const outDir = getOutDirFromViteUserConfig(config) || 'dist';
|
|
25
27
|
// outDir may already be resolved when using Telefunc + vike (because both Telefunc and vike use this logic)
|
|
26
28
|
if (!isOutDirRoot(outDir)) {
|
|
27
29
|
assertOutDirResolved(outDir, config);
|
|
@@ -39,6 +41,7 @@ function resolveOutDir(config) {
|
|
|
39
41
|
}
|
|
40
42
|
function determineOutDirs(outDirRoot) {
|
|
41
43
|
assertPosixPath(outDirRoot);
|
|
44
|
+
assert(!outDirRoot.endsWith('/'));
|
|
42
45
|
assert(isOutDirRoot(outDirRoot));
|
|
43
46
|
const outDirClient = pathJoin(outDirRoot, 'client');
|
|
44
47
|
const outDirServer = pathJoin(outDirRoot, 'server');
|
|
@@ -89,18 +92,22 @@ function assertOutDirResolved(outDir, config) {
|
|
|
89
92
|
assertUsage(outDir.endsWith('/client'), wrongUsage);
|
|
90
93
|
}
|
|
91
94
|
}
|
|
92
|
-
function
|
|
95
|
+
function getOutDirFromViteUserConfig(config) {
|
|
93
96
|
let outDir = config.build?.outDir;
|
|
94
97
|
if (outDir === undefined)
|
|
95
98
|
return undefined;
|
|
96
|
-
|
|
97
|
-
outDir = toPosixPath(outDir);
|
|
99
|
+
outDir = normalize(outDir);
|
|
98
100
|
return outDir;
|
|
99
101
|
}
|
|
100
|
-
function
|
|
102
|
+
function getOutDirFromViteResolvedConfig(config) {
|
|
101
103
|
let outDir = config.build.outDir;
|
|
102
|
-
|
|
104
|
+
assert(outDir);
|
|
105
|
+
outDir = normalize(outDir);
|
|
106
|
+
return outDir;
|
|
107
|
+
}
|
|
108
|
+
function normalize(outDir) {
|
|
103
109
|
outDir = toPosixPath(outDir);
|
|
110
|
+
outDir = outDir.replace(/\/+$/, ''); // remove trailing slashes
|
|
104
111
|
return outDir;
|
|
105
112
|
}
|
|
106
113
|
function outDirIsAbsolutePath(outDir) {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export function getValuePrintable(value) {
|
|
2
2
|
if ([null, undefined].includes(value))
|
|
3
3
|
return String(value);
|
|
4
|
-
if (['
|
|
4
|
+
if (['boolean', 'number', 'string'].includes(typeof value))
|
|
5
5
|
return JSON.stringify(value);
|
|
6
6
|
return null;
|
|
7
7
|
}
|
|
@@ -5,7 +5,7 @@ type ProjectVersion = typeof projectInfo.projectVersion;
|
|
|
5
5
|
type ProjectTag = `[${PackageName}]` | `[${PackageName}@${ProjectVersion}]`;
|
|
6
6
|
declare const projectInfo: {
|
|
7
7
|
projectName: "Vike";
|
|
8
|
-
projectVersion: "0.4.
|
|
8
|
+
projectVersion: "0.4.144-commit-e40e9b1";
|
|
9
9
|
npmPackageName: "vike";
|
|
10
10
|
githubRepository: "https://github.com/vikejs/vike";
|
|
11
11
|
};
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
import { onProjectInfo } from './assertSingleInstance.js';
|
|
3
|
-
const PROJECT_VERSION = '0.4.
|
|
3
|
+
const PROJECT_VERSION = '0.4.144-commit-e40e9b1';
|
|
4
4
|
const projectInfo = {
|
|
5
5
|
projectName: 'Vike',
|
|
6
6
|
projectVersion: PROJECT_VERSION,
|
|
@@ -7,7 +7,7 @@ assertIsNotBrowser();
|
|
|
7
7
|
// It would be cleaner to:
|
|
8
8
|
// - Call assertUsageErrorIsObject() right after calling the user's hook
|
|
9
9
|
// - Attach the original error: assertUsageError.originalErrorValue = err
|
|
10
|
-
// - Show the original error in
|
|
10
|
+
// - Show the original error in Vike's error handling
|
|
11
11
|
// - Use assertErrorIsObject() throughout Vike's source code
|
|
12
12
|
function warnIfErrorIsNotObject(err) {
|
|
13
13
|
if (!isObject(err)) {
|
package/package.json
CHANGED
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isConfigEnvMatch = void 0;
|
|
4
|
-
function isConfigEnvMatch(configEnv, isForClientSide, isClientRouting) {
|
|
5
|
-
if (configEnv === '_routing-eager' || configEnv === 'config-only')
|
|
6
|
-
return false;
|
|
7
|
-
if (configEnv === (isForClientSide ? 'server-only' : 'client-only'))
|
|
8
|
-
return false;
|
|
9
|
-
if (configEnv === '_routing-lazy' && isForClientSide && !isClientRouting)
|
|
10
|
-
return false;
|
|
11
|
-
return true;
|
|
12
|
-
}
|
|
13
|
-
exports.isConfigEnvMatch = isConfigEnvMatch;
|
|
@@ -1,10 +0,0 @@
|
|
|
1
|
-
export { isConfigEnvMatch };
|
|
2
|
-
function isConfigEnvMatch(configEnv, isForClientSide, isClientRouting) {
|
|
3
|
-
if (configEnv === '_routing-eager' || configEnv === 'config-only')
|
|
4
|
-
return false;
|
|
5
|
-
if (configEnv === (isForClientSide ? 'server-only' : 'client-only'))
|
|
6
|
-
return false;
|
|
7
|
-
if (configEnv === '_routing-lazy' && isForClientSide && !isClientRouting)
|
|
8
|
-
return false;
|
|
9
|
-
return true;
|
|
10
|
-
}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export { parsePageConfigsSerialized };
|
|
2
|
-
import type { PageConfigRuntime, PageConfigGlobalRuntime, PageConfigGlobalRuntimeSerialized, PageConfigRuntimeSerialized } from '../page-configs/PageConfig.js';
|
|
3
|
-
declare function parsePageConfigsSerialized(pageConfigsSerialized: PageConfigRuntimeSerialized[], pageConfigGlobalSerialized: PageConfigGlobalRuntimeSerialized): {
|
|
4
|
-
pageConfigs: PageConfigRuntime[];
|
|
5
|
-
pageConfigGlobal: PageConfigGlobalRuntime;
|
|
6
|
-
};
|