vike 0.4.160 → 0.4.161-commit-0e9c635
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/cli/bin.js +5 -0
- package/dist/cjs/node/client/router.js +4 -2
- package/dist/cjs/node/plugin/plugins/autoFullBuild.js +2 -2
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +148 -0
- package/dist/cjs/node/plugin/plugins/buildConfig.js +61 -35
- package/dist/cjs/node/plugin/plugins/commonConfig.js +5 -13
- package/dist/cjs/node/plugin/plugins/config/stemUtils.js +1 -1
- package/dist/cjs/node/plugin/plugins/distFileNames.js +9 -1
- package/dist/cjs/node/plugin/plugins/envVars.js +6 -2
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +16 -4
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +2 -2
- package/dist/cjs/node/plugin/plugins/importBuild/getVikeManifest.js +1 -21
- package/dist/cjs/node/plugin/plugins/importBuild/index.js +5 -8
- package/dist/cjs/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +11 -91
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +1 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +28 -46
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{loadFileConfigEnv.js → loadFileAtConfigTime.js} +5 -5
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveFilePath.js +33 -0
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +2 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{transformImports.js → transformFileImports.js} +7 -7
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +21 -27
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +157 -111
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +2 -1
- package/dist/cjs/node/plugin/plugins/setGlobalContext.js +0 -14
- package/dist/cjs/node/plugin/shared/rollupSourceMap.js +20 -0
- package/dist/cjs/node/plugin/utils.js +3 -2
- package/dist/cjs/node/prerender/runPrerender.js +13 -5
- package/dist/cjs/node/runtime/globalContext.js +15 -23
- package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +2 -2
- package/dist/cjs/node/runtime/html/renderHtml.js +1 -1
- package/dist/cjs/node/runtime/html/stream.js +2 -2
- package/dist/cjs/node/runtime/renderPage/analyzePage.js +2 -2
- package/dist/cjs/node/runtime/renderPage/executeOnRenderHtmlHook.js +2 -2
- package/dist/cjs/node/runtime/renderPage/getHttpResponseBody.js +39 -39
- package/dist/cjs/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +0 -5
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +6 -7
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +2 -2
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +23 -28
- package/dist/cjs/node/runtime/renderPage/loadUserFilesServerSide.js +1 -1
- package/dist/cjs/node/runtime/renderPage/{logHintForCjsEsmError.js → logErrorHint.js} +81 -43
- package/dist/cjs/node/runtime/renderPage/loggerProd.js +3 -3
- package/dist/cjs/node/runtime/renderPage/renderPageAlreadyRouted.js +2 -23
- package/dist/cjs/node/runtime/utils.js +1 -1
- package/dist/cjs/node/shared/assertPluginManifest.js +1 -4
- package/dist/cjs/node/shared/assertV1Design.js +26 -0
- package/dist/cjs/node/shared/{getClientEntryFilePath.js → getClientEntry.js} +3 -3
- package/dist/cjs/node/shared/prependEntriesDir.js +13 -0
- package/dist/cjs/node/shared/utils.js +2 -0
- package/dist/cjs/shared/page-configs/serialize/parseConfigValuesImported.js +53 -26
- package/dist/cjs/shared/route/executeGuardHook.js +3 -2
- package/dist/cjs/shared/utils.js +0 -1
- package/dist/cjs/utils/assertNodeVersion.js +2 -2
- package/dist/cjs/utils/{findUserPackageJsonPath.js → findFile.js} +11 -8
- package/dist/cjs/utils/isVersionOrAbove.js +29 -0
- package/dist/cjs/utils/nodeEnv.js +23 -1
- package/dist/cjs/utils/objectKeys.js +19 -3
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/cjs/utils/sorter.js +62 -1
- package/dist/esm/client/client-routing-runtime/index.d.ts +1 -1
- package/dist/esm/client/client-routing-runtime/index.js +1 -1
- package/dist/esm/node/cli/bin.js +3 -1
- package/dist/esm/node/client/router.d.ts +2 -0
- package/dist/esm/node/client/router.js +3 -1
- package/dist/esm/node/plugin/plugins/autoFullBuild.js +2 -2
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.d.ts +13 -0
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +142 -0
- package/dist/esm/node/plugin/plugins/buildConfig.d.ts +2 -0
- package/dist/esm/node/plugin/plugins/buildConfig.js +60 -34
- package/dist/esm/node/plugin/plugins/commonConfig.js +6 -14
- package/dist/esm/node/plugin/plugins/config/stemUtils.js +2 -2
- package/dist/esm/node/plugin/plugins/distFileNames.js +9 -1
- package/dist/esm/node/plugin/plugins/envVars.js +6 -2
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +17 -5
- package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +2 -2
- package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.d.ts +1 -2
- package/dist/esm/node/plugin/plugins/importBuild/getVikeManifest.js +2 -19
- package/dist/esm/node/plugin/plugins/importBuild/index.d.ts +6 -1
- package/dist/esm/node/plugin/plugins/importBuild/index.js +5 -8
- package/dist/esm/node/plugin/plugins/importUserCode/getVirtualFileImportUserCode.js +13 -93
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +2 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.d.ts +0 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +1 -5
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +39 -12
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +29 -47
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{loadFileConfigEnv.js → loadFileAtConfigTime.js} +4 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveFilePath.d.ts +5 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveFilePath.js +27 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{transformImports.d.ts → transformFileImports.d.ts} +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{transformImports.js → transformFileImports.js} +6 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +20 -26
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +5 -0
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +155 -109
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVirtualFilePageConfigValuesAll.js +2 -1
- package/dist/esm/node/plugin/plugins/setGlobalContext.js +1 -15
- package/dist/esm/node/plugin/shared/rollupSourceMap.d.ts +14 -0
- package/dist/esm/node/plugin/shared/rollupSourceMap.js +17 -0
- package/dist/esm/node/plugin/utils.d.ts +3 -2
- package/dist/esm/node/plugin/utils.js +3 -2
- package/dist/esm/node/prerender/runPrerender.js +15 -7
- package/dist/esm/node/runtime/globalContext.d.ts +3 -10
- package/dist/esm/node/runtime/globalContext.js +15 -23
- package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.js +2 -2
- package/dist/esm/node/runtime/html/renderHtml.js +1 -1
- package/dist/esm/node/runtime/html/stream.js +2 -2
- package/dist/esm/node/runtime/renderPage/analyzePage.js +2 -2
- package/dist/esm/node/runtime/renderPage/executeOnRenderHtmlHook.js +2 -2
- package/dist/esm/node/runtime/renderPage/getHttpResponseBody.d.ts +6 -5
- package/dist/esm/node/runtime/renderPage/getHttpResponseBody.js +39 -39
- package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +0 -5
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.js +6 -7
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.d.ts +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +2 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets.js +24 -29
- package/dist/esm/node/runtime/renderPage/loadUserFilesServerSide.js +1 -1
- package/dist/esm/node/runtime/renderPage/logErrorHint.d.ts +8 -0
- package/dist/esm/node/runtime/renderPage/{logHintForCjsEsmError.js → logErrorHint.js} +80 -42
- package/dist/esm/node/runtime/renderPage/loggerProd.js +3 -3
- package/dist/esm/node/runtime/renderPage/renderPageAlreadyRouted.js +3 -24
- package/dist/esm/node/runtime/utils.d.ts +1 -1
- package/dist/esm/node/runtime/utils.js +1 -1
- package/dist/esm/node/shared/ViteManifest.d.ts +1 -0
- package/dist/esm/node/shared/assertPluginManifest.d.ts +0 -1
- package/dist/esm/node/shared/assertPluginManifest.js +2 -5
- package/dist/esm/node/shared/assertV1Design.d.ts +4 -0
- package/dist/esm/node/shared/assertV1Design.js +23 -0
- package/dist/esm/node/shared/getClientEntry.d.ts +3 -0
- package/dist/esm/node/shared/{getClientEntryFilePath.js → getClientEntry.js} +2 -2
- package/dist/esm/node/shared/prependEntriesDir.d.ts +2 -0
- package/dist/esm/node/shared/prependEntriesDir.js +10 -0
- package/dist/esm/node/shared/utils.d.ts +2 -0
- package/dist/esm/node/shared/utils.js +2 -0
- package/dist/esm/shared/page-configs/Config.d.ts +1 -1
- package/dist/esm/shared/page-configs/PageConfig.d.ts +3 -3
- package/dist/esm/shared/page-configs/serialize/parseConfigValuesImported.js +53 -26
- package/dist/esm/shared/route/executeGuardHook.js +3 -2
- package/dist/esm/shared/utils.d.ts +0 -1
- package/dist/esm/shared/utils.js +0 -1
- package/dist/esm/utils/assertNodeVersion.js +2 -2
- package/dist/esm/utils/findFile.d.ts +3 -0
- package/dist/esm/utils/findFile.js +21 -0
- package/dist/esm/utils/getOutDirs.d.ts +1 -0
- package/dist/esm/utils/isVersionOrAbove.d.ts +2 -0
- package/dist/esm/utils/isVersionOrAbove.js +26 -0
- package/dist/esm/utils/nodeEnv.d.ts +4 -0
- package/dist/esm/utils/nodeEnv.js +19 -0
- package/dist/esm/utils/objectKeys.d.ts +10 -1
- package/dist/esm/utils/objectKeys.js +20 -3
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/dist/esm/utils/sorter.d.ts +59 -0
- package/dist/esm/utils/sorter.js +61 -0
- package/package.json +2 -2
- package/dist/cjs/node/plugin/shared/removeSourceMap.js +0 -12
- package/dist/cjs/utils/objectEntries.js +0 -8
- package/dist/esm/node/plugin/shared/removeSourceMap.d.ts +0 -7
- package/dist/esm/node/plugin/shared/removeSourceMap.js +0 -9
- package/dist/esm/node/runtime/renderPage/logHintForCjsEsmError.d.ts +0 -13
- package/dist/esm/node/shared/getClientEntryFilePath.d.ts +0 -3
- package/dist/esm/utils/findUserPackageJsonPath.d.ts +0 -2
- package/dist/esm/utils/findUserPackageJsonPath.js +0 -18
- package/dist/esm/utils/objectEntries.d.ts +0 -4
- package/dist/esm/utils/objectEntries.js +0 -5
- /package/dist/cjs/node/runtime/renderPage/{logHintForCjsEsmError → logErrorHint}/errors.js +0 -0
- /package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/{loadFileConfigEnv.d.ts → loadFileAtConfigTime.d.ts} +0 -0
- /package/dist/esm/node/runtime/renderPage/{logHintForCjsEsmError → logErrorHint}/errors.d.ts +0 -0
- /package/dist/esm/node/runtime/renderPage/{logHintForCjsEsmError → logErrorHint}/errors.js +0 -0
|
@@ -1,12 +1,22 @@
|
|
|
1
|
-
export {
|
|
2
|
-
// For ./
|
|
1
|
+
export { logErrorHint };
|
|
2
|
+
// For ./logErrorHint/*.spec.ts
|
|
3
3
|
export { isCjsEsmError };
|
|
4
|
-
export {
|
|
4
|
+
export { isKnownError };
|
|
5
5
|
export { getHint };
|
|
6
6
|
import pc from '@brillout/picocolors';
|
|
7
7
|
import { assert, formatHintLog, isNotNullish, isObject, unique, joinEnglish } from '../utils.js';
|
|
8
|
-
|
|
9
|
-
|
|
8
|
+
const knownErrors = [
|
|
9
|
+
{
|
|
10
|
+
errMsg: 'jsxDEV is not a function',
|
|
11
|
+
link: 'https://github.com/vikejs/vike/issues/1469#issuecomment-1919518096'
|
|
12
|
+
},
|
|
13
|
+
{
|
|
14
|
+
errMsg: 'Element type is invalid: expected a string (for built-in components) or a class/function (for composite components)',
|
|
15
|
+
link: 'https://vike.dev/broken-npm-package#react-invalid-component'
|
|
16
|
+
}
|
|
17
|
+
];
|
|
18
|
+
function logErrorHint(error) {
|
|
19
|
+
/* Collect errors for ./logErrorHint.spec.ts
|
|
10
20
|
collectError(error)
|
|
11
21
|
//*/
|
|
12
22
|
const hint = getHint(error);
|
|
@@ -14,9 +24,10 @@ function logHintForCjsEsmError(error) {
|
|
|
14
24
|
logHint(hint);
|
|
15
25
|
}
|
|
16
26
|
function getHint(error) {
|
|
17
|
-
|
|
18
|
-
const
|
|
19
|
-
|
|
27
|
+
{
|
|
28
|
+
const link = isKnownError(error);
|
|
29
|
+
if (link)
|
|
30
|
+
return `To fix this error, see ${link}`;
|
|
20
31
|
}
|
|
21
32
|
const res = isCjsEsmError(error);
|
|
22
33
|
if (res) {
|
|
@@ -37,43 +48,71 @@ function logHint(hint) {
|
|
|
37
48
|
hint = formatHintLog(hint);
|
|
38
49
|
console.error(hint);
|
|
39
50
|
}
|
|
40
|
-
function
|
|
51
|
+
function isKnownError(error) {
|
|
41
52
|
const anywhere = getAnywhere(error);
|
|
42
|
-
|
|
53
|
+
const knownErr = knownErrors.find((knownErorr) => {
|
|
54
|
+
return includes(anywhere, knownErorr.errMsg);
|
|
55
|
+
});
|
|
56
|
+
if (!knownErr)
|
|
57
|
+
return false;
|
|
58
|
+
return knownErr.link;
|
|
43
59
|
}
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
* `'some-npm-package'` -> add some-npm-package to `ssr.noExternal`
|
|
48
|
-
*/
|
|
60
|
+
// `false` -> noop
|
|
61
|
+
// `true` -> generic message
|
|
62
|
+
// `'some-npm-package'` -> add some-npm-package to `ssr.noExternal`
|
|
49
63
|
function isCjsEsmError(error) {
|
|
64
|
+
const res = check(error);
|
|
65
|
+
if (res === true || res === false)
|
|
66
|
+
return res;
|
|
67
|
+
const packageNames = normalizeRes(res);
|
|
68
|
+
if (packageNames === false)
|
|
69
|
+
return packageNames;
|
|
70
|
+
packageNames.forEach((packageName) => {
|
|
71
|
+
assert(!['vite', 'vike'].includes(packageName));
|
|
72
|
+
});
|
|
73
|
+
return packageNames;
|
|
74
|
+
}
|
|
75
|
+
function normalizeRes(res) {
|
|
76
|
+
let packageNames = Array.isArray(res) ? res : [res];
|
|
77
|
+
packageNames = unique(packageNames.filter(isNotNullish).filter((packageName) => packageName !== '@brillout/import'));
|
|
78
|
+
if (packageNames.length === 0)
|
|
79
|
+
return false;
|
|
80
|
+
return packageNames;
|
|
81
|
+
}
|
|
82
|
+
function check(error) {
|
|
50
83
|
const message = getErrMessage(error);
|
|
51
84
|
const anywhere = getAnywhere(error);
|
|
52
85
|
const packageName_stack1 = getPackageName_stack1(error);
|
|
53
86
|
const packageName_stack2 = getPackageName_stack2(error);
|
|
54
87
|
const isRelatedToNodeModules = !!packageName_stack1 || !!packageName_stack2 || includesNodeModules(message);
|
|
55
|
-
|
|
88
|
+
/*
|
|
89
|
+
const relatedNpmPackages = normalizeArray([
|
|
90
|
+
packageName_stack1 || null,
|
|
91
|
+
packageName_stack2 || null,
|
|
92
|
+
(message && extractFromNodeModulesPath(message)) || null
|
|
93
|
+
])
|
|
94
|
+
*/
|
|
56
95
|
// ERR_UNSUPPORTED_DIR_IMPORT
|
|
57
96
|
{
|
|
58
|
-
const
|
|
59
|
-
if (
|
|
60
|
-
return
|
|
97
|
+
const packageName = parseNodeModulesPathMessage('ERR_UNSUPPORTED_DIR_IMPORT', anywhere);
|
|
98
|
+
if (packageName)
|
|
99
|
+
return packageName;
|
|
61
100
|
}
|
|
62
101
|
// ERR_UNKNOWN_FILE_EXTENSION
|
|
63
102
|
{
|
|
64
|
-
const
|
|
65
|
-
if (
|
|
66
|
-
return
|
|
103
|
+
const packageName = parseUnkownFileExtensionMessage(anywhere);
|
|
104
|
+
if (packageName)
|
|
105
|
+
return packageName;
|
|
67
106
|
}
|
|
68
107
|
{
|
|
69
|
-
const
|
|
70
|
-
if (
|
|
71
|
-
return
|
|
108
|
+
const packageName = parseNodeModulesPathMessage('ERR_UNKNOWN_FILE_EXTENSION', anywhere);
|
|
109
|
+
if (packageName)
|
|
110
|
+
return packageName;
|
|
72
111
|
}
|
|
73
112
|
{
|
|
74
|
-
const
|
|
75
|
-
if (
|
|
76
|
-
return
|
|
113
|
+
const packageName = parseNodeModulesPathMessage('is not exported', anywhere);
|
|
114
|
+
if (packageName)
|
|
115
|
+
return packageName;
|
|
77
116
|
}
|
|
78
117
|
// Using CJS inside ESM modules.
|
|
79
118
|
if (includes(anywhere, 'require is not a function') ||
|
|
@@ -94,7 +133,7 @@ function isCjsEsmError(error) {
|
|
|
94
133
|
if (includes(anywhere, 'ERR_REQUIRE_ESM')) {
|
|
95
134
|
/* The issue is the importer, not the importee.
|
|
96
135
|
if (relatedNpmPackages) return relatedNpmPackages
|
|
97
|
-
|
|
136
|
+
*/
|
|
98
137
|
{
|
|
99
138
|
if (packageName_stack1)
|
|
100
139
|
return packageName_stack1;
|
|
@@ -114,9 +153,9 @@ function isCjsEsmError(error) {
|
|
|
114
153
|
*/
|
|
115
154
|
// `SyntaxError: Named export '${exportName}' not found. The requested module '${packageName}' is a CommonJS module, which may not support all module.exports as named exports.`
|
|
116
155
|
{
|
|
117
|
-
const
|
|
118
|
-
if (
|
|
119
|
-
return
|
|
156
|
+
const packageName = parseImportFrom(anywhere);
|
|
157
|
+
if (packageName)
|
|
158
|
+
return packageName;
|
|
120
159
|
}
|
|
121
160
|
if (includes(anywhere, 'Cannot read properties of undefined')) {
|
|
122
161
|
if (isRelatedToNodeModules) {
|
|
@@ -152,7 +191,7 @@ function parseCannotFindMessage(str) {
|
|
|
152
191
|
return false;
|
|
153
192
|
// const packageNameCannotFind = extractFromPath(match[1]!)
|
|
154
193
|
const packageNameFrom = extractFromPath(match[2]);
|
|
155
|
-
return
|
|
194
|
+
return normalizeArray([
|
|
156
195
|
// packageNameCannotFind,
|
|
157
196
|
packageNameFrom
|
|
158
197
|
]);
|
|
@@ -163,7 +202,7 @@ function parseUnkownFileExtensionMessage(str) {
|
|
|
163
202
|
return false;
|
|
164
203
|
const filePath = match[1];
|
|
165
204
|
const packageName = extractFromPath(filePath);
|
|
166
|
-
return
|
|
205
|
+
return packageName;
|
|
167
206
|
}
|
|
168
207
|
function parseImportFrom(str) {
|
|
169
208
|
const match = /\bimport\b.*?\bfrom\b\s*?"(.+?)"/.exec(str);
|
|
@@ -171,7 +210,7 @@ function parseImportFrom(str) {
|
|
|
171
210
|
return false;
|
|
172
211
|
const importPath = match[1];
|
|
173
212
|
const packageName = extractFromPath(importPath);
|
|
174
|
-
return
|
|
213
|
+
return packageName;
|
|
175
214
|
}
|
|
176
215
|
function parseNodeModulesPathMessage(begin, str) {
|
|
177
216
|
str = str.replaceAll('\\', '/');
|
|
@@ -225,7 +264,6 @@ function extractFromPath(filePath) {
|
|
|
225
264
|
packageName = packageName.split('/')[0];
|
|
226
265
|
}
|
|
227
266
|
packageName = clean(packageName);
|
|
228
|
-
assert(!['vite', 'vike'].includes(packageName));
|
|
229
267
|
return packageName;
|
|
230
268
|
}
|
|
231
269
|
function clean(packageName) {
|
|
@@ -243,7 +281,7 @@ function extractFromNodeModulesPath(str) {
|
|
|
243
281
|
return false;
|
|
244
282
|
const packageName = extractFromPath(str);
|
|
245
283
|
assert(packageName);
|
|
246
|
-
return
|
|
284
|
+
return packageName;
|
|
247
285
|
}
|
|
248
286
|
function includes(str1, str2) {
|
|
249
287
|
return !!str1 && str1.toLowerCase().includes(str2.toLowerCase());
|
|
@@ -258,11 +296,11 @@ function includesNodeModules(str) {
|
|
|
258
296
|
return false;
|
|
259
297
|
return true;
|
|
260
298
|
}
|
|
261
|
-
function
|
|
262
|
-
const
|
|
263
|
-
if (
|
|
264
|
-
return
|
|
265
|
-
return
|
|
299
|
+
function normalizeArray(arr) {
|
|
300
|
+
const arrNormalized = arr.filter(isNotNullish);
|
|
301
|
+
if (arrNormalized.length === 0)
|
|
302
|
+
return null;
|
|
303
|
+
return arrNormalized;
|
|
266
304
|
}
|
|
267
305
|
function getErrMessage(err) {
|
|
268
306
|
if (!isObject(err))
|
|
@@ -6,7 +6,7 @@ import { isAbortError } from '../../../shared/route/abort.js';
|
|
|
6
6
|
import { setAlreadyLogged } from './isNewError.js';
|
|
7
7
|
import { isObject, warnIfErrorIsNotObject } from '../utils.js';
|
|
8
8
|
import pc from '@brillout/picocolors';
|
|
9
|
-
import {
|
|
9
|
+
import { logErrorHint } from './logErrorHint.js';
|
|
10
10
|
function logErrorProd(err, _httpRquestId) {
|
|
11
11
|
warnIfErrorIsNotObject(err);
|
|
12
12
|
setAlreadyLogged(err);
|
|
@@ -20,6 +20,6 @@ function logErrorProd(err, _httpRquestId) {
|
|
|
20
20
|
}
|
|
21
21
|
// Every server-side runtime error is expected to go through onRuntimeError(). (In principle, any runtime error is (or at least should) be catched by Vike, otherwise Vike couldn't render the error page.)
|
|
22
22
|
function onRuntimeError(err) {
|
|
23
|
-
// The more runtime errors we pass to
|
|
24
|
-
|
|
23
|
+
// The more runtime errors we pass to logErrorHint() the better.
|
|
24
|
+
logErrorHint(err);
|
|
25
25
|
}
|
|
@@ -6,7 +6,7 @@ export { getRenderContext };
|
|
|
6
6
|
import { getErrorPageId } from '../../../shared/error-page.js';
|
|
7
7
|
import { getHtmlString } from '../html/renderHtml.js';
|
|
8
8
|
import { getPageFilesAll } from '../../../shared/getPageFiles.js';
|
|
9
|
-
import { assert, assertUsage,
|
|
9
|
+
import { assert, assertUsage, hasProp, objectAssign } from '../utils.js';
|
|
10
10
|
import { serializePageContextClientSide } from '../html/serializePageContextClientSide.js';
|
|
11
11
|
import { addUrlComputedProps } from '../../../shared/addUrlComputedProps.js';
|
|
12
12
|
import { getGlobalContext } from '../globalContext.js';
|
|
@@ -20,8 +20,8 @@ import { preparePageContextForUserConsumptionServerSide } from './preparePageCon
|
|
|
20
20
|
import { executeGuardHook } from '../../../shared/route/executeGuardHook.js';
|
|
21
21
|
import { loadPageRoutes } from '../../../shared/route/loadPageRoutes.js';
|
|
22
22
|
import pc from '@brillout/picocolors';
|
|
23
|
-
import { getConfigValueFilePathToShowToUser } from '../../../shared/page-configs/helpers.js';
|
|
24
23
|
import { isServerSideError } from '../../../shared/misc/isServerSideError.js';
|
|
24
|
+
import { assertV1Design } from '../../shared/assertV1Design.js';
|
|
25
25
|
async function renderPageAlreadyRouted(pageContext) {
|
|
26
26
|
// pageContext._pageId can either be the:
|
|
27
27
|
// - ID of the page matching the routing, or the
|
|
@@ -151,7 +151,7 @@ async function getRenderContext() {
|
|
|
151
151
|
const globalContext = getGlobalContext();
|
|
152
152
|
const { pageFilesAll, allPageIds, pageConfigs, pageConfigGlobal } = await getPageFilesAll(false, globalContext.isProduction);
|
|
153
153
|
const { pageRoutes, onBeforeRouteHook } = await loadPageRoutes(pageFilesAll, pageConfigs, pageConfigGlobal, allPageIds);
|
|
154
|
-
assertV1Design(pageFilesAll, pageConfigs);
|
|
154
|
+
assertV1Design(pageFilesAll.length > 0, pageConfigs, pageFilesAll);
|
|
155
155
|
const renderContext = {
|
|
156
156
|
pageFilesAll: pageFilesAll,
|
|
157
157
|
pageConfigs,
|
|
@@ -162,24 +162,3 @@ async function getRenderContext() {
|
|
|
162
162
|
};
|
|
163
163
|
return renderContext;
|
|
164
164
|
}
|
|
165
|
-
function assertV1Design(pageFilesAll, pageConfigs) {
|
|
166
|
-
const isV1Design = pageConfigs.length !== 0;
|
|
167
|
-
const isDesignOld = pageFilesAll.length !== 0;
|
|
168
|
-
if (isV1Design && isDesignOld) {
|
|
169
|
-
const indent = '- ';
|
|
170
|
-
const v1Files = unique(pageConfigs
|
|
171
|
-
.map((p) => Object.values(p.configValues)
|
|
172
|
-
.map(getConfigValueFilePathToShowToUser)
|
|
173
|
-
.filter(isNotNullish)
|
|
174
|
-
.map((filePathToShowToUser) => indent + filePathToShowToUser))
|
|
175
|
-
.flat(2));
|
|
176
|
-
assertUsage(false, [
|
|
177
|
-
'Mixing the new V1 design with the old V0.4 design is forbidden.',
|
|
178
|
-
'V1 files:',
|
|
179
|
-
...v1Files,
|
|
180
|
-
'V0.4 files:',
|
|
181
|
-
...pageFilesAll.map((p) => indent + p.filePath)
|
|
182
|
-
].join('\n'));
|
|
183
|
-
}
|
|
184
|
-
assertWarning(!isDesignOld, "You are using Vike's deprecated design. Update to the new V1 design, see https://vike.dev/migration/v1-design for how to migrate.", { onlyOnce: true });
|
|
185
|
-
}
|
|
@@ -36,7 +36,7 @@ export * from '../../utils/isNpmPackage.js';
|
|
|
36
36
|
export * from '../../utils/isNotNullish.js';
|
|
37
37
|
export * from '../../utils/isScriptFile.js';
|
|
38
38
|
export * from '../../utils/removeFileExtention.js';
|
|
39
|
-
export * from '../../utils/
|
|
39
|
+
export * from '../../utils/objectKeys.js';
|
|
40
40
|
export * from '../../utils/isStringRecord.js';
|
|
41
41
|
export * from '../../utils/getFileExtension.js';
|
|
42
42
|
export * from '../../utils/assertIsNotProductionRuntime.js';
|
|
@@ -39,7 +39,7 @@ export * from '../../utils/isNpmPackage.js';
|
|
|
39
39
|
export * from '../../utils/isNotNullish.js';
|
|
40
40
|
export * from '../../utils/isScriptFile.js';
|
|
41
41
|
export * from '../../utils/removeFileExtention.js';
|
|
42
|
-
export * from '../../utils/
|
|
42
|
+
export * from '../../utils/objectKeys.js';
|
|
43
43
|
export * from '../../utils/isStringRecord.js';
|
|
44
44
|
export * from '../../utils/getFileExtension.js';
|
|
45
45
|
export * from '../../utils/assertIsNotProductionRuntime.js';
|
|
@@ -1,21 +1,18 @@
|
|
|
1
1
|
export { assertPluginManifest };
|
|
2
2
|
import { assertRuntimeManifest } from './assertRuntimeManifest.js';
|
|
3
|
-
import { assert, assertUsage, isPlainObject, projectInfo, checkType, hasProp
|
|
3
|
+
import { assert, assertUsage, isPlainObject, projectInfo, checkType, hasProp } from './utils.js';
|
|
4
4
|
function assertPluginManifest(pluginManifest) {
|
|
5
5
|
assert(isPlainObject(pluginManifest));
|
|
6
6
|
assertUsage(pluginManifest.version === projectInfo.projectVersion, `Re-build your app (you're using vike@${projectInfo.projectVersion} but your app was built with vike@${pluginManifest.version})`);
|
|
7
7
|
assertRuntimeManifest(pluginManifest);
|
|
8
8
|
assert(hasProp(pluginManifest, 'usesClientRouter', 'boolean'));
|
|
9
9
|
assert(hasProp(pluginManifest, 'version', 'string'));
|
|
10
|
-
assert(hasProp(pluginManifest, 'manifestKeyMap', 'object'));
|
|
11
|
-
const { manifestKeyMap } = pluginManifest;
|
|
12
|
-
assert(isStringRecord(manifestKeyMap));
|
|
13
10
|
// Avoid:
|
|
14
11
|
// ```
|
|
15
12
|
// Uncaught (in promise) TypeError: Cannot set property manifestKeyMap of #<Object> which has only a getter
|
|
16
13
|
// ```
|
|
14
|
+
// We removed manifestKeyMap, maybe this isn't needed anymore.
|
|
17
15
|
// See https://github.com/vikejs/vike/issues/596
|
|
18
16
|
const pluginManifestClone = { ...pluginManifest };
|
|
19
|
-
objectAssign(pluginManifestClone, { manifestKeyMap });
|
|
20
17
|
checkType(pluginManifestClone);
|
|
21
18
|
}
|
|
@@ -0,0 +1,4 @@
|
|
|
1
|
+
export { assertV1Design };
|
|
2
|
+
import { PageFile } from '../../shared/getPageFiles.js';
|
|
3
|
+
import type { PageConfigBuildTime, PageConfigRuntime } from '../../shared/page-configs/PageConfig.js';
|
|
4
|
+
declare function assertV1Design(isOldDesign: boolean, pageConfigs: (PageConfigRuntime | PageConfigBuildTime)[], pageFilesAll?: PageFile[]): void;
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
export { assertV1Design };
|
|
2
|
+
import { getConfigValueFilePathToShowToUser } from '../../shared/page-configs/helpers.js';
|
|
3
|
+
import { assert, assertUsage, assertWarning, isNotNullish, unique } from './utils.js';
|
|
4
|
+
function assertV1Design(isOldDesign, pageConfigs, pageFilesAll) {
|
|
5
|
+
const isV1Design = pageConfigs.length > 0;
|
|
6
|
+
if (isV1Design && isOldDesign) {
|
|
7
|
+
const lines = ['Mixing the new V1 design with the old V0.4 design is forbidden.'];
|
|
8
|
+
if (pageFilesAll) {
|
|
9
|
+
assert(pageFilesAll.length > 0);
|
|
10
|
+
const indent = '- ';
|
|
11
|
+
const filesV1 = unique(pageConfigs
|
|
12
|
+
.map((p) => Object.values(p.configValues)
|
|
13
|
+
.map(getConfigValueFilePathToShowToUser)
|
|
14
|
+
.filter(isNotNullish)
|
|
15
|
+
.map((filePathToShowToUser) => indent + filePathToShowToUser))
|
|
16
|
+
.flat(2));
|
|
17
|
+
const filesOld = pageFilesAll.map((p) => indent + p.filePath);
|
|
18
|
+
lines.push(...['V1 design files:', ...filesV1, 'Old design files:', ...filesOld]);
|
|
19
|
+
}
|
|
20
|
+
assertUsage(false, lines.join('\n'));
|
|
21
|
+
}
|
|
22
|
+
assertWarning(!isOldDesign, "You are using Vike's deprecated design. Update to the new V1 design, see https://vike.dev/migration/v1-design for how to migrate.", { onlyOnce: true });
|
|
23
|
+
}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
export {
|
|
1
|
+
export { getClientEntry };
|
|
2
2
|
import { getConfigValue } from '../../shared/page-configs/helpers.js';
|
|
3
|
-
function
|
|
3
|
+
function getClientEntry(pageConfig) {
|
|
4
4
|
const configName = 'client';
|
|
5
5
|
const configValue = getConfigValue(pageConfig, configName, 'string');
|
|
6
6
|
if (!configValue)
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
export { prependEntriesDir };
|
|
2
|
+
import { assert } from './utils.js';
|
|
3
|
+
function prependEntriesDir(entryName) {
|
|
4
|
+
if (entryName.startsWith('/')) {
|
|
5
|
+
entryName = entryName.slice(1);
|
|
6
|
+
}
|
|
7
|
+
assert(!entryName.startsWith('/'));
|
|
8
|
+
entryName = `entries/${entryName}`;
|
|
9
|
+
return entryName;
|
|
10
|
+
}
|
|
@@ -13,3 +13,5 @@ export * from '../../utils/parseUrl-extras.js';
|
|
|
13
13
|
export * from '../../utils/isObject.js';
|
|
14
14
|
export * from '../../utils/virtual-files.js';
|
|
15
15
|
export * from '../../utils/assertIsNotBrowser.js';
|
|
16
|
+
export * from '../../utils/isNotNullish.js';
|
|
17
|
+
export * from '../../utils/unique.js';
|
|
@@ -15,3 +15,5 @@ export * from '../../utils/parseUrl-extras.js';
|
|
|
15
15
|
export * from '../../utils/isObject.js';
|
|
16
16
|
export * from '../../utils/virtual-files.js';
|
|
17
17
|
export * from '../../utils/assertIsNotBrowser.js';
|
|
18
|
+
export * from '../../utils/isNotNullish.js';
|
|
19
|
+
export * from '../../utils/unique.js';
|
|
@@ -201,7 +201,7 @@ type OnRenderHtmlSync = (pageContext: PageContextServer) => DocumentHtml | {
|
|
|
201
201
|
pageContext: OnRenderHtmlPageContextReturn | (() => Promise<OnRenderHtmlPageContextReturn> | OnRenderHtmlPageContextReturn);
|
|
202
202
|
};
|
|
203
203
|
type OnRenderHtmlPageContextReturn = Partial<Vike.PageContext & {
|
|
204
|
-
/** See https://vike.dev/
|
|
204
|
+
/** See https://vike.dev/streaming */
|
|
205
205
|
enableEagerStreaming: boolean;
|
|
206
206
|
}>;
|
|
207
207
|
/** @deprecated Use a sync route() with an async guard() instead */
|
|
@@ -17,6 +17,7 @@ export type { DefinedAtFileFullInfo };
|
|
|
17
17
|
export type { FilePathResolved };
|
|
18
18
|
export type { FilePath };
|
|
19
19
|
import type { ConfigValueImported, ConfigValueSerialized } from './serialize/PageConfigSerialized.js';
|
|
20
|
+
import type { LocationId } from '../../node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js';
|
|
20
21
|
type PageConfigBase = {
|
|
21
22
|
pageId: string;
|
|
22
23
|
isErrorPage?: true;
|
|
@@ -24,11 +25,10 @@ type PageConfigBase = {
|
|
|
24
25
|
routeString: string;
|
|
25
26
|
definedBy: string;
|
|
26
27
|
};
|
|
28
|
+
configValues: ConfigValues;
|
|
27
29
|
};
|
|
28
30
|
/** Page config data structure available at runtime */
|
|
29
31
|
type PageConfigRuntime = PageConfigBase & {
|
|
30
|
-
/** All loaded config values */
|
|
31
|
-
configValues: ConfigValues;
|
|
32
32
|
/** Load config values that are lazily loaded such as config.Page */
|
|
33
33
|
loadConfigValuesAll: () => Promise<{
|
|
34
34
|
configValuesImported: ConfigValueImported[];
|
|
@@ -42,7 +42,6 @@ type PageConfigRuntimeLoaded = PageConfigRuntime & {
|
|
|
42
42
|
};
|
|
43
43
|
/** Page config data structure available at build-time */
|
|
44
44
|
type PageConfigBuildTime = PageConfigBase & {
|
|
45
|
-
configValues: ConfigValues;
|
|
46
45
|
configValueSources: ConfigValueSources;
|
|
47
46
|
configValuesComputed: ConfigValuesComputed;
|
|
48
47
|
};
|
|
@@ -71,6 +70,7 @@ type ConfigValueSource = {
|
|
|
71
70
|
value?: unknown;
|
|
72
71
|
configEnv: ConfigEnvInternal;
|
|
73
72
|
definedAt: DefinedAtFileFullInfo;
|
|
73
|
+
locationId: LocationId;
|
|
74
74
|
/** Wether the config value is loaded at runtime, for example config.Page or config.onBeforeRender */
|
|
75
75
|
valueIsImportedAtRuntime: boolean;
|
|
76
76
|
/** Whether the config value is a file path, for example config.client */
|
|
@@ -2,41 +2,68 @@ export { parseConfigValuesImported };
|
|
|
2
2
|
import { assert } from '../../utils.js';
|
|
3
3
|
import { assertPlusFileExport } from '../assertPlusFileExport.js';
|
|
4
4
|
function parseConfigValuesImported(configValuesImported) {
|
|
5
|
-
const
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
definedAt: {
|
|
10
|
-
// importPath cannot be relative to the current file, since the current file is a virtual file
|
|
11
|
-
filePathToShowToUser: importPath,
|
|
12
|
-
fileExportPathToShowToUser: [configName, 'default'].includes(exportName)
|
|
13
|
-
? []
|
|
14
|
-
: // Side-effect config
|
|
15
|
-
[exportName]
|
|
16
|
-
}
|
|
17
|
-
};
|
|
18
|
-
assertIsNotNull(value, configName, importPath);
|
|
19
|
-
};
|
|
20
|
-
configValuesImported.forEach((configValueLoaded) => {
|
|
5
|
+
const configValuesUnmerged = {};
|
|
6
|
+
configValuesImported
|
|
7
|
+
.filter((c) => c.configName !== 'client')
|
|
8
|
+
.forEach((configValueLoaded) => {
|
|
21
9
|
if (configValueLoaded.isValueFile) {
|
|
22
10
|
const { exportValues, importPath, configName } = configValueLoaded;
|
|
23
|
-
|
|
24
|
-
assertPlusFileExport(exportValues, importPath, configName);
|
|
25
|
-
}
|
|
11
|
+
assertPlusFileExport(exportValues, importPath, configName);
|
|
26
12
|
Object.entries(exportValues).forEach(([exportName, exportValue]) => {
|
|
27
13
|
const isSideExport = exportName !== 'default'; // .md files may have "side-exports" such as `export { frontmatter }`
|
|
28
14
|
const configName = isSideExport ? exportName : configValueLoaded.configName;
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
15
|
+
configValuesUnmerged[configName] ?? (configValuesUnmerged[configName] = []);
|
|
16
|
+
configValuesUnmerged[configName].push({
|
|
17
|
+
value: exportValue,
|
|
18
|
+
importPath,
|
|
19
|
+
exportName,
|
|
20
|
+
isSideExport
|
|
21
|
+
});
|
|
35
22
|
});
|
|
36
23
|
}
|
|
37
24
|
else {
|
|
38
25
|
const { configName, importPath, exportValue, exportName } = configValueLoaded;
|
|
39
|
-
|
|
26
|
+
configValuesUnmerged[configName] ?? (configValuesUnmerged[configName] = []);
|
|
27
|
+
configValuesUnmerged[configName].push({
|
|
28
|
+
value: exportValue,
|
|
29
|
+
importPath,
|
|
30
|
+
exportName,
|
|
31
|
+
isSideExport: false
|
|
32
|
+
});
|
|
33
|
+
}
|
|
34
|
+
});
|
|
35
|
+
const configValues = {};
|
|
36
|
+
Object.entries(configValuesUnmerged).forEach(([configName, values]) => {
|
|
37
|
+
const valuesWithoutSideExports = values.filter((v) => !v.isSideExport);
|
|
38
|
+
const isCumulative = valuesWithoutSideExports.length > 1;
|
|
39
|
+
const noSideExports = valuesWithoutSideExports.length === values.length;
|
|
40
|
+
if (isCumulative) {
|
|
41
|
+
// Vike currently doesn't support side exports for cumulative configs
|
|
42
|
+
assert(noSideExports);
|
|
43
|
+
// TODO: implement
|
|
44
|
+
assert(false);
|
|
45
|
+
}
|
|
46
|
+
else {
|
|
47
|
+
const val = valuesWithoutSideExports[0] ??
|
|
48
|
+
// We can't avoid side-export conflicts upstream. (We cannot know about side-exports at build-time.)
|
|
49
|
+
// Side-exports have lower precedence.
|
|
50
|
+
values[0];
|
|
51
|
+
assert(val);
|
|
52
|
+
const { value, importPath, exportName } = val;
|
|
53
|
+
configValues[configName] = {
|
|
54
|
+
value,
|
|
55
|
+
definedAt: {
|
|
56
|
+
// importPath cannot be relative to the current file, since the current file is a virtual file
|
|
57
|
+
filePathToShowToUser: importPath,
|
|
58
|
+
fileExportPathToShowToUser: [configName, 'default'].includes(exportName)
|
|
59
|
+
? []
|
|
60
|
+
: [
|
|
61
|
+
// Side-export
|
|
62
|
+
exportName
|
|
63
|
+
]
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
assertIsNotNull(value, configName, importPath);
|
|
40
67
|
}
|
|
41
68
|
});
|
|
42
69
|
return configValues;
|
|
@@ -1,6 +1,7 @@
|
|
|
1
1
|
export { executeGuardHook };
|
|
2
2
|
import { getHook, getHookTimeoutDefault } from '../hooks/getHook.js';
|
|
3
3
|
import { assert, assertUsage, executeHook, isCallable } from './utils.js';
|
|
4
|
+
const errIntro = 'The guard() hook defined by';
|
|
4
5
|
async function executeGuardHook(pageContext, prepareForUserConsumption) {
|
|
5
6
|
let hook;
|
|
6
7
|
if (pageContext._pageFilesAll.length > 0) {
|
|
@@ -20,7 +21,7 @@ async function executeGuardHook(pageContext, prepareForUserConsumption) {
|
|
|
20
21
|
if (res)
|
|
21
22
|
pageContextForUserConsumption = res;
|
|
22
23
|
const hookResult = await executeHook(() => guard(pageContextForUserConsumption), hook);
|
|
23
|
-
assertUsage(hookResult === undefined,
|
|
24
|
+
assertUsage(hookResult === undefined, `${errIntro} ${hook.hookFilePath} returns a value, but guard() shouldn't return any value`);
|
|
24
25
|
}
|
|
25
26
|
function findPageGuard(pageId, pageFilesAll) {
|
|
26
27
|
const pageRouteFile = pageFilesAll.find((p) => p.pageId === pageId && p.fileType === '.page.route');
|
|
@@ -33,6 +34,6 @@ function findPageGuard(pageId, pageFilesAll) {
|
|
|
33
34
|
return null;
|
|
34
35
|
const hookFilePath = filePath;
|
|
35
36
|
const hookTimeout = getHookTimeoutDefault('guard');
|
|
36
|
-
assertUsage(isCallable(hookFn),
|
|
37
|
+
assertUsage(isCallable(hookFn), `${errIntro} ${hookFilePath} should be a function`);
|
|
37
38
|
return { hookFn, hookName: 'guard', hookFilePath, hookTimeout };
|
|
38
39
|
}
|
|
@@ -18,6 +18,5 @@ export * from '../utils/projectInfo.js';
|
|
|
18
18
|
export * from '../utils/isPropertyGetter.js';
|
|
19
19
|
export * from '../utils/isPromise.js';
|
|
20
20
|
export * from '../utils/checkType.js';
|
|
21
|
-
export * from '../utils/objectEntries.js';
|
|
22
21
|
export * from '../utils/getValuePrintable.js';
|
|
23
22
|
export * from '../utils/escapeRegex.js';
|
package/dist/esm/shared/utils.js
CHANGED
|
@@ -22,6 +22,5 @@ export * from '../utils/projectInfo.js';
|
|
|
22
22
|
export * from '../utils/isPropertyGetter.js';
|
|
23
23
|
export * from '../utils/isPromise.js';
|
|
24
24
|
export * from '../utils/checkType.js';
|
|
25
|
-
export * from '../utils/objectEntries.js';
|
|
26
25
|
export * from '../utils/getValuePrintable.js';
|
|
27
26
|
export * from '../utils/escapeRegex.js';
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
export { assertNodeVersion };
|
|
2
2
|
import { assertUsage } from './assert.js';
|
|
3
3
|
import { isNodeJS } from './isNodeJS.js';
|
|
4
|
+
import { isVersionOrAbove } from './isVersionOrAbove.js';
|
|
4
5
|
// package.json#engines.node isn't enough as users can ignore it
|
|
5
6
|
function assertNodeVersion() {
|
|
6
7
|
if (!isNodeJS())
|
|
7
8
|
return;
|
|
8
9
|
const version = process.versions.node;
|
|
9
|
-
|
|
10
|
-
assertUsage(major >= 16, `Node.js ${version} isn't supported, use Node.js >=16.0.0 instead.`);
|
|
10
|
+
assertUsage(isVersionOrAbove(version, '16.0.0'), `Node.js ${version} isn't supported, use Node.js >=16.0.0 instead.`);
|
|
11
11
|
}
|