vike 0.4.240-commit-098ff81 → 0.4.240-commit-bcd07ae
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/esm/client/runtime-client-routing/renderPageClientSide.js +14 -6
- package/dist/esm/node/runtime/logErrorServer.d.ts +2 -0
- package/dist/esm/node/runtime/logErrorServer.js +14 -0
- package/dist/esm/node/runtime/renderPage/loggerProd.js +3 -5
- package/dist/esm/node/vite/shared/loggerNotProd/log.js +3 -1
- package/dist/esm/utils/PROJECT_VERSION.d.ts +1 -1
- package/dist/esm/utils/PROJECT_VERSION.js +1 -1
- package/dist/esm/utils/debug.js +1 -1
- package/package.json +1 -1
|
@@ -3,7 +3,7 @@ export { getRenderCount };
|
|
|
3
3
|
export { disableClientRouting };
|
|
4
4
|
export { firstRenderStartPromise };
|
|
5
5
|
export { getPageContextClient };
|
|
6
|
-
import { assert, objectAssign, redirectHard, getGlobalObject, hasProp, updateType, genPromise, isCallable, catchInfiniteLoop, } from './utils.js';
|
|
6
|
+
import { assert, objectAssign, redirectHard, getGlobalObject, hasProp, updateType, genPromise, isCallable, catchInfiniteLoop, isObject, } from './utils.js';
|
|
7
7
|
import { getPageContextFromClientHooks, getPageContextFromServerHooks, getPageContextFromHooks_isHydration, getPageContextFromHooks_serialized, setPageContextInitIsPassedToClient, } from './getPageContextFromHooks.js';
|
|
8
8
|
import { createPageContextClientSide } from './createPageContextClientSide.js';
|
|
9
9
|
import { addLinkPrefetchHandlers, addLinkPrefetchHandlers_unwatch, addLinkPrefetchHandlers_watch, getPageContextPrefetched, populatePageContextPrefetchCache, } from './prefetch.js';
|
|
@@ -241,7 +241,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
241
241
|
// We don't swallow 404 errors:
|
|
242
242
|
// - On the server-side, Vike swallows / doesn't show any 404 error log because it's expected that a user may go to some random non-existent URL. (We don't want to flood the app's error tracking with 404 logs.)
|
|
243
243
|
// - On the client-side, if the user navigates to a 404 then it means that the UI has a broken link. (It isn't expected that users can go to some random URL using the client-side router, as it would require, for example, the user to manually change the URL of a link by manually manipulating the DOM which highly unlikely.)
|
|
244
|
-
|
|
244
|
+
logError(err);
|
|
245
245
|
}
|
|
246
246
|
else {
|
|
247
247
|
// We swallow throw redirect()/render() called by client-side hooks onBeforeRender()/data()/guard()
|
|
@@ -272,7 +272,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
272
272
|
- An infinite reloading page is a even worse UX than a blank page.
|
|
273
273
|
redirectHard(urlOriginal)
|
|
274
274
|
*/
|
|
275
|
-
|
|
275
|
+
logError(err);
|
|
276
276
|
};
|
|
277
277
|
const errorPageId = getErrorPageId(pageContext._pageFilesAll, pageContext._globalContext._pageConfigs);
|
|
278
278
|
if (!errorPageId)
|
|
@@ -384,7 +384,7 @@ async function renderPageClientSide(renderArgs) {
|
|
|
384
384
|
await handleError({ err });
|
|
385
385
|
}
|
|
386
386
|
else {
|
|
387
|
-
|
|
387
|
+
logError(err);
|
|
388
388
|
}
|
|
389
389
|
};
|
|
390
390
|
// We use globalObject.onRenderClientPreviousPromise in order to ensure that there is never two concurrent onRenderClient() calls
|
|
@@ -515,10 +515,10 @@ function changeUrl(url, overwriteLastHistoryEntry) {
|
|
|
515
515
|
pushHistoryState(url, overwriteLastHistoryEntry);
|
|
516
516
|
}
|
|
517
517
|
function disableClientRouting(err, log) {
|
|
518
|
-
assert(isErrorFetchingStaticAssets(err));
|
|
519
518
|
globalObject.clientRoutingIsDisabled = true;
|
|
519
|
+
assert(isErrorFetchingStaticAssets(err));
|
|
520
520
|
if (log) {
|
|
521
|
-
// We don't use console.error() to avoid flooding error trackers such as Sentry
|
|
521
|
+
// We purposely don't use console.error() to avoid flooding error trackers such as Sentry
|
|
522
522
|
console.log(err);
|
|
523
523
|
}
|
|
524
524
|
assertInfo(false, [
|
|
@@ -665,3 +665,11 @@ if (import.meta.env.DEV && import.meta.hot)
|
|
|
665
665
|
});
|
|
666
666
|
}
|
|
667
667
|
});
|
|
668
|
+
function logError(err) {
|
|
669
|
+
if (isObject(err) &&
|
|
670
|
+
// Set by vike-react
|
|
671
|
+
err.isAlreadyLogged) {
|
|
672
|
+
return;
|
|
673
|
+
}
|
|
674
|
+
console.error(err);
|
|
675
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
export { logErrorServer };
|
|
2
|
+
import pc from '@brillout/picocolors';
|
|
3
|
+
import { isCallable, isObject } from './utils.js';
|
|
4
|
+
function logErrorServer(err) {
|
|
5
|
+
if (isObject(err) &&
|
|
6
|
+
// Set by react-streaming
|
|
7
|
+
isCallable(err.prettifyThisError)) {
|
|
8
|
+
err = err.prettifyThisError(err);
|
|
9
|
+
}
|
|
10
|
+
// We ensure we print a string; Cloudflare Workers doesn't seem to properly stringify `Error` objects.
|
|
11
|
+
// - TO-DO/eventuually: is that still true? Let's eventuually remove it and see if it crashes Cloudflare.
|
|
12
|
+
const errStr = isObject(err) && 'stack' in err ? String(err.stack) : String(err);
|
|
13
|
+
console.error(pc.red(errStr));
|
|
14
|
+
}
|
|
@@ -4,18 +4,16 @@ export { logErrorProd };
|
|
|
4
4
|
export { onRuntimeError };
|
|
5
5
|
import { isAbortError } from '../../../shared/route/abort.js';
|
|
6
6
|
import { setAlreadyLogged } from './isNewError.js';
|
|
7
|
-
import {
|
|
8
|
-
import pc from '@brillout/picocolors';
|
|
7
|
+
import { warnIfErrorIsNotObject } from '../utils.js';
|
|
9
8
|
import { logErrorHint } from './logErrorHint.js';
|
|
9
|
+
import { logErrorServer } from '../logErrorServer.js';
|
|
10
10
|
function logErrorProd(err, _httpRequestId) {
|
|
11
11
|
warnIfErrorIsNotObject(err);
|
|
12
12
|
setAlreadyLogged(err);
|
|
13
13
|
if (isAbortError(err)) {
|
|
14
14
|
return;
|
|
15
15
|
}
|
|
16
|
-
|
|
17
|
-
const errStr = isObject(err) && 'stack' in err ? String(err.stack) : String(err);
|
|
18
|
-
console.error(pc.red(errStr));
|
|
16
|
+
logErrorServer(err);
|
|
19
17
|
// Needs to be called after logging the error.
|
|
20
18
|
onRuntimeError(err);
|
|
21
19
|
}
|
|
@@ -6,6 +6,7 @@ import { assert, stripAnsi, hasProp, assertIsNotProductionRuntime, PROJECT_VERSI
|
|
|
6
6
|
import pc from '@brillout/picocolors';
|
|
7
7
|
import { isErrorDebug } from '../../../shared/isErrorDebug.js';
|
|
8
8
|
import { getViteDevServer } from '../../../runtime/globalContext.js';
|
|
9
|
+
import { logErrorServer } from '../../../runtime/logErrorServer.js';
|
|
9
10
|
assertIsNotProductionRuntime();
|
|
10
11
|
function logWithVikeTag(msg, logType, category, showVikeVersion = false) {
|
|
11
12
|
const projectTag = getProjectTag(showVikeVersion);
|
|
@@ -40,7 +41,8 @@ function logDirectly(thing, logType) {
|
|
|
40
41
|
return;
|
|
41
42
|
}
|
|
42
43
|
if (logType === 'error') {
|
|
43
|
-
console.error(
|
|
44
|
+
// console.error()
|
|
45
|
+
logErrorServer(thing);
|
|
44
46
|
return;
|
|
45
47
|
}
|
|
46
48
|
if (logType === 'error-recover') {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const PROJECT_VERSION: "0.4.240-commit-
|
|
1
|
+
export declare const PROJECT_VERSION: "0.4.240-commit-bcd07ae";
|
|
@@ -1,2 +1,2 @@
|
|
|
1
1
|
// Automatically updated by @brillout/release-me
|
|
2
|
-
export const PROJECT_VERSION = '0.4.240-commit-
|
|
2
|
+
export const PROJECT_VERSION = '0.4.240-commit-bcd07ae';
|
package/dist/esm/utils/debug.js
CHANGED
|
@@ -158,7 +158,7 @@ function assertFlagsActivated() {
|
|
|
158
158
|
function getFlagsActivated() {
|
|
159
159
|
const flagsActivated = DEBUG.match(/\bvike:[a-zA-Z-]+/g) ?? [];
|
|
160
160
|
const isAll = DEBUG.includes('vike:*');
|
|
161
|
-
const isGlobal = /\bvike\b[^:]/.test(DEBUG);
|
|
161
|
+
const isGlobal = /\bvike\b([^:]|$)/.test(DEBUG);
|
|
162
162
|
return { flagsActivated, isAll, isGlobal };
|
|
163
163
|
}
|
|
164
164
|
function isDebug() {
|