eddev 2.0.0-beta.53 → 2.0.0-beta.55
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/app/lib/blocks/ContentBlocks.d.ts +1 -1
- package/dist/app/lib/blocks/ContentBlocks.js +2 -2
- package/dist/app/lib/devtools/hooks/useTailwind.d.ts +16 -16
- package/dist/app/lib/hooks/index.d.ts +1 -1
- package/dist/app/lib/hooks/index.js +1 -1
- package/dist/app/lib/hooks/queryUtils.js +1 -1
- package/dist/app/lib/routing/components/RouteRenderer.js +2 -2
- package/dist/app/lib/{hooks → runtime}/apiConfig.d.ts +3 -1
- package/dist/app/lib/{hooks → runtime}/apiConfig.js +0 -3
- package/dist/app/lib/runtime/errorHandling.d.ts +39 -0
- package/dist/app/lib/runtime/errorHandling.js +6 -0
- package/dist/app/lib/runtime/index.d.ts +2 -0
- package/dist/app/lib/runtime/index.js +2 -0
- package/dist/app/utils/BlockErrorBoundary.d.ts +19 -0
- package/dist/app/utils/BlockErrorBoundary.js +38 -0
- package/dist/app/utils/ErrorMessage.d.ts +5 -0
- package/dist/app/utils/ErrorMessage.js +14 -0
- package/dist/app/{lib/blocks/ErrorBoundaryFrontend.d.ts → utils/RouteErrorBoundary.d.ts} +6 -3
- package/dist/app/utils/RouteErrorBoundary.js +38 -0
- package/dist/node/cli/cli.js +1 -1
- package/dist/node/cli/version.d.ts +1 -1
- package/dist/node/cli/version.js +1 -1
- package/package.json +5 -1
- package/dist/app/lib/blocks/ErrorBoundaryFrontend.js +0 -36
|
@@ -20,7 +20,7 @@ export type ContentBlock = {
|
|
|
20
20
|
/**
|
|
21
21
|
* Represents a block instance's position in the hierarchy via relationships with other blocks.
|
|
22
22
|
*/
|
|
23
|
-
type BlocksContext = {
|
|
23
|
+
export type BlocksContext = {
|
|
24
24
|
ancestors: ContentBlock[];
|
|
25
25
|
parent?: ContentBlock;
|
|
26
26
|
prev?: ContentBlock;
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { jsx as _jsx, jsxs as _jsxs } from "react/jsx-runtime";
|
|
2
2
|
import { Fragment, createContext, memo, useContext, useMemo } from "react";
|
|
3
3
|
import { blockManifestReader } from "../internal/read-block-manifest.js";
|
|
4
|
-
import {
|
|
4
|
+
import { BlockErrorBoundary } from "../../utils/BlockErrorBoundary.js";
|
|
5
5
|
import { InlineEditingContextProvider, ReadonlyInlineEditingProvider } from "./inline-editing.js";
|
|
6
6
|
import { addBlockMetadata } from "./block-utils.js";
|
|
7
7
|
export const BlocksContext = createContext(undefined);
|
|
@@ -63,7 +63,7 @@ export const ContentBlocks = memo((props) => {
|
|
|
63
63
|
}
|
|
64
64
|
}
|
|
65
65
|
// Attempt to wrap the block
|
|
66
|
-
return (_jsxs(Fragment, { children: [spaceBefore, _jsx(
|
|
66
|
+
return (_jsxs(Fragment, { children: [spaceBefore, _jsx(BlockErrorBoundary, { block: block, blockContext: ctx, children: blockNode }), spaceAfter] }, index));
|
|
67
67
|
});
|
|
68
68
|
}, [blocks, props.wrapBlock, props.spacer]);
|
|
69
69
|
if (env.admin) {
|
|
@@ -908,15 +908,18 @@ export declare function useTailwindConfig(): {
|
|
|
908
908
|
readonly size?: boolean | undefined;
|
|
909
909
|
readonly backgroundColor?: boolean | undefined;
|
|
910
910
|
readonly inset?: boolean | undefined;
|
|
911
|
+
readonly invert?: boolean | undefined;
|
|
912
|
+
readonly outlineOffset?: boolean | undefined;
|
|
911
913
|
readonly borderRadius?: boolean | undefined;
|
|
912
914
|
readonly padding?: boolean | undefined;
|
|
913
915
|
readonly flex?: boolean | undefined;
|
|
914
916
|
readonly blur?: boolean | undefined;
|
|
915
917
|
readonly resize?: boolean | undefined;
|
|
918
|
+
readonly position?: boolean | undefined;
|
|
919
|
+
readonly columns?: boolean | undefined;
|
|
916
920
|
readonly preflight?: boolean | undefined;
|
|
917
921
|
readonly container?: boolean | undefined;
|
|
918
922
|
readonly accessibility?: boolean | undefined;
|
|
919
|
-
readonly position?: boolean | undefined;
|
|
920
923
|
readonly isolation?: boolean | undefined;
|
|
921
924
|
readonly zIndex?: boolean | undefined;
|
|
922
925
|
readonly gridColumn?: boolean | undefined;
|
|
@@ -956,7 +959,6 @@ export declare function useTailwindConfig(): {
|
|
|
956
959
|
readonly listStyleType?: boolean | undefined;
|
|
957
960
|
readonly listStyleImage?: boolean | undefined;
|
|
958
961
|
readonly appearance?: boolean | undefined;
|
|
959
|
-
readonly columns?: boolean | undefined;
|
|
960
962
|
readonly breakBefore?: boolean | undefined;
|
|
961
963
|
readonly breakInside?: boolean | undefined;
|
|
962
964
|
readonly breakAfter?: boolean | undefined;
|
|
@@ -1028,7 +1030,6 @@ export declare function useTailwindConfig(): {
|
|
|
1028
1030
|
readonly boxShadowColor?: boolean | undefined;
|
|
1029
1031
|
readonly outlineStyle?: boolean | undefined;
|
|
1030
1032
|
readonly outlineWidth?: boolean | undefined;
|
|
1031
|
-
readonly outlineOffset?: boolean | undefined;
|
|
1032
1033
|
readonly outlineColor?: boolean | undefined;
|
|
1033
1034
|
readonly ringWidth?: boolean | undefined;
|
|
1034
1035
|
readonly ringColor?: boolean | undefined;
|
|
@@ -1040,7 +1041,6 @@ export declare function useTailwindConfig(): {
|
|
|
1040
1041
|
readonly dropShadow?: boolean | undefined;
|
|
1041
1042
|
readonly grayscale?: boolean | undefined;
|
|
1042
1043
|
readonly hueRotate?: boolean | undefined;
|
|
1043
|
-
readonly invert?: boolean | undefined;
|
|
1044
1044
|
readonly saturate?: boolean | undefined;
|
|
1045
1045
|
readonly sepia?: boolean | undefined;
|
|
1046
1046
|
readonly backdropBlur?: boolean | undefined;
|
|
@@ -1953,15 +1953,18 @@ export declare function useTailwindConfig(): {
|
|
|
1953
1953
|
readonly size?: boolean | undefined;
|
|
1954
1954
|
readonly backgroundColor?: boolean | undefined;
|
|
1955
1955
|
readonly inset?: boolean | undefined;
|
|
1956
|
+
readonly invert?: boolean | undefined;
|
|
1957
|
+
readonly outlineOffset?: boolean | undefined;
|
|
1956
1958
|
readonly borderRadius?: boolean | undefined;
|
|
1957
1959
|
readonly padding?: boolean | undefined;
|
|
1958
1960
|
readonly flex?: boolean | undefined;
|
|
1959
1961
|
readonly blur?: boolean | undefined;
|
|
1960
1962
|
readonly resize?: boolean | undefined;
|
|
1963
|
+
readonly position?: boolean | undefined;
|
|
1964
|
+
readonly columns?: boolean | undefined;
|
|
1961
1965
|
readonly preflight?: boolean | undefined;
|
|
1962
1966
|
readonly container?: boolean | undefined;
|
|
1963
1967
|
readonly accessibility?: boolean | undefined;
|
|
1964
|
-
readonly position?: boolean | undefined;
|
|
1965
1968
|
readonly isolation?: boolean | undefined;
|
|
1966
1969
|
readonly zIndex?: boolean | undefined;
|
|
1967
1970
|
readonly gridColumn?: boolean | undefined;
|
|
@@ -2001,7 +2004,6 @@ export declare function useTailwindConfig(): {
|
|
|
2001
2004
|
readonly listStyleType?: boolean | undefined;
|
|
2002
2005
|
readonly listStyleImage?: boolean | undefined;
|
|
2003
2006
|
readonly appearance?: boolean | undefined;
|
|
2004
|
-
readonly columns?: boolean | undefined;
|
|
2005
2007
|
readonly breakBefore?: boolean | undefined;
|
|
2006
2008
|
readonly breakInside?: boolean | undefined;
|
|
2007
2009
|
readonly breakAfter?: boolean | undefined;
|
|
@@ -2073,7 +2075,6 @@ export declare function useTailwindConfig(): {
|
|
|
2073
2075
|
readonly boxShadowColor?: boolean | undefined;
|
|
2074
2076
|
readonly outlineStyle?: boolean | undefined;
|
|
2075
2077
|
readonly outlineWidth?: boolean | undefined;
|
|
2076
|
-
readonly outlineOffset?: boolean | undefined;
|
|
2077
2078
|
readonly outlineColor?: boolean | undefined;
|
|
2078
2079
|
readonly ringWidth?: boolean | undefined;
|
|
2079
2080
|
readonly ringColor?: boolean | undefined;
|
|
@@ -2085,7 +2086,6 @@ export declare function useTailwindConfig(): {
|
|
|
2085
2086
|
readonly dropShadow?: boolean | undefined;
|
|
2086
2087
|
readonly grayscale?: boolean | undefined;
|
|
2087
2088
|
readonly hueRotate?: boolean | undefined;
|
|
2088
|
-
readonly invert?: boolean | undefined;
|
|
2089
2089
|
readonly saturate?: boolean | undefined;
|
|
2090
2090
|
readonly sepia?: boolean | undefined;
|
|
2091
2091
|
readonly backdropBlur?: boolean | undefined;
|
|
@@ -2973,15 +2973,18 @@ export declare function useTailwindConfig(): {
|
|
|
2973
2973
|
readonly size?: boolean | undefined;
|
|
2974
2974
|
readonly backgroundColor?: boolean | undefined;
|
|
2975
2975
|
readonly inset?: boolean | undefined;
|
|
2976
|
+
readonly invert?: boolean | undefined;
|
|
2977
|
+
readonly outlineOffset?: boolean | undefined;
|
|
2976
2978
|
readonly borderRadius?: boolean | undefined;
|
|
2977
2979
|
readonly padding?: boolean | undefined;
|
|
2978
2980
|
readonly flex?: boolean | undefined;
|
|
2979
2981
|
readonly blur?: boolean | undefined;
|
|
2980
2982
|
readonly resize?: boolean | undefined;
|
|
2983
|
+
readonly position?: boolean | undefined;
|
|
2984
|
+
readonly columns?: boolean | undefined;
|
|
2981
2985
|
readonly preflight?: boolean | undefined;
|
|
2982
2986
|
readonly container?: boolean | undefined;
|
|
2983
2987
|
readonly accessibility?: boolean | undefined;
|
|
2984
|
-
readonly position?: boolean | undefined;
|
|
2985
2988
|
readonly isolation?: boolean | undefined;
|
|
2986
2989
|
readonly zIndex?: boolean | undefined;
|
|
2987
2990
|
readonly gridColumn?: boolean | undefined;
|
|
@@ -3021,7 +3024,6 @@ export declare function useTailwindConfig(): {
|
|
|
3021
3024
|
readonly listStyleType?: boolean | undefined;
|
|
3022
3025
|
readonly listStyleImage?: boolean | undefined;
|
|
3023
3026
|
readonly appearance?: boolean | undefined;
|
|
3024
|
-
readonly columns?: boolean | undefined;
|
|
3025
3027
|
readonly breakBefore?: boolean | undefined;
|
|
3026
3028
|
readonly breakInside?: boolean | undefined;
|
|
3027
3029
|
readonly breakAfter?: boolean | undefined;
|
|
@@ -3093,7 +3095,6 @@ export declare function useTailwindConfig(): {
|
|
|
3093
3095
|
readonly boxShadowColor?: boolean | undefined;
|
|
3094
3096
|
readonly outlineStyle?: boolean | undefined;
|
|
3095
3097
|
readonly outlineWidth?: boolean | undefined;
|
|
3096
|
-
readonly outlineOffset?: boolean | undefined;
|
|
3097
3098
|
readonly outlineColor?: boolean | undefined;
|
|
3098
3099
|
readonly ringWidth?: boolean | undefined;
|
|
3099
3100
|
readonly ringColor?: boolean | undefined;
|
|
@@ -3105,7 +3106,6 @@ export declare function useTailwindConfig(): {
|
|
|
3105
3106
|
readonly dropShadow?: boolean | undefined;
|
|
3106
3107
|
readonly grayscale?: boolean | undefined;
|
|
3107
3108
|
readonly hueRotate?: boolean | undefined;
|
|
3108
|
-
readonly invert?: boolean | undefined;
|
|
3109
3109
|
readonly saturate?: boolean | undefined;
|
|
3110
3110
|
readonly sepia?: boolean | undefined;
|
|
3111
3111
|
readonly backdropBlur?: boolean | undefined;
|
|
@@ -4018,15 +4018,18 @@ export declare function useTailwindConfig(): {
|
|
|
4018
4018
|
readonly size?: boolean | undefined;
|
|
4019
4019
|
readonly backgroundColor?: boolean | undefined;
|
|
4020
4020
|
readonly inset?: boolean | undefined;
|
|
4021
|
+
readonly invert?: boolean | undefined;
|
|
4022
|
+
readonly outlineOffset?: boolean | undefined;
|
|
4021
4023
|
readonly borderRadius?: boolean | undefined;
|
|
4022
4024
|
readonly padding?: boolean | undefined;
|
|
4023
4025
|
readonly flex?: boolean | undefined;
|
|
4024
4026
|
readonly blur?: boolean | undefined;
|
|
4025
4027
|
readonly resize?: boolean | undefined;
|
|
4028
|
+
readonly position?: boolean | undefined;
|
|
4029
|
+
readonly columns?: boolean | undefined;
|
|
4026
4030
|
readonly preflight?: boolean | undefined;
|
|
4027
4031
|
readonly container?: boolean | undefined;
|
|
4028
4032
|
readonly accessibility?: boolean | undefined;
|
|
4029
|
-
readonly position?: boolean | undefined;
|
|
4030
4033
|
readonly isolation?: boolean | undefined;
|
|
4031
4034
|
readonly zIndex?: boolean | undefined;
|
|
4032
4035
|
readonly gridColumn?: boolean | undefined;
|
|
@@ -4066,7 +4069,6 @@ export declare function useTailwindConfig(): {
|
|
|
4066
4069
|
readonly listStyleType?: boolean | undefined;
|
|
4067
4070
|
readonly listStyleImage?: boolean | undefined;
|
|
4068
4071
|
readonly appearance?: boolean | undefined;
|
|
4069
|
-
readonly columns?: boolean | undefined;
|
|
4070
4072
|
readonly breakBefore?: boolean | undefined;
|
|
4071
4073
|
readonly breakInside?: boolean | undefined;
|
|
4072
4074
|
readonly breakAfter?: boolean | undefined;
|
|
@@ -4138,7 +4140,6 @@ export declare function useTailwindConfig(): {
|
|
|
4138
4140
|
readonly boxShadowColor?: boolean | undefined;
|
|
4139
4141
|
readonly outlineStyle?: boolean | undefined;
|
|
4140
4142
|
readonly outlineWidth?: boolean | undefined;
|
|
4141
|
-
readonly outlineOffset?: boolean | undefined;
|
|
4142
4143
|
readonly outlineColor?: boolean | undefined;
|
|
4143
4144
|
readonly ringWidth?: boolean | undefined;
|
|
4144
4145
|
readonly ringColor?: boolean | undefined;
|
|
@@ -4150,7 +4151,6 @@ export declare function useTailwindConfig(): {
|
|
|
4150
4151
|
readonly dropShadow?: boolean | undefined;
|
|
4151
4152
|
readonly grayscale?: boolean | undefined;
|
|
4152
4153
|
readonly hueRotate?: boolean | undefined;
|
|
4153
|
-
readonly invert?: boolean | undefined;
|
|
4154
4154
|
readonly saturate?: boolean | undefined;
|
|
4155
4155
|
readonly sepia?: boolean | undefined;
|
|
4156
4156
|
readonly backdropBlur?: boolean | undefined;
|
|
@@ -2,7 +2,7 @@ import { useInfiniteQuery, useMutation, useQuery, } from "@tanstack/react-query"
|
|
|
2
2
|
import { useEffect, useState } from "react";
|
|
3
3
|
import { joinURL } from "ufo";
|
|
4
4
|
import { getQueryClient } from "../../utils/query-client.js";
|
|
5
|
-
import { apiConfig } from "
|
|
5
|
+
import { apiConfig } from "../runtime/apiConfig.js";
|
|
6
6
|
function createQueryError(messages, statusCode) {
|
|
7
7
|
const error = new Error(messages.join(", "));
|
|
8
8
|
error.statusCode = statusCode;
|
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
2
|
import { memo, useMemo } from "react";
|
|
3
|
+
import { RouteErrorBoundary } from "../../../utils/RouteErrorBoundary.js";
|
|
3
4
|
import { RouteItemContext } from "../context.js";
|
|
4
5
|
import { useRouter } from "../hooks/useRouter.js";
|
|
5
6
|
import { useRouterState } from "../hooks/useRouterState.js";
|
|
6
|
-
import { ErrorBoundaryFrontend } from "../../blocks/ErrorBoundaryFrontend.js";
|
|
7
7
|
export const AppRenderer = memo(() => {
|
|
8
8
|
const { appData, appComponent: AppComponent } = useRouter().loader;
|
|
9
9
|
const { activeRoute } = useRouterState();
|
|
@@ -23,7 +23,7 @@ export function RouteDisplay(props) {
|
|
|
23
23
|
}
|
|
24
24
|
return useMemo(() => {
|
|
25
25
|
let child = !!Component && _jsx(Component, { ...props.route.props });
|
|
26
|
-
return (_jsx(
|
|
26
|
+
return (_jsx(RouteErrorBoundary, { route: props.route, children: _jsx(RouteItemContext.Provider, { value: props.route, children: child }) }));
|
|
27
27
|
}, [Component, props.route, props.route]);
|
|
28
28
|
}
|
|
29
29
|
RouteDisplay.displayName = "RouteDisplay";
|
|
@@ -1,3 +1,6 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* Configuration options for manipulating how the client interacts with the GraphQL API
|
|
3
|
+
*/
|
|
1
4
|
export type APIConfigStore = {
|
|
2
5
|
/**
|
|
3
6
|
* Any value, which will be used as part of the cache key for each query.
|
|
@@ -17,4 +20,3 @@ export type APIConfigStore = {
|
|
|
17
20
|
set: (config: Partial<APIConfigStore>) => void;
|
|
18
21
|
};
|
|
19
22
|
export declare const apiConfig: APIConfigStore;
|
|
20
|
-
export declare function useAPIConfig(): APIConfigStore;
|
|
@@ -0,0 +1,39 @@
|
|
|
1
|
+
import { ContentBlock } from "../blocks";
|
|
2
|
+
import { ReactNode } from "react";
|
|
3
|
+
import { RouteState } from "../routing";
|
|
4
|
+
export type ErrorEvent = {
|
|
5
|
+
/** The runtime error that occurred */
|
|
6
|
+
error: Error;
|
|
7
|
+
/** The Component stack (not available in renderBlockError) */
|
|
8
|
+
componentStack?: string;
|
|
9
|
+
} & ({
|
|
10
|
+
type: "block";
|
|
11
|
+
/** The block which had an error, including it's type information, props, content and children */
|
|
12
|
+
block: ContentBlock;
|
|
13
|
+
} | {
|
|
14
|
+
type: "route";
|
|
15
|
+
/** The route which had an error */
|
|
16
|
+
route: RouteState;
|
|
17
|
+
});
|
|
18
|
+
/**
|
|
19
|
+
* Configuration options for manipulating how the client interacts with the GraphQL API
|
|
20
|
+
*/
|
|
21
|
+
export type ErrorHandlingConfig = {
|
|
22
|
+
/**
|
|
23
|
+
* Triggered when a runtime error occurs in a block
|
|
24
|
+
* @param event The error event, containing the error and block information
|
|
25
|
+
**/
|
|
26
|
+
onReactError?(event: ErrorEvent): void;
|
|
27
|
+
/**
|
|
28
|
+
* Triggered when a React rendering error occurs, and allows you to return some JSX to render as a fallback.
|
|
29
|
+
* If not provided, the block will be hidden from the user.
|
|
30
|
+
* @param error The error event, containing the error and contextual information
|
|
31
|
+
* @param defaultDisplay The default display for the block — in development, this will display the error message. In production, this will be `null`.
|
|
32
|
+
*/
|
|
33
|
+
renderFallback?(event: ErrorEvent, defaultDisplay: ReactNode): ReactNode;
|
|
34
|
+
/**
|
|
35
|
+
* Update the error handling configuration all at once
|
|
36
|
+
*/
|
|
37
|
+
set: (config: Partial<ErrorHandlingConfig>) => void;
|
|
38
|
+
};
|
|
39
|
+
export declare const errorHandling: ErrorHandlingConfig;
|
|
@@ -0,0 +1,19 @@
|
|
|
1
|
+
import { Component, ErrorInfo, ReactNode } from "react";
|
|
2
|
+
import { BlocksContext, ContentBlock } from "../lib/blocks/ContentBlocks";
|
|
3
|
+
interface Props {
|
|
4
|
+
block: ContentBlock;
|
|
5
|
+
blockContext: BlocksContext;
|
|
6
|
+
children: ReactNode;
|
|
7
|
+
}
|
|
8
|
+
interface State {
|
|
9
|
+
hasError: boolean;
|
|
10
|
+
error?: Error;
|
|
11
|
+
errorInfo?: ErrorInfo;
|
|
12
|
+
}
|
|
13
|
+
export declare class BlockErrorBoundary extends Component<Props, State> {
|
|
14
|
+
state: State;
|
|
15
|
+
static getDerivedStateFromError(error: Error): State;
|
|
16
|
+
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
17
|
+
render(): ReactNode;
|
|
18
|
+
}
|
|
19
|
+
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component } from "react";
|
|
3
|
+
import { errorHandling } from "../lib/runtime";
|
|
4
|
+
import { ErrorMessage } from "./ErrorMessage";
|
|
5
|
+
export class BlockErrorBoundary extends Component {
|
|
6
|
+
state = {
|
|
7
|
+
hasError: false,
|
|
8
|
+
};
|
|
9
|
+
static getDerivedStateFromError(error) {
|
|
10
|
+
// Update state so the next render will show the fallback UI.
|
|
11
|
+
return { hasError: true, error: error };
|
|
12
|
+
}
|
|
13
|
+
componentDidCatch(error, errorInfo) {
|
|
14
|
+
if (errorHandling.onReactError) {
|
|
15
|
+
errorHandling.onReactError({
|
|
16
|
+
type: "block",
|
|
17
|
+
block: this.props.block,
|
|
18
|
+
error,
|
|
19
|
+
componentStack: errorInfo.componentStack,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
if (this.state.hasError) {
|
|
25
|
+
const err = this.state.error;
|
|
26
|
+
let display = env.dev ? _jsx(ErrorMessage, { error: err }) : null;
|
|
27
|
+
if (errorHandling.renderFallback) {
|
|
28
|
+
display = errorHandling.renderFallback({
|
|
29
|
+
type: "block",
|
|
30
|
+
block: this.props.block,
|
|
31
|
+
error: err,
|
|
32
|
+
}, display);
|
|
33
|
+
}
|
|
34
|
+
return display;
|
|
35
|
+
}
|
|
36
|
+
return this.props.children;
|
|
37
|
+
}
|
|
38
|
+
}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
export function ErrorMessage({ error }) {
|
|
3
|
+
return (_jsx("pre", { style: {
|
|
4
|
+
backgroundColor: "#060309",
|
|
5
|
+
fontSize: "12px",
|
|
6
|
+
color: "#d92a0b",
|
|
7
|
+
outline: "1px solid #d92a0b",
|
|
8
|
+
outlineOffset: "-4px",
|
|
9
|
+
borderRadius: "6px",
|
|
10
|
+
padding: "12px 16px",
|
|
11
|
+
overflowX: "auto",
|
|
12
|
+
fontFamily: '"Roboto Mono", Menlo, monospace',
|
|
13
|
+
}, children: error.stack ?? String(error) }));
|
|
14
|
+
}
|
|
@@ -1,15 +1,18 @@
|
|
|
1
1
|
import { Component, ErrorInfo, ReactNode } from "react";
|
|
2
|
+
import { RouteState } from "../lib/routing";
|
|
2
3
|
interface Props {
|
|
4
|
+
route: RouteState;
|
|
3
5
|
children: ReactNode;
|
|
4
6
|
}
|
|
5
7
|
interface State {
|
|
6
8
|
hasError: boolean;
|
|
7
9
|
error?: Error;
|
|
10
|
+
errorInfo?: ErrorInfo;
|
|
8
11
|
}
|
|
9
|
-
export declare class
|
|
12
|
+
export declare class RouteErrorBoundary extends Component<Props, State> {
|
|
10
13
|
state: State;
|
|
11
|
-
static getDerivedStateFromError(
|
|
14
|
+
static getDerivedStateFromError(error: Error): State;
|
|
12
15
|
componentDidCatch(error: Error, errorInfo: ErrorInfo): void;
|
|
13
|
-
render():
|
|
16
|
+
render(): ReactNode;
|
|
14
17
|
}
|
|
15
18
|
export {};
|
|
@@ -0,0 +1,38 @@
|
|
|
1
|
+
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
+
import { Component } from "react";
|
|
3
|
+
import { errorHandling } from "../lib/runtime";
|
|
4
|
+
import { ErrorMessage } from "./ErrorMessage";
|
|
5
|
+
export class RouteErrorBoundary extends Component {
|
|
6
|
+
state = {
|
|
7
|
+
hasError: false,
|
|
8
|
+
};
|
|
9
|
+
static getDerivedStateFromError(error) {
|
|
10
|
+
// Update state so the next render will show the fallback UI.
|
|
11
|
+
return { hasError: true, error: error };
|
|
12
|
+
}
|
|
13
|
+
componentDidCatch(error, errorInfo) {
|
|
14
|
+
if (errorHandling.onReactError) {
|
|
15
|
+
errorHandling.onReactError({
|
|
16
|
+
type: "route",
|
|
17
|
+
route: this.props.route,
|
|
18
|
+
error,
|
|
19
|
+
componentStack: errorInfo.componentStack,
|
|
20
|
+
});
|
|
21
|
+
}
|
|
22
|
+
}
|
|
23
|
+
render() {
|
|
24
|
+
if (this.state.hasError) {
|
|
25
|
+
const err = this.state.error;
|
|
26
|
+
let display = env.dev ? _jsx(ErrorMessage, { error: err }) : null;
|
|
27
|
+
if (errorHandling.renderFallback) {
|
|
28
|
+
display = errorHandling.renderFallback({
|
|
29
|
+
type: "route",
|
|
30
|
+
route: this.props.route,
|
|
31
|
+
error: err,
|
|
32
|
+
}, display);
|
|
33
|
+
}
|
|
34
|
+
return display;
|
|
35
|
+
}
|
|
36
|
+
return this.props.children;
|
|
37
|
+
}
|
|
38
|
+
}
|
package/dist/node/cli/cli.js
CHANGED
|
@@ -143,7 +143,7 @@ program
|
|
|
143
143
|
.option("-s, --serverless", 'Build in "serverless" mode', false)
|
|
144
144
|
.option("--verbose", "Show extra debugging info", false)
|
|
145
145
|
.action(async (options) => {
|
|
146
|
-
process.env["NODE_ENV"] = "
|
|
146
|
+
process.env["NODE_ENV"] = "production";
|
|
147
147
|
/** Ignore self-signed certificate errors in dev mode */
|
|
148
148
|
process.env["NODE_TLS_REJECT_UNAUTHORIZED"] = "0";
|
|
149
149
|
init(options.verbose);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
export declare const VERSION = "2.0.0-beta.
|
|
1
|
+
export declare const VERSION = "2.0.0-beta.55";
|
package/dist/node/cli/version.js
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
export const VERSION = "2.0.0-beta.
|
|
1
|
+
export const VERSION = "2.0.0-beta.55";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "eddev",
|
|
3
|
-
"version": "2.0.0-beta.
|
|
3
|
+
"version": "2.0.0-beta.55",
|
|
4
4
|
"description": "",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"type": "module",
|
|
@@ -38,6 +38,10 @@
|
|
|
38
38
|
"types": "./dist/app/lib/devtools/index.d.ts",
|
|
39
39
|
"import": "./dist/app/lib/devtools/index.js"
|
|
40
40
|
},
|
|
41
|
+
"./runtime": {
|
|
42
|
+
"types": "./dist/app/lib/runtime/index.d.ts",
|
|
43
|
+
"import": "./dist/app/lib/runtime/index.js"
|
|
44
|
+
},
|
|
41
45
|
"./server": {
|
|
42
46
|
"types": "./dist/app/server/index.d.ts",
|
|
43
47
|
"import": "./dist/app/server/index.js"
|
|
@@ -1,36 +0,0 @@
|
|
|
1
|
-
import { jsx as _jsx } from "react/jsx-runtime";
|
|
2
|
-
import { Component } from "react";
|
|
3
|
-
export class ErrorBoundaryFrontend extends Component {
|
|
4
|
-
state = {
|
|
5
|
-
hasError: false,
|
|
6
|
-
};
|
|
7
|
-
static getDerivedStateFromError(err) {
|
|
8
|
-
// Update state so the next render will show the fallback UI.
|
|
9
|
-
return { hasError: true, error: err };
|
|
10
|
-
}
|
|
11
|
-
componentDidCatch(error, errorInfo) {
|
|
12
|
-
console.log("Caught error:", error, errorInfo);
|
|
13
|
-
console.error("Uncaught error:", error, errorInfo);
|
|
14
|
-
}
|
|
15
|
-
render() {
|
|
16
|
-
if (this.state.hasError) {
|
|
17
|
-
const err = this.state.error;
|
|
18
|
-
if (env.dev) {
|
|
19
|
-
return (_jsx("pre", { style: {
|
|
20
|
-
backgroundColor: "#fafafa",
|
|
21
|
-
fontSize: "12px",
|
|
22
|
-
color: "#d92a0b",
|
|
23
|
-
border: "2px solid #d92a0b",
|
|
24
|
-
borderRadius: "4px",
|
|
25
|
-
padding: "8px",
|
|
26
|
-
overflowX: "auto",
|
|
27
|
-
fontFamily: '"Roboto Mono", Menlo, monospace',
|
|
28
|
-
}, children: err.stack }));
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
return null;
|
|
32
|
-
}
|
|
33
|
-
}
|
|
34
|
-
return this.props.children;
|
|
35
|
-
}
|
|
36
|
-
}
|