vike 0.4.162-commit-6812418 → 0.4.162-commit-421de1c
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/commonConfig.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -1
- package/dist/cjs/shared/page-configs/serialize/serializeConfigValue.js +4 -11
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/node/plugin/plugins/commonConfig.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -1
- package/dist/esm/shared/page-configs/PageConfig.d.ts +1 -0
- package/dist/esm/shared/page-configs/serialize/serializeConfigValue.js +5 -9
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +1 -1
|
@@ -85,5 +85,5 @@ function assertEsm(userViteRoot) {
|
|
|
85
85
|
}
|
|
86
86
|
function assertSingleInstance(config) {
|
|
87
87
|
const numberOfInstances = config.plugins.filter((o) => o.name === pluginName).length;
|
|
88
|
-
(0, utils_js_1.assertUsage)(numberOfInstances === 1, `Vike's Vite plugin (${picocolors_1.default.cyan("
|
|
88
|
+
(0, utils_js_1.assertUsage)(numberOfInstances === 1, `Vike's Vite plugin (${picocolors_1.default.cyan("import vike from 'vike/plugin'")}) is being added ${numberOfInstances} times to the list of Vite plugins. Make sure to add it only once instead.`);
|
|
89
89
|
}
|
|
@@ -474,7 +474,8 @@ function warnOverridenConfigValues(interfaceFileWinner, interfaceFilesOverriden,
|
|
|
474
474
|
interfaceFilesOverriden.forEach((interfaceFileLoser) => {
|
|
475
475
|
const loserFilePath = interfaceFileLoser.filePath.filePathToShowToUser;
|
|
476
476
|
const winnerFilePath = interfaceFileWinner.filePath.filePathToShowToUser;
|
|
477
|
-
|
|
477
|
+
const confName = picocolors_1.default.cyan(configName);
|
|
478
|
+
(0, utils_js_1.assertWarning)(false, `The value of the config ${confName} defined at ${loserFilePath} is always overwritten by the value defined at ${winnerFilePath}, remove the superfluous value defined at ${loserFilePath}`, { onlyOnce: true });
|
|
478
479
|
});
|
|
479
480
|
}
|
|
480
481
|
function isInterfaceFileUserLand(interfaceFile) {
|
|
@@ -515,6 +516,7 @@ async function getConfigValueSource(configName, interfaceFile, configDef, userRo
|
|
|
515
516
|
valueIsFilePath: true,
|
|
516
517
|
configEnv,
|
|
517
518
|
valueIsImportedAtRuntime: true,
|
|
519
|
+
valueIsDefinedByValueFile: false,
|
|
518
520
|
definedAt
|
|
519
521
|
};
|
|
520
522
|
return configValueSource;
|
|
@@ -530,6 +532,7 @@ async function getConfigValueSource(configName, interfaceFile, configDef, userRo
|
|
|
530
532
|
locationId,
|
|
531
533
|
configEnv,
|
|
532
534
|
valueIsImportedAtRuntime: true,
|
|
535
|
+
valueIsDefinedByValueFile: false,
|
|
533
536
|
definedAt: import_
|
|
534
537
|
};
|
|
535
538
|
// Load fake import
|
|
@@ -554,6 +557,7 @@ async function getConfigValueSource(configName, interfaceFile, configDef, userRo
|
|
|
554
557
|
value: configValue,
|
|
555
558
|
configEnv,
|
|
556
559
|
valueIsImportedAtRuntime: false,
|
|
560
|
+
valueIsDefinedByValueFile: false,
|
|
557
561
|
definedAt: definedAtConfigFile
|
|
558
562
|
};
|
|
559
563
|
return configValueSource;
|
|
@@ -566,6 +570,7 @@ async function getConfigValueSource(configName, interfaceFile, configDef, userRo
|
|
|
566
570
|
locationId,
|
|
567
571
|
configEnv,
|
|
568
572
|
valueIsImportedAtRuntime: !valueAlreadyLoaded,
|
|
573
|
+
valueIsDefinedByValueFile: true,
|
|
569
574
|
definedAt: {
|
|
570
575
|
...interfaceFile.filePath,
|
|
571
576
|
fileExportPathToShowToUser: configName === interfaceFile.configName
|
|
@@ -1,7 +1,4 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
-
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
-
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
-
};
|
|
5
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
3
|
exports.serializeConfigValueImported = exports.serializeConfigValue = void 0;
|
|
7
4
|
// This file is never loaded on the client-side but we save it under the vike/shared/ directory in order to collocate it with:
|
|
@@ -10,7 +7,6 @@ exports.serializeConfigValueImported = exports.serializeConfigValue = void 0;
|
|
|
10
7
|
// Both parsePageConfigs() parseConfigValuesImported() and are loaded on the client-side and server-side
|
|
11
8
|
const assertIsNotProductionRuntime_js_1 = require("../../../utils/assertIsNotProductionRuntime.js");
|
|
12
9
|
(0, assertIsNotProductionRuntime_js_1.assertIsNotProductionRuntime)();
|
|
13
|
-
const path_1 = __importDefault(require("path"));
|
|
14
10
|
const utils_js_1 = require("../../utils.js");
|
|
15
11
|
const generateEagerImport_js_1 = require("../../../node/plugin/plugins/importUserCode/generateEagerImport.js");
|
|
16
12
|
function serializeConfigValue(lines, configName, configValueSerialized) {
|
|
@@ -28,13 +24,10 @@ exports.serializeConfigValue = serializeConfigValue;
|
|
|
28
24
|
function serializeConfigValueImported(configValueSource, configName, whitespace, varCounterContainer, importStatements) {
|
|
29
25
|
(0, utils_js_1.assert)(!configValueSource.valueIsFilePath);
|
|
30
26
|
(0, utils_js_1.assert)(whitespace.replaceAll(' ', '').length === 0);
|
|
31
|
-
const { valueIsImportedAtRuntime, definedAt } = configValueSource;
|
|
27
|
+
const { valueIsImportedAtRuntime, valueIsDefinedByValueFile, definedAt } = configValueSource;
|
|
32
28
|
(0, utils_js_1.assert)(valueIsImportedAtRuntime);
|
|
33
29
|
const { filePathAbsoluteVite, fileExportName } = definedAt;
|
|
34
|
-
|
|
35
|
-
const fileName = path_1.default.posix.basename(filePathAbsoluteVite);
|
|
36
|
-
const isValueFile = fileName.startsWith('+');
|
|
37
|
-
if (isValueFile)
|
|
30
|
+
if (valueIsDefinedByValueFile)
|
|
38
31
|
(0, utils_js_1.assert)(fileExportName === undefined);
|
|
39
32
|
const { importName, importStatement } = (0, generateEagerImport_js_1.generateEagerImport)(filePathAbsoluteVite, varCounterContainer.varCounter++, fileExportName);
|
|
40
33
|
importStatements.push(importStatement);
|
|
@@ -42,8 +35,8 @@ function serializeConfigValueImported(configValueSource, configName, whitespace,
|
|
|
42
35
|
lines.push(` {`);
|
|
43
36
|
lines.push(` configName: '${configName}',`);
|
|
44
37
|
lines.push(` importPath: '${filePathAbsoluteVite}',`);
|
|
45
|
-
lines.push(` isValueFile: ${JSON.stringify(
|
|
46
|
-
if (
|
|
38
|
+
lines.push(` isValueFile: ${JSON.stringify(valueIsDefinedByValueFile)},`);
|
|
39
|
+
if (valueIsDefinedByValueFile) {
|
|
47
40
|
lines.push(` exportValues: ${importName},`);
|
|
48
41
|
}
|
|
49
42
|
else {
|
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PROJECT_VERSION = exports.projectInfo = void 0;
|
|
4
4
|
const assertSingleInstance_js_1 = require("./assertSingleInstance.js");
|
|
5
|
-
const PROJECT_VERSION = '0.4.162-commit-
|
|
5
|
+
const PROJECT_VERSION = '0.4.162-commit-421de1c';
|
|
6
6
|
exports.PROJECT_VERSION = PROJECT_VERSION;
|
|
7
7
|
const projectInfo = {
|
|
8
8
|
projectName: 'Vike',
|
|
@@ -79,5 +79,5 @@ function assertEsm(userViteRoot) {
|
|
|
79
79
|
}
|
|
80
80
|
function assertSingleInstance(config) {
|
|
81
81
|
const numberOfInstances = config.plugins.filter((o) => o.name === pluginName).length;
|
|
82
|
-
assertUsage(numberOfInstances === 1, `Vike's Vite plugin (${pc.cyan("
|
|
82
|
+
assertUsage(numberOfInstances === 1, `Vike's Vite plugin (${pc.cyan("import vike from 'vike/plugin'")}) is being added ${numberOfInstances} times to the list of Vite plugins. Make sure to add it only once instead.`);
|
|
83
83
|
}
|
|
@@ -469,7 +469,8 @@ function warnOverridenConfigValues(interfaceFileWinner, interfaceFilesOverriden,
|
|
|
469
469
|
interfaceFilesOverriden.forEach((interfaceFileLoser) => {
|
|
470
470
|
const loserFilePath = interfaceFileLoser.filePath.filePathToShowToUser;
|
|
471
471
|
const winnerFilePath = interfaceFileWinner.filePath.filePathToShowToUser;
|
|
472
|
-
|
|
472
|
+
const confName = pc.cyan(configName);
|
|
473
|
+
assertWarning(false, `The value of the config ${confName} defined at ${loserFilePath} is always overwritten by the value defined at ${winnerFilePath}, remove the superfluous value defined at ${loserFilePath}`, { onlyOnce: true });
|
|
473
474
|
});
|
|
474
475
|
}
|
|
475
476
|
function isInterfaceFileUserLand(interfaceFile) {
|
|
@@ -510,6 +511,7 @@ async function getConfigValueSource(configName, interfaceFile, configDef, userRo
|
|
|
510
511
|
valueIsFilePath: true,
|
|
511
512
|
configEnv,
|
|
512
513
|
valueIsImportedAtRuntime: true,
|
|
514
|
+
valueIsDefinedByValueFile: false,
|
|
513
515
|
definedAt
|
|
514
516
|
};
|
|
515
517
|
return configValueSource;
|
|
@@ -525,6 +527,7 @@ async function getConfigValueSource(configName, interfaceFile, configDef, userRo
|
|
|
525
527
|
locationId,
|
|
526
528
|
configEnv,
|
|
527
529
|
valueIsImportedAtRuntime: true,
|
|
530
|
+
valueIsDefinedByValueFile: false,
|
|
528
531
|
definedAt: import_
|
|
529
532
|
};
|
|
530
533
|
// Load fake import
|
|
@@ -549,6 +552,7 @@ async function getConfigValueSource(configName, interfaceFile, configDef, userRo
|
|
|
549
552
|
value: configValue,
|
|
550
553
|
configEnv,
|
|
551
554
|
valueIsImportedAtRuntime: false,
|
|
555
|
+
valueIsDefinedByValueFile: false,
|
|
552
556
|
definedAt: definedAtConfigFile
|
|
553
557
|
};
|
|
554
558
|
return configValueSource;
|
|
@@ -561,6 +565,7 @@ async function getConfigValueSource(configName, interfaceFile, configDef, userRo
|
|
|
561
565
|
locationId,
|
|
562
566
|
configEnv,
|
|
563
567
|
valueIsImportedAtRuntime: !valueAlreadyLoaded,
|
|
568
|
+
valueIsDefinedByValueFile: true,
|
|
564
569
|
definedAt: {
|
|
565
570
|
...interfaceFile.filePath,
|
|
566
571
|
fileExportPathToShowToUser: configName === interfaceFile.configName
|
|
@@ -75,6 +75,7 @@ type ConfigValueSource = {
|
|
|
75
75
|
valueIsImportedAtRuntime: boolean;
|
|
76
76
|
/** Whether the config value is a file path, for example config.client */
|
|
77
77
|
valueIsFilePath?: true;
|
|
78
|
+
valueIsDefinedByValueFile: boolean;
|
|
78
79
|
};
|
|
79
80
|
type DefinedAtFileFullInfo = DefinedAtFile & FilePath & {
|
|
80
81
|
fileExportName?: string;
|
|
@@ -6,8 +6,7 @@ export { serializeConfigValueImported };
|
|
|
6
6
|
// Both parsePageConfigs() parseConfigValuesImported() and are loaded on the client-side and server-side
|
|
7
7
|
import { assertIsNotProductionRuntime } from '../../../utils/assertIsNotProductionRuntime.js';
|
|
8
8
|
assertIsNotProductionRuntime();
|
|
9
|
-
import
|
|
10
|
-
import { assert, assertPosixPath } from '../../utils.js';
|
|
9
|
+
import { assert } from '../../utils.js';
|
|
11
10
|
import { generateEagerImport } from '../../../node/plugin/plugins/importUserCode/generateEagerImport.js';
|
|
12
11
|
function serializeConfigValue(lines, configName, configValueSerialized) {
|
|
13
12
|
let whitespace = ' ';
|
|
@@ -23,13 +22,10 @@ function serializeConfigValue(lines, configName, configValueSerialized) {
|
|
|
23
22
|
function serializeConfigValueImported(configValueSource, configName, whitespace, varCounterContainer, importStatements) {
|
|
24
23
|
assert(!configValueSource.valueIsFilePath);
|
|
25
24
|
assert(whitespace.replaceAll(' ', '').length === 0);
|
|
26
|
-
const { valueIsImportedAtRuntime, definedAt } = configValueSource;
|
|
25
|
+
const { valueIsImportedAtRuntime, valueIsDefinedByValueFile, definedAt } = configValueSource;
|
|
27
26
|
assert(valueIsImportedAtRuntime);
|
|
28
27
|
const { filePathAbsoluteVite, fileExportName } = definedAt;
|
|
29
|
-
|
|
30
|
-
const fileName = path.posix.basename(filePathAbsoluteVite);
|
|
31
|
-
const isValueFile = fileName.startsWith('+');
|
|
32
|
-
if (isValueFile)
|
|
28
|
+
if (valueIsDefinedByValueFile)
|
|
33
29
|
assert(fileExportName === undefined);
|
|
34
30
|
const { importName, importStatement } = generateEagerImport(filePathAbsoluteVite, varCounterContainer.varCounter++, fileExportName);
|
|
35
31
|
importStatements.push(importStatement);
|
|
@@ -37,8 +33,8 @@ function serializeConfigValueImported(configValueSource, configName, whitespace,
|
|
|
37
33
|
lines.push(` {`);
|
|
38
34
|
lines.push(` configName: '${configName}',`);
|
|
39
35
|
lines.push(` importPath: '${filePathAbsoluteVite}',`);
|
|
40
|
-
lines.push(` isValueFile: ${JSON.stringify(
|
|
41
|
-
if (
|
|
36
|
+
lines.push(` isValueFile: ${JSON.stringify(valueIsDefinedByValueFile)},`);
|
|
37
|
+
if (valueIsDefinedByValueFile) {
|
|
42
38
|
lines.push(` exportValues: ${importName},`);
|
|
43
39
|
}
|
|
44
40
|
else {
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
export { PROJECT_VERSION };
|
|
3
|
-
declare const PROJECT_VERSION: "0.4.162-commit-
|
|
3
|
+
declare const PROJECT_VERSION: "0.4.162-commit-421de1c";
|
|
4
4
|
declare const projectInfo: {
|
|
5
5
|
projectName: "Vike";
|
|
6
|
-
projectVersion: "0.4.162-commit-
|
|
6
|
+
projectVersion: "0.4.162-commit-421de1c";
|
|
7
7
|
};
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
export { PROJECT_VERSION };
|
|
3
3
|
import { onProjectInfo } from './assertSingleInstance.js';
|
|
4
|
-
const PROJECT_VERSION = '0.4.162-commit-
|
|
4
|
+
const PROJECT_VERSION = '0.4.162-commit-421de1c';
|
|
5
5
|
const projectInfo = {
|
|
6
6
|
projectName: 'Vike',
|
|
7
7
|
projectVersion: PROJECT_VERSION
|