vike 0.4.218-commit-ed9b3d4 → 0.4.218-commit-85af52a
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/cjs/node/plugin/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/baseUrls.js +3 -10
- package/dist/cjs/node/plugin/plugins/commonConfig.js +14 -3
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/node/plugin/index.js +1 -1
- package/dist/esm/node/plugin/plugins/baseUrls.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/baseUrls.js +4 -11
- package/dist/esm/node/plugin/plugins/commonConfig.d.ts +5 -0
- package/dist/esm/node/plugin/plugins/commonConfig.js +14 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +5 -3
- 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 +1 -1
|
@@ -53,7 +53,7 @@ function plugin(vikeVitePluginOptions = {}) {
|
|
|
53
53
|
(0, suppressRollupWarning_js_1.suppressRollupWarning)(),
|
|
54
54
|
...(0, setGlobalContext_js_1.setGlobalContext)(),
|
|
55
55
|
...(0, index_js_3.buildEntry)(),
|
|
56
|
-
(0, baseUrls_js_1.baseUrls)(
|
|
56
|
+
(0, baseUrls_js_1.baseUrls)(),
|
|
57
57
|
(0, envVars_js_1.envVarsPlugin)(),
|
|
58
58
|
(0, fileEnv_js_1.fileEnv)(),
|
|
59
59
|
(0, workaroundCssModuleHmr_js_1.workaroundCssModuleHmr)(),
|
|
@@ -4,22 +4,16 @@ exports.baseUrls = baseUrls;
|
|
|
4
4
|
const resolveBase_js_1 = require("../../shared/resolveBase.js");
|
|
5
5
|
const utils_js_1 = require("../utils.js");
|
|
6
6
|
const getVikeConfig_js_1 = require("./importUserCode/v1-design/getVikeConfig.js");
|
|
7
|
-
|
|
8
|
-
function baseUrls(vikeVitePluginOptions) {
|
|
7
|
+
function baseUrls() {
|
|
9
8
|
let basesResolved;
|
|
10
|
-
let root;
|
|
11
9
|
return {
|
|
12
10
|
name: 'vike:baseUrls',
|
|
13
11
|
enforce: 'post',
|
|
14
|
-
async config(config
|
|
12
|
+
async config(config) {
|
|
15
13
|
const isDev = config._isDev;
|
|
16
14
|
(0, utils_js_1.assert)(typeof isDev === 'boolean');
|
|
17
|
-
const operation = env.command === 'build' ? 'build' : env.isPreview ? 'preview' : 'dev';
|
|
18
|
-
root = config.root ? (0, prepareViteApiCall_js_1.normalizeViteRoot)(config.root) : await (0, prepareViteApiCall_js_1.getViteRoot)(operation);
|
|
19
|
-
(0, utils_js_1.assert)(root);
|
|
20
15
|
const baseViteOriginal = config.base ?? '/__UNSET__'; // '/__UNSET__' because Vite resolves `_baseViteOriginal: null` to `undefined`
|
|
21
|
-
|
|
22
|
-
basesResolved = (0, resolveBase_js_1.resolveBase)(baseViteOriginal, vikeConfig.vikeConfigGlobal.baseServer, vikeConfig.vikeConfigGlobal.baseAssets);
|
|
16
|
+
basesResolved = (0, resolveBase_js_1.resolveBase)(baseViteOriginal, config.vikeTmp.vikeConfigGlobal.baseServer, config.vikeTmp.vikeConfigGlobal.baseAssets);
|
|
23
17
|
// We cannot define these in configResolved() because Vite picks up the env variables before any configResolved() hook is called
|
|
24
18
|
process.env.BASE_SERVER = basesResolved.baseServer;
|
|
25
19
|
process.env.BASE_ASSETS = basesResolved.baseAssets;
|
|
@@ -34,7 +28,6 @@ function baseUrls(vikeVitePluginOptions) {
|
|
|
34
28
|
};
|
|
35
29
|
},
|
|
36
30
|
async configResolved(config) {
|
|
37
|
-
(0, prepareViteApiCall_js_1.assertViteRoot)(root, config);
|
|
38
31
|
const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig)(config);
|
|
39
32
|
const basesResolved2 = (0, resolveBase_js_1.resolveBaseFromResolvedConfig)(vikeConfig.vikeConfigGlobal.baseServer, vikeConfig.vikeConfigGlobal.baseAssets, config);
|
|
40
33
|
(0, utils_js_1.assert)(basesResolved2.baseServer === basesResolved.baseServer);
|
|
@@ -14,6 +14,8 @@ const assertResolveAlias_js_1 = require("./commonConfig/assertResolveAlias.js");
|
|
|
14
14
|
const getEnvVarObject_js_1 = require("../shared/getEnvVarObject.js");
|
|
15
15
|
const isViteCliCall_js_1 = require("../shared/isViteCliCall.js");
|
|
16
16
|
const context_js_1 = require("../../api/context.js");
|
|
17
|
+
const getVikeConfig_js_1 = require("./importUserCode/v1-design/getVikeConfig.js");
|
|
18
|
+
const prepareViteApiCall_js_1 = require("../../api/prepareViteApiCall.js");
|
|
17
19
|
const pluginName = 'vike:commonConfig';
|
|
18
20
|
function commonConfig(vikeVitePluginOptions) {
|
|
19
21
|
return [
|
|
@@ -22,10 +24,18 @@ function commonConfig(vikeVitePluginOptions) {
|
|
|
22
24
|
enforce: 'pre',
|
|
23
25
|
config: {
|
|
24
26
|
order: 'pre',
|
|
25
|
-
handler(
|
|
27
|
+
async handler(configFromUser, env) {
|
|
28
|
+
const isDev = (0, utils_js_1.isDevCheck)(env);
|
|
29
|
+
const operation = env.command === 'build' ? 'build' : env.isPreview ? 'preview' : 'dev';
|
|
30
|
+
const root = configFromUser.root ? (0, prepareViteApiCall_js_1.normalizeViteRoot)(configFromUser.root) : await (0, prepareViteApiCall_js_1.getViteRoot)(operation);
|
|
31
|
+
(0, utils_js_1.assert)(root);
|
|
32
|
+
const vikeConfig = await (0, getVikeConfig_js_1.getVikeConfig2)(root, isDev, vikeVitePluginOptions);
|
|
26
33
|
return {
|
|
27
|
-
_isDev:
|
|
28
|
-
|
|
34
|
+
_isDev: isDev,
|
|
35
|
+
_root: root,
|
|
36
|
+
_vikeVitePluginOptions: vikeVitePluginOptions,
|
|
37
|
+
vike: vikeConfig.vikeConfigNew,
|
|
38
|
+
vikeTmp: vikeConfig
|
|
29
39
|
};
|
|
30
40
|
}
|
|
31
41
|
}
|
|
@@ -33,6 +43,7 @@ function commonConfig(vikeVitePluginOptions) {
|
|
|
33
43
|
{
|
|
34
44
|
name: pluginName,
|
|
35
45
|
configResolved(config) {
|
|
46
|
+
(0, prepareViteApiCall_js_1.assertViteRoot)(config._root, config);
|
|
36
47
|
assertSingleInstance(config);
|
|
37
48
|
(0, require_shim_1.installRequireShim_setUserRootDir)(config.root);
|
|
38
49
|
}
|
|
@@ -1,23 +1,17 @@
|
|
|
1
1
|
export { baseUrls };
|
|
2
2
|
import { resolveBase, resolveBaseFromResolvedConfig } from '../../shared/resolveBase.js';
|
|
3
3
|
import { assert } from '../utils.js';
|
|
4
|
-
import { getVikeConfig
|
|
5
|
-
|
|
6
|
-
function baseUrls(vikeVitePluginOptions) {
|
|
4
|
+
import { getVikeConfig } from './importUserCode/v1-design/getVikeConfig.js';
|
|
5
|
+
function baseUrls() {
|
|
7
6
|
let basesResolved;
|
|
8
|
-
let root;
|
|
9
7
|
return {
|
|
10
8
|
name: 'vike:baseUrls',
|
|
11
9
|
enforce: 'post',
|
|
12
|
-
async config(config
|
|
10
|
+
async config(config) {
|
|
13
11
|
const isDev = config._isDev;
|
|
14
12
|
assert(typeof isDev === 'boolean');
|
|
15
|
-
const operation = env.command === 'build' ? 'build' : env.isPreview ? 'preview' : 'dev';
|
|
16
|
-
root = config.root ? normalizeViteRoot(config.root) : await getViteRoot(operation);
|
|
17
|
-
assert(root);
|
|
18
13
|
const baseViteOriginal = config.base ?? '/__UNSET__'; // '/__UNSET__' because Vite resolves `_baseViteOriginal: null` to `undefined`
|
|
19
|
-
|
|
20
|
-
basesResolved = resolveBase(baseViteOriginal, vikeConfig.vikeConfigGlobal.baseServer, vikeConfig.vikeConfigGlobal.baseAssets);
|
|
14
|
+
basesResolved = resolveBase(baseViteOriginal, config.vikeTmp.vikeConfigGlobal.baseServer, config.vikeTmp.vikeConfigGlobal.baseAssets);
|
|
21
15
|
// We cannot define these in configResolved() because Vite picks up the env variables before any configResolved() hook is called
|
|
22
16
|
process.env.BASE_SERVER = basesResolved.baseServer;
|
|
23
17
|
process.env.BASE_ASSETS = basesResolved.baseAssets;
|
|
@@ -32,7 +26,6 @@ function baseUrls(vikeVitePluginOptions) {
|
|
|
32
26
|
};
|
|
33
27
|
},
|
|
34
28
|
async configResolved(config) {
|
|
35
|
-
assertViteRoot(root, config);
|
|
36
29
|
const vikeConfig = await getVikeConfig(config);
|
|
37
30
|
const basesResolved2 = resolveBaseFromResolvedConfig(vikeConfig.vikeConfigGlobal.baseServer, vikeConfig.vikeConfigGlobal.baseAssets, config);
|
|
38
31
|
assert(basesResolved2.baseServer === basesResolved.baseServer);
|
|
@@ -1,9 +1,14 @@
|
|
|
1
1
|
export { commonConfig };
|
|
2
2
|
import { type Plugin } from 'vite';
|
|
3
|
+
import { type VikeConfigObject, type VikeConfigNew } from './importUserCode/v1-design/getVikeConfig.js';
|
|
3
4
|
declare module 'vite' {
|
|
4
5
|
interface UserConfig {
|
|
5
6
|
_isDev?: boolean;
|
|
6
7
|
_vikeVitePluginOptions?: unknown;
|
|
8
|
+
_root?: string;
|
|
9
|
+
vike?: VikeConfigNew;
|
|
10
|
+
/** @deprecated */
|
|
11
|
+
vikeTmp?: VikeConfigObject;
|
|
7
12
|
}
|
|
8
13
|
}
|
|
9
14
|
declare function commonConfig(vikeVitePluginOptions: unknown): Plugin[];
|
|
@@ -9,6 +9,8 @@ import { assertResolveAlias } from './commonConfig/assertResolveAlias.js';
|
|
|
9
9
|
import { getEnvVarObject } from '../shared/getEnvVarObject.js';
|
|
10
10
|
import { isViteCliCall } from '../shared/isViteCliCall.js';
|
|
11
11
|
import { isVikeCliOrApi } from '../../api/context.js';
|
|
12
|
+
import { getVikeConfig2 } from './importUserCode/v1-design/getVikeConfig.js';
|
|
13
|
+
import { assertViteRoot, getViteRoot, normalizeViteRoot } from '../../api/prepareViteApiCall.js';
|
|
12
14
|
const pluginName = 'vike:commonConfig';
|
|
13
15
|
function commonConfig(vikeVitePluginOptions) {
|
|
14
16
|
return [
|
|
@@ -17,10 +19,18 @@ function commonConfig(vikeVitePluginOptions) {
|
|
|
17
19
|
enforce: 'pre',
|
|
18
20
|
config: {
|
|
19
21
|
order: 'pre',
|
|
20
|
-
handler(
|
|
22
|
+
async handler(configFromUser, env) {
|
|
23
|
+
const isDev = isDevCheck(env);
|
|
24
|
+
const operation = env.command === 'build' ? 'build' : env.isPreview ? 'preview' : 'dev';
|
|
25
|
+
const root = configFromUser.root ? normalizeViteRoot(configFromUser.root) : await getViteRoot(operation);
|
|
26
|
+
assert(root);
|
|
27
|
+
const vikeConfig = await getVikeConfig2(root, isDev, vikeVitePluginOptions);
|
|
21
28
|
return {
|
|
22
|
-
_isDev:
|
|
23
|
-
|
|
29
|
+
_isDev: isDev,
|
|
30
|
+
_root: root,
|
|
31
|
+
_vikeVitePluginOptions: vikeVitePluginOptions,
|
|
32
|
+
vike: vikeConfig.vikeConfigNew,
|
|
33
|
+
vikeTmp: vikeConfig
|
|
24
34
|
};
|
|
25
35
|
}
|
|
26
36
|
}
|
|
@@ -28,6 +38,7 @@ function commonConfig(vikeVitePluginOptions) {
|
|
|
28
38
|
{
|
|
29
39
|
name: pluginName,
|
|
30
40
|
configResolved(config) {
|
|
41
|
+
assertViteRoot(config._root, config);
|
|
31
42
|
assertSingleInstance(config);
|
|
32
43
|
installRequireShim_setUserRootDir(config.root);
|
|
33
44
|
}
|
|
@@ -9,6 +9,7 @@ export type { VikeConfigObject };
|
|
|
9
9
|
export type { InterfaceValueFile };
|
|
10
10
|
export type { InterfaceFile };
|
|
11
11
|
export type { VikeConfigGlobal };
|
|
12
|
+
export type { VikeConfigNew };
|
|
12
13
|
export type { VikeVitePluginOptions };
|
|
13
14
|
import type { PageConfigGlobalBuildTime, PageConfigBuildTime } from '../../../../../shared/page-configs/PageConfig.js';
|
|
14
15
|
import { type LocationId } from './getVikeConfig/filesystemRouting.js';
|
|
@@ -35,13 +36,14 @@ type InterfaceValueFile = InterfaceFileCommons & {
|
|
|
35
36
|
configName: string;
|
|
36
37
|
};
|
|
37
38
|
type ConfigName = string;
|
|
39
|
+
type VikeConfigNew = {
|
|
40
|
+
global: ReturnType<typeof getPageConfigUserFriendlyNew>;
|
|
41
|
+
};
|
|
38
42
|
type VikeConfigObject = {
|
|
39
43
|
pageConfigs: PageConfigBuildTime[];
|
|
40
44
|
pageConfigGlobal: PageConfigGlobalBuildTime;
|
|
41
45
|
vikeConfigGlobal: VikeConfigGlobal;
|
|
42
|
-
vikeConfigNew:
|
|
43
|
-
global: ReturnType<typeof getPageConfigUserFriendlyNew>;
|
|
44
|
-
};
|
|
46
|
+
vikeConfigNew: VikeConfigNew;
|
|
45
47
|
};
|
|
46
48
|
declare const vikeConfigDependencies: Set<string>;
|
|
47
49
|
declare function reloadVikeConfig(config: ResolvedConfig): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.218-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.218-commit-85af52a";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.218-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.218-commit-85af52a';
|