@contember/react-devbar 2.1.0-alpha.8 → 2.1.0-beta.1
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/development/index.cjs +2 -2
- package/dist/development/index.js +1 -1
- package/dist/development/src/DevErrorManager.cjs.map +1 -1
- package/dist/development/src/DevErrorManager.js.map +1 -1
- package/dist/development/src/errorHandling.cjs +2 -22
- package/dist/development/src/errorHandling.cjs.map +1 -1
- package/dist/development/src/errorHandling.js +2 -5
- package/dist/development/src/errorHandling.js.map +1 -1
- package/dist/development/src/hooks/useCopyErrorMarkdown.cjs +101 -0
- package/dist/development/src/hooks/useCopyErrorMarkdown.cjs.map +1 -0
- package/dist/development/src/hooks/useCopyErrorMarkdown.js +101 -0
- package/dist/development/src/hooks/useCopyErrorMarkdown.js.map +1 -0
- package/dist/development/src/hooks/useParsedStacktrace.cjs.map +1 -1
- package/dist/development/src/hooks/useParsedStacktrace.js.map +1 -1
- package/dist/development/src/ui/DevBar/DevBar.cjs +15 -13
- package/dist/development/src/ui/DevBar/DevBar.cjs.map +1 -1
- package/dist/development/src/ui/DevBar/DevBar.js +15 -13
- package/dist/development/src/ui/DevBar/DevBar.js.map +1 -1
- package/dist/development/src/ui/DevError/DevError.cjs.map +1 -1
- package/dist/development/src/ui/DevError/DevError.js.map +1 -1
- package/dist/development/src/ui/DevError/DevErrorBadge.cjs +2 -2
- package/dist/development/src/ui/DevError/DevErrorBadge.cjs.map +1 -1
- package/dist/development/src/ui/DevError/DevErrorBadge.js +2 -2
- package/dist/development/src/ui/DevError/DevErrorBadge.js.map +1 -1
- package/dist/development/src/ui/DevError/DevErrorCopy.cjs +36 -0
- package/dist/development/src/ui/DevError/DevErrorCopy.cjs.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorCopy.js +36 -0
- package/dist/development/src/ui/DevError/DevErrorCopy.js.map +1 -0
- package/dist/development/src/ui/DevError/DevErrorInner.cjs +26 -26
- package/dist/development/src/ui/DevError/DevErrorInner.cjs.map +1 -1
- package/dist/development/src/ui/DevError/DevErrorInner.js +26 -26
- package/dist/development/src/ui/DevError/DevErrorInner.js.map +1 -1
- package/dist/development/src/ui/DevError/DevErrorList.cjs +35 -27
- package/dist/development/src/ui/DevError/DevErrorList.cjs.map +1 -1
- package/dist/development/src/ui/DevError/DevErrorList.js +35 -27
- package/dist/development/src/ui/DevError/DevErrorList.js.map +1 -1
- package/dist/development/src/ui/DevError/StackTrace.cjs +11 -11
- package/dist/development/src/ui/DevError/StackTrace.cjs.map +1 -1
- package/dist/development/src/ui/DevError/StackTrace.js +11 -11
- package/dist/development/src/ui/DevError/StackTrace.js.map +1 -1
- package/dist/production/index.cjs +2 -2
- package/dist/production/index.js +1 -1
- package/dist/production/src/errorHandling.cjs +1 -21
- package/dist/production/src/errorHandling.cjs.map +1 -1
- package/dist/production/src/errorHandling.js +1 -4
- package/dist/production/src/errorHandling.js.map +1 -1
- package/dist/production/src/hooks/useCopyErrorMarkdown.cjs +101 -0
- package/dist/production/src/hooks/useCopyErrorMarkdown.cjs.map +1 -0
- package/dist/production/src/hooks/useCopyErrorMarkdown.js +101 -0
- package/dist/production/src/hooks/useCopyErrorMarkdown.js.map +1 -0
- package/dist/production/src/hooks/useParsedStacktrace.cjs.map +1 -1
- package/dist/production/src/hooks/useParsedStacktrace.js.map +1 -1
- package/dist/production/src/ui/DevBar/DevBar.cjs +2 -0
- package/dist/production/src/ui/DevBar/DevBar.cjs.map +1 -1
- package/dist/production/src/ui/DevBar/DevBar.js +2 -0
- package/dist/production/src/ui/DevBar/DevBar.js.map +1 -1
- package/dist/production/src/ui/DevError/DevError.cjs.map +1 -1
- package/dist/production/src/ui/DevError/DevError.js.map +1 -1
- package/dist/production/src/ui/DevError/DevErrorBadge.cjs.map +1 -1
- package/dist/production/src/ui/DevError/DevErrorBadge.js.map +1 -1
- package/dist/production/src/ui/DevError/DevErrorCopy.cjs +28 -0
- package/dist/production/src/ui/DevError/DevErrorCopy.cjs.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorCopy.js +28 -0
- package/dist/production/src/ui/DevError/DevErrorCopy.js.map +1 -0
- package/dist/production/src/ui/DevError/DevErrorInner.cjs.map +1 -1
- package/dist/production/src/ui/DevError/DevErrorInner.js.map +1 -1
- package/dist/production/src/ui/DevError/DevErrorList.cjs +10 -6
- package/dist/production/src/ui/DevError/DevErrorList.cjs.map +1 -1
- package/dist/production/src/ui/DevError/DevErrorList.js +10 -6
- package/dist/production/src/ui/DevError/DevErrorList.js.map +1 -1
- package/dist/production/src/ui/DevError/StackTrace.cjs.map +1 -1
- package/dist/production/src/ui/DevError/StackTrace.js.map +1 -1
- package/dist/types/errorHandling.d.ts.map +1 -1
- package/dist/types/hooks/useCopyErrorMarkdown.d.ts +12 -0
- package/dist/types/hooks/useCopyErrorMarkdown.d.ts.map +1 -0
- package/dist/types/tsconfig.tsbuildinfo +1 -1
- package/dist/types/ui/DevBar/DevBar.d.ts +1 -1
- package/dist/types/ui/DevBar/DevBar.d.ts.map +1 -1
- package/dist/types/ui/DevError/DevErrorBadge.d.ts.map +1 -1
- package/dist/types/ui/DevError/DevErrorCopy.d.ts +6 -0
- package/dist/types/ui/DevError/DevErrorCopy.d.ts.map +1 -0
- package/dist/types/ui/DevError/DevErrorInner.d.ts.map +1 -1
- package/dist/types/ui/DevError/DevErrorList.d.ts +1 -1
- package/dist/types/ui/DevError/DevErrorList.d.ts.map +1 -1
- package/dist/types/ui/DevError/StackTrace.d.ts.map +1 -1
- package/package.json +10 -10
- package/src/errorHandling.tsx +1 -8
- package/src/hooks/useCopyErrorMarkdown.ts +127 -0
- package/src/hooks/useParsedStacktrace.ts +1 -1
- package/src/index.css +27 -0
- package/src/ui/DevBar/DevBar.tsx +9 -13
- package/src/ui/DevError/DevErrorBadge.tsx +0 -1
- package/src/ui/DevError/DevErrorCopy.tsx +30 -0
- package/src/ui/DevError/DevErrorInner.tsx +26 -26
- package/src/ui/DevError/DevErrorList.tsx +25 -19
- package/src/ui/DevError/StackTrace.tsx +1 -4
|
@@ -4,14 +4,14 @@ const errorHandling = require("./src/errorHandling.cjs");
|
|
|
4
4
|
const useParsedStacktrace = require("./src/hooks/useParsedStacktrace.cjs");
|
|
5
5
|
const DevBar = require("./src/ui/DevBar/DevBar.cjs");
|
|
6
6
|
const DevError = require("./src/ui/DevError/DevError.cjs");
|
|
7
|
-
const DevErrorList = require("./src/ui/DevError/DevErrorList.cjs");
|
|
8
7
|
const DevErrorBadge = require("./src/ui/DevError/DevErrorBadge.cjs");
|
|
8
|
+
const DevErrorList = require("./src/ui/DevError/DevErrorList.cjs");
|
|
9
9
|
exports.createErrorHandler = errorHandling.createErrorHandler;
|
|
10
10
|
exports.parseStacktrace = useParsedStacktrace.parseStacktrace;
|
|
11
11
|
exports.useProcessedError = useParsedStacktrace.useProcessedError;
|
|
12
12
|
exports.DevBar = DevBar.DevBar;
|
|
13
13
|
exports.DevPanel = DevBar.DevPanel;
|
|
14
14
|
exports.DevError = DevError.DevError;
|
|
15
|
-
exports.DevErrorList = DevErrorList.DevErrorList;
|
|
16
15
|
exports.DevErrorBadge = DevErrorBadge.DevErrorBadge;
|
|
16
|
+
exports.DevErrorList = DevErrorList.DevErrorList;
|
|
17
17
|
//# sourceMappingURL=index.cjs.map
|
|
@@ -2,8 +2,8 @@ import { createErrorHandler } from "./src/errorHandling.js";
|
|
|
2
2
|
import { parseStacktrace, useProcessedError } from "./src/hooks/useParsedStacktrace.js";
|
|
3
3
|
import { DevBar, DevPanel } from "./src/ui/DevBar/DevBar.js";
|
|
4
4
|
import { DevError } from "./src/ui/DevError/DevError.js";
|
|
5
|
-
import { DevErrorList } from "./src/ui/DevError/DevErrorList.js";
|
|
6
5
|
import { DevErrorBadge } from "./src/ui/DevError/DevErrorBadge.js";
|
|
6
|
+
import { DevErrorList } from "./src/ui/DevError/DevErrorList.js";
|
|
7
7
|
export {
|
|
8
8
|
DevBar,
|
|
9
9
|
DevError,
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevErrorManager.cjs","sources":["../../../../packages/react-devbar/src/DevErrorManager.tsx"],"sourcesContent":["import { DevErrorBadge, DevErrorList, ErrorType } from './ui/DevError'\nimport { useEffect, useState } from 'react'\nimport { useProcessedError } from './hooks/useParsedStacktrace'\n\nexport class ErrorBus {\n\tprivate queue: { error: ErrorType; source: string }[] = []\n\tprivate listener: null | ((error: { error: ErrorType; source: string }) => void) = null\n\n\tasync handleError(source: string, error: ErrorType) {\n\t\tconst boxedError = { error, source }\n\n\t\tif (!this.listener) {\n\t\t\tthis.queue.push(boxedError)\n\t\t} else {\n\t\t\tthis.listener(boxedError)\n\t\t}\n\t}\n\n\tregister(listener: (error: { error: ErrorType; source: string }) => void): () => void {\n\t\tthis.listener = listener\n\t\tthis.queue.forEach(listener)\n\t\tthis.queue = []\n\t\treturn () => {\n\t\t\tthis.listener = null\n\t\t}\n\t}\n}\n\nexport interface DevErrorManagerProps {\n\tbus: ErrorBus\n}\n\nconst compareErrors = (a: ErrorType, b: ErrorType) => {\n\tif (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n\t\treturn false\n\t}\n\tif (!('stack' in a) || !('stack' in b) || !('message' in a) || !('message' in b)) {\n\t\treturn false\n\t}\n\tif (a.message !== b.message) {\n\t\treturn false\n\t}\n\tif (a.stack !== b.stack) {\n\t\treturn false\n\t}\n\treturn true\n}\n\nexport function DevErrorManager(props: DevErrorManagerProps) {\n\tconst [errors, setErrors] = useState<{ error: ErrorType; source: string }[]>([])\n\tconst [errIndex, setErrorIndex] = useState(0)\n\tconst [open, setOpen] = useState(false)\n\n\tuseEffect(\n\t\t() => {\n\t\t\treturn props.bus.register(err => {\n\t\t\t\tsetTimeout(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tsetErrors(errors => {\n\t\t\t\t\t\t\treturn !errors.find(it => compareErrors(it.error, err.error)) ? [err, ...errors] : errors\n\t\t\t\t\t\t})\n\t\t\t\t\t\tsetOpen(true)\n\t\t\t\t\t},\n\t\t\t\t\t0,\n\t\t\t\t)\n\t\t\t})\n\t\t},\n\t\t[props.bus],\n\t)\n\n\tconst currentError = errors[errIndex]\n\tconst processedError = useProcessedError(currentError?.error)\n\n\tuseEffect(() => {\n\t\tif (import.meta.hot) {\n\t\t\tconst cb = () => {\n\t\t\t\tsetOpen(false)\n\t\t\t}\n\t\t\timport.meta.hot.on('vite:afterUpdate', cb)\n\t\t\treturn () => {\n\t\t\t\timport.meta.hot?.off('vite:afterUpdate', cb)\n\t\t\t}\n\t\t}\n\t}, [])\n\n\tif (!currentError) {\n\t\treturn null\n\t}\n\tconst onPrevious = () => setErrorIndex(it => Math.max(0, it - 1))\n\tconst onNext = () => setErrorIndex(it => Math.min(errors.length - 1, it + 1))\n\tconst onClose = () => setOpen(false)\n\tconst onClear = () => setErrors([])\n\tif (!open) {\n\t\treturn <DevErrorBadge errorCount={errors.length} onOpen={() => setOpen(true)} onClear={onClear} />\n\t}\n\treturn (\n\t\t<DevErrorList\n\t\t\tcurrentError={processedError}\n\t\t\tcurrentErrorSource={currentError.source}\n\t\t\tcurrentErrorIndex={errIndex}\n\t\t\terrorCount={errors.length}\n\t\t\tonPrevious={onPrevious}\n\t\t\tonNext={onNext}\n\t\t\tonClose={onClose}\n\t\t\tonClear={onClear}\n\t\t/>\n\t)\n}\n"],"names":["useState","useEffect","errors","useProcessedError","jsxDEV","DevErrorBadge","DevErrorList"],"mappings":";;;;;;;;;;AAIO,MAAM,SAAS;AAAA,EAAf,cAAA;AACN,kBAAA,MAAQ,SAAgD,EAAC;AACzD,kBAAA,MAAQ,YAA2E,IAAA;AAAA,EAAA;AAAA,EAEnF,MAAM,YAAY,QAAgB,OAAkB;
|
|
1
|
+
{"version":3,"file":"DevErrorManager.cjs","sources":["../../../../packages/react-devbar/src/DevErrorManager.tsx"],"sourcesContent":["import { DevErrorBadge, DevErrorList, ErrorType } from './ui/DevError'\nimport { useEffect, useState } from 'react'\nimport { useProcessedError } from './hooks/useParsedStacktrace'\n\nexport class ErrorBus {\n\tprivate queue: { error: ErrorType; source: string }[] = []\n\tprivate listener: null | ((error: { error: ErrorType; source: string }) => void) = null\n\n\tasync handleError(source: string, error: ErrorType) {\n\t\tconst boxedError = { error, source }\n\n\t\tif (!this.listener) {\n\t\t\tthis.queue.push(boxedError)\n\t\t} else {\n\t\t\tthis.listener(boxedError)\n\t\t}\n\t}\n\n\tregister(listener: (error: { error: ErrorType; source: string }) => void): () => void {\n\t\tthis.listener = listener\n\t\tthis.queue.forEach(listener)\n\t\tthis.queue = []\n\t\treturn () => {\n\t\t\tthis.listener = null\n\t\t}\n\t}\n}\n\nexport interface DevErrorManagerProps {\n\tbus: ErrorBus\n}\n\nconst compareErrors = (a: ErrorType, b: ErrorType) => {\n\tif (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n\t\treturn false\n\t}\n\tif (!('stack' in a) || !('stack' in b) || !('message' in a) || !('message' in b)) {\n\t\treturn false\n\t}\n\tif (a.message !== b.message) {\n\t\treturn false\n\t}\n\tif (a.stack !== b.stack) {\n\t\treturn false\n\t}\n\treturn true\n}\n\nexport function DevErrorManager(props: DevErrorManagerProps) {\n\tconst [errors, setErrors] = useState<{ error: ErrorType; source: string }[]>([])\n\tconst [errIndex, setErrorIndex] = useState(0)\n\tconst [open, setOpen] = useState(false)\n\n\tuseEffect(\n\t\t() => {\n\t\t\treturn props.bus.register(err => {\n\t\t\t\tsetTimeout(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tsetErrors(errors => {\n\t\t\t\t\t\t\treturn !errors.find(it => compareErrors(it.error, err.error)) ? [err, ...errors] : errors\n\t\t\t\t\t\t})\n\t\t\t\t\t\tsetOpen(true)\n\t\t\t\t\t},\n\t\t\t\t\t0,\n\t\t\t\t)\n\t\t\t})\n\t\t},\n\t\t[props.bus],\n\t)\n\n\tconst currentError = errors[errIndex]\n\tconst processedError = useProcessedError(currentError?.error)\n\n\tuseEffect(() => {\n\t\tif (import.meta.hot) {\n\t\t\tconst cb = () => {\n\t\t\t\tsetOpen(false)\n\t\t\t}\n\t\t\timport.meta.hot.on('vite:afterUpdate', cb)\n\t\t\treturn () => {\n\t\t\t\timport.meta.hot?.off('vite:afterUpdate', cb)\n\t\t\t}\n\t\t}\n\t}, [])\n\n\tif (!currentError) {\n\t\treturn null\n\t}\n\tconst onPrevious = () => setErrorIndex(it => Math.max(0, it - 1))\n\tconst onNext = () => setErrorIndex(it => Math.min(errors.length - 1, it + 1))\n\tconst onClose = () => setOpen(false)\n\tconst onClear = () => setErrors([])\n\tif (!open) {\n\t\treturn <DevErrorBadge errorCount={errors.length} onOpen={() => setOpen(true)} onClear={onClear} />\n\t}\n\treturn (\n\t\t<DevErrorList\n\t\t\tcurrentError={processedError}\n\t\t\tcurrentErrorSource={currentError.source}\n\t\t\tcurrentErrorIndex={errIndex}\n\t\t\terrorCount={errors.length}\n\t\t\tonPrevious={onPrevious}\n\t\t\tonNext={onNext}\n\t\t\tonClose={onClose}\n\t\t\tonClear={onClear}\n\t\t/>\n\t)\n}\n"],"names":["useState","useEffect","errors","useProcessedError","jsxDEV","DevErrorBadge","DevErrorList"],"mappings":";;;;;;;;;;AAIO,MAAM,SAAS;AAAA,EAAf,cAAA;AACN,kBAAA,MAAQ,SAAgD,EAAC;AACzD,kBAAA,MAAQ,YAA2E,IAAA;AAAA,EAAA;AAAA,EAEnF,MAAM,YAAY,QAAgB,OAAkB;AACnD,UAAM,aAAa,EAAE,OAAO,OAAA;AAE5B,QAAI,CAAC,KAAK,UAAU;AACnB,WAAK,MAAM,KAAK,UAAU;AAAA,IAC3B,OAAO;AACN,WAAK,SAAS,UAAU;AAAA,IACzB;AAAA,EACD;AAAA,EAEA,SAAS,UAA6E;AACrF,SAAK,WAAW;AAChB,SAAK,MAAM,QAAQ,QAAQ;AAC3B,SAAK,QAAQ,CAAA;AACb,WAAO,MAAM;AACZ,WAAK,WAAW;AAAA,IACjB;AAAA,EACD;AACD;AAMA,MAAM,gBAAgB,CAAC,GAAc,MAAiB;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M,KAAK,IAAI,OAAO,SAAS,GAAG,KAAK,CAAC,CAAC;AAC5E,QAAM,UAAU,MAAM,QAAQ,KAAK;AACnC,QAAM,UAAU,MAAM,UAAU,EAAE;AAClC,MAAI,CAAC,MAAM;AACV,WAAOG,8BAAAA,OAACC,cAAAA,eAAA,EAAc,YAAY,OAAO,QAAQ,QAAQ,MAAM,QAAQ,IAAI,GAAG,QAAA,GAAvE,QAAA,OAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA,GAAA,IAAyF;AAAA,EACjG;AACA,SACCD,8BAAAA;AAAAA,IAACE,aAAAA;AAAAA,IAAA;AAAA,MACA,cAAc;AAAA,MACd,oBAAoB,aAAa;AAAA,MACjC,mBAAmB;AAAA,MACnB,YAAY,OAAO;AAAA,MACnB;AAAA,MACA;AAAA,MACA;AAAA,MACA;AAAA,IAAA;AAAA,IARD;AAAA,IAAA;AAAA,IAAA;AAAA,MAAA,UAAA;AAAA,MAAA,YAAA;AAAA,MAAA,cAAA;AAAA,IAAA;AAAA,IAAA;AAAA,EAAA;AAWF;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"DevErrorManager.js","sources":["../../../../packages/react-devbar/src/DevErrorManager.tsx"],"sourcesContent":["import { DevErrorBadge, DevErrorList, ErrorType } from './ui/DevError'\nimport { useEffect, useState } from 'react'\nimport { useProcessedError } from './hooks/useParsedStacktrace'\n\nexport class ErrorBus {\n\tprivate queue: { error: ErrorType; source: string }[] = []\n\tprivate listener: null | ((error: { error: ErrorType; source: string }) => void) = null\n\n\tasync handleError(source: string, error: ErrorType) {\n\t\tconst boxedError = { error, source }\n\n\t\tif (!this.listener) {\n\t\t\tthis.queue.push(boxedError)\n\t\t} else {\n\t\t\tthis.listener(boxedError)\n\t\t}\n\t}\n\n\tregister(listener: (error: { error: ErrorType; source: string }) => void): () => void {\n\t\tthis.listener = listener\n\t\tthis.queue.forEach(listener)\n\t\tthis.queue = []\n\t\treturn () => {\n\t\t\tthis.listener = null\n\t\t}\n\t}\n}\n\nexport interface DevErrorManagerProps {\n\tbus: ErrorBus\n}\n\nconst compareErrors = (a: ErrorType, b: ErrorType) => {\n\tif (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n\t\treturn false\n\t}\n\tif (!('stack' in a) || !('stack' in b) || !('message' in a) || !('message' in b)) {\n\t\treturn false\n\t}\n\tif (a.message !== b.message) {\n\t\treturn false\n\t}\n\tif (a.stack !== b.stack) {\n\t\treturn false\n\t}\n\treturn true\n}\n\nexport function DevErrorManager(props: DevErrorManagerProps) {\n\tconst [errors, setErrors] = useState<{ error: ErrorType; source: string }[]>([])\n\tconst [errIndex, setErrorIndex] = useState(0)\n\tconst [open, setOpen] = useState(false)\n\n\tuseEffect(\n\t\t() => {\n\t\t\treturn props.bus.register(err => {\n\t\t\t\tsetTimeout(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tsetErrors(errors => {\n\t\t\t\t\t\t\treturn !errors.find(it => compareErrors(it.error, err.error)) ? [err, ...errors] : errors\n\t\t\t\t\t\t})\n\t\t\t\t\t\tsetOpen(true)\n\t\t\t\t\t},\n\t\t\t\t\t0,\n\t\t\t\t)\n\t\t\t})\n\t\t},\n\t\t[props.bus],\n\t)\n\n\tconst currentError = errors[errIndex]\n\tconst processedError = useProcessedError(currentError?.error)\n\n\tuseEffect(() => {\n\t\tif (import.meta.hot) {\n\t\t\tconst cb = () => {\n\t\t\t\tsetOpen(false)\n\t\t\t}\n\t\t\timport.meta.hot.on('vite:afterUpdate', cb)\n\t\t\treturn () => {\n\t\t\t\timport.meta.hot?.off('vite:afterUpdate', cb)\n\t\t\t}\n\t\t}\n\t}, [])\n\n\tif (!currentError) {\n\t\treturn null\n\t}\n\tconst onPrevious = () => setErrorIndex(it => Math.max(0, it - 1))\n\tconst onNext = () => setErrorIndex(it => Math.min(errors.length - 1, it + 1))\n\tconst onClose = () => setOpen(false)\n\tconst onClear = () => setErrors([])\n\tif (!open) {\n\t\treturn <DevErrorBadge errorCount={errors.length} onOpen={() => setOpen(true)} onClear={onClear} />\n\t}\n\treturn (\n\t\t<DevErrorList\n\t\t\tcurrentError={processedError}\n\t\t\tcurrentErrorSource={currentError.source}\n\t\t\tcurrentErrorIndex={errIndex}\n\t\t\terrorCount={errors.length}\n\t\t\tonPrevious={onPrevious}\n\t\t\tonNext={onNext}\n\t\t\tonClose={onClose}\n\t\t\tonClear={onClear}\n\t\t/>\n\t)\n}\n"],"names":["errors"],"mappings":";;;;;;;;AAIO,MAAM,SAAS;AAAA,EAAf,cAAA;AACN,kBAAA,MAAQ,SAAgD,EAAC;AACzD,kBAAA,MAAQ,YAA2E,IAAA;AAAA,EAAA;AAAA,EAEnF,MAAM,YAAY,QAAgB,OAAkB;
|
|
1
|
+
{"version":3,"file":"DevErrorManager.js","sources":["../../../../packages/react-devbar/src/DevErrorManager.tsx"],"sourcesContent":["import { DevErrorBadge, DevErrorList, ErrorType } from './ui/DevError'\nimport { useEffect, useState } from 'react'\nimport { useProcessedError } from './hooks/useParsedStacktrace'\n\nexport class ErrorBus {\n\tprivate queue: { error: ErrorType; source: string }[] = []\n\tprivate listener: null | ((error: { error: ErrorType; source: string }) => void) = null\n\n\tasync handleError(source: string, error: ErrorType) {\n\t\tconst boxedError = { error, source }\n\n\t\tif (!this.listener) {\n\t\t\tthis.queue.push(boxedError)\n\t\t} else {\n\t\t\tthis.listener(boxedError)\n\t\t}\n\t}\n\n\tregister(listener: (error: { error: ErrorType; source: string }) => void): () => void {\n\t\tthis.listener = listener\n\t\tthis.queue.forEach(listener)\n\t\tthis.queue = []\n\t\treturn () => {\n\t\t\tthis.listener = null\n\t\t}\n\t}\n}\n\nexport interface DevErrorManagerProps {\n\tbus: ErrorBus\n}\n\nconst compareErrors = (a: ErrorType, b: ErrorType) => {\n\tif (typeof a !== 'object' || typeof b !== 'object' || a === null || b === null) {\n\t\treturn false\n\t}\n\tif (!('stack' in a) || !('stack' in b) || !('message' in a) || !('message' in b)) {\n\t\treturn false\n\t}\n\tif (a.message !== b.message) {\n\t\treturn false\n\t}\n\tif (a.stack !== b.stack) {\n\t\treturn false\n\t}\n\treturn true\n}\n\nexport function DevErrorManager(props: DevErrorManagerProps) {\n\tconst [errors, setErrors] = useState<{ error: ErrorType; source: string }[]>([])\n\tconst [errIndex, setErrorIndex] = useState(0)\n\tconst [open, setOpen] = useState(false)\n\n\tuseEffect(\n\t\t() => {\n\t\t\treturn props.bus.register(err => {\n\t\t\t\tsetTimeout(\n\t\t\t\t\t() => {\n\t\t\t\t\t\tsetErrors(errors => {\n\t\t\t\t\t\t\treturn !errors.find(it => compareErrors(it.error, err.error)) ? [err, ...errors] : errors\n\t\t\t\t\t\t})\n\t\t\t\t\t\tsetOpen(true)\n\t\t\t\t\t},\n\t\t\t\t\t0,\n\t\t\t\t)\n\t\t\t})\n\t\t},\n\t\t[props.bus],\n\t)\n\n\tconst currentError = errors[errIndex]\n\tconst processedError = useProcessedError(currentError?.error)\n\n\tuseEffect(() => {\n\t\tif (import.meta.hot) {\n\t\t\tconst cb = () => {\n\t\t\t\tsetOpen(false)\n\t\t\t}\n\t\t\timport.meta.hot.on('vite:afterUpdate', cb)\n\t\t\treturn () => {\n\t\t\t\timport.meta.hot?.off('vite:afterUpdate', cb)\n\t\t\t}\n\t\t}\n\t}, [])\n\n\tif (!currentError) {\n\t\treturn null\n\t}\n\tconst onPrevious = () => setErrorIndex(it => Math.max(0, it - 1))\n\tconst onNext = () => setErrorIndex(it => Math.min(errors.length - 1, it + 1))\n\tconst onClose = () => setOpen(false)\n\tconst onClear = () => setErrors([])\n\tif (!open) {\n\t\treturn <DevErrorBadge errorCount={errors.length} onOpen={() => setOpen(true)} onClear={onClear} />\n\t}\n\treturn (\n\t\t<DevErrorList\n\t\t\tcurrentError={processedError}\n\t\t\tcurrentErrorSource={currentError.source}\n\t\t\tcurrentErrorIndex={errIndex}\n\t\t\terrorCount={errors.length}\n\t\t\tonPrevious={onPrevious}\n\t\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
@@ -1,32 +1,12 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
3
|
const jsxDevRuntime = require("react/jsx-dev-runtime");
|
|
4
|
-
const ReactDOM = require("react-dom");
|
|
5
4
|
const buffer = require("buffer");
|
|
6
5
|
const DevErrorManager = require("./DevErrorManager.cjs");
|
|
7
|
-
function _interopNamespaceDefault(e) {
|
|
8
|
-
const n = Object.create(null, { [Symbol.toStringTag]: { value: "Module" } });
|
|
9
|
-
if (e) {
|
|
10
|
-
for (const k in e) {
|
|
11
|
-
if (k !== "default") {
|
|
12
|
-
const d = Object.getOwnPropertyDescriptor(e, k);
|
|
13
|
-
Object.defineProperty(n, k, d.get ? d : {
|
|
14
|
-
enumerable: true,
|
|
15
|
-
get: () => e[k]
|
|
16
|
-
});
|
|
17
|
-
}
|
|
18
|
-
}
|
|
19
|
-
}
|
|
20
|
-
n.default = e;
|
|
21
|
-
return Object.freeze(n);
|
|
22
|
-
}
|
|
23
|
-
const ReactDOM__namespace = /* @__PURE__ */ _interopNamespaceDefault(ReactDOM);
|
|
24
6
|
const getErrorContainer = () => {
|
|
25
7
|
const errorElementId = "__contember__dev__error__container__element";
|
|
26
8
|
let errorContainer = document.getElementById(errorElementId);
|
|
27
|
-
if (errorContainer) {
|
|
28
|
-
ReactDOM__namespace.unmountComponentAtNode(errorContainer);
|
|
29
|
-
} else {
|
|
9
|
+
if (!errorContainer) {
|
|
30
10
|
errorContainer = document.createElement("div");
|
|
31
11
|
errorContainer.id = errorElementId;
|
|
32
12
|
document.body.appendChild(errorContainer);
|
|
@@ -54,7 +34,7 @@ const devErrorHandler = (renderer) => {
|
|
|
54
34
|
};
|
|
55
35
|
renderer(getErrorContainer(), /* @__PURE__ */ jsxDevRuntime.jsxDEV(DevErrorManager.DevErrorManager, { bus: errorBus }, void 0, false, {
|
|
56
36
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/errorHandling.tsx",
|
|
57
|
-
lineNumber:
|
|
37
|
+
lineNumber: 42,
|
|
58
38
|
columnNumber: 32
|
|
59
39
|
}, void 0), () => {
|
|
60
40
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorHandling.cjs","sources":["../../../../packages/react-devbar/src/errorHandling.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"errorHandling.cjs","sources":["../../../../packages/react-devbar/src/errorHandling.tsx"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { DevErrorManager, ErrorBus } from './DevErrorManager'\nimport { ReactElement } from 'react'\n\nexport type ErrorReactRenderer = (domElement: Element, reactElement: ReactElement, onRecoverableError: (e: any) => void) => void\n\nconst getErrorContainer = () => {\n\tconst errorElementId = '__contember__dev__error__container__element'\n\tlet errorContainer = document.getElementById(errorElementId)\n\n\tif (!errorContainer) {\n\t\terrorContainer = document.createElement('div')\n\t\terrorContainer.id = errorElementId\n\t\tdocument.body.appendChild(errorContainer)\n\t}\n\n\treturn errorContainer\n}\n\nconst devErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst errorBus = new ErrorBus()\n\t;(window as any).Buffer = Buffer\n\twindow.addEventListener('error', e => {\n\t\tif (e.message.startsWith('ResizeObserver')) {\n\t\t\t// Apparently, this can be ignored: https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded\n\t\t\treturn\n\t\t}\n\t\terrorBus.handleError('Unhandled error', e.error)\n\t})\n\n\twindow.addEventListener('unhandledrejection', e => errorBus.handleError('Unhandled promise rejection', e.reason))\n\n\tconst origOnError = console.error\n\tconsole.error = (...args) => {\n\t\torigOnError(...args)\n\t\tfor (const arg of args) {\n\t\t\tif (arg instanceof Error) {\n\t\t\t\terrorBus.handleError('Logged error', arg)\n\t\t\t}\n\t\t}\n\t}\n\trenderer(getErrorContainer(), <DevErrorManager bus={errorBus} />, () => {})\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => errorBus.handleError('Recoverable React error', e))\n\t\t} catch (e) {\n\t\t\terrorBus.handleError('Entrypoint crash', e)\n\t\t}\n\t}\n}\n\ntype TryRun = <T>(cb: (onRecoverableError: (e: any) => void) => T | Promise<T>) => void\nconst prodErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst renderError = () => {\n\t\trenderer(getErrorContainer(), <h1>Fatal error</h1>, () => {})\n\t}\n\n\twindow.addEventListener('error', renderError)\n\twindow.addEventListener('unhandledrejection', renderError)\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => {\n\t\t\t\tconsole.warn(e)\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\trenderError()\n\t\t}\n\t}\n}\n\nexport const createErrorHandler = (renderer: ErrorReactRenderer) => {\n\tif (import.meta.env.DEV) {\n\t\treturn devErrorHandler(renderer)\n\t} else {\n\t\treturn prodErrorHandler(renderer)\n\t}\n}\n"],"names":["ErrorBus","Buffer","jsxDEV","DevErrorManager"],"mappings":";;;;;AAMA,MAAM,oBAAoB,MAAM;AAC/B,QAAM,iBAAiB;AACvB,MAAI,iBAAiB,SAAS,eAAe,cAAc;AAE3D,MAAI,CAAC,gBAAgB;AACpB,qBAAiB,SAAS,cAAc,KAAK;AAC7C,mBAAe,KAAK;AACpB,aAAS,KAAK,YAAY,cAAc;AAAA,EACzC;AAEA,SAAO;AACR;AAEA,MAAM,kBAAkB,CAAC,aAAyC;AACjE,QAAM,WAAW,IAAIA,yBAAA;AACnB,SAAe,SAASC,OAAAA;AAC1B,SAAO,iBAAiB,SAAS,CAAA,MAAK;AACrC,QAAI,EAAE,QAAQ,WAAW,gBAAgB,GAAG;AAE3C;AAAA,IACD;AACA,aAAS,YAAY,mBAAmB,EAAE,KAAK;AAAA,EAChD,CAAC;AAED,SAAO,iBAAiB,sBAAsB,CAAA,MAAK,SAAS,YAAY,+BAA+B,EAAE,MAAM,CAAC;AAEhH,QAAM,cAAc,QAAQ;AAC5B,UAAQ,QAAQ,IAAI,SAAS;AAC5B,gBAAY,GAAG,IAAI;AACnB,eAAW,OAAO,MAAM;AACvB,UAAI,eAAe,OAAO;AACzB,iBAAS,YAAY,gBAAgB,GAAG;AAAA,MACzC;AAAA,IACD;AAAA,EACD;AACA,WAAS,qBAAqBC,8BAAAA,OAACC,gBAAAA,iBAAA,EAAgB,KAAK,SAAA,GAAtB,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,MAAgC,GAAI,MAAM;AAAA,EAAC,CAAC;AAE1E,SAAO,OAAM,OAAM;AAClB,QAAI;AACH,YAAM,GAAG,CAAA,MAAK,SAAS,YAAY,2BAA2B,CAAC,CAAC;AAAA,IACjE,SAAS,GAAG;AACX,eAAS,YAAY,oBAAoB,CAAC;AAAA,IAC3C;AAAA,EACD;AACD;AAuBO,MAAM,qBAAqB,CAAC,aAAiC;AAC1C;AACxB,WAAO,gBAAgB,QAAQ;AAAA,EAChC;AAGD;;"}
|
|
@@ -1,13 +1,10 @@
|
|
|
1
1
|
import { jsxDEV } from "react/jsx-dev-runtime";
|
|
2
|
-
import * as ReactDOM from "react-dom";
|
|
3
2
|
import { Buffer } from "buffer";
|
|
4
3
|
import { ErrorBus, DevErrorManager } from "./DevErrorManager.js";
|
|
5
4
|
const getErrorContainer = () => {
|
|
6
5
|
const errorElementId = "__contember__dev__error__container__element";
|
|
7
6
|
let errorContainer = document.getElementById(errorElementId);
|
|
8
|
-
if (errorContainer) {
|
|
9
|
-
ReactDOM.unmountComponentAtNode(errorContainer);
|
|
10
|
-
} else {
|
|
7
|
+
if (!errorContainer) {
|
|
11
8
|
errorContainer = document.createElement("div");
|
|
12
9
|
errorContainer.id = errorElementId;
|
|
13
10
|
document.body.appendChild(errorContainer);
|
|
@@ -35,7 +32,7 @@ const devErrorHandler = (renderer) => {
|
|
|
35
32
|
};
|
|
36
33
|
renderer(getErrorContainer(), /* @__PURE__ */ jsxDEV(DevErrorManager, { bus: errorBus }, void 0, false, {
|
|
37
34
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/errorHandling.tsx",
|
|
38
|
-
lineNumber:
|
|
35
|
+
lineNumber: 42,
|
|
39
36
|
columnNumber: 32
|
|
40
37
|
}, void 0), () => {
|
|
41
38
|
});
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"errorHandling.js","sources":["../../../../packages/react-devbar/src/errorHandling.tsx"],"sourcesContent":["import
|
|
1
|
+
{"version":3,"file":"errorHandling.js","sources":["../../../../packages/react-devbar/src/errorHandling.tsx"],"sourcesContent":["import { Buffer } from 'buffer'\nimport { DevErrorManager, ErrorBus } from './DevErrorManager'\nimport { ReactElement } from 'react'\n\nexport type ErrorReactRenderer = (domElement: Element, reactElement: ReactElement, onRecoverableError: (e: any) => void) => void\n\nconst getErrorContainer = () => {\n\tconst errorElementId = '__contember__dev__error__container__element'\n\tlet errorContainer = document.getElementById(errorElementId)\n\n\tif (!errorContainer) {\n\t\terrorContainer = document.createElement('div')\n\t\terrorContainer.id = errorElementId\n\t\tdocument.body.appendChild(errorContainer)\n\t}\n\n\treturn errorContainer\n}\n\nconst devErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst errorBus = new ErrorBus()\n\t;(window as any).Buffer = Buffer\n\twindow.addEventListener('error', e => {\n\t\tif (e.message.startsWith('ResizeObserver')) {\n\t\t\t// Apparently, this can be ignored: https://stackoverflow.com/questions/49384120/resizeobserver-loop-limit-exceeded\n\t\t\treturn\n\t\t}\n\t\terrorBus.handleError('Unhandled error', e.error)\n\t})\n\n\twindow.addEventListener('unhandledrejection', e => errorBus.handleError('Unhandled promise rejection', e.reason))\n\n\tconst origOnError = console.error\n\tconsole.error = (...args) => {\n\t\torigOnError(...args)\n\t\tfor (const arg of args) {\n\t\t\tif (arg instanceof Error) {\n\t\t\t\terrorBus.handleError('Logged error', arg)\n\t\t\t}\n\t\t}\n\t}\n\trenderer(getErrorContainer(), <DevErrorManager bus={errorBus} />, () => {})\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => errorBus.handleError('Recoverable React error', e))\n\t\t} catch (e) {\n\t\t\terrorBus.handleError('Entrypoint crash', e)\n\t\t}\n\t}\n}\n\ntype TryRun = <T>(cb: (onRecoverableError: (e: any) => void) => T | Promise<T>) => void\nconst prodErrorHandler = (renderer: ErrorReactRenderer): TryRun => {\n\tconst renderError = () => {\n\t\trenderer(getErrorContainer(), <h1>Fatal error</h1>, () => {})\n\t}\n\n\twindow.addEventListener('error', renderError)\n\twindow.addEventListener('unhandledrejection', renderError)\n\n\treturn async cb => {\n\t\ttry {\n\t\t\tawait cb(e => {\n\t\t\t\tconsole.warn(e)\n\t\t\t})\n\t\t} catch (e) {\n\t\t\tconsole.error(e)\n\t\t\trenderError()\n\t\t}\n\t}\n}\n\nexport const createErrorHandler = (renderer: ErrorReactRenderer) => {\n\tif (import.meta.env.DEV) {\n\t\treturn devErrorHandler(renderer)\n\t} else {\n\t\treturn prodErrorHandler(renderer)\n\t}\n}\n"],"names":[],"mappings":";;;AAMA,MAAM,oBAAoB,MAAM;AAC/B,QAAM,iBAAiB;AACvB,MAAI,iBAAiB,SAAS,eAAe,cAAc;AAE3D,MAAI,CAAC,gBAAgB;AACpB,qBAAiB,SAAS,cAAc,KAAK;AAC7C,mBAAe,KAAK;AACpB,aAAS,KAAK,YAAY,cAAc;AAAA,EACzC;AAEA,SAAO;AACR;AAEA,MAAM,kBAAkB,CAAC,aAAyC;AACjE,QAAM,WAAW,IAAI,SAAA;AACnB,SAAe,SAAS;AAC1B,SAAO,iBAAiB,SAAS,CAAA,MAAK;AACrC,QAAI,EAAE,QAAQ,WAAW,gBAAgB,GAAG;AAE3C;AAAA,IACD;AACA,aAAS,YAAY,mBAAmB,EAAE,KAAK;AAAA,EAChD,CAAC;AAED,SAAO,iBAAiB,sBAAsB,CAAA,MAAK,SAAS,YAAY,+BAA+B,EAAE,MAAM,CAAC;AAEhH,QAAM,cAAc,QAAQ;AAC5B,UAAQ,QAAQ,IAAI,SAAS;AAC5B,gBAAY,GAAG,IAAI;AACnB,eAAW,OAAO,MAAM;AACvB,UAAI,eAAe,OAAO;AACzB,iBAAS,YAAY,gBAAgB,GAAG;AAAA,MACzC;AAAA,IACD;AAAA,EACD;AACA,WAAS,qBAAqB,uBAAC,iBAAA,EAAgB,KAAK,SAAA,GAAtB,QAAA,OAAA;AAAA,IAAA,UAAA;AAAA,IAAA,YAAA;AAAA,IAAA,cAAA;AAAA,EAAA,GAAA,MAAgC,GAAI,MAAM;AAAA,EAAC,CAAC;AAE1E,SAAO,OAAM,OAAM;AAClB,QAAI;AACH,YAAM,GAAG,CAAA,MAAK,SAAS,YAAY,2BAA2B,CAAC,CAAC;AAAA,IACjE,SAAS,GAAG;AACX,eAAS,YAAY,oBAAoB,CAAC;AAAA,IAC3C;AAAA,EACD;AACD;AAuBO,MAAM,qBAAqB,CAAC,aAAiC;AAC1C;AACxB,WAAO,gBAAgB,QAAQ;AAAA,EAChC;AAGD;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
"use strict";
|
|
2
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
3
|
+
const React = require("react");
|
|
4
|
+
const convertStackTraceToMarkdown = (stackTrace, lines) => {
|
|
5
|
+
stackTrace.forEach((frame, index) => {
|
|
6
|
+
lines.push(`**Frame ${index + 1}:**`);
|
|
7
|
+
lines.push("");
|
|
8
|
+
lines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ""}`);
|
|
9
|
+
if (frame.callee) {
|
|
10
|
+
lines.push(`- **Function:** ${frame.callee}`);
|
|
11
|
+
}
|
|
12
|
+
lines.push("");
|
|
13
|
+
if (frame.line !== void 0 && frame.sourceCodeLines) {
|
|
14
|
+
lines.push("**Source Code:**");
|
|
15
|
+
lines.push("");
|
|
16
|
+
lines.push("```typescript");
|
|
17
|
+
frame.sourceCodeLines.forEach((codeLine, lineIndex) => {
|
|
18
|
+
const lineNumber = lineIndex + 1;
|
|
19
|
+
if (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {
|
|
20
|
+
const isErrorLine = lineNumber === frame.line;
|
|
21
|
+
const marker = isErrorLine ? ">>> " : " ";
|
|
22
|
+
lines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`);
|
|
23
|
+
}
|
|
24
|
+
});
|
|
25
|
+
lines.push("```");
|
|
26
|
+
lines.push("");
|
|
27
|
+
}
|
|
28
|
+
lines.push("---");
|
|
29
|
+
lines.push("");
|
|
30
|
+
});
|
|
31
|
+
};
|
|
32
|
+
const convertErrorToMarkdownRecursive = (error, lines, level) => {
|
|
33
|
+
const errorObject = error.error instanceof Error ? error.error : void 0;
|
|
34
|
+
const prefix = "#".repeat(level + 1);
|
|
35
|
+
if (errorObject) {
|
|
36
|
+
lines.push(`${prefix} ${errorObject.name}`);
|
|
37
|
+
lines.push("");
|
|
38
|
+
if (errorObject.message) {
|
|
39
|
+
lines.push(`**Message:** ${errorObject.message}`);
|
|
40
|
+
lines.push("");
|
|
41
|
+
}
|
|
42
|
+
if ("details" in errorObject && errorObject.details) {
|
|
43
|
+
lines.push(`**Details:** ${errorObject.details}`);
|
|
44
|
+
lines.push("");
|
|
45
|
+
}
|
|
46
|
+
} else {
|
|
47
|
+
lines.push(`${prefix} Unknown Error`);
|
|
48
|
+
lines.push("");
|
|
49
|
+
}
|
|
50
|
+
if (error.parsedStackStrace) {
|
|
51
|
+
lines.push(`${"#".repeat(level + 2)} Stack Trace`);
|
|
52
|
+
lines.push("");
|
|
53
|
+
convertStackTraceToMarkdown(error.parsedStackStrace, lines);
|
|
54
|
+
} else if (errorObject?.stack) {
|
|
55
|
+
lines.push(`${"#".repeat(level + 2)} Stack Trace`);
|
|
56
|
+
lines.push("");
|
|
57
|
+
lines.push("```");
|
|
58
|
+
lines.push(errorObject.stack);
|
|
59
|
+
lines.push("```");
|
|
60
|
+
lines.push("");
|
|
61
|
+
}
|
|
62
|
+
if (error.cause) {
|
|
63
|
+
lines.push(`${"#".repeat(level + 2)} Caused By`);
|
|
64
|
+
lines.push("");
|
|
65
|
+
convertErrorToMarkdownRecursive(error.cause, lines, level + 1);
|
|
66
|
+
}
|
|
67
|
+
};
|
|
68
|
+
const convertErrorToMarkdown = (error, source) => {
|
|
69
|
+
const lines = [];
|
|
70
|
+
lines.push("# Contember Error Report");
|
|
71
|
+
lines.push("");
|
|
72
|
+
lines.push(`**Source:** ${source}`);
|
|
73
|
+
lines.push("");
|
|
74
|
+
convertErrorToMarkdownRecursive(error, lines, 1);
|
|
75
|
+
return lines.join("\n");
|
|
76
|
+
};
|
|
77
|
+
const useCopyErrorMarkdown = ({ currentError, currentErrorSource }) => {
|
|
78
|
+
const [copyStatus, setCopyStatus] = React.useState("idle");
|
|
79
|
+
React.useEffect(() => {
|
|
80
|
+
setCopyStatus("idle");
|
|
81
|
+
}, [currentError]);
|
|
82
|
+
const handleCopyMarkdown = async () => {
|
|
83
|
+
setCopyStatus("copying");
|
|
84
|
+
try {
|
|
85
|
+
const markdown = convertErrorToMarkdown(currentError, currentErrorSource);
|
|
86
|
+
await navigator.clipboard.writeText(markdown);
|
|
87
|
+
setCopyStatus("success");
|
|
88
|
+
} catch (err) {
|
|
89
|
+
console.error("Failed to copy markdown:", err);
|
|
90
|
+
setCopyStatus("error");
|
|
91
|
+
}
|
|
92
|
+
};
|
|
93
|
+
const isClipboardSupported = !!navigator?.clipboard;
|
|
94
|
+
return {
|
|
95
|
+
copyStatus,
|
|
96
|
+
handleCopyMarkdown,
|
|
97
|
+
isClipboardSupported
|
|
98
|
+
};
|
|
99
|
+
};
|
|
100
|
+
exports.useCopyErrorMarkdown = useCopyErrorMarkdown;
|
|
101
|
+
//# sourceMappingURL=useCopyErrorMarkdown.cjs.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCopyErrorMarkdown.cjs","sources":["../../../../../packages/react-devbar/src/hooks/useCopyErrorMarkdown.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { ParsedStackTrace, ProcessedError } from '../ui/DevError/types'\n\nconst convertStackTraceToMarkdown = (stackTrace: ParsedStackTrace, lines: string[]) => {\n\tstackTrace.forEach((frame, index) => {\n\t\tlines.push(`**Frame ${index + 1}:**`)\n\t\tlines.push('')\n\t\tlines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ''}`)\n\n\t\tif (frame.callee) {\n\t\t\tlines.push(`- **Function:** ${frame.callee}`)\n\t\t}\n\n\t\tlines.push('')\n\n\t\tif (frame.line !== undefined && frame.sourceCodeLines) {\n\t\t\tlines.push('**Source Code:**')\n\t\t\tlines.push('')\n\t\t\tlines.push('```typescript')\n\n\t\t\tframe.sourceCodeLines.forEach((codeLine, lineIndex) => {\n\t\t\t\tconst lineNumber = lineIndex + 1\n\t\t\t\t// Show context around the error line (similar to the UI logic)\n\t\t\t\tif (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {\n\t\t\t\t\tconst isErrorLine = lineNumber === frame.line\n\t\t\t\t\tconst marker = isErrorLine ? '>>> ' : ' '\n\t\t\t\t\tlines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tlines.push('```')\n\t\t\tlines.push('')\n\t\t}\n\n\t\tlines.push('---')\n\t\tlines.push('')\n\t})\n}\n\nconst convertErrorToMarkdownRecursive = (error: ProcessedError, lines: string[], level: number) => {\n\tconst errorObject = error.error instanceof Error ? error.error : undefined\n\tconst prefix = '#'.repeat(level + 1)\n\n\tif (errorObject) {\n\t\tlines.push(`${prefix} ${errorObject.name}`)\n\t\tlines.push('')\n\n\t\tif (errorObject.message) {\n\t\t\tlines.push(`**Message:** ${errorObject.message}`)\n\t\t\tlines.push('')\n\t\t}\n\n\t\tif ('details' in errorObject && (errorObject as Error & { details?: unknown }).details) {\n\t\t\tlines.push(`**Details:** ${(errorObject as Error & { details: string }).details}`)\n\t\t\tlines.push('')\n\t\t}\n\t} else {\n\t\tlines.push(`${prefix} Unknown Error`)\n\t\tlines.push('')\n\t}\n\n\tif (error.parsedStackStrace) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tconvertStackTraceToMarkdown(error.parsedStackStrace, lines)\n\t} else if (errorObject?.stack) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tlines.push('```')\n\t\tlines.push(errorObject.stack)\n\t\tlines.push('```')\n\t\tlines.push('')\n\t}\n\n\tif (error.cause) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Caused By`)\n\t\tlines.push('')\n\t\tconvertErrorToMarkdownRecursive(error.cause, lines, level + 1)\n\t}\n}\n\nconst convertErrorToMarkdown = (error: ProcessedError, source: string): string => {\n\tconst lines: string[] = []\n\n\tlines.push('# Contember Error Report')\n\tlines.push('')\n\tlines.push(`**Source:** ${source}`)\n\tlines.push('')\n\n\tconvertErrorToMarkdownRecursive(error, lines, 1)\n\n\treturn lines.join('\\n')\n}\n\ntype CopyMarkdownProps = {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n}\n\nexport const useCopyErrorMarkdown = ({ currentError, currentErrorSource }: CopyMarkdownProps) => {\n\tconst [copyStatus, setCopyStatus] = useState<'idle' | 'copying' | 'success' | 'error'>('idle')\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intentional\n\tuseEffect(() => {\n\t\tsetCopyStatus('idle')\n\t}, [currentError])\n\n\tconst handleCopyMarkdown = async () => {\n\t\tsetCopyStatus('copying')\n\t\ttry {\n\t\t\tconst markdown = convertErrorToMarkdown(currentError, currentErrorSource)\n\t\t\tawait navigator.clipboard.writeText(markdown)\n\t\t\tsetCopyStatus('success')\n\t\t} catch (err) {\n\t\t\tconsole.error('Failed to copy markdown:', err)\n\t\t\tsetCopyStatus('error')\n\t\t}\n\t}\n\n\tconst isClipboardSupported = !!navigator?.clipboard\n\n\treturn {\n\t\tcopyStatus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AA,UAAU,MAAM;AACf,kBAAc,MAAM;AAAA,EACrB,GAAG,CAAC,YAAY,CAAC;AAEjB,QAAM,qBAAqB,YAAY;AACtC,kBAAc,SAAS;AACvB,QAAI;AACH,YAAM,WAAW,uBAAuB,cAAc,kBAAkB;AACxE,YAAM,UAAU,UAAU,UAAU,QAAQ;AAC5C,oBAAc,SAAS;AAAA,IACxB,SAAS,KAAK;AACb,cAAQ,MAAM,4BAA4B,GAAG;AAC7C,oBAAc,OAAO;AAAA,IACtB;AAAA,EACD;AAEA,QAAM,uBAAuB,CAAC,CAAC,WAAW;AAE1C,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEF;;"}
|
|
@@ -0,0 +1,101 @@
|
|
|
1
|
+
import { useState, useEffect } from "react";
|
|
2
|
+
const convertStackTraceToMarkdown = (stackTrace, lines) => {
|
|
3
|
+
stackTrace.forEach((frame, index) => {
|
|
4
|
+
lines.push(`**Frame ${index + 1}:**`);
|
|
5
|
+
lines.push("");
|
|
6
|
+
lines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ""}`);
|
|
7
|
+
if (frame.callee) {
|
|
8
|
+
lines.push(`- **Function:** ${frame.callee}`);
|
|
9
|
+
}
|
|
10
|
+
lines.push("");
|
|
11
|
+
if (frame.line !== void 0 && frame.sourceCodeLines) {
|
|
12
|
+
lines.push("**Source Code:**");
|
|
13
|
+
lines.push("");
|
|
14
|
+
lines.push("```typescript");
|
|
15
|
+
frame.sourceCodeLines.forEach((codeLine, lineIndex) => {
|
|
16
|
+
const lineNumber = lineIndex + 1;
|
|
17
|
+
if (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {
|
|
18
|
+
const isErrorLine = lineNumber === frame.line;
|
|
19
|
+
const marker = isErrorLine ? ">>> " : " ";
|
|
20
|
+
lines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`);
|
|
21
|
+
}
|
|
22
|
+
});
|
|
23
|
+
lines.push("```");
|
|
24
|
+
lines.push("");
|
|
25
|
+
}
|
|
26
|
+
lines.push("---");
|
|
27
|
+
lines.push("");
|
|
28
|
+
});
|
|
29
|
+
};
|
|
30
|
+
const convertErrorToMarkdownRecursive = (error, lines, level) => {
|
|
31
|
+
const errorObject = error.error instanceof Error ? error.error : void 0;
|
|
32
|
+
const prefix = "#".repeat(level + 1);
|
|
33
|
+
if (errorObject) {
|
|
34
|
+
lines.push(`${prefix} ${errorObject.name}`);
|
|
35
|
+
lines.push("");
|
|
36
|
+
if (errorObject.message) {
|
|
37
|
+
lines.push(`**Message:** ${errorObject.message}`);
|
|
38
|
+
lines.push("");
|
|
39
|
+
}
|
|
40
|
+
if ("details" in errorObject && errorObject.details) {
|
|
41
|
+
lines.push(`**Details:** ${errorObject.details}`);
|
|
42
|
+
lines.push("");
|
|
43
|
+
}
|
|
44
|
+
} else {
|
|
45
|
+
lines.push(`${prefix} Unknown Error`);
|
|
46
|
+
lines.push("");
|
|
47
|
+
}
|
|
48
|
+
if (error.parsedStackStrace) {
|
|
49
|
+
lines.push(`${"#".repeat(level + 2)} Stack Trace`);
|
|
50
|
+
lines.push("");
|
|
51
|
+
convertStackTraceToMarkdown(error.parsedStackStrace, lines);
|
|
52
|
+
} else if (errorObject?.stack) {
|
|
53
|
+
lines.push(`${"#".repeat(level + 2)} Stack Trace`);
|
|
54
|
+
lines.push("");
|
|
55
|
+
lines.push("```");
|
|
56
|
+
lines.push(errorObject.stack);
|
|
57
|
+
lines.push("```");
|
|
58
|
+
lines.push("");
|
|
59
|
+
}
|
|
60
|
+
if (error.cause) {
|
|
61
|
+
lines.push(`${"#".repeat(level + 2)} Caused By`);
|
|
62
|
+
lines.push("");
|
|
63
|
+
convertErrorToMarkdownRecursive(error.cause, lines, level + 1);
|
|
64
|
+
}
|
|
65
|
+
};
|
|
66
|
+
const convertErrorToMarkdown = (error, source) => {
|
|
67
|
+
const lines = [];
|
|
68
|
+
lines.push("# Contember Error Report");
|
|
69
|
+
lines.push("");
|
|
70
|
+
lines.push(`**Source:** ${source}`);
|
|
71
|
+
lines.push("");
|
|
72
|
+
convertErrorToMarkdownRecursive(error, lines, 1);
|
|
73
|
+
return lines.join("\n");
|
|
74
|
+
};
|
|
75
|
+
const useCopyErrorMarkdown = ({ currentError, currentErrorSource }) => {
|
|
76
|
+
const [copyStatus, setCopyStatus] = useState("idle");
|
|
77
|
+
useEffect(() => {
|
|
78
|
+
setCopyStatus("idle");
|
|
79
|
+
}, [currentError]);
|
|
80
|
+
const handleCopyMarkdown = async () => {
|
|
81
|
+
setCopyStatus("copying");
|
|
82
|
+
try {
|
|
83
|
+
const markdown = convertErrorToMarkdown(currentError, currentErrorSource);
|
|
84
|
+
await navigator.clipboard.writeText(markdown);
|
|
85
|
+
setCopyStatus("success");
|
|
86
|
+
} catch (err) {
|
|
87
|
+
console.error("Failed to copy markdown:", err);
|
|
88
|
+
setCopyStatus("error");
|
|
89
|
+
}
|
|
90
|
+
};
|
|
91
|
+
const isClipboardSupported = !!navigator?.clipboard;
|
|
92
|
+
return {
|
|
93
|
+
copyStatus,
|
|
94
|
+
handleCopyMarkdown,
|
|
95
|
+
isClipboardSupported
|
|
96
|
+
};
|
|
97
|
+
};
|
|
98
|
+
export {
|
|
99
|
+
useCopyErrorMarkdown
|
|
100
|
+
};
|
|
101
|
+
//# sourceMappingURL=useCopyErrorMarkdown.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"useCopyErrorMarkdown.js","sources":["../../../../../packages/react-devbar/src/hooks/useCopyErrorMarkdown.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport type { ParsedStackTrace, ProcessedError } from '../ui/DevError/types'\n\nconst convertStackTraceToMarkdown = (stackTrace: ParsedStackTrace, lines: string[]) => {\n\tstackTrace.forEach((frame, index) => {\n\t\tlines.push(`**Frame ${index + 1}:**`)\n\t\tlines.push('')\n\t\tlines.push(`- **File:** ${frame.filename}${frame.line ? `:${frame.line}` : ''}`)\n\n\t\tif (frame.callee) {\n\t\t\tlines.push(`- **Function:** ${frame.callee}`)\n\t\t}\n\n\t\tlines.push('')\n\n\t\tif (frame.line !== undefined && frame.sourceCodeLines) {\n\t\t\tlines.push('**Source Code:**')\n\t\t\tlines.push('')\n\t\t\tlines.push('```typescript')\n\n\t\t\tframe.sourceCodeLines.forEach((codeLine, lineIndex) => {\n\t\t\t\tconst lineNumber = lineIndex + 1\n\t\t\t\t// Show context around the error line (similar to the UI logic)\n\t\t\t\tif (frame.line && lineNumber + 5 >= frame.line && lineNumber - 3 <= frame.line) {\n\t\t\t\t\tconst isErrorLine = lineNumber === frame.line\n\t\t\t\t\tconst marker = isErrorLine ? '>>> ' : ' '\n\t\t\t\t\tlines.push(`${marker}${lineNumber.toString().padStart(3)}: ${codeLine}`)\n\t\t\t\t}\n\t\t\t})\n\n\t\t\tlines.push('```')\n\t\t\tlines.push('')\n\t\t}\n\n\t\tlines.push('---')\n\t\tlines.push('')\n\t})\n}\n\nconst convertErrorToMarkdownRecursive = (error: ProcessedError, lines: string[], level: number) => {\n\tconst errorObject = error.error instanceof Error ? error.error : undefined\n\tconst prefix = '#'.repeat(level + 1)\n\n\tif (errorObject) {\n\t\tlines.push(`${prefix} ${errorObject.name}`)\n\t\tlines.push('')\n\n\t\tif (errorObject.message) {\n\t\t\tlines.push(`**Message:** ${errorObject.message}`)\n\t\t\tlines.push('')\n\t\t}\n\n\t\tif ('details' in errorObject && (errorObject as Error & { details?: unknown }).details) {\n\t\t\tlines.push(`**Details:** ${(errorObject as Error & { details: string }).details}`)\n\t\t\tlines.push('')\n\t\t}\n\t} else {\n\t\tlines.push(`${prefix} Unknown Error`)\n\t\tlines.push('')\n\t}\n\n\tif (error.parsedStackStrace) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tconvertStackTraceToMarkdown(error.parsedStackStrace, lines)\n\t} else if (errorObject?.stack) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Stack Trace`)\n\t\tlines.push('')\n\t\tlines.push('```')\n\t\tlines.push(errorObject.stack)\n\t\tlines.push('```')\n\t\tlines.push('')\n\t}\n\n\tif (error.cause) {\n\t\tlines.push(`${'#'.repeat(level + 2)} Caused By`)\n\t\tlines.push('')\n\t\tconvertErrorToMarkdownRecursive(error.cause, lines, level + 1)\n\t}\n}\n\nconst convertErrorToMarkdown = (error: ProcessedError, source: string): string => {\n\tconst lines: string[] = []\n\n\tlines.push('# Contember Error Report')\n\tlines.push('')\n\tlines.push(`**Source:** ${source}`)\n\tlines.push('')\n\n\tconvertErrorToMarkdownRecursive(error, lines, 1)\n\n\treturn lines.join('\\n')\n}\n\ntype CopyMarkdownProps = {\n\tcurrentError: ProcessedError\n\tcurrentErrorSource: string\n}\n\nexport const useCopyErrorMarkdown = ({ currentError, currentErrorSource }: CopyMarkdownProps) => {\n\tconst [copyStatus, setCopyStatus] = useState<'idle' | 'copying' | 'success' | 'error'>('idle')\n\n\t// biome-ignore lint/correctness/useExhaustiveDependencies: intentional\n\tuseEffect(() => {\n\t\tsetCopyStatus('idle')\n\t}, [currentError])\n\n\tconst handleCopyMarkdown = async () => {\n\t\tsetCopyStatus('copying')\n\t\ttry {\n\t\t\tconst markdown = convertErrorToMarkdown(currentError, currentErrorSource)\n\t\t\tawait navigator.clipboard.writeText(markdown)\n\t\t\tsetCopyStatus('success')\n\t\t} catch (err) {\n\t\t\tconsole.error('Failed to copy markdown:', err)\n\t\t\tsetCopyStatus('error')\n\t\t}\n\t}\n\n\tconst isClipboardSupported = !!navigator?.clipboard\n\n\treturn {\n\t\tcopyStatus,\n\t\thandleCopyMarkdown,\n\t\tisClipboardSupported,\n\t}\n}\n"],"names":[],"mappings":";AAGA,MAAM,8BAA8B,CAAC,YAA8B,UAAoB;AACtF,aAAW,QAAQ,CAAC,OAAO,UAAU;AACpC,UAAM,KAAK,WAAW,QAAQ,CAAC,KAAK;AACpC,UAAM,KAAK,EAAE;AACb,UAAM,KAAK,eAAe,MAAM,QAAQ,G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AG;AAC7C,oBAAc,OAAO;AAAA,IACtB;AAAA,EACD;AAEA,QAAM,uBAAuB,CAAC,CAAC,WAAW;AAE1C,SAAO;AAAA,IACN;AAAA,IACA;AAAA,IACA;AAAA,EAAA;AAEF;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useParsedStacktrace.cjs","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["useState","useEffect","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"useParsedStacktrace.cjs","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t;(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["useState","useEffect","e"],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AAGO,MAAM,kBAAkB,OAAO,MAAa;AAClD,MAAI;AACJ,MAAI;AACH,mBAAe,MAAM,OAAO,aAAa,GAAG;AAAA,EAC7C,QAAQ;AACP,WAAO;AAAA,EACR;AACA,UAAQ,MAAM,IAAI,YAAY,CAAC,EAAE,iBAAA,GAAoB,MAAM,IAAI,CAAA,QAAO;AAAA,IACrE,UAAU,GAAG;AAAA,IACb,MAAM,GAAG;AAAA,IACT,QAAQ,GAAG;AAAA,IACX,YAAY,GAAG;AAAA,IACf,iBAAiB,GAAG,YAAY;AAAA,EAAA,EAC/B;AACH;AAEA,MAAM,qBAAqB,CAAC,OAAkC;AAAA,EAC7D,OAAO;AAAA,EACP,OAAO,aAAa,SAAS,WAAW,KAAM,EAAU,UAAU,SAAY,mBAAoB,EAAU,KAAK,IAAI;AACtH;AAEO,MAAM,oBAAoB,CAAC,MAAiC;AAClE,QAAM,CAAC,OAAO,QAAQ,IAAIA,MAAAA,SAAyB,MAAM,mBAAmB,CAAC,CAAC;AAC9EC,QAAAA,UAAU,MAAM;AACf,aAAS,mBAAmB,CAAC,CAAC;AAC9B,QAAI,EAAE,aAAa,QAAQ;AAC1B;AAAA,IACD;AACA,UAAM,4BAA4B,OAAOC,OAA0C;AAClF,aAAO;AAAA,QACN,OAAOA;AAAAA,QACP,mBAAmBA,cAAa,QAAQ,MAAM,gBAAgBA,EAAC,IAAI;AAAA,QACnE,OAAOA,cAAa,SAAS,WAAWA,MAAMA,GAAU,UAAU,SAAY,MAAM,0BAA2BA,GAAU,KAAK,IAAI;AAAA,MAAA;AAAA,IAEpI;AACC,KAAC,YAAY;AACb,eAAS,MAAM,0BAA0B,CAAC,CAAC;AAAA,IAC5C,GAAA;AAAA,EACD,GAAG,CAAC,CAAC,CAAC;AAEN,SAAO;AACR;;;"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"useParsedStacktrace.js","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["e"],"mappings":";
|
|
1
|
+
{"version":3,"file":"useParsedStacktrace.js","sources":["../../../../../packages/react-devbar/src/hooks/useParsedStacktrace.ts"],"sourcesContent":["import { useEffect, useState } from 'react'\nimport { ErrorType, ProcessedError } from '../ui/DevError'\n\nexport const parseStacktrace = async (e: Error) => {\n\tlet StackTracey\n\ttry {\n\t\tStackTracey = (await import('stacktracey')).default\n\t} catch {\n\t\treturn undefined\n\t}\n\treturn (await new StackTracey(e).withSourcesAsync()).items.map(it => ({\n\t\tfilename: it.fileShort,\n\t\tline: it.line,\n\t\tcallee: it.callee,\n\t\tthirdParty: it.thirdParty,\n\t\tsourceCodeLines: it.sourceFile?.lines,\n\t}))\n}\n\nconst createInitialError = (e: ErrorType): ProcessedError => ({\n\terror: e,\n\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? createInitialError((e as any).cause) : undefined,\n})\n\nexport const useProcessedError = (e: ErrorType): ProcessedError => {\n\tconst [error, setError] = useState<ProcessedError>(() => createInitialError(e))\n\tuseEffect(() => {\n\t\tsetError(createInitialError(e))\n\t\tif (!(e instanceof Error)) {\n\t\t\treturn\n\t\t}\n\t\tconst createErrorWithStackTrace = async (e: ErrorType): Promise<ProcessedError> => {\n\t\t\treturn {\n\t\t\t\terror: e,\n\t\t\t\tparsedStackStrace: e instanceof Error ? await parseStacktrace(e) : undefined,\n\t\t\t\tcause: e instanceof Error && 'cause' in e && (e as any).cause !== undefined ? await createErrorWithStackTrace((e as any).cause) : undefined,\n\t\t\t}\n\t\t}\n\t\t;(async () => {\n\t\t\tsetError(await createErrorWithStackTrace(e))\n\t\t})()\n\t}, [e])\n\n\treturn error\n}\n"],"names":["e"],"mappings":";AAGO,MAAM,kBAAkB,OAAO,MAAa;AAClD,MAAI;AACJ,MAAI;AACH,mBAAe,MAAM,OAAO,aAAa,GAAG;AAAA,EAC7C,QAAQ;AACP,WAAO;AAAA,EACR;AACA,UAAQ,MAAM,IAAI,YAAY,CAAC,EAAE,iBAAA,GAAoB,MAAM,IAAI,CAAA,QAAO;AAAA,IACrE,UAAU,GAAG;AAAA,IACb,MAAM,GAAG;AAAA,IACT,QAAQ,GAAG;AAAA,IACX,YAAY,GAAG;AAAA,IACf,iBAAiB,GAAG,YAAY;AAAA,EAAA,EAC/B;AACH;AAEA,MAAM,qBAAqB,CAAC,OAAkC;AAAA,EAC7D,OAAO;AAAA,EACP,OAAO,aAAa,SAAS,WAAW,KAAM,EAAU,UAAU,SAAY,mBAAoB,EAAU,KAAK,IAAI;AACtH;AAEO,MAAM,oBAAoB,CAAC,MAAiC;AAClE,QAAM,CAAC,OAAO,QAAQ,IAAI,SAAyB,MAAM,mBAAmB,CAAC,CAAC;AAC9E,YAAU,MAAM;AACf,aAAS,mBAAmB,CAAC,CAAC;AAC9B,QAAI,EAAE,aAAa,QAAQ;AAC1B;AAAA,IACD;AACA,UAAM,4BAA4B,OAAOA,OAA0C;AAClF,aAAO;AAAA,QACN,OAAOA;AAAAA,QACP,mBAAmBA,cAAa,QAAQ,MAAM,gBAAgBA,EAAC,IAAI;AAAA,QACnE,OAAOA,cAAa,SAAS,WAAWA,MAAMA,GAAU,UAAU,SAAY,MAAM,0BAA2BA,GAAU,KAAK,IAAI;AAAA,MAAA;AAAA,IAEpI;AACC,KAAC,YAAY;AACb,eAAS,MAAM,0BAA0B,CAAC,CAAC;AAAA,IAC5C,GAAA;AAAA,EACD,GAAG,CAAC,CAAC,CAAC;AAEN,SAAO;AACR;"}
|
|
@@ -49,7 +49,7 @@ const DevBar = ({
|
|
|
49
49
|
style: { display: "contents" },
|
|
50
50
|
children: /* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panels"), children }, void 0, false, {
|
|
51
51
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
52
|
-
lineNumber:
|
|
52
|
+
lineNumber: 60,
|
|
53
53
|
columnNumber: 6
|
|
54
54
|
}, void 0)
|
|
55
55
|
},
|
|
@@ -57,13 +57,13 @@ const DevBar = ({
|
|
|
57
57
|
false,
|
|
58
58
|
{
|
|
59
59
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
60
|
-
lineNumber:
|
|
60
|
+
lineNumber: 54,
|
|
61
61
|
columnNumber: 5
|
|
62
62
|
},
|
|
63
63
|
void 0
|
|
64
64
|
) }, void 0, false, {
|
|
65
65
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
66
|
-
lineNumber:
|
|
66
|
+
lineNumber: 53,
|
|
67
67
|
columnNumber: 4
|
|
68
68
|
}, void 0)
|
|
69
69
|
},
|
|
@@ -71,7 +71,7 @@ const DevBar = ({
|
|
|
71
71
|
false,
|
|
72
72
|
{
|
|
73
73
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
74
|
-
lineNumber:
|
|
74
|
+
lineNumber: 46,
|
|
75
75
|
columnNumber: 3
|
|
76
76
|
},
|
|
77
77
|
void 0
|
|
@@ -113,6 +113,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
113
113
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
114
114
|
"button",
|
|
115
115
|
{
|
|
116
|
+
type: "button",
|
|
116
117
|
ref: triggerRef,
|
|
117
118
|
tabIndex: 0,
|
|
118
119
|
"aria-haspopup": "dialog",
|
|
@@ -123,7 +124,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
123
124
|
icon,
|
|
124
125
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("span", { className: className("trigger-label-text"), children: preview ?? heading }, void 0, false, {
|
|
125
126
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
126
|
-
lineNumber:
|
|
127
|
+
lineNumber: 132,
|
|
127
128
|
columnNumber: 5
|
|
128
129
|
}, void 0)
|
|
129
130
|
]
|
|
@@ -132,7 +133,7 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
132
133
|
true,
|
|
133
134
|
{
|
|
134
135
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
135
|
-
lineNumber:
|
|
136
|
+
lineNumber: 122,
|
|
136
137
|
columnNumber: 4
|
|
137
138
|
},
|
|
138
139
|
void 0
|
|
@@ -141,12 +142,13 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
141
142
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panel-header"), children: [
|
|
142
143
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("h2", { className: "h4", children: heading }, void 0, false, {
|
|
143
144
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
144
|
-
lineNumber:
|
|
145
|
+
lineNumber: 140,
|
|
145
146
|
columnNumber: 7
|
|
146
147
|
}, void 0),
|
|
147
148
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV(
|
|
148
149
|
"button",
|
|
149
150
|
{
|
|
151
|
+
type: "button",
|
|
150
152
|
onClick: handleClose,
|
|
151
153
|
className: className("close-button"),
|
|
152
154
|
"aria-label": "Close",
|
|
@@ -156,33 +158,33 @@ const DevPanel = ({ heading, icon, children, preview }) => {
|
|
|
156
158
|
false,
|
|
157
159
|
{
|
|
158
160
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
159
|
-
lineNumber:
|
|
161
|
+
lineNumber: 141,
|
|
160
162
|
columnNumber: 7
|
|
161
163
|
},
|
|
162
164
|
void 0
|
|
163
165
|
)
|
|
164
166
|
] }, void 0, true, {
|
|
165
167
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
166
|
-
lineNumber:
|
|
168
|
+
lineNumber: 139,
|
|
167
169
|
columnNumber: 6
|
|
168
170
|
}, void 0),
|
|
169
171
|
/* @__PURE__ */ jsxDevRuntime.jsxDEV("div", { className: className("panel-body"), children }, void 0, false, {
|
|
170
172
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
171
|
-
lineNumber:
|
|
173
|
+
lineNumber: 150,
|
|
172
174
|
columnNumber: 6
|
|
173
175
|
}, void 0)
|
|
174
176
|
] }, void 0, true, {
|
|
175
177
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
176
|
-
lineNumber:
|
|
178
|
+
lineNumber: 138,
|
|
177
179
|
columnNumber: 5
|
|
178
180
|
}, void 0) }, void 0, false, {
|
|
179
181
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
180
|
-
lineNumber:
|
|
182
|
+
lineNumber: 137,
|
|
181
183
|
columnNumber: 4
|
|
182
184
|
}, void 0)
|
|
183
185
|
] }, void 0, true, {
|
|
184
186
|
fileName: "/home/runner/work/contember/contember/packages/react-devbar/src/ui/DevBar/DevBar.tsx",
|
|
185
|
-
lineNumber:
|
|
187
|
+
lineNumber: 121,
|
|
186
188
|
columnNumber: 3
|
|
187
189
|
}, void 0);
|
|
188
190
|
};
|