vike 0.4.223-commit-6adb186 → 0.4.223-commit-e239e2b
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/api/build.js +1 -1
- package/dist/cjs/node/api/prepareViteApiCall.js +0 -1
- package/dist/cjs/node/plugin/plugins/build/handleAssetsManifest.js +1 -1
- package/dist/cjs/node/plugin/plugins/build/pluginAutoFullBuild.js +2 -2
- package/dist/cjs/node/plugin/plugins/build/pluginBuildApp.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +22 -13
- package/dist/cjs/node/prerender/runPrerender.js +2 -1
- package/dist/cjs/shared/page-configs/serialize/parsePageConfigs.js +3 -1
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/node/api/build.js +1 -1
- package/dist/esm/node/api/prepareViteApiCall.js +0 -1
- package/dist/esm/node/plugin/plugins/build/handleAssetsManifest.js +1 -1
- package/dist/esm/node/plugin/plugins/build/pluginAutoFullBuild.js +2 -2
- package/dist/esm/node/plugin/plugins/build/pluginBuildApp.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +22 -13
- package/dist/esm/node/prerender/runPrerender.js +2 -1
- package/dist/esm/shared/page-configs/Config.d.ts +4 -2
- package/dist/esm/shared/page-configs/serialize/parsePageConfigs.js +3 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +2 -2
|
@@ -20,7 +20,7 @@ async function build(options = {}) {
|
|
|
20
20
|
// Pass it to pluginAutoFullBuild()
|
|
21
21
|
if (viteConfigEnhanced)
|
|
22
22
|
viteConfigEnhanced._viteConfigEnhanced = viteConfigEnhanced;
|
|
23
|
-
if (vikeConfig.global.config.
|
|
23
|
+
if (vikeConfig.global.config.vite6BuilderApp) {
|
|
24
24
|
(0, utils_js_1.assertVersion)('Vite', vite_1.version, '6.0.0');
|
|
25
25
|
const builder = await (0, vite_1.createBuilder)(viteConfigEnhanced);
|
|
26
26
|
// See Vite plugin vike:build:pluginBuildApp
|
|
@@ -40,7 +40,6 @@ exports.prepareViteApiCall = prepareViteApiCall;
|
|
|
40
40
|
exports.getViteRoot = getViteRoot;
|
|
41
41
|
exports.assertViteRoot = assertViteRoot;
|
|
42
42
|
exports.normalizeViteRoot = normalizeViteRoot;
|
|
43
|
-
// TODO: enable Vike extensions to add Vite plugins
|
|
44
43
|
const vite_1 = require("vite");
|
|
45
44
|
const context_js_1 = require("./context.js");
|
|
46
45
|
const getVikeConfig_js_1 = require("../plugin/plugins/importUserCode/v1-design/getVikeConfig.js");
|
|
@@ -294,7 +294,7 @@ function handleAssetsManifest_getBuildConfig(config) {
|
|
|
294
294
|
// Required if `ssrEmitAssets: true`, see https://github.com/vitejs/vite/pull/11430#issuecomment-1454800934
|
|
295
295
|
cssMinify: isFixEnabled ? 'esbuild' : undefined,
|
|
296
296
|
manifest: pluginBuildConfig_js_1.manifestTempFile,
|
|
297
|
-
copyPublicDir: vike.config.
|
|
297
|
+
copyPublicDir: vike.config.vite6BuilderApp
|
|
298
298
|
? // Already set by vike:build:pluginBuildApp
|
|
299
299
|
undefined
|
|
300
300
|
: !(0, isViteServerBuild_js_1.isViteServerBuild)(config)
|
|
@@ -55,7 +55,7 @@ function pluginAutoFullBuild() {
|
|
|
55
55
|
(0, handleAssetsManifest_js_1.handleAssetsManifest_assertUsageCssTarget)(config);
|
|
56
56
|
if (forceExit &&
|
|
57
57
|
// Let vike:build:pluginBuildApp force exit
|
|
58
|
-
!vikeConfig.global.config.
|
|
58
|
+
!vikeConfig.global.config.vite6BuilderApp) {
|
|
59
59
|
(0, runPrerender_js_1.runPrerender_forceExit)();
|
|
60
60
|
(0, utils_js_1.assert)(false);
|
|
61
61
|
}
|
|
@@ -66,7 +66,7 @@ function pluginAutoFullBuild() {
|
|
|
66
66
|
}
|
|
67
67
|
async function triggerFullBuild(config, vikeConfig, viteEnv, bundle) {
|
|
68
68
|
// Whether builder.buildApp() is being used, see plugin:build:pluginBuildApp
|
|
69
|
-
const isBuilderApp = vikeConfig.global.config.
|
|
69
|
+
const isBuilderApp = vikeConfig.global.config.vite6BuilderApp;
|
|
70
70
|
// If builder.buildApp() => trigger at end of `this.environment.name === 'ssr'`.
|
|
71
71
|
// Else => trigger at end of client-side build.
|
|
72
72
|
if (isBuilderApp ? !(0, isViteServerBuild_js_1.isViteServerBuild_onlySsrEnv)(config, viteEnv) : !(0, isViteServerBuild_js_1.isViteClientBuild)(config, viteEnv))
|
|
@@ -206,6 +206,7 @@ function getPageConfigsBuildTime(configDefinitionsResolved, plusFilesAll, userRo
|
|
|
206
206
|
return;
|
|
207
207
|
pageConfigGlobal.configValueSources[configName] = sources;
|
|
208
208
|
});
|
|
209
|
+
applyEffectsAll(pageConfigGlobal.configValueSources, configDefinitionsResolved.configDefinitionsGlobal);
|
|
209
210
|
assertPageConfigGlobal(pageConfigGlobal, plusFilesAll);
|
|
210
211
|
const pageConfigs = (0, utils_js_1.objectEntries)(configDefinitionsResolved.configDefinitionsLocal)
|
|
211
212
|
.filter(([_locationId, { plusFiles }]) => isDefiningPage(plusFiles))
|
|
@@ -679,7 +680,7 @@ function applyEffectsAll(configValueSources, configDefinitions) {
|
|
|
679
680
|
if (!source)
|
|
680
681
|
return;
|
|
681
682
|
// The config value is eagerly loaded since `configDef.env === 'config-only``
|
|
682
|
-
(0, utils_js_1.assert)('value' in source);
|
|
683
|
+
(0, utils_js_1.assert)('value' in source); // TODO/now: refactor all `'value' in`
|
|
683
684
|
// Call effect
|
|
684
685
|
const configModFromEffect = configDef.effect({
|
|
685
686
|
configValue: source.value,
|
|
@@ -687,12 +688,11 @@ function applyEffectsAll(configValueSources, configDefinitions) {
|
|
|
687
688
|
});
|
|
688
689
|
if (!configModFromEffect)
|
|
689
690
|
return;
|
|
690
|
-
(
|
|
691
|
-
applyEffect(configModFromEffect, configValueSources, configDef);
|
|
691
|
+
applyEffect(configModFromEffect, source, configValueSources, configName, configDef, configDefinitions);
|
|
692
692
|
});
|
|
693
693
|
}
|
|
694
|
-
function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
695
|
-
const notSupported =
|
|
694
|
+
function applyEffect(configModFromEffect, source, configValueSources, configNameEffect, configDefEffect, configDefinitions) {
|
|
695
|
+
const notSupported = `${picocolors_1.default.cyan('meta.effect')} currently only supports setting the value of a config, or modifying the ${picocolors_1.default.cyan('meta.env')} of a config.`;
|
|
696
696
|
(0, utils_js_1.objectEntries)(configModFromEffect).forEach(([configName, configValue]) => {
|
|
697
697
|
if (configName === 'meta') {
|
|
698
698
|
let configDefinedAt;
|
|
@@ -718,14 +718,23 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
718
718
|
});
|
|
719
719
|
}
|
|
720
720
|
else {
|
|
721
|
-
|
|
722
|
-
|
|
723
|
-
|
|
724
|
-
|
|
725
|
-
|
|
726
|
-
|
|
727
|
-
|
|
728
|
-
|
|
721
|
+
const configDef = configDefinitions[configName];
|
|
722
|
+
(0, utils_js_1.assert)(configDef);
|
|
723
|
+
(0, utils_js_1.assert)(configDefEffect._userEffectDefinedAtFilePath);
|
|
724
|
+
const configValueSource = {
|
|
725
|
+
definedAtFilePath: configDefEffect._userEffectDefinedAtFilePath,
|
|
726
|
+
plusFile: source.plusFile,
|
|
727
|
+
locationId: source.locationId,
|
|
728
|
+
configEnv: configDef.env,
|
|
729
|
+
isOverriden: false, // TODO/now check
|
|
730
|
+
valueIsLoadedWithImport: false,
|
|
731
|
+
valueIsDefinedByPlusValueFile: false,
|
|
732
|
+
valueIsLoaded: true,
|
|
733
|
+
value: configValue
|
|
734
|
+
};
|
|
735
|
+
(0, utils_js_1.assertUsage)(!!configDef.global === !!configDefEffect.global, `The configuration ${picocolors_1.default.cyan(configNameEffect)} has a ${picocolors_1.default.cyan('meta.effect')} that changes the configuration ${picocolors_1.default.cyan(configName)} and, consequently, both ${picocolors_1.default.cyan(configNameEffect)} and ${picocolors_1.default.cyan(configName)} must have the same ${picocolors_1.default.cyan('meta.global')} value.`);
|
|
736
|
+
configValueSources[configName] ?? (configValueSources[configName] = []);
|
|
737
|
+
configValueSources[configName].push(configValueSource);
|
|
729
738
|
}
|
|
730
739
|
});
|
|
731
740
|
}
|
|
@@ -816,7 +816,8 @@ prerenderConfig) {
|
|
|
816
816
|
}
|
|
817
817
|
function makePublic(prerenderContext) {
|
|
818
818
|
const prerenderContextPublic = (0, utils_js_1.makePublicCopy)(prerenderContext, 'prerenderContext', [
|
|
819
|
-
'pageContexts'
|
|
819
|
+
'pageContexts',
|
|
820
|
+
'output'
|
|
820
821
|
]);
|
|
821
822
|
return prerenderContextPublic;
|
|
822
823
|
}
|
|
@@ -66,7 +66,9 @@ function parseConfigValuesSerialized_tmp(configValuesSerialized) {
|
|
|
66
66
|
const { valueSerialized, ...common } = configValueSeriliazed;
|
|
67
67
|
const { value, sideExports } = parseValueSerialized(valueSerialized, configName, () => {
|
|
68
68
|
(0, utils_js_1.assert)(configValueSeriliazed.type !== 'computed');
|
|
69
|
-
|
|
69
|
+
const { definedAtData } = configValueSeriliazed;
|
|
70
|
+
const definedAtFile = Array.isArray(definedAtData) ? definedAtData[0] : definedAtData;
|
|
71
|
+
return definedAtFile;
|
|
70
72
|
});
|
|
71
73
|
addSideExports(sideExports);
|
|
72
74
|
configValue = { value, ...common };
|
|
@@ -15,7 +15,7 @@ async function build(options = {}) {
|
|
|
15
15
|
// Pass it to pluginAutoFullBuild()
|
|
16
16
|
if (viteConfigEnhanced)
|
|
17
17
|
viteConfigEnhanced._viteConfigEnhanced = viteConfigEnhanced;
|
|
18
|
-
if (vikeConfig.global.config.
|
|
18
|
+
if (vikeConfig.global.config.vite6BuilderApp) {
|
|
19
19
|
assertVersion('Vite', version, '6.0.0');
|
|
20
20
|
const builder = await createBuilder(viteConfigEnhanced);
|
|
21
21
|
// See Vite plugin vike:build:pluginBuildApp
|
|
@@ -2,7 +2,6 @@ export { prepareViteApiCall };
|
|
|
2
2
|
export { getViteRoot };
|
|
3
3
|
export { assertViteRoot };
|
|
4
4
|
export { normalizeViteRoot };
|
|
5
|
-
// TODO: enable Vike extensions to add Vite plugins
|
|
6
5
|
import { loadConfigFromFile, mergeConfig, resolveConfig } from 'vite';
|
|
7
6
|
import { clearContextApiOperation, setContextApiOperation } from './context.js';
|
|
8
7
|
import { getVikeConfig2 } from '../plugin/plugins/importUserCode/v1-design/getVikeConfig.js';
|
|
@@ -289,7 +289,7 @@ function handleAssetsManifest_getBuildConfig(config) {
|
|
|
289
289
|
// Required if `ssrEmitAssets: true`, see https://github.com/vitejs/vite/pull/11430#issuecomment-1454800934
|
|
290
290
|
cssMinify: isFixEnabled ? 'esbuild' : undefined,
|
|
291
291
|
manifest: manifestTempFile,
|
|
292
|
-
copyPublicDir: vike.config.
|
|
292
|
+
copyPublicDir: vike.config.vite6BuilderApp
|
|
293
293
|
? // Already set by vike:build:pluginBuildApp
|
|
294
294
|
undefined
|
|
295
295
|
: !isViteServerBuild(config)
|
|
@@ -50,7 +50,7 @@ function pluginAutoFullBuild() {
|
|
|
50
50
|
handleAssetsManifest_assertUsageCssTarget(config);
|
|
51
51
|
if (forceExit &&
|
|
52
52
|
// Let vike:build:pluginBuildApp force exit
|
|
53
|
-
!vikeConfig.global.config.
|
|
53
|
+
!vikeConfig.global.config.vite6BuilderApp) {
|
|
54
54
|
runPrerender_forceExit();
|
|
55
55
|
assert(false);
|
|
56
56
|
}
|
|
@@ -61,7 +61,7 @@ function pluginAutoFullBuild() {
|
|
|
61
61
|
}
|
|
62
62
|
async function triggerFullBuild(config, vikeConfig, viteEnv, bundle) {
|
|
63
63
|
// Whether builder.buildApp() is being used, see plugin:build:pluginBuildApp
|
|
64
|
-
const isBuilderApp = vikeConfig.global.config.
|
|
64
|
+
const isBuilderApp = vikeConfig.global.config.vite6BuilderApp;
|
|
65
65
|
// If builder.buildApp() => trigger at end of `this.environment.name === 'ssr'`.
|
|
66
66
|
// Else => trigger at end of client-side build.
|
|
67
67
|
if (isBuilderApp ? !isViteServerBuild_onlySsrEnv(config, viteEnv) : !isViteClientBuild(config, viteEnv))
|
|
@@ -200,6 +200,7 @@ function getPageConfigsBuildTime(configDefinitionsResolved, plusFilesAll, userRo
|
|
|
200
200
|
return;
|
|
201
201
|
pageConfigGlobal.configValueSources[configName] = sources;
|
|
202
202
|
});
|
|
203
|
+
applyEffectsAll(pageConfigGlobal.configValueSources, configDefinitionsResolved.configDefinitionsGlobal);
|
|
203
204
|
assertPageConfigGlobal(pageConfigGlobal, plusFilesAll);
|
|
204
205
|
const pageConfigs = objectEntries(configDefinitionsResolved.configDefinitionsLocal)
|
|
205
206
|
.filter(([_locationId, { plusFiles }]) => isDefiningPage(plusFiles))
|
|
@@ -673,7 +674,7 @@ function applyEffectsAll(configValueSources, configDefinitions) {
|
|
|
673
674
|
if (!source)
|
|
674
675
|
return;
|
|
675
676
|
// The config value is eagerly loaded since `configDef.env === 'config-only``
|
|
676
|
-
assert('value' in source);
|
|
677
|
+
assert('value' in source); // TODO/now: refactor all `'value' in`
|
|
677
678
|
// Call effect
|
|
678
679
|
const configModFromEffect = configDef.effect({
|
|
679
680
|
configValue: source.value,
|
|
@@ -681,12 +682,11 @@ function applyEffectsAll(configValueSources, configDefinitions) {
|
|
|
681
682
|
});
|
|
682
683
|
if (!configModFromEffect)
|
|
683
684
|
return;
|
|
684
|
-
|
|
685
|
-
applyEffect(configModFromEffect, configValueSources, configDef);
|
|
685
|
+
applyEffect(configModFromEffect, source, configValueSources, configName, configDef, configDefinitions);
|
|
686
686
|
});
|
|
687
687
|
}
|
|
688
|
-
function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
689
|
-
const notSupported =
|
|
688
|
+
function applyEffect(configModFromEffect, source, configValueSources, configNameEffect, configDefEffect, configDefinitions) {
|
|
689
|
+
const notSupported = `${pc.cyan('meta.effect')} currently only supports setting the value of a config, or modifying the ${pc.cyan('meta.env')} of a config.`;
|
|
690
690
|
objectEntries(configModFromEffect).forEach(([configName, configValue]) => {
|
|
691
691
|
if (configName === 'meta') {
|
|
692
692
|
let configDefinedAt;
|
|
@@ -712,14 +712,23 @@ function applyEffect(configModFromEffect, configValueSources, configDefEffect) {
|
|
|
712
712
|
});
|
|
713
713
|
}
|
|
714
714
|
else {
|
|
715
|
-
|
|
716
|
-
|
|
717
|
-
|
|
718
|
-
|
|
719
|
-
|
|
720
|
-
|
|
721
|
-
|
|
722
|
-
|
|
715
|
+
const configDef = configDefinitions[configName];
|
|
716
|
+
assert(configDef);
|
|
717
|
+
assert(configDefEffect._userEffectDefinedAtFilePath);
|
|
718
|
+
const configValueSource = {
|
|
719
|
+
definedAtFilePath: configDefEffect._userEffectDefinedAtFilePath,
|
|
720
|
+
plusFile: source.plusFile,
|
|
721
|
+
locationId: source.locationId,
|
|
722
|
+
configEnv: configDef.env,
|
|
723
|
+
isOverriden: false, // TODO/now check
|
|
724
|
+
valueIsLoadedWithImport: false,
|
|
725
|
+
valueIsDefinedByPlusValueFile: false,
|
|
726
|
+
valueIsLoaded: true,
|
|
727
|
+
value: configValue
|
|
728
|
+
};
|
|
729
|
+
assertUsage(!!configDef.global === !!configDefEffect.global, `The configuration ${pc.cyan(configNameEffect)} has a ${pc.cyan('meta.effect')} that changes the configuration ${pc.cyan(configName)} and, consequently, both ${pc.cyan(configNameEffect)} and ${pc.cyan(configName)} must have the same ${pc.cyan('meta.global')} value.`);
|
|
730
|
+
configValueSources[configName] ?? (configValueSources[configName] = []);
|
|
731
|
+
configValueSources[configName].push(configValueSource);
|
|
723
732
|
}
|
|
724
733
|
});
|
|
725
734
|
}
|
|
@@ -778,7 +778,8 @@ prerenderConfig) {
|
|
|
778
778
|
}
|
|
779
779
|
function makePublic(prerenderContext) {
|
|
780
780
|
const prerenderContextPublic = makePublicCopy(prerenderContext, 'prerenderContext', [
|
|
781
|
-
'pageContexts'
|
|
781
|
+
'pageContexts',
|
|
782
|
+
'output'
|
|
782
783
|
]);
|
|
783
784
|
return prerenderContextPublic;
|
|
784
785
|
}
|
|
@@ -422,10 +422,12 @@ type ConfigBuiltIn = {
|
|
|
422
422
|
includeAssetsImportedByServer?: boolean;
|
|
423
423
|
/** @deprecated See https://vike.dev/disableAutoFullBuild */
|
|
424
424
|
disableAutoFullBuild?: boolean | 'prerender';
|
|
425
|
-
/**
|
|
425
|
+
/**
|
|
426
|
+
* Use builder.buildApp() to orchestrate the build process.
|
|
427
|
+
*
|
|
426
428
|
* @experimental
|
|
427
429
|
*/
|
|
428
|
-
|
|
430
|
+
vite6BuilderApp?: boolean;
|
|
429
431
|
/** The Base URL of your server.
|
|
430
432
|
*
|
|
431
433
|
* https://vike.dev/base-url
|
|
@@ -64,7 +64,9 @@ function parseConfigValuesSerialized_tmp(configValuesSerialized) {
|
|
|
64
64
|
const { valueSerialized, ...common } = configValueSeriliazed;
|
|
65
65
|
const { value, sideExports } = parseValueSerialized(valueSerialized, configName, () => {
|
|
66
66
|
assert(configValueSeriliazed.type !== 'computed');
|
|
67
|
-
|
|
67
|
+
const { definedAtData } = configValueSeriliazed;
|
|
68
|
+
const definedAtFile = Array.isArray(definedAtData) ? definedAtData[0] : definedAtData;
|
|
69
|
+
return definedAtFile;
|
|
68
70
|
});
|
|
69
71
|
addSideExports(sideExports);
|
|
70
72
|
configValue = { value, ...common };
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.223-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.223-commit-e239e2b";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.223-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.223-commit-e239e2b';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.223-commit-
|
|
3
|
+
"version": "0.4.223-commit-e239e2b",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -252,7 +252,7 @@
|
|
|
252
252
|
"react-streaming": "^0.3.47",
|
|
253
253
|
"rimraf": "^5.0.5",
|
|
254
254
|
"typescript": "^5.7.3",
|
|
255
|
-
"vite": "^6.0
|
|
255
|
+
"vite": "^6.2.0"
|
|
256
256
|
},
|
|
257
257
|
"scripts": {
|
|
258
258
|
"dev": "tsc --watch",
|