@shuvi/error-overlay 1.0.16 → 1.0.18
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/package.json +3 -3
- package/umd/client.d.ts +15 -0
- package/umd/constants.d.ts +7 -0
- package/umd/iframeScript.d.ts +1 -0
- package/umd/index.d.ts +2 -0
- package/umd/middleware/helper/createOriginalStackFrame.d.ts +15 -0
- package/umd/middleware/helper/findOriginalSourcePositionAndContent.d.ts +7 -0
- package/umd/middleware/helper/getModuleById.d.ts +2 -0
- package/umd/middleware/helper/getOriginalStackFrame.d.ts +6 -0
- package/umd/middleware/helper/getSourceById.d.ts +6 -0
- package/umd/middleware/helper/getSourceMapUrl.d.ts +1 -0
- package/umd/middleware/helper/getSourcePath.d.ts +1 -0
- package/umd/middleware/index.d.ts +2 -0
- package/umd/middleware/launchEditorMiddleware.d.ts +2 -0
- package/umd/middleware/stackFrameMiddleware.d.ts +2 -0
- package/umd/view/ErrorOverlay.d.ts +2 -0
- package/umd/view/components/Dialog/Dialog.d.ts +10 -0
- package/umd/view/components/Dialog/DialogBody.d.ts +7 -0
- package/umd/view/components/Dialog/DialogContent.d.ts +7 -0
- package/umd/view/components/Dialog/DialogHeader.d.ts +7 -0
- package/umd/view/components/Dialog/index.d.ts +5 -0
- package/umd/view/components/Dialog/styles.d.ts +2 -0
- package/umd/view/components/Errors/CallStackFrame/CallStackFrame.d.ts +10 -0
- package/umd/view/components/Errors/CallStackFrame/index.d.ts +1 -0
- package/umd/view/components/Errors/CodeFrame/CodeFrame.d.ts +7 -0
- package/umd/view/components/Errors/CodeFrame/index.d.ts +1 -0
- package/umd/view/components/Errors/Errors.d.ts +7 -0
- package/umd/view/components/Errors/index.d.ts +2 -0
- package/umd/view/components/Errors/styles.d.ts +1 -0
- package/umd/view/components/Icons/ArrowLeftIcon.d.ts +3 -0
- package/umd/view/components/Icons/ArrowRightIcon.d.ts +3 -0
- package/umd/view/components/Icons/CloseIcon.d.ts +3 -0
- package/umd/view/components/Icons/ExternalLinkIcon.d.ts +3 -0
- package/umd/view/components/Icons/WarningIcon.d.ts +3 -0
- package/umd/view/components/Icons/index.d.ts +5 -0
- package/umd/view/components/NavigationBar/NavigationBar.d.ts +10 -0
- package/umd/view/components/NavigationBar/index.d.ts +2 -0
- package/umd/view/components/NavigationBar/styles.d.ts +2 -0
- package/umd/view/components/Overlay/Overlay.d.ts +8 -0
- package/umd/view/components/Overlay/body-locker.d.ts +2 -0
- package/umd/view/components/Overlay/index.d.ts +2 -0
- package/umd/view/components/Overlay/styles.d.ts +2 -0
- package/umd/view/components/ShadowPortal.d.ts +5 -0
- package/umd/view/components/Terminal/Terminal.d.ts +5 -0
- package/umd/view/components/Terminal/index.d.ts +2 -0
- package/umd/view/components/Terminal/styles.d.ts +2 -0
- package/umd/view/components/Toast/Toast.d.ts +7 -0
- package/umd/view/components/Toast/index.d.ts +2 -0
- package/umd/view/components/Toast/styles.d.ts +2 -0
- package/umd/view/container/BuildError.d.ts +6 -0
- package/umd/view/container/RuntimeError.d.ts +11 -0
- package/umd/view/container/index.d.ts +2 -0
- package/umd/view/errorTypeHandler.d.ts +27 -0
- package/umd/view/helpers/getErrorByType.d.ts +9 -0
- package/umd/view/helpers/nodeStackFrames.d.ts +7 -0
- package/umd/view/helpers/noop-template.d.ts +1 -0
- package/umd/view/helpers/parseStack.d.ts +3 -0
- package/umd/view/helpers/stack-frame.d.ts +12 -0
- package/umd/view/hooks/use-on-click-outside.d.ts +1 -0
- package/umd/view/styles/Base.d.ts +2 -0
- package/umd/view/styles/ComponentStyles.d.ts +2 -0
- package/umd/view/styles/CssReset.d.ts +2 -0
- package/umd/view/styles/index.d.ts +3 -0
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@shuvi/error-overlay",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.18",
|
|
4
4
|
"main": "umd/index.js",
|
|
5
5
|
"types": "lib/index.d.ts",
|
|
6
6
|
"files": [
|
|
@@ -23,8 +23,8 @@
|
|
|
23
23
|
},
|
|
24
24
|
"dependencies": {
|
|
25
25
|
"@babel/code-frame": "7.14.5",
|
|
26
|
-
"@shuvi/shared": "1.0.
|
|
27
|
-
"@shuvi/toolpack": "1.0.
|
|
26
|
+
"@shuvi/shared": "1.0.18",
|
|
27
|
+
"@shuvi/toolpack": "1.0.18",
|
|
28
28
|
"anser": "1.4.9",
|
|
29
29
|
"data-uri-to-buffer": "3.0.1",
|
|
30
30
|
"html-entities": "2.3.2",
|
package/umd/client.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
declare global {
|
|
2
|
+
interface Window {
|
|
3
|
+
__SHUVI_ERROR_OVERLAY_GLOBAL_HOOK__: string | {};
|
|
4
|
+
}
|
|
5
|
+
}
|
|
6
|
+
declare function startReportingRuntimeErrors({ onError }: {
|
|
7
|
+
onError: () => void;
|
|
8
|
+
}): void;
|
|
9
|
+
declare function stopReportingRuntimeErrors(): void;
|
|
10
|
+
declare function onBuildOk(): void;
|
|
11
|
+
declare function onBuildError(message: string): void;
|
|
12
|
+
declare function onRefresh(): void;
|
|
13
|
+
export { getErrorByType } from './view/helpers/getErrorByType';
|
|
14
|
+
export { getServerError } from './view/helpers/nodeStackFrames';
|
|
15
|
+
export { onBuildError, onBuildOk, onRefresh, startReportingRuntimeErrors, stopReportingRuntimeErrors };
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
export declare const SERVER_TYPE_ERROR = "server";
|
|
2
|
+
export declare const TYPE_BUILD_OK = "build-ok";
|
|
3
|
+
export declare const TYPE_REFRESH = "fast-refresh";
|
|
4
|
+
export declare const TYPE_BUILD_ERROR = "build-error";
|
|
5
|
+
export declare const TYPE_UNHANDLED_ERROR = "unhandled-error";
|
|
6
|
+
export declare const TYPE_UNHANDLED_REJECTION = "unhandled-rejection";
|
|
7
|
+
export declare const STACK_TRACE_LIMIT = 50;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export {};
|
package/umd/index.d.ts
ADDED
|
@@ -0,0 +1,15 @@
|
|
|
1
|
+
import { StackFrame } from 'stacktrace-parser';
|
|
2
|
+
import type webpack from '@shuvi/toolpack/lib/webpack';
|
|
3
|
+
export declare type OriginalStackFrameResponse = {
|
|
4
|
+
originalStackFrame: StackFrame;
|
|
5
|
+
originalCodeFrame: string | null;
|
|
6
|
+
};
|
|
7
|
+
export declare function createOriginalStackFrame({ line, column, source, modulePath, frame, errorMessage, compilation }: {
|
|
8
|
+
line: number;
|
|
9
|
+
column: number | null;
|
|
10
|
+
source: any;
|
|
11
|
+
modulePath?: string;
|
|
12
|
+
frame: any;
|
|
13
|
+
errorMessage?: string;
|
|
14
|
+
compilation?: webpack.Compilation;
|
|
15
|
+
}): Promise<OriginalStackFrameResponse | null>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import type { StackFrame } from 'stacktrace-parser';
|
|
2
|
+
import type webpack from '@shuvi/toolpack/lib/webpack';
|
|
3
|
+
import type { Source } from './getSourceById';
|
|
4
|
+
import type { OriginalStackFrame } from '../../view/helpers/stack-frame';
|
|
5
|
+
export { OriginalStackFrame };
|
|
6
|
+
export declare function getOriginalStackFrame(frame: StackFrame, cache: Map<string, Source | null>, resolveBuildFile: (...paths: string[]) => string, buildDir: string, errorMessage?: string, compilation?: webpack.Compilation): Promise<OriginalStackFrame>;
|
|
@@ -0,0 +1,6 @@
|
|
|
1
|
+
import { RawSourceMap } from 'source-map';
|
|
2
|
+
import type { webpack } from '@shuvi/toolpack/lib/webpack';
|
|
3
|
+
export declare type Source = {
|
|
4
|
+
map: () => RawSourceMap;
|
|
5
|
+
} | null;
|
|
6
|
+
export declare function getSourceById(isFile: boolean, id: string, compiler: webpack.Compiler, resolveBuildFile: (...paths: string[]) => string, buildDir: string, compilation?: webpack.Compilation): Promise<Source>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSourceMapUrl(fileContents: string): string | null;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function getSourcePath(source: string): string;
|
|
@@ -0,0 +1,2 @@
|
|
|
1
|
+
import { IncomingMessage, ServerResponse } from 'http';
|
|
2
|
+
export declare function stackFrameMiddleware(originalStackFrameEndpoint: string, bundler: any, resolveBuildFile: (...paths: string[]) => string, buildDefaultDir: string, buildServerDir: string): (req: IncomingMessage, res: ServerResponse, next: Function) => Promise<any>;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare type DialogProps = {
|
|
3
|
+
type: 'error' | 'warning';
|
|
4
|
+
'aria-labelledby': string;
|
|
5
|
+
'aria-describedby': string;
|
|
6
|
+
onClose?: (e: MouseEvent | TouchEvent) => void;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
declare const Dialog: React.FC<DialogProps>;
|
|
10
|
+
export { Dialog };
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { StackFrame } from 'stacktrace-parser';
|
|
3
|
+
import { OriginalStackFrame } from '../../../helpers/stack-frame';
|
|
4
|
+
export declare type CallStackFrameProps = {
|
|
5
|
+
stackFrame: StackFrame;
|
|
6
|
+
codeFrame: string;
|
|
7
|
+
};
|
|
8
|
+
export declare const CallStackFrame: React.FC<{
|
|
9
|
+
frame: OriginalStackFrame;
|
|
10
|
+
}>;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CallStackFrame } from './CallStackFrame';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export { CodeFrame } from './CodeFrame';
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare const styles: string;
|
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
export declare type NavigationBarProps = {
|
|
3
|
+
className?: string;
|
|
4
|
+
previous: (() => void) | null;
|
|
5
|
+
next: (() => void) | null;
|
|
6
|
+
close?: () => void;
|
|
7
|
+
children: React.ReactNode;
|
|
8
|
+
};
|
|
9
|
+
declare const NavigationBar: React.FC<NavigationBarProps>;
|
|
10
|
+
export { NavigationBar };
|
|
@@ -0,0 +1,11 @@
|
|
|
1
|
+
import * as React from 'react';
|
|
2
|
+
import { UnhandledError, UnhandledRejection } from '../errorTypeHandler';
|
|
3
|
+
export declare type SupportedErrorEvent = {
|
|
4
|
+
id: number;
|
|
5
|
+
event: UnhandledError | UnhandledRejection;
|
|
6
|
+
};
|
|
7
|
+
export declare type RuntimeErrorProps = {
|
|
8
|
+
errors: SupportedErrorEvent[];
|
|
9
|
+
};
|
|
10
|
+
export declare const RuntimeError: React.FC<RuntimeErrorProps>;
|
|
11
|
+
export declare const styles: string;
|
|
@@ -0,0 +1,27 @@
|
|
|
1
|
+
import { StackFrame } from 'stacktrace-parser';
|
|
2
|
+
import { TYPE_BUILD_OK, TYPE_REFRESH, TYPE_BUILD_ERROR, TYPE_UNHANDLED_ERROR, TYPE_UNHANDLED_REJECTION } from '../constants';
|
|
3
|
+
export declare type BuildOk = {
|
|
4
|
+
type: typeof TYPE_BUILD_OK;
|
|
5
|
+
};
|
|
6
|
+
export declare type FastRefresh = {
|
|
7
|
+
type: typeof TYPE_REFRESH;
|
|
8
|
+
};
|
|
9
|
+
export declare type BuildError = {
|
|
10
|
+
type: typeof TYPE_BUILD_ERROR;
|
|
11
|
+
message: string;
|
|
12
|
+
};
|
|
13
|
+
export declare type UnhandledError = {
|
|
14
|
+
type: typeof TYPE_UNHANDLED_ERROR;
|
|
15
|
+
reason: Error;
|
|
16
|
+
frames: StackFrame[];
|
|
17
|
+
};
|
|
18
|
+
export declare type UnhandledRejection = {
|
|
19
|
+
type: typeof TYPE_UNHANDLED_REJECTION;
|
|
20
|
+
reason: Error;
|
|
21
|
+
frames: StackFrame[];
|
|
22
|
+
};
|
|
23
|
+
export declare type ErrorTypeEvent = BuildOk | FastRefresh | BuildError | UnhandledError | UnhandledRejection;
|
|
24
|
+
export declare type ErrorTypeEventHandler = (ev: ErrorTypeEvent) => void;
|
|
25
|
+
export declare function emit(ev: ErrorTypeEvent): void;
|
|
26
|
+
export declare function on(fn: ErrorTypeEventHandler): boolean;
|
|
27
|
+
export declare function off(fn: ErrorTypeEventHandler): boolean;
|
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
import { SupportedErrorEvent } from '../container/RuntimeError';
|
|
2
|
+
import { OriginalStackFrame } from './stack-frame';
|
|
3
|
+
export declare type ReadyRuntimeError = {
|
|
4
|
+
id: number;
|
|
5
|
+
runtime: true;
|
|
6
|
+
error: Error;
|
|
7
|
+
frames: OriginalStackFrame[];
|
|
8
|
+
};
|
|
9
|
+
export declare function getErrorByType(ev: SupportedErrorEvent): Promise<ReadyRuntimeError>;
|
|
@@ -0,0 +1,7 @@
|
|
|
1
|
+
import { StackFrame } from 'stacktrace-parser';
|
|
2
|
+
declare type ErrorType = 'server';
|
|
3
|
+
export declare function getFilesystemFrame(frame: StackFrame): StackFrame;
|
|
4
|
+
export declare function decorateServerError(error: Error): void;
|
|
5
|
+
export declare function getServerError(error: Error): Error;
|
|
6
|
+
export declare function getErrorSource(error: Error): ErrorType | null;
|
|
7
|
+
export {};
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function noop(strings: TemplateStringsArray, ...keys: readonly string[]): string;
|
|
@@ -0,0 +1,12 @@
|
|
|
1
|
+
import { StackFrame } from 'stacktrace-parser';
|
|
2
|
+
export declare type OriginalStackFrame = {
|
|
3
|
+
error: boolean;
|
|
4
|
+
reason: string | null;
|
|
5
|
+
external: boolean;
|
|
6
|
+
expanded: boolean;
|
|
7
|
+
sourceStackFrame: StackFrame;
|
|
8
|
+
originalStackFrame: StackFrame | null;
|
|
9
|
+
originalCodeFrame: string | null;
|
|
10
|
+
};
|
|
11
|
+
export declare function getOriginalStackFrames(frames: StackFrame[], type: 'server' | null, errorMessage: string): Promise<OriginalStackFrame[]>;
|
|
12
|
+
export declare function getFrameSource(frame: StackFrame): string;
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
export declare function useOnClickOutside(el: Node | null, handler: ((e: MouseEvent | TouchEvent) => void) | undefined): void;
|