vike 0.4.165-commit-8eba585 → 0.4.166-commit-6a8acaa
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/fileEnv.js +6 -3
- package/dist/cjs/node/plugin/plugins/importUserCode/index.js +6 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +6 -2
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +22 -18
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +7 -6
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +7 -3
- package/dist/cjs/node/plugin/shared/getFilePath.js +142 -0
- 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/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/renderPage/logErrorHint.js +5 -0
- package/dist/cjs/node/runtime/utils.js +0 -1
- 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/utils.js +0 -1
- package/dist/cjs/utils/assertPathIsFilesystemAbsolute.js +1 -0
- package/dist/cjs/utils/isNpmPackage.js +11 -2
- package/dist/cjs/utils/parseUrl.js +8 -1
- package/dist/cjs/utils/projectInfo.js +1 -1
- 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/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/fileEnv.js +7 -4
- package/dist/esm/node/plugin/plugins/importUserCode/index.js +7 -3
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js +6 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js +22 -18
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +7 -6
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +7 -3
- package/dist/esm/node/plugin/shared/getFilePath.d.ts +21 -0
- package/dist/esm/node/plugin/shared/getFilePath.js +136 -0
- 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/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/renderPage/logErrorHint.js +2 -0
- 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/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/utils.d.ts +0 -1
- package/dist/esm/shared/route/utils.js +0 -1
- package/dist/esm/utils/assertPathIsFilesystemAbsolute.js +1 -0
- package/dist/esm/utils/debug.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/parseUrl.js +8 -1
- package/dist/esm/utils/projectInfo.d.ts +2 -2
- package/dist/esm/utils/projectInfo.js +1 -1
- package/package.json +25 -13
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getFilePath.js +0 -90
- package/dist/cjs/node/runtime/renderPage/getPageAssets/assertClientEntryId.js +0 -19
- package/dist/cjs/utils/getFilePathAbsolute.js +0 -70
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getFilePath.d.ts +0 -20
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/getFilePath.js +0 -84
- 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
|
@@ -18,6 +18,7 @@ const path_1 = __importDefault(require("path"));
|
|
|
18
18
|
const fixServerAssets_js_1 = require("./buildConfig/fixServerAssets.js");
|
|
19
19
|
const index_js_1 = require("./importBuild/index.js");
|
|
20
20
|
const prependEntriesDir_js_1 = require("../../shared/prependEntriesDir.js");
|
|
21
|
+
const getFilePath_js_1 = require("../shared/getFilePath.js");
|
|
21
22
|
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
22
23
|
const importMetaUrl = `file://${__filename}`;
|
|
23
24
|
const require_ = (0, module_1.createRequire)(importMetaUrl);
|
|
@@ -205,18 +206,22 @@ async function getPageFileEntries(config, includeAssetsImportedByServer) {
|
|
|
205
206
|
return pageFileEntries;
|
|
206
207
|
}
|
|
207
208
|
function getEntryFromClientEntry(clientEntry, config, addExtractAssetsQuery) {
|
|
208
|
-
if (
|
|
209
|
+
if (!clientEntry.startsWith('/')) {
|
|
210
|
+
(0, utils_js_1.assertIsNpmPackageImport)(clientEntry);
|
|
209
211
|
const entryTarget = clientEntry;
|
|
210
212
|
const entryName = (0, prependEntriesDir_js_1.prependEntriesDir)(clientEntry);
|
|
211
213
|
return { entryName, entryTarget };
|
|
212
214
|
}
|
|
213
|
-
const
|
|
214
|
-
(0, utils_js_1.
|
|
215
|
-
(0,
|
|
216
|
-
|
|
215
|
+
const filePathAbsoluteUserRootDir = clientEntry;
|
|
216
|
+
(0, utils_js_1.assert)(filePathAbsoluteUserRootDir.startsWith('/'));
|
|
217
|
+
const filePath = (0, getFilePath_js_1.getFilePathResolved)({
|
|
218
|
+
filePathAbsoluteUserRootDir,
|
|
219
|
+
userRootDir: config.root
|
|
220
|
+
});
|
|
221
|
+
let entryTarget = filePath.filePathAbsoluteFilesystem;
|
|
217
222
|
if (addExtractAssetsQuery)
|
|
218
223
|
entryTarget = (0, extractAssetsQuery_js_1.extractAssetsAddQuery)(entryTarget);
|
|
219
|
-
let entryName =
|
|
224
|
+
let entryName = filePathAbsoluteUserRootDir;
|
|
220
225
|
if (addExtractAssetsQuery)
|
|
221
226
|
entryName = (0, extractAssetsQuery_js_1.extractAssetsAddQuery)(entryName);
|
|
222
227
|
entryName = (0, utils_js_1.removeFileExtention)(entryName);
|
|
@@ -18,8 +18,9 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
|
18
18
|
// - Aliases react imports
|
|
19
19
|
// - @vitejs/plugin-vue2
|
|
20
20
|
// - https://github.com/vikejs/vike/issues/1329
|
|
21
|
-
// TODO/v1-release: replace assertWarning() with assertUsage()
|
|
22
21
|
function assertResolveAlias(config) {
|
|
22
|
+
// TODO: re-implement warning https://github.com/vikejs/vike/issues/1567
|
|
23
|
+
return;
|
|
23
24
|
const aliases = getAliases(config);
|
|
24
25
|
const errPrefix = config.configFile || 'Your Vite configuration';
|
|
25
26
|
const errSuffix1 = 'see https://vike.dev/path-aliases#vite';
|
|
@@ -7,6 +7,8 @@ const getVikeConfig_js_1 = require("../importUserCode/v1-design/getVikeConfig.js
|
|
|
7
7
|
const getConfigValueSourcesNotOverriden_js_1 = require("../../shared/getConfigValueSourcesNotOverriden.js");
|
|
8
8
|
const buildConfig_js_1 = require("../buildConfig.js");
|
|
9
9
|
const virtualFileImportUserCode_js_1 = require("../../../shared/virtual-files/virtualFileImportUserCode.js");
|
|
10
|
+
const getFilePath_js_1 = require("../../shared/getFilePath.js");
|
|
11
|
+
const debug = (0, utils_js_1.createDebugger)('vike:optimizeDeps');
|
|
10
12
|
async function determineOptimizeDeps(config, isDev) {
|
|
11
13
|
const { pageConfigs } = await (0, getVikeConfig_js_1.getVikeConfig)(config, isDev);
|
|
12
14
|
const { entries, include } = await getPageDeps(config, pageConfigs, isDev);
|
|
@@ -23,7 +25,11 @@ async function determineOptimizeDeps(config, isDev) {
|
|
|
23
25
|
*/
|
|
24
26
|
config.optimizeDeps.include = [...include, ...normalizeInclude(config.optimizeDeps.include)];
|
|
25
27
|
config.optimizeDeps.entries = [...entries, ...normalizeEntries(config.optimizeDeps.entries)];
|
|
26
|
-
|
|
28
|
+
if (debug.isEnabled)
|
|
29
|
+
debug('config.optimizeDeps', {
|
|
30
|
+
'config.optimizeDeps.entries': config.optimizeDeps.entries,
|
|
31
|
+
'config.optimizeDeps.include': config.optimizeDeps.include
|
|
32
|
+
});
|
|
27
33
|
}
|
|
28
34
|
exports.determineOptimizeDeps = determineOptimizeDeps;
|
|
29
35
|
async function getPageDeps(config, pageConfigs, isDev) {
|
|
@@ -47,24 +53,10 @@ async function getPageDeps(config, pageConfigs, isDev) {
|
|
|
47
53
|
else {
|
|
48
54
|
// Adding definedAt.filePathAbsoluteFilesystem doesn't work for npm packages, I guess because of Vite's config.server.fs.allow
|
|
49
55
|
const { importPathAbsolute } = definedAt;
|
|
50
|
-
(0, utils_js_1.assert)(importPathAbsolute);
|
|
51
|
-
//
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
if ((0, utils_js_1.isNpmPackageImport)(importPathAbsolute)) {
|
|
55
|
-
// isNpmPackageImport() returns false for a path alias like #root/renderer/onRenderClient
|
|
56
|
-
(0, utils_js_1.assert)(!importPathAbsolute.startsWith('#'));
|
|
57
|
-
include.push(importPathAbsolute);
|
|
58
|
-
}
|
|
59
|
-
else {
|
|
60
|
-
/* Path aliases, e.g.:
|
|
61
|
-
* ```js
|
|
62
|
-
* // /renderer/+config.js
|
|
63
|
-
* import onRenderClient from '#root/renderer/onRenderClient'
|
|
64
|
-
* ```
|
|
65
|
-
*/
|
|
66
|
-
entries.push(importPathAbsolute);
|
|
67
|
-
}
|
|
56
|
+
(0, utils_js_1.assert)(importPathAbsolute); // Help TS
|
|
57
|
+
// Shouldn't be a path alias, as path aliases would need to be added to config.optimizeDeps.entries instead of config.optimizeDeps.include
|
|
58
|
+
(0, utils_js_1.assertIsNpmPackageImport)(importPathAbsolute);
|
|
59
|
+
include.push(importPathAbsolute);
|
|
68
60
|
}
|
|
69
61
|
});
|
|
70
62
|
});
|
|
@@ -72,9 +64,12 @@ async function getPageDeps(config, pageConfigs, isDev) {
|
|
|
72
64
|
// V0.4 design
|
|
73
65
|
{
|
|
74
66
|
const pageFiles = await (0, findPageFiles_js_1.findPageFiles)(config, ['.page', '.page.client'], isDev);
|
|
75
|
-
|
|
76
|
-
|
|
77
|
-
|
|
67
|
+
const userRootDir = config.root;
|
|
68
|
+
pageFiles.forEach((filePathAbsoluteUserRootDir) => {
|
|
69
|
+
const entry = (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir });
|
|
70
|
+
const { filePathAbsoluteFilesystem } = entry;
|
|
71
|
+
(0, utils_js_1.assert)(filePathAbsoluteFilesystem);
|
|
72
|
+
entries.push(filePathAbsoluteFilesystem);
|
|
78
73
|
});
|
|
79
74
|
}
|
|
80
75
|
entries = (0, utils_js_1.unique)(entries);
|
|
@@ -4,6 +4,7 @@ exports.applyEnvVar = exports.envVarsPlugin = void 0;
|
|
|
4
4
|
const vite_1 = require("vite");
|
|
5
5
|
const utils_js_1 = require("../utils.js");
|
|
6
6
|
const rollupSourceMap_js_1 = require("../shared/rollupSourceMap.js");
|
|
7
|
+
const getFilePath_js_1 = require("../shared/getFilePath.js");
|
|
7
8
|
function envVarsPlugin() {
|
|
8
9
|
let envsAll;
|
|
9
10
|
let config;
|
|
@@ -45,10 +46,10 @@ function envVarsPlugin() {
|
|
|
45
46
|
if (isPrivate && isClientSide) {
|
|
46
47
|
if (!code.includes(envStatement))
|
|
47
48
|
return;
|
|
48
|
-
const
|
|
49
|
+
const modulePath = (0, getFilePath_js_1.getModuleFilePath)(id, config);
|
|
49
50
|
const errMsgAddendum = isBuild ? '' : ' (Vike will prevent your app from building for production)';
|
|
50
51
|
const keyPublic = `${publicPrefix}${envName}`;
|
|
51
|
-
const errMsg = `${envStatement} is used in client-side file ${
|
|
52
|
+
const errMsg = `${envStatement} is used in client-side file ${modulePath} which means that the environment variable ${envName} will be included in client-side bundles and, therefore, ${envName} will be publicly exposed which can be a security leak${errMsgAddendum}. Use ${envStatement} only in server-side files, or rename ${envName} to ${keyPublic}, see https://vike.dev/env`;
|
|
52
53
|
if (isBuild) {
|
|
53
54
|
(0, utils_js_1.assertUsage)(false, errMsg);
|
|
54
55
|
}
|
|
@@ -8,6 +8,7 @@ const utils_js_1 = require("../utils.js");
|
|
|
8
8
|
const extractAssetsPlugin_js_1 = require("./extractAssetsPlugin.js");
|
|
9
9
|
const extractExportNamesPlugin_js_1 = require("./extractExportNamesPlugin.js");
|
|
10
10
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
11
|
+
const getFilePath_js_1 = require("../shared/getFilePath.js");
|
|
11
12
|
function fileEnv() {
|
|
12
13
|
let config;
|
|
13
14
|
let isDev = false;
|
|
@@ -44,11 +45,13 @@ function fileEnv() {
|
|
|
44
45
|
// resolved is null when import path is erroneous and doesn't actually point to a file
|
|
45
46
|
if (!resolved)
|
|
46
47
|
return;
|
|
47
|
-
const
|
|
48
|
+
const moduleId = resolved.id;
|
|
49
|
+
const modulePath = moduleId.split('?')[0];
|
|
48
50
|
// `.server.js` and `.client.js` should only apply to user files
|
|
49
51
|
if (modulePath.includes('/node_modules/'))
|
|
50
52
|
return;
|
|
51
53
|
// TODO/v1-release: remove
|
|
54
|
+
// - I don't remember exactly, but I think I've added `TODO/v1-release: remove` because I vaguely remember that we can remove this after we remove the 0.4 design.
|
|
52
55
|
if (modulePath.endsWith('.css'))
|
|
53
56
|
return;
|
|
54
57
|
const isServerSide = options?.ssr;
|
|
@@ -60,7 +63,7 @@ function fileEnv() {
|
|
|
60
63
|
return;
|
|
61
64
|
// Show error message
|
|
62
65
|
let errMsg;
|
|
63
|
-
let modulePathPretty = (0,
|
|
66
|
+
let modulePathPretty = (0, getFilePath_js_1.getModuleFilePath)(moduleId, config);
|
|
64
67
|
modulePathPretty = modulePathPretty.replaceAll(suffix, picocolors_1.default.bold(suffix));
|
|
65
68
|
errMsg = `${(0, utils_js_1.capitalizeFirstLetter)(envExpect)}-only module ${modulePathPretty} (https://vike.dev/file-env) imported on the ${envActual}-side`;
|
|
66
69
|
if (importer &&
|
|
@@ -68,7 +71,7 @@ function fileEnv() {
|
|
|
68
71
|
!importer.includes('virtual:vike:') &&
|
|
69
72
|
// I don't know why and who sets importer to '<stdin>' (I guess Vite?)
|
|
70
73
|
importer !== '<stdin>') {
|
|
71
|
-
const importerPath = (0,
|
|
74
|
+
const importerPath = (0, getFilePath_js_1.getModuleFilePath)(importer, config);
|
|
72
75
|
errMsg += ` by ${importerPath}`;
|
|
73
76
|
}
|
|
74
77
|
if (isDev) {
|
|
@@ -14,6 +14,7 @@ const virtualFileImportUserCode_js_1 = require("../../../shared/virtual-files/vi
|
|
|
14
14
|
const getVikeConfig_js_1 = require("./v1-design/getVikeConfig.js");
|
|
15
15
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
16
16
|
const loggerNotProd_js_1 = require("../../shared/loggerNotProd.js");
|
|
17
|
+
const getFilePath_js_1 = require("../../shared/getFilePath.js");
|
|
17
18
|
function importUserCode() {
|
|
18
19
|
let config;
|
|
19
20
|
let configVike;
|
|
@@ -124,8 +125,11 @@ function isVikeConfigModule(filePathAbsoluteFilesystem) {
|
|
|
124
125
|
}
|
|
125
126
|
function reloadConfig(filePath, config, op) {
|
|
126
127
|
{
|
|
127
|
-
const
|
|
128
|
-
|
|
128
|
+
const { filePathToShowToUserResolved } = (0, getFilePath_js_1.getFilePathResolved)({
|
|
129
|
+
filePathAbsoluteFilesystem: filePath,
|
|
130
|
+
userRootDir: config.root
|
|
131
|
+
});
|
|
132
|
+
const msg = `${op} ${picocolors_1.default.dim(filePathToShowToUserResolved)}`;
|
|
129
133
|
(0, loggerNotProd_js_1.logConfigInfo)(msg, 'info');
|
|
130
134
|
}
|
|
131
135
|
(0, getVikeConfig_js_1.reloadVikeConfig)(config.root, (0, utils_js_1.getOutDirs)(config).outDirRoot);
|
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/loadFileAtConfigTime.js
CHANGED
|
@@ -12,7 +12,7 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
|
12
12
|
const transformFileImports_js_1 = require("./transformFileImports.js");
|
|
13
13
|
const getConfigFileExport_js_1 = require("../getConfigFileExport.js");
|
|
14
14
|
const resolveImportPath_js_1 = require("./resolveImportPath.js");
|
|
15
|
-
const getFilePath_js_1 = require("
|
|
15
|
+
const getFilePath_js_1 = require("../../../../shared/getFilePath.js");
|
|
16
16
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
17
17
|
// Load fake import
|
|
18
18
|
async function loadImportedFile(import_, userRootDir, importedFilesLoaded) {
|
|
@@ -82,7 +82,11 @@ async function loadExtendsConfigs(configFileExports, configFilePath, userRootDir
|
|
|
82
82
|
return { extendsConfigs, extendsFilePaths };
|
|
83
83
|
}
|
|
84
84
|
function warnUserLandExtension(importPath, configFilePath) {
|
|
85
|
-
|
|
85
|
+
// We preserve this feature because we may need it for eject
|
|
86
|
+
(0, utils_js_1.assertWarning)((0, utils_js_1.isNpmPackageImport)(importPath, {
|
|
87
|
+
// Vike config files don't support path aliases. (If they do one day, then Vike will/should be able to resolve path aliases.)
|
|
88
|
+
cannotBePathAlias: true
|
|
89
|
+
}) || importPath.includes('/node_modules/'), `${configFilePath.filePathToShowToUser} uses ${picocolors_1.default.cyan('extends')} to inherit from ${picocolors_1.default.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 });
|
|
86
90
|
}
|
|
87
91
|
function getExtendsImportData(configFileExports, configFilePath) {
|
|
88
92
|
const { filePathToShowToUser } = configFilePath;
|
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/resolveImportPath.js
CHANGED
|
@@ -8,7 +8,7 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
|
8
8
|
const utils_js_1 = require("../../../../utils.js");
|
|
9
9
|
const transformFileImports_js_1 = require("./transformFileImports.js");
|
|
10
10
|
const path_1 = __importDefault(require("path"));
|
|
11
|
-
const getFilePath_js_1 = require("
|
|
11
|
+
const getFilePath_js_1 = require("../../../../shared/getFilePath.js");
|
|
12
12
|
const filesEnvMap = new Map();
|
|
13
13
|
function resolveImport(configValue, importerFilePath, userRootDir, configEnv, configName) {
|
|
14
14
|
if (typeof configValue !== 'string')
|
|
@@ -20,6 +20,7 @@ function resolveImport(configValue, importerFilePath, userRootDir, configEnv, co
|
|
|
20
20
|
const filePathAbsoluteFilesystem = resolveImportPath(importData, importerFilePath);
|
|
21
21
|
assertFileEnv(filePathAbsoluteFilesystem ?? importPath, configEnv, configName);
|
|
22
22
|
const fileExportPathToShowToUser = exportName === 'default' || exportName === configName ? [] : [exportName];
|
|
23
|
+
let filePath;
|
|
23
24
|
if (importPath.startsWith('.')) {
|
|
24
25
|
// We need to resolve relative paths into absolute paths. Because the import paths are included in virtual files:
|
|
25
26
|
// ```
|
|
@@ -27,28 +28,30 @@ function resolveImport(configValue, importerFilePath, userRootDir, configEnv, co
|
|
|
27
28
|
// ```
|
|
28
29
|
assertImportPath(filePathAbsoluteFilesystem, importData, importerFilePath);
|
|
29
30
|
const filePathAbsoluteUserRootDir = resolveImportPath_absoluteUserRootDir(filePathAbsoluteFilesystem, importData, importerFilePath, userRootDir);
|
|
30
|
-
|
|
31
|
-
return {
|
|
32
|
-
...filePath,
|
|
33
|
-
fileExportName: exportName,
|
|
34
|
-
fileExportPathToShowToUser
|
|
35
|
-
};
|
|
31
|
+
filePath = (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir });
|
|
36
32
|
}
|
|
37
33
|
else {
|
|
38
34
|
// importPath can be:
|
|
39
35
|
// - an npm package import
|
|
40
36
|
// - a path alias
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
|
|
45
|
-
|
|
46
|
-
|
|
47
|
-
|
|
48
|
-
|
|
49
|
-
|
|
50
|
-
|
|
37
|
+
if (filePathAbsoluteFilesystem) {
|
|
38
|
+
filePath = (0, getFilePath_js_1.getFilePathResolved)({
|
|
39
|
+
userRootDir,
|
|
40
|
+
filePathAbsoluteFilesystem,
|
|
41
|
+
importPathAbsolute: importPath
|
|
42
|
+
});
|
|
43
|
+
}
|
|
44
|
+
else {
|
|
45
|
+
filePath = (0, getFilePath_js_1.getFilePathUnresolved)({
|
|
46
|
+
importPathAbsolute: importPath
|
|
47
|
+
});
|
|
48
|
+
}
|
|
51
49
|
}
|
|
50
|
+
return {
|
|
51
|
+
...filePath,
|
|
52
|
+
fileExportName: exportName,
|
|
53
|
+
fileExportPathToShowToUser
|
|
54
|
+
};
|
|
52
55
|
}
|
|
53
56
|
exports.resolveImport = resolveImport;
|
|
54
57
|
function resolveImportPath_absoluteUserRootDir(filePathAbsoluteFilesystem, importData, configFilePath, userRootDir) {
|
|
@@ -77,7 +80,8 @@ function resolveImportPath(importData, importerFilePath) {
|
|
|
77
80
|
const importerFilePathAbsolute = importerFilePath.filePathAbsoluteFilesystem;
|
|
78
81
|
(0, utils_js_1.assertPosixPath)(importerFilePathAbsolute);
|
|
79
82
|
const cwd = path_1.default.posix.dirname(importerFilePathAbsolute);
|
|
80
|
-
// We can't use import.meta.resolve() as of Junary 2023 (and probably for a lot longer)
|
|
83
|
+
// We can't use import.meta.resolve() as of Junary 2023 (and probably for a lot longer)
|
|
84
|
+
// https://stackoverflow.com/questions/54977743/do-require-resolve-for-es-modules#comment137174954_62272600:~:text=But%20the%20argument%20parent%20(aka%20cwd)%20still%20requires%20a%20flag
|
|
81
85
|
// filePathAbsoluteFilesystem is expected to be null when importData.importPath is a Vite path alias
|
|
82
86
|
const filePathAbsoluteFilesystem = (0, utils_js_1.requireResolve)(importData.importPath, cwd);
|
|
83
87
|
return filePathAbsoluteFilesystem;
|
|
@@ -73,7 +73,7 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
73
73
|
outfile: path_1.default.posix.join(
|
|
74
74
|
// Needed for correct inline source map
|
|
75
75
|
entryFileDir,
|
|
76
|
-
// `write: false` => no file is actually
|
|
76
|
+
// `write: false` => no file is actually emitted
|
|
77
77
|
'NEVER_EMITTED.js'),
|
|
78
78
|
logLevel: 'silent',
|
|
79
79
|
format: 'esm',
|
|
@@ -105,10 +105,10 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
105
105
|
return;
|
|
106
106
|
if (args.pluginData?.[useEsbuildResolver])
|
|
107
107
|
return;
|
|
108
|
-
const isImportAbsolute = !args.path.startsWith('.');
|
|
109
108
|
const { path, ...opts } = args;
|
|
110
109
|
opts.pluginData = { [useEsbuildResolver]: true };
|
|
111
110
|
const resolved = await build.resolve(path, opts);
|
|
111
|
+
resolved.path = (0, utils_js_1.toPosixPath)(resolved.path);
|
|
112
112
|
// vike-{react,vue,solid} follow the convention that their config export resolves to a file named +config.js
|
|
113
113
|
// - This is temporary, see comment below.
|
|
114
114
|
const isVikeExtensionConfigImport = resolved.path.endsWith('+config.js');
|
|
@@ -123,14 +123,15 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
123
123
|
// - For example if esbuild cannot resolve a path alias while Vite can.
|
|
124
124
|
// - When tsconfig.js#compilerOptions.paths is set, then esbuild is able to resolve the path alias.
|
|
125
125
|
resolved.errors.length > 0;
|
|
126
|
-
pointerImports_[
|
|
126
|
+
pointerImports_[resolved.path] = isPointerImport;
|
|
127
|
+
(0, utils_js_1.assertPosixPath)(resolved.path);
|
|
127
128
|
const isExternal = isPointerImport ||
|
|
128
|
-
// npm package imports that aren't pointer imports (e.g. Vite plugin
|
|
129
|
-
|
|
129
|
+
// npm package imports that aren't pointer imports (e.g. importing a Vite plugin)
|
|
130
|
+
resolved.path.includes('/node_modules/');
|
|
130
131
|
if (debug.isEnabled)
|
|
131
132
|
debug('onResolved()', { args, resolved, isPointerImport, isExternal });
|
|
132
133
|
if (isExternal) {
|
|
133
|
-
return { external: true, path:
|
|
134
|
+
return { external: true, path: resolved.path };
|
|
134
135
|
}
|
|
135
136
|
else {
|
|
136
137
|
return resolved;
|
|
@@ -20,7 +20,7 @@ const crawlPlusFiles_js_1 = require("./getVikeConfig/crawlPlusFiles.js");
|
|
|
20
20
|
const getConfigFileExport_js_1 = require("./getConfigFileExport.js");
|
|
21
21
|
const loadFileAtConfigTime_js_1 = require("./getVikeConfig/loadFileAtConfigTime.js");
|
|
22
22
|
const resolveImportPath_js_1 = require("./getVikeConfig/resolveImportPath.js");
|
|
23
|
-
const getFilePath_js_1 = require("
|
|
23
|
+
const getFilePath_js_1 = require("../../../shared/getFilePath.js");
|
|
24
24
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
25
25
|
let devServerIsCorrupt = false;
|
|
26
26
|
let wasConfigInvalid = null;
|
|
@@ -745,7 +745,7 @@ function getComputed(configValueSources, configDefinitions) {
|
|
|
745
745
|
}
|
|
746
746
|
async function findPlusFiles(userRootDir, outDirRoot, isDev) {
|
|
747
747
|
const files = await (0, crawlPlusFiles_js_1.crawlPlusFiles)(userRootDir, outDirRoot, isDev);
|
|
748
|
-
const plusFiles = files.map(({ filePathAbsoluteUserRootDir }) => (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir
|
|
748
|
+
const plusFiles = files.map(({ filePathAbsoluteUserRootDir }) => (0, getFilePath_js_1.getFilePathResolved)({ filePathAbsoluteUserRootDir, userRootDir }));
|
|
749
749
|
return plusFiles;
|
|
750
750
|
}
|
|
751
751
|
function getConfigName(filePath) {
|
|
@@ -1013,7 +1013,11 @@ function sortConfigValueSources(configValueSources, locationIdPage) {
|
|
|
1013
1013
|
// Sort after whether the config value was defined by an npm package
|
|
1014
1014
|
.sort((0, utils_js_1.makeFirst)(([, [source]]) => {
|
|
1015
1015
|
const { importPathAbsolute } = source.definedAt;
|
|
1016
|
-
return !!importPathAbsolute &&
|
|
1016
|
+
return (!!importPathAbsolute &&
|
|
1017
|
+
(0, utils_js_1.isNpmPackageImport)(importPathAbsolute, {
|
|
1018
|
+
// Vike config files don't support path aliases. (If they do one day, then Vike will/should be able to resolve path aliases.)
|
|
1019
|
+
cannotBePathAlias: true
|
|
1020
|
+
}));
|
|
1017
1021
|
}))
|
|
1018
1022
|
// Sort after the filesystem inheritance of the config value
|
|
1019
1023
|
.sort(([, [source1]], [, [source2]]) => (0, utils_js_1.reverse)((0, filesystemRouting_js_1.sortAfterInheritanceOrder)(source1.locationId, source2.locationId, locationIdPage))));
|
|
@@ -0,0 +1,142 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
5
|
+
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
+
exports.cleanFilePathUnkown = exports.getFilePathToShowToUserFromUnkown = exports.getModuleFilePath = exports.getFilePathUnresolved = exports.getFilePathResolved = void 0;
|
|
7
|
+
const path_1 = __importDefault(require("path"));
|
|
8
|
+
const utils_js_1 = require("../utils.js");
|
|
9
|
+
function getFilePathUnresolved({ importPathAbsolute }) {
|
|
10
|
+
return getFilePath({ importPathAbsolute, filePathAbsoluteUserRootDir: null });
|
|
11
|
+
}
|
|
12
|
+
exports.getFilePathUnresolved = getFilePathUnresolved;
|
|
13
|
+
function getFilePathResolved(args) {
|
|
14
|
+
const { userRootDir } = args;
|
|
15
|
+
const importPathAbsolute = args.importPathAbsolute ?? null;
|
|
16
|
+
let filePathAbsoluteFilesystem;
|
|
17
|
+
let filePathAbsoluteUserRootDir;
|
|
18
|
+
if ('filePathAbsoluteFilesystem' in args) {
|
|
19
|
+
filePathAbsoluteFilesystem = args.filePathAbsoluteFilesystem;
|
|
20
|
+
filePathAbsoluteUserRootDir = getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir });
|
|
21
|
+
}
|
|
22
|
+
else {
|
|
23
|
+
filePathAbsoluteUserRootDir = args.filePathAbsoluteUserRootDir;
|
|
24
|
+
filePathAbsoluteFilesystem = getFilePathAbsoluteUserFilesystem({ filePathAbsoluteUserRootDir, userRootDir });
|
|
25
|
+
}
|
|
26
|
+
let filePath;
|
|
27
|
+
const common = {
|
|
28
|
+
filePathAbsoluteUserRootDir,
|
|
29
|
+
importPathAbsolute,
|
|
30
|
+
userRootDir
|
|
31
|
+
};
|
|
32
|
+
if (importPathAbsolute) {
|
|
33
|
+
filePath = getFilePath({
|
|
34
|
+
...common,
|
|
35
|
+
importPathAbsolute
|
|
36
|
+
});
|
|
37
|
+
}
|
|
38
|
+
else {
|
|
39
|
+
(0, utils_js_1.assert)(filePathAbsoluteUserRootDir);
|
|
40
|
+
filePath = getFilePath({
|
|
41
|
+
...common,
|
|
42
|
+
filePathAbsoluteUserRootDir
|
|
43
|
+
});
|
|
44
|
+
}
|
|
45
|
+
(0, utils_js_1.assert)(filePathAbsoluteFilesystem);
|
|
46
|
+
(0, utils_js_1.assertPathIsFilesystemAbsolute)(filePathAbsoluteFilesystem);
|
|
47
|
+
const filePathToShowToUserResolved = filePathAbsoluteUserRootDir || filePathAbsoluteFilesystem;
|
|
48
|
+
(0, utils_js_1.assert)(filePathToShowToUserResolved);
|
|
49
|
+
const filePathResolved = {
|
|
50
|
+
...filePath,
|
|
51
|
+
filePathAbsoluteFilesystem,
|
|
52
|
+
filePathToShowToUserResolved
|
|
53
|
+
};
|
|
54
|
+
return filePathResolved;
|
|
55
|
+
}
|
|
56
|
+
exports.getFilePathResolved = getFilePathResolved;
|
|
57
|
+
function getFilePath(args) {
|
|
58
|
+
let filePathAbsoluteVite;
|
|
59
|
+
if (args.filePathAbsoluteUserRootDir !== null) {
|
|
60
|
+
filePathAbsoluteVite = args.filePathAbsoluteUserRootDir;
|
|
61
|
+
}
|
|
62
|
+
else {
|
|
63
|
+
(0, utils_js_1.assert)(args.importPathAbsolute !== null); // Help TS
|
|
64
|
+
filePathAbsoluteVite = args.importPathAbsolute;
|
|
65
|
+
}
|
|
66
|
+
const filePathToShowToUser = filePathAbsoluteVite;
|
|
67
|
+
(0, utils_js_1.assert)(filePathToShowToUser);
|
|
68
|
+
return {
|
|
69
|
+
...args,
|
|
70
|
+
filePathAbsoluteFilesystem: null,
|
|
71
|
+
filePathAbsoluteVite,
|
|
72
|
+
filePathToShowToUser
|
|
73
|
+
};
|
|
74
|
+
}
|
|
75
|
+
function getFilePathAbsoluteUserFilesystem({ filePathAbsoluteUserRootDir, userRootDir }) {
|
|
76
|
+
(0, utils_js_1.assertPosixPath)(filePathAbsoluteUserRootDir);
|
|
77
|
+
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
78
|
+
(0, utils_js_1.assertPathIsFilesystemAbsolute)(userRootDir);
|
|
79
|
+
const filePathAbsoluteFilesystem = path_1.default.posix.join(userRootDir, filePathAbsoluteUserRootDir);
|
|
80
|
+
(0, utils_js_1.assertPathIsFilesystemAbsolute)(userRootDir);
|
|
81
|
+
return filePathAbsoluteFilesystem;
|
|
82
|
+
}
|
|
83
|
+
function getFilePathAbsoluteUserRootDir({ filePathAbsoluteFilesystem, userRootDir }) {
|
|
84
|
+
(0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
|
|
85
|
+
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
86
|
+
(0, utils_js_1.assertPathIsFilesystemAbsolute)(filePathAbsoluteFilesystem);
|
|
87
|
+
(0, utils_js_1.assertPathIsFilesystemAbsolute)(userRootDir);
|
|
88
|
+
const filePathRelative = path_1.default.posix.relative(userRootDir, filePathAbsoluteFilesystem);
|
|
89
|
+
if (!filePathAbsoluteFilesystem.startsWith(userRootDir)) {
|
|
90
|
+
(0, utils_js_1.assert)(filePathRelative.startsWith('../'));
|
|
91
|
+
return null;
|
|
92
|
+
}
|
|
93
|
+
(0, utils_js_1.assert)(!filePathRelative.startsWith('.') && !filePathRelative.startsWith('/'));
|
|
94
|
+
const filePathAbsoluteUserRootDir = `/${filePathRelative}`;
|
|
95
|
+
(0, utils_js_1.assert)(filePathAbsoluteUserRootDir === getFilePathAbsoluteUserRootDir2(filePathAbsoluteFilesystem, userRootDir));
|
|
96
|
+
return filePathAbsoluteUserRootDir;
|
|
97
|
+
}
|
|
98
|
+
function getModuleFilePath(moduleId, config) {
|
|
99
|
+
const userRootDir = config.root;
|
|
100
|
+
(0, utils_js_1.assertPosixPath)(moduleId);
|
|
101
|
+
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
102
|
+
const filePathAbsoluteFilesystem = cleanModuleId(moduleId);
|
|
103
|
+
(0, utils_js_1.assertPathIsFilesystemAbsolute)(filePathAbsoluteFilesystem);
|
|
104
|
+
const filePath = getFilePathResolved({ filePathAbsoluteFilesystem, userRootDir });
|
|
105
|
+
return filePath.filePathToShowToUserResolved;
|
|
106
|
+
}
|
|
107
|
+
exports.getModuleFilePath = getModuleFilePath;
|
|
108
|
+
function getFilePathToShowToUserFromUnkown(
|
|
109
|
+
// We don't have any guarentee about filePath, e.g. about whether is filePathAbsoluteFilesystem or filePathAbsoluteUserRootDir
|
|
110
|
+
filePathUnkown, userRootDir) {
|
|
111
|
+
(0, utils_js_1.assertPosixPath)(userRootDir);
|
|
112
|
+
(0, utils_js_1.assertPathIsFilesystemAbsolute)(userRootDir);
|
|
113
|
+
filePathUnkown = cleanFilePathUnkown(filePathUnkown);
|
|
114
|
+
if (!filePathUnkown.startsWith(userRootDir)) {
|
|
115
|
+
return filePathUnkown;
|
|
116
|
+
}
|
|
117
|
+
else {
|
|
118
|
+
return getFilePathAbsoluteUserRootDir2(filePathUnkown, userRootDir);
|
|
119
|
+
}
|
|
120
|
+
}
|
|
121
|
+
exports.getFilePathToShowToUserFromUnkown = getFilePathToShowToUserFromUnkown;
|
|
122
|
+
function getFilePathAbsoluteUserRootDir2(filePathAbsoluteFilesystem, userRootDir) {
|
|
123
|
+
(0, utils_js_1.assert)(filePathAbsoluteFilesystem.startsWith(userRootDir));
|
|
124
|
+
let filePathAbsoluteUserRootDir = filePathAbsoluteFilesystem.slice(userRootDir.length);
|
|
125
|
+
if (!filePathAbsoluteUserRootDir.startsWith('/'))
|
|
126
|
+
filePathAbsoluteUserRootDir = '/' + filePathAbsoluteUserRootDir;
|
|
127
|
+
return filePathAbsoluteUserRootDir;
|
|
128
|
+
}
|
|
129
|
+
function cleanFilePathUnkown(filePathUnknown) {
|
|
130
|
+
filePathUnknown = (0, utils_js_1.toPosixPath)(filePathUnknown);
|
|
131
|
+
filePathUnknown = cleanModuleId(filePathUnknown);
|
|
132
|
+
return filePathUnknown;
|
|
133
|
+
}
|
|
134
|
+
exports.cleanFilePathUnkown = cleanFilePathUnkown;
|
|
135
|
+
function cleanModuleId(moduleId) {
|
|
136
|
+
// remove query
|
|
137
|
+
const parts = moduleId.split('?');
|
|
138
|
+
if (parts.length > 1)
|
|
139
|
+
parts.pop();
|
|
140
|
+
(0, utils_js_1.assert)(parts.length >= 1);
|
|
141
|
+
return parts.join('?');
|
|
142
|
+
}
|
|
@@ -9,6 +9,7 @@ exports.getPrettyErrMessage = exports.isEquivalentErrorWithCodeSnippet = exports
|
|
|
9
9
|
// Copied & adapted from https://github.com/vitejs/vite/blob/9c114c5c72a6af87e3330d5573362554b4511265/packages/vite/src/node/server/middlewares/error.ts
|
|
10
10
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
11
11
|
const utils_js_1 = require("../../utils.js");
|
|
12
|
+
const getFilePath_js_1 = require("../getFilePath.js");
|
|
12
13
|
function isErrorWithCodeSnippet(err) {
|
|
13
14
|
if (!(0, utils_js_1.isObject)(err)) {
|
|
14
15
|
return false;
|
|
@@ -48,7 +49,7 @@ function getPrettyErrorWithCodeSnippet(err, userRootDir) {
|
|
|
48
49
|
let { id, frame } = err;
|
|
49
50
|
const msgFirstLine = [
|
|
50
51
|
picocolors_1.default.red('Failed to transpile'),
|
|
51
|
-
picocolors_1.default.bold(picocolors_1.default.red((0,
|
|
52
|
+
picocolors_1.default.bold(picocolors_1.default.red((0, getFilePath_js_1.getFilePathToShowToUserFromUnkown)(id, userRootDir))),
|
|
52
53
|
picocolors_1.default.red('because:')
|
|
53
54
|
].join(' ');
|
|
54
55
|
const errMsg = getPrettyErrMessage(err);
|
|
@@ -88,7 +89,7 @@ function getPrettyErrMessage(err) {
|
|
|
88
89
|
// Remove "/home/rom/code/vike/examples/react-full/components/Counter.tsx:1:8:" (redundant since we already print the filename)
|
|
89
90
|
const pos = /(?:\:\d+|)/;
|
|
90
91
|
errMsg = errMsg.split(reg([id, pos, pos, trail], 'gi')).join('');
|
|
91
|
-
errMsg = errMsg.split(reg([
|
|
92
|
+
errMsg = errMsg.split(reg([(0, getFilePath_js_1.cleanFilePathUnkown)(id), pos, pos, trail], 'gi')).join('');
|
|
92
93
|
// Remove "ERROR:" (useless)
|
|
93
94
|
errMsg = errMsg.split(reg(['ERROR:', trail])).join('');
|
|
94
95
|
// Remove "Internal server error:" (useless)
|
|
@@ -160,9 +161,3 @@ exports.isEquivalentErrorWithCodeSnippet = isEquivalentErrorWithCodeSnippet;
|
|
|
160
161
|
function isDefinedAndSame(val1, val2) {
|
|
161
162
|
return val1 && val1 === val2;
|
|
162
163
|
}
|
|
163
|
-
function normalizeId(id) {
|
|
164
|
-
id = (0, utils_js_1.toPosixPath)(id);
|
|
165
|
-
// remove query
|
|
166
|
-
id = id.split('?')[0];
|
|
167
|
-
return id;
|
|
168
|
-
}
|
|
@@ -23,6 +23,7 @@ const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
|
23
23
|
const isNewError_js_1 = require("../../runtime/renderPage/isNewError.js");
|
|
24
24
|
const isConfigInvalid_js_1 = require("../../runtime/renderPage/isConfigInvalid.js");
|
|
25
25
|
const loggerProd_js_1 = require("../../runtime/renderPage/loggerProd.js");
|
|
26
|
+
const executeHook_js_1 = require("../../../shared/hooks/executeHook.js");
|
|
26
27
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
27
28
|
(0, loggerRuntime_js_1.overwriteRuntimeProductionLogger)(logRuntimeError, logRuntimeInfo);
|
|
28
29
|
(0, utils_js_1.overwriteAssertProductionLogger)(assertLogger);
|
|
@@ -99,7 +100,7 @@ function logErr(err, httpRequestId = null, errorComesFromVite) {
|
|
|
99
100
|
}
|
|
100
101
|
}
|
|
101
102
|
// Needs to be after assertion messages handling, because user hooks may throw an assertion error
|
|
102
|
-
const hook = (0,
|
|
103
|
+
const hook = (0, executeHook_js_1.isUserHookError)(err);
|
|
103
104
|
if (hook) {
|
|
104
105
|
const { hookName, hookFilePath } = hook;
|
|
105
106
|
(0, log_js_1.logWithVikeTag)(picocolors_1.default.red(`Following error was thrown by the ${hookName}() hook defined at ${hookFilePath}`), 'error', category);
|
|
@@ -22,7 +22,6 @@ const onLoad_js_1 = require("./onLoad.js");
|
|
|
22
22
|
__exportStar(require("../runtime/utils.js"), exports);
|
|
23
23
|
// Utils only needed by `plugin/*`
|
|
24
24
|
__exportStar(require("../../utils/viteIsSSR.js"), exports);
|
|
25
|
-
__exportStar(require("../../utils/getFilePathAbsolute.js"), exports);
|
|
26
25
|
__exportStar(require("../../utils/requireResolve.js"), exports);
|
|
27
26
|
__exportStar(require("../../utils/arrayIncludes.js"), exports);
|
|
28
27
|
__exportStar(require("../../utils/isDev.js"), exports);
|
|
@@ -42,3 +41,4 @@ __exportStar(require("../../utils/injectRollupInputs.js"), exports);
|
|
|
42
41
|
__exportStar(require("../../utils/humanizeTime.js"), exports);
|
|
43
42
|
__exportStar(require("../../utils/pLimit.js"), exports);
|
|
44
43
|
__exportStar(require("../../utils/assertVersion.js"), exports);
|
|
44
|
+
__exportStar(require("../../utils/assertPathIsFilesystemAbsolute.js"), exports);
|