vike 0.4.165 → 0.4.166
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 +1 -1
- package/dist/cjs/node/plugin/plugins/buildConfig/fixServerAssets.js +6 -2
- package/dist/cjs/node/plugin/plugins/buildConfig.js +68 -58
- package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +12 -0
- package/dist/cjs/node/plugin/plugins/config/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +2 -2
- package/dist/cjs/node/plugin/plugins/envVars.js +1 -1
- package/dist/cjs/node/plugin/plugins/fileEnv.js +2 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +1 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +0 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +53 -24
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +6 -6
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +5 -24
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +15 -22
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +11 -20
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +21 -20
- package/dist/cjs/node/plugin/shared/getFilePath.js +88 -0
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +1 -1
- package/dist/cjs/node/runtime/html/injectAssets/getHtmlTags.js +1 -0
- package/dist/cjs/node/runtime/html/injectAssets/injectHtmlTags.js +1 -1
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +26 -24
- package/dist/cjs/node/runtime/renderPage/logErrorHint.js +5 -0
- package/dist/cjs/node/runtime/renderPage.js +34 -21
- package/dist/cjs/shared/page-configs/FilePath.js +2 -0
- package/dist/cjs/utils/assert.js +2 -0
- package/dist/cjs/utils/assertSingleInstance.js +6 -5
- package/dist/cjs/utils/assertVersion.js +4 -1
- package/dist/cjs/utils/getFilePathAbsolute.js +11 -11
- package/dist/cjs/utils/getGlobalObject.js +21 -6
- package/dist/cjs/utils/isNpmPackage.js +1 -4
- package/dist/cjs/utils/parseUrl.js +8 -1
- package/dist/cjs/utils/projectInfo.js +1 -4
- package/dist/esm/client/client-routing-runtime/history.d.ts +1 -1
- package/dist/esm/client/client-routing-runtime/history.js +5 -5
- package/dist/esm/client/client-routing-runtime/onBrowserHistoryNavigation.js +1 -1
- package/dist/esm/node/plugin/index.js +1 -1
- package/dist/esm/node/plugin/plugins/baseUrls.js +1 -1
- package/dist/esm/node/plugin/plugins/buildConfig/fixServerAssets.js +6 -2
- package/dist/esm/node/plugin/plugins/buildConfig.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/buildConfig.js +69 -59
- package/dist/esm/node/plugin/plugins/commonConfig/assertResolveAlias.js +12 -0
- package/dist/esm/node/plugin/plugins/config/index.js +1 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +3 -3
- package/dist/esm/node/plugin/plugins/envVars.js +2 -2
- package/dist/esm/node/plugin/plugins/fileEnv.js +3 -3
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/configDefinitionsBuiltIn.js +0 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js +54 -25
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/filesystemRouting.js +6 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +6 -25
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.d.ts +2 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +15 -22
- 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 +11 -20
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.d.ts +3 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +21 -20
- package/dist/esm/node/plugin/shared/getFilePath.d.ts +20 -0
- package/dist/esm/node/plugin/shared/getFilePath.js +82 -0
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +2 -2
- package/dist/esm/node/runtime/html/injectAssets/getHtmlTags.js +1 -0
- package/dist/esm/node/runtime/html/injectAssets/injectHtmlTags.js +1 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.js +26 -24
- package/dist/esm/node/runtime/renderPage/logErrorHint.js +2 -0
- package/dist/esm/node/runtime/renderPage.js +34 -21
- package/dist/esm/shared/page-configs/Config/PageContextConfig.d.ts +1 -1
- package/dist/esm/shared/page-configs/FilePath.d.ts +52 -0
- package/dist/esm/shared/page-configs/FilePath.js +1 -0
- package/dist/esm/shared/page-configs/PageConfig.d.ts +1 -42
- package/dist/esm/utils/assert.js +2 -0
- package/dist/esm/utils/assertSingleInstance.d.ts +2 -2
- package/dist/esm/utils/assertSingleInstance.js +5 -4
- package/dist/esm/utils/assertVersion.js +4 -1
- package/dist/esm/utils/getFilePathAbsolute.d.ts +4 -4
- package/dist/esm/utils/getFilePathAbsolute.js +10 -10
- package/dist/esm/utils/getGlobalObject.d.ts +6 -1
- package/dist/esm/utils/getGlobalObject.js +22 -6
- package/dist/esm/utils/isNpmPackage.d.ts +0 -6
- package/dist/esm/utils/isNpmPackage.js +5 -3
- package/dist/esm/utils/parseUrl.js +8 -1
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -4
- package/package.json +26 -14
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveFilePath.js +0 -33
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveFilePath.d.ts +0 -5
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveFilePath.js +0 -27
|
@@ -3,7 +3,7 @@ export { loadValueFile };
|
|
|
3
3
|
export { loadConfigFile };
|
|
4
4
|
export type { ImportedFilesLoaded };
|
|
5
5
|
export type { ConfigFile };
|
|
6
|
-
import type { FilePathResolved } from '../../../../../../shared/page-configs/
|
|
6
|
+
import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js';
|
|
7
7
|
import type { InterfaceValueFile } from '../getVikeConfig.js';
|
|
8
8
|
type ImportedFilesLoaded = Record<string, Promise<Record<string, unknown>>>;
|
|
9
9
|
type ConfigFile = {
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js
CHANGED
|
@@ -2,13 +2,14 @@
|
|
|
2
2
|
export { loadImportedFile };
|
|
3
3
|
export { loadValueFile };
|
|
4
4
|
export { loadConfigFile };
|
|
5
|
-
import {
|
|
5
|
+
import { assert, assertUsage, assertWarning, hasProp, assertIsNotProductionRuntime, isNpmPackageImport } from '../../../../utils.js';
|
|
6
6
|
import { transpileAndExecuteFile } from './transpileAndExecuteFile.js';
|
|
7
7
|
import { assertPlusFileExport } from '../../../../../../shared/page-configs/assertPlusFileExport.js';
|
|
8
8
|
import pc from '@brillout/picocolors';
|
|
9
9
|
import { parseImportData } from './transformFileImports.js';
|
|
10
10
|
import { getConfigFileExport } from '../getConfigFileExport.js';
|
|
11
11
|
import { assertImportPath, resolveImportPath } from './resolveImportPath.js';
|
|
12
|
+
import { getFilePathResolved } from '../../../../shared/getFilePath.js';
|
|
12
13
|
assertIsNotProductionRuntime();
|
|
13
14
|
// Load fake import
|
|
14
15
|
async function loadImportedFile(import_, userRootDir, importedFilesLoaded) {
|
|
@@ -58,21 +59,12 @@ async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir
|
|
|
58
59
|
const extendsImportData = getExtendsImportData(configFileExports, configFilePath);
|
|
59
60
|
const extendsConfigFiles = [];
|
|
60
61
|
extendsImportData.map((importData) => {
|
|
61
|
-
const { importPath:
|
|
62
|
+
const { importPath: importPathAbsolute } = importData;
|
|
62
63
|
const filePathAbsoluteFilesystem = resolveImportPath(importData, configFilePath);
|
|
63
64
|
assertImportPath(filePathAbsoluteFilesystem, importData, configFilePath);
|
|
64
|
-
warnUserLandExtension(
|
|
65
|
-
|
|
66
|
-
|
|
67
|
-
const filePathRelativeToUserRootDir = determineFilePathRelativeToUserDir(filePathAbsoluteFilesystem, userRootDir);
|
|
68
|
-
const filePathAbsoluteVite = filePathRelativeToUserRootDir ?? importPath;
|
|
69
|
-
extendsConfigFiles.push({
|
|
70
|
-
filePathAbsoluteFilesystem,
|
|
71
|
-
filePathAbsoluteVite,
|
|
72
|
-
filePathRelativeToUserRootDir,
|
|
73
|
-
filePathToShowToUser: filePathAbsoluteVite,
|
|
74
|
-
importPathAbsolute: importPath
|
|
75
|
-
});
|
|
65
|
+
warnUserLandExtension(importPathAbsolute, configFilePath);
|
|
66
|
+
const filePath = getFilePathResolved({ filePathAbsoluteFilesystem, userRootDir, importPathAbsolute });
|
|
67
|
+
extendsConfigFiles.push(filePath);
|
|
76
68
|
});
|
|
77
69
|
const extendsConfigs = [];
|
|
78
70
|
await Promise.all(extendsConfigFiles.map(async (configFilePath) => {
|
|
@@ -83,17 +75,6 @@ async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir
|
|
|
83
75
|
const extendsFilePaths = extendsConfigFiles.map((f) => f.filePathAbsoluteFilesystem);
|
|
84
76
|
return { extendsConfigs, extendsFilePaths };
|
|
85
77
|
}
|
|
86
|
-
function determineFilePathRelativeToUserDir(filePathAbsoluteFilesystem, userRootDir) {
|
|
87
|
-
assertPosixPath(filePathAbsoluteFilesystem);
|
|
88
|
-
assertPosixPath(userRootDir);
|
|
89
|
-
if (!filePathAbsoluteFilesystem.startsWith(userRootDir)) {
|
|
90
|
-
return null;
|
|
91
|
-
}
|
|
92
|
-
let filePathRelativeToUserRootDir = filePathAbsoluteFilesystem.slice(userRootDir.length);
|
|
93
|
-
if (!filePathRelativeToUserRootDir.startsWith('/'))
|
|
94
|
-
filePathRelativeToUserRootDir = '/' + filePathRelativeToUserRootDir;
|
|
95
|
-
return filePathRelativeToUserRootDir;
|
|
96
|
-
}
|
|
97
78
|
function warnUserLandExtension(importPath, configFilePath) {
|
|
98
79
|
assertWarning(isNpmPackageImport(importPath), `${configFilePath.filePathToShowToUser} uses ${pc.cyan('extends')} to inherit from ${pc.cyan(importPath)} which is a user-land file: this is experimental and may be remove at any time. Reach out to a maintainer if you need this.`, { onlyOnce: true });
|
|
99
80
|
}
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.d.ts
CHANGED
|
@@ -2,8 +2,9 @@ export { resolveImport };
|
|
|
2
2
|
export { resolveImportPath };
|
|
3
3
|
export { assertImportPath };
|
|
4
4
|
export { clearFilesEnvMap };
|
|
5
|
-
import type { ConfigEnvInternal, DefinedAtFileFullInfo
|
|
5
|
+
import type { ConfigEnvInternal, DefinedAtFileFullInfo } from '../../../../../../shared/page-configs/PageConfig.js';
|
|
6
6
|
import { type ImportData } from './transformFileImports.js';
|
|
7
|
+
import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js';
|
|
7
8
|
declare function resolveImport(configValue: unknown, importerFilePath: FilePathResolved, userRootDir: string, configEnv: ConfigEnvInternal, configName: string): null | (DefinedAtFileFullInfo & {
|
|
8
9
|
fileExportName: string;
|
|
9
10
|
});
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js
CHANGED
|
@@ -6,6 +6,7 @@ import pc from '@brillout/picocolors';
|
|
|
6
6
|
import { assert, assertPosixPath, assertUsage, deepEqual, requireResolve } from '../../../../utils.js';
|
|
7
7
|
import { parseImportData } from './transformFileImports.js';
|
|
8
8
|
import path from 'path';
|
|
9
|
+
import { getFilePathResolved, getFilePathUnresolved } from '../../../../shared/getFilePath.js';
|
|
9
10
|
const filesEnvMap = new Map();
|
|
10
11
|
function resolveImport(configValue, importerFilePath, userRootDir, configEnv, configName) {
|
|
11
12
|
if (typeof configValue !== 'string')
|
|
@@ -23,14 +24,8 @@ function resolveImport(configValue, importerFilePath, userRootDir, configEnv, co
|
|
|
23
24
|
// [vite] Internal server error: Failed to resolve import "./onPageTransitionHooks" from "virtual:vike:pageConfigValuesAll:client:/pages/index". Does the file exist?
|
|
24
25
|
// ```
|
|
25
26
|
assertImportPath(filePathAbsoluteFilesystem, importData, importerFilePath);
|
|
26
|
-
const
|
|
27
|
-
const filePath = {
|
|
28
|
-
filePathAbsoluteFilesystem,
|
|
29
|
-
filePathRelativeToUserRootDir,
|
|
30
|
-
filePathAbsoluteVite: filePathRelativeToUserRootDir,
|
|
31
|
-
filePathToShowToUser: filePathRelativeToUserRootDir,
|
|
32
|
-
importPathAbsolute: null
|
|
33
|
-
};
|
|
27
|
+
const filePathAbsoluteUserRootDir = resolveImportPath_absoluteUserRootDir(filePathAbsoluteFilesystem, importData, importerFilePath, userRootDir);
|
|
28
|
+
const filePath = getFilePathResolved({ filePathAbsoluteUserRootDir, userRootDir, importPathAbsolute: null });
|
|
34
29
|
return {
|
|
35
30
|
...filePath,
|
|
36
31
|
fileExportName: exportName,
|
|
@@ -41,13 +36,11 @@ function resolveImport(configValue, importerFilePath, userRootDir, configEnv, co
|
|
|
41
36
|
// importPath can be:
|
|
42
37
|
// - an npm package import
|
|
43
38
|
// - a path alias
|
|
44
|
-
const filePath = {
|
|
39
|
+
const filePath = getFilePathUnresolved({
|
|
45
40
|
filePathAbsoluteFilesystem,
|
|
46
|
-
|
|
47
|
-
filePathAbsoluteVite: importPath,
|
|
48
|
-
filePathToShowToUser: importPath,
|
|
41
|
+
filePathAbsoluteUserRootDir: null,
|
|
49
42
|
importPathAbsolute: importPath
|
|
50
|
-
};
|
|
43
|
+
});
|
|
51
44
|
return {
|
|
52
45
|
...filePath,
|
|
53
46
|
fileExportName: exportName,
|
|
@@ -55,11 +48,11 @@ function resolveImport(configValue, importerFilePath, userRootDir, configEnv, co
|
|
|
55
48
|
};
|
|
56
49
|
}
|
|
57
50
|
}
|
|
58
|
-
function
|
|
51
|
+
function resolveImportPath_absoluteUserRootDir(filePathAbsoluteFilesystem, importData, configFilePath, userRootDir) {
|
|
59
52
|
assertPosixPath(userRootDir);
|
|
60
|
-
let
|
|
53
|
+
let filePathAbsoluteUserRootDir;
|
|
61
54
|
if (filePathAbsoluteFilesystem.startsWith(userRootDir)) {
|
|
62
|
-
|
|
55
|
+
filePathAbsoluteUserRootDir = getVitePathFromAbsolutePath(filePathAbsoluteFilesystem, userRootDir);
|
|
63
56
|
}
|
|
64
57
|
else {
|
|
65
58
|
assertUsage(false, `${configFilePath.filePathToShowToUser} imports from a relative path ${pc.cyan(importData.importPath)} outside of ${userRootDir} which is forbidden: import from a relative path inside ${userRootDir}, or import from a dependency's package.json#exports entry instead`);
|
|
@@ -68,14 +61,14 @@ function resolveImportPath_relativeToUserRootDir(filePathAbsoluteFilesystem, imp
|
|
|
68
61
|
// assert(filePathAbsoluteFilesystem.startsWith('/'))
|
|
69
62
|
// filePath = `/@fs${filePathAbsoluteFilesystem}`
|
|
70
63
|
// /*/
|
|
71
|
-
//
|
|
72
|
-
// assert(
|
|
73
|
-
//
|
|
64
|
+
// filePathAbsoluteUserRootDir = path.posix.relative(userRootDir, filePathAbsoluteFilesystem)
|
|
65
|
+
// assert(filePathAbsoluteUserRootDir.startsWith('../'))
|
|
66
|
+
// filePathAbsoluteUserRootDir = '/' + filePathAbsoluteUserRootDir
|
|
74
67
|
// //*/
|
|
75
68
|
}
|
|
76
|
-
assertPosixPath(
|
|
77
|
-
assert(
|
|
78
|
-
return
|
|
69
|
+
assertPosixPath(filePathAbsoluteUserRootDir);
|
|
70
|
+
assert(filePathAbsoluteUserRootDir.startsWith('/'));
|
|
71
|
+
return filePathAbsoluteUserRootDir;
|
|
79
72
|
}
|
|
80
73
|
function resolveImportPath(importData, importerFilePath) {
|
|
81
74
|
const importerFilePathAbsolute = importerFilePath.filePathAbsoluteFilesystem;
|
|
@@ -3,7 +3,7 @@ export { getConfigBuildErrorFormatted };
|
|
|
3
3
|
export { getConfigExecutionErrorIntroMsg };
|
|
4
4
|
export { isTmpFile };
|
|
5
5
|
import 'source-map-support/register.js';
|
|
6
|
-
import type { FilePathResolved } from '../../../../../../shared/page-configs/
|
|
6
|
+
import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js';
|
|
7
7
|
declare function transpileAndExecuteFile(filePath: FilePathResolved, userRootDir: string, isConfigFile: boolean | 'is-extension-config'): Promise<{
|
|
8
8
|
fileExports: Record<string, unknown>;
|
|
9
9
|
}>;
|
|
@@ -14,13 +14,12 @@ import 'source-map-support/register.js';
|
|
|
14
14
|
assertIsNotProductionRuntime();
|
|
15
15
|
const debug = createDebugger('vike:pointer-imports');
|
|
16
16
|
async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile) {
|
|
17
|
-
const { filePathAbsoluteFilesystem } = filePath;
|
|
17
|
+
const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
|
|
18
18
|
const fileExtension = getFileExtension(filePathAbsoluteFilesystem);
|
|
19
|
-
|
|
20
|
-
assertUsage(isJavaScriptFile(filePathAbsoluteFilesystem), `${filePathToShowToUser2} has file extension .${fileExtension} but a config file can only be a JavaScript/TypeScript file`);
|
|
19
|
+
assertUsage(isJavaScriptFile(filePathAbsoluteFilesystem), `${filePathToShowToUserResolved} has file extension .${fileExtension} but a config file can only be a JavaScript/TypeScript file`);
|
|
21
20
|
const isHeader = isHeaderFile(filePathAbsoluteFilesystem);
|
|
22
21
|
if (isHeader) {
|
|
23
|
-
assertWarning(false, `${pc.cyan('.h.js')} files are deprecated: simply renaming ${
|
|
22
|
+
assertWarning(false, `${pc.cyan('.h.js')} files are deprecated: simply renaming ${filePathToShowToUserResolved} to ${removeHeaderFileExtension(filePathToShowToUserResolved)} is usually enough, although you may occasionally need to use ${pc.cyan("with { type: 'pointer' }")} as explained at https://vike.dev/config#pointer-imports`, { onlyOnce: true });
|
|
24
23
|
}
|
|
25
24
|
if (isConfigFile === 'is-extension-config' && !isHeader && fileExtension.endsWith('js')) {
|
|
26
25
|
// This doesn't track dependencies => we should never use this for user land configs
|
|
@@ -35,28 +34,27 @@ async function transpileAndExecuteFile(filePath, userRootDir, isConfigFile) {
|
|
|
35
34
|
}
|
|
36
35
|
}
|
|
37
36
|
async function transpileFile(filePath, transformImports, userRootDir) {
|
|
38
|
-
const
|
|
39
|
-
const { filePathAbsoluteFilesystem } = filePath;
|
|
37
|
+
const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
|
|
40
38
|
assertPosixPath(filePathAbsoluteFilesystem);
|
|
41
39
|
vikeConfigDependencies.add(filePathAbsoluteFilesystem);
|
|
42
40
|
if (debug.isEnabled)
|
|
43
|
-
debug('transpile',
|
|
41
|
+
debug('transpile', filePathToShowToUserResolved);
|
|
44
42
|
let { code, pointerImports } = await transpileWithEsbuild(filePath, userRootDir, transformImports);
|
|
45
43
|
if (debug.isEnabled)
|
|
46
|
-
debug(`code, post esbuild (${
|
|
44
|
+
debug(`code, post esbuild (${filePathToShowToUserResolved})`, code);
|
|
47
45
|
let isImportTransformed = false;
|
|
48
46
|
if (transformImports) {
|
|
49
|
-
const codeMod = transformFileImports(code,
|
|
47
|
+
const codeMod = transformFileImports(code, filePathToShowToUserResolved, pointerImports);
|
|
50
48
|
if (codeMod) {
|
|
51
49
|
code = codeMod;
|
|
52
50
|
isImportTransformed = true;
|
|
53
51
|
if (debug.isEnabled)
|
|
54
|
-
debug(`code, post transformImports() (${
|
|
52
|
+
debug(`code, post transformImports() (${filePathToShowToUserResolved})`, code);
|
|
55
53
|
}
|
|
56
54
|
}
|
|
57
55
|
if (!isImportTransformed) {
|
|
58
56
|
if (debug.isEnabled)
|
|
59
|
-
debug(`code, no transformImports() (${
|
|
57
|
+
debug(`code, no transformImports() (${filePathToShowToUserResolved})`);
|
|
60
58
|
}
|
|
61
59
|
return code;
|
|
62
60
|
}
|
|
@@ -292,19 +290,12 @@ function triggerPrepareStackTrace(err) {
|
|
|
292
290
|
}
|
|
293
291
|
}
|
|
294
292
|
function getErrIntroMsg(operation, filePath) {
|
|
295
|
-
const
|
|
293
|
+
const { filePathToShowToUserResolved } = filePath;
|
|
296
294
|
const msg = [
|
|
297
295
|
// prettier ignore
|
|
298
296
|
pc.red(`Failed to ${operation}`),
|
|
299
|
-
pc.bold(pc.red(
|
|
297
|
+
pc.bold(pc.red(filePathToShowToUserResolved)),
|
|
300
298
|
pc.red(`because:`)
|
|
301
299
|
].join(' ');
|
|
302
300
|
return msg;
|
|
303
301
|
}
|
|
304
|
-
/** `filePath.filePathToShowToUser` may show the import path of a package, use `filePathToShowToUser2` instead always show a file path instead. */
|
|
305
|
-
function getFilePathToShowToUser2(filePath) {
|
|
306
|
-
const { filePathAbsoluteFilesystem, filePathRelativeToUserRootDir } = filePath;
|
|
307
|
-
const filePathToShowToUser2 = filePathRelativeToUserRootDir || filePathAbsoluteFilesystem;
|
|
308
|
-
assert(filePathToShowToUser2);
|
|
309
|
-
return filePathToShowToUser2;
|
|
310
|
-
}
|
|
@@ -5,9 +5,10 @@ export { isVikeConfigFile };
|
|
|
5
5
|
export { isV1Design };
|
|
6
6
|
export type { VikeConfigObject };
|
|
7
7
|
export type { InterfaceValueFile };
|
|
8
|
-
import type { PageConfigGlobalBuildTime, PageConfigBuildTime
|
|
8
|
+
import type { PageConfigGlobalBuildTime, PageConfigBuildTime } from '../../../../../shared/page-configs/PageConfig.js';
|
|
9
9
|
import { type LocationId } from './getVikeConfig/filesystemRouting.js';
|
|
10
10
|
import type { ResolvedConfig } from 'vite';
|
|
11
|
+
import type { FilePathResolved } from '../../../../../shared/page-configs/FilePath.js';
|
|
11
12
|
type InterfaceFileCommons = {
|
|
12
13
|
locationId: LocationId;
|
|
13
14
|
filePath: FilePathResolved;
|
|
@@ -28,6 +29,6 @@ type VikeConfigObject = {
|
|
|
28
29
|
};
|
|
29
30
|
declare const vikeConfigDependencies: Set<string>;
|
|
30
31
|
declare function reloadVikeConfig(userRootDir: string, outDirRoot: string): void;
|
|
31
|
-
declare function getVikeConfig(config: ResolvedConfig, isDev: boolean, tolerateInvalidConfig?:
|
|
32
|
+
declare function getVikeConfig(config: ResolvedConfig, isDev: boolean, tolerateInvalidConfig?: true): Promise<VikeConfigObject>;
|
|
32
33
|
declare function isV1Design(config: ResolvedConfig, isDev: boolean): Promise<boolean>;
|
|
33
34
|
declare function isVikeConfigFile(filePath: string): boolean;
|
|
@@ -19,7 +19,7 @@ import { crawlPlusFiles } from './getVikeConfig/crawlPlusFiles.js';
|
|
|
19
19
|
import { getConfigFileExport } from './getConfigFileExport.js';
|
|
20
20
|
import { loadConfigFile, loadImportedFile, loadValueFile } from './getVikeConfig/loadFileAtConfigTime.js';
|
|
21
21
|
import { clearFilesEnvMap, resolveImport } from './getVikeConfig/resolveImportPath.js';
|
|
22
|
-
import {
|
|
22
|
+
import { getFilePathResolved } from '../../../shared/getFilePath.js';
|
|
23
23
|
assertIsNotProductionRuntime();
|
|
24
24
|
let devServerIsCorrupt = false;
|
|
25
25
|
let wasConfigInvalid = null;
|
|
@@ -62,7 +62,7 @@ async function handleReloadSideEffects() {
|
|
|
62
62
|
}
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
|
-
async function getVikeConfig(config, isDev, tolerateInvalidConfig
|
|
65
|
+
async function getVikeConfig(config, isDev, tolerateInvalidConfig) {
|
|
66
66
|
const { outDirRoot } = getOutDirs(config);
|
|
67
67
|
const userRootDir = config.root;
|
|
68
68
|
if (!vikeConfigPromise) {
|
|
@@ -92,11 +92,11 @@ async function loadInterfaceFiles(userRootDir, outDirRoot, isDev) {
|
|
|
92
92
|
await Promise.all([
|
|
93
93
|
// Config files
|
|
94
94
|
...configFiles.map(async (filePath) => {
|
|
95
|
-
const {
|
|
96
|
-
assert(
|
|
95
|
+
const { filePathAbsoluteUserRootDir } = filePath;
|
|
96
|
+
assert(filePathAbsoluteUserRootDir);
|
|
97
97
|
const { configFile, extendsConfigs } = await loadConfigFile(filePath, userRootDir, [], false);
|
|
98
|
-
assert(filePath.
|
|
99
|
-
const locationId = getLocationId(
|
|
98
|
+
assert(filePath.filePathAbsoluteUserRootDir);
|
|
99
|
+
const locationId = getLocationId(filePathAbsoluteUserRootDir);
|
|
100
100
|
const interfaceFile = getInterfaceFileFromConfigFile(configFile, false, locationId);
|
|
101
101
|
interfaceFilesByLocationId[locationId] = interfaceFilesByLocationId[locationId] ?? [];
|
|
102
102
|
interfaceFilesByLocationId[locationId].push(interfaceFile);
|
|
@@ -145,11 +145,11 @@ async function loadInterfaceFiles(userRootDir, outDirRoot, isDev) {
|
|
|
145
145
|
}),
|
|
146
146
|
// Value files
|
|
147
147
|
...valueFiles.map(async (filePath) => {
|
|
148
|
-
const {
|
|
149
|
-
assert(
|
|
150
|
-
const configName = getConfigName(
|
|
148
|
+
const { filePathAbsoluteUserRootDir } = filePath;
|
|
149
|
+
assert(filePathAbsoluteUserRootDir);
|
|
150
|
+
const configName = getConfigName(filePathAbsoluteUserRootDir);
|
|
151
151
|
assert(configName);
|
|
152
|
-
const locationId = getLocationId(
|
|
152
|
+
const locationId = getLocationId(filePathAbsoluteUserRootDir);
|
|
153
153
|
const interfaceFile = {
|
|
154
154
|
locationId,
|
|
155
155
|
filePath,
|
|
@@ -348,9 +348,9 @@ async function getGlobalConfigs(interfaceFilesByLocationId, userRootDir, importe
|
|
|
348
348
|
const interfaceFilesGlobalPaths = [];
|
|
349
349
|
objectEntries(interfaceFilesGlobal).forEach(([locationId, interfaceFiles]) => {
|
|
350
350
|
assert(isGlobalLocation(locationId, locationIds));
|
|
351
|
-
interfaceFiles.forEach(({ filePath: {
|
|
352
|
-
if (
|
|
353
|
-
interfaceFilesGlobalPaths.push(
|
|
351
|
+
interfaceFiles.forEach(({ filePath: { filePathAbsoluteUserRootDir } }) => {
|
|
352
|
+
if (filePathAbsoluteUserRootDir) {
|
|
353
|
+
interfaceFilesGlobalPaths.push(filePathAbsoluteUserRootDir);
|
|
354
354
|
}
|
|
355
355
|
});
|
|
356
356
|
});
|
|
@@ -459,10 +459,10 @@ async function resolveConfigValueSources(configName, configDef, interfaceFilesRe
|
|
|
459
459
|
}
|
|
460
460
|
function makeOrderDeterministic(interfaceFile1, interfaceFile2) {
|
|
461
461
|
return lowerFirst((interfaceFile) => {
|
|
462
|
-
const {
|
|
462
|
+
const { filePathAbsoluteUserRootDir } = interfaceFile.filePath;
|
|
463
463
|
assert(isInterfaceFileUserLand(interfaceFile));
|
|
464
|
-
assert(
|
|
465
|
-
return
|
|
464
|
+
assert(filePathAbsoluteUserRootDir);
|
|
465
|
+
return filePathAbsoluteUserRootDir.length;
|
|
466
466
|
})(interfaceFile1, interfaceFile2);
|
|
467
467
|
}
|
|
468
468
|
function warnOverridenConfigValues(interfaceFileWinner, interfaceFilesOverriden, configName) {
|
|
@@ -536,6 +536,7 @@ async function getConfigValueSource(configName, interfaceFile, configDef, userRo
|
|
|
536
536
|
configName !== 'extends') {
|
|
537
537
|
if (import_.filePathAbsoluteFilesystem) {
|
|
538
538
|
assert(hasProp(import_, 'filePathAbsoluteFilesystem', 'string')); // Help TS
|
|
539
|
+
assert(hasProp(import_, 'filePathToShowToUserResolved', 'string')); // Help TS
|
|
539
540
|
const fileExport = await loadImportedFile(import_, userRootDir, importedFilesLoaded);
|
|
540
541
|
configValueSource.value = fileExport;
|
|
541
542
|
}
|
|
@@ -739,7 +740,7 @@ function getComputed(configValueSources, configDefinitions) {
|
|
|
739
740
|
}
|
|
740
741
|
async function findPlusFiles(userRootDir, outDirRoot, isDev) {
|
|
741
742
|
const files = await crawlPlusFiles(userRootDir, outDirRoot, isDev);
|
|
742
|
-
const plusFiles = files.map(({
|
|
743
|
+
const plusFiles = files.map(({ filePathAbsoluteUserRootDir }) => getFilePathResolved({ filePathAbsoluteUserRootDir, userRootDir, importPathAbsolute: null }));
|
|
743
744
|
return plusFiles;
|
|
744
745
|
}
|
|
745
746
|
function getConfigName(filePath) {
|
|
@@ -829,9 +830,9 @@ function getFilesystemRoutingRootEffect(configFilesystemRoutingRoot, configName)
|
|
|
829
830
|
const configDefinedAt = getConfigDefinedAtString('Config', configName, configFilesystemRoutingRoot);
|
|
830
831
|
assertUsage(typeof value === 'string', `${configDefinedAt} should be a string`);
|
|
831
832
|
assertUsage(value.startsWith('/'), `${configDefinedAt} is ${pc.cyan(value)} but it should start with a leading slash ${pc.cyan('/')}`);
|
|
832
|
-
const {
|
|
833
|
-
assert(
|
|
834
|
-
const before = getFilesystemRouteString(getLocationId(
|
|
833
|
+
const { filePathAbsoluteUserRootDir } = configFilesystemRoutingRoot.definedAt;
|
|
834
|
+
assert(filePathAbsoluteUserRootDir);
|
|
835
|
+
const before = getFilesystemRouteString(getLocationId(filePathAbsoluteUserRootDir));
|
|
835
836
|
const after = value;
|
|
836
837
|
const filesystemRoutingRootEffect = { before, after };
|
|
837
838
|
return { filesystemRoutingRootEffect, filesystemRoutingRootDefinedAt: configDefinedAt };
|
|
@@ -0,0 +1,20 @@
|
|
|
1
|
+
export { getFilePathResolved };
|
|
2
|
+
export { getFilePathUnresolved };
|
|
3
|
+
import type { FilePath, FilePathResolved } from '../../../shared/page-configs/FilePath.js';
|
|
4
|
+
declare function getFilePathUnresolved(args: {
|
|
5
|
+
filePathAbsoluteFilesystem: string | null;
|
|
6
|
+
filePathAbsoluteUserRootDir: string | null;
|
|
7
|
+
importPathAbsolute: string | null;
|
|
8
|
+
} & ({
|
|
9
|
+
filePathAbsoluteUserRootDir: string;
|
|
10
|
+
} | {
|
|
11
|
+
importPathAbsolute: string;
|
|
12
|
+
})): FilePath;
|
|
13
|
+
declare function getFilePathResolved(args: {
|
|
14
|
+
userRootDir: string;
|
|
15
|
+
importPathAbsolute: string | null;
|
|
16
|
+
} & ({
|
|
17
|
+
filePathAbsoluteFilesystem: string;
|
|
18
|
+
} | {
|
|
19
|
+
filePathAbsoluteUserRootDir: string;
|
|
20
|
+
})): FilePathResolved;
|
|
@@ -0,0 +1,82 @@
|
|
|
1
|
+
export { getFilePathResolved };
|
|
2
|
+
export { getFilePathUnresolved };
|
|
3
|
+
import path from 'path';
|
|
4
|
+
import { assert, assertPosixPath, hasProp } from '../utils.js';
|
|
5
|
+
function getFilePathUnresolved(args) {
|
|
6
|
+
const { filePathAbsoluteFilesystem, filePathAbsoluteUserRootDir } = args;
|
|
7
|
+
let filePathAbsoluteVite;
|
|
8
|
+
if (args.filePathAbsoluteUserRootDir !== null) {
|
|
9
|
+
filePathAbsoluteVite = args.filePathAbsoluteUserRootDir;
|
|
10
|
+
}
|
|
11
|
+
else {
|
|
12
|
+
assert(args.importPathAbsolute !== null); // Help TS
|
|
13
|
+
filePathAbsoluteVite = args.importPathAbsolute;
|
|
14
|
+
}
|
|
15
|
+
return {
|
|
16
|
+
...args,
|
|
17
|
+
filePathAbsoluteVite,
|
|
18
|
+
filePathToShowToUser: filePathAbsoluteVite,
|
|
19
|
+
filePathToShowToUserResolved: filePathAbsoluteUserRootDir || filePathAbsoluteFilesystem
|
|
20
|
+
};
|
|
21
|
+
}
|
|
22
|
+
function getFilePathResolved(args) {
|
|
23
|
+
const { userRootDir, importPathAbsolute } = args;
|
|
24
|
+
let filePathAbsoluteFilesystem;
|
|
25
|
+
let filePathAbsoluteUserRootDir;
|
|
26
|
+
if ('filePathAbsoluteFilesystem' in args) {
|
|
27
|
+
filePathAbsoluteFilesystem = args.filePathAbsoluteFilesystem;
|
|
28
|
+
filePathAbsoluteUserRootDir = getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir });
|
|
29
|
+
}
|
|
30
|
+
else {
|
|
31
|
+
filePathAbsoluteUserRootDir = args.filePathAbsoluteUserRootDir;
|
|
32
|
+
filePathAbsoluteFilesystem = getFilePathAbsoluteUserFilesystem({ filePathAbsoluteUserRootDir, userRootDir });
|
|
33
|
+
}
|
|
34
|
+
let filePathResolved;
|
|
35
|
+
const common = {
|
|
36
|
+
filePathAbsoluteUserRootDir,
|
|
37
|
+
filePathAbsoluteFilesystem,
|
|
38
|
+
importPathAbsolute,
|
|
39
|
+
userRootDir
|
|
40
|
+
};
|
|
41
|
+
if (importPathAbsolute) {
|
|
42
|
+
filePathResolved = getFilePathUnresolved({
|
|
43
|
+
...common,
|
|
44
|
+
importPathAbsolute
|
|
45
|
+
});
|
|
46
|
+
}
|
|
47
|
+
else {
|
|
48
|
+
assert(filePathAbsoluteUserRootDir);
|
|
49
|
+
filePathResolved = getFilePathUnresolved({
|
|
50
|
+
...common,
|
|
51
|
+
filePathAbsoluteUserRootDir
|
|
52
|
+
});
|
|
53
|
+
}
|
|
54
|
+
assert(filePathAbsoluteFilesystem);
|
|
55
|
+
assert(hasProp(filePathResolved, 'filePathAbsoluteFilesystem', 'string'));
|
|
56
|
+
assert(hasProp(filePathResolved, 'filePathToShowToUserResolved', 'string'));
|
|
57
|
+
return filePathResolved;
|
|
58
|
+
}
|
|
59
|
+
function getFilePathAbsoluteUserFilesystem({ filePathAbsoluteUserRootDir, userRootDir }) {
|
|
60
|
+
assertPosixPath(filePathAbsoluteUserRootDir);
|
|
61
|
+
assertPosixPath(userRootDir);
|
|
62
|
+
const filePathAbsoluteFilesystem = path.posix.join(userRootDir, filePathAbsoluteUserRootDir);
|
|
63
|
+
return filePathAbsoluteFilesystem;
|
|
64
|
+
}
|
|
65
|
+
function getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir }) {
|
|
66
|
+
assertPosixPath(filePathAbsoluteFilesystem);
|
|
67
|
+
assertPosixPath(userRootDir);
|
|
68
|
+
const filePathRelative = path.posix.relative(userRootDir, filePathAbsoluteFilesystem);
|
|
69
|
+
if (!filePathAbsoluteFilesystem.startsWith(userRootDir)) {
|
|
70
|
+
assert(filePathRelative.startsWith('../'));
|
|
71
|
+
return null;
|
|
72
|
+
}
|
|
73
|
+
assert(!filePathRelative.startsWith('.') && !filePathRelative.startsWith('/'));
|
|
74
|
+
const filePathAbsoluteUserRootDir = `/${filePathRelative}`;
|
|
75
|
+
{
|
|
76
|
+
let check = filePathAbsoluteFilesystem.slice(userRootDir.length);
|
|
77
|
+
if (!check.startsWith('/'))
|
|
78
|
+
check = '/' + check;
|
|
79
|
+
assert(filePathAbsoluteUserRootDir === check);
|
|
80
|
+
}
|
|
81
|
+
return filePathAbsoluteUserRootDir;
|
|
82
|
+
}
|
|
@@ -7,7 +7,7 @@ export { isEquivalentErrorWithCodeSnippet };
|
|
|
7
7
|
export { getPrettyErrMessage };
|
|
8
8
|
// Copied & adapted from https://github.com/vitejs/vite/blob/9c114c5c72a6af87e3330d5573362554b4511265/packages/vite/src/node/server/middlewares/error.ts
|
|
9
9
|
import pc from '@brillout/picocolors';
|
|
10
|
-
import { assert, escapeRegex,
|
|
10
|
+
import { assert, escapeRegex, getFilePathAbsoluteUserRootDir, isObject, removeEmptyLines, stripAnsi, toPosixPath } from '../../utils.js';
|
|
11
11
|
function isErrorWithCodeSnippet(err) {
|
|
12
12
|
if (!isObject(err)) {
|
|
13
13
|
return false;
|
|
@@ -46,7 +46,7 @@ function getPrettyErrorWithCodeSnippet(err, userRootDir) {
|
|
|
46
46
|
let { id, frame } = err;
|
|
47
47
|
const msgFirstLine = [
|
|
48
48
|
pc.red('Failed to transpile'),
|
|
49
|
-
pc.bold(pc.red(
|
|
49
|
+
pc.bold(pc.red(getFilePathAbsoluteUserRootDir(normalizeId(id), userRootDir))),
|
|
50
50
|
pc.red('because:')
|
|
51
51
|
].join(' ');
|
|
52
52
|
const errMsg = getPrettyErrMessage(err);
|
|
@@ -138,6 +138,7 @@ async function mergeScriptEntries(pageAssets, isProduction) {
|
|
|
138
138
|
function getPageContextJsonScriptTag(pageContext) {
|
|
139
139
|
const pageContextSerialized = sanitizeJson(serializePageContextClientSide(pageContext));
|
|
140
140
|
const htmlTag = `<script id="vike_pageContext" type="application/json">${pageContextSerialized}</script>`;
|
|
141
|
+
// Used by contra.com https://github.com/gajus
|
|
141
142
|
// @ts-expect-error
|
|
142
143
|
pageContext._pageContextHtmlTag = htmlTag;
|
|
143
144
|
return htmlTag;
|
|
@@ -94,7 +94,7 @@ function injectBreakLines(htmlFragment, before, after) {
|
|
|
94
94
|
const whitespaceExtra = paddingParent ? ' ' : '';
|
|
95
95
|
const whitespace = `${paddingParent}${whitespaceExtra}`;
|
|
96
96
|
const padding = `\n${whitespace}`;
|
|
97
|
-
htmlFragment = htmlFragment.
|
|
97
|
+
htmlFragment = htmlFragment.replace(/<[^\/]/g, (match) => `${padding}${match}`);
|
|
98
98
|
if (isBlankLine) {
|
|
99
99
|
assert(htmlFragment.startsWith(padding), { htmlFragment });
|
|
100
100
|
htmlFragment = whitespaceExtra + htmlFragment.slice(padding.length);
|
|
@@ -48,35 +48,37 @@ function getManifestEntry(id, assetsManifest) {
|
|
|
48
48
|
const [manifestKey, manifestEntry] = found;
|
|
49
49
|
return { manifestEntry, manifestKey };
|
|
50
50
|
}
|
|
51
|
+
/* Can we remove this?
|
|
51
52
|
// extensions[number].pageConfigsSrcDir
|
|
52
53
|
if (id.startsWith('/node_modules/') || id.startsWith('/../')) {
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
}
|
|
63
|
-
}
|
|
64
|
-
{
|
|
65
|
-
assert(manifestKeyEnd.startsWith('/'), debugInfo);
|
|
66
|
-
const dirS = manifestKeyEnd.split('/');
|
|
67
|
-
assert(dirS[0] === '', debugInfo);
|
|
68
|
-
manifestKeyEnd = '/' + dirS.slice(2).join('/');
|
|
69
|
-
assert(manifestKeyEnd.startsWith('/'), debugInfo);
|
|
54
|
+
let manifestKeyEnd = id.split('/node_modules/').slice(-1)[0]
|
|
55
|
+
assert(manifestKeyEnd, debugInfo)
|
|
56
|
+
assert(!manifestKeyEnd.startsWith('/'), debugInfo)
|
|
57
|
+
manifestKeyEnd = '/' + manifestKeyEnd
|
|
58
|
+
{
|
|
59
|
+
const { manifestEntry, manifestKey } = findEntryWithKeyEnd(manifestKeyEnd, assetsManifest, id)
|
|
60
|
+
if (manifestEntry) {
|
|
61
|
+
assert(manifestKey, debugInfo)
|
|
62
|
+
return { manifestEntry, manifestKey }
|
|
70
63
|
}
|
|
71
|
-
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
75
|
-
|
|
76
|
-
|
|
64
|
+
}
|
|
65
|
+
{
|
|
66
|
+
assert(manifestKeyEnd.startsWith('/'), debugInfo)
|
|
67
|
+
const dirS = manifestKeyEnd.split('/')
|
|
68
|
+
assert(dirS[0] === '', debugInfo)
|
|
69
|
+
manifestKeyEnd = '/' + dirS.slice(2).join('/')
|
|
70
|
+
assert(manifestKeyEnd.startsWith('/'), debugInfo)
|
|
71
|
+
}
|
|
72
|
+
{
|
|
73
|
+
const { manifestEntry, manifestKey } = findEntryWithKeyEnd(manifestKeyEnd, assetsManifest, id)
|
|
74
|
+
if (manifestEntry) {
|
|
75
|
+
assert(manifestKey, debugInfo)
|
|
76
|
+
return { manifestEntry, manifestKey }
|
|
77
77
|
}
|
|
78
|
-
|
|
78
|
+
}
|
|
79
|
+
assert(false, debugInfo)
|
|
79
80
|
}
|
|
81
|
+
*/
|
|
80
82
|
assert(false, debugInfo);
|
|
81
83
|
}
|
|
82
84
|
function findEntryWithKeyEnd(manifestKeyEnd, assetsManifest, id) {
|
|
@@ -4,6 +4,7 @@ export { isCjsEsmError };
|
|
|
4
4
|
export { isKnownError };
|
|
5
5
|
export { getHint };
|
|
6
6
|
import { assert, formatHintLog, isNotNullish, isObject, unique } from '../utils.js';
|
|
7
|
+
import pc from '@brillout/picocolors';
|
|
7
8
|
const knownErrors = [
|
|
8
9
|
{
|
|
9
10
|
errMsg: 'jsxDEV is not a function',
|
|
@@ -44,6 +45,7 @@ function getHint(error) {
|
|
|
44
45
|
}
|
|
45
46
|
function logHint(hint) {
|
|
46
47
|
hint = formatHintLog(hint);
|
|
48
|
+
hint = pc.bold(hint);
|
|
47
49
|
console.error(hint);
|
|
48
50
|
}
|
|
49
51
|
function isKnownError(error) {
|