vike 0.4.166-commit-a5e2596 → 0.4.167-commit-14e4b5e
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/devConfig/determineOptimizeDeps.js +1 -1
- package/dist/cjs/node/plugin/plugins/extractAssetsPlugin.js +2 -4
- package/dist/cjs/node/plugin/plugins/extractExportNamesPlugin.js +2 -4
- 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/transpileAndExecuteFile.js +28 -18
- package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +1 -1
- package/dist/cjs/node/plugin/shared/isErrorDebug.js +1 -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/logErrorHint.js +13 -1
- package/dist/cjs/shared/page-configs/assertPlusFileExport.js +1 -3
- package/dist/cjs/utils/assertIsNotProductionRuntime.js +5 -5
- package/dist/cjs/utils/debug.js +48 -14
- 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/devConfig/determineOptimizeDeps.js +1 -1
- package/dist/esm/node/plugin/plugins/extractAssetsPlugin.js +3 -5
- package/dist/esm/node/plugin/plugins/extractExportNamesPlugin.js +3 -5
- 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/transpileAndExecuteFile.d.ts +2 -2
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/transpileAndExecuteFile.js +27 -17
- package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig.js +2 -2
- package/dist/esm/node/plugin/shared/isErrorDebug.js +2 -2
- 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/logErrorHint.js +13 -1
- package/dist/esm/shared/addUrlComputedProps.d.ts +2 -2
- package/dist/esm/shared/page-configs/assertPlusFileExport.js +1 -3
- package/dist/esm/utils/assertIsNotProductionRuntime.js +5 -5
- 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/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
|
@@ -25,7 +25,7 @@ async function determineOptimizeDeps(config, isDev) {
|
|
|
25
25
|
*/
|
|
26
26
|
config.optimizeDeps.include = [...include, ...normalizeInclude(config.optimizeDeps.include)];
|
|
27
27
|
config.optimizeDeps.entries = [...entries, ...normalizeEntries(config.optimizeDeps.entries)];
|
|
28
|
-
if (debug.
|
|
28
|
+
if (debug.isActivated)
|
|
29
29
|
debug('config.optimizeDeps', {
|
|
30
30
|
'config.optimizeDeps.entries': config.optimizeDeps.entries,
|
|
31
31
|
'config.optimizeDeps.include': config.optimizeDeps.include
|
|
@@ -21,9 +21,7 @@ exports.extractAssetsRE = extractAssetsRE;
|
|
|
21
21
|
const rawRE = /(\?|&)raw(?:&|$)/;
|
|
22
22
|
const urlRE = /(\?|&)url(?:&|$)/;
|
|
23
23
|
const EMPTY_MODULE_ID = 'virtual:vike:empty-module';
|
|
24
|
-
const
|
|
25
|
-
const debug = (0, utils_js_1.createDebugger)(debugNamespace);
|
|
26
|
-
const debugEnabled = (0, utils_js_1.isDebugEnabled)(debugNamespace);
|
|
24
|
+
const debug = (0, utils_js_1.createDebugger)('vike:extractAssets');
|
|
27
25
|
function extractAssetsPlugin() {
|
|
28
26
|
let config;
|
|
29
27
|
let configVike;
|
|
@@ -129,7 +127,7 @@ function extractAssetsPlugin() {
|
|
|
129
127
|
}
|
|
130
128
|
},
|
|
131
129
|
config() {
|
|
132
|
-
if (
|
|
130
|
+
if (debug.isActivated) {
|
|
133
131
|
return { logLevel: 'silent' };
|
|
134
132
|
}
|
|
135
133
|
}
|
|
@@ -6,9 +6,7 @@ const parseEsModule_js_1 = require("../shared/parseEsModule.js");
|
|
|
6
6
|
const rollupSourceMap_js_1 = require("../shared/rollupSourceMap.js");
|
|
7
7
|
const extractExportNamesRE = /(\?|&)extractExportNames(?:&|$)/;
|
|
8
8
|
exports.extractExportNamesRE = extractExportNamesRE;
|
|
9
|
-
const
|
|
10
|
-
const debug = (0, utils_js_1.createDebugger)(debugNamespace);
|
|
11
|
-
const debugEnabled = (0, utils_js_1.isDebugEnabled)(debugNamespace);
|
|
9
|
+
const debug = (0, utils_js_1.createDebugger)('vike:extractExportNames');
|
|
12
10
|
const globalObject = (0, utils_js_1.getGlobalObject)('extractExportNamesPlugin.ts', {});
|
|
13
11
|
function extractExportNamesPlugin() {
|
|
14
12
|
let isDev = false;
|
|
@@ -27,7 +25,7 @@ function extractExportNamesPlugin() {
|
|
|
27
25
|
isDev = true;
|
|
28
26
|
},
|
|
29
27
|
config() {
|
|
30
|
-
if (
|
|
28
|
+
if (debug.isActivated) {
|
|
31
29
|
return { logLevel: 'silent' };
|
|
32
30
|
}
|
|
33
31
|
}
|
|
@@ -9,9 +9,9 @@ const assertPlusFileExport_js_1 = require("../../../../../shared/page-configs/as
|
|
|
9
9
|
const utils_js_1 = require("../../../utils.js");
|
|
10
10
|
function getConfigFileExport(fileExports, filePathToShowToUser) {
|
|
11
11
|
(0, assertPlusFileExport_js_1.assertPlusFileExport)(fileExports, filePathToShowToUser, 'config');
|
|
12
|
-
const
|
|
13
|
-
|
|
14
|
-
const exportName = picocolors_1.default.cyan(
|
|
12
|
+
const usesNamedExport = !!fileExports.config;
|
|
13
|
+
const fileExport = usesNamedExport ? fileExports.config : fileExports.default;
|
|
14
|
+
const exportName = picocolors_1.default.cyan(usesNamedExport ? 'export { config }' : 'export default');
|
|
15
15
|
(0, utils_js_1.assertUsage)((0, utils_js_1.isObject)(fileExport), `The ${exportName} of ${filePathToShowToUser} should be an object (but it's ${picocolors_1.default.cyan(`typeof exportedValue === ${JSON.stringify(typeof fileExport)}`)} instead)`);
|
|
16
16
|
return fileExport;
|
|
17
17
|
}
|
package/dist/cjs/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js
CHANGED
|
@@ -10,6 +10,7 @@ const fast_glob_1 = __importDefault(require("fast-glob"));
|
|
|
10
10
|
const child_process_1 = require("child_process");
|
|
11
11
|
const util_1 = require("util");
|
|
12
12
|
const picocolors_1 = __importDefault(require("@brillout/picocolors"));
|
|
13
|
+
const transpileAndExecuteFile_js_1 = require("./transpileAndExecuteFile.js");
|
|
13
14
|
const execA = (0, util_1.promisify)(child_process_1.exec);
|
|
14
15
|
(0, utils_js_1.assertIsNotProductionRuntime)();
|
|
15
16
|
(0, utils_js_1.assertIsSingleModuleInstance)('crawlPlusFiles.ts');
|
|
@@ -34,6 +35,7 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
|
|
|
34
35
|
else {
|
|
35
36
|
files = await fastGlob(userRootDir, outDirRelativeFromUserRootDir);
|
|
36
37
|
}
|
|
38
|
+
files = files.filter((file) => !(0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(file));
|
|
37
39
|
{
|
|
38
40
|
const timeAfter = new Date().getTime();
|
|
39
41
|
const timeSpent = timeAfter - timeBefore;
|
|
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
3
3
|
return (mod && mod.__esModule) ? mod : { "default": mod };
|
|
4
4
|
};
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
|
-
exports.
|
|
6
|
+
exports.isTemporaryBuildFile = exports.getConfigExecutionErrorIntroMsg = exports.getConfigBuildErrorFormatted = exports.transpileAndExecuteFile = void 0;
|
|
7
7
|
const esbuild_1 = require("esbuild");
|
|
8
8
|
const fs_1 = __importDefault(require("fs"));
|
|
9
9
|
const path_1 = __importDefault(require("path"));
|
|
@@ -40,10 +40,10 @@ async function transpileFile(filePath, transformImports, userRootDir) {
|
|
|
40
40
|
const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
|
|
41
41
|
(0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
|
|
42
42
|
getVikeConfig_js_1.vikeConfigDependencies.add(filePathAbsoluteFilesystem);
|
|
43
|
-
if (debug.
|
|
43
|
+
if (debug.isActivated)
|
|
44
44
|
debug('transpile', filePathToShowToUserResolved);
|
|
45
45
|
let { code, pointerImports } = await transpileWithEsbuild(filePath, userRootDir, transformImports);
|
|
46
|
-
if (debug.
|
|
46
|
+
if (debug.isActivated)
|
|
47
47
|
debug(`code, post esbuild (${filePathToShowToUserResolved})`, code);
|
|
48
48
|
let isImportTransformed = false;
|
|
49
49
|
if (transformImports) {
|
|
@@ -51,12 +51,12 @@ async function transpileFile(filePath, transformImports, userRootDir) {
|
|
|
51
51
|
if (codeMod) {
|
|
52
52
|
code = codeMod;
|
|
53
53
|
isImportTransformed = true;
|
|
54
|
-
if (debug.
|
|
54
|
+
if (debug.isActivated)
|
|
55
55
|
debug(`code, post transformImports() (${filePathToShowToUserResolved})`, code);
|
|
56
56
|
}
|
|
57
57
|
}
|
|
58
58
|
if (!isImportTransformed) {
|
|
59
|
-
if (debug.
|
|
59
|
+
if (debug.isActivated)
|
|
60
60
|
debug(`code, no transformImports() (${filePathToShowToUserResolved})`);
|
|
61
61
|
}
|
|
62
62
|
return code;
|
|
@@ -93,9 +93,11 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
93
93
|
else {
|
|
94
94
|
const pointerImports_ = (pointerImports = {});
|
|
95
95
|
options.plugins = [
|
|
96
|
-
// Determine
|
|
96
|
+
// Determine whether an import should be:
|
|
97
|
+
// - A pointer import
|
|
98
|
+
// - Externalized
|
|
97
99
|
{
|
|
98
|
-
name: 'vike
|
|
100
|
+
name: 'vike-esbuild-plugin',
|
|
99
101
|
setup(build) {
|
|
100
102
|
// https://github.com/evanw/esbuild/issues/3095#issuecomment-1546916366
|
|
101
103
|
const useEsbuildResolver = 'useEsbuildResolver';
|
|
@@ -108,6 +110,15 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
108
110
|
const { path, ...opts } = args;
|
|
109
111
|
opts.pluginData = { [useEsbuildResolver]: true };
|
|
110
112
|
const resolved = await build.resolve(path, opts);
|
|
113
|
+
if (resolved.errors.length > 0) {
|
|
114
|
+
/* We could do the following to let Node.js throw the error, but we don't because the error shown by esbuild is prettier: the Node.js error refers to the transpiled [build-f7i251e0iwnw]+config.ts.mjs file which isn't that nice, whereas esbuild refers to the source +config.ts file.
|
|
115
|
+
pointerImports_[args.path] = false
|
|
116
|
+
return { external: true }
|
|
117
|
+
*/
|
|
118
|
+
// Let esbuild throw the error. (It throws a nice & pretty error.)
|
|
119
|
+
return resolved;
|
|
120
|
+
}
|
|
121
|
+
(0, utils_js_1.assert)(resolved.path);
|
|
111
122
|
resolved.path = (0, utils_js_1.toPosixPath)(resolved.path);
|
|
112
123
|
// vike-{react,vue,solid} follow the convention that their config export resolves to a file named +config.js
|
|
113
124
|
// - This is temporary, see comment below.
|
|
@@ -126,9 +137,9 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
126
137
|
pointerImports_[resolved.path] = isPointerImport;
|
|
127
138
|
(0, utils_js_1.assertPosixPath)(resolved.path);
|
|
128
139
|
const isExternal = isPointerImport ||
|
|
129
|
-
// npm package imports that aren't pointer imports
|
|
140
|
+
// Performance: npm package imports that aren't pointer imports can be externalized. For example, if Vike eventually adds support for setting Vite configs in the vike.config.js file, then the user may import a Vite plugin in his vike.config.js file. (We could as well let esbuild always transpile /node_modules/ code but it would be useless and would unnecessarily slow down transpilation.)
|
|
130
141
|
resolved.path.includes('/node_modules/');
|
|
131
|
-
if (debug.
|
|
142
|
+
if (debug.isActivated)
|
|
132
143
|
debug('onResolved()', { args, resolved, isPointerImport, isExternal });
|
|
133
144
|
if (isExternal) {
|
|
134
145
|
return { external: true, path: resolved.path };
|
|
@@ -189,7 +200,7 @@ async function executeTranspiledFile(filePath, code) {
|
|
|
189
200
|
const { filePathAbsoluteFilesystem } = filePath;
|
|
190
201
|
// Alternative to using a temporary file: https://github.com/vitejs/vite/pull/13269
|
|
191
202
|
// - But seems to break source maps, so I don't think it's worth it
|
|
192
|
-
const filePathTmp =
|
|
203
|
+
const filePathTmp = getTemporaryBuildFilePath(filePathAbsoluteFilesystem);
|
|
193
204
|
fs_1.default.writeFileSync(filePathTmp, code);
|
|
194
205
|
const clean = () => fs_1.default.unlinkSync(filePathTmp);
|
|
195
206
|
let fileExports = {};
|
|
@@ -248,22 +259,21 @@ function getConfigExecutionErrorIntroMsg(err) {
|
|
|
248
259
|
return errIntroMsg ?? null;
|
|
249
260
|
}
|
|
250
261
|
exports.getConfigExecutionErrorIntroMsg = getConfigExecutionErrorIntroMsg;
|
|
251
|
-
|
|
252
|
-
function getFilePathTmp(filePathAbsoluteFilesystem) {
|
|
262
|
+
function getTemporaryBuildFilePath(filePathAbsoluteFilesystem) {
|
|
253
263
|
(0, utils_js_1.assertPosixPath)(filePathAbsoluteFilesystem);
|
|
254
264
|
const dirname = path_1.default.posix.dirname(filePathAbsoluteFilesystem);
|
|
255
265
|
const filename = path_1.default.posix.basename(filePathAbsoluteFilesystem);
|
|
256
|
-
// Syntax with semicolon `
|
|
257
|
-
const
|
|
258
|
-
|
|
266
|
+
// Syntax with semicolon `build:${/*...*/}` doesn't work on Windows: https://github.com/vikejs/vike/issues/800#issuecomment-1517329455
|
|
267
|
+
const filePathTmp = path_1.default.posix.join(dirname, `${filename}.build-${(0, utils_js_1.getRandomId)(12)}.mjs`);
|
|
268
|
+
(0, utils_js_1.assert)(isTemporaryBuildFile(filePathTmp));
|
|
259
269
|
return filePathTmp;
|
|
260
270
|
}
|
|
261
|
-
function
|
|
271
|
+
function isTemporaryBuildFile(filePath) {
|
|
262
272
|
(0, utils_js_1.assertPosixPath)(filePath);
|
|
263
273
|
const fileName = path_1.default.posix.basename(filePath);
|
|
264
|
-
return fileName
|
|
274
|
+
return /\.build-[a-z0-9]{12}\.mjs$/.test(fileName);
|
|
265
275
|
}
|
|
266
|
-
exports.
|
|
276
|
+
exports.isTemporaryBuildFile = isTemporaryBuildFile;
|
|
267
277
|
function isHeaderFile(filePath) {
|
|
268
278
|
(0, utils_js_1.assertPosixPath)(filePath);
|
|
269
279
|
const fileExtensions = getFileExtensions(filePath);
|
|
@@ -750,7 +750,7 @@ async function findPlusFiles(userRootDir, outDirRoot, isDev) {
|
|
|
750
750
|
}
|
|
751
751
|
function getConfigName(filePath) {
|
|
752
752
|
(0, utils_js_1.assertPosixPath)(filePath);
|
|
753
|
-
if ((0, transpileAndExecuteFile_js_1.
|
|
753
|
+
if ((0, transpileAndExecuteFile_js_1.isTemporaryBuildFile)(filePath))
|
|
754
754
|
return null;
|
|
755
755
|
const fileName = path_1.default.posix.basename(filePath);
|
|
756
756
|
// assertNoUnexpectedPlusSign(filePath, fileName)
|
|
@@ -3,6 +3,6 @@ Object.defineProperty(exports, "__esModule", { value: true });
|
|
|
3
3
|
exports.isErrorDebug = void 0;
|
|
4
4
|
const utils_js_1 = require("../utils.js");
|
|
5
5
|
function isErrorDebug() {
|
|
6
|
-
return (0, utils_js_1.
|
|
6
|
+
return (0, utils_js_1.isDebugActivated)('vike:error');
|
|
7
7
|
}
|
|
8
8
|
exports.isErrorDebug = isErrorDebug;
|
|
@@ -375,7 +375,7 @@ async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onF
|
|
|
375
375
|
const writeChunk = (chunk) => {
|
|
376
376
|
(0, utils_js_1.assert)(writableOriginal);
|
|
377
377
|
writableOriginal.write(chunk);
|
|
378
|
-
if (debug.
|
|
378
|
+
if (debug.isActivated) {
|
|
379
379
|
debug('data written (Node.js Writable)', String(chunk));
|
|
380
380
|
}
|
|
381
381
|
};
|
|
@@ -448,7 +448,7 @@ async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onF
|
|
|
448
448
|
const writeChunk = (chunk) => {
|
|
449
449
|
(0, utils_js_1.assert)(writerOriginal);
|
|
450
450
|
writerOriginal.write(encodeForWebStream(chunk));
|
|
451
|
-
if (debug.
|
|
451
|
+
if (debug.isActivated) {
|
|
452
452
|
debug('data written (Web Writable)', String(chunk));
|
|
453
453
|
}
|
|
454
454
|
};
|
|
@@ -541,12 +541,12 @@ async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onF
|
|
|
541
541
|
// 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`.
|
|
542
542
|
!controllerProxyIsClosed) {
|
|
543
543
|
controllerProxy.enqueue(encodeForWebStream(chunk));
|
|
544
|
-
if (debug.
|
|
544
|
+
if (debug.isActivated) {
|
|
545
545
|
debug('data written (Web Readable)', String(chunk));
|
|
546
546
|
}
|
|
547
547
|
}
|
|
548
548
|
else {
|
|
549
|
-
if (debug.
|
|
549
|
+
if (debug.isActivated) {
|
|
550
550
|
debug('data emitted but not written (Web Readable)', String(chunk));
|
|
551
551
|
}
|
|
552
552
|
}
|
|
@@ -568,7 +568,7 @@ async function createStreamWrapper({ streamOriginal, onError, onData, onEnd, onF
|
|
|
568
568
|
}
|
|
569
569
|
const writeChunk = (chunk) => {
|
|
570
570
|
readableProxy.push(chunk);
|
|
571
|
-
if (debug.
|
|
571
|
+
if (debug.isActivated) {
|
|
572
572
|
debug('data written (Node.js Readable)', String(chunk));
|
|
573
573
|
}
|
|
574
574
|
};
|
|
@@ -15,7 +15,7 @@ function analyzePage(pageFilesAll, pageConfig, pageId) {
|
|
|
15
15
|
const clientDependencies = [];
|
|
16
16
|
clientDependencies.push({
|
|
17
17
|
id: (0, virtualFilePageConfigValuesAll_js_1.getVirtualFileIdPageConfigValuesAll)(pageConfig.pageId, true),
|
|
18
|
-
onlyAssets: false,
|
|
18
|
+
onlyAssets: isClientSideRenderable ? false : true,
|
|
19
19
|
eagerlyImported: false
|
|
20
20
|
});
|
|
21
21
|
// In production we inject the import of the server virtual module with ?extractAssets inside the client virtual module
|
|
@@ -21,6 +21,10 @@ const knownErrors = [
|
|
|
21
21
|
// ```
|
|
22
22
|
errMsg: 'assets.json',
|
|
23
23
|
link: 'https://vike.dev/getGlobalContext'
|
|
24
|
+
},
|
|
25
|
+
{
|
|
26
|
+
errMsg: /Named export.*not found/i,
|
|
27
|
+
link: 'https://vike.dev/broken-npm-package#named-export-not-found'
|
|
24
28
|
}
|
|
25
29
|
];
|
|
26
30
|
function logErrorHint(error) {
|
|
@@ -290,7 +294,15 @@ function extractFromNodeModulesPath(str) {
|
|
|
290
294
|
return packageName;
|
|
291
295
|
}
|
|
292
296
|
function includes(str1, str2) {
|
|
293
|
-
|
|
297
|
+
if (!str1)
|
|
298
|
+
return false;
|
|
299
|
+
if (str2 instanceof RegExp) {
|
|
300
|
+
return str2.test(str1.toLowerCase());
|
|
301
|
+
}
|
|
302
|
+
if (typeof str2 === 'string') {
|
|
303
|
+
return str1.toLowerCase().includes(str2.toLowerCase());
|
|
304
|
+
}
|
|
305
|
+
return false;
|
|
294
306
|
}
|
|
295
307
|
function includesNodeModules(str) {
|
|
296
308
|
if (!str)
|
|
@@ -28,9 +28,7 @@ function assertPlusFileExport(fileExports, filePathToShowToUser, configName) {
|
|
|
28
28
|
}
|
|
29
29
|
else {
|
|
30
30
|
(0, utils_js_1.assert)(exportsAll.length === 2); // because `exportsInvalid.length === 0`
|
|
31
|
-
(0, utils_js_1.assertWarning)(false,
|
|
32
|
-
onlyOnce: true
|
|
33
|
-
});
|
|
31
|
+
(0, utils_js_1.assertWarning)(false, `The exports of ${filePathToShowToUser} are ambiguous: remove ${exportDefault} or ${exportNamed}`, { onlyOnce: true });
|
|
34
32
|
}
|
|
35
33
|
}
|
|
36
34
|
else {
|
|
@@ -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;
|
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,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-14e4b5e';
|
|
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 {
|
|
@@ -23,7 +23,7 @@ async function determineOptimizeDeps(config, isDev) {
|
|
|
23
23
|
*/
|
|
24
24
|
config.optimizeDeps.include = [...include, ...normalizeInclude(config.optimizeDeps.include)];
|
|
25
25
|
config.optimizeDeps.entries = [...entries, ...normalizeEntries(config.optimizeDeps.entries)];
|
|
26
|
-
if (debug.
|
|
26
|
+
if (debug.isActivated)
|
|
27
27
|
debug('config.optimizeDeps', {
|
|
28
28
|
'config.optimizeDeps.entries': config.optimizeDeps.entries,
|
|
29
29
|
'config.optimizeDeps.include': config.optimizeDeps.include
|
|
@@ -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;
|
|
@@ -128,7 +126,7 @@ function extractAssetsPlugin() {
|
|
|
128
126
|
}
|
|
129
127
|
},
|
|
130
128
|
config() {
|
|
131
|
-
if (
|
|
129
|
+
if (debug.isActivated) {
|
|
132
130
|
return { logLevel: 'silent' };
|
|
133
131
|
}
|
|
134
132
|
}
|
|
@@ -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,12 +1,12 @@
|
|
|
1
1
|
export { getConfigFileExport };
|
|
2
2
|
import pc from '@brillout/picocolors';
|
|
3
3
|
import { assertPlusFileExport } from '../../../../../shared/page-configs/assertPlusFileExport.js';
|
|
4
|
-
import {
|
|
4
|
+
import { assertUsage, isObject } from '../../../utils.js';
|
|
5
5
|
function getConfigFileExport(fileExports, filePathToShowToUser) {
|
|
6
6
|
assertPlusFileExport(fileExports, filePathToShowToUser, 'config');
|
|
7
|
-
const
|
|
8
|
-
|
|
9
|
-
const exportName = pc.cyan(
|
|
7
|
+
const usesNamedExport = !!fileExports.config;
|
|
8
|
+
const fileExport = usesNamedExport ? fileExports.config : fileExports.default;
|
|
9
|
+
const exportName = pc.cyan(usesNamedExport ? 'export { config }' : 'export default');
|
|
10
10
|
assertUsage(isObject(fileExport), `The ${exportName} of ${filePathToShowToUser} should be an object (but it's ${pc.cyan(`typeof exportedValue === ${JSON.stringify(typeof fileExport)}`)} instead)`);
|
|
11
11
|
return fileExport;
|
|
12
12
|
}
|
package/dist/esm/node/plugin/plugins/importUserCode/v1-design/getVikeConfig/crawlPlusFiles.js
CHANGED
|
@@ -5,6 +5,7 @@ import glob from 'fast-glob';
|
|
|
5
5
|
import { exec } from 'child_process';
|
|
6
6
|
import { promisify } from 'util';
|
|
7
7
|
import pc from '@brillout/picocolors';
|
|
8
|
+
import { isTemporaryBuildFile } from './transpileAndExecuteFile.js';
|
|
8
9
|
const execA = promisify(exec);
|
|
9
10
|
assertIsNotProductionRuntime();
|
|
10
11
|
assertIsSingleModuleInstance('crawlPlusFiles.ts');
|
|
@@ -29,6 +30,7 @@ async function crawlPlusFiles(userRootDir, outDirAbsoluteFilesystem, isDev) {
|
|
|
29
30
|
else {
|
|
30
31
|
files = await fastGlob(userRootDir, outDirRelativeFromUserRootDir);
|
|
31
32
|
}
|
|
33
|
+
files = files.filter((file) => !isTemporaryBuildFile(file));
|
|
32
34
|
{
|
|
33
35
|
const timeAfter = new Date().getTime();
|
|
34
36
|
const timeSpent = timeAfter - timeBefore;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { transpileAndExecuteFile };
|
|
2
2
|
export { getConfigBuildErrorFormatted };
|
|
3
3
|
export { getConfigExecutionErrorIntroMsg };
|
|
4
|
-
export {
|
|
4
|
+
export { isTemporaryBuildFile };
|
|
5
5
|
import 'source-map-support/register.js';
|
|
6
6
|
import type { FilePathResolved } from '../../../../../../shared/page-configs/FilePath.js';
|
|
7
7
|
declare function transpileAndExecuteFile(filePath: FilePathResolved, userRootDir: string, isConfigFile: boolean | 'is-extension-config'): Promise<{
|
|
@@ -9,4 +9,4 @@ declare function transpileAndExecuteFile(filePath: FilePathResolved, userRootDir
|
|
|
9
9
|
}>;
|
|
10
10
|
declare function getConfigBuildErrorFormatted(err: unknown): null | string;
|
|
11
11
|
declare function getConfigExecutionErrorIntroMsg(err: unknown): string | null;
|
|
12
|
-
declare function
|
|
12
|
+
declare function isTemporaryBuildFile(filePath: string): boolean;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { transpileAndExecuteFile };
|
|
2
2
|
export { getConfigBuildErrorFormatted };
|
|
3
3
|
export { getConfigExecutionErrorIntroMsg };
|
|
4
|
-
export {
|
|
4
|
+
export { isTemporaryBuildFile };
|
|
5
5
|
import { build, formatMessages } from 'esbuild';
|
|
6
6
|
import fs from 'fs';
|
|
7
7
|
import path from 'path';
|
|
@@ -37,10 +37,10 @@ async function transpileFile(filePath, transformImports, userRootDir) {
|
|
|
37
37
|
const { filePathAbsoluteFilesystem, filePathToShowToUserResolved } = filePath;
|
|
38
38
|
assertPosixPath(filePathAbsoluteFilesystem);
|
|
39
39
|
vikeConfigDependencies.add(filePathAbsoluteFilesystem);
|
|
40
|
-
if (debug.
|
|
40
|
+
if (debug.isActivated)
|
|
41
41
|
debug('transpile', filePathToShowToUserResolved);
|
|
42
42
|
let { code, pointerImports } = await transpileWithEsbuild(filePath, userRootDir, transformImports);
|
|
43
|
-
if (debug.
|
|
43
|
+
if (debug.isActivated)
|
|
44
44
|
debug(`code, post esbuild (${filePathToShowToUserResolved})`, code);
|
|
45
45
|
let isImportTransformed = false;
|
|
46
46
|
if (transformImports) {
|
|
@@ -48,12 +48,12 @@ async function transpileFile(filePath, transformImports, userRootDir) {
|
|
|
48
48
|
if (codeMod) {
|
|
49
49
|
code = codeMod;
|
|
50
50
|
isImportTransformed = true;
|
|
51
|
-
if (debug.
|
|
51
|
+
if (debug.isActivated)
|
|
52
52
|
debug(`code, post transformImports() (${filePathToShowToUserResolved})`, code);
|
|
53
53
|
}
|
|
54
54
|
}
|
|
55
55
|
if (!isImportTransformed) {
|
|
56
|
-
if (debug.
|
|
56
|
+
if (debug.isActivated)
|
|
57
57
|
debug(`code, no transformImports() (${filePathToShowToUserResolved})`);
|
|
58
58
|
}
|
|
59
59
|
return code;
|
|
@@ -90,9 +90,11 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
90
90
|
else {
|
|
91
91
|
const pointerImports_ = (pointerImports = {});
|
|
92
92
|
options.plugins = [
|
|
93
|
-
// Determine
|
|
93
|
+
// Determine whether an import should be:
|
|
94
|
+
// - A pointer import
|
|
95
|
+
// - Externalized
|
|
94
96
|
{
|
|
95
|
-
name: 'vike
|
|
97
|
+
name: 'vike-esbuild-plugin',
|
|
96
98
|
setup(build) {
|
|
97
99
|
// https://github.com/evanw/esbuild/issues/3095#issuecomment-1546916366
|
|
98
100
|
const useEsbuildResolver = 'useEsbuildResolver';
|
|
@@ -105,6 +107,15 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
105
107
|
const { path, ...opts } = args;
|
|
106
108
|
opts.pluginData = { [useEsbuildResolver]: true };
|
|
107
109
|
const resolved = await build.resolve(path, opts);
|
|
110
|
+
if (resolved.errors.length > 0) {
|
|
111
|
+
/* We could do the following to let Node.js throw the error, but we don't because the error shown by esbuild is prettier: the Node.js error refers to the transpiled [build-f7i251e0iwnw]+config.ts.mjs file which isn't that nice, whereas esbuild refers to the source +config.ts file.
|
|
112
|
+
pointerImports_[args.path] = false
|
|
113
|
+
return { external: true }
|
|
114
|
+
*/
|
|
115
|
+
// Let esbuild throw the error. (It throws a nice & pretty error.)
|
|
116
|
+
return resolved;
|
|
117
|
+
}
|
|
118
|
+
assert(resolved.path);
|
|
108
119
|
resolved.path = toPosixPath(resolved.path);
|
|
109
120
|
// vike-{react,vue,solid} follow the convention that their config export resolves to a file named +config.js
|
|
110
121
|
// - This is temporary, see comment below.
|
|
@@ -123,9 +134,9 @@ async function transpileWithEsbuild(filePath, userRootDir, transformImports) {
|
|
|
123
134
|
pointerImports_[resolved.path] = isPointerImport;
|
|
124
135
|
assertPosixPath(resolved.path);
|
|
125
136
|
const isExternal = isPointerImport ||
|
|
126
|
-
// npm package imports that aren't pointer imports
|
|
137
|
+
// Performance: npm package imports that aren't pointer imports can be externalized. For example, if Vike eventually adds support for setting Vite configs in the vike.config.js file, then the user may import a Vite plugin in his vike.config.js file. (We could as well let esbuild always transpile /node_modules/ code but it would be useless and would unnecessarily slow down transpilation.)
|
|
127
138
|
resolved.path.includes('/node_modules/');
|
|
128
|
-
if (debug.
|
|
139
|
+
if (debug.isActivated)
|
|
129
140
|
debug('onResolved()', { args, resolved, isPointerImport, isExternal });
|
|
130
141
|
if (isExternal) {
|
|
131
142
|
return { external: true, path: resolved.path };
|
|
@@ -186,7 +197,7 @@ async function executeTranspiledFile(filePath, code) {
|
|
|
186
197
|
const { filePathAbsoluteFilesystem } = filePath;
|
|
187
198
|
// Alternative to using a temporary file: https://github.com/vitejs/vite/pull/13269
|
|
188
199
|
// - But seems to break source maps, so I don't think it's worth it
|
|
189
|
-
const filePathTmp =
|
|
200
|
+
const filePathTmp = getTemporaryBuildFilePath(filePathAbsoluteFilesystem);
|
|
190
201
|
fs.writeFileSync(filePathTmp, code);
|
|
191
202
|
const clean = () => fs.unlinkSync(filePathTmp);
|
|
192
203
|
let fileExports = {};
|
|
@@ -243,20 +254,19 @@ function getConfigExecutionErrorIntroMsg(err) {
|
|
|
243
254
|
const errIntroMsg = execErrIntroMsg.get(err);
|
|
244
255
|
return errIntroMsg ?? null;
|
|
245
256
|
}
|
|
246
|
-
|
|
247
|
-
function getFilePathTmp(filePathAbsoluteFilesystem) {
|
|
257
|
+
function getTemporaryBuildFilePath(filePathAbsoluteFilesystem) {
|
|
248
258
|
assertPosixPath(filePathAbsoluteFilesystem);
|
|
249
259
|
const dirname = path.posix.dirname(filePathAbsoluteFilesystem);
|
|
250
260
|
const filename = path.posix.basename(filePathAbsoluteFilesystem);
|
|
251
|
-
// Syntax with semicolon `
|
|
252
|
-
const
|
|
253
|
-
|
|
261
|
+
// Syntax with semicolon `build:${/*...*/}` doesn't work on Windows: https://github.com/vikejs/vike/issues/800#issuecomment-1517329455
|
|
262
|
+
const filePathTmp = path.posix.join(dirname, `${filename}.build-${getRandomId(12)}.mjs`);
|
|
263
|
+
assert(isTemporaryBuildFile(filePathTmp));
|
|
254
264
|
return filePathTmp;
|
|
255
265
|
}
|
|
256
|
-
function
|
|
266
|
+
function isTemporaryBuildFile(filePath) {
|
|
257
267
|
assertPosixPath(filePath);
|
|
258
268
|
const fileName = path.posix.basename(filePath);
|
|
259
|
-
return fileName
|
|
269
|
+
return /\.build-[a-z0-9]{12}\.mjs$/.test(fileName);
|
|
260
270
|
}
|
|
261
271
|
function isHeaderFile(filePath) {
|
|
262
272
|
assertPosixPath(filePath);
|
|
@@ -7,7 +7,7 @@ import { assertPosixPath, assert, isObject, assertUsage, assertWarning, objectEn
|
|
|
7
7
|
import path from 'path';
|
|
8
8
|
import { configDefinitionsBuiltIn, configDefinitionsBuiltInGlobal } from './getVikeConfig/configDefinitionsBuiltIn.js';
|
|
9
9
|
import { getLocationId, getFilesystemRouteString, getFilesystemRouteDefinedBy, isInherited, sortAfterInheritanceOrder, isGlobalLocation, applyFilesystemRoutingRootEffect } from './getVikeConfig/filesystemRouting.js';
|
|
10
|
-
import {
|
|
10
|
+
import { isTemporaryBuildFile } from './getVikeConfig/transpileAndExecuteFile.js';
|
|
11
11
|
import { isConfigInvalid, isConfigInvalid_set } from '../../../../runtime/renderPage/isConfigInvalid.js';
|
|
12
12
|
import { getViteDevServer } from '../../../../runtime/globalContext.js';
|
|
13
13
|
import { logConfigError, logConfigErrorRecover } from '../../../shared/loggerNotProd.js';
|
|
@@ -745,7 +745,7 @@ async function findPlusFiles(userRootDir, outDirRoot, isDev) {
|
|
|
745
745
|
}
|
|
746
746
|
function getConfigName(filePath) {
|
|
747
747
|
assertPosixPath(filePath);
|
|
748
|
-
if (
|
|
748
|
+
if (isTemporaryBuildFile(filePath))
|
|
749
749
|
return null;
|
|
750
750
|
const fileName = path.posix.basename(filePath);
|
|
751
751
|
// assertNoUnexpectedPlusSign(filePath, fileName)
|
|
@@ -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
|
};
|
|
@@ -13,7 +13,7 @@ function analyzePage(pageFilesAll, pageConfig, pageId) {
|
|
|
13
13
|
const clientDependencies = [];
|
|
14
14
|
clientDependencies.push({
|
|
15
15
|
id: getVirtualFileIdPageConfigValuesAll(pageConfig.pageId, true),
|
|
16
|
-
onlyAssets: false,
|
|
16
|
+
onlyAssets: isClientSideRenderable ? false : true,
|
|
17
17
|
eagerlyImported: false
|
|
18
18
|
});
|
|
19
19
|
// In production we inject the import of the server virtual module with ?extractAssets inside the client virtual module
|
|
@@ -20,6 +20,10 @@ const knownErrors = [
|
|
|
20
20
|
// ```
|
|
21
21
|
errMsg: 'assets.json',
|
|
22
22
|
link: 'https://vike.dev/getGlobalContext'
|
|
23
|
+
},
|
|
24
|
+
{
|
|
25
|
+
errMsg: /Named export.*not found/i,
|
|
26
|
+
link: 'https://vike.dev/broken-npm-package#named-export-not-found'
|
|
23
27
|
}
|
|
24
28
|
];
|
|
25
29
|
function logErrorHint(error) {
|
|
@@ -285,7 +289,15 @@ function extractFromNodeModulesPath(str) {
|
|
|
285
289
|
return packageName;
|
|
286
290
|
}
|
|
287
291
|
function includes(str1, str2) {
|
|
288
|
-
|
|
292
|
+
if (!str1)
|
|
293
|
+
return false;
|
|
294
|
+
if (str2 instanceof RegExp) {
|
|
295
|
+
return str2.test(str1.toLowerCase());
|
|
296
|
+
}
|
|
297
|
+
if (typeof str2 === 'string') {
|
|
298
|
+
return str1.toLowerCase().includes(str2.toLowerCase());
|
|
299
|
+
}
|
|
300
|
+
return false;
|
|
289
301
|
}
|
|
290
302
|
function includesNodeModules(str) {
|
|
291
303
|
if (!str)
|
|
@@ -18,14 +18,14 @@ type Url = {
|
|
|
18
18
|
searchAll: Record<string, string[]>;
|
|
19
19
|
/** The URL search parameterer string, e.g. `?details=yes` of `https://example.com/product/42?details=yes#reviews` */
|
|
20
20
|
searchOriginal: null | string;
|
|
21
|
-
/** @deprecated */
|
|
22
|
-
searchString: null | string;
|
|
23
21
|
/** The URL hash, e.g. `reviews` of `https://example.com/product/42?details=yes#reviews` */
|
|
24
22
|
hash: string;
|
|
25
23
|
/** The URL hash string, e.g. `#reviews` of `https://example.com/product/42?details=yes#reviews` */
|
|
26
24
|
hashOriginal: null | string;
|
|
27
25
|
/** @deprecated */
|
|
28
26
|
hashString: null | string;
|
|
27
|
+
/** @deprecated */
|
|
28
|
+
searchString: null | string;
|
|
29
29
|
};
|
|
30
30
|
type PageContextUrlComputedPropsClient = {
|
|
31
31
|
/** @deprecated */
|
|
@@ -23,9 +23,7 @@ function assertPlusFileExport(fileExports, filePathToShowToUser, configName) {
|
|
|
23
23
|
}
|
|
24
24
|
else {
|
|
25
25
|
assert(exportsAll.length === 2); // because `exportsInvalid.length === 0`
|
|
26
|
-
assertWarning(false,
|
|
27
|
-
onlyOnce: true
|
|
28
|
-
});
|
|
26
|
+
assertWarning(false, `The exports of ${filePathToShowToUser} are ambiguous: remove ${exportDefault} or ${exportNamed}`, { onlyOnce: true });
|
|
29
27
|
}
|
|
30
28
|
}
|
|
31
29
|
else {
|
|
@@ -16,31 +16,31 @@ const vikeVitePluginLoadedInProductionError = `Loading Vike's Vite plugin (the v
|
|
|
16
16
|
const env = getGlobalObject('utils/assertIsNotProductionRuntime.ts', {});
|
|
17
17
|
// Called by Vike modules that want to ensure that they aren't loaded by the server runtime in production
|
|
18
18
|
function assertIsNotProductionRuntime() {
|
|
19
|
-
if (debug.
|
|
19
|
+
if (debug.isActivated)
|
|
20
20
|
debug('assertIsNotProductionRuntime()', new Error().stack);
|
|
21
21
|
env.shouldNotBeProduction = true;
|
|
22
22
|
}
|
|
23
23
|
// Called by Vite hook configureServer()
|
|
24
24
|
function markEnvAsViteDev() {
|
|
25
|
-
if (debug.
|
|
25
|
+
if (debug.isActivated)
|
|
26
26
|
debug('markEnvAsViteDev()', new Error().stack);
|
|
27
27
|
env.isViteDev = true;
|
|
28
28
|
}
|
|
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
|
// Called by ../node/plugin/index.ts
|
|
36
36
|
function markEnvAsVikePluginLoaded() {
|
|
37
|
-
if (debug.
|
|
37
|
+
if (debug.isActivated)
|
|
38
38
|
debug('markEnvAsVikePluginLoaded()', new Error().stack);
|
|
39
39
|
env.isVikePluginLoaded = true;
|
|
40
40
|
}
|
|
41
41
|
// Called by ../node/runtime/index.ts
|
|
42
42
|
function assertEnv() {
|
|
43
|
-
if (debug.
|
|
43
|
+
if (debug.isActivated)
|
|
44
44
|
debug('assertEnv()', new Error().stack);
|
|
45
45
|
if (isVitest())
|
|
46
46
|
return;
|
|
@@ -1,7 +1,8 @@
|
|
|
1
1
|
export { createDebugger };
|
|
2
|
-
export {
|
|
2
|
+
export { isDebugActivated };
|
|
3
3
|
export type { Debug };
|
|
4
|
-
|
|
4
|
+
declare const flags: readonly ["vike:error", "vike:extractAssets", "vike:extractExportNames", "vike:glob", "vike:log", "vike:optimizeDeps", "vike:outDir", "vike:pageFiles", "vike:pointer-imports", "vike:routing", "vike:setup", "vike:stream", "vike:virtual-files"];
|
|
5
|
+
type Flag = (typeof flags)[number];
|
|
5
6
|
type Debug = ReturnType<typeof createDebugger>;
|
|
6
7
|
type Options = {
|
|
7
8
|
serialization?: {
|
|
@@ -10,6 +11,6 @@ type Options = {
|
|
|
10
11
|
};
|
|
11
12
|
declare function createDebugger(flag: Flag, optionsGlobal?: Options): ((...msgs: unknown[]) => void) & {
|
|
12
13
|
options: (optionsLocal: Options) => (...msgs: unknown[]) => void;
|
|
13
|
-
|
|
14
|
+
isActivated: boolean;
|
|
14
15
|
};
|
|
15
|
-
declare function
|
|
16
|
+
declare function isDebugActivated(flag: Flag): boolean;
|
package/dist/esm/utils/debug.js
CHANGED
|
@@ -1,16 +1,35 @@
|
|
|
1
1
|
export { createDebugger };
|
|
2
|
-
export {
|
|
2
|
+
export { isDebugActivated };
|
|
3
3
|
import { isBrowser } from './isBrowser.js';
|
|
4
4
|
import { isCallable } from './isCallable.js';
|
|
5
5
|
import { objectAssign } from './objectAssign.js';
|
|
6
|
-
import { assert } from './assert.js';
|
|
6
|
+
import { assert, assertUsage } from './assert.js';
|
|
7
7
|
import { checkType } from './checkType.js';
|
|
8
8
|
import { getTerminalWidth } from './getTerminWidth.js';
|
|
9
|
+
import pc from '@brillout/picocolors';
|
|
9
10
|
// Avoid this to be loaded in the browser. For isomorphic code: instead of `import { createDebugger } from './utils.js'`, use `globalThis.createDebugger()`.
|
|
10
11
|
assert(!isBrowser());
|
|
11
12
|
globalThis.__brillout_debug_createDebugger = createDebugger;
|
|
13
|
+
const flags = [
|
|
14
|
+
'vike:error',
|
|
15
|
+
'vike:extractAssets',
|
|
16
|
+
'vike:extractExportNames',
|
|
17
|
+
'vike:glob',
|
|
18
|
+
'vike:log',
|
|
19
|
+
'vike:optimizeDeps',
|
|
20
|
+
'vike:outDir',
|
|
21
|
+
'vike:pageFiles',
|
|
22
|
+
'vike:pointer-imports',
|
|
23
|
+
'vike:routing',
|
|
24
|
+
'vike:setup',
|
|
25
|
+
'vike:stream',
|
|
26
|
+
'vike:virtual-files'
|
|
27
|
+
];
|
|
28
|
+
const flagRegex = /\bvike:[a-zA-Z-]+/g;
|
|
29
|
+
assertDEBUG();
|
|
12
30
|
function createDebugger(flag, optionsGlobal) {
|
|
13
31
|
checkType(flag);
|
|
32
|
+
assert(flags.includes(flag));
|
|
14
33
|
const debugWithOptions = (optionsLocal) => {
|
|
15
34
|
return (...msgs) => {
|
|
16
35
|
const options = { ...optionsGlobal, ...optionsLocal };
|
|
@@ -18,11 +37,11 @@ function createDebugger(flag, optionsGlobal) {
|
|
|
18
37
|
};
|
|
19
38
|
};
|
|
20
39
|
const debug = (...msgs) => debugWithOptions({})(...msgs);
|
|
21
|
-
objectAssign(debug, { options: debugWithOptions,
|
|
40
|
+
objectAssign(debug, { options: debugWithOptions, isActivated: isDebugActivated(flag) });
|
|
22
41
|
return debug;
|
|
23
42
|
}
|
|
24
43
|
function debug_(flag, options, ...msgs) {
|
|
25
|
-
if (!
|
|
44
|
+
if (!isDebugActivated(flag))
|
|
26
45
|
return;
|
|
27
46
|
let [msgFirst, ...msgsRest] = msgs;
|
|
28
47
|
const padding = ' '.repeat(flag.length + 1);
|
|
@@ -47,17 +66,12 @@ function debug_(flag, options, ...msgs) {
|
|
|
47
66
|
console.log(msg);
|
|
48
67
|
});
|
|
49
68
|
}
|
|
50
|
-
function
|
|
69
|
+
function isDebugActivated(flag) {
|
|
51
70
|
checkType(flag);
|
|
52
|
-
|
|
53
|
-
|
|
54
|
-
|
|
55
|
-
|
|
56
|
-
DEBUG = process.env.DEBUG;
|
|
57
|
-
}
|
|
58
|
-
catch { }
|
|
59
|
-
const isEnabled = DEBUG?.includes(flag) ?? false;
|
|
60
|
-
return isEnabled;
|
|
71
|
+
assert(flags.includes(flag));
|
|
72
|
+
const DEBUG = getDEBUG();
|
|
73
|
+
const isActivated = DEBUG?.includes(flag) ?? false;
|
|
74
|
+
return isActivated;
|
|
61
75
|
}
|
|
62
76
|
function formatMsg(info, options, padding, position) {
|
|
63
77
|
if (info === undefined) {
|
|
@@ -119,3 +133,20 @@ function replaceFunctionSerializer(_key, value) {
|
|
|
119
133
|
}
|
|
120
134
|
return value;
|
|
121
135
|
}
|
|
136
|
+
function assertDEBUG() {
|
|
137
|
+
const DEBUG = getDEBUG() ?? '';
|
|
138
|
+
const flagsActivated = DEBUG.match(flagRegex) ?? [];
|
|
139
|
+
flagsActivated.forEach((flag) => {
|
|
140
|
+
assertUsage(flags.includes(flag), `Unknown DEBUG flag ${pc.cyan(flag)}. Valid flags:\n${flags.map((f) => ` ${pc.cyan(f)}`).join('\n')}`);
|
|
141
|
+
});
|
|
142
|
+
}
|
|
143
|
+
function getDEBUG() {
|
|
144
|
+
let DEBUG;
|
|
145
|
+
// - `process` can be undefined in edge workers
|
|
146
|
+
// - We want bundlers to be able to statically replace `process.env.*`
|
|
147
|
+
try {
|
|
148
|
+
DEBUG = process.env.DEBUG;
|
|
149
|
+
}
|
|
150
|
+
catch { }
|
|
151
|
+
return DEBUG;
|
|
152
|
+
}
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
export { projectInfo };
|
|
2
2
|
export { PROJECT_VERSION };
|
|
3
|
-
declare const PROJECT_VERSION: "0.4.
|
|
3
|
+
declare const PROJECT_VERSION: "0.4.167-commit-14e4b5e";
|
|
4
4
|
declare const projectInfo: {
|
|
5
5
|
projectName: "Vike";
|
|
6
|
-
projectVersion: "0.4.
|
|
6
|
+
projectVersion: "0.4.167-commit-14e4b5e";
|
|
7
7
|
};
|
|
@@ -1,8 +1,8 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { isDebugActivated } from './debug.js';
|
|
2
2
|
import pc from '@brillout/picocolors';
|
|
3
3
|
import { assertIsNotBrowser } from './assertIsNotBrowser.js';
|
|
4
4
|
assertIsNotBrowser();
|
|
5
|
-
if (
|
|
5
|
+
if (isDebugActivated('vike:log')) {
|
|
6
6
|
trackLogs();
|
|
7
7
|
}
|
|
8
8
|
// https://stackoverflow.com/questions/45395369/how-to-get-console-log-line-numbers-shown-in-nodejs/75109905#75109905
|