vike 0.4.168-commit-ce94f5c → 0.4.168-commit-7678a7d
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 +8 -0
- package/dist/cjs/node/plugin/plugins/distFileNames.js +6 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +6 -3
- package/dist/cjs/node/shared/prependEntriesDir.js +1 -0
- package/dist/cjs/utils/isDev.js +12 -4
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/esm/node/plugin/plugins/buildConfig.js +8 -0
- package/dist/esm/node/plugin/plugins/distFileNames.js +6 -0
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +7 -4
- package/dist/esm/node/shared/prependEntriesDir.js +1 -0
- package/dist/esm/utils/isDev.d.ts +3 -0
- package/dist/esm/utils/isDev.js +11 -3
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +1 -1
|
@@ -232,7 +232,15 @@ function getEntryFromPageConfig(pageConfig, isForClientSide) {
|
|
|
232
232
|
let { pageId } = pageConfig;
|
|
233
233
|
const entryTarget = (0, virtualFilePageConfigValuesAll_js_1.getVirtualFileIdPageConfigValuesAll)(pageId, isForClientSide);
|
|
234
234
|
let entryName = pageId;
|
|
235
|
+
// Avoid:
|
|
236
|
+
// ```
|
|
237
|
+
// dist/client/assets/entries/.Dp9wM6PK.js
|
|
238
|
+
// dist/server/entries/.mjs
|
|
239
|
+
// ```
|
|
240
|
+
if (entryName === '/')
|
|
241
|
+
entryName = 'root';
|
|
235
242
|
entryName = (0, prependEntriesDir_js_1.prependEntriesDir)(entryName);
|
|
243
|
+
(0, utils_js_1.assert)(!entryName.endsWith('/'));
|
|
236
244
|
return { entryName, entryTarget };
|
|
237
245
|
}
|
|
238
246
|
function resolve(filePath) {
|
|
@@ -116,6 +116,12 @@ function clean(name, removePathSep, fixGlob) {
|
|
|
116
116
|
}
|
|
117
117
|
name = removeLeadingUnderscoreInFilename(name);
|
|
118
118
|
name = removeUnderscoreDoublets(name);
|
|
119
|
+
// Avoid:
|
|
120
|
+
// ```
|
|
121
|
+
// dist/client/assets/entries/.Dp9wM6PK.js
|
|
122
|
+
// dist/server/entries/.mjs
|
|
123
|
+
// ```
|
|
124
|
+
(0, utils_js_1.assert)(!name.endsWith('/'));
|
|
119
125
|
return name;
|
|
120
126
|
}
|
|
121
127
|
function fixExtractAssetsQuery(name) {
|
|
@@ -18,9 +18,11 @@ const getFilePath_js_1 = require("../../shared/getFilePath.js");
|
|
|
18
18
|
function importUserCode() {
|
|
19
19
|
let config;
|
|
20
20
|
let configVike;
|
|
21
|
+
let isDev_;
|
|
21
22
|
return {
|
|
22
23
|
name: 'vike:importUserCode',
|
|
23
|
-
config() {
|
|
24
|
+
config(_, env) {
|
|
25
|
+
isDev_ = (0, utils_js_1.isDev3)(env);
|
|
24
26
|
return {
|
|
25
27
|
experimental: {
|
|
26
28
|
// TODO/v1-release: remove
|
|
@@ -48,7 +50,7 @@ function importUserCode() {
|
|
|
48
50
|
}
|
|
49
51
|
},
|
|
50
52
|
async load(id, options) {
|
|
51
|
-
const isDev = (0, utils_js_1.isDev1)();
|
|
53
|
+
const isDev = isDev_ !== null ? isDev_ : (0, utils_js_1.isDev1)();
|
|
52
54
|
if (!(0, utils_js_1.isVirtualFileId)(id))
|
|
53
55
|
return undefined;
|
|
54
56
|
id = (0, utils_js_1.getVirtualFileId)(id);
|
|
@@ -62,7 +64,8 @@ function importUserCode() {
|
|
|
62
64
|
}
|
|
63
65
|
},
|
|
64
66
|
configureServer(server) {
|
|
65
|
-
(
|
|
67
|
+
if (isDev_ === null)
|
|
68
|
+
(0, utils_js_1.isDev1_onConfigureServer)();
|
|
66
69
|
handleFileAddRemove(server, config);
|
|
67
70
|
}
|
|
68
71
|
};
|
package/dist/cjs/utils/isDev.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDev2 = exports.isDev1_onConfigureServer = exports.isDev1 = void 0;
|
|
4
|
-
|
|
5
|
-
|
|
3
|
+
exports.isDev3 = exports.isDev2 = exports.isDev1_onConfigureServer = exports.isDev1 = void 0;
|
|
4
|
+
function isDev3(configEnv) {
|
|
5
|
+
const { isPreview, command } = configEnv;
|
|
6
|
+
if (command !== 'serve')
|
|
7
|
+
return false;
|
|
8
|
+
if (typeof isPreview === 'boolean')
|
|
9
|
+
return !isPreview;
|
|
10
|
+
// isPreview is undefined in older Vite versions, see https://github.com/vitejs/vite/commit/93fce55
|
|
11
|
+
return null;
|
|
12
|
+
}
|
|
13
|
+
exports.isDev3 = isDev3;
|
|
6
14
|
// ********
|
|
7
|
-
// Method 1 -
|
|
15
|
+
// Method 1 - reliable
|
|
8
16
|
// ********
|
|
9
17
|
const assert_js_1 = require("./assert.js");
|
|
10
18
|
const getGlobalObject_js_1 = require("./getGlobalObject.js");
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PROJECT_VERSION = exports.projectInfo = void 0;
|
|
4
|
-
const PROJECT_VERSION = '0.4.168-commit-
|
|
4
|
+
const PROJECT_VERSION = '0.4.168-commit-7678a7d';
|
|
5
5
|
exports.PROJECT_VERSION = PROJECT_VERSION;
|
|
6
6
|
const projectInfo = {
|
|
7
7
|
projectName: 'Vike',
|
|
@@ -227,7 +227,15 @@ function getEntryFromPageConfig(pageConfig, isForClientSide) {
|
|
|
227
227
|
let { pageId } = pageConfig;
|
|
228
228
|
const entryTarget = getVirtualFileIdPageConfigValuesAll(pageId, isForClientSide);
|
|
229
229
|
let entryName = pageId;
|
|
230
|
+
// Avoid:
|
|
231
|
+
// ```
|
|
232
|
+
// dist/client/assets/entries/.Dp9wM6PK.js
|
|
233
|
+
// dist/server/entries/.mjs
|
|
234
|
+
// ```
|
|
235
|
+
if (entryName === '/')
|
|
236
|
+
entryName = 'root';
|
|
230
237
|
entryName = prependEntriesDir(entryName);
|
|
238
|
+
assert(!entryName.endsWith('/'));
|
|
231
239
|
return { entryName, entryTarget };
|
|
232
240
|
}
|
|
233
241
|
function resolve(filePath) {
|
|
@@ -110,6 +110,12 @@ function clean(name, removePathSep, fixGlob) {
|
|
|
110
110
|
}
|
|
111
111
|
name = removeLeadingUnderscoreInFilename(name);
|
|
112
112
|
name = removeUnderscoreDoublets(name);
|
|
113
|
+
// Avoid:
|
|
114
|
+
// ```
|
|
115
|
+
// dist/client/assets/entries/.Dp9wM6PK.js
|
|
116
|
+
// dist/server/entries/.mjs
|
|
117
|
+
// ```
|
|
118
|
+
assert(!name.endsWith('/'));
|
|
113
119
|
return name;
|
|
114
120
|
}
|
|
115
121
|
function fixExtractAssetsQuery(name) {
|
|
@@ -3,7 +3,7 @@ import { normalizePath } from 'vite';
|
|
|
3
3
|
import { getConfigVike } from '../../../shared/getConfigVike.js';
|
|
4
4
|
import { getVirtualFilePageConfigValuesAll } from './v1-design/getVirtualFilePageConfigValuesAll.js';
|
|
5
5
|
import { getVirtualFileImportUserCode } from './getVirtualFileImportUserCode.js';
|
|
6
|
-
import { assert, assertPosixPath, getOutDirs, getVirtualFileId, isDev1, isDev1_onConfigureServer, isVirtualFileId, resolveVirtualFileId } from '../../utils.js';
|
|
6
|
+
import { assert, assertPosixPath, getOutDirs, getVirtualFileId, isDev1, isDev1_onConfigureServer, isDev3, isVirtualFileId, resolveVirtualFileId } from '../../utils.js';
|
|
7
7
|
import { isVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll.js';
|
|
8
8
|
import { isVirtualFileIdImportUserCode } from '../../../shared/virtual-files/virtualFileImportUserCode.js';
|
|
9
9
|
import { vikeConfigDependencies, reloadVikeConfig, isVikeConfigFile } from './v1-design/getVikeConfig.js';
|
|
@@ -13,9 +13,11 @@ import { getFilePathResolved } from '../../shared/getFilePath.js';
|
|
|
13
13
|
function importUserCode() {
|
|
14
14
|
let config;
|
|
15
15
|
let configVike;
|
|
16
|
+
let isDev_;
|
|
16
17
|
return {
|
|
17
18
|
name: 'vike:importUserCode',
|
|
18
|
-
config() {
|
|
19
|
+
config(_, env) {
|
|
20
|
+
isDev_ = isDev3(env);
|
|
19
21
|
return {
|
|
20
22
|
experimental: {
|
|
21
23
|
// TODO/v1-release: remove
|
|
@@ -43,7 +45,7 @@ function importUserCode() {
|
|
|
43
45
|
}
|
|
44
46
|
},
|
|
45
47
|
async load(id, options) {
|
|
46
|
-
const isDev = isDev1();
|
|
48
|
+
const isDev = isDev_ !== null ? isDev_ : isDev1();
|
|
47
49
|
if (!isVirtualFileId(id))
|
|
48
50
|
return undefined;
|
|
49
51
|
id = getVirtualFileId(id);
|
|
@@ -57,7 +59,8 @@ function importUserCode() {
|
|
|
57
59
|
}
|
|
58
60
|
},
|
|
59
61
|
configureServer(server) {
|
|
60
|
-
|
|
62
|
+
if (isDev_ === null)
|
|
63
|
+
isDev1_onConfigureServer();
|
|
61
64
|
handleFileAddRemove(server, config);
|
|
62
65
|
}
|
|
63
66
|
};
|
|
@@ -1,6 +1,9 @@
|
|
|
1
1
|
export { isDev1 };
|
|
2
2
|
export { isDev1_onConfigureServer };
|
|
3
3
|
export { isDev2 };
|
|
4
|
+
export { isDev3 };
|
|
5
|
+
import type { ConfigEnv } from 'vite';
|
|
6
|
+
declare function isDev3(configEnv: ConfigEnv): null | boolean;
|
|
4
7
|
declare function isDev1(): boolean;
|
|
5
8
|
declare function isDev1_onConfigureServer(): void | undefined;
|
|
6
9
|
import type { ResolvedConfig } from 'vite';
|
package/dist/esm/utils/isDev.js
CHANGED
|
@@ -1,10 +1,18 @@
|
|
|
1
1
|
export { isDev1 };
|
|
2
2
|
export { isDev1_onConfigureServer };
|
|
3
3
|
export { isDev2 };
|
|
4
|
-
|
|
5
|
-
|
|
4
|
+
export { isDev3 };
|
|
5
|
+
function isDev3(configEnv) {
|
|
6
|
+
const { isPreview, command } = configEnv;
|
|
7
|
+
if (command !== 'serve')
|
|
8
|
+
return false;
|
|
9
|
+
if (typeof isPreview === 'boolean')
|
|
10
|
+
return !isPreview;
|
|
11
|
+
// isPreview is undefined in older Vite versions, see https://github.com/vitejs/vite/commit/93fce55
|
|
12
|
+
return null;
|
|
13
|
+
}
|
|
6
14
|
// ********
|
|
7
|
-
// Method 1 -
|
|
15
|
+
// Method 1 - reliable
|
|
8
16
|
// ********
|
|
9
17
|
import { assert } from './assert.js';
|
|
10
18
|
import { getGlobalObject } from './getGlobalObject.js';
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
export { PROJECT_VERSION };
|
|
3
|
-
declare const PROJECT_VERSION: "0.4.168-commit-
|
|
3
|
+
declare const PROJECT_VERSION: "0.4.168-commit-7678a7d";
|
|
4
4
|
declare const projectInfo: {
|
|
5
5
|
projectName: "Vike";
|
|
6
|
-
projectVersion: "0.4.168-commit-
|
|
6
|
+
projectVersion: "0.4.168-commit-7678a7d";
|
|
7
7
|
};
|