@expo/metro-runtime 2.2.7 → 3.0.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/README.md +17 -1
- package/async-require.d.ts +1 -1
- package/async-require.js +1 -1
- package/build/HMRClient.d.ts +1 -1
- package/build/HMRClient.d.ts.map +1 -1
- package/build/HMRClient.js +27 -27
- package/build/HMRClient.js.map +1 -1
- package/build/HMRClient.native.js +1 -1
- package/build/HMRClient.native.js.map +1 -1
- package/build/LoadingView.d.ts +1 -1
- package/build/LoadingView.d.ts.map +1 -1
- package/build/LoadingView.js +2 -6
- package/build/LoadingView.js.map +1 -1
- package/build/LoadingView.native.d.ts +2 -0
- package/build/LoadingView.native.d.ts.map +1 -1
- package/build/LoadingView.native.js +6 -1
- package/build/LoadingView.native.js.map +1 -1
- package/build/async-require/buildAsyncRequire.js.map +1 -1
- package/build/async-require/buildUrlForBundle.js +1 -1
- package/build/async-require/buildUrlForBundle.js.map +1 -1
- package/build/async-require/buildUrlForBundle.native.js +5 -4
- package/build/async-require/buildUrlForBundle.native.js.map +1 -1
- package/build/async-require/fetchAsync.d.ts.map +1 -1
- package/build/async-require/fetchAsync.js +2 -2
- package/build/async-require/fetchAsync.js.map +1 -1
- package/build/async-require/fetchAsync.native.d.ts +1 -1
- package/build/async-require/fetchAsync.native.d.ts.map +1 -1
- package/build/async-require/fetchAsync.native.js +10 -10
- package/build/async-require/fetchAsync.native.js.map +1 -1
- package/build/async-require/fetchThenEval.d.ts.map +1 -1
- package/build/async-require/fetchThenEval.js +2 -3
- package/build/async-require/fetchThenEval.js.map +1 -1
- package/build/async-require/fetchThenEval.web.d.ts.map +1 -1
- package/build/async-require/fetchThenEval.web.js +13 -22
- package/build/async-require/fetchThenEval.web.js.map +1 -1
- package/build/async-require/index.js +1 -3
- package/build/async-require/index.js.map +1 -1
- package/build/async-require/loadBundle.d.ts.map +1 -1
- package/build/async-require/loadBundle.js +8 -8
- package/build/async-require/loadBundle.js.map +1 -1
- package/build/effects.js +10 -10
- package/build/effects.js.map +1 -1
- package/build/effects.native.js +0 -1
- package/build/error-overlay/Data/LogBoxData.d.ts +5 -5
- package/build/error-overlay/Data/LogBoxData.d.ts.map +1 -1
- package/build/error-overlay/Data/LogBoxData.js +46 -48
- package/build/error-overlay/Data/LogBoxData.js.map +1 -1
- package/build/error-overlay/Data/LogBoxLog.d.ts +10 -10
- package/build/error-overlay/Data/LogBoxLog.d.ts.map +1 -1
- package/build/error-overlay/Data/LogBoxLog.js +44 -40
- package/build/error-overlay/Data/LogBoxLog.js.map +1 -1
- package/build/error-overlay/Data/LogBoxSymbolication.d.ts +2 -2
- package/build/error-overlay/Data/LogBoxSymbolication.js +5 -5
- package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -1
- package/build/error-overlay/Data/LogContext.d.ts +2 -2
- package/build/error-overlay/Data/LogContext.d.ts.map +1 -1
- package/build/error-overlay/Data/LogContext.js +4 -4
- package/build/error-overlay/Data/LogContext.js.map +1 -1
- package/build/error-overlay/Data/parseLogBoxLog.d.ts +2 -2
- package/build/error-overlay/Data/parseLogBoxLog.d.ts.map +1 -1
- package/build/error-overlay/Data/parseLogBoxLog.js +26 -31
- package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -1
- package/build/error-overlay/ErrorOverlay.d.ts +10 -3
- package/build/error-overlay/ErrorOverlay.d.ts.map +1 -1
- package/build/error-overlay/ErrorOverlay.js +22 -21
- package/build/error-overlay/ErrorOverlay.js.map +1 -1
- package/build/error-overlay/LogBox.d.ts +2 -2
- package/build/error-overlay/LogBox.d.ts.map +1 -1
- package/build/error-overlay/LogBox.js +0 -1
- package/build/error-overlay/LogBox.js.map +1 -1
- package/build/error-overlay/LogBox.web.d.ts +3 -3
- package/build/error-overlay/LogBox.web.d.ts.map +1 -1
- package/build/error-overlay/LogBox.web.js +9 -12
- package/build/error-overlay/LogBox.web.js.map +1 -1
- package/build/error-overlay/UI/AnsiHighlight.d.ts +2 -2
- package/build/error-overlay/UI/AnsiHighlight.d.ts.map +1 -1
- package/build/error-overlay/UI/AnsiHighlight.js +21 -22
- package/build/error-overlay/UI/AnsiHighlight.js.map +1 -1
- package/build/error-overlay/UI/LogBoxButton.d.ts +1 -1
- package/build/error-overlay/UI/LogBoxButton.d.ts.map +1 -1
- package/build/error-overlay/UI/LogBoxButton.js +3 -5
- package/build/error-overlay/UI/LogBoxButton.js.map +1 -1
- package/build/error-overlay/UI/LogBoxMessage.d.ts +2 -2
- package/build/error-overlay/UI/LogBoxMessage.d.ts.map +1 -1
- package/build/error-overlay/UI/LogBoxMessage.js +4 -4
- package/build/error-overlay/UI/LogBoxMessage.js.map +1 -1
- package/build/error-overlay/UI/LogBoxStyle.d.ts +1 -1
- package/build/error-overlay/UI/LogBoxStyle.js +1 -1
- package/build/error-overlay/UI/LogBoxStyle.js.map +1 -1
- package/build/error-overlay/UI/constants.js +3 -3
- package/build/error-overlay/UI/constants.js.map +1 -1
- package/build/error-overlay/formatProjectFilePath.d.ts +1 -1
- package/build/error-overlay/formatProjectFilePath.d.ts.map +1 -1
- package/build/error-overlay/formatProjectFilePath.js +5 -7
- package/build/error-overlay/formatProjectFilePath.js.map +1 -1
- package/build/error-overlay/index.d.ts +1 -1
- package/build/error-overlay/index.d.ts.map +1 -1
- package/build/error-overlay/index.js +6 -5
- package/build/error-overlay/index.js.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.d.ts +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.d.ts.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.js +9 -14
- package/build/error-overlay/modules/ExceptionsManager/index.js.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts +2 -1
- package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts.map +1 -1
- package/build/error-overlay/modules/ExceptionsManager/index.native.js +7 -2
- package/build/error-overlay/modules/ExceptionsManager/index.native.js.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.d.ts.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.js +5 -5
- package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.native.d.ts +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.native.d.ts.map +1 -1
- package/build/error-overlay/modules/NativeLogBox/index.native.js +0 -1
- package/build/error-overlay/modules/NativeLogBox/index.native.js.map +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.js +4 -4
- package/build/error-overlay/modules/openFileInEditor/index.js.map +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.native.d.ts +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.native.d.ts.map +1 -1
- package/build/error-overlay/modules/openFileInEditor/index.native.js +0 -1
- package/build/error-overlay/modules/openFileInEditor/index.native.js.map +1 -1
- package/build/error-overlay/modules/parseErrorStack/index.d.ts +1 -1
- package/build/error-overlay/modules/parseErrorStack/index.d.ts.map +1 -1
- package/build/error-overlay/modules/parseErrorStack/index.js +5 -5
- package/build/error-overlay/modules/parseErrorStack/index.js.map +1 -1
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.d.ts +1 -1
- package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js.map +1 -1
- package/build/error-overlay/modules/stringifySafe/index.d.ts +1 -1
- package/build/error-overlay/modules/stringifySafe/index.d.ts.map +1 -1
- package/build/error-overlay/modules/stringifySafe/index.js +14 -16
- package/build/error-overlay/modules/stringifySafe/index.js.map +1 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts +2 -2
- package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts.map +1 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.js +5 -5
- package/build/error-overlay/modules/symbolicateStackTrace/index.js.map +1 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.d.ts +1 -1
- package/build/error-overlay/modules/symbolicateStackTrace/index.native.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +10 -11
- package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorFooter.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js +27 -24
- package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js +18 -18
- package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +6 -6
- package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSection.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorSection.js +4 -4
- package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +13 -13
- package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +9 -9
- package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts +2 -2
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts.map +1 -1
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +24 -27
- package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -1
- package/build/error-overlay/toast/ErrorToast.d.ts +2 -2
- package/build/error-overlay/toast/ErrorToast.d.ts.map +1 -1
- package/build/error-overlay/toast/ErrorToast.js +35 -34
- package/build/error-overlay/toast/ErrorToast.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.d.ts +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts +2 -2
- package/build/error-overlay/toast/ErrorToastContainer.web.d.ts.map +1 -1
- package/build/error-overlay/toast/ErrorToastContainer.web.js +6 -5
- package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -1
- package/build/error-overlay/toast/ErrorToastMessage.d.ts +1 -1
- package/build/error-overlay/toast/ErrorToastMessage.d.ts.map +1 -1
- package/build/error-overlay/toast/ErrorToastMessage.js +4 -4
- package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -1
- package/build/error-overlay/useRejectionHandler.d.ts +1 -1
- package/build/error-overlay/useRejectionHandler.d.ts.map +1 -1
- package/build/error-overlay/useRejectionHandler.js +11 -12
- package/build/error-overlay/useRejectionHandler.js.map +1 -1
- package/build/getDevServer.d.ts.map +1 -1
- package/build/getDevServer.js +4 -5
- package/build/getDevServer.js.map +1 -1
- package/build/getDevServer.native.d.ts +2 -0
- package/build/getDevServer.native.d.ts.map +1 -1
- package/build/getDevServer.native.js +6 -1
- package/build/getDevServer.native.js.map +1 -1
- package/build/index.d.ts +1 -2
- package/build/index.d.ts.map +1 -1
- package/build/index.js +4 -4
- package/build/index.js.map +1 -1
- package/build/location/Location.native.d.ts.map +1 -1
- package/build/location/Location.native.js +21 -20
- package/build/location/Location.native.js.map +1 -1
- package/build/location/install.js +0 -1
- package/build/location/install.native.d.ts +1 -1
- package/build/location/install.native.js +16 -22
- package/build/location/install.native.js.map +1 -1
- package/build/messageSocket.d.ts.map +1 -1
- package/build/messageSocket.js +5 -6
- package/build/messageSocket.js.map +1 -1
- package/build/setupFastRefresh.d.ts.map +1 -1
- package/build/setupFastRefresh.js +2 -4
- package/build/setupFastRefresh.js.map +1 -1
- package/build/setupHMR.js +1 -3
- package/build/setupHMR.js.map +1 -1
- package/build/symbolicate.d.ts +3 -3
- package/build/symbolicate.js.map +1 -1
- package/error-overlay.d.ts +1 -1
- package/error-overlay.js +1 -1
- package/package.json +25 -14
- package/LICENSE +0 -13
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"parseLogBoxLog.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/parseLogBoxLog.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,mBAAmB;AACnB,qFAA6D;AAE7D,iFAAyD;AACzD,6EAAqD;AAIrD,MAAM,4BAA4B,GAChC,gGAAgG,CAAC;AACnG,MAAM,6BAA6B,GACjC,sGAAsG,CAAC;AACzG,MAAM,kBAAkB,GACtB,6FAA6F,CAAC;AAgChG,MAAM,YAAY,GAAG,qBAAW,CAAC,GAAG,GAAG,IAAI,CAAC;AAE5C,SAAgB,kBAAkB,CAAC,IAAoB;IAIrD,MAAM,aAAa,GAAa,EAAE,CAAC;IACnC,MAAM,YAAY,GAAa,EAAE,CAAC;IAClC,MAAM,mBAAmB,GAAyC,EAAE,CAAC;IAErE,MAAM,SAAS,GAAG,CAAC,GAAG,IAAI,CAAC,CAAC;IAC5B,IAAI,OAAO,SAAS,CAAC,CAAC,CAAC,KAAK,QAAQ,EAAE;QACpC,MAAM,YAAY,GAAG,MAAM,CAAC,SAAS,CAAC,KAAK,EAAE,CAAC,CAAC;QAC/C,MAAM,iBAAiB,GAAG,YAAY,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC;QACnD,MAAM,iBAAiB,GAAG,iBAAiB,CAAC,MAAM,GAAG,CAAC,CAAC;QACvD,MAAM,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B,CAAC,OAAO,CAAC,CAAC;SAC/C;KACF;IAED,IAAI,cAAc,CAAC,MAAM,KAAK,CAAC,EAAE;QAC/B,6CAA6C;QAC7C,KAAK,MAAM,GAAG,IAAI,IAAI,EAAE;YACtB,IAAI,OAAO,GAAG,KAAK,QAAQ,IAAI,gBAAgB,CAAC,GAAG,CAAC,EAAE;gBACpD,qDAAqD;gBACrD,IAAI,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBACnD,IAAI,eAAe,GAAG,CAAC,EAAE;oBACvB,+BAA+B;oBAC/B,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;iBACpC;gBACD,IAAI,eAAe,GAAG,CAAC,EAAE;oBACvB,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;iBAC/D;gBAED,cAAc,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;aAC3C;iBAAM;gBACL,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACrC;SACF;KACF;IAED,OAAO;QACL,GAAG,kBAAkB,CAAC,yBAAyB,CAAC;QAChD,cAAc;KACf,CAAC;AACJ,CAAC;AAhDD,wCAgDC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\n// @ts-expect-error\nimport UTFSequence from \"react-native/Libraries/UTFSequence\";\n\nimport parseErrorStack from \"../modules/parseErrorStack\";\nimport stringifySafe from \"../modules/stringifySafe\";\nimport type { LogBoxLogData } from \"./LogBoxLog\";\ntype ExceptionData = any;\n\nconst BABEL_TRANSFORM_ERROR_FORMAT =\n /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \\((\\d+):(\\d+)\\)\\n\\n([\\s\\S]+)/;\nconst BABEL_CODE_FRAME_ERROR_FORMAT =\n /^(?:TransformError )?(?:.*):? (?:.*?)(\\/.*): ([\\s\\S]+?)\\n([ >]{2}[\\d\\s]+ \\|[\\s\\S]+|\\u{001b}[\\s\\S]+)/u;\nconst METRO_ERROR_FORMAT =\n /^(?:InternalError Metro has encountered an error:) (.*): (.*) \\((\\d+):(\\d+)\\)\\n\\n([\\s\\S]+)/u;\n\nexport type ExtendedExceptionData = ExceptionData & {\n isComponentError: boolean;\n [key: string]: any;\n};\nexport type Category = string;\nexport type CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n } | null;\n fileName: string;\n\n // TODO: When React switched to using call stack frames,\n // we gained the ability to use the collapse flag, but\n // it is not integrated into the LogBox UI.\n collapse?: boolean;\n};\n\nexport type Message = {\n content: string;\n substitutions: {\n length: number;\n offset: number;\n }[];\n};\n\nexport type ComponentStack = CodeFrame[];\n\nconst SUBSTITUTION = UTFSequence.BOM + \"%s\";\n\nexport function parseInterpolation(args: readonly any[]): {\n category: Category;\n message: Message;\n} {\n const categoryParts: string[] = [];\n const contentParts: string[] = [];\n const substitutionOffsets: { length: number; offset: number }[] = [];\n\n const remaining = [...args];\n if (typeof remaining[0] === \"string\") {\n const formatString = String(remaining.shift());\n const formatStringParts = formatString.split(\"%s\");\n const substitutionCount = formatStringParts.length - 1;\n const substitutions = remaining.splice(0, substitutionCount);\n\n let categoryString = \"\";\n let contentString = \"\";\n\n let substitutionIndex = 0;\n for (const formatStringPart of formatStringParts) {\n categoryString += formatStringPart;\n contentString += formatStringPart;\n\n if (substitutionIndex < substitutionCount) {\n if (substitutionIndex < substitutions.length) {\n // Don't stringify a string type.\n // It adds quotation mark wrappers around the string,\n // which causes the LogBox to look odd.\n const substitution =\n typeof substitutions[substitutionIndex] === \"string\"\n ? substitutions[substitutionIndex]\n : stringifySafe(substitutions[substitutionIndex]);\n substitutionOffsets.push({\n length: substitution.length,\n offset: contentString.length,\n });\n\n categoryString += SUBSTITUTION;\n contentString += substitution;\n } else {\n substitutionOffsets.push({\n length: 2,\n offset: contentString.length,\n });\n\n categoryString += \"%s\";\n contentString += \"%s\";\n }\n\n substitutionIndex++;\n }\n }\n\n categoryParts.push(categoryString);\n contentParts.push(contentString);\n }\n\n const remainingArgs = remaining.map((arg) => {\n // Don't stringify a string type.\n // It adds quotation mark wrappers around the string,\n // which causes the LogBox to look odd.\n return typeof arg === \"string\" ? arg : stringifySafe(arg);\n });\n categoryParts.push(...remainingArgs);\n contentParts.push(...remainingArgs);\n\n return {\n category: categoryParts.join(\" \"),\n message: {\n content: contentParts.join(\" \"),\n substitutions: substitutionOffsets,\n },\n };\n}\n\nfunction isComponentStack(consoleArgument: string) {\n const isOldComponentStackFormat = / {4}in/.test(consoleArgument);\n const isNewComponentStackFormat = / {4}at/.test(consoleArgument);\n const isNewJSCComponentStackFormat = /@.*\\n/.test(consoleArgument);\n\n return (\n isOldComponentStackFormat ||\n isNewComponentStackFormat ||\n isNewJSCComponentStackFormat\n );\n}\n\nexport function parseComponentStack(message: string): ComponentStack {\n // In newer versions of React, the component stack is formatted as a call stack frame.\n // First try to parse the component stack as a call stack frame, and if that doesn't\n // work then we'll fallback to the old custom component stack format parsing.\n const stack = parseErrorStack(message);\n if (stack && stack.length > 0) {\n return stack.map((frame) => ({\n content: frame.methodName,\n collapse: frame.collapse || false,\n fileName: frame.file == null ? \"unknown\" : frame.file,\n location: {\n column: frame.column == null ? -1 : frame.column,\n row: frame.lineNumber == null ? -1 : frame.lineNumber,\n },\n }));\n }\n\n return message\n .split(/\\n {4}in /g)\n .map((s) => {\n if (!s) {\n return null;\n }\n const match = s.match(/(.*) \\(at (.*\\.js):([\\d]+)\\)/);\n if (!match) {\n return null;\n }\n\n const [content, fileName, row] = match.slice(1);\n return {\n content,\n fileName,\n location: { column: -1, row: parseInt(row, 10) },\n };\n })\n .filter(Boolean) as ComponentStack;\n}\n\nexport function parseLogBoxException(\n error: ExtendedExceptionData\n): LogBoxLogData {\n const message =\n error.originalMessage != null ? error.originalMessage : \"Unknown\";\n\n const metroInternalError = message.match(METRO_ERROR_FORMAT);\n if (metroInternalError) {\n const [content, fileName, row, column, codeFrame] =\n metroInternalError.slice(1);\n\n return {\n level: \"fatal\",\n type: \"Metro Error\",\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: {\n row: parseInt(row, 10),\n column: parseInt(column, 10),\n },\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${row}-${column}`,\n };\n }\n\n const babelTransformError = message.match(BABEL_TRANSFORM_ERROR_FORMAT);\n if (babelTransformError) {\n // Transform errors are thrown from inside the Babel transformer.\n const [fileName, content, row, column, codeFrame] =\n babelTransformError.slice(1);\n\n return {\n level: \"syntax\",\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: {\n row: parseInt(row, 10),\n column: parseInt(column, 10),\n },\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${row}-${column}`,\n };\n }\n\n const babelCodeFrameError = message.match(BABEL_CODE_FRAME_ERROR_FORMAT);\n\n if (babelCodeFrameError) {\n // Codeframe errors are thrown from any use of buildCodeFrameError.\n const [fileName, content, codeFrame] = babelCodeFrameError.slice(1);\n return {\n level: \"syntax\",\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: null, // We are not given the location.\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${1}-${1}`,\n };\n }\n\n if (message.match(/^TransformError /)) {\n return {\n level: \"syntax\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack: [],\n message: {\n content: message,\n substitutions: [],\n },\n category: message,\n };\n }\n\n const componentStack = error.componentStack;\n if (error.isFatal || error.isComponentError) {\n return {\n level: \"fatal\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack:\n componentStack != null ? parseComponentStack(componentStack) : [],\n ...parseInterpolation([message]),\n };\n }\n\n if (componentStack != null) {\n // It is possible that console errors have a componentStack.\n return {\n level: \"error\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack: parseComponentStack(componentStack),\n ...parseInterpolation([message]),\n };\n }\n\n // Most `console.error` calls won't have a componentStack. We parse them like\n // regular logs which have the component stack burried in the message.\n return {\n level: \"error\",\n stack: error.stack,\n isComponentError: error.isComponentError,\n ...parseLogBoxLog([message]),\n };\n}\n\nexport function parseLogBoxLog(args: readonly any[]): {\n componentStack: ComponentStack;\n category: Category;\n message: Message;\n} {\n const message = args[0];\n let argsWithoutComponentStack: any[] = [];\n let componentStack: ComponentStack = [];\n\n // Extract component stack from warnings like \"Some warning%s\".\n if (\n typeof message === \"string\" &&\n message.slice(-2) === \"%s\" &&\n args.length > 0\n ) {\n const lastArg = args[args.length - 1];\n if (typeof lastArg === \"string\" && isComponentStack(lastArg)) {\n argsWithoutComponentStack = args.slice(0, -1);\n argsWithoutComponentStack[0] = message.slice(0, -2);\n componentStack = parseComponentStack(lastArg);\n }\n }\n\n if (componentStack.length === 0) {\n // Try finding the component stack elsewhere.\n for (const arg of args) {\n if (typeof arg === \"string\" && isComponentStack(arg)) {\n // Strip out any messages before the component stack.\n let messageEndIndex = arg.search(/\\n {4}(in|at) /);\n if (messageEndIndex < 0) {\n // Handle JSC component stacks.\n messageEndIndex = arg.search(/\\n/);\n }\n if (messageEndIndex > 0) {\n argsWithoutComponentStack.push(arg.slice(0, messageEndIndex));\n }\n\n componentStack = parseComponentStack(arg);\n } else {\n argsWithoutComponentStack.push(arg);\n }\n }\n }\n\n return {\n ...parseInterpolation(argsWithoutComponentStack),\n componentStack,\n };\n}\n"]}
|
|
1
|
+
{"version":3,"file":"parseLogBoxLog.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/parseLogBoxLog.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAEH,qFAA6D;AAG7D,iFAAyD;AACzD,6EAAqD;AAGrD,MAAM,4BAA4B,GAChC,gGAAgG,CAAC;AACn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AC3C;iBAAM;gBACL,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;aACrC;SACF;KACF;IAED,OAAO;QACL,GAAG,kBAAkB,CAAC,yBAAyB,CAAC;QAChD,cAAc;KACf,CAAC;AACJ,CAAC;AA5CD,wCA4CC","sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport UTFSequence from 'react-native/Libraries/UTFSequence';\n\nimport type { LogBoxLogData } from './LogBoxLog';\nimport parseErrorStack from '../modules/parseErrorStack';\nimport stringifySafe from '../modules/stringifySafe';\ntype ExceptionData = any;\n\nconst BABEL_TRANSFORM_ERROR_FORMAT =\n /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \\((\\d+):(\\d+)\\)\\n\\n([\\s\\S]+)/;\nconst BABEL_CODE_FRAME_ERROR_FORMAT =\n /^(?:TransformError )?(?:.*):? (?:.*?)(\\/.*): ([\\s\\S]+?)\\n([ >]{2}[\\d\\s]+ \\|[\\s\\S]+|\\u{001b}[\\s\\S]+)/u;\nconst METRO_ERROR_FORMAT =\n /^(?:InternalError Metro has encountered an error:) (.*): (.*) \\((\\d+):(\\d+)\\)\\n\\n([\\s\\S]+)/u;\n\nexport type ExtendedExceptionData = ExceptionData & {\n isComponentError: boolean;\n [key: string]: any;\n};\nexport type Category = string;\nexport type CodeFrame = {\n content: string;\n location?: {\n row: number;\n column: number;\n [key: string]: any;\n } | null;\n fileName: string;\n\n // TODO: When React switched to using call stack frames,\n // we gained the ability to use the collapse flag, but\n // it is not integrated into the LogBox UI.\n collapse?: boolean;\n};\n\nexport type Message = {\n content: string;\n substitutions: {\n length: number;\n offset: number;\n }[];\n};\n\nexport type ComponentStack = CodeFrame[];\n\nconst SUBSTITUTION = UTFSequence.BOM + '%s';\n\nexport function parseInterpolation(args: readonly any[]): {\n category: Category;\n message: Message;\n} {\n const categoryParts: string[] = [];\n const contentParts: string[] = [];\n const substitutionOffsets: { length: number; offset: number }[] = [];\n\n const remaining = [...args];\n if (typeof remaining[0] === 'string') {\n const formatString = String(remaining.shift());\n const formatStringParts = formatString.split('%s');\n const substitutionCount = formatStringParts.length - 1;\n const substitutions = remaining.splice(0, substitutionCount);\n\n let categoryString = '';\n let contentString = '';\n\n let substitutionIndex = 0;\n for (const formatStringPart of formatStringParts) {\n categoryString += formatStringPart;\n contentString += formatStringPart;\n\n if (substitutionIndex < substitutionCount) {\n if (substitutionIndex < substitutions.length) {\n // Don't stringify a string type.\n // It adds quotation mark wrappers around the string,\n // which causes the LogBox to look odd.\n const substitution =\n typeof substitutions[substitutionIndex] === 'string'\n ? substitutions[substitutionIndex]\n : stringifySafe(substitutions[substitutionIndex]);\n substitutionOffsets.push({\n length: substitution.length,\n offset: contentString.length,\n });\n\n categoryString += SUBSTITUTION;\n contentString += substitution;\n } else {\n substitutionOffsets.push({\n length: 2,\n offset: contentString.length,\n });\n\n categoryString += '%s';\n contentString += '%s';\n }\n\n substitutionIndex++;\n }\n }\n\n categoryParts.push(categoryString);\n contentParts.push(contentString);\n }\n\n const remainingArgs = remaining.map((arg) => {\n // Don't stringify a string type.\n // It adds quotation mark wrappers around the string,\n // which causes the LogBox to look odd.\n return typeof arg === 'string' ? arg : stringifySafe(arg);\n });\n categoryParts.push(...remainingArgs);\n contentParts.push(...remainingArgs);\n\n return {\n category: categoryParts.join(' '),\n message: {\n content: contentParts.join(' '),\n substitutions: substitutionOffsets,\n },\n };\n}\n\nfunction isComponentStack(consoleArgument: string) {\n const isOldComponentStackFormat = / {4}in/.test(consoleArgument);\n const isNewComponentStackFormat = / {4}at/.test(consoleArgument);\n const isNewJSCComponentStackFormat = /@.*\\n/.test(consoleArgument);\n\n return isOldComponentStackFormat || isNewComponentStackFormat || isNewJSCComponentStackFormat;\n}\n\nexport function parseComponentStack(message: string): ComponentStack {\n // In newer versions of React, the component stack is formatted as a call stack frame.\n // First try to parse the component stack as a call stack frame, and if that doesn't\n // work then we'll fallback to the old custom component stack format parsing.\n const stack = parseErrorStack(message);\n if (stack && stack.length > 0) {\n return stack.map((frame) => ({\n content: frame.methodName,\n collapse: frame.collapse || false,\n fileName: frame.file == null ? 'unknown' : frame.file,\n location: {\n column: frame.column == null ? -1 : frame.column,\n row: frame.lineNumber == null ? -1 : frame.lineNumber,\n },\n }));\n }\n\n return message\n .split(/\\n {4}in /g)\n .map((s) => {\n if (!s) {\n return null;\n }\n const match = s.match(/(.*) \\(at (.*\\.js):([\\d]+)\\)/);\n if (!match) {\n return null;\n }\n\n const [content, fileName, row] = match.slice(1);\n return {\n content,\n fileName,\n location: { column: -1, row: parseInt(row, 10) },\n };\n })\n .filter(Boolean) as ComponentStack;\n}\n\nexport function parseLogBoxException(error: ExtendedExceptionData): LogBoxLogData {\n const message = error.originalMessage != null ? error.originalMessage : 'Unknown';\n\n const metroInternalError = message.match(METRO_ERROR_FORMAT);\n if (metroInternalError) {\n const [content, fileName, row, column, codeFrame] = metroInternalError.slice(1);\n\n return {\n level: 'fatal',\n type: 'Metro Error',\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: {\n row: parseInt(row, 10),\n column: parseInt(column, 10),\n },\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${row}-${column}`,\n };\n }\n\n const babelTransformError = message.match(BABEL_TRANSFORM_ERROR_FORMAT);\n if (babelTransformError) {\n // Transform errors are thrown from inside the Babel transformer.\n const [fileName, content, row, column, codeFrame] = babelTransformError.slice(1);\n\n return {\n level: 'syntax',\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: {\n row: parseInt(row, 10),\n column: parseInt(column, 10),\n },\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${row}-${column}`,\n };\n }\n\n const babelCodeFrameError = message.match(BABEL_CODE_FRAME_ERROR_FORMAT);\n\n if (babelCodeFrameError) {\n // Codeframe errors are thrown from any use of buildCodeFrameError.\n const [fileName, content, codeFrame] = babelCodeFrameError.slice(1);\n return {\n level: 'syntax',\n stack: [],\n isComponentError: false,\n componentStack: [],\n codeFrame: {\n fileName,\n location: null, // We are not given the location.\n content: codeFrame,\n },\n message: {\n content,\n substitutions: [],\n },\n category: `${fileName}-${1}-${1}`,\n };\n }\n\n if (message.match(/^TransformError /)) {\n return {\n level: 'syntax',\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack: [],\n message: {\n content: message,\n substitutions: [],\n },\n category: message,\n };\n }\n\n const componentStack = error.componentStack;\n if (error.isFatal || error.isComponentError) {\n return {\n level: 'fatal',\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack: componentStack != null ? parseComponentStack(componentStack) : [],\n ...parseInterpolation([message]),\n };\n }\n\n if (componentStack != null) {\n // It is possible that console errors have a componentStack.\n return {\n level: 'error',\n stack: error.stack,\n isComponentError: error.isComponentError,\n componentStack: parseComponentStack(componentStack),\n ...parseInterpolation([message]),\n };\n }\n\n // Most `console.error` calls won't have a componentStack. We parse them like\n // regular logs which have the component stack burried in the message.\n return {\n level: 'error',\n stack: error.stack,\n isComponentError: error.isComponentError,\n ...parseLogBoxLog([message]),\n };\n}\n\nexport function parseLogBoxLog(args: readonly any[]): {\n componentStack: ComponentStack;\n category: Category;\n message: Message;\n} {\n const message = args[0];\n let argsWithoutComponentStack: any[] = [];\n let componentStack: ComponentStack = [];\n\n // Extract component stack from warnings like \"Some warning%s\".\n if (typeof message === 'string' && message.slice(-2) === '%s' && args.length > 0) {\n const lastArg = args[args.length - 1];\n if (typeof lastArg === 'string' && isComponentStack(lastArg)) {\n argsWithoutComponentStack = args.slice(0, -1);\n argsWithoutComponentStack[0] = message.slice(0, -2);\n componentStack = parseComponentStack(lastArg);\n }\n }\n\n if (componentStack.length === 0) {\n // Try finding the component stack elsewhere.\n for (const arg of args) {\n if (typeof arg === 'string' && isComponentStack(arg)) {\n // Strip out any messages before the component stack.\n let messageEndIndex = arg.search(/\\n {4}(in|at) /);\n if (messageEndIndex < 0) {\n // Handle JSC component stacks.\n messageEndIndex = arg.search(/\\n/);\n }\n if (messageEndIndex > 0) {\n argsWithoutComponentStack.push(arg.slice(0, messageEndIndex));\n }\n\n componentStack = parseComponentStack(arg);\n } else {\n argsWithoutComponentStack.push(arg);\n }\n }\n }\n\n return {\n ...parseInterpolation(argsWithoutComponentStack),\n componentStack,\n };\n}\n"]}
|
|
@@ -1,12 +1,19 @@
|
|
|
1
|
-
|
|
2
|
-
|
|
1
|
+
/**
|
|
2
|
+
* Copyright (c) 650 Industries.
|
|
3
|
+
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
|
+
*
|
|
5
|
+
* This source code is licensed under the MIT license found in the
|
|
6
|
+
* LICENSE file in the root directory of this source tree.
|
|
7
|
+
*/
|
|
8
|
+
import React from 'react';
|
|
9
|
+
import { LogBoxLog, StackType } from './Data/LogBoxLog';
|
|
3
10
|
export declare function LogBoxInspectorContainer(): JSX.Element | null;
|
|
4
11
|
export declare function LogBoxInspector({ log, selectedLogIndex, logs, }: {
|
|
5
12
|
log: LogBoxLog;
|
|
6
13
|
selectedLogIndex: number;
|
|
7
14
|
logs: LogBoxLog[];
|
|
8
15
|
}): JSX.Element;
|
|
9
|
-
export declare function ErrorOverlayBody({ onRetry
|
|
16
|
+
export declare function ErrorOverlayBody({ onRetry }: {
|
|
10
17
|
onRetry: (type: StackType) => void;
|
|
11
18
|
}): JSX.Element;
|
|
12
19
|
export declare function ErrorOverlayBodyContents({ log, onRetry, }: {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"ErrorOverlay.d.ts","sourceRoot":"","sources":["../../src/error-overlay/ErrorOverlay.tsx"],"names":[],"mappings":"
|
|
1
|
+
{"version":3,"file":"ErrorOverlay.d.ts","sourceRoot":"","sources":["../../src/error-overlay/ErrorOverlay.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,KAA2C,MAAM,OAAO,CAAC;AAIhE,OAAO,EAAE,SAAS,EAAE,SAAS,EAAE,MAAM,kBAAkB,CAAC;AAkBxD,wBAAgB,wBAAwB,uBAOvC;AAED,wBAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,gBAAgB,EAChB,IAAI,GACL,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,gBAAgB,EAAE,MAAM,CAAC;IACzB,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB,eAgEA;AAED,wBAAgB,gBAAgB,CAAC,EAAE,OAAO,EAAE,EAAE;IAAE,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAA;CAAE,eAGnF;AAED,wBAAgB,wBAAwB,CAAC,EACvC,GAAG,EACH,OAAO,GACR,EAAE;IACD,GAAG,EAAE,SAAS,CAAC;IACf,OAAO,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,CAAC;CACpC,eAgDA;;AAmBD,wBAAqE"}
|
|
@@ -25,13 +25,12 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
26
|
exports.ErrorOverlayBodyContents = exports.ErrorOverlayBody = exports.LogBoxInspector = exports.LogBoxInspectorContainer = void 0;
|
|
27
27
|
/**
|
|
28
|
-
* Copyright (c)
|
|
28
|
+
* Copyright (c) 650 Industries.
|
|
29
29
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
30
30
|
*
|
|
31
31
|
* This source code is licensed under the MIT license found in the
|
|
32
32
|
* LICENSE file in the root directory of this source tree.
|
|
33
33
|
*/
|
|
34
|
-
const react_views_1 = require("@bacons/react-views");
|
|
35
34
|
const react_1 = __importStar(require("react"));
|
|
36
35
|
const react_native_1 = require("react-native");
|
|
37
36
|
const LogBoxData = __importStar(require("./Data/LogBoxData"));
|
|
@@ -43,12 +42,12 @@ const LogBoxInspectorHeader_1 = require("./overlay/LogBoxInspectorHeader");
|
|
|
43
42
|
const LogBoxInspectorMessageHeader_1 = require("./overlay/LogBoxInspectorMessageHeader");
|
|
44
43
|
const LogBoxInspectorStackFrames_1 = require("./overlay/LogBoxInspectorStackFrames");
|
|
45
44
|
const HEADER_TITLE_MAP = {
|
|
46
|
-
warn:
|
|
47
|
-
error:
|
|
48
|
-
fatal:
|
|
49
|
-
syntax:
|
|
50
|
-
static:
|
|
51
|
-
component:
|
|
45
|
+
warn: 'Console Warning',
|
|
46
|
+
error: 'Console Error',
|
|
47
|
+
fatal: 'Uncaught Error',
|
|
48
|
+
syntax: 'Syntax Error',
|
|
49
|
+
static: 'Static Rendering Error (Node.js)',
|
|
50
|
+
component: 'Render Error',
|
|
52
51
|
};
|
|
53
52
|
function LogBoxInspectorContainer() {
|
|
54
53
|
const { selectedLogIndex, logs } = (0, LogContext_1.useLogs)();
|
|
@@ -56,7 +55,7 @@ function LogBoxInspectorContainer() {
|
|
|
56
55
|
if (log == null) {
|
|
57
56
|
return null;
|
|
58
57
|
}
|
|
59
|
-
return
|
|
58
|
+
return react_1.default.createElement(LogBoxInspector, { log: log, selectedLogIndex: selectedLogIndex, logs: logs });
|
|
60
59
|
}
|
|
61
60
|
exports.LogBoxInspectorContainer = LogBoxInspectorContainer;
|
|
62
61
|
function LogBoxInspector({ log, selectedLogIndex, logs, }) {
|
|
@@ -83,8 +82,8 @@ function LogBoxInspector({ log, selectedLogIndex, logs, }) {
|
|
|
83
82
|
}, []);
|
|
84
83
|
(0, react_1.useEffect)(() => {
|
|
85
84
|
if (log) {
|
|
86
|
-
LogBoxData.symbolicateLogNow(
|
|
87
|
-
LogBoxData.symbolicateLogNow(
|
|
85
|
+
LogBoxData.symbolicateLogNow('stack', log);
|
|
86
|
+
LogBoxData.symbolicateLogNow('component', log);
|
|
88
87
|
}
|
|
89
88
|
}, [log]);
|
|
90
89
|
(0, react_1.useEffect)(() => {
|
|
@@ -94,7 +93,7 @@ function LogBoxInspector({ log, selectedLogIndex, logs, }) {
|
|
|
94
93
|
const lastIndex = logs.length - 1;
|
|
95
94
|
const prevIndex = selected - 1 < 0 ? lastIndex : selected - 1;
|
|
96
95
|
const nextIndex = selected + 1 > lastIndex ? 0 : selected + 1;
|
|
97
|
-
for (const type of [
|
|
96
|
+
for (const type of ['component', 'stack']) {
|
|
98
97
|
LogBoxData.symbolicateLogLazy(type, logs[prevIndex]);
|
|
99
98
|
LogBoxData.symbolicateLogLazy(type, logs[nextIndex]);
|
|
100
99
|
}
|
|
@@ -112,33 +111,34 @@ function LogBoxInspector({ log, selectedLogIndex, logs, }) {
|
|
|
112
111
|
react_1.default.createElement(LogBoxInspectorFooter_1.LogBoxInspectorFooter, { onDismiss: onDismiss, onMinimize: onMinimize })));
|
|
113
112
|
}
|
|
114
113
|
exports.LogBoxInspector = LogBoxInspector;
|
|
115
|
-
function ErrorOverlayBody({ onRetry
|
|
114
|
+
function ErrorOverlayBody({ onRetry }) {
|
|
116
115
|
const log = (0, LogContext_1.useSelectedLog)();
|
|
117
116
|
return react_1.default.createElement(ErrorOverlayBodyContents, { log: log, onRetry: onRetry });
|
|
118
117
|
}
|
|
119
118
|
exports.ErrorOverlayBody = ErrorOverlayBody;
|
|
120
119
|
function ErrorOverlayBodyContents({ log, onRetry, }) {
|
|
121
|
-
var _a, _b;
|
|
122
120
|
const [collapsed, setCollapsed] = (0, react_1.useState)(true);
|
|
123
121
|
(0, react_1.useEffect)(() => {
|
|
124
122
|
setCollapsed(true);
|
|
125
123
|
}, [log]);
|
|
126
|
-
const headerTitle =
|
|
124
|
+
const headerTitle = HEADER_TITLE_MAP[log.isComponentError ? 'component' : log.level] ?? log.type;
|
|
127
125
|
const header = (react_1.default.createElement(LogBoxInspectorMessageHeader_1.LogBoxInspectorMessageHeader, { collapsed: collapsed, onPress: () => setCollapsed(!collapsed), message: log.message, level: log.level, title: headerTitle }));
|
|
126
|
+
// Hide useless React stack.
|
|
127
|
+
const needsStack = !log.message.content.match(/(Expected server HTML to contain a matching|Text content did not match\.)/);
|
|
128
128
|
return (react_1.default.createElement(react_1.default.Fragment, null,
|
|
129
129
|
collapsed && header,
|
|
130
130
|
react_1.default.createElement(react_native_1.ScrollView, { style: styles.scrollBody },
|
|
131
131
|
!collapsed && header,
|
|
132
132
|
react_1.default.createElement(LogBoxInspectorCodeFrame_1.LogBoxInspectorCodeFrame, { codeFrame: log.codeFrame }),
|
|
133
|
-
react_1.default.createElement(LogBoxInspectorStackFrames_1.LogBoxInspectorStackFrames, { type: "stack",
|
|
133
|
+
needsStack && (react_1.default.createElement(LogBoxInspectorStackFrames_1.LogBoxInspectorStackFrames, { type: "stack",
|
|
134
134
|
// eslint-disable-next-line react/jsx-no-bind
|
|
135
|
-
onRetry: onRetry.bind(onRetry,
|
|
136
|
-
!!
|
|
135
|
+
onRetry: onRetry.bind(onRetry, 'stack') })),
|
|
136
|
+
!!log?.componentStack?.length && (react_1.default.createElement(LogBoxInspectorStackFrames_1.LogBoxInspectorStackFrames, { type: "component",
|
|
137
137
|
// eslint-disable-next-line react/jsx-no-bind
|
|
138
|
-
onRetry: onRetry.bind(onRetry,
|
|
138
|
+
onRetry: onRetry.bind(onRetry, 'component') })))));
|
|
139
139
|
}
|
|
140
140
|
exports.ErrorOverlayBodyContents = ErrorOverlayBodyContents;
|
|
141
|
-
const styles =
|
|
141
|
+
const styles = react_native_1.StyleSheet.create({
|
|
142
142
|
scrollBody: {
|
|
143
143
|
backgroundColor: LogBoxStyle.getBackgroundColor(1),
|
|
144
144
|
flex: 1,
|
|
@@ -150,7 +150,8 @@ const styles = react_views_1.StyleSheet.create({
|
|
|
150
150
|
right: 0,
|
|
151
151
|
zIndex: 999,
|
|
152
152
|
flex: 1,
|
|
153
|
-
|
|
153
|
+
// @ts-expect-error: fixed is not in the RN types but it works on web
|
|
154
|
+
position: 'fixed',
|
|
154
155
|
},
|
|
155
156
|
});
|
|
156
157
|
exports.default = LogBoxData.withSubscription(LogBoxInspectorContainer);
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"Err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,CAAC,MAAM,CAAC;IAC/B,UAAU,EAAE;QACV,eAAe,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC;KACR;IACD,SAAS,EAAE;QACT,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,GAAG;QACX,IAAI,EAAE,CAAC;QACP,QAAQ,EAAE,OAAO;KAClB;CACF,CAAC,CAAC;AAEH,kBAAe,UAAU,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport { StyleSheet } from \"@bacons/react-views\";\nimport React, { useCallback, useEffect, useState } from \"react\";\nimport { Keyboard, ScrollView, View } from \"react-native\";\n\nimport * as LogBoxData from \"./Data/LogBoxData\";\nimport { LogBoxLog, StackType } from \"./Data/LogBoxLog\";\nimport { useLogs, useSelectedLog } from \"./Data/LogContext\";\nimport * as LogBoxStyle from \"./UI/LogBoxStyle\";\nimport { LogBoxInspectorCodeFrame } from \"./overlay/LogBoxInspectorCodeFrame\";\nimport { LogBoxInspectorFooter as ErrorOverlayFooter } from \"./overlay/LogBoxInspectorFooter\";\nimport { LogBoxInspectorHeader as ErrorOverlayHeader } from \"./overlay/LogBoxInspectorHeader\";\nimport { LogBoxInspectorMessageHeader } from \"./overlay/LogBoxInspectorMessageHeader\";\nimport { LogBoxInspectorStackFrames } from \"./overlay/LogBoxInspectorStackFrames\";\n\nconst HEADER_TITLE_MAP = {\n warn: \"Console Warning\",\n error: \"Console Error\",\n fatal: \"Uncaught Error\",\n syntax: \"Syntax Error\",\n static: \"Static Rendering Error (Node.js)\",\n component: \"Render Error\",\n};\n\nexport function LogBoxInspectorContainer() {\n const { selectedLogIndex, logs } = useLogs();\n const log = logs[selectedLogIndex];\n if (log == null) {\n return null;\n }\n return (\n <LogBoxInspector\n log={log}\n selectedLogIndex={selectedLogIndex}\n logs={logs}\n />\n );\n}\n\nexport function LogBoxInspector({\n log,\n selectedLogIndex,\n logs,\n}: {\n log: LogBoxLog;\n selectedLogIndex: number;\n logs: LogBoxLog[];\n}) {\n const onDismiss = useCallback((): void => {\n // Here we handle the cases when the log is dismissed and it\n // was either the last log, or when the current index\n // is now outside the bounds of the log array.\n const logsArray = Array.from(logs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n LogBoxData.setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n LogBoxData.setSelectedLog(selectedLogIndex - 1);\n }\n\n LogBoxData.dismiss(logsArray[selectedLogIndex]);\n }\n }, [selectedLogIndex]);\n\n const onMinimize = useCallback((): void => {\n LogBoxData.setSelectedLog(-1);\n }, []);\n\n const onChangeSelectedIndex = useCallback((index: number): void => {\n LogBoxData.setSelectedLog(index);\n }, []);\n\n useEffect(() => {\n if (log) {\n LogBoxData.symbolicateLogNow(\"stack\", log);\n LogBoxData.symbolicateLogNow(\"component\", log);\n }\n }, [log]);\n\n useEffect(() => {\n // Optimistically symbolicate the last and next logs.\n if (logs.length > 1) {\n const selected = selectedLogIndex;\n const lastIndex = logs.length - 1;\n const prevIndex = selected - 1 < 0 ? lastIndex : selected - 1;\n const nextIndex = selected + 1 > lastIndex ? 0 : selected + 1;\n for (const type of [\"component\", \"stack\"] as const) {\n LogBoxData.symbolicateLogLazy(type, logs[prevIndex]);\n LogBoxData.symbolicateLogLazy(type, logs[nextIndex]);\n }\n }\n }, [logs, selectedLogIndex]);\n\n useEffect(() => {\n Keyboard.dismiss();\n }, []);\n\n const _handleRetry = useCallback(\n (type: StackType) => {\n LogBoxData.retrySymbolicateLogNow(type, log);\n },\n [log]\n );\n\n return (\n <View style={styles.container}>\n <ErrorOverlayHeader\n onSelectIndex={onChangeSelectedIndex}\n level={log.level}\n />\n <ErrorOverlayBody onRetry={_handleRetry} />\n <ErrorOverlayFooter onDismiss={onDismiss} onMinimize={onMinimize} />\n </View>\n );\n}\n\nexport function ErrorOverlayBody({\n onRetry,\n}: {\n onRetry: (type: StackType) => void;\n}) {\n const log = useSelectedLog();\n return <ErrorOverlayBodyContents log={log} onRetry={onRetry} />;\n}\n\nexport function ErrorOverlayBodyContents({\n log,\n onRetry,\n}: {\n log: LogBoxLog;\n onRetry: (type: StackType) => void;\n}) {\n const [collapsed, setCollapsed] = useState(true);\n\n useEffect(() => {\n setCollapsed(true);\n }, [log]);\n\n const headerTitle =\n HEADER_TITLE_MAP[log.isComponentError ? \"component\" : log.level] ??\n log.type;\n\n const header = (\n <LogBoxInspectorMessageHeader\n collapsed={collapsed}\n onPress={() => setCollapsed(!collapsed)}\n message={log.message}\n level={log.level}\n title={headerTitle}\n />\n );\n\n return (\n <>\n {collapsed && header}\n <ScrollView style={styles.scrollBody}>\n {!collapsed && header}\n\n <LogBoxInspectorCodeFrame codeFrame={log.codeFrame} />\n <LogBoxInspectorStackFrames\n type=\"stack\"\n // eslint-disable-next-line react/jsx-no-bind\n onRetry={onRetry.bind(onRetry, \"stack\")}\n />\n {!!log?.componentStack?.length && (\n <LogBoxInspectorStackFrames\n type=\"component\"\n // eslint-disable-next-line react/jsx-no-bind\n onRetry={onRetry.bind(onRetry, \"component\")}\n />\n )}\n </ScrollView>\n </>\n );\n}\n\nconst styles = StyleSheet.create({\n scrollBody: {\n backgroundColor: LogBoxStyle.getBackgroundColor(1),\n flex: 1,\n },\n container: {\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n zIndex: 999,\n flex: 1,\n position: \"fixed\",\n },\n});\n\nexport default LogBoxData.withSubscription(LogBoxInspectorContainer);\n"]}
|
|
1
|
+
{"version":3,"file":"ErrorOverlay.js","sourceRoot":"","sources":["../../src/error-overlay/ErrorOverlay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG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AAe,EAAE,WAAW,CAAC,kBAAkB,CAAC,CAAC,CAAC;QAClD,IAAI,EAAE,CAAC;KACR;IACD,SAAS,EAAE;QACT,GAAG,EAAE,CAAC;QACN,IAAI,EAAE,CAAC;QACP,MAAM,EAAE,CAAC;QACT,KAAK,EAAE,CAAC;QACR,MAAM,EAAE,GAAG;QACX,IAAI,EAAE,CAAC;QACP,qEAAqE;QACrE,QAAQ,EAAE,OAAO;KAClB;CACF,CAAC,CAAC;AAEH,kBAAe,UAAU,CAAC,gBAAgB,CAAC,wBAAwB,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport React, { useCallback, useEffect, useState } from 'react';\nimport { Keyboard, ScrollView, View, StyleSheet } from 'react-native';\n\nimport * as LogBoxData from './Data/LogBoxData';\nimport { LogBoxLog, StackType } from './Data/LogBoxLog';\nimport { useLogs, useSelectedLog } from './Data/LogContext';\nimport * as LogBoxStyle from './UI/LogBoxStyle';\nimport { LogBoxInspectorCodeFrame } from './overlay/LogBoxInspectorCodeFrame';\nimport { LogBoxInspectorFooter as ErrorOverlayFooter } from './overlay/LogBoxInspectorFooter';\nimport { LogBoxInspectorHeader as ErrorOverlayHeader } from './overlay/LogBoxInspectorHeader';\nimport { LogBoxInspectorMessageHeader } from './overlay/LogBoxInspectorMessageHeader';\nimport { LogBoxInspectorStackFrames } from './overlay/LogBoxInspectorStackFrames';\n\nconst HEADER_TITLE_MAP = {\n warn: 'Console Warning',\n error: 'Console Error',\n fatal: 'Uncaught Error',\n syntax: 'Syntax Error',\n static: 'Static Rendering Error (Node.js)',\n component: 'Render Error',\n};\n\nexport function LogBoxInspectorContainer() {\n const { selectedLogIndex, logs } = useLogs();\n const log = logs[selectedLogIndex];\n if (log == null) {\n return null;\n }\n return <LogBoxInspector log={log} selectedLogIndex={selectedLogIndex} logs={logs} />;\n}\n\nexport function LogBoxInspector({\n log,\n selectedLogIndex,\n logs,\n}: {\n log: LogBoxLog;\n selectedLogIndex: number;\n logs: LogBoxLog[];\n}) {\n const onDismiss = useCallback((): void => {\n // Here we handle the cases when the log is dismissed and it\n // was either the last log, or when the current index\n // is now outside the bounds of the log array.\n const logsArray = Array.from(logs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n LogBoxData.setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n LogBoxData.setSelectedLog(selectedLogIndex - 1);\n }\n\n LogBoxData.dismiss(logsArray[selectedLogIndex]);\n }\n }, [selectedLogIndex]);\n\n const onMinimize = useCallback((): void => {\n LogBoxData.setSelectedLog(-1);\n }, []);\n\n const onChangeSelectedIndex = useCallback((index: number): void => {\n LogBoxData.setSelectedLog(index);\n }, []);\n\n useEffect(() => {\n if (log) {\n LogBoxData.symbolicateLogNow('stack', log);\n LogBoxData.symbolicateLogNow('component', log);\n }\n }, [log]);\n\n useEffect(() => {\n // Optimistically symbolicate the last and next logs.\n if (logs.length > 1) {\n const selected = selectedLogIndex;\n const lastIndex = logs.length - 1;\n const prevIndex = selected - 1 < 0 ? lastIndex : selected - 1;\n const nextIndex = selected + 1 > lastIndex ? 0 : selected + 1;\n for (const type of ['component', 'stack'] as const) {\n LogBoxData.symbolicateLogLazy(type, logs[prevIndex]);\n LogBoxData.symbolicateLogLazy(type, logs[nextIndex]);\n }\n }\n }, [logs, selectedLogIndex]);\n\n useEffect(() => {\n Keyboard.dismiss();\n }, []);\n\n const _handleRetry = useCallback(\n (type: StackType) => {\n LogBoxData.retrySymbolicateLogNow(type, log);\n },\n [log]\n );\n\n return (\n <View style={styles.container}>\n <ErrorOverlayHeader onSelectIndex={onChangeSelectedIndex} level={log.level} />\n <ErrorOverlayBody onRetry={_handleRetry} />\n <ErrorOverlayFooter onDismiss={onDismiss} onMinimize={onMinimize} />\n </View>\n );\n}\n\nexport function ErrorOverlayBody({ onRetry }: { onRetry: (type: StackType) => void }) {\n const log = useSelectedLog();\n return <ErrorOverlayBodyContents log={log} onRetry={onRetry} />;\n}\n\nexport function ErrorOverlayBodyContents({\n log,\n onRetry,\n}: {\n log: LogBoxLog;\n onRetry: (type: StackType) => void;\n}) {\n const [collapsed, setCollapsed] = useState(true);\n\n useEffect(() => {\n setCollapsed(true);\n }, [log]);\n\n const headerTitle = HEADER_TITLE_MAP[log.isComponentError ? 'component' : log.level] ?? log.type;\n\n const header = (\n <LogBoxInspectorMessageHeader\n collapsed={collapsed}\n onPress={() => setCollapsed(!collapsed)}\n message={log.message}\n level={log.level}\n title={headerTitle}\n />\n );\n\n // Hide useless React stack.\n const needsStack = !log.message.content.match(\n /(Expected server HTML to contain a matching|Text content did not match\\.)/\n );\n\n return (\n <>\n {collapsed && header}\n <ScrollView style={styles.scrollBody}>\n {!collapsed && header}\n\n <LogBoxInspectorCodeFrame codeFrame={log.codeFrame} />\n {needsStack && (\n <LogBoxInspectorStackFrames\n type=\"stack\"\n // eslint-disable-next-line react/jsx-no-bind\n onRetry={onRetry.bind(onRetry, 'stack')}\n />\n )}\n {!!log?.componentStack?.length && (\n <LogBoxInspectorStackFrames\n type=\"component\"\n // eslint-disable-next-line react/jsx-no-bind\n onRetry={onRetry.bind(onRetry, 'component')}\n />\n )}\n </ScrollView>\n </>\n );\n}\n\nconst styles = StyleSheet.create({\n scrollBody: {\n backgroundColor: LogBoxStyle.getBackgroundColor(1),\n flex: 1,\n },\n container: {\n top: 0,\n left: 0,\n bottom: 0,\n right: 0,\n zIndex: 999,\n flex: 1,\n // @ts-expect-error: fixed is not in the RN types but it works on web\n position: 'fixed',\n },\n});\n\nexport default LogBoxData.withSubscription(LogBoxInspectorContainer);\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { IgnorePattern, LogData } from
|
|
2
|
-
import { ExtendedExceptionData } from
|
|
1
|
+
import { IgnorePattern, LogData } from './Data/LogBoxData';
|
|
2
|
+
import { ExtendedExceptionData } from './Data/parseLogBoxLog';
|
|
3
3
|
export { LogData, ExtendedExceptionData, IgnorePattern };
|
|
4
4
|
interface ILogBox {
|
|
5
5
|
install(): void;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBox.d.ts","sourceRoot":"","sources":["../../src/error-overlay/LogBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,CAAC;AAEzD,UAAU,OAAO;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,SAAS,IAAI,IAAI,CAAC;IAClB,WAAW,IAAI,OAAO,CAAC;IACvB,UAAU,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;IACrD,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,YAAY,IAAI,IAAI,CAAC;IACrB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAClD;AAED,QAAA,MAAM,MAAM,EAAE,OAgCb,CAAC;
|
|
1
|
+
{"version":3,"file":"LogBox.d.ts","sourceRoot":"","sources":["../../src/error-overlay/LogBox.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,aAAa,EAAE,OAAO,EAAE,MAAM,mBAAmB,CAAC;AAC3D,OAAO,EAAE,qBAAqB,EAAE,MAAM,uBAAuB,CAAC;AAE9D,OAAO,EAAE,OAAO,EAAE,qBAAqB,EAAE,aAAa,EAAE,CAAC;AAEzD,UAAU,OAAO;IACf,OAAO,IAAI,IAAI,CAAC;IAChB,SAAS,IAAI,IAAI,CAAC;IAClB,WAAW,IAAI,OAAO,CAAC;IACvB,UAAU,CAAC,QAAQ,EAAE,SAAS,aAAa,EAAE,GAAG,IAAI,CAAC;IACrD,aAAa,CAAC,MAAM,CAAC,EAAE,OAAO,GAAG,IAAI,CAAC;IACtC,YAAY,IAAI,IAAI,CAAC;IACrB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAClD;AAED,QAAA,MAAM,MAAM,EAAE,OAgCb,CAAC;AAEF,eAAe,MAAM,CAAC"}
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBox.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.ts"],"names":[],"mappings":";;AAgBA,MAAM,MAAM,GAAY;IACtB,OAAO;QACL,cAAc;IAChB,CAAC;IAED,SAAS;QACP,cAAc;IAChB,CAAC;IAED,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU,CAAC,QAAkC;QAC3C,cAAc;IAChB,CAAC;IAED,aAAa,CAAC,KAAe;QAC3B,cAAc;IAChB,CAAC;IAED,YAAY;QACV,cAAc;IAChB,CAAC;IAED,MAAM,CAAC,GAAY;QACjB,cAAc;IAChB,CAAC;IAED,YAAY,CAAC,EAAyB;QACpC,cAAc;IAChB,CAAC;CACF,CAAC;AAEF,
|
|
1
|
+
{"version":3,"file":"LogBox.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.ts"],"names":[],"mappings":";;AAgBA,MAAM,MAAM,GAAY;IACtB,OAAO;QACL,cAAc;IAChB,CAAC;IAED,SAAS;QACP,cAAc;IAChB,CAAC;IAED,WAAW;QACT,OAAO,KAAK,CAAC;IACf,CAAC;IAED,UAAU,CAAC,QAAkC;QAC3C,cAAc;IAChB,CAAC;IAED,aAAa,CAAC,KAAe;QAC3B,cAAc;IAChB,CAAC;IAED,YAAY;QACV,cAAc;IAChB,CAAC;IAED,MAAM,CAAC,GAAY;QACjB,cAAc;IAChB,CAAC;IAED,YAAY,CAAC,EAAyB;QACpC,cAAc;IAChB,CAAC;CACF,CAAC;AAEF,kBAAe,MAAM,CAAC","sourcesContent":["import { IgnorePattern, LogData } from './Data/LogBoxData';\nimport { ExtendedExceptionData } from './Data/parseLogBoxLog';\n\nexport { LogData, ExtendedExceptionData, IgnorePattern };\n\ninterface ILogBox {\n install(): void;\n uninstall(): void;\n isInstalled(): boolean;\n ignoreLogs(patterns: readonly IgnorePattern[]): void;\n ignoreAllLogs(ignore?: boolean): void;\n clearAllLogs(): void;\n addLog(log: LogData): void;\n addException(error: ExtendedExceptionData): void;\n}\n\nconst LogBox: ILogBox = {\n install(): void {\n // Do nothing.\n },\n\n uninstall(): void {\n // Do nothing.\n },\n\n isInstalled(): boolean {\n return false;\n },\n\n ignoreLogs(patterns: readonly IgnorePattern[]): void {\n // Do nothing.\n },\n\n ignoreAllLogs(value?: boolean): void {\n // Do nothing.\n },\n\n clearAllLogs(): void {\n // Do nothing.\n },\n\n addLog(log: LogData): void {\n // Do nothing.\n },\n\n addException(ex: ExtendedExceptionData): void {\n // Do nothing.\n },\n};\n\nexport default LogBox;\n"]}
|
|
@@ -1,12 +1,12 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* Copyright (c)
|
|
2
|
+
* Copyright (c) 650 Industries.
|
|
3
3
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
4
4
|
*
|
|
5
5
|
* This source code is licensed under the MIT license found in the
|
|
6
6
|
* LICENSE file in the root directory of this source tree.
|
|
7
7
|
*/
|
|
8
|
-
import { IgnorePattern, LogData } from
|
|
9
|
-
import { ExtendedExceptionData } from
|
|
8
|
+
import { IgnorePattern, LogData } from './Data/LogBoxData';
|
|
9
|
+
import { ExtendedExceptionData } from './Data/parseLogBoxLog';
|
|
10
10
|
export { LogData, ExtendedExceptionData, IgnorePattern };
|
|
11
11
|
declare let LogBox: ILogBox;
|
|
12
12
|
interface ILogBox {
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBox.web.d.ts","sourceRoot":"","sources":["../../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;IACtC,YAAY,IAAI,IAAI,CAAC;IACrB,MAAM,CAAC,GAAG,EAAE,OAAO,GAAG,IAAI,CAAC;IAC3B,YAAY,CAAC,KAAK,EAAE,qBAAqB,GAAG,IAAI,CAAC;CAClD;AAqJD,eAAe,MAAM,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
/**
|
|
3
|
-
* Copyright (c)
|
|
3
|
+
* Copyright (c) 650 Industries.
|
|
4
4
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
5
5
|
*
|
|
6
6
|
* This source code is licensed under the MIT license found in the
|
|
@@ -13,8 +13,8 @@ let LogBox;
|
|
|
13
13
|
* LogBox displays logs in the app.
|
|
14
14
|
*/
|
|
15
15
|
if (__DEV__) {
|
|
16
|
-
const LogBoxData = require(
|
|
17
|
-
const { parseLogBoxLog, parseInterpolation } = require(
|
|
16
|
+
const LogBoxData = require('./Data/LogBoxData');
|
|
17
|
+
const { parseLogBoxLog, parseInterpolation } = require('./Data/parseLogBoxLog');
|
|
18
18
|
let originalConsoleError;
|
|
19
19
|
let consoleErrorImpl;
|
|
20
20
|
let isLogBoxInstalled = false;
|
|
@@ -33,7 +33,7 @@ if (__DEV__) {
|
|
|
33
33
|
if (isFirstInstall) {
|
|
34
34
|
originalConsoleError = console.error.bind(console);
|
|
35
35
|
console.error = (...args) => {
|
|
36
|
-
consoleErrorImpl
|
|
36
|
+
consoleErrorImpl?.(...args);
|
|
37
37
|
};
|
|
38
38
|
}
|
|
39
39
|
consoleErrorImpl = registerError;
|
|
@@ -77,12 +77,12 @@ if (__DEV__) {
|
|
|
77
77
|
},
|
|
78
78
|
};
|
|
79
79
|
const isWarningModuleWarning = (...args) => {
|
|
80
|
-
return typeof args[0] ===
|
|
80
|
+
return typeof args[0] === 'string' && args[0].startsWith('Warning: ');
|
|
81
81
|
};
|
|
82
82
|
const registerError = (...args) => {
|
|
83
83
|
// Let errors within LogBox itself fall through.
|
|
84
84
|
if (LogBoxData.isLogBoxErrorMessage(args[0])) {
|
|
85
|
-
originalConsoleError
|
|
85
|
+
originalConsoleError?.(...args);
|
|
86
86
|
return;
|
|
87
87
|
}
|
|
88
88
|
try {
|
|
@@ -94,7 +94,7 @@ if (__DEV__) {
|
|
|
94
94
|
//
|
|
95
95
|
// The 'warning' module needs to be handled here because React internally calls
|
|
96
96
|
// `console.error('Warning: ')` with the component stack already included.
|
|
97
|
-
originalConsoleError
|
|
97
|
+
originalConsoleError?.(...args);
|
|
98
98
|
return;
|
|
99
99
|
}
|
|
100
100
|
const { category, message, componentStack } = parseLogBoxLog(args);
|
|
@@ -102,13 +102,11 @@ if (__DEV__) {
|
|
|
102
102
|
// Interpolate the message so they are formatted for adb and other CLIs.
|
|
103
103
|
// This is different than the message.content above because it includes component stacks.
|
|
104
104
|
const interpolated = parseInterpolation(args);
|
|
105
|
-
originalConsoleError
|
|
105
|
+
originalConsoleError?.(interpolated.message.content);
|
|
106
106
|
LogBoxData.addLog({
|
|
107
107
|
// Always show the static rendering issues as full screen since they
|
|
108
108
|
// are too confusing otherwise.
|
|
109
|
-
level: /did not match\. Server:/.test(message.content)
|
|
110
|
-
? "fatal"
|
|
111
|
-
: "error",
|
|
109
|
+
level: /did not match\. Server:/.test(message.content) ? 'fatal' : 'error',
|
|
112
110
|
category,
|
|
113
111
|
message,
|
|
114
112
|
componentStack,
|
|
@@ -134,6 +132,5 @@ else {
|
|
|
134
132
|
addException(ex) { },
|
|
135
133
|
};
|
|
136
134
|
}
|
|
137
|
-
module.exports = LogBox;
|
|
138
135
|
exports.default = LogBox;
|
|
139
136
|
//# sourceMappingURL=LogBox.web.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"LogBox.web.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAEH,+CAAwC;AAOxC,IAAI,MAAe,CAAC;AAapB;;GAEG;AACH,IAAI,OAAO,EAAE;IAC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c;iBACf,CAAC,CAAC;aACJ;SACF;QAAC,OAAO,GAAG,EAAE;YACZ,UAAU,CAAC,2BAA2B,CAAC,GAAG,CAAC,CAAC;SAC7C;IACH,CAAC,CAAC;CACH;KAAM;IACL,MAAM,GAAG;QACP,OAAO,KAAU,CAAC;QAClB,SAAS,KAAU,CAAC;QACpB,WAAW;YACT,OAAO,KAAK,CAAC;QACf,CAAC;QACD,UAAU,CAAC,QAAkC,IAAS,CAAC;QACvD,aAAa,CAAC,KAAe,IAAS,CAAC;QACvC,YAAY,KAAU,CAAC;QACvB,MAAM,CAAC,GAAY,IAAS,CAAC;QAC7B,YAAY,CAAC,EAAyB,IAAS,CAAC;KACjD,CAAC;CACH;AAED,kBAAe,MAAM,CAAC","sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport { Platform } from 'react-native';\n\nimport { IgnorePattern, LogData } from './Data/LogBoxData';\nimport { ExtendedExceptionData } from './Data/parseLogBoxLog';\n\nexport { LogData, ExtendedExceptionData, IgnorePattern };\n\nlet LogBox: ILogBox;\n\ninterface ILogBox {\n install(): void;\n uninstall(): void;\n isInstalled(): boolean;\n ignoreLogs(patterns: readonly IgnorePattern[]): void;\n ignoreAllLogs(ignore?: boolean): void;\n clearAllLogs(): void;\n addLog(log: LogData): void;\n addException(error: ExtendedExceptionData): void;\n}\n\n/**\n * LogBox displays logs in the app.\n */\nif (__DEV__) {\n const LogBoxData = require('./Data/LogBoxData');\n const { parseLogBoxLog, parseInterpolation } =\n require('./Data/parseLogBoxLog') as typeof import('./Data/parseLogBoxLog');\n\n let originalConsoleError: typeof console.error | undefined;\n let consoleErrorImpl: typeof console.error | undefined;\n\n let isLogBoxInstalled: boolean = false;\n\n LogBox = {\n install(): void {\n if (isLogBoxInstalled) {\n return;\n }\n\n isLogBoxInstalled = true;\n\n // Trigger lazy initialization of module.\n // require(\"../NativeModules/specs/NativeLogBox\");\n\n // IMPORTANT: we only overwrite `console.error` and `console.warn` once.\n // When we uninstall we keep the same reference and only change its\n // internal implementation\n const isFirstInstall = originalConsoleError == null;\n if (isFirstInstall) {\n originalConsoleError = console.error.bind(console);\n\n console.error = (...args) => {\n consoleErrorImpl?.(...args);\n };\n }\n\n consoleErrorImpl = registerError;\n\n if (Platform.isTesting) {\n LogBoxData.setDisabled(true);\n }\n },\n\n uninstall(): void {\n if (!isLogBoxInstalled) {\n return;\n }\n\n isLogBoxInstalled = false;\n\n // IMPORTANT: we don't re-assign to `console` in case the method has been\n // decorated again after installing LogBox. E.g.:\n // Before uninstalling: original > LogBox > OtherErrorHandler\n // After uninstalling: original > LogBox (noop) > OtherErrorHandler\n consoleErrorImpl = originalConsoleError;\n delete (console as any).disableLogBox;\n },\n\n isInstalled(): boolean {\n return isLogBoxInstalled;\n },\n\n ignoreLogs(patterns: readonly IgnorePattern[]): void {\n LogBoxData.addIgnorePatterns(patterns);\n },\n\n ignoreAllLogs(value?: boolean): void {\n LogBoxData.setDisabled(value == null ? true : value);\n },\n\n clearAllLogs(): void {\n LogBoxData.clear();\n },\n\n addLog(log: LogData): void {\n if (isLogBoxInstalled) {\n LogBoxData.addLog(log);\n }\n },\n\n addException(error: ExtendedExceptionData): void {\n if (isLogBoxInstalled) {\n LogBoxData.addException(error);\n }\n },\n };\n\n const isWarningModuleWarning = (...args: any) => {\n return typeof args[0] === 'string' && args[0].startsWith('Warning: ');\n };\n\n const registerError = (...args: Parameters<typeof console.error>): void => {\n // Let errors within LogBox itself fall through.\n if (LogBoxData.isLogBoxErrorMessage(args[0])) {\n originalConsoleError?.(...args);\n return;\n }\n\n try {\n if (!isWarningModuleWarning(...args)) {\n // Only show LogBox for the 'warning' module, otherwise pass through.\n // By passing through, this will get picked up by the React console override,\n // potentially adding the component stack. React then passes it back to the\n // React Native ExceptionsManager, which reports it to LogBox as an error.\n //\n // The 'warning' module needs to be handled here because React internally calls\n // `console.error('Warning: ')` with the component stack already included.\n originalConsoleError?.(...args);\n return;\n }\n\n const { category, message, componentStack } = parseLogBoxLog(args);\n\n if (!LogBoxData.isMessageIgnored(message.content)) {\n // Interpolate the message so they are formatted for adb and other CLIs.\n // This is different than the message.content above because it includes component stacks.\n const interpolated = parseInterpolation(args);\n originalConsoleError?.(interpolated.message.content);\n\n LogBoxData.addLog({\n // Always show the static rendering issues as full screen since they\n // are too confusing otherwise.\n level: /did not match\\. Server:/.test(message.content) ? 'fatal' : 'error',\n category,\n message,\n componentStack,\n });\n }\n } catch (err) {\n LogBoxData.reportUnexpectedLogBoxError(err);\n }\n };\n} else {\n LogBox = {\n install(): void {},\n uninstall(): void {},\n isInstalled(): boolean {\n return false;\n },\n ignoreLogs(patterns: readonly IgnorePattern[]): void {},\n ignoreAllLogs(value?: boolean): void {},\n clearAllLogs(): void {},\n addLog(log: LogData): void {},\n addException(ex: ExtendedExceptionData): void {},\n };\n}\n\nexport default LogBox;\n"]}
|
|
@@ -1,5 +1,5 @@
|
|
|
1
|
-
import { StyleProp, TextStyle } from
|
|
2
|
-
export declare function Ansi({ text, style
|
|
1
|
+
import { StyleProp, TextStyle } from 'react-native';
|
|
2
|
+
export declare function Ansi({ text, style }: {
|
|
3
3
|
text: string;
|
|
4
4
|
style: StyleProp<TextStyle>;
|
|
5
5
|
}): JSX.Element;
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnsiHighlight.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/UI/AnsiHighlight.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAQ,MAAM,cAAc,CAAC;AAuB5E,wBAAgB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"AnsiHighlight.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/UI/AnsiHighlight.tsx"],"names":[],"mappings":"AASA,OAAO,EAAE,SAAS,EAAoB,SAAS,EAAQ,MAAM,cAAc,CAAC;AAuB5E,wBAAgB,IAAI,CAAC,EAAE,IAAI,EAAE,KAAK,EAAE,EAAE;IAAE,IAAI,EAAE,MAAM,CAAC;IAAC,KAAK,EAAE,SAAS,CAAC,SAAS,CAAC,CAAA;CAAE,eAyDlF"}
|
|
@@ -5,7 +5,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
|
|
|
5
5
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
6
6
|
exports.Ansi = void 0;
|
|
7
7
|
/**
|
|
8
|
-
* Copyright (c)
|
|
8
|
+
* Copyright (c) 650 Industries.
|
|
9
9
|
* Copyright (c) Meta Platforms, Inc. and affiliates.
|
|
10
10
|
*
|
|
11
11
|
* This source code is licensed under the MIT license found in the
|
|
@@ -16,25 +16,25 @@ const react_1 = __importDefault(require("react"));
|
|
|
16
16
|
const react_native_1 = require("react-native");
|
|
17
17
|
// Afterglow theme from https://iterm2colorschemes.com/
|
|
18
18
|
const COLORS = {
|
|
19
|
-
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
|
|
19
|
+
'ansi-black': 'rgb(27, 27, 27)',
|
|
20
|
+
'ansi-red': 'rgb(187, 86, 83)',
|
|
21
|
+
'ansi-green': 'rgb(144, 157, 98)',
|
|
22
|
+
'ansi-yellow': 'rgb(234, 193, 121)',
|
|
23
|
+
'ansi-blue': 'rgb(125, 169, 199)',
|
|
24
|
+
'ansi-magenta': 'rgb(176, 101, 151)',
|
|
25
|
+
'ansi-cyan': 'rgb(140, 220, 216)',
|
|
26
26
|
// Instead of white, use the default color provided to the component
|
|
27
27
|
// 'ansi-white': 'rgb(216, 216, 216)',
|
|
28
|
-
|
|
29
|
-
|
|
30
|
-
|
|
31
|
-
|
|
32
|
-
|
|
33
|
-
|
|
34
|
-
|
|
35
|
-
|
|
28
|
+
'ansi-bright-black': 'rgb(98, 98, 98)',
|
|
29
|
+
'ansi-bright-red': 'rgb(187, 86, 83)',
|
|
30
|
+
'ansi-bright-green': 'rgb(144, 157, 98)',
|
|
31
|
+
'ansi-bright-yellow': 'rgb(234, 193, 121)',
|
|
32
|
+
'ansi-bright-blue': 'rgb(125, 169, 199)',
|
|
33
|
+
'ansi-bright-magenta': 'rgb(176, 101, 151)',
|
|
34
|
+
'ansi-bright-cyan': 'rgb(140, 220, 216)',
|
|
35
|
+
'ansi-bright-white': 'rgb(247, 247, 247)',
|
|
36
36
|
};
|
|
37
|
-
function Ansi({ text, style
|
|
37
|
+
function Ansi({ text, style }) {
|
|
38
38
|
let commonWhitespaceLength = Infinity;
|
|
39
39
|
const parsedLines = text.split(/\n/).map((line) => anser_1.default.ansiToJson(line, {
|
|
40
40
|
json: true,
|
|
@@ -42,12 +42,11 @@ function Ansi({ text, style, }) {
|
|
|
42
42
|
use_classes: true,
|
|
43
43
|
}));
|
|
44
44
|
parsedLines.map((lines) => {
|
|
45
|
-
var _a, _b, _c;
|
|
46
45
|
// The third item on each line includes the whitespace of the source code.
|
|
47
46
|
// We are looking for the least amount of common whitespace to trim all lines.
|
|
48
47
|
// Example: Array [" ", " 96 |", " text", ...]
|
|
49
|
-
const match = lines[2] &&
|
|
50
|
-
const whitespaceLength = (match &&
|
|
48
|
+
const match = lines[2] && lines[2]?.content?.match(/^ +/);
|
|
49
|
+
const whitespaceLength = (match && match[0]?.length) || 0;
|
|
51
50
|
if (whitespaceLength < commonWhitespaceLength) {
|
|
52
51
|
commonWhitespaceLength = whitespaceLength;
|
|
53
52
|
}
|
|
@@ -55,7 +54,7 @@ function Ansi({ text, style, }) {
|
|
|
55
54
|
const getText = (content, key) => {
|
|
56
55
|
if (key === 1) {
|
|
57
56
|
// Remove the vertical bar after line numbers
|
|
58
|
-
return content.replace(/\| $/,
|
|
57
|
+
return content.replace(/\| $/, ' ');
|
|
59
58
|
}
|
|
60
59
|
else if (key === 2 && commonWhitespaceLength < Infinity) {
|
|
61
60
|
// Remove common whitespace at the beginning of the line
|
|
@@ -80,7 +79,7 @@ function Ansi({ text, style, }) {
|
|
|
80
79
|
exports.Ansi = Ansi;
|
|
81
80
|
const styles = react_native_1.StyleSheet.create({
|
|
82
81
|
line: {
|
|
83
|
-
flexDirection:
|
|
82
|
+
flexDirection: 'row',
|
|
84
83
|
},
|
|
85
84
|
});
|
|
86
85
|
//# sourceMappingURL=AnsiHighlight.js.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"AnsiHighlight.js","sourceRoot":"","sources":["../../../src/error-overlay/UI/AnsiHighlight.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;GAMG;AACH,kDAA0B;AAC1B,kDAA0B;AAC1B,+CAA4E;AAE5E,uDAAuD;AACvD,MAAM,MAAM,GAA2B;IACrC,YAAY,EAAE,iBAAiB;IAC/B,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,mBAAmB;IACjC,aAAa,EAAE,oBAAoB;IACnC,WAAW,EAAE,oBAAoB;IACjC,cAAc,EAAE,oBAAoB;IACpC,WAAW,EAAE,oBAAoB;IACjC,oEAAoE;IACpE,sCAAsC;IACtC,mBAAmB,EAAE,iBAAiB;IACtC,iBAAiB,EAAE,kBAAkB;IACrC,mBAAmB,EAAE,mBAAmB;IACxC,oBAAoB,EAAE,oBAAoB;IAC1C,kBAAkB,EAAE,oBAAoB;IACxC,qBAAqB,EAAE,oBAAoB;IAC3C,kBAAkB,EAAE,oBAAoB;IACxC,mBAAmB,EAAE,oBAAoB;CAC1C,CAAC;AAEF,SAAgB,IAAI,CAAC,
|
|
1
|
+
{"version":3,"file":"AnsiHighlight.js","sourceRoot":"","sources":["../../../src/error-overlay/UI/AnsiHighlight.tsx"],"names":[],"mappings":";;;;;;AAAA;;;;;;GAMG;AACH,kDAA0B;AAC1B,kDAA0B;AAC1B,+CAA4E;AAE5E,uDAAuD;AACvD,MAAM,MAAM,GAA2B;IACrC,YAAY,EAAE,iBAAiB;IAC/B,UAAU,EAAE,kBAAkB;IAC9B,YAAY,EAAE,mBAAmB;IACjC,aAAa,EAAE,oBAAoB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EAAE,KAAK;KACrB;CACF,CAAC,CAAC","sourcesContent":["/**\n * Copyright (c) 650 Industries.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\nimport Anser from 'anser';\nimport React from 'react';\nimport { StyleProp, StyleSheet, Text, TextStyle, View } from 'react-native';\n\n// Afterglow theme from https://iterm2colorschemes.com/\nconst COLORS: Record<string, string> = {\n 'ansi-black': 'rgb(27, 27, 27)',\n 'ansi-red': 'rgb(187, 86, 83)',\n 'ansi-green': 'rgb(144, 157, 98)',\n 'ansi-yellow': 'rgb(234, 193, 121)',\n 'ansi-blue': 'rgb(125, 169, 199)',\n 'ansi-magenta': 'rgb(176, 101, 151)',\n 'ansi-cyan': 'rgb(140, 220, 216)',\n // Instead of white, use the default color provided to the component\n // 'ansi-white': 'rgb(216, 216, 216)',\n 'ansi-bright-black': 'rgb(98, 98, 98)',\n 'ansi-bright-red': 'rgb(187, 86, 83)',\n 'ansi-bright-green': 'rgb(144, 157, 98)',\n 'ansi-bright-yellow': 'rgb(234, 193, 121)',\n 'ansi-bright-blue': 'rgb(125, 169, 199)',\n 'ansi-bright-magenta': 'rgb(176, 101, 151)',\n 'ansi-bright-cyan': 'rgb(140, 220, 216)',\n 'ansi-bright-white': 'rgb(247, 247, 247)',\n};\n\nexport function Ansi({ text, style }: { text: string; style: StyleProp<TextStyle> }) {\n let commonWhitespaceLength = Infinity;\n const parsedLines = text.split(/\\n/).map((line) =>\n Anser.ansiToJson(line, {\n json: true,\n remove_empty: true,\n use_classes: true,\n })\n );\n\n parsedLines.map((lines) => {\n // The third item on each line includes the whitespace of the source code.\n // We are looking for the least amount of common whitespace to trim all lines.\n // Example: Array [\" \", \" 96 |\", \" text\", ...]\n const match = lines[2] && lines[2]?.content?.match(/^ +/);\n const whitespaceLength = (match && match[0]?.length) || 0;\n if (whitespaceLength < commonWhitespaceLength) {\n commonWhitespaceLength = whitespaceLength;\n }\n });\n\n const getText = (content: string, key: number) => {\n if (key === 1) {\n // Remove the vertical bar after line numbers\n return content.replace(/\\| $/, ' ');\n } else if (key === 2 && commonWhitespaceLength < Infinity) {\n // Remove common whitespace at the beginning of the line\n return content.substr(commonWhitespaceLength);\n } else {\n return content;\n }\n };\n\n return (\n <View>\n {parsedLines.map((items, i) => (\n <View style={styles.line} key={i}>\n {items.map((bundle, key) => {\n const textStyle =\n bundle.fg && COLORS[bundle.fg]\n ? {\n backgroundColor: bundle.bg && COLORS[bundle.bg],\n color: bundle.fg && COLORS[bundle.fg],\n }\n : {\n backgroundColor: bundle.bg && COLORS[bundle.bg],\n };\n return (\n <Text style={[style, textStyle]} key={key}>\n {getText(bundle.content, key)}\n </Text>\n );\n })}\n </View>\n ))}\n </View>\n );\n}\n\nconst styles = StyleSheet.create({\n line: {\n flexDirection: 'row',\n },\n});\n"]}
|