vike 0.4.210 → 0.4.211
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/fixServerAssets.js +30 -7
- package/dist/cjs/node/plugin/plugins/commonConfig.js +13 -7
- package/dist/cjs/node/plugin/plugins/config/index.js +9 -3
- package/dist/cjs/node/plugin/plugins/devConfig/index.js +14 -6
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +3 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +38 -11
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +20 -35
- package/dist/cjs/node/plugin/plugins/previewConfig.js +5 -4
- package/dist/cjs/node/plugin/plugins/setGlobalContext.js +1 -1
- package/dist/cjs/node/plugin/utils.js +1 -0
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +11 -7
- package/dist/cjs/utils/PROJECT_VERSION.js +1 -1
- package/dist/cjs/utils/assertVersion.js +2 -0
- package/dist/cjs/utils/isDev.js +11 -16
- package/dist/cjs/utils/isDocker.js +45 -0
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +28 -5
- package/dist/esm/node/plugin/plugins/commonConfig.js +14 -8
- package/dist/esm/node/plugin/plugins/config/index.js +10 -4
- package/dist/esm/node/plugin/plugins/devConfig/index.d.ts +3 -1
- package/dist/esm/node/plugin/plugins/devConfig/index.js +12 -7
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.d.ts +11 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolvePointerImport.js +39 -12
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +21 -36
- package/dist/esm/node/plugin/plugins/previewConfig.js +6 -5
- package/dist/esm/node/plugin/plugins/setGlobalContext.js +2 -2
- package/dist/esm/node/plugin/utils.d.ts +1 -0
- package/dist/esm/node/plugin/utils.js +1 -0
- package/dist/esm/node/runtime/renderPage/logErrorHint.js +11 -7
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/assertVersion.js +2 -0
- package/dist/esm/utils/isDev.d.ts +6 -5
- package/dist/esm/utils/isDev.js +11 -16
- package/dist/esm/utils/isDocker.d.ts +2 -0
- package/dist/esm/utils/isDocker.js +40 -0
- package/dist/esm/utils/projectInfo.d.ts +1 -1
- package/package.json +2 -2
|
@@ -6,10 +6,15 @@ import pc from '@brillout/picocolors';
|
|
|
6
6
|
const hintDefault = 'The error could be a CJS/ESM issue, see https://vike.dev/broken-npm-package';
|
|
7
7
|
const hintLinkPrefix = 'To fix this error, see ';
|
|
8
8
|
const errorsMisc = [
|
|
9
|
+
{
|
|
10
|
+
errMsg: 'window is not defined',
|
|
11
|
+
link: 'https://vike.dev/hints#window-is-not-defined',
|
|
12
|
+
mustMentionNodeModules: false
|
|
13
|
+
},
|
|
9
14
|
{
|
|
10
15
|
errMsg: 'jsxDEV is not a function',
|
|
11
16
|
link: 'https://github.com/vikejs/vike/issues/1469#issuecomment-1919518096',
|
|
12
|
-
|
|
17
|
+
mustMentionNodeModules: false
|
|
13
18
|
},
|
|
14
19
|
{
|
|
15
20
|
// ```
|
|
@@ -17,7 +22,7 @@ const errorsMisc = [
|
|
|
17
22
|
// ```
|
|
18
23
|
errMsg: 'assets.json',
|
|
19
24
|
link: 'https://vike.dev/getGlobalContext',
|
|
20
|
-
|
|
25
|
+
mustMentionNodeModules: false
|
|
21
26
|
}
|
|
22
27
|
];
|
|
23
28
|
const errorsReact = [
|
|
@@ -25,7 +30,7 @@ const errorsReact = [
|
|
|
25
30
|
errMsg: 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)',
|
|
26
31
|
link: 'https://vike.dev/broken-npm-package#react-invalid-component',
|
|
27
32
|
// The stack trace can be user-land while the import is coming from node_modules
|
|
28
|
-
|
|
33
|
+
mustMentionNodeModules: false
|
|
29
34
|
},
|
|
30
35
|
{
|
|
31
36
|
// React's "Invalid hook call.", see https://github.com/vikejs/vike/discussions/1637#discussioncomment-9424712
|
|
@@ -38,7 +43,7 @@ const errorsCjsEsm_withPreciseLink = [
|
|
|
38
43
|
errMsg: /Named export.*not found/i,
|
|
39
44
|
link: 'https://vike.dev/broken-npm-package#named-export-not-found',
|
|
40
45
|
// It seems that this always points to an npm package import.
|
|
41
|
-
|
|
46
|
+
mustMentionNodeModules: false
|
|
42
47
|
}
|
|
43
48
|
];
|
|
44
49
|
const errorsCjsEsm = [
|
|
@@ -52,7 +57,7 @@ const errorsCjsEsm = [
|
|
|
52
57
|
{
|
|
53
58
|
errMsg: 'Cannot use import statement',
|
|
54
59
|
// Since user code is always ESM, this error must always originate from an npm package.
|
|
55
|
-
|
|
60
|
+
mustMentionNodeModules: false
|
|
56
61
|
},
|
|
57
62
|
{ errMsg: 'is not exported' },
|
|
58
63
|
{ errMsg: 'Cannot read properties of undefined' },
|
|
@@ -61,7 +66,6 @@ const errorsCjsEsm = [
|
|
|
61
66
|
{ errMsg: 'require is not a function' },
|
|
62
67
|
{ errMsg: 'exports is not defined' },
|
|
63
68
|
{ errMsg: 'module is not defined' },
|
|
64
|
-
{ errMsg: 'window is not defined' },
|
|
65
69
|
{ errMsg: 'not defined in ES' },
|
|
66
70
|
{ errMsg: "Unexpected token 'export'" }
|
|
67
71
|
];
|
|
@@ -103,7 +107,7 @@ function isKnownError(error) {
|
|
|
103
107
|
].find((knownErorr) => {
|
|
104
108
|
if (!includesLowercase(anywhere, knownErorr.errMsg))
|
|
105
109
|
return false;
|
|
106
|
-
if (knownErorr.
|
|
110
|
+
if (knownErorr.mustMentionNodeModules !== false && !includesLowercase(anywhere, 'node_modules'))
|
|
107
111
|
return false;
|
|
108
112
|
return true;
|
|
109
113
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.211";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.
|
|
2
|
+
export const PROJECT_VERSION = '0.4.211';
|
|
@@ -2,6 +2,8 @@ export { assertVersion };
|
|
|
2
2
|
export { isVersionOrAbove };
|
|
3
3
|
import { assert, assertUsage } from './assert.js';
|
|
4
4
|
function assertVersion(dependencyName, versionActual, versionExpected) {
|
|
5
|
+
assert(versionActual);
|
|
6
|
+
assert(versionExpected);
|
|
5
7
|
assertUsage(isVersionOrAbove(versionActual, versionExpected), `${dependencyName} ${versionActual} isn't supported, use ${dependencyName} >= ${versionExpected} instead.`);
|
|
6
8
|
}
|
|
7
9
|
function isVersionOrAbove(versionActual, versionExpected) {
|
|
@@ -1,6 +1,7 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { isDevCheck };
|
|
2
|
+
export { applyDev };
|
|
3
|
+
export { applyPreview };
|
|
3
4
|
import type { ConfigEnv } from 'vite';
|
|
4
|
-
declare function
|
|
5
|
-
|
|
6
|
-
declare function
|
|
5
|
+
declare function isDevCheck(configEnv: ConfigEnv): boolean;
|
|
6
|
+
declare function applyDev(_: unknown, env: ConfigEnv): boolean;
|
|
7
|
+
declare function applyPreview(_: unknown, env: ConfigEnv): boolean;
|
package/dist/esm/utils/isDev.js
CHANGED
|
@@ -1,21 +1,16 @@
|
|
|
1
|
-
export {
|
|
2
|
-
export {
|
|
1
|
+
export { isDevCheck };
|
|
2
|
+
export { applyDev };
|
|
3
|
+
export { applyPreview };
|
|
3
4
|
import { assert } from './assert.js';
|
|
4
|
-
function
|
|
5
|
+
function isDevCheck(configEnv) {
|
|
5
6
|
const { isPreview, command } = configEnv;
|
|
6
|
-
|
|
7
|
-
return false;
|
|
8
|
-
// `isPreview` is `undefined` in older Vite versions.
|
|
9
|
-
// https://github.com/vitejs/vite/pull/14855
|
|
10
|
-
// https://github.com/vitejs/vite/pull/15695O
|
|
11
|
-
// - Released at `vite@5.1.0`: https://github.com/vitejs/vite/blob/main/packages/vite/CHANGELOG.md#510-beta4-2024-01-26:~:text=fix(preview)%3A%20set%20isPreview%20true%20(%2315695)%20(93fce55)%2C%20closes%20%2315695
|
|
7
|
+
// Released at vite@5.1.0 which is guaranteed with `assertVersion('Vite', version, '5.1.0')`
|
|
12
8
|
assert(typeof isPreview === 'boolean');
|
|
13
|
-
return !isPreview;
|
|
9
|
+
return command === 'serve' && !isPreview;
|
|
14
10
|
}
|
|
15
|
-
function
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
return isDev;
|
|
11
|
+
function applyDev(_, env) {
|
|
12
|
+
return isDevCheck(env);
|
|
13
|
+
}
|
|
14
|
+
function applyPreview(_, env) {
|
|
15
|
+
return env.command == 'serve' && !isDevCheck(env);
|
|
21
16
|
}
|
|
@@ -0,0 +1,40 @@
|
|
|
1
|
+
export { isDocker };
|
|
2
|
+
import fs from 'node:fs';
|
|
3
|
+
import { assertIsNotProductionRuntime } from './assertIsNotProductionRuntime.js';
|
|
4
|
+
assertIsNotProductionRuntime();
|
|
5
|
+
function isDocker() {
|
|
6
|
+
return hasContainerEnv() || isDockerContainer();
|
|
7
|
+
}
|
|
8
|
+
// Podman detection
|
|
9
|
+
// https://github.com/sindresorhus/is-inside-container/blob/7f0dc884bda6b368d89ec90e77f2bef3b87e6f09/index.js
|
|
10
|
+
function hasContainerEnv() {
|
|
11
|
+
try {
|
|
12
|
+
fs.statSync('/run/.containerenv');
|
|
13
|
+
return true;
|
|
14
|
+
}
|
|
15
|
+
catch {
|
|
16
|
+
return false;
|
|
17
|
+
}
|
|
18
|
+
}
|
|
19
|
+
// Docker detection
|
|
20
|
+
// https://github.com/sindresorhus/is-docker/blob/1cfd2b5bfa9fbd87d2b22e6f514e7d5cc60a794b/index.js
|
|
21
|
+
function isDockerContainer() {
|
|
22
|
+
return hasDockerEnv() || hasDockerCGroup();
|
|
23
|
+
}
|
|
24
|
+
function hasDockerEnv() {
|
|
25
|
+
try {
|
|
26
|
+
fs.statSync('/.dockerenv');
|
|
27
|
+
return true;
|
|
28
|
+
}
|
|
29
|
+
catch {
|
|
30
|
+
return false;
|
|
31
|
+
}
|
|
32
|
+
}
|
|
33
|
+
function hasDockerCGroup() {
|
|
34
|
+
try {
|
|
35
|
+
return fs.readFileSync('/proc/self/cgroup', 'utf8').includes('docker');
|
|
36
|
+
}
|
|
37
|
+
catch {
|
|
38
|
+
return false;
|
|
39
|
+
}
|
|
40
|
+
}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "vike",
|
|
3
|
-
"version": "0.4.
|
|
3
|
+
"version": "0.4.211",
|
|
4
4
|
"repository": "https://github.com/vikejs/vike",
|
|
5
5
|
"exports": {
|
|
6
6
|
"./server": {
|
|
@@ -234,7 +234,7 @@
|
|
|
234
234
|
"react-streaming": "^0.3.44",
|
|
235
235
|
"rimraf": "^5.0.5",
|
|
236
236
|
"typescript": "^5.6.2",
|
|
237
|
-
"vite": "^
|
|
237
|
+
"vite": "^6.0.5"
|
|
238
238
|
},
|
|
239
239
|
"scripts": {
|
|
240
240
|
"dev": "tsc --watch",
|