vike 0.4.166 → 0.4.167-commit-c08a6bb
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/crawlPlusFiles.js +2 -0
- 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 +34 -23
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +33 -10
- 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/analyzePage.js +1 -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 +13 -1
- 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/crawlPlusFiles.js +2 -0
- 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.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +33 -22
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +34 -11
- 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/analyzePage.js +1 -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 +13 -1
- package/dist/esm/node/runtime/utils.d.ts +0 -1
- package/dist/esm/node/runtime/utils.js +0 -1
- package/dist/esm/shared/addUrlComputedProps.d.ts +2 -2
- 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
|
@@ -39,9 +39,8 @@ async function route(pageContextForRoute) {
|
|
|
39
39
|
(0, utils_js_1.objectAssign)(pageContext, pageContextFromOnBeforeRouteHook);
|
|
40
40
|
// Vike's routing
|
|
41
41
|
const allPageIds = pageContext._allPageIds;
|
|
42
|
-
(0, utils_js_1.
|
|
43
|
-
(0, utils_js_1.
|
|
44
|
-
(0, utils_js_1.assertUsage)(allPageIds.length > 0, "You must create at least one *.page.js file that isn't _default.page.*");
|
|
42
|
+
(0, utils_js_1.assertUsage)(allPageIds.length > 0, 'No page found. You must create at least one page.');
|
|
43
|
+
(0, utils_js_1.assert)(pageContext._pageFilesAll.length > 0 || pageContext._pageConfigs.length > 0);
|
|
45
44
|
const { urlPathname } = pageContext;
|
|
46
45
|
(0, utils_js_1.assert)(urlPathname.startsWith('/'));
|
|
47
46
|
const routeMatches = [];
|
|
@@ -35,7 +35,6 @@ __exportStar(require("../../utils/isStringRecord.js"), exports);
|
|
|
35
35
|
__exportStar(require("../../utils/unique.js"), exports);
|
|
36
36
|
__exportStar(require("../../utils/isBrowser.js"), exports);
|
|
37
37
|
__exportStar(require("../../utils/parseUrl.js"), exports);
|
|
38
|
-
__exportStar(require("../hooks/executeHook.js"), exports);
|
|
39
38
|
__exportStar(require("../../utils/checkType.js"), exports);
|
|
40
39
|
__exportStar(require("../../utils/joinEnglish.js"), exports);
|
|
41
40
|
__exportStar(require("../../utils/projectInfo.js"), exports);
|
|
@@ -14,35 +14,35 @@ exports.vikeVitePluginLoadedInProductionError = vikeVitePluginLoadedInProduction
|
|
|
14
14
|
const env = (0, getGlobalObject_js_1.getGlobalObject)('utils/assertIsNotProductionRuntime.ts', {});
|
|
15
15
|
// Called by Vike modules that want to ensure that they aren't loaded by the server runtime in production
|
|
16
16
|
function assertIsNotProductionRuntime() {
|
|
17
|
-
if (debug.
|
|
17
|
+
if (debug.isActivated)
|
|
18
18
|
debug('assertIsNotProductionRuntime()', new Error().stack);
|
|
19
19
|
env.shouldNotBeProduction = true;
|
|
20
20
|
}
|
|
21
21
|
exports.assertIsNotProductionRuntime = assertIsNotProductionRuntime;
|
|
22
22
|
// Called by Vite hook configureServer()
|
|
23
23
|
function markEnvAsViteDev() {
|
|
24
|
-
if (debug.
|
|
24
|
+
if (debug.isActivated)
|
|
25
25
|
debug('markEnvAsViteDev()', new Error().stack);
|
|
26
26
|
env.isViteDev = true;
|
|
27
27
|
}
|
|
28
28
|
exports.markEnvAsViteDev = markEnvAsViteDev;
|
|
29
29
|
// Called by Vite hook configurePreviewServer()
|
|
30
30
|
function markEnvAsVitePreview() {
|
|
31
|
-
if (debug.
|
|
31
|
+
if (debug.isActivated)
|
|
32
32
|
debug('markEnvAsVitePreview()', new Error().stack);
|
|
33
33
|
env.isVitePreview = true;
|
|
34
34
|
}
|
|
35
35
|
exports.markEnvAsVitePreview = markEnvAsVitePreview;
|
|
36
36
|
// Called by ../node/plugin/index.ts
|
|
37
37
|
function markEnvAsVikePluginLoaded() {
|
|
38
|
-
if (debug.
|
|
38
|
+
if (debug.isActivated)
|
|
39
39
|
debug('markEnvAsVikePluginLoaded()', new Error().stack);
|
|
40
40
|
env.isVikePluginLoaded = true;
|
|
41
41
|
}
|
|
42
42
|
exports.markEnvAsVikePluginLoaded = markEnvAsVikePluginLoaded;
|
|
43
43
|
// Called by ../node/runtime/index.ts
|
|
44
44
|
function assertEnv() {
|
|
45
|
-
if (debug.
|
|
45
|
+
if (debug.isActivated)
|
|
46
46
|
debug('assertEnv()', new Error().stack);
|
|
47
47
|
if ((0, isVitest_js_1.isVitest)())
|
|
48
48
|
return;
|
|
@@ -10,6 +10,7 @@ const filesystemPathHandling_js_1 = require("./filesystemPathHandling.js");
|
|
|
10
10
|
/** Assert path is absolute from the filesystem root */
|
|
11
11
|
function assertPathIsFilesystemAbsolute(p) {
|
|
12
12
|
(0, filesystemPathHandling_js_1.assertPosixPath)(p);
|
|
13
|
+
(0, assert_js_1.assert)(!p.startsWith('/@fs/'));
|
|
13
14
|
if (process.platform === 'win32') {
|
|
14
15
|
(0, assert_js_1.assert)(path_1.default.win32.isAbsolute(p));
|
|
15
16
|
}
|
package/dist/cjs/utils/debug.js
CHANGED
|
@@ -1,17 +1,39 @@
|
|
|
1
1
|
"use strict";
|
|
2
|
+
var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
3
|
+
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
|
+
};
|
|
2
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.
|
|
6
|
+
exports.isDebugActivated = exports.createDebugger = void 0;
|
|
4
7
|
const isBrowser_js_1 = require("./isBrowser.js");
|
|
5
8
|
const isCallable_js_1 = require("./isCallable.js");
|
|
6
9
|
const objectAssign_js_1 = require("./objectAssign.js");
|
|
7
10
|
const assert_js_1 = require("./assert.js");
|
|
8
11
|
const checkType_js_1 = require("./checkType.js");
|
|
9
12
|
const getTerminWidth_js_1 = require("./getTerminWidth.js");
|
|
13
|
+
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
10
14
|
// Avoid this to be loaded in the browser. For isomorphic code: instead of `import { createDebugger } from './utils.js'`, use `globalThis.createDebugger()`.
|
|
11
15
|
(0, assert_js_1.assert)(!(0, isBrowser_js_1.isBrowser)());
|
|
12
16
|
globalThis.__brillout_debug_createDebugger = createDebugger;
|
|
17
|
+
const flags = [
|
|
18
|
+
'vike:error',
|
|
19
|
+
'vike:extractAssets',
|
|
20
|
+
'vike:extractExportNames',
|
|
21
|
+
'vike:glob',
|
|
22
|
+
'vike:log',
|
|
23
|
+
'vike:optimizeDeps',
|
|
24
|
+
'vike:outDir',
|
|
25
|
+
'vike:pageFiles',
|
|
26
|
+
'vike:pointer-imports',
|
|
27
|
+
'vike:routing',
|
|
28
|
+
'vike:setup',
|
|
29
|
+
'vike:stream',
|
|
30
|
+
'vike:virtual-files'
|
|
31
|
+
];
|
|
32
|
+
const flagRegex = /\bvike:[a-zA-Z-]+/g;
|
|
33
|
+
assertDEBUG();
|
|
13
34
|
function createDebugger(flag, optionsGlobal) {
|
|
14
35
|
(0, checkType_js_1.checkType)(flag);
|
|
36
|
+
(0, assert_js_1.assert)(flags.includes(flag));
|
|
15
37
|
const debugWithOptions = (optionsLocal) => {
|
|
16
38
|
return (...msgs) => {
|
|
17
39
|
const options = { ...optionsGlobal, ...optionsLocal };
|
|
@@ -19,12 +41,12 @@ function createDebugger(flag, optionsGlobal) {
|
|
|
19
41
|
};
|
|
20
42
|
};
|
|
21
43
|
const debug = (...msgs) => debugWithOptions({})(...msgs);
|
|
22
|
-
(0, objectAssign_js_1.objectAssign)(debug, { options: debugWithOptions,
|
|
44
|
+
(0, objectAssign_js_1.objectAssign)(debug, { options: debugWithOptions, isActivated: isDebugActivated(flag) });
|
|
23
45
|
return debug;
|
|
24
46
|
}
|
|
25
47
|
exports.createDebugger = createDebugger;
|
|
26
48
|
function debug_(flag, options, ...msgs) {
|
|
27
|
-
if (!
|
|
49
|
+
if (!isDebugActivated(flag))
|
|
28
50
|
return;
|
|
29
51
|
let [msgFirst, ...msgsRest] = msgs;
|
|
30
52
|
const padding = ' '.repeat(flag.length + 1);
|
|
@@ -49,19 +71,14 @@ function debug_(flag, options, ...msgs) {
|
|
|
49
71
|
console.log(msg);
|
|
50
72
|
});
|
|
51
73
|
}
|
|
52
|
-
function
|
|
74
|
+
function isDebugActivated(flag) {
|
|
53
75
|
(0, checkType_js_1.checkType)(flag);
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
|
|
57
|
-
|
|
58
|
-
DEBUG = process.env.DEBUG;
|
|
59
|
-
}
|
|
60
|
-
catch { }
|
|
61
|
-
const isEnabled = DEBUG?.includes(flag) ?? false;
|
|
62
|
-
return isEnabled;
|
|
76
|
+
(0, assert_js_1.assert)(flags.includes(flag));
|
|
77
|
+
const DEBUG = getDEBUG();
|
|
78
|
+
const isActivated = DEBUG?.includes(flag) ?? false;
|
|
79
|
+
return isActivated;
|
|
63
80
|
}
|
|
64
|
-
exports.
|
|
81
|
+
exports.isDebugActivated = isDebugActivated;
|
|
65
82
|
function formatMsg(info, options, padding, position) {
|
|
66
83
|
if (info === undefined) {
|
|
67
84
|
return undefined;
|
|
@@ -122,3 +139,20 @@ function replaceFunctionSerializer(_key, value) {
|
|
|
122
139
|
}
|
|
123
140
|
return value;
|
|
124
141
|
}
|
|
142
|
+
function assertDEBUG() {
|
|
143
|
+
const DEBUG = getDEBUG() ?? '';
|
|
144
|
+
const flagsActivated = DEBUG.match(flagRegex) ?? [];
|
|
145
|
+
flagsActivated.forEach((flag) => {
|
|
146
|
+
(0, assert_js_1.assertUsage)(flags.includes(flag), `Unknown DEBUG flag ${picocolors_1.default.cyan(flag)}. Valid flags:\n${flags.map((f) => ` ${picocolors_1.default.cyan(f)}`).join('\n')}`);
|
|
147
|
+
});
|
|
148
|
+
}
|
|
149
|
+
function getDEBUG() {
|
|
150
|
+
let DEBUG;
|
|
151
|
+
// - `process` can be undefined in edge workers
|
|
152
|
+
// - We want bundlers to be able to statically replace `process.env.*`
|
|
153
|
+
try {
|
|
154
|
+
DEBUG = process.env.DEBUG;
|
|
155
|
+
}
|
|
156
|
+
catch { }
|
|
157
|
+
return DEBUG;
|
|
158
|
+
}
|
|
@@ -1,14 +1,23 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isDistinguishable = exports.parse = exports.isValidPathAlias = exports.isNpmPackageImport = void 0;
|
|
3
|
+
exports.isDistinguishable = exports.parse = exports.isValidPathAlias = exports.assertIsNpmPackageImport = exports.isNpmPackageImport = void 0;
|
|
4
4
|
const assert_js_1 = require("./assert.js");
|
|
5
5
|
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
6
6
|
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
7
|
-
function isNpmPackageImport(str) {
|
|
7
|
+
function isNpmPackageImport(str, { cannotBePathAlias }) {
|
|
8
|
+
// We cannot distinguish path alises that look like npm package imports
|
|
9
|
+
(0, assert_js_1.assert)(cannotBePathAlias);
|
|
8
10
|
const res = parse(str);
|
|
9
11
|
return res !== null;
|
|
10
12
|
}
|
|
11
13
|
exports.isNpmPackageImport = isNpmPackageImport;
|
|
14
|
+
function assertIsNpmPackageImport(str) {
|
|
15
|
+
(0, assert_js_1.assert)(isNpmPackageImport(str, {
|
|
16
|
+
// If `str` is a path alias that looks like an npm package => assertIsNpmPackageImport() is erroneous but that's okay because the assertion will eventually fail for some other user using a disambiguated path alias.
|
|
17
|
+
cannotBePathAlias: true
|
|
18
|
+
}));
|
|
19
|
+
}
|
|
20
|
+
exports.assertIsNpmPackageImport = assertIsNpmPackageImport;
|
|
12
21
|
function isNpmPackageName(str) {
|
|
13
22
|
const res = parse(str);
|
|
14
23
|
return res !== null && res.importPath === null;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
3
|
exports.PROJECT_VERSION = exports.projectInfo = void 0;
|
|
4
|
-
const PROJECT_VERSION = '0.4.
|
|
4
|
+
const PROJECT_VERSION = '0.4.167-commit-c08a6bb';
|
|
5
5
|
exports.PROJECT_VERSION = PROJECT_VERSION;
|
|
6
6
|
const projectInfo = {
|
|
7
7
|
projectName: 'Vike',
|
|
@@ -7,7 +7,7 @@ const debug_js_1 = require("./debug.js");
|
|
|
7
7
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
8
8
|
const assertIsNotBrowser_js_1 = require("./assertIsNotBrowser.js");
|
|
9
9
|
(0, assertIsNotBrowser_js_1.assertIsNotBrowser)();
|
|
10
|
-
if ((0, debug_js_1.
|
|
10
|
+
if ((0, debug_js_1.isDebugActivated)('vike:log')) {
|
|
11
11
|
trackLogs();
|
|
12
12
|
}
|
|
13
13
|
// https://stackoverflow.com/questions/45395369/how-to-get-console-log-line-numbers-shown-in-nodejs/75109905#75109905
|
|
@@ -22,7 +22,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
22
22
|
const { scrollTarget, urlOriginal = getCurrentUrl(), overwriteLastHistoryEntry = false, isBackwardNavigation, pageContextsFromRewrite = [], redirectCount = 0, isUserLandPushStateNavigation, isClientSideNavigation = true } = renderArgs;
|
|
23
23
|
// isHydrationRender <=> the first render attempt
|
|
24
24
|
const { isRenderOutdated, setHydrationCanBeAborted, isHydrationRender } = getIsRenderOutdated();
|
|
25
|
-
assert(isClientSideNavigation === !isHydrationRender);
|
|
25
|
+
assert(isClientSideNavigation === !isHydrationRender); // isHydrationRender === (renderNumber === 1)
|
|
26
26
|
assertNoInfiniteAbortLoop(pageContextsFromRewrite.length, redirectCount);
|
|
27
27
|
if (globalObject.clientRoutingIsDisabled) {
|
|
28
28
|
serverSideRouteTo(urlOriginal);
|
|
@@ -37,6 +37,31 @@ async function renderPageClientSide(renderArgs) {
|
|
|
37
37
|
const pageContext = await getPageContextBegin();
|
|
38
38
|
if (isRenderOutdated())
|
|
39
39
|
return;
|
|
40
|
+
// onPageTransitionStart()
|
|
41
|
+
if (globalObject.isFirstRenderDone) {
|
|
42
|
+
const { previousPageContext } = globalObject;
|
|
43
|
+
assert(previousPageContext);
|
|
44
|
+
// We use the hook of the previous page in order to be able to call onPageTransitionStart() before fetching the files of the next page.
|
|
45
|
+
// https://github.com/vikejs/vike/issues/1560
|
|
46
|
+
assertHook(previousPageContext, 'onPageTransitionStart');
|
|
47
|
+
if (!globalObject.isTransitioning) {
|
|
48
|
+
globalObject.isTransitioning = true;
|
|
49
|
+
const onPageTransitionStartHook = getHook(previousPageContext, 'onPageTransitionStart');
|
|
50
|
+
if (onPageTransitionStartHook) {
|
|
51
|
+
const hook = onPageTransitionStartHook;
|
|
52
|
+
const { hookFn } = hook;
|
|
53
|
+
try {
|
|
54
|
+
await executeHook(() => hookFn(pageContext), hook);
|
|
55
|
+
}
|
|
56
|
+
catch (err) {
|
|
57
|
+
await onError(err);
|
|
58
|
+
return;
|
|
59
|
+
}
|
|
60
|
+
if (isRenderOutdated())
|
|
61
|
+
return;
|
|
62
|
+
}
|
|
63
|
+
}
|
|
64
|
+
}
|
|
40
65
|
// Route
|
|
41
66
|
let pageContextRouted;
|
|
42
67
|
if (isHydrationRender) {
|
|
@@ -104,27 +129,6 @@ async function renderPageClientSide(renderArgs) {
|
|
|
104
129
|
// There wasn't any `await` but result may change because we just called setHydrationCanBeAborted()
|
|
105
130
|
if (isRenderOutdated())
|
|
106
131
|
return;
|
|
107
|
-
// onPageTransitionStart()
|
|
108
|
-
if (!isHydrationRender) {
|
|
109
|
-
assertHook(pageContext, 'onPageTransitionStart');
|
|
110
|
-
if (!globalObject.isTransitioning) {
|
|
111
|
-
globalObject.isTransitioning = true;
|
|
112
|
-
const onPageTransitionStartHook = getHook(pageContext, 'onPageTransitionStart');
|
|
113
|
-
if (onPageTransitionStartHook) {
|
|
114
|
-
const hook = onPageTransitionStartHook;
|
|
115
|
-
const { hookFn } = hook;
|
|
116
|
-
try {
|
|
117
|
-
await executeHook(() => hookFn(pageContext), hook);
|
|
118
|
-
}
|
|
119
|
-
catch (err) {
|
|
120
|
-
await onError(err);
|
|
121
|
-
return;
|
|
122
|
-
}
|
|
123
|
-
if (isRenderOutdated())
|
|
124
|
-
return;
|
|
125
|
-
}
|
|
126
|
-
}
|
|
127
|
-
}
|
|
128
132
|
// Get pageContext from hooks (fetched from server, and/or directly called on the client-side)
|
|
129
133
|
if (isHydrationRender) {
|
|
130
134
|
assert(hasProp(pageContext, '_hasPageContextFromServer', 'true'));
|
|
@@ -328,6 +332,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
328
332
|
onRenderClientError = err;
|
|
329
333
|
}
|
|
330
334
|
globalObject.onRenderClientPromise = undefined;
|
|
335
|
+
globalObject.isFirstRenderDone = true;
|
|
331
336
|
return onRenderClientError;
|
|
332
337
|
})();
|
|
333
338
|
const onRenderClientError = await globalObject.onRenderClientPromise;
|
|
@@ -365,8 +370,10 @@ async function renderPageClientSide(renderArgs) {
|
|
|
365
370
|
// onPageTransitionEnd()
|
|
366
371
|
if (globalObject.isTransitioning) {
|
|
367
372
|
globalObject.isTransitioning = undefined;
|
|
368
|
-
|
|
369
|
-
|
|
373
|
+
const { previousPageContext } = globalObject;
|
|
374
|
+
assert(previousPageContext);
|
|
375
|
+
assertHook(previousPageContext, 'onPageTransitionEnd');
|
|
376
|
+
const hook = getHook(previousPageContext, 'onPageTransitionEnd');
|
|
370
377
|
if (hook) {
|
|
371
378
|
const { hookFn } = hook;
|
|
372
379
|
try {
|
|
@@ -2,7 +2,7 @@ export { buildConfig };
|
|
|
2
2
|
export { assertRollupInput };
|
|
3
3
|
export { analyzeClientEntries };
|
|
4
4
|
export { manifestTempFile };
|
|
5
|
-
import { assert, resolveOutDir, viteIsSSR,
|
|
5
|
+
import { assert, resolveOutDir, viteIsSSR, addOnBeforeLogHook, removeFileExtention, unique, assertUsage, injectRollupInputs, normalizeRollupInput, getOutDirs, assertNodeEnv_build, assertIsNpmPackageImport } from '../utils.js';
|
|
6
6
|
import { getVikeConfig, isV1Design } from './importUserCode/v1-design/getVikeConfig.js';
|
|
7
7
|
import { getConfigValue } from '../../../shared/page-configs/helpers.js';
|
|
8
8
|
import { findPageFiles } from '../shared/findPageFiles.js';
|
|
@@ -16,6 +16,7 @@ import path from 'path';
|
|
|
16
16
|
import { fixServerAssets, fixServerAssets_isEnabled } from './buildConfig/fixServerAssets.js';
|
|
17
17
|
import { set_constant_ASSETS_MAP } from './importBuild/index.js';
|
|
18
18
|
import { prependEntriesDir } from '../../shared/prependEntriesDir.js';
|
|
19
|
+
import { getFilePathResolved } from '../shared/getFilePath.js';
|
|
19
20
|
// @ts-ignore Shimmed by dist-cjs-fixup.js for CJS build.
|
|
20
21
|
const importMetaUrl = import.meta.url;
|
|
21
22
|
const require_ = createRequire(importMetaUrl);
|
|
@@ -200,18 +201,22 @@ async function getPageFileEntries(config, includeAssetsImportedByServer) {
|
|
|
200
201
|
return pageFileEntries;
|
|
201
202
|
}
|
|
202
203
|
function getEntryFromClientEntry(clientEntry, config, addExtractAssetsQuery) {
|
|
203
|
-
if (
|
|
204
|
+
if (!clientEntry.startsWith('/')) {
|
|
205
|
+
assertIsNpmPackageImport(clientEntry);
|
|
204
206
|
const entryTarget = clientEntry;
|
|
205
207
|
const entryName = prependEntriesDir(clientEntry);
|
|
206
208
|
return { entryName, entryTarget };
|
|
207
209
|
}
|
|
208
|
-
const
|
|
209
|
-
|
|
210
|
-
|
|
211
|
-
|
|
210
|
+
const filePathAbsoluteUserRootDir = clientEntry;
|
|
211
|
+
assert(filePathAbsoluteUserRootDir.startsWith('/'));
|
|
212
|
+
const filePath = getFilePathResolved({
|
|
213
|
+
filePathAbsoluteUserRootDir,
|
|
214
|
+
userRootDir: config.root
|
|
215
|
+
});
|
|
216
|
+
let entryTarget = filePath.filePathAbsoluteFilesystem;
|
|
212
217
|
if (addExtractAssetsQuery)
|
|
213
218
|
entryTarget = extractAssetsAddQuery(entryTarget);
|
|
214
|
-
let entryName =
|
|
219
|
+
let entryName = filePathAbsoluteUserRootDir;
|
|
215
220
|
if (addExtractAssetsQuery)
|
|
216
221
|
entryName = extractAssetsAddQuery(entryName);
|
|
217
222
|
entryName = removeFileExtention(entryName);
|
|
@@ -13,8 +13,9 @@ import pc from '@brillout/picocolors';
|
|
|
13
13
|
// - Aliases react imports
|
|
14
14
|
// - @vitejs/plugin-vue2
|
|
15
15
|
// - https://github.com/vikejs/vike/issues/1329
|
|
16
|
-
// TODO/v1-release: replace assertWarning() with assertUsage()
|
|
17
16
|
function assertResolveAlias(config) {
|
|
17
|
+
// TODO: re-implement warning https://github.com/vikejs/vike/issues/1567
|
|
18
|
+
return;
|
|
18
19
|
const aliases = getAliases(config);
|
|
19
20
|
const errPrefix = config.configFile || 'Your Vite configuration';
|
|
20
21
|
const errSuffix1 = 'see https://vike.dev/path-aliases#vite';
|
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
export { determineOptimizeDeps };
|
|
2
2
|
import { findPageFiles } from '../../shared/findPageFiles.js';
|
|
3
|
-
import { assert,
|
|
3
|
+
import { assert, assertIsNpmPackageImport, createDebugger, unique } from '../../utils.js';
|
|
4
4
|
import { getVikeConfig } from '../importUserCode/v1-design/getVikeConfig.js';
|
|
5
5
|
import { getConfigValueSourcesNotOverriden } from '../../shared/getConfigValueSourcesNotOverriden.js';
|
|
6
6
|
import { analyzeClientEntries } from '../buildConfig.js';
|
|
7
7
|
import { virtualFileIdImportUserCodeClientCR, virtualFileIdImportUserCodeClientSR } from '../../../shared/virtual-files/virtualFileImportUserCode.js';
|
|
8
|
+
import { getFilePathResolved } from '../../shared/getFilePath.js';
|
|
9
|
+
const debug = createDebugger('vike:optimizeDeps');
|
|
8
10
|
async function determineOptimizeDeps(config, isDev) {
|
|
9
11
|
const { pageConfigs } = await getVikeConfig(config, isDev);
|
|
10
12
|
const { entries, include } = await getPageDeps(config, pageConfigs, isDev);
|
|
@@ -21,7 +23,11 @@ async function determineOptimizeDeps(config, isDev) {
|
|
|
21
23
|
*/
|
|
22
24
|
config.optimizeDeps.include = [...include, ...normalizeInclude(config.optimizeDeps.include)];
|
|
23
25
|
config.optimizeDeps.entries = [...entries, ...normalizeEntries(config.optimizeDeps.entries)];
|
|
24
|
-
|
|
26
|
+
if (debug.isActivated)
|
|
27
|
+
debug('config.optimizeDeps', {
|
|
28
|
+
'config.optimizeDeps.entries': config.optimizeDeps.entries,
|
|
29
|
+
'config.optimizeDeps.include': config.optimizeDeps.include
|
|
30
|
+
});
|
|
25
31
|
}
|
|
26
32
|
async function getPageDeps(config, pageConfigs, isDev) {
|
|
27
33
|
let entries = [];
|
|
@@ -44,24 +50,10 @@ async function getPageDeps(config, pageConfigs, isDev) {
|
|
|
44
50
|
else {
|
|
45
51
|
// Adding definedAt.filePathAbsoluteFilesystem doesn't work for npm packages, I guess because of Vite's config.server.fs.allow
|
|
46
52
|
const { importPathAbsolute } = definedAt;
|
|
47
|
-
assert(importPathAbsolute);
|
|
48
|
-
//
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
if (isNpmPackageImport(importPathAbsolute)) {
|
|
52
|
-
// isNpmPackageImport() returns false for a path alias like #root/renderer/onRenderClient
|
|
53
|
-
assert(!importPathAbsolute.startsWith('#'));
|
|
54
|
-
include.push(importPathAbsolute);
|
|
55
|
-
}
|
|
56
|
-
else {
|
|
57
|
-
/* Path aliases, e.g.:
|
|
58
|
-
* ```js
|
|
59
|
-
* // /renderer/+config.js
|
|
60
|
-
* import onRenderClient from '#root/renderer/onRenderClient'
|
|
61
|
-
* ```
|
|
62
|
-
*/
|
|
63
|
-
entries.push(importPathAbsolute);
|
|
64
|
-
}
|
|
53
|
+
assert(importPathAbsolute); // Help TS
|
|
54
|
+
// Shouldn't be a path alias, as path aliases would need to be added to config.optimizeDeps.entries instead of config.optimizeDeps.include
|
|
55
|
+
assertIsNpmPackageImport(importPathAbsolute);
|
|
56
|
+
include.push(importPathAbsolute);
|
|
65
57
|
}
|
|
66
58
|
});
|
|
67
59
|
});
|
|
@@ -69,9 +61,12 @@ async function getPageDeps(config, pageConfigs, isDev) {
|
|
|
69
61
|
// V0.4 design
|
|
70
62
|
{
|
|
71
63
|
const pageFiles = await findPageFiles(config, ['.page', '.page.client'], isDev);
|
|
72
|
-
|
|
73
|
-
|
|
74
|
-
|
|
64
|
+
const userRootDir = config.root;
|
|
65
|
+
pageFiles.forEach((filePathAbsoluteUserRootDir) => {
|
|
66
|
+
const entry = getFilePathResolved({ filePathAbsoluteUserRootDir, userRootDir });
|
|
67
|
+
const { filePathAbsoluteFilesystem } = entry;
|
|
68
|
+
assert(filePathAbsoluteFilesystem);
|
|
69
|
+
entries.push(filePathAbsoluteFilesystem);
|
|
75
70
|
});
|
|
76
71
|
}
|
|
77
72
|
entries = unique(entries);
|
|
@@ -2,8 +2,9 @@ export { envVarsPlugin };
|
|
|
2
2
|
// For ./envVars.spec.ts
|
|
3
3
|
export { applyEnvVar };
|
|
4
4
|
import { loadEnv } from 'vite';
|
|
5
|
-
import { assert, assertPosixPath, assertUsage, assertWarning, escapeRegex,
|
|
5
|
+
import { assert, assertPosixPath, assertUsage, assertWarning, escapeRegex, lowerFirst } from '../utils.js';
|
|
6
6
|
import { sourceMapPassthrough } from '../shared/rollupSourceMap.js';
|
|
7
|
+
import { getModuleFilePath } from '../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 = 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
|
assertUsage(false, errMsg);
|
|
54
55
|
}
|
|
@@ -6,7 +6,7 @@
|
|
|
6
6
|
// - This appraoch supports import path aliases `vite.config.js#resolve.alias` https://vitejs.dev/config/#resolve-alias
|
|
7
7
|
export { extractAssetsPlugin };
|
|
8
8
|
export { extractAssetsRE };
|
|
9
|
-
import { viteIsSSR_options, assert, assertPosixPath, styleFileRE, createDebugger,
|
|
9
|
+
import { viteIsSSR_options, assert, assertPosixPath, styleFileRE, createDebugger, isScriptFile, resolveVirtualFileId, isVirtualFileId, getVirtualFileId, assertUsage } from '../utils.js';
|
|
10
10
|
import { extractAssetsAddQuery } from '../../shared/extractAssetsQuery.js';
|
|
11
11
|
import { getConfigVike } from '../../shared/getConfigVike.js';
|
|
12
12
|
import { isAsset } from '../shared/isAsset.js';
|
|
@@ -20,9 +20,7 @@ const extractAssetsRE = /(\?|&)extractAssets(?:&|$)/;
|
|
|
20
20
|
const rawRE = /(\?|&)raw(?:&|$)/;
|
|
21
21
|
const urlRE = /(\?|&)url(?:&|$)/;
|
|
22
22
|
const EMPTY_MODULE_ID = 'virtual:vike:empty-module';
|
|
23
|
-
const
|
|
24
|
-
const debug = createDebugger(debugNamespace);
|
|
25
|
-
const debugEnabled = isDebugEnabled(debugNamespace);
|
|
23
|
+
const debug = createDebugger('vike:extractAssets');
|
|
26
24
|
function extractAssetsPlugin() {
|
|
27
25
|
let config;
|
|
28
26
|
let configVike;
|
|
@@ -119,12 +117,6 @@ function extractAssetsPlugin() {
|
|
|
119
117
|
{
|
|
120
118
|
name: 'vike:extractAssets-3',
|
|
121
119
|
apply: 'build',
|
|
122
|
-
async configResolved(config_) {
|
|
123
|
-
configVike = await getConfigVike(config_);
|
|
124
|
-
config = config_;
|
|
125
|
-
vikeConfig = await getVikeConfig(config, false);
|
|
126
|
-
isServerAssetsFixEnabled = fixServerAssets_isEnabled() && (await isV1Design(config, false));
|
|
127
|
-
},
|
|
128
120
|
load(id) {
|
|
129
121
|
if (!isVirtualFileId(id))
|
|
130
122
|
return undefined;
|
|
@@ -134,16 +126,22 @@ function extractAssetsPlugin() {
|
|
|
134
126
|
}
|
|
135
127
|
},
|
|
136
128
|
config() {
|
|
137
|
-
if (
|
|
129
|
+
if (debug.isActivated) {
|
|
138
130
|
return { logLevel: 'silent' };
|
|
139
131
|
}
|
|
140
132
|
}
|
|
141
133
|
},
|
|
142
134
|
{
|
|
143
135
|
name: 'vike:extractAssets-4',
|
|
144
|
-
configResolved(
|
|
145
|
-
|
|
146
|
-
|
|
136
|
+
async configResolved(config_) {
|
|
137
|
+
configVike = await getConfigVike(config_);
|
|
138
|
+
config = config_;
|
|
139
|
+
vikeConfig = await getVikeConfig(config, false);
|
|
140
|
+
isServerAssetsFixEnabled = fixServerAssets_isEnabled() && (await isV1Design(config, false));
|
|
141
|
+
if (!isServerAssetsFixEnabled) {
|
|
142
|
+
// https://github.com/vikejs/vike/issues/1060
|
|
143
|
+
assertUsage(!config.plugins.find((p) => p.name === 'vite-tsconfig-paths'), 'vite-tsconfig-paths not supported, remove it and use vite.config.js#resolve.alias instead');
|
|
144
|
+
}
|
|
147
145
|
}
|
|
148
146
|
}
|
|
149
147
|
];
|
|
@@ -1,13 +1,11 @@
|
|
|
1
1
|
export { extractExportNamesPlugin };
|
|
2
2
|
export { isUsingClientRouter };
|
|
3
3
|
export { extractExportNamesRE };
|
|
4
|
-
import { assert, getFileExtension, viteIsSSR_options, createDebugger,
|
|
4
|
+
import { assert, getFileExtension, viteIsSSR_options, createDebugger, getGlobalObject, assertUsage } from '../utils.js';
|
|
5
5
|
import { getExportNames } from '../shared/parseEsModule.js';
|
|
6
6
|
import { sourceMapRemove } from '../shared/rollupSourceMap.js';
|
|
7
7
|
const extractExportNamesRE = /(\?|&)extractExportNames(?:&|$)/;
|
|
8
|
-
const
|
|
9
|
-
const debug = createDebugger(debugNamespace);
|
|
10
|
-
const debugEnabled = isDebugEnabled(debugNamespace);
|
|
8
|
+
const debug = createDebugger('vike:extractExportNames');
|
|
11
9
|
const globalObject = getGlobalObject('extractExportNamesPlugin.ts', {});
|
|
12
10
|
function extractExportNamesPlugin() {
|
|
13
11
|
let isDev = false;
|
|
@@ -26,7 +24,7 @@ function extractExportNamesPlugin() {
|
|
|
26
24
|
isDev = true;
|
|
27
25
|
},
|
|
28
26
|
config() {
|
|
29
|
-
if (
|
|
27
|
+
if (debug.isActivated) {
|
|
30
28
|
return { logLevel: 'silent' };
|
|
31
29
|
}
|
|
32
30
|
}
|
|
@@ -1,8 +1,9 @@
|
|
|
1
1
|
export { fileEnv };
|
|
2
|
-
import { assert, assertUsage, assertWarning, capitalizeFirstLetter
|
|
2
|
+
import { assert, assertUsage, assertWarning, capitalizeFirstLetter } from '../utils.js';
|
|
3
3
|
import { extractAssetsRE } from './extractAssetsPlugin.js';
|
|
4
4
|
import { extractExportNamesRE } from './extractExportNamesPlugin.js';
|
|
5
5
|
import pc from '@brillout/picocolors';
|
|
6
|
+
import { getModuleFilePath } from '../shared/getFilePath.js';
|
|
6
7
|
function fileEnv() {
|
|
7
8
|
let config;
|
|
8
9
|
let isDev = false;
|
|
@@ -39,11 +40,13 @@ function fileEnv() {
|
|
|
39
40
|
// resolved is null when import path is erroneous and doesn't actually point to a file
|
|
40
41
|
if (!resolved)
|
|
41
42
|
return;
|
|
42
|
-
const
|
|
43
|
+
const moduleId = resolved.id;
|
|
44
|
+
const modulePath = moduleId.split('?')[0];
|
|
43
45
|
// `.server.js` and `.client.js` should only apply to user files
|
|
44
46
|
if (modulePath.includes('/node_modules/'))
|
|
45
47
|
return;
|
|
46
48
|
// TODO/v1-release: remove
|
|
49
|
+
// - 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.
|
|
47
50
|
if (modulePath.endsWith('.css'))
|
|
48
51
|
return;
|
|
49
52
|
const isServerSide = options?.ssr;
|
|
@@ -55,7 +58,7 @@ function fileEnv() {
|
|
|
55
58
|
return;
|
|
56
59
|
// Show error message
|
|
57
60
|
let errMsg;
|
|
58
|
-
let modulePathPretty =
|
|
61
|
+
let modulePathPretty = getModuleFilePath(moduleId, config);
|
|
59
62
|
modulePathPretty = modulePathPretty.replaceAll(suffix, pc.bold(suffix));
|
|
60
63
|
errMsg = `${capitalizeFirstLetter(envExpect)}-only module ${modulePathPretty} (https://vike.dev/file-env) imported on the ${envActual}-side`;
|
|
61
64
|
if (importer &&
|
|
@@ -63,7 +66,7 @@ function fileEnv() {
|
|
|
63
66
|
!importer.includes('virtual:vike:') &&
|
|
64
67
|
// I don't know why and who sets importer to '<stdin>' (I guess Vite?)
|
|
65
68
|
importer !== '<stdin>') {
|
|
66
|
-
const importerPath =
|
|
69
|
+
const importerPath = getModuleFilePath(importer, config);
|
|
67
70
|
errMsg += ` by ${importerPath}`;
|
|
68
71
|
}
|
|
69
72
|
if (isDev) {
|
|
@@ -3,12 +3,13 @@ import { normalizePath } from 'vite';
|
|
|
3
3
|
import { getConfigVike } from '../../../shared/getConfigVike.js';
|
|
4
4
|
import { getVirtualFilePageConfigValuesAll } from './v1-design/getVirtualFilePageConfigValuesAll.js';
|
|
5
5
|
import { getVirtualFileImportUserCode } from './getVirtualFileImportUserCode.js';
|
|
6
|
-
import { assert, assertPosixPath,
|
|
6
|
+
import { assert, assertPosixPath, getOutDirs, getVirtualFileId, isDev1, isDev1_onConfigureServer, isVirtualFileId, resolveVirtualFileId } from '../../utils.js';
|
|
7
7
|
import { isVirtualFileIdPageConfigValuesAll } from '../../../shared/virtual-files/virtualFilePageConfigValuesAll.js';
|
|
8
8
|
import { isVirtualFileIdImportUserCode } from '../../../shared/virtual-files/virtualFileImportUserCode.js';
|
|
9
9
|
import { vikeConfigDependencies, reloadVikeConfig, isVikeConfigFile } from './v1-design/getVikeConfig.js';
|
|
10
10
|
import pc from '@brillout/picocolors';
|
|
11
11
|
import { logConfigInfo, clearLogs } from '../../shared/loggerNotProd.js';
|
|
12
|
+
import { getFilePathResolved } from '../../shared/getFilePath.js';
|
|
12
13
|
function importUserCode() {
|
|
13
14
|
let config;
|
|
14
15
|
let configVike;
|
|
@@ -118,8 +119,11 @@ function isVikeConfigModule(filePathAbsoluteFilesystem) {
|
|
|
118
119
|
}
|
|
119
120
|
function reloadConfig(filePath, config, op) {
|
|
120
121
|
{
|
|
121
|
-
const
|
|
122
|
-
|
|
122
|
+
const { filePathToShowToUserResolved } = getFilePathResolved({
|
|
123
|
+
filePathAbsoluteFilesystem: filePath,
|
|
124
|
+
userRootDir: config.root
|
|
125
|
+
});
|
|
126
|
+
const msg = `${op} ${pc.dim(filePathToShowToUserResolved)}`;
|
|
123
127
|
logConfigInfo(msg, 'info');
|
|
124
128
|
}
|
|
125
129
|
reloadVikeConfig(config.root, getOutDirs(config).outDirRoot);
|