vike 0.4.166 → 0.4.167
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 +11 -6
- package/dist/cjs/node/plugin/plugins/commonConfig/assertResolveAlias.js +2 -1
- package/dist/cjs/node/plugin/plugins/devConfig/determineOptimizeDeps.js +17 -22
- package/dist/cjs/node/plugin/plugins/envVars.js +3 -2
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +11 -13
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +2 -4
- package/dist/cjs/node/plugin/plugins/fileEnv.js +6 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +6 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.js +3 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +5 -1
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +21 -17
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +12 -11
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -2
- package/dist/cjs/node/plugin/shared/getFilePath.js +83 -29
- package/dist/cjs/node/plugin/shared/isErrorDebug.js +1 -1
- package/dist/cjs/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +3 -8
- package/dist/cjs/node/plugin/shared/loggerNotProd.js +2 -1
- package/dist/cjs/node/plugin/utils.js +1 -1
- package/dist/cjs/node/prerender/runPrerender.js +6 -7
- package/dist/cjs/node/prerender/utils.js +2 -1
- package/dist/cjs/node/runtime/html/stream.js +5 -5
- package/dist/cjs/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +3 -3
- package/dist/cjs/node/runtime/renderPage/executeOnRenderHtmlHook.js +2 -1
- package/dist/cjs/node/runtime/renderPage/getPageAssets/getManifestEntry.js +5 -9
- package/dist/cjs/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +9 -8
- package/dist/cjs/node/runtime/renderPage/getPageAssets.js +6 -12
- package/dist/cjs/node/runtime/utils.js +0 -1
- package/dist/cjs/shared/page-configs/assertPlusFileExport.js +1 -3
- package/dist/cjs/shared/route/abort.js +2 -1
- package/dist/cjs/shared/route/executeGuardHook.js +2 -1
- package/dist/cjs/shared/route/executeOnBeforeRouteHook.js +2 -1
- package/dist/cjs/shared/route/index.js +2 -3
- package/dist/cjs/shared/route/utils.js +0 -1
- package/dist/cjs/utils/assertIsNotProductionRuntime.js +5 -5
- package/dist/cjs/utils/assertPathIsFilesystemAbsolute.js +1 -0
- package/dist/cjs/utils/debug.js +48 -14
- package/dist/cjs/utils/isNpmPackage.js +11 -2
- package/dist/cjs/utils/projectInfo.js +1 -1
- package/dist/cjs/utils/trackLogs.js +1 -1
- package/dist/esm/client/client-routing-runtime/renderPageClientSide.js +31 -24
- package/dist/esm/node/plugin/plugins/buildConfig.js +12 -7
- package/dist/esm/node/plugin/plugins/commonConfig/assertResolveAlias.js +2 -1
- package/dist/esm/node/plugin/plugins/devConfig/determineOptimizeDeps.js +18 -23
- package/dist/esm/node/plugin/plugins/envVars.js +4 -3
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +12 -14
- package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +3 -5
- package/dist/esm/node/plugin/plugins/fileEnv.js +7 -4
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +7 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/debug.d.ts +1 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getConfigFileExport.js +4 -4
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +5 -1
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +21 -17
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +12 -11
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +6 -2
- package/dist/esm/node/plugin/shared/getFilePath.d.ts +10 -9
- package/dist/esm/node/plugin/shared/getFilePath.js +83 -29
- package/dist/esm/node/plugin/shared/isErrorDebug.js +2 -2
- package/dist/esm/node/plugin/shared/loggerNotProd/errorWithCodeSnippet.js +4 -9
- package/dist/esm/node/plugin/shared/loggerNotProd.js +2 -1
- package/dist/esm/node/plugin/utils.d.ts +1 -1
- package/dist/esm/node/plugin/utils.js +1 -1
- package/dist/esm/node/prerender/runPrerender.js +2 -3
- package/dist/esm/node/prerender/utils.d.ts +2 -1
- package/dist/esm/node/prerender/utils.js +2 -1
- package/dist/esm/node/runtime/html/stream.js +5 -5
- package/dist/esm/node/runtime/renderPage/executeOnBeforeRenderAndDataHooks.js +1 -1
- package/dist/esm/node/runtime/renderPage/executeOnRenderHtmlHook.js +2 -1
- package/dist/esm/node/runtime/renderPage/getPageAssets/getManifestEntry.js +6 -10
- package/dist/esm/node/runtime/renderPage/getPageAssets/retrieveAssetsProd.js +9 -8
- package/dist/esm/node/runtime/renderPage/getPageAssets.js +7 -13
- package/dist/esm/node/runtime/utils.d.ts +0 -1
- package/dist/esm/node/runtime/utils.js +0 -1
- package/dist/esm/shared/page-configs/FilePath.d.ts +41 -29
- package/dist/esm/shared/page-configs/assertPlusFileExport.js +1 -3
- package/dist/esm/shared/route/abort.js +2 -1
- package/dist/esm/shared/route/executeGuardHook.js +2 -1
- package/dist/esm/shared/route/executeOnBeforeRouteHook.js +2 -1
- package/dist/esm/shared/route/index.js +2 -3
- package/dist/esm/shared/route/utils.d.ts +0 -1
- package/dist/esm/shared/route/utils.js +0 -1
- package/dist/esm/utils/assertIsNotProductionRuntime.js +5 -5
- package/dist/esm/utils/assertPathIsFilesystemAbsolute.js +1 -0
- package/dist/esm/utils/debug.d.ts +5 -4
- package/dist/esm/utils/debug.js +45 -14
- package/dist/esm/utils/debugGlob.d.ts +1 -1
- package/dist/esm/utils/isNpmPackage.d.ts +5 -1
- package/dist/esm/utils/isNpmPackage.js +10 -1
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/dist/esm/utils/trackLogs.js +2 -2
- package/package.json +1 -1
- package/dist/cjs/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +0 -19
- package/dist/cjs/utils/getFilePathAbsolute.js +0 -70
- package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.d.ts +0 -2
- package/dist/esm/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +0 -16
- package/dist/esm/utils/getFilePathAbsolute.d.ts +0 -5
- package/dist/esm/utils/getFilePathAbsolute.js +0 -64
|
@@ -1,20 +1,21 @@
|
|
|
1
1
|
export { getFilePathResolved };
|
|
2
2
|
export { getFilePathUnresolved };
|
|
3
|
+
export { getModuleFilePath };
|
|
4
|
+
export { getFilePathToShowToUserFromUnkown };
|
|
5
|
+
export { cleanFilePathUnkown };
|
|
3
6
|
import type { FilePath, FilePathResolved } from '../../../shared/page-configs/FilePath.js';
|
|
4
|
-
|
|
5
|
-
|
|
6
|
-
filePathAbsoluteUserRootDir: string | null;
|
|
7
|
-
importPathAbsolute: string | null;
|
|
8
|
-
} & ({
|
|
9
|
-
filePathAbsoluteUserRootDir: string;
|
|
10
|
-
} | {
|
|
7
|
+
import type { ResolvedConfig } from 'vite';
|
|
8
|
+
declare function getFilePathUnresolved({ importPathAbsolute }: {
|
|
11
9
|
importPathAbsolute: string;
|
|
12
|
-
})
|
|
10
|
+
}): FilePath;
|
|
13
11
|
declare function getFilePathResolved(args: {
|
|
14
12
|
userRootDir: string;
|
|
15
|
-
importPathAbsolute
|
|
13
|
+
importPathAbsolute?: string;
|
|
16
14
|
} & ({
|
|
17
15
|
filePathAbsoluteFilesystem: string;
|
|
18
16
|
} | {
|
|
19
17
|
filePathAbsoluteUserRootDir: string;
|
|
20
18
|
})): FilePathResolved;
|
|
19
|
+
declare function getModuleFilePath(moduleId: string, config: ResolvedConfig): string;
|
|
20
|
+
declare function getFilePathToShowToUserFromUnkown(filePathUnkown: string, userRootDir: string): string;
|
|
21
|
+
declare function cleanFilePathUnkown(filePathUnknown: string): string;
|
|
@@ -1,26 +1,16 @@
|
|
|
1
1
|
export { getFilePathResolved };
|
|
2
2
|
export { getFilePathUnresolved };
|
|
3
|
+
export { getModuleFilePath };
|
|
4
|
+
export { getFilePathToShowToUserFromUnkown };
|
|
5
|
+
export { cleanFilePathUnkown };
|
|
3
6
|
import path from 'path';
|
|
4
|
-
import { assert, assertPosixPath,
|
|
5
|
-
function getFilePathUnresolved(
|
|
6
|
-
|
|
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
|
-
};
|
|
7
|
+
import { assert, assertPathIsFilesystemAbsolute, assertPosixPath, toPosixPath } from '../utils.js';
|
|
8
|
+
function getFilePathUnresolved({ importPathAbsolute }) {
|
|
9
|
+
return getFilePath({ importPathAbsolute, filePathAbsoluteUserRootDir: null });
|
|
21
10
|
}
|
|
22
11
|
function getFilePathResolved(args) {
|
|
23
|
-
const { userRootDir
|
|
12
|
+
const { userRootDir } = args;
|
|
13
|
+
const importPathAbsolute = args.importPathAbsolute ?? null;
|
|
24
14
|
let filePathAbsoluteFilesystem;
|
|
25
15
|
let filePathAbsoluteUserRootDir;
|
|
26
16
|
if ('filePathAbsoluteFilesystem' in args) {
|
|
@@ -31,40 +21,67 @@ function getFilePathResolved(args) {
|
|
|
31
21
|
filePathAbsoluteUserRootDir = args.filePathAbsoluteUserRootDir;
|
|
32
22
|
filePathAbsoluteFilesystem = getFilePathAbsoluteUserFilesystem({ filePathAbsoluteUserRootDir, userRootDir });
|
|
33
23
|
}
|
|
34
|
-
let
|
|
24
|
+
let filePath;
|
|
35
25
|
const common = {
|
|
36
26
|
filePathAbsoluteUserRootDir,
|
|
37
|
-
filePathAbsoluteFilesystem,
|
|
38
27
|
importPathAbsolute,
|
|
39
28
|
userRootDir
|
|
40
29
|
};
|
|
41
30
|
if (importPathAbsolute) {
|
|
42
|
-
|
|
31
|
+
filePath = getFilePath({
|
|
43
32
|
...common,
|
|
44
33
|
importPathAbsolute
|
|
45
34
|
});
|
|
46
35
|
}
|
|
47
36
|
else {
|
|
48
37
|
assert(filePathAbsoluteUserRootDir);
|
|
49
|
-
|
|
38
|
+
filePath = getFilePath({
|
|
50
39
|
...common,
|
|
51
40
|
filePathAbsoluteUserRootDir
|
|
52
41
|
});
|
|
53
42
|
}
|
|
54
43
|
assert(filePathAbsoluteFilesystem);
|
|
55
|
-
|
|
56
|
-
|
|
44
|
+
assertPathIsFilesystemAbsolute(filePathAbsoluteFilesystem);
|
|
45
|
+
const filePathToShowToUserResolved = filePathAbsoluteUserRootDir || filePathAbsoluteFilesystem;
|
|
46
|
+
assert(filePathToShowToUserResolved);
|
|
47
|
+
const filePathResolved = {
|
|
48
|
+
...filePath,
|
|
49
|
+
filePathAbsoluteFilesystem,
|
|
50
|
+
filePathToShowToUserResolved
|
|
51
|
+
};
|
|
57
52
|
return filePathResolved;
|
|
58
53
|
}
|
|
54
|
+
function getFilePath(args) {
|
|
55
|
+
let filePathAbsoluteVite;
|
|
56
|
+
if (args.filePathAbsoluteUserRootDir !== null) {
|
|
57
|
+
filePathAbsoluteVite = args.filePathAbsoluteUserRootDir;
|
|
58
|
+
}
|
|
59
|
+
else {
|
|
60
|
+
assert(args.importPathAbsolute !== null); // Help TS
|
|
61
|
+
filePathAbsoluteVite = args.importPathAbsolute;
|
|
62
|
+
}
|
|
63
|
+
const filePathToShowToUser = filePathAbsoluteVite;
|
|
64
|
+
assert(filePathToShowToUser);
|
|
65
|
+
return {
|
|
66
|
+
...args,
|
|
67
|
+
filePathAbsoluteFilesystem: null,
|
|
68
|
+
filePathAbsoluteVite,
|
|
69
|
+
filePathToShowToUser
|
|
70
|
+
};
|
|
71
|
+
}
|
|
59
72
|
function getFilePathAbsoluteUserFilesystem({ filePathAbsoluteUserRootDir, userRootDir }) {
|
|
60
73
|
assertPosixPath(filePathAbsoluteUserRootDir);
|
|
61
74
|
assertPosixPath(userRootDir);
|
|
75
|
+
assertPathIsFilesystemAbsolute(userRootDir);
|
|
62
76
|
const filePathAbsoluteFilesystem = path.posix.join(userRootDir, filePathAbsoluteUserRootDir);
|
|
77
|
+
assertPathIsFilesystemAbsolute(userRootDir);
|
|
63
78
|
return filePathAbsoluteFilesystem;
|
|
64
79
|
}
|
|
65
80
|
function getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir }) {
|
|
66
81
|
assertPosixPath(filePathAbsoluteFilesystem);
|
|
67
82
|
assertPosixPath(userRootDir);
|
|
83
|
+
assertPathIsFilesystemAbsolute(filePathAbsoluteFilesystem);
|
|
84
|
+
assertPathIsFilesystemAbsolute(userRootDir);
|
|
68
85
|
const filePathRelative = path.posix.relative(userRootDir, filePathAbsoluteFilesystem);
|
|
69
86
|
if (!filePathAbsoluteFilesystem.startsWith(userRootDir)) {
|
|
70
87
|
assert(filePathRelative.startsWith('../'));
|
|
@@ -72,11 +89,48 @@ function getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDi
|
|
|
72
89
|
}
|
|
73
90
|
assert(!filePathRelative.startsWith('.') && !filePathRelative.startsWith('/'));
|
|
74
91
|
const filePathAbsoluteUserRootDir = `/${filePathRelative}`;
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
78
|
-
|
|
79
|
-
|
|
92
|
+
assert(filePathAbsoluteUserRootDir === getFilePathAbsoluteUserRootDir2(filePathAbsoluteFilesystem, userRootDir));
|
|
93
|
+
return filePathAbsoluteUserRootDir;
|
|
94
|
+
}
|
|
95
|
+
function getModuleFilePath(moduleId, config) {
|
|
96
|
+
const userRootDir = config.root;
|
|
97
|
+
assertPosixPath(moduleId);
|
|
98
|
+
assertPosixPath(userRootDir);
|
|
99
|
+
const filePathAbsoluteFilesystem = cleanModuleId(moduleId);
|
|
100
|
+
assertPathIsFilesystemAbsolute(filePathAbsoluteFilesystem);
|
|
101
|
+
const filePath = getFilePathResolved({ filePathAbsoluteFilesystem, userRootDir });
|
|
102
|
+
return filePath.filePathToShowToUserResolved;
|
|
103
|
+
}
|
|
104
|
+
function getFilePathToShowToUserFromUnkown(
|
|
105
|
+
// We don't have any guarentee about filePath, e.g. about whether is filePathAbsoluteFilesystem or filePathAbsoluteUserRootDir
|
|
106
|
+
filePathUnkown, userRootDir) {
|
|
107
|
+
assertPosixPath(userRootDir);
|
|
108
|
+
assertPathIsFilesystemAbsolute(userRootDir);
|
|
109
|
+
filePathUnkown = cleanFilePathUnkown(filePathUnkown);
|
|
110
|
+
if (!filePathUnkown.startsWith(userRootDir)) {
|
|
111
|
+
return filePathUnkown;
|
|
80
112
|
}
|
|
113
|
+
else {
|
|
114
|
+
return getFilePathAbsoluteUserRootDir2(filePathUnkown, userRootDir);
|
|
115
|
+
}
|
|
116
|
+
}
|
|
117
|
+
function getFilePathAbsoluteUserRootDir2(filePathAbsoluteFilesystem, userRootDir) {
|
|
118
|
+
assert(filePathAbsoluteFilesystem.startsWith(userRootDir));
|
|
119
|
+
let filePathAbsoluteUserRootDir = filePathAbsoluteFilesystem.slice(userRootDir.length);
|
|
120
|
+
if (!filePathAbsoluteUserRootDir.startsWith('/'))
|
|
121
|
+
filePathAbsoluteUserRootDir = '/' + filePathAbsoluteUserRootDir;
|
|
81
122
|
return filePathAbsoluteUserRootDir;
|
|
82
123
|
}
|
|
124
|
+
function cleanFilePathUnkown(filePathUnknown) {
|
|
125
|
+
filePathUnknown = toPosixPath(filePathUnknown);
|
|
126
|
+
filePathUnknown = cleanModuleId(filePathUnknown);
|
|
127
|
+
return filePathUnknown;
|
|
128
|
+
}
|
|
129
|
+
function cleanModuleId(moduleId) {
|
|
130
|
+
// remove query
|
|
131
|
+
const parts = moduleId.split('?');
|
|
132
|
+
if (parts.length > 1)
|
|
133
|
+
parts.pop();
|
|
134
|
+
assert(parts.length >= 1);
|
|
135
|
+
return parts.join('?');
|
|
136
|
+
}
|
|
@@ -7,7 +7,8 @@ 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, isObject, removeEmptyLines, stripAnsi } from '../../utils.js';
|
|
11
|
+
import { cleanFilePathUnkown, getFilePathToShowToUserFromUnkown } from '../getFilePath.js';
|
|
11
12
|
function isErrorWithCodeSnippet(err) {
|
|
12
13
|
if (!isObject(err)) {
|
|
13
14
|
return false;
|
|
@@ -46,7 +47,7 @@ function getPrettyErrorWithCodeSnippet(err, userRootDir) {
|
|
|
46
47
|
let { id, frame } = err;
|
|
47
48
|
const msgFirstLine = [
|
|
48
49
|
pc.red('Failed to transpile'),
|
|
49
|
-
pc.bold(pc.red(
|
|
50
|
+
pc.bold(pc.red(getFilePathToShowToUserFromUnkown(id, userRootDir))),
|
|
50
51
|
pc.red('because:')
|
|
51
52
|
].join(' ');
|
|
52
53
|
const errMsg = getPrettyErrMessage(err);
|
|
@@ -85,7 +86,7 @@ function getPrettyErrMessage(err) {
|
|
|
85
86
|
// Remove "/home/rom/code/vike/examples/react-full/components/Counter.tsx:1:8:" (redundant since we already print the filename)
|
|
86
87
|
const pos = /(?:\:\d+|)/;
|
|
87
88
|
errMsg = errMsg.split(reg([id, pos, pos, trail], 'gi')).join('');
|
|
88
|
-
errMsg = errMsg.split(reg([
|
|
89
|
+
errMsg = errMsg.split(reg([cleanFilePathUnkown(id), pos, pos, trail], 'gi')).join('');
|
|
89
90
|
// Remove "ERROR:" (useless)
|
|
90
91
|
errMsg = errMsg.split(reg(['ERROR:', trail])).join('');
|
|
91
92
|
// Remove "Internal server error:" (useless)
|
|
@@ -155,9 +156,3 @@ function isEquivalentErrorWithCodeSnippet(err1, err2) {
|
|
|
155
156
|
function isDefinedAndSame(val1, val2) {
|
|
156
157
|
return val1 && val1 === val2;
|
|
157
158
|
}
|
|
158
|
-
function normalizeId(id) {
|
|
159
|
-
id = toPosixPath(id);
|
|
160
|
-
// remove query
|
|
161
|
-
id = id.split('?')[0];
|
|
162
|
-
return id;
|
|
163
|
-
}
|
|
@@ -14,7 +14,7 @@ export { clearLogs };
|
|
|
14
14
|
import { isAbortError } from '../../../shared/route/abort.js';
|
|
15
15
|
import { getViteConfig } from '../../runtime/globalContext.js';
|
|
16
16
|
import { overwriteRuntimeProductionLogger } from '../../runtime/renderPage/loggerRuntime.js';
|
|
17
|
-
import { assert, assertIsNotProductionRuntime, formatHintLog, getAssertErrMsg,
|
|
17
|
+
import { assert, assertIsNotProductionRuntime, formatHintLog, getAssertErrMsg, overwriteAssertProductionLogger, stripAnsi, warnIfErrorIsNotObject } from '../utils.js';
|
|
18
18
|
import { getHttpRequestAsyncStore } from './getHttpRequestAsyncStore.js';
|
|
19
19
|
import { isErrorDebug } from './isErrorDebug.js';
|
|
20
20
|
import { isErrorWithCodeSnippet, getPrettyErrorWithCodeSnippet } from './loggerNotProd/errorWithCodeSnippet.js';
|
|
@@ -24,6 +24,7 @@ import pc from '@brillout/picocolors';
|
|
|
24
24
|
import { setAlreadyLogged } from '../../runtime/renderPage/isNewError.js';
|
|
25
25
|
import { isConfigInvalid } from '../../runtime/renderPage/isConfigInvalid.js';
|
|
26
26
|
import { onRuntimeError } from '../../runtime/renderPage/loggerProd.js';
|
|
27
|
+
import { isUserHookError } from '../../../shared/hooks/executeHook.js';
|
|
27
28
|
assertIsNotProductionRuntime();
|
|
28
29
|
overwriteRuntimeProductionLogger(logRuntimeError, logRuntimeInfo);
|
|
29
30
|
overwriteAssertProductionLogger(assertLogger);
|
|
@@ -1,6 +1,5 @@
|
|
|
1
1
|
export * from '../runtime/utils.js';
|
|
2
2
|
export * from '../../utils/viteIsSSR.js';
|
|
3
|
-
export * from '../../utils/getFilePathAbsolute.js';
|
|
4
3
|
export * from '../../utils/requireResolve.js';
|
|
5
4
|
export * from '../../utils/arrayIncludes.js';
|
|
6
5
|
export * from '../../utils/isDev.js';
|
|
@@ -20,3 +19,4 @@ export * from '../../utils/injectRollupInputs.js';
|
|
|
20
19
|
export * from '../../utils/humanizeTime.js';
|
|
21
20
|
export * from '../../utils/pLimit.js';
|
|
22
21
|
export * from '../../utils/assertVersion.js';
|
|
22
|
+
export * from '../../utils/assertPathIsFilesystemAbsolute.js';
|
|
@@ -6,7 +6,6 @@ onLoad();
|
|
|
6
6
|
export * from '../runtime/utils.js';
|
|
7
7
|
// Utils only needed by `plugin/*`
|
|
8
8
|
export * from '../../utils/viteIsSSR.js';
|
|
9
|
-
export * from '../../utils/getFilePathAbsolute.js';
|
|
10
9
|
export * from '../../utils/requireResolve.js';
|
|
11
10
|
export * from '../../utils/arrayIncludes.js';
|
|
12
11
|
export * from '../../utils/isDev.js';
|
|
@@ -26,3 +25,4 @@ export * from '../../utils/injectRollupInputs.js';
|
|
|
26
25
|
export * from '../../utils/humanizeTime.js';
|
|
27
26
|
export * from '../../utils/pLimit.js';
|
|
28
27
|
export * from '../../utils/assertVersion.js';
|
|
28
|
+
export * from '../../utils/assertPathIsFilesystemAbsolute.js';
|
|
@@ -5,8 +5,7 @@ export { runPrerender_forceExit };
|
|
|
5
5
|
import '../runtime/page-files/setup.js';
|
|
6
6
|
import path from 'path';
|
|
7
7
|
import { route } from '../../shared/route/index.js';
|
|
8
|
-
import { assert, assertUsage, assertWarning, hasProp, projectInfo, objectAssign, isObjectWithKeys, isCallable, getOutDirs, isPropertyGetter, assertPosixPath, urlToFile,
|
|
9
|
-
import { pLimit } from '../../utils/pLimit.js';
|
|
8
|
+
import { assert, assertUsage, assertWarning, hasProp, projectInfo, objectAssign, isObjectWithKeys, isCallable, getOutDirs, isPropertyGetter, assertPosixPath, urlToFile, isPlainObject, handleNodeEnv_prerender, pLimit, assertPathIsFilesystemAbsolute } from './utils.js';
|
|
10
9
|
import { prerenderPage, prerender404Page, getRenderContext, getPageContextInitEnhanced } from '../runtime/renderPage/renderPageAlreadyRouted.js';
|
|
11
10
|
import pc from '@brillout/picocolors';
|
|
12
11
|
import { cpus } from 'os';
|
|
@@ -20,13 +19,13 @@ import { getConfigValue, getConfigValueFilePathToShowToUser } from '../../shared
|
|
|
20
19
|
import { loadConfigValues } from '../../shared/page-configs/loadConfigValues.js';
|
|
21
20
|
import { isErrorPage } from '../../shared/error-page.js';
|
|
22
21
|
import { addUrlComputedProps } from '../../shared/addUrlComputedProps.js';
|
|
23
|
-
import { assertPathIsFilesystemAbsolute } from '../../utils/assertPathIsFilesystemAbsolute.js';
|
|
24
22
|
import { isAbortError } from '../../shared/route/abort.js';
|
|
25
23
|
import { loadUserFilesServerSide } from '../runtime/renderPage/loadUserFilesServerSide.js';
|
|
26
24
|
import { getHookFromPageConfig, getHookFromPageConfigGlobal, getHookTimeoutDefault, setIsPrerenderering } from '../../shared/hooks/getHook.js';
|
|
27
25
|
import { noRouteMatch } from '../../shared/route/noRouteMatch.js';
|
|
28
26
|
import { getVikeConfig } from '../plugin/plugins/importUserCode/v1-design/getVikeConfig.js';
|
|
29
27
|
import { logErrorHint } from '../runtime/renderPage/logErrorHint.js';
|
|
28
|
+
import { executeHook, isUserHookError } from '../../shared/hooks/executeHook.js';
|
|
30
29
|
async function runPrerenderFromAPI(options = {}) {
|
|
31
30
|
await runPrerender(options, 'prerender()');
|
|
32
31
|
// - We purposely propagate the error to the user land, so that the error interrupts the user land. It's also, I guess, a nice-to-have that the user has control over the error.
|
|
@@ -8,6 +8,7 @@ export * from '../../utils/getOutDirs.js';
|
|
|
8
8
|
export * from '../../utils/isPropertyGetter.js';
|
|
9
9
|
export * from '../../utils/filesystemPathHandling.js';
|
|
10
10
|
export * from '../../utils/urlToFile.js';
|
|
11
|
-
export * from '../../shared/hooks/executeHook.js';
|
|
12
11
|
export * from '../../utils/isPlainObject.js';
|
|
13
12
|
export * from '../../utils/assertNodeEnv.js';
|
|
13
|
+
export * from '../../utils/pLimit.js';
|
|
14
|
+
export * from '../../utils/assertPathIsFilesystemAbsolute.js';
|
|
@@ -10,6 +10,7 @@ export * from '../../utils/getOutDirs.js';
|
|
|
10
10
|
export * from '../../utils/isPropertyGetter.js';
|
|
11
11
|
export * from '../../utils/filesystemPathHandling.js';
|
|
12
12
|
export * from '../../utils/urlToFile.js';
|
|
13
|
-
export * from '../../shared/hooks/executeHook.js';
|
|
14
13
|
export * from '../../utils/isPlainObject.js';
|
|
15
14
|
export * from '../../utils/assertNodeEnv.js';
|
|
15
|
+
export * from '../../utils/pLimit.js';
|
|
16
|
+
export * from '../../utils/assertPathIsFilesystemAbsolute.js';
|
|
@@ -379,7 +379,7 @@ async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onF
|
|
|
379
379
|
const writeChunk = (chunk) => {
|
|
380
380
|
assert(writableOriginal);
|
|
381
381
|
writableOriginal.write(chunk);
|
|
382
|
-
if (debug.
|
|
382
|
+
if (debug.isActivated) {
|
|
383
383
|
debug('data written (Node.js Writable)', String(chunk));
|
|
384
384
|
}
|
|
385
385
|
};
|
|
@@ -452,7 +452,7 @@ async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onF
|
|
|
452
452
|
const writeChunk = (chunk) => {
|
|
453
453
|
assert(writerOriginal);
|
|
454
454
|
writerOriginal.write(encodeForWebStream(chunk));
|
|
455
|
-
if (debug.
|
|
455
|
+
if (debug.isActivated) {
|
|
456
456
|
debug('data written (Web Writable)', String(chunk));
|
|
457
457
|
}
|
|
458
458
|
};
|
|
@@ -545,12 +545,12 @@ async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onF
|
|
|
545
545
|
// If readableOriginal doesn't implement readableOriginal.cancel() then it may still emit data after we close the stream. We therefore need to check whether we closed `controllerProxy`.
|
|
546
546
|
!controllerProxyIsClosed) {
|
|
547
547
|
controllerProxy.enqueue(encodeForWebStream(chunk));
|
|
548
|
-
if (debug.
|
|
548
|
+
if (debug.isActivated) {
|
|
549
549
|
debug('data written (Web Readable)', String(chunk));
|
|
550
550
|
}
|
|
551
551
|
}
|
|
552
552
|
else {
|
|
553
|
-
if (debug.
|
|
553
|
+
if (debug.isActivated) {
|
|
554
554
|
debug('data emitted but not written (Web Readable)', String(chunk));
|
|
555
555
|
}
|
|
556
556
|
}
|
|
@@ -572,7 +572,7 @@ async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onF
|
|
|
572
572
|
}
|
|
573
573
|
const writeChunk = (chunk) => {
|
|
574
574
|
readableProxy.push(chunk);
|
|
575
|
-
if (debug.
|
|
575
|
+
if (debug.isActivated) {
|
|
576
576
|
debug('data written (Node.js Readable)', String(chunk));
|
|
577
577
|
}
|
|
578
578
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
1
|
export { executeOnBeforeRenderAndDataHooks };
|
|
2
2
|
import { getHook } from '../../../shared/hooks/getHook.js';
|
|
3
3
|
import { preparePageContextForUserConsumptionServerSide } from './preparePageContextForUserConsumptionServerSide.js';
|
|
4
|
-
import { executeHook } from '../utils.js';
|
|
5
4
|
import { assertOnBeforeRenderHookReturn } from '../../../shared/assertOnBeforeRenderHookReturn.js';
|
|
5
|
+
import { executeHook } from '../../../shared/hooks/executeHook.js';
|
|
6
6
|
async function executeOnBeforeRenderAndDataHooks(pageContext) {
|
|
7
7
|
if (pageContext._pageContextAlreadyProvidedByOnPrerenderHook) {
|
|
8
8
|
return;
|
|
@@ -1,13 +1,14 @@
|
|
|
1
1
|
export { executeOnRenderHtmlHook };
|
|
2
2
|
import { isDocumentHtml, renderDocumentHtml, dangerouslySkipEscape } from '../html/renderHtml.js';
|
|
3
3
|
import { getHook } from '../../../shared/hooks/getHook.js';
|
|
4
|
-
import { assert, assertUsage, assertWarning, isObject, objectAssign, isPromise,
|
|
4
|
+
import { assert, assertUsage, assertWarning, isObject, objectAssign, isPromise, isCallable } from '../utils.js';
|
|
5
5
|
import { isStream } from '../html/stream.js';
|
|
6
6
|
import { assertPageContextProvidedByUser } from '../../../shared/assertPageContextProvidedByUser.js';
|
|
7
7
|
import { preparePageContextForUserConsumptionServerSide } from './preparePageContextForUserConsumptionServerSide.js';
|
|
8
8
|
import { assertHookReturnedObject } from '../../../shared/assertHookReturnedObject.js';
|
|
9
9
|
import { logRuntimeError } from './loggerRuntime.js';
|
|
10
10
|
import pc from '@brillout/picocolors';
|
|
11
|
+
import { executeHook } from '../../../shared/hooks/executeHook.js';
|
|
11
12
|
async function executeOnRenderHtmlHook(pageContext) {
|
|
12
13
|
const { renderHook, hookFn } = getRenderHook(pageContext);
|
|
13
14
|
objectAssign(pageContext, { _renderHook: renderHook });
|
|
@@ -1,10 +1,8 @@
|
|
|
1
1
|
export { getManifestEntry };
|
|
2
|
-
import { assert, slice,
|
|
3
|
-
import { assertClientEntryId } from './assertClientEntryId.js';
|
|
2
|
+
import { assert, slice, assertIsNpmPackageImport } from '../../utils.js';
|
|
4
3
|
import { isVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll.js';
|
|
5
4
|
import { prependEntriesDir } from '../../../shared/prependEntriesDir.js';
|
|
6
5
|
function getManifestEntry(id, assetsManifest) {
|
|
7
|
-
assertClientEntryId(id);
|
|
8
6
|
const debugInfo = getDebugInfo(id, assetsManifest);
|
|
9
7
|
// Vike client entry
|
|
10
8
|
if (id.startsWith('@@vike/')) {
|
|
@@ -42,12 +40,11 @@ function getManifestEntry(id, assetsManifest) {
|
|
|
42
40
|
return { manifestEntry, manifestKey };
|
|
43
41
|
}
|
|
44
42
|
// npm package import
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
}
|
|
43
|
+
assertIsNpmPackageImport(id);
|
|
44
|
+
const found = Object.entries(assetsManifest).find(([, e]) => e.name === prependEntriesDir(id));
|
|
45
|
+
assert(found);
|
|
46
|
+
const [manifestKey, manifestEntry] = found;
|
|
47
|
+
return { manifestEntry, manifestKey };
|
|
51
48
|
/* Can we remove this?
|
|
52
49
|
// extensions[number].pageConfigsSrcDir
|
|
53
50
|
if (id.startsWith('/node_modules/') || id.startsWith('/../')) {
|
|
@@ -79,7 +76,6 @@ function getManifestEntry(id, assetsManifest) {
|
|
|
79
76
|
assert(false, debugInfo)
|
|
80
77
|
}
|
|
81
78
|
*/
|
|
82
|
-
assert(false, debugInfo);
|
|
83
79
|
}
|
|
84
80
|
function findEntryWithKeyEnd(manifestKeyEnd, assetsManifest, id) {
|
|
85
81
|
const debugInfo = getDebugInfo(id, assetsManifest, manifestKeyEnd);
|
|
@@ -9,15 +9,16 @@ function retrieveAssetsProd(clientDependencies, assetsManifest, includeAssetsImp
|
|
|
9
9
|
clientDependencies.forEach(({ id, onlyAssets, eagerlyImported }) => {
|
|
10
10
|
if (eagerlyImported)
|
|
11
11
|
return; // Eagerly imported assets aren't imported with import() and therefore don't create a new Rollup entry and aren't listed in the manifest file
|
|
12
|
-
|
|
13
|
-
|
|
14
|
-
|
|
12
|
+
// TODO/v1-release: remove
|
|
13
|
+
if (includeAssetsImportedByServer &&
|
|
14
|
+
onlyAssets &&
|
|
15
|
+
id.includes('.page.server.') &&
|
|
15
16
|
// We assume that all npm packages have already built their files: bundlers (Rollup, esbuild, tsup, ...) extract the CSS out of JavaScript => we can assume JavaScript to not import any CSS/assets.
|
|
16
|
-
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
!isNpmPackageImport(id, {
|
|
18
|
+
// I presume Vite already resolves path aliases when Vite sets the module's id
|
|
19
|
+
cannotBePathAlias: true
|
|
20
|
+
})) {
|
|
21
|
+
id = extractAssetsAddQuery(id);
|
|
21
22
|
}
|
|
22
23
|
const { manifestKey } = getManifestEntry(id, assetsManifest);
|
|
23
24
|
collectAssets(manifestKey, assetUrls, visistedAssets, assetsManifest, onlyAssets);
|
|
@@ -1,12 +1,11 @@
|
|
|
1
1
|
export { getPageAssets };
|
|
2
|
-
import { assert, prependBase, assertPosixPath, toPosixPath,
|
|
2
|
+
import { assert, prependBase, assertPosixPath, toPosixPath, unique, pathJoin, assertIsNpmPackageImport } from '../utils.js';
|
|
3
3
|
import { retrieveAssetsDev } from './getPageAssets/retrieveAssetsDev.js';
|
|
4
4
|
import { retrieveAssetsProd } from './getPageAssets/retrieveAssetsProd.js';
|
|
5
5
|
import { inferMediaType } from './inferMediaType.js';
|
|
6
6
|
import { getManifestEntry } from './getPageAssets/getManifestEntry.js';
|
|
7
7
|
import { sortPageAssetsForEarlyHintsHeader } from './getPageAssets/sortPageAssetsForEarlyHintsHeader.js';
|
|
8
8
|
import { getGlobalContext } from '../globalContext.js';
|
|
9
|
-
import { assertClientEntryId } from './getPageAssets/assertClientEntryId.js';
|
|
10
9
|
import { import_ } from '@brillout/import';
|
|
11
10
|
async function getPageAssets(pageContext, clientDependencies, clientEntries) {
|
|
12
11
|
const globalContext = getGlobalContext();
|
|
@@ -56,7 +55,6 @@ async function getPageAssets(pageContext, clientDependencies, clientEntries) {
|
|
|
56
55
|
return pageAssets;
|
|
57
56
|
}
|
|
58
57
|
async function resolveClientEntriesDev(clientEntry, viteDevServer) {
|
|
59
|
-
assertClientEntryId(clientEntry);
|
|
60
58
|
let root = viteDevServer.config.root;
|
|
61
59
|
assert(root);
|
|
62
60
|
root = toPosixPath(root);
|
|
@@ -73,11 +71,9 @@ async function resolveClientEntriesDev(clientEntry, viteDevServer) {
|
|
|
73
71
|
assertPosixPath(clientEntry);
|
|
74
72
|
let filePath;
|
|
75
73
|
if (clientEntry.startsWith('/')) {
|
|
76
|
-
// User files
|
|
77
74
|
filePath = pathJoin(root, clientEntry);
|
|
78
75
|
}
|
|
79
|
-
else
|
|
80
|
-
// Vike client entry
|
|
76
|
+
else {
|
|
81
77
|
const { createRequire } = (await import_('module')).default;
|
|
82
78
|
const { dirname } = (await import_('path')).default;
|
|
83
79
|
const { fileURLToPath } = (await import_('url')).default;
|
|
@@ -88,10 +84,7 @@ async function resolveClientEntriesDev(clientEntry, viteDevServer) {
|
|
|
88
84
|
// @ts-expect-error
|
|
89
85
|
// Bun workaround https://github.com/vikejs/vike/pull/1048
|
|
90
86
|
const res = typeof Bun !== 'undefined' ? (toPath) => Bun.resolveSync(toPath, __dirname_) : require_.resolve;
|
|
91
|
-
if (
|
|
92
|
-
filePath = res(clientEntry);
|
|
93
|
-
}
|
|
94
|
-
else {
|
|
87
|
+
if (clientEntry.startsWith('@@vike/')) {
|
|
95
88
|
assert(clientEntry.endsWith('.js'));
|
|
96
89
|
try {
|
|
97
90
|
// For Vitest (which doesn't resolve vike to its dist but to its source files)
|
|
@@ -104,9 +97,10 @@ async function resolveClientEntriesDev(clientEntry, viteDevServer) {
|
|
|
104
97
|
filePath = toPosixPath(res(clientEntry.replace('@@vike/dist/esm/client/', '../../../../../dist/esm/client/')));
|
|
105
98
|
}
|
|
106
99
|
}
|
|
107
|
-
|
|
108
|
-
|
|
109
|
-
|
|
100
|
+
else {
|
|
101
|
+
assertIsNpmPackageImport(clientEntry);
|
|
102
|
+
filePath = res(clientEntry);
|
|
103
|
+
}
|
|
110
104
|
}
|
|
111
105
|
if (!filePath.startsWith('/')) {
|
|
112
106
|
assert(process.platform === 'win32');
|
|
@@ -29,7 +29,6 @@ export * from '../../utils/isPropertyGetter.js';
|
|
|
29
29
|
export * from '../../utils/debug.js';
|
|
30
30
|
export * from '../../utils/urlToFile.js';
|
|
31
31
|
export * from '../../utils/getGlobalObject.js';
|
|
32
|
-
export * from '../../shared/hooks/executeHook.js';
|
|
33
32
|
export * from '../../utils/freezePartial.js';
|
|
34
33
|
export * from '../../utils/isNpmPackage.js';
|
|
35
34
|
export * from '../../utils/isNotNullish.js';
|
|
@@ -32,7 +32,6 @@ export * from '../../utils/isPropertyGetter.js';
|
|
|
32
32
|
export * from '../../utils/debug.js';
|
|
33
33
|
export * from '../../utils/urlToFile.js';
|
|
34
34
|
export * from '../../utils/getGlobalObject.js';
|
|
35
|
-
export * from '../../shared/hooks/executeHook.js';
|
|
36
35
|
export * from '../../utils/freezePartial.js';
|
|
37
36
|
export * from '../../utils/isNpmPackage.js';
|
|
38
37
|
export * from '../../utils/isNotNullish.js';
|
|
@@ -2,51 +2,63 @@ export type { FilePath };
|
|
|
2
2
|
export type { FilePathResolved };
|
|
3
3
|
type FilePathResolved = FilePath & {
|
|
4
4
|
filePathAbsoluteFilesystem: string;
|
|
5
|
+
/**
|
|
6
|
+
* The file's path, shown to the user in logs.
|
|
7
|
+
*
|
|
8
|
+
* Resolved: it always shows a file path. (It nevers shows an import path such as `vike-react/config`.)
|
|
9
|
+
*
|
|
10
|
+
* Its value is equivalent to `filePath.filePathAbsoluteUserRootDir ?? filePath.filePathAbsoluteFilesystem`.
|
|
11
|
+
*/
|
|
5
12
|
filePathToShowToUserResolved: string;
|
|
6
13
|
};
|
|
7
|
-
type
|
|
8
|
-
|
|
14
|
+
type IsReferencedByUserLandFile = {
|
|
15
|
+
filePathAbsoluteUserRootDir: string;
|
|
16
|
+
} | {
|
|
17
|
+
importPathAbsolute: string;
|
|
18
|
+
};
|
|
19
|
+
type FilePath = FilePathProps & IsReferencedByUserLandFile;
|
|
20
|
+
type FilePathProps = {
|
|
21
|
+
/**
|
|
22
|
+
* The file's path, absolute starting from the filesystem root.
|
|
9
23
|
*
|
|
10
|
-
*
|
|
11
|
-
* - `vike-react/config`, or
|
|
12
|
-
* - `/pages/+config.js`.
|
|
24
|
+
* Example: `/home/rom/code/my-app/pages/some-page/+Page.js`
|
|
13
25
|
*
|
|
14
|
-
*
|
|
26
|
+
* The value is `null` for imports using path aliases. (Because Vike cannot resolve path aliases, otherwise Vike would need to re-implement https://www.npmjs.com/package/@rollup/plugin-alias.)
|
|
15
27
|
*/
|
|
16
|
-
|
|
17
|
-
/**
|
|
28
|
+
filePathAbsoluteFilesystem: string | null;
|
|
29
|
+
/**
|
|
30
|
+
* The file's path, absolute starting from the user root directory (i.e. Vite's `config.root`).
|
|
31
|
+
*
|
|
32
|
+
* Example: `/pages/some-page/+Page.js`.
|
|
18
33
|
*
|
|
19
|
-
*
|
|
34
|
+
* Its value is `null` if the file is outside of the user root directory (i.e. Vite's `config.root`).
|
|
20
35
|
*
|
|
21
|
-
* The value is `null` upon aliased import paths which we cannot resolve (we'd need to re-implement https://www.npmjs.com/package/@rollup/plugin-alias).
|
|
22
36
|
*/
|
|
23
|
-
|
|
24
|
-
/**
|
|
37
|
+
filePathAbsoluteUserRootDir: string | null;
|
|
38
|
+
/**
|
|
39
|
+
* The file's path, shown to the user in logs.
|
|
25
40
|
*
|
|
26
|
-
* Unresolved: it may show an import path of a
|
|
41
|
+
* Unresolved: it may show an import path instead of a file path such as `vike-react/config`.
|
|
27
42
|
*
|
|
28
|
-
*
|
|
43
|
+
* Its value is equivalent to `filePath.filePathAbsoluteUserRootDir ?? filePath.importPathAbsolute`.
|
|
29
44
|
*/
|
|
30
45
|
filePathToShowToUser: string;
|
|
31
|
-
/**
|
|
46
|
+
/**
|
|
47
|
+
* The file's non-relative path, from Vite's perspective.
|
|
32
48
|
*
|
|
33
|
-
*
|
|
49
|
+
* Examples:
|
|
50
|
+
* - `/pages/+config.js`
|
|
51
|
+
* - `vike-react/config`
|
|
34
52
|
*
|
|
35
|
-
*
|
|
36
|
-
*/
|
|
37
|
-
filePathToShowToUserResolved: string | null;
|
|
38
|
-
/** The file's path, absolute starting from the user root directory (i.e. Vite's `config.root`).
|
|
53
|
+
* We use it to generate import paths in virtual modules. (Since import paths in virtual modules cannot be relative.)
|
|
39
54
|
*
|
|
40
|
-
*
|
|
55
|
+
* Its value is equivalent to `filePath.filePathAbsoluteUserRootDir ?? filePath.importPathAbsolute`.
|
|
41
56
|
*/
|
|
42
|
-
|
|
43
|
-
/**
|
|
57
|
+
filePathAbsoluteVite: string;
|
|
58
|
+
/**
|
|
59
|
+
* The file's non-relative import path. It's either:
|
|
44
60
|
* - an npm package import (e.g. `vike-react/config`), or
|
|
45
|
-
* -
|
|
61
|
+
* - a path alias import (e.g. `#components/Counter').
|
|
46
62
|
*/
|
|
47
63
|
importPathAbsolute: string | null;
|
|
48
|
-
}
|
|
49
|
-
importPathAbsolute: string;
|
|
50
|
-
} | {
|
|
51
|
-
filePathAbsoluteUserRootDir: string;
|
|
52
|
-
});
|
|
64
|
+
};
|