@expo/metro-runtime 3.2.0 → 3.2.2

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.
Files changed (89) hide show
  1. package/build/HMRClient.js.map +1 -1
  2. package/build/LoadingView.native.d.ts +1 -1
  3. package/build/LoadingView.native.d.ts.map +1 -1
  4. package/build/LoadingView.native.js +9 -5
  5. package/build/LoadingView.native.js.map +1 -1
  6. package/build/async-require/buildAsyncRequire.js +2 -1
  7. package/build/async-require/buildAsyncRequire.js.map +1 -1
  8. package/build/async-require/buildUrlForBundle.js +2 -1
  9. package/build/async-require/buildUrlForBundle.js.map +1 -1
  10. package/build/async-require/buildUrlForBundle.native.js +2 -1
  11. package/build/async-require/buildUrlForBundle.native.js.map +1 -1
  12. package/build/async-require/fetchAsync.js +2 -1
  13. package/build/async-require/fetchAsync.js.map +1 -1
  14. package/build/async-require/fetchAsync.native.js +2 -1
  15. package/build/async-require/fetchAsync.native.js.map +1 -1
  16. package/build/async-require/fetchThenEval.web.js +2 -1
  17. package/build/async-require/fetchThenEval.web.js.map +1 -1
  18. package/build/async-require/fetchThenEvalJs.js +2 -1
  19. package/build/async-require/fetchThenEvalJs.js.map +1 -1
  20. package/build/async-require/index.native.js.map +1 -1
  21. package/build/async-require/loadBundle.js +2 -1
  22. package/build/async-require/loadBundle.js.map +1 -1
  23. package/build/effects.js.map +1 -1
  24. package/build/error-overlay/Data/LogBoxData.js +21 -20
  25. package/build/error-overlay/Data/LogBoxData.js.map +1 -1
  26. package/build/error-overlay/Data/LogBoxLog.js.map +1 -1
  27. package/build/error-overlay/Data/LogBoxSymbolication.js +3 -2
  28. package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -1
  29. package/build/error-overlay/Data/LogContext.js +3 -3
  30. package/build/error-overlay/Data/LogContext.js.map +1 -1
  31. package/build/error-overlay/Data/parseLogBoxLog.js +6 -5
  32. package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -1
  33. package/build/error-overlay/ErrorOverlay.js +5 -4
  34. package/build/error-overlay/ErrorOverlay.js.map +1 -1
  35. package/build/error-overlay/LogBox.web.js.map +1 -1
  36. package/build/error-overlay/UI/AnsiHighlight.js +2 -1
  37. package/build/error-overlay/UI/AnsiHighlight.js.map +1 -1
  38. package/build/error-overlay/UI/LogBoxButton.js +2 -1
  39. package/build/error-overlay/UI/LogBoxButton.js.map +1 -1
  40. package/build/error-overlay/UI/LogBoxMessage.js +2 -1
  41. package/build/error-overlay/UI/LogBoxMessage.js.map +1 -1
  42. package/build/error-overlay/UI/LogBoxStyle.js +15 -14
  43. package/build/error-overlay/UI/LogBoxStyle.js.map +1 -1
  44. package/build/error-overlay/formatProjectFilePath.js +3 -2
  45. package/build/error-overlay/formatProjectFilePath.js.map +1 -1
  46. package/build/error-overlay/index.js +2 -1
  47. package/build/error-overlay/index.js.map +1 -1
  48. package/build/error-overlay/modules/ExceptionsManager/index.js.map +1 -1
  49. package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -1
  50. package/build/error-overlay/modules/openFileInEditor/index.js.map +1 -1
  51. package/build/error-overlay/modules/parseErrorStack/index.js.map +1 -1
  52. package/build/error-overlay/modules/stringifySafe/index.js +2 -1
  53. package/build/error-overlay/modules/stringifySafe/index.js.map +1 -1
  54. package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +2 -1
  55. package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -1
  56. package/build/error-overlay/overlay/LogBoxInspectorFooter.js +2 -1
  57. package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -1
  58. package/build/error-overlay/overlay/LogBoxInspectorHeader.js +2 -1
  59. package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -1
  60. package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +2 -1
  61. package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -1
  62. package/build/error-overlay/overlay/LogBoxInspectorSection.js +2 -1
  63. package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -1
  64. package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +2 -1
  65. package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -1
  66. package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +2 -1
  67. package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -1
  68. package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +3 -2
  69. package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -1
  70. package/build/error-overlay/toast/ErrorToast.js +2 -1
  71. package/build/error-overlay/toast/ErrorToast.js.map +1 -1
  72. package/build/error-overlay/toast/ErrorToastContainer.js +1 -1
  73. package/build/error-overlay/toast/ErrorToastContainer.js.map +1 -1
  74. package/build/error-overlay/toast/ErrorToastContainer.web.js +2 -1
  75. package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -1
  76. package/build/error-overlay/toast/ErrorToastMessage.js +2 -1
  77. package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -1
  78. package/build/error-overlay/useRejectionHandler.js +2 -1
  79. package/build/error-overlay/useRejectionHandler.js.map +1 -1
  80. package/build/getDevServer.js.map +1 -1
  81. package/build/location/Location.js +3 -2
  82. package/build/location/Location.js.map +1 -1
  83. package/build/location/Location.native.js +3 -2
  84. package/build/location/Location.native.js.map +1 -1
  85. package/build/location/install.native.js.map +1 -1
  86. package/build/messageSocket.js.map +1 -1
  87. package/build/setupFastRefresh.js.map +1 -1
  88. package/package.json +2 -2
  89. package/src/LoadingView.native.ts +8 -1
@@ -1 +1 @@
1
- {"version":3,"file":"LogBoxData.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AA0Eb,8CAOC;AAED,kEAGC;AAED,oDAEC;AAED,4CAUC;AA+ED,wBAuBC;AAED,oCAUC;AAED,8CA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,CAAC;QAED,oBAAoB;YAClB,IAAI,IAAI,CAAC,aAAa,IAAI,IAAI,EAAE,CAAC;gBAC/B,IAAI,CAAC,aAAa,CAAC,WAAW,EAAE,CAAC;YACnC,CAAC;QACH,CAAC;QAED,cAAc,GAAG,GAAS,EAAE;YAC1B,4DAA4D;YAC5D,qDAAqD;YACrD,8CAA8C;YAC9C,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,SAAS,EAAE,GAAG,IAAI,CAAC,KAAK,CAAC;YACzD,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,SAAS,CAAC,CAAC;YACxC,IAAI,gBAAgB,IAAI,IAAI,EAAE,CAAC;gBAC7B,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE,CAAC;oBAC9B,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;gBACrB,CAAC;qBAAM,IAAI,gBAAgB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE,CAAC;oBACpD,cAAc,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;gBACvC,CAAC;gBAED,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC;YACvC,CAAC;QACH,CAAC,CAAC;QAEF,eAAe,GAAG,GAAS,EAAE;YAC3B,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC,CAAC;QAEF,qBAAqB,GAAG,CAAC,KAAa,EAAQ,EAAE;YAC9C,cAAc,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC;KACH;IAED,mBAAmB;IACnB,OAAO,uBAAuB,CAAC;AACjC,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\n'use client';\n\nimport * as React from 'react';\n\nimport { LogBoxLog, StackType } from './LogBoxLog';\nimport type { LogLevel } from './LogBoxLog';\nimport { LogContext } from './LogContext';\nimport { parseLogBoxException } from './parseLogBoxLog';\nimport type { Message, Category, ComponentStack, ExtendedExceptionData } from './parseLogBoxLog';\nimport NativeLogBox from '../modules/NativeLogBox';\nimport parseErrorStack from '../modules/parseErrorStack';\n\nexport type LogBoxLogs = Set<LogBoxLog>;\n\nexport type LogData = {\n level: LogLevel;\n message: Message;\n category: Category;\n componentStack: ComponentStack;\n};\n\ntype ExtendedError = any;\n\nexport type Observer = (options: {\n logs: LogBoxLogs;\n isDisabled: boolean;\n selectedLogIndex: number;\n}) => void;\n\nexport type IgnorePattern = string | RegExp;\n\nexport type Subscription = {\n unsubscribe: () => void;\n};\n\nexport type WarningInfo = {\n finalFormat: string;\n forceDialogImmediately: boolean;\n suppressDialog_LEGACY: boolean;\n suppressCompletely: boolean;\n monitorEvent: string | null;\n monitorListVersion: number;\n monitorSampleRate: number;\n};\n\nexport type WarningFilter = (format: string) => WarningInfo;\n\ntype Props = object;\n\ntype State = {\n logs: LogBoxLogs;\n isDisabled: boolean;\n hasError: boolean;\n selectedLogIndex: number;\n};\n\nconst observers: Set<{ observer: Observer } & any> = new Set();\nconst ignorePatterns: Set<IgnorePattern> = new Set();\nlet logs: LogBoxLogs = new Set();\nlet updateTimeout: null | ReturnType<typeof setImmediate> | ReturnType<typeof setTimeout> = null;\nlet _isDisabled = false;\nlet _selectedIndex = -1;\n\nconst LOGBOX_ERROR_MESSAGE =\n 'An error was thrown when attempting to render log messages via LogBox.';\n\nfunction getNextState() {\n return {\n logs,\n isDisabled: _isDisabled,\n selectedLogIndex: _selectedIndex,\n };\n}\n\nexport function reportLogBoxError(error: ExtendedError, componentStack?: string): void {\n const ExceptionsManager = require('../modules/ExceptionsManager').default;\n\n if (componentStack != null) {\n error.componentStack = componentStack;\n }\n ExceptionsManager.handleException(error);\n}\n\nexport function reportUnexpectedLogBoxError(error: ExtendedError, componentStack?: string): void {\n error.message = `${LOGBOX_ERROR_MESSAGE}\\n\\n${error.message}`;\n return reportLogBoxError(error, componentStack);\n}\n\nexport function isLogBoxErrorMessage(message: string): boolean {\n return typeof message === 'string' && message.includes(LOGBOX_ERROR_MESSAGE);\n}\n\nexport function isMessageIgnored(message: string): boolean {\n for (const pattern of ignorePatterns) {\n if (\n (pattern instanceof RegExp && pattern.test(message)) ||\n (typeof pattern === 'string' && message.includes(pattern))\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction setImmediateShim(callback: () => void) {\n if (!global.setImmediate) {\n return setTimeout(callback, 0);\n }\n return global.setImmediate(callback);\n}\n\nfunction handleUpdate(): void {\n if (updateTimeout == null) {\n updateTimeout = setImmediateShim(() => {\n updateTimeout = null;\n const nextState = getNextState();\n observers.forEach(({ observer }) => observer(nextState));\n });\n }\n}\n\nfunction appendNewLog(newLog: LogBoxLog): void {\n // Don't want store these logs because they trigger a\n // state update when we add them to the store.\n if (isMessageIgnored(newLog.message.content)) {\n return;\n }\n\n // If the next log has the same category as the previous one\n // then roll it up into the last log in the list by incrementing\n // the count (similar to how Chrome does it).\n const lastLog = Array.from(logs).pop();\n if (lastLog && lastLog.category === newLog.category) {\n lastLog.incrementCount();\n handleUpdate();\n return;\n }\n\n if (newLog.level === 'fatal') {\n // If possible, to avoid jank, we don't want to open the error before\n // it's symbolicated. To do that, we optimistically wait for\n // symbolication for up to a second before adding the log.\n const OPTIMISTIC_WAIT_TIME = 1000;\n\n let addPendingLog: null | (() => void) = () => {\n logs.add(newLog);\n if (_selectedIndex < 0) {\n setSelectedLog(logs.size - 1);\n } else {\n handleUpdate();\n }\n addPendingLog = null;\n };\n\n const optimisticTimeout = setTimeout(() => {\n if (addPendingLog) {\n addPendingLog();\n }\n }, OPTIMISTIC_WAIT_TIME);\n\n // TODO: HANDLE THIS\n newLog.symbolicate('component');\n\n newLog.symbolicate('stack', (status) => {\n if (addPendingLog && status !== 'PENDING') {\n addPendingLog();\n clearTimeout(optimisticTimeout);\n } else if (status !== 'PENDING') {\n // The log has already been added but we need to trigger a render.\n handleUpdate();\n }\n });\n } else if (newLog.level === 'syntax') {\n logs.add(newLog);\n setSelectedLog(logs.size - 1);\n } else {\n logs.add(newLog);\n handleUpdate();\n }\n}\n\nexport function addLog(log: LogData): void {\n const errorForStackTrace = new Error();\n\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n const stack = parseErrorStack(errorForStackTrace?.stack);\n\n appendNewLog(\n new LogBoxLog({\n level: log.level,\n message: log.message,\n isComponentError: false,\n stack,\n category: log.category,\n componentStack: log.componentStack,\n })\n );\n } catch (error) {\n reportUnexpectedLogBoxError(error);\n }\n });\n}\n\nexport function addException(error: ExtendedExceptionData): void {\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n appendNewLog(new LogBoxLog(parseLogBoxException(error)));\n } catch (loggingError) {\n reportUnexpectedLogBoxError(loggingError);\n }\n });\n}\n\nexport function symbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.symbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function retrySymbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.retrySymbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function symbolicateLogLazy(type: StackType, log: LogBoxLog) {\n log.symbolicate(type);\n}\n\nexport function clear(): void {\n if (logs.size > 0) {\n logs = new Set();\n setSelectedLog(-1);\n }\n}\n\nexport function setSelectedLog(proposedNewIndex: number): void {\n const oldIndex = _selectedIndex;\n let newIndex = proposedNewIndex;\n\n const logArray = Array.from(logs);\n let index = logArray.length - 1;\n while (index >= 0) {\n // The latest syntax error is selected and displayed before all other logs.\n if (logArray[index].level === 'syntax') {\n newIndex = index;\n break;\n }\n index -= 1;\n }\n _selectedIndex = newIndex;\n handleUpdate();\n if (NativeLogBox) {\n setTimeout(() => {\n if (oldIndex < 0 && newIndex >= 0) {\n NativeLogBox.show();\n } else if (oldIndex >= 0 && newIndex < 0) {\n NativeLogBox.hide();\n }\n }, 0);\n }\n}\n\nexport function clearWarnings(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== 'warn');\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n handleUpdate();\n }\n}\n\nexport function clearErrors(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== 'error' && log.level !== 'fatal');\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n }\n}\n\nexport function dismiss(log: LogBoxLog): void {\n if (logs.has(log)) {\n logs.delete(log);\n handleUpdate();\n }\n}\n\nexport function getIgnorePatterns(): IgnorePattern[] {\n return Array.from(ignorePatterns);\n}\n\nexport function addIgnorePatterns(patterns: IgnorePattern[]): void {\n const existingSize = ignorePatterns.size;\n // The same pattern may be added multiple times, but adding a new pattern\n // can be expensive so let's find only the ones that are new.\n patterns.forEach((pattern: IgnorePattern) => {\n if (pattern instanceof RegExp) {\n for (const existingPattern of ignorePatterns) {\n if (\n existingPattern instanceof RegExp &&\n existingPattern.toString() === pattern.toString()\n ) {\n return;\n }\n }\n ignorePatterns.add(pattern);\n }\n ignorePatterns.add(pattern);\n });\n if (ignorePatterns.size === existingSize) {\n return;\n }\n // We need to recheck all of the existing logs.\n // This allows adding an ignore pattern anywhere in the codebase.\n // Without this, if you ignore a pattern after the a log is created,\n // then we would keep showing the log.\n logs = new Set(Array.from(logs).filter((log) => !isMessageIgnored(log.message.content)));\n handleUpdate();\n}\n\nexport function setDisabled(value: boolean): void {\n if (value === _isDisabled) {\n return;\n }\n _isDisabled = value;\n handleUpdate();\n}\n\nexport function isDisabled(): boolean {\n return _isDisabled;\n}\n\nexport function observe(observer: Observer): Subscription {\n const subscription = { observer };\n observers.add(subscription);\n\n observer(getNextState());\n\n return {\n unsubscribe(): void {\n observers.delete(subscription);\n },\n };\n}\n\nexport function withSubscription(WrappedComponent: React.FC<object>): React.Component<object> {\n class LogBoxStateSubscription extends React.Component<React.PropsWithChildren<Props>, State> {\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(err: Error, errorInfo: { componentStack: string } & any) {\n /* $FlowFixMe[class-object-subtyping] added when improving typing for\n * this parameters */\n reportLogBoxError(err, errorInfo.componentStack);\n }\n\n _subscription?: Subscription;\n\n state = {\n logs: new Set<LogBoxLog>(),\n isDisabled: false,\n hasError: false,\n selectedLogIndex: -1,\n };\n\n render() {\n if (this.state.hasError) {\n // This happens when the component failed to render, in which case we delegate to the native redbox.\n // We can't show any fallback UI here, because the error may be with <View> or <Text>.\n return null;\n }\n\n return (\n <LogContext.Provider\n value={{\n selectedLogIndex: this.state.selectedLogIndex,\n isDisabled: this.state.isDisabled,\n logs: Array.from(this.state.logs),\n }}>\n {this.props.children}\n <WrappedComponent />\n </LogContext.Provider>\n );\n }\n\n componentDidMount(): void {\n this._subscription = observe((data) => {\n this.setState(data);\n });\n }\n\n componentWillUnmount(): void {\n if (this._subscription != null) {\n this._subscription.unsubscribe();\n }\n }\n\n _handleDismiss = (): 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 { selectedLogIndex, logs: stateLogs } = this.state;\n const logsArray = Array.from(stateLogs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n setSelectedLog(selectedLogIndex - 1);\n }\n\n dismiss(logsArray[selectedLogIndex]);\n }\n };\n\n _handleMinimize = (): void => {\n setSelectedLog(-1);\n };\n\n _handleSetSelectedLog = (index: number): void => {\n setSelectedLog(index);\n };\n }\n\n // @ts-expect-error\n return LogBoxStateSubscription;\n}\n"]}
1
+ {"version":3,"file":"LogBoxData.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxData.tsx"],"names":[],"mappings":"AAAA;;;;;;GAMG;AAEH,YAAY,CAAC;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;AAEb,6CAA+B;AAE/B,2CAAmD;AAEnD,6CAA0C;AAC1C,qDAAwD;AAExD,2EAAmD;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AI,EAAE;gBAC5B,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,IAAI,CAAC,EAAE;oBAC7B,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;iBACpB;qBAAM,IAAI,gBAAgB,IAAI,SAAS,CAAC,MAAM,GAAG,CAAC,EAAE;oBACnD,cAAc,CAAC,gBAAgB,GAAG,CAAC,CAAC,CAAC;iBACtC;gBAED,OAAO,CAAC,SAAS,CAAC,gBAAgB,CAAC,CAAC,CAAC;aACtC;QACH,CAAC,CAAC;QAEF,eAAe,GAAG,GAAS,EAAE;YAC3B,cAAc,CAAC,CAAC,CAAC,CAAC,CAAC;QACrB,CAAC,CAAC;QAEF,qBAAqB,GAAG,CAAC,KAAa,EAAQ,EAAE;YAC9C,cAAc,CAAC,KAAK,CAAC,CAAC;QACxB,CAAC,CAAC;KACH;IAED,mBAAmB;IACnB,OAAO,uBAAuB,CAAC;AACjC,CAAC;AAjFD,4CAiFC","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\n'use client';\n\nimport * as React from 'react';\n\nimport { LogBoxLog, StackType } from './LogBoxLog';\nimport type { LogLevel } from './LogBoxLog';\nimport { LogContext } from './LogContext';\nimport { parseLogBoxException } from './parseLogBoxLog';\nimport type { Message, Category, ComponentStack, ExtendedExceptionData } from './parseLogBoxLog';\nimport NativeLogBox from '../modules/NativeLogBox';\nimport parseErrorStack from '../modules/parseErrorStack';\n\nexport type LogBoxLogs = Set<LogBoxLog>;\n\nexport type LogData = {\n level: LogLevel;\n message: Message;\n category: Category;\n componentStack: ComponentStack;\n};\n\ntype ExtendedError = any;\n\nexport type Observer = (options: {\n logs: LogBoxLogs;\n isDisabled: boolean;\n selectedLogIndex: number;\n}) => void;\n\nexport type IgnorePattern = string | RegExp;\n\nexport type Subscription = {\n unsubscribe: () => void;\n};\n\nexport type WarningInfo = {\n finalFormat: string;\n forceDialogImmediately: boolean;\n suppressDialog_LEGACY: boolean;\n suppressCompletely: boolean;\n monitorEvent: string | null;\n monitorListVersion: number;\n monitorSampleRate: number;\n};\n\nexport type WarningFilter = (format: string) => WarningInfo;\n\ntype Props = object;\n\ntype State = {\n logs: LogBoxLogs;\n isDisabled: boolean;\n hasError: boolean;\n selectedLogIndex: number;\n};\n\nconst observers: Set<{ observer: Observer } & any> = new Set();\nconst ignorePatterns: Set<IgnorePattern> = new Set();\nlet logs: LogBoxLogs = new Set();\nlet updateTimeout: null | ReturnType<typeof setImmediate> | ReturnType<typeof setTimeout> = null;\nlet _isDisabled = false;\nlet _selectedIndex = -1;\n\nconst LOGBOX_ERROR_MESSAGE =\n 'An error was thrown when attempting to render log messages via LogBox.';\n\nfunction getNextState() {\n return {\n logs,\n isDisabled: _isDisabled,\n selectedLogIndex: _selectedIndex,\n };\n}\n\nexport function reportLogBoxError(error: ExtendedError, componentStack?: string): void {\n const ExceptionsManager = require('../modules/ExceptionsManager').default;\n\n if (componentStack != null) {\n error.componentStack = componentStack;\n }\n ExceptionsManager.handleException(error);\n}\n\nexport function reportUnexpectedLogBoxError(error: ExtendedError, componentStack?: string): void {\n error.message = `${LOGBOX_ERROR_MESSAGE}\\n\\n${error.message}`;\n return reportLogBoxError(error, componentStack);\n}\n\nexport function isLogBoxErrorMessage(message: string): boolean {\n return typeof message === 'string' && message.includes(LOGBOX_ERROR_MESSAGE);\n}\n\nexport function isMessageIgnored(message: string): boolean {\n for (const pattern of ignorePatterns) {\n if (\n (pattern instanceof RegExp && pattern.test(message)) ||\n (typeof pattern === 'string' && message.includes(pattern))\n ) {\n return true;\n }\n }\n return false;\n}\n\nfunction setImmediateShim(callback: () => void) {\n if (!global.setImmediate) {\n return setTimeout(callback, 0);\n }\n return global.setImmediate(callback);\n}\n\nfunction handleUpdate(): void {\n if (updateTimeout == null) {\n updateTimeout = setImmediateShim(() => {\n updateTimeout = null;\n const nextState = getNextState();\n observers.forEach(({ observer }) => observer(nextState));\n });\n }\n}\n\nfunction appendNewLog(newLog: LogBoxLog): void {\n // Don't want store these logs because they trigger a\n // state update when we add them to the store.\n if (isMessageIgnored(newLog.message.content)) {\n return;\n }\n\n // If the next log has the same category as the previous one\n // then roll it up into the last log in the list by incrementing\n // the count (similar to how Chrome does it).\n const lastLog = Array.from(logs).pop();\n if (lastLog && lastLog.category === newLog.category) {\n lastLog.incrementCount();\n handleUpdate();\n return;\n }\n\n if (newLog.level === 'fatal') {\n // If possible, to avoid jank, we don't want to open the error before\n // it's symbolicated. To do that, we optimistically wait for\n // symbolication for up to a second before adding the log.\n const OPTIMISTIC_WAIT_TIME = 1000;\n\n let addPendingLog: null | (() => void) = () => {\n logs.add(newLog);\n if (_selectedIndex < 0) {\n setSelectedLog(logs.size - 1);\n } else {\n handleUpdate();\n }\n addPendingLog = null;\n };\n\n const optimisticTimeout = setTimeout(() => {\n if (addPendingLog) {\n addPendingLog();\n }\n }, OPTIMISTIC_WAIT_TIME);\n\n // TODO: HANDLE THIS\n newLog.symbolicate('component');\n\n newLog.symbolicate('stack', (status) => {\n if (addPendingLog && status !== 'PENDING') {\n addPendingLog();\n clearTimeout(optimisticTimeout);\n } else if (status !== 'PENDING') {\n // The log has already been added but we need to trigger a render.\n handleUpdate();\n }\n });\n } else if (newLog.level === 'syntax') {\n logs.add(newLog);\n setSelectedLog(logs.size - 1);\n } else {\n logs.add(newLog);\n handleUpdate();\n }\n}\n\nexport function addLog(log: LogData): void {\n const errorForStackTrace = new Error();\n\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n const stack = parseErrorStack(errorForStackTrace?.stack);\n\n appendNewLog(\n new LogBoxLog({\n level: log.level,\n message: log.message,\n isComponentError: false,\n stack,\n category: log.category,\n componentStack: log.componentStack,\n })\n );\n } catch (error) {\n reportUnexpectedLogBoxError(error);\n }\n });\n}\n\nexport function addException(error: ExtendedExceptionData): void {\n // Parsing logs are expensive so we schedule this\n // otherwise spammy logs would pause rendering.\n setImmediate(() => {\n try {\n appendNewLog(new LogBoxLog(parseLogBoxException(error)));\n } catch (loggingError) {\n reportUnexpectedLogBoxError(loggingError);\n }\n });\n}\n\nexport function symbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.symbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function retrySymbolicateLogNow(type: StackType, log: LogBoxLog) {\n log.retrySymbolicate(type, () => {\n handleUpdate();\n });\n}\n\nexport function symbolicateLogLazy(type: StackType, log: LogBoxLog) {\n log.symbolicate(type);\n}\n\nexport function clear(): void {\n if (logs.size > 0) {\n logs = new Set();\n setSelectedLog(-1);\n }\n}\n\nexport function setSelectedLog(proposedNewIndex: number): void {\n const oldIndex = _selectedIndex;\n let newIndex = proposedNewIndex;\n\n const logArray = Array.from(logs);\n let index = logArray.length - 1;\n while (index >= 0) {\n // The latest syntax error is selected and displayed before all other logs.\n if (logArray[index].level === 'syntax') {\n newIndex = index;\n break;\n }\n index -= 1;\n }\n _selectedIndex = newIndex;\n handleUpdate();\n if (NativeLogBox) {\n setTimeout(() => {\n if (oldIndex < 0 && newIndex >= 0) {\n NativeLogBox.show();\n } else if (oldIndex >= 0 && newIndex < 0) {\n NativeLogBox.hide();\n }\n }, 0);\n }\n}\n\nexport function clearWarnings(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== 'warn');\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n handleUpdate();\n }\n}\n\nexport function clearErrors(): void {\n const newLogs = Array.from(logs).filter((log) => log.level !== 'error' && log.level !== 'fatal');\n if (newLogs.length !== logs.size) {\n logs = new Set(newLogs);\n setSelectedLog(-1);\n }\n}\n\nexport function dismiss(log: LogBoxLog): void {\n if (logs.has(log)) {\n logs.delete(log);\n handleUpdate();\n }\n}\n\nexport function getIgnorePatterns(): IgnorePattern[] {\n return Array.from(ignorePatterns);\n}\n\nexport function addIgnorePatterns(patterns: IgnorePattern[]): void {\n const existingSize = ignorePatterns.size;\n // The same pattern may be added multiple times, but adding a new pattern\n // can be expensive so let's find only the ones that are new.\n patterns.forEach((pattern: IgnorePattern) => {\n if (pattern instanceof RegExp) {\n for (const existingPattern of ignorePatterns) {\n if (\n existingPattern instanceof RegExp &&\n existingPattern.toString() === pattern.toString()\n ) {\n return;\n }\n }\n ignorePatterns.add(pattern);\n }\n ignorePatterns.add(pattern);\n });\n if (ignorePatterns.size === existingSize) {\n return;\n }\n // We need to recheck all of the existing logs.\n // This allows adding an ignore pattern anywhere in the codebase.\n // Without this, if you ignore a pattern after the a log is created,\n // then we would keep showing the log.\n logs = new Set(Array.from(logs).filter((log) => !isMessageIgnored(log.message.content)));\n handleUpdate();\n}\n\nexport function setDisabled(value: boolean): void {\n if (value === _isDisabled) {\n return;\n }\n _isDisabled = value;\n handleUpdate();\n}\n\nexport function isDisabled(): boolean {\n return _isDisabled;\n}\n\nexport function observe(observer: Observer): Subscription {\n const subscription = { observer };\n observers.add(subscription);\n\n observer(getNextState());\n\n return {\n unsubscribe(): void {\n observers.delete(subscription);\n },\n };\n}\n\nexport function withSubscription(WrappedComponent: React.FC<object>): React.Component<object> {\n class LogBoxStateSubscription extends React.Component<React.PropsWithChildren<Props>, State> {\n static getDerivedStateFromError() {\n return { hasError: true };\n }\n\n componentDidCatch(err: Error, errorInfo: { componentStack: string } & any) {\n /* $FlowFixMe[class-object-subtyping] added when improving typing for\n * this parameters */\n reportLogBoxError(err, errorInfo.componentStack);\n }\n\n _subscription?: Subscription;\n\n state = {\n logs: new Set<LogBoxLog>(),\n isDisabled: false,\n hasError: false,\n selectedLogIndex: -1,\n };\n\n render() {\n if (this.state.hasError) {\n // This happens when the component failed to render, in which case we delegate to the native redbox.\n // We can't show any fallback UI here, because the error may be with <View> or <Text>.\n return null;\n }\n\n return (\n <LogContext.Provider\n value={{\n selectedLogIndex: this.state.selectedLogIndex,\n isDisabled: this.state.isDisabled,\n logs: Array.from(this.state.logs),\n }}>\n {this.props.children}\n <WrappedComponent />\n </LogContext.Provider>\n );\n }\n\n componentDidMount(): void {\n this._subscription = observe((data) => {\n this.setState(data);\n });\n }\n\n componentWillUnmount(): void {\n if (this._subscription != null) {\n this._subscription.unsubscribe();\n }\n }\n\n _handleDismiss = (): 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 { selectedLogIndex, logs: stateLogs } = this.state;\n const logsArray = Array.from(stateLogs);\n if (selectedLogIndex != null) {\n if (logsArray.length - 1 <= 0) {\n setSelectedLog(-1);\n } else if (selectedLogIndex >= logsArray.length - 1) {\n setSelectedLog(selectedLogIndex - 1);\n }\n\n dismiss(logsArray[selectedLogIndex]);\n }\n };\n\n _handleMinimize = (): void => {\n setSelectedLog(-1);\n };\n\n _handleSetSelectedLog = (index: number): void => {\n setSelectedLog(index);\n };\n }\n\n // @ts-expect-error\n return LogBoxStateSubscription;\n}\n"]}
@@ -1 +1 @@
1
- {"version":3,"file":"LogBoxLog.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxLog.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2EAA6D;AAqB7D,SAAS,qBAAqB,CAAC,cAA8B;IAC3D,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACpC,IAAI,EAAE,KAAK,CAAC,QAAQ;QACpB,UAAU,EAAE,KAAK,CAAC,OAAO;QACzB,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;QACpC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;QACnC,SAAS,EAAE,EAAE;KACd,CAAC,CAAC,CAAC;AACN,CAAC;AAUD,MAAa,SAAS;IACpB,OAAO,CAAU;IACjB,IAAI,CAAS;IACb,QAAQ,CAAW;IACnB,cAAc,CAAiB;IAC/B,KAAK,CAAQ;IACb,KAAK,CAAS;IACd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7KD,8BA6KC","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 * as LogBoxSymbolication from './LogBoxSymbolication';\nimport type { Stack } from './LogBoxSymbolication';\nimport type { Category, Message, ComponentStack, CodeFrame } from './parseLogBoxLog';\n\ntype SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';\n\nexport type LogLevel = 'warn' | 'error' | 'fatal' | 'syntax' | 'static';\n\nexport type LogBoxLogData = {\n level: LogLevel;\n type?: string;\n message: Message;\n stack: Stack;\n category: string;\n componentStack: ComponentStack;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n};\n\nexport type StackType = 'stack' | 'component';\n\nfunction componentStackToStack(componentStack: ComponentStack): Stack {\n return componentStack.map((stack) => ({\n file: stack.fileName,\n methodName: stack.content,\n lineNumber: stack.location?.row ?? 0,\n column: stack.location?.column ?? 0,\n arguments: [],\n }));\n}\n\ntype SymbolicationCallback = (status: SymbolicationStatus) => void;\n\ntype SymbolicationResult =\n | { error: null; stack: null; status: 'NONE' }\n | { error: null; stack: null; status: 'PENDING' }\n | { error: null; stack: Stack; status: 'COMPLETE' }\n | { error: Error; stack: null; status: 'FAILED' };\n\nexport class LogBoxLog {\n message: Message;\n type: string;\n category: Category;\n componentStack: ComponentStack;\n stack: Stack;\n count: number;\n level: LogLevel;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n symbolicated: Record<StackType, SymbolicationResult> = {\n stack: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n component: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n };\n\n private callbacks: Map<StackType, Set<SymbolicationCallback>> = new Map();\n\n constructor(\n data: LogBoxLogData & {\n symbolicated?: Record<StackType, SymbolicationResult>;\n }\n ) {\n this.level = data.level;\n this.type = data.type ?? 'error';\n this.message = data.message;\n this.stack = data.stack;\n this.category = data.category;\n this.componentStack = data.componentStack;\n this.codeFrame = data.codeFrame;\n this.isComponentError = data.isComponentError;\n this.count = 1;\n this.symbolicated = data.symbolicated ?? this.symbolicated;\n }\n\n incrementCount(): void {\n this.count += 1;\n }\n\n getAvailableStack(type: StackType): Stack | null {\n if (this.symbolicated[type].status === 'COMPLETE') {\n return this.symbolicated[type].stack;\n }\n return this.getStack(type);\n }\n\n private flushCallbacks(type: StackType): void {\n const callbacks = this.callbacks.get(type);\n const status = this.symbolicated[type].status;\n if (callbacks) {\n for (const callback of callbacks) {\n callback(status);\n }\n callbacks.clear();\n }\n }\n\n private pushCallback(type: StackType, callback: SymbolicationCallback): void {\n let callbacks = this.callbacks.get(type);\n if (!callbacks) {\n callbacks = new Set();\n this.callbacks.set(type, callbacks);\n }\n callbacks.add(callback);\n }\n\n retrySymbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, true, callback);\n }\n\n symbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, false, callback);\n }\n\n private _symbolicate(\n type: StackType,\n retry: boolean,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n if (callback) {\n this.pushCallback(type, callback);\n }\n const status = this.symbolicated[type].status;\n\n if (status === 'COMPLETE') {\n return this.flushCallbacks(type);\n }\n\n if (retry) {\n LogBoxSymbolication.deleteStack(this.getStack(type));\n this.handleSymbolicate(type);\n } else {\n if (status === 'NONE') {\n this.handleSymbolicate(type);\n }\n }\n }\n\n private componentStackCache: Stack | null = null;\n\n private getStack(type: StackType): Stack {\n if (type === 'component') {\n if (this.componentStackCache == null) {\n this.componentStackCache = componentStackToStack(this.componentStack);\n }\n return this.componentStackCache;\n }\n return this.stack;\n }\n\n private handleSymbolicate(type: StackType): void {\n if (type === 'component' && !this.componentStack?.length) {\n return;\n }\n\n if (this.symbolicated[type].status !== 'PENDING') {\n this.updateStatus(type, null, null, null);\n LogBoxSymbolication.symbolicate(this.getStack(type)).then(\n (data) => {\n this.updateStatus(type, null, data?.stack, data?.codeFrame);\n },\n (error) => {\n this.updateStatus(type, error, null, null);\n }\n );\n }\n }\n\n private updateStatus(\n type: StackType,\n error?: Error | null,\n stack?: Stack | null,\n codeFrame?: CodeFrame | null\n ): void {\n const lastStatus = this.symbolicated[type].status;\n if (error != null) {\n this.symbolicated[type] = {\n error,\n stack: null,\n status: 'FAILED',\n };\n } else if (stack != null) {\n if (codeFrame) {\n this.codeFrame = codeFrame;\n }\n\n this.symbolicated[type] = {\n error: null,\n stack,\n status: 'COMPLETE',\n };\n } else {\n this.symbolicated[type] = {\n error: null,\n stack: null,\n status: 'PENDING',\n };\n }\n\n const status = this.symbolicated[type].status;\n if (lastStatus !== status) {\n if (['COMPLETE', 'FAILED'].includes(status)) {\n this.flushCallbacks(type);\n }\n }\n }\n}\n"]}
1
+ {"version":3,"file":"LogBoxLog.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxLog.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2EAA6D;AAqB7D,SAAS,qBAAqB,CAAC,cAA8B;IAC3D,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE,CAAC,CAAC;QACpC,IAAI,EAAE,KAAK,CAAC,QAAQ;QACpB,UAAU,EAAE,KAAK,CAAC,OAAO;QACzB,UAAU,EAAE,KAAK,CAAC,QAAQ,EAAE,GAAG,IAAI,CAAC;QACpC,MAAM,EAAE,KAAK,CAAC,QAAQ,EAAE,MAAM,IAAI,CAAC;QACnC,SAAS,EAAE,EAAE;KACd,CAAC,CAAC,CAAC;AACN,CAAC;AAUD,MAAa,SAAS;IACpB,OAAO,CAAU;IACjB,IAAI,CAAS;IACb,QAAQ,CAAW;IACnB,cAAc,CAAiB;IAC/B,KAAK,CAAQ;IACb,KAAK,CAAS;IACd,KAAK,CAAW;IAChB,SAAS,CAAa;IACtB,gBAAgB,CAAU;IAC1B,YAAY,GAA2C;QACr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ACpB,KAAoB,EACpB,SAA4B;QAE5B,MAAM,UAAU,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QAClD,IAAI,KAAK,IAAI,IAAI,EAAE;YACjB,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG;gBACxB,KAAK;gBACL,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,QAAQ;aACjB,CAAC;SACH;aAAM,IAAI,KAAK,IAAI,IAAI,EAAE;YACxB,IAAI,SAAS,EAAE;gBACb,IAAI,CAAC,SAAS,GAAG,SAAS,CAAC;aAC5B;YAED,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG;gBACxB,KAAK,EAAE,IAAI;gBACX,KAAK;gBACL,MAAM,EAAE,UAAU;aACnB,CAAC;SACH;aAAM;YACL,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,GAAG;gBACxB,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,SAAS;aAClB,CAAC;SACH;QAED,MAAM,MAAM,GAAG,IAAI,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC,MAAM,CAAC;QAC9C,IAAI,UAAU,KAAK,MAAM,EAAE;YACzB,IAAI,CAAC,UAAU,EAAE,QAAQ,CAAC,CAAC,QAAQ,CAAC,MAAM,CAAC,EAAE;gBAC3C,IAAI,CAAC,cAAc,CAAC,IAAI,CAAC,CAAC;aAC3B;SACF;IACH,CAAC;CACF;AA7KD,8BA6KC","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 * as LogBoxSymbolication from './LogBoxSymbolication';\nimport type { Stack } from './LogBoxSymbolication';\nimport type { Category, Message, ComponentStack, CodeFrame } from './parseLogBoxLog';\n\ntype SymbolicationStatus = 'NONE' | 'PENDING' | 'COMPLETE' | 'FAILED';\n\nexport type LogLevel = 'warn' | 'error' | 'fatal' | 'syntax' | 'static';\n\nexport type LogBoxLogData = {\n level: LogLevel;\n type?: string;\n message: Message;\n stack: Stack;\n category: string;\n componentStack: ComponentStack;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n};\n\nexport type StackType = 'stack' | 'component';\n\nfunction componentStackToStack(componentStack: ComponentStack): Stack {\n return componentStack.map((stack) => ({\n file: stack.fileName,\n methodName: stack.content,\n lineNumber: stack.location?.row ?? 0,\n column: stack.location?.column ?? 0,\n arguments: [],\n }));\n}\n\ntype SymbolicationCallback = (status: SymbolicationStatus) => void;\n\ntype SymbolicationResult =\n | { error: null; stack: null; status: 'NONE' }\n | { error: null; stack: null; status: 'PENDING' }\n | { error: null; stack: Stack; status: 'COMPLETE' }\n | { error: Error; stack: null; status: 'FAILED' };\n\nexport class LogBoxLog {\n message: Message;\n type: string;\n category: Category;\n componentStack: ComponentStack;\n stack: Stack;\n count: number;\n level: LogLevel;\n codeFrame?: CodeFrame;\n isComponentError: boolean;\n symbolicated: Record<StackType, SymbolicationResult> = {\n stack: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n component: {\n error: null,\n stack: null,\n status: 'NONE',\n },\n };\n\n private callbacks: Map<StackType, Set<SymbolicationCallback>> = new Map();\n\n constructor(\n data: LogBoxLogData & {\n symbolicated?: Record<StackType, SymbolicationResult>;\n }\n ) {\n this.level = data.level;\n this.type = data.type ?? 'error';\n this.message = data.message;\n this.stack = data.stack;\n this.category = data.category;\n this.componentStack = data.componentStack;\n this.codeFrame = data.codeFrame;\n this.isComponentError = data.isComponentError;\n this.count = 1;\n this.symbolicated = data.symbolicated ?? this.symbolicated;\n }\n\n incrementCount(): void {\n this.count += 1;\n }\n\n getAvailableStack(type: StackType): Stack | null {\n if (this.symbolicated[type].status === 'COMPLETE') {\n return this.symbolicated[type].stack;\n }\n return this.getStack(type);\n }\n\n private flushCallbacks(type: StackType): void {\n const callbacks = this.callbacks.get(type);\n const status = this.symbolicated[type].status;\n if (callbacks) {\n for (const callback of callbacks) {\n callback(status);\n }\n callbacks.clear();\n }\n }\n\n private pushCallback(type: StackType, callback: SymbolicationCallback): void {\n let callbacks = this.callbacks.get(type);\n if (!callbacks) {\n callbacks = new Set();\n this.callbacks.set(type, callbacks);\n }\n callbacks.add(callback);\n }\n\n retrySymbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, true, callback);\n }\n\n symbolicate(type: StackType, callback?: (status: SymbolicationStatus) => void): void {\n this._symbolicate(type, false, callback);\n }\n\n private _symbolicate(\n type: StackType,\n retry: boolean,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n if (callback) {\n this.pushCallback(type, callback);\n }\n const status = this.symbolicated[type].status;\n\n if (status === 'COMPLETE') {\n return this.flushCallbacks(type);\n }\n\n if (retry) {\n LogBoxSymbolication.deleteStack(this.getStack(type));\n this.handleSymbolicate(type);\n } else {\n if (status === 'NONE') {\n this.handleSymbolicate(type);\n }\n }\n }\n\n private componentStackCache: Stack | null = null;\n\n private getStack(type: StackType): Stack {\n if (type === 'component') {\n if (this.componentStackCache == null) {\n this.componentStackCache = componentStackToStack(this.componentStack);\n }\n return this.componentStackCache;\n }\n return this.stack;\n }\n\n private handleSymbolicate(type: StackType): void {\n if (type === 'component' && !this.componentStack?.length) {\n return;\n }\n\n if (this.symbolicated[type].status !== 'PENDING') {\n this.updateStatus(type, null, null, null);\n LogBoxSymbolication.symbolicate(this.getStack(type)).then(\n (data) => {\n this.updateStatus(type, null, data?.stack, data?.codeFrame);\n },\n (error) => {\n this.updateStatus(type, error, null, null);\n }\n );\n }\n }\n\n private updateStatus(\n type: StackType,\n error?: Error | null,\n stack?: Stack | null,\n codeFrame?: CodeFrame | null\n ): void {\n const lastStatus = this.symbolicated[type].status;\n if (error != null) {\n this.symbolicated[type] = {\n error,\n stack: null,\n status: 'FAILED',\n };\n } else if (stack != null) {\n if (codeFrame) {\n this.codeFrame = codeFrame;\n }\n\n this.symbolicated[type] = {\n error: null,\n stack,\n status: 'COMPLETE',\n };\n } else {\n this.symbolicated[type] = {\n error: null,\n stack: null,\n status: 'PENDING',\n };\n }\n\n const status = this.symbolicated[type].status;\n if (lastStatus !== status) {\n if (['COMPLETE', 'FAILED'].includes(status)) {\n this.flushCallbacks(type);\n }\n }\n }\n}\n"]}
@@ -10,8 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  return (mod && mod.__esModule) ? mod : { "default": mod };
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.deleteStack = deleteStack;
14
- exports.symbolicate = symbolicate;
13
+ exports.symbolicate = exports.deleteStack = void 0;
15
14
  const symbolicateStackTrace_1 = __importDefault(require("../modules/symbolicateStackTrace"));
16
15
  const cache = new Map();
17
16
  /**
@@ -44,6 +43,7 @@ const sanitize = ({ stack: maybeStack, codeFrame, }) => {
44
43
  function deleteStack(stack) {
45
44
  cache.delete(stack);
46
45
  }
46
+ exports.deleteStack = deleteStack;
47
47
  function symbolicate(stack) {
48
48
  let promise = cache.get(stack);
49
49
  if (promise == null) {
@@ -52,4 +52,5 @@ function symbolicate(stack) {
52
52
  }
53
53
  return promise;
54
54
  }
55
+ exports.symbolicate = symbolicate;
55
56
  //# sourceMappingURL=LogBoxSymbolication.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogBoxSymbolication.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxSymbolication.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;AA6CH,kCAEC;AAED,kCAQC;AArDD,6FAAqE;AAQrE,MAAM,KAAK,GAAgD,IAAI,GAAG,EAAE,CAAC;AAErE;;GAEG;AACH,MAAM,QAAQ,GAAG,CAAC,EAChB,KAAK,EAAE,UAAU,EACjB,SAAS,GACc,EAA0B,EAAE;IACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE,CAAC;QAC/B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;IACpD,CAAC;IACD,MAAM,KAAK,GAAiB,EAAE,CAAC;IAC/B,KAAK,MAAM,UAAU,IAAI,UAAU,EAAE,CAAC;QACpC,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,IAAI,UAAU,IAAI,UAAU,EAAE,CAAC;YAC7B,IAAI,OAAO,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE,CAAC;gBAC7C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;YACtE,CAAC;YACD,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;QACjC,CAAC;QACD,KAAK,CAAC,IAAI,CAAC;YACT,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,QAAQ;SACT,CAAC,CAAC;IACL,CAAC;IACD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,SAAgB,WAAW,CAAC,KAAY;IACtC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,SAAgB,WAAW,CAAC,KAAY;IACtC,IAAI,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,OAAO,IAAI,IAAI,EAAE,CAAC;QACpB,OAAO,GAAG,IAAA,+BAAqB,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtD,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;IAC5B,CAAC;IAED,OAAO,OAAO,CAAC;AACjB,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 { StackFrame as UpstreamStackFrame } from 'stacktrace-parser';\n\nimport symbolicateStackTrace from '../modules/symbolicateStackTrace';\n\ntype SymbolicatedStackTrace = any;\n\ntype StackFrame = UpstreamStackFrame & { collapse?: boolean };\n\nexport type Stack = StackFrame[];\n\nconst cache: Map<Stack, Promise<SymbolicatedStackTrace>> = new Map();\n\n/**\n * Sanitize because sometimes, `symbolicateStackTrace` gives us invalid values.\n */\nconst sanitize = ({\n stack: maybeStack,\n codeFrame,\n}: SymbolicatedStackTrace): SymbolicatedStackTrace => {\n if (!Array.isArray(maybeStack)) {\n throw new Error('Expected stack to be an array.');\n }\n const stack: StackFrame[] = [];\n for (const maybeFrame of maybeStack) {\n let collapse = false;\n if ('collapse' in maybeFrame) {\n if (typeof maybeFrame.collapse !== 'boolean') {\n throw new Error('Expected stack frame `collapse` to be a boolean.');\n }\n collapse = maybeFrame.collapse;\n }\n stack.push({\n arguments: [],\n column: maybeFrame.column,\n file: maybeFrame.file,\n lineNumber: maybeFrame.lineNumber,\n methodName: maybeFrame.methodName,\n collapse,\n });\n }\n return { stack, codeFrame };\n};\n\nexport function deleteStack(stack: Stack): void {\n cache.delete(stack);\n}\n\nexport function symbolicate(stack: Stack): Promise<SymbolicatedStackTrace> {\n let promise = cache.get(stack);\n if (promise == null) {\n promise = symbolicateStackTrace(stack).then(sanitize);\n cache.set(stack, promise);\n }\n\n return promise;\n}\n"]}
1
+ {"version":3,"file":"LogBoxSymbolication.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxSymbolication.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAIH,6FAAqE;AAQrE,MAAM,KAAK,GAAgD,IAAI,GAAG,EAAE,CAAC;AAErE;;GAEG;AACH,MAAM,QAAQ,GAAG,CAAC,EAChB,KAAK,EAAE,UAAU,EACjB,SAAS,GACc,EAA0B,EAAE;IACnD,IAAI,CAAC,KAAK,CAAC,OAAO,CAAC,UAAU,CAAC,EAAE;QAC9B,MAAM,IAAI,KAAK,CAAC,gCAAgC,CAAC,CAAC;KACnD;IACD,MAAM,KAAK,GAAiB,EAAE,CAAC;IAC/B,KAAK,MAAM,UAAU,IAAI,UAAU,EAAE;QACnC,IAAI,QAAQ,GAAG,KAAK,CAAC;QACrB,IAAI,UAAU,IAAI,UAAU,EAAE;YAC5B,IAAI,OAAO,UAAU,CAAC,QAAQ,KAAK,SAAS,EAAE;gBAC5C,MAAM,IAAI,KAAK,CAAC,kDAAkD,CAAC,CAAC;aACrE;YACD,QAAQ,GAAG,UAAU,CAAC,QAAQ,CAAC;SAChC;QACD,KAAK,CAAC,IAAI,CAAC;YACT,SAAS,EAAE,EAAE;YACb,MAAM,EAAE,UAAU,CAAC,MAAM;YACzB,IAAI,EAAE,UAAU,CAAC,IAAI;YACrB,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,UAAU,EAAE,UAAU,CAAC,UAAU;YACjC,QAAQ;SACT,CAAC,CAAC;KACJ;IACD,OAAO,EAAE,KAAK,EAAE,SAAS,EAAE,CAAC;AAC9B,CAAC,CAAC;AAEF,SAAgB,WAAW,CAAC,KAAY;IACtC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAFD,kCAEC;AAED,SAAgB,WAAW,CAAC,KAAY;IACtC,IAAI,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,GAAG,IAAA,+BAAqB,EAAC,KAAK,CAAC,CAAC,IAAI,CAAC,QAAQ,CAAC,CAAC;QACtD,KAAK,CAAC,GAAG,CAAC,KAAK,EAAE,OAAO,CAAC,CAAC;KAC3B;IAED,OAAO,OAAO,CAAC;AACjB,CAAC;AARD,kCAQC","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 { StackFrame as UpstreamStackFrame } from 'stacktrace-parser';\n\nimport symbolicateStackTrace from '../modules/symbolicateStackTrace';\n\ntype SymbolicatedStackTrace = any;\n\ntype StackFrame = UpstreamStackFrame & { collapse?: boolean };\n\nexport type Stack = StackFrame[];\n\nconst cache: Map<Stack, Promise<SymbolicatedStackTrace>> = new Map();\n\n/**\n * Sanitize because sometimes, `symbolicateStackTrace` gives us invalid values.\n */\nconst sanitize = ({\n stack: maybeStack,\n codeFrame,\n}: SymbolicatedStackTrace): SymbolicatedStackTrace => {\n if (!Array.isArray(maybeStack)) {\n throw new Error('Expected stack to be an array.');\n }\n const stack: StackFrame[] = [];\n for (const maybeFrame of maybeStack) {\n let collapse = false;\n if ('collapse' in maybeFrame) {\n if (typeof maybeFrame.collapse !== 'boolean') {\n throw new Error('Expected stack frame `collapse` to be a boolean.');\n }\n collapse = maybeFrame.collapse;\n }\n stack.push({\n arguments: [],\n column: maybeFrame.column,\n file: maybeFrame.file,\n lineNumber: maybeFrame.lineNumber,\n methodName: maybeFrame.methodName,\n collapse,\n });\n }\n return { stack, codeFrame };\n};\n\nexport function deleteStack(stack: Stack): void {\n cache.delete(stack);\n}\n\nexport function symbolicate(stack: Stack): Promise<SymbolicatedStackTrace> {\n let promise = cache.get(stack);\n if (promise == null) {\n promise = symbolicateStackTrace(stack).then(sanitize);\n cache.set(stack, promise);\n }\n\n return promise;\n}\n"]}
@@ -3,9 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.LogContext = void 0;
7
- exports.useLogs = useLogs;
8
- exports.useSelectedLog = useSelectedLog;
6
+ exports.useSelectedLog = exports.useLogs = exports.LogContext = void 0;
9
7
  const react_1 = __importDefault(require("react"));
10
8
  const LogBoxLog_1 = require("./LogBoxLog");
11
9
  // Context provider for Array<LogBoxLog>
@@ -28,8 +26,10 @@ function useLogs() {
28
26
  }
29
27
  return logs;
30
28
  }
29
+ exports.useLogs = useLogs;
31
30
  function useSelectedLog() {
32
31
  const { selectedLogIndex, logs } = useLogs();
33
32
  return logs[selectedLogIndex];
34
33
  }
34
+ exports.useSelectedLog = useSelectedLog;
35
35
  //# sourceMappingURL=LogContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogContext.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":";;;;;;AAYA,0BAsBC;AAED,wCAGC;AAvCD,kDAA0B;AAE1B,2CAAwC;AAExC,wCAAwC;AAE3B,QAAA,UAAU,GAAG,eAAK,CAAC,aAAa,CAInC,IAAI,CAAC,CAAC;AAEhB,SAAgB,OAAO;IAKrB,MAAM,IAAI,GAAG,eAAK,CAAC,UAAU,CAAC,kBAAU,CAAC,CAAC;IAC1C,IAAI,CAAC,IAAI,EAAE,CAAC;QACV,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE,CAAC;YACnE,uEAAuE;YACvE,MAAM,yBAAyB,GAAG,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;YAChF,IAAI,yBAAyB,EAAE,WAAW,EAAE,CAAC;gBAC3C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;gBAC9D,OAAO;oBACL,GAAG,GAAG;oBACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,qBAAS,CAAC,GAAG,CAAC,CAAC;iBACrD,CAAC;YACJ,CAAC;QACH,CAAC;QAED,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;IAC/D,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,SAAgB,cAAc;IAC5B,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAChC,CAAC","sourcesContent":["import React from 'react';\n\nimport { LogBoxLog } from './LogBoxLog';\n\n// Context provider for Array<LogBoxLog>\n\nexport const LogContext = React.createContext<{\n selectedLogIndex: number;\n isDisabled: boolean;\n logs: LogBoxLog[];\n} | null>(null);\n\nexport function useLogs(): {\n selectedLogIndex: number;\n isDisabled: boolean;\n logs: LogBoxLog[];\n} {\n const logs = React.useContext(LogContext);\n if (!logs) {\n if (process.env.EXPO_OS === 'web' && typeof window !== 'undefined') {\n // Logbox data that is pre-fetched on the dev server and rendered here.\n const expoCliStaticErrorElement = document.getElementById('_expo-static-error');\n if (expoCliStaticErrorElement?.textContent) {\n const raw = JSON.parse(expoCliStaticErrorElement.textContent);\n return {\n ...raw,\n logs: raw.logs.map((raw: any) => new LogBoxLog(raw)),\n };\n }\n }\n\n throw new Error('useLogs must be used within a LogProvider');\n }\n return logs;\n}\n\nexport function useSelectedLog() {\n const { selectedLogIndex, logs } = useLogs();\n return logs[selectedLogIndex];\n}\n"]}
1
+ {"version":3,"file":"LogContext.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAE1B,2CAAwC;AAExC,wCAAwC;AAE3B,QAAA,UAAU,GAAG,eAAK,CAAC,aAAa,CAInC,IAAI,CAAC,CAAC;AAEhB,SAAgB,OAAO;IAKrB,MAAM,IAAI,GAAG,eAAK,CAAC,UAAU,CAAC,kBAAU,CAAC,CAAC;IAC1C,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,OAAO,CAAC,GAAG,CAAC,OAAO,KAAK,KAAK,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YAClE,uEAAuE;YACvE,MAAM,yBAAyB,GAAG,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;YAChF,IAAI,yBAAyB,EAAE,WAAW,EAAE;gBAC1C,MAAM,GAAG,GAAG,IAAI,CAAC,KAAK,CAAC,yBAAyB,CAAC,WAAW,CAAC,CAAC;gBAC9D,OAAO;oBACL,GAAG,GAAG;oBACN,IAAI,EAAE,GAAG,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC,GAAQ,EAAE,EAAE,CAAC,IAAI,qBAAS,CAAC,GAAG,CAAC,CAAC;iBACrD,CAAC;aACH;SACF;QAED,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAtBD,0BAsBC;AAED,SAAgB,cAAc;IAC5B,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,OAAO,EAAE,CAAC;IAC7C,OAAO,IAAI,CAAC,gBAAgB,CAAC,CAAC;AAChC,CAAC;AAHD,wCAGC","sourcesContent":["import React from 'react';\n\nimport { LogBoxLog } from './LogBoxLog';\n\n// Context provider for Array<LogBoxLog>\n\nexport const LogContext = React.createContext<{\n selectedLogIndex: number;\n isDisabled: boolean;\n logs: LogBoxLog[];\n} | null>(null);\n\nexport function useLogs(): {\n selectedLogIndex: number;\n isDisabled: boolean;\n logs: LogBoxLog[];\n} {\n const logs = React.useContext(LogContext);\n if (!logs) {\n if (process.env.EXPO_OS === 'web' && typeof window !== 'undefined') {\n // Logbox data that is pre-fetched on the dev server and rendered here.\n const expoCliStaticErrorElement = document.getElementById('_expo-static-error');\n if (expoCliStaticErrorElement?.textContent) {\n const raw = JSON.parse(expoCliStaticErrorElement.textContent);\n return {\n ...raw,\n logs: raw.logs.map((raw: any) => new LogBoxLog(raw)),\n };\n }\n }\n\n throw new Error('useLogs must be used within a LogProvider');\n }\n return logs;\n}\n\nexport function useSelectedLog() {\n const { selectedLogIndex, logs } = useLogs();\n return logs[selectedLogIndex];\n}\n"]}
@@ -10,10 +10,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
10
10
  return (mod && mod.__esModule) ? mod : { "default": mod };
11
11
  };
12
12
  Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.parseInterpolation = parseInterpolation;
14
- exports.parseComponentStack = parseComponentStack;
15
- exports.parseLogBoxException = parseLogBoxException;
16
- exports.parseLogBoxLog = parseLogBoxLog;
13
+ exports.parseLogBoxLog = exports.parseLogBoxException = exports.parseComponentStack = exports.parseInterpolation = void 0;
17
14
  const parseErrorStack_1 = __importDefault(require("../modules/parseErrorStack"));
18
15
  const stringifySafe_1 = __importDefault(require("../modules/stringifySafe"));
19
16
  const BABEL_TRANSFORM_ERROR_FORMAT = /^(?:TransformError )?(?:SyntaxError: |ReferenceError: )(.*): (.*) \((\d+):(\d+)\)\n\n([\s\S]+)/;
@@ -81,6 +78,7 @@ function parseInterpolation(args) {
81
78
  },
82
79
  };
83
80
  }
81
+ exports.parseInterpolation = parseInterpolation;
84
82
  function isComponentStack(consoleArgument) {
85
83
  const isOldComponentStackFormat = / {4}in/.test(consoleArgument);
86
84
  const isNewComponentStackFormat = / {4}at/.test(consoleArgument);
@@ -122,6 +120,7 @@ function parseComponentStack(message) {
122
120
  })
123
121
  .filter(Boolean);
124
122
  }
123
+ exports.parseComponentStack = parseComponentStack;
125
124
  function parseLogBoxException(error) {
126
125
  const message = error.originalMessage != null ? error.originalMessage : 'Unknown';
127
126
  const metroInternalError = message.match(METRO_ERROR_FORMAT);
@@ -183,7 +182,7 @@ function parseLogBoxException(error) {
183
182
  componentStack: [],
184
183
  codeFrame: {
185
184
  fileName,
186
- location: null, // We are not given the location.
185
+ location: null,
187
186
  content: codeFrame,
188
187
  },
189
188
  message: {
@@ -235,6 +234,7 @@ function parseLogBoxException(error) {
235
234
  ...parseLogBoxLog([message]),
236
235
  };
237
236
  }
237
+ exports.parseLogBoxException = parseLogBoxException;
238
238
  function parseLogBoxLog(args) {
239
239
  const message = args[0];
240
240
  let argsWithoutComponentStack = [];
@@ -273,4 +273,5 @@ function parseLogBoxLog(args) {
273
273
  componentStack,
274
274
  };
275
275
  }
276
+ exports.parseLogBoxLog = parseLogBoxLog;
276
277
  //# sourceMappingURL=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AAI,gBAAgB,CAAC,GAAG,CAAC,EAAE,CAAC;gBACrD,qDAAqD;gBACrD,IAAI,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,gBAAgB,CAAC,CAAC;gBACnD,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;oBACxB,+BAA+B;oBAC/B,eAAe,GAAG,GAAG,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC;gBACrC,CAAC;gBACD,IAAI,eAAe,GAAG,CAAC,EAAE,CAAC;oBACxB,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC,EAAE,eAAe,CAAC,CAAC,CAAC;gBAChE,CAAC;gBAED,cAAc,GAAG,mBAAmB,CAAC,GAAG,CAAC,CAAC;YAC5C,CAAC;iBAAM,CAAC;gBACN,yBAAyB,CAAC,IAAI,CAAC,GAAG,CAAC,CAAC;YACtC,CAAC;QACH,CAAC;IACH,CAAC;IAED,OAAO;QACL,GAAG,kBAAkB,CAAC,yBAAyB,CAAC;QAChD,cAAc;KACf,CAAC;AACJ,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 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 = '\\ufeff%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
+ {"version":3,"file":"parseLogBoxLog.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/parseLogBoxLog.tsx"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;AAGH,iFAAyD;AACzD,6EAAqD;AAGrD,MAAM,4BAA4B,GAChC,gGAAgG,CAAC;AACnG,MAAM,6BAA6B,GACjC,sGAAsG,CAAC;AACzG,MAAM,kBAAkB,GACtB,6FAA6F,CAAC;AAgChG,MAAM,YAAY,GAAG,UAAU,CAAC;AAEhC,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,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IAAI,OAAO,OAAO,KAAK,QAAQ,IAAI,gBAAgB,CAAC,OAAO,CAAC,EAAE;YAC5D,yBAAyB,GAAG,IAAI,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YAC9C,yBAAyB,CAAC,CAAC,CAAC,GAAG,OAAO,CAAC,KAAK,CAAC,CAAC,EAAE,CAAC,CAAC,CAAC,CAAC;YACpD,cAAc,GAAG,mBAAmB,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;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 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 = '\\ufeff%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"]}
@@ -23,10 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.LogBoxInspectorContainer = LogBoxInspectorContainer;
27
- exports.LogBoxInspector = LogBoxInspector;
28
- exports.ErrorOverlayBody = ErrorOverlayBody;
29
- exports.ErrorOverlayBodyContents = ErrorOverlayBodyContents;
26
+ exports.ErrorOverlayBodyContents = exports.ErrorOverlayBody = exports.LogBoxInspector = exports.LogBoxInspectorContainer = void 0;
30
27
  /**
31
28
  * Copyright (c) 650 Industries.
32
29
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -60,6 +57,7 @@ function LogBoxInspectorContainer() {
60
57
  }
61
58
  return react_1.default.createElement(LogBoxInspector, { log: log, selectedLogIndex: selectedLogIndex, logs: logs });
62
59
  }
60
+ exports.LogBoxInspectorContainer = LogBoxInspectorContainer;
63
61
  function LogBoxInspector({ log, selectedLogIndex, logs, }) {
64
62
  const onDismiss = (0, react_1.useCallback)(() => {
65
63
  // Here we handle the cases when the log is dismissed and it
@@ -112,10 +110,12 @@ function LogBoxInspector({ log, selectedLogIndex, logs, }) {
112
110
  react_1.default.createElement(ErrorOverlayBody, { onRetry: _handleRetry }),
113
111
  react_1.default.createElement(LogBoxInspectorFooter_1.LogBoxInspectorFooter, { onDismiss: onDismiss, onMinimize: onMinimize })));
114
112
  }
113
+ exports.LogBoxInspector = LogBoxInspector;
115
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
  }
118
+ exports.ErrorOverlayBody = ErrorOverlayBody;
119
119
  function ErrorOverlayBodyContents({ log, onRetry, }) {
120
120
  const [collapsed, setCollapsed] = (0, react_1.useState)(true);
121
121
  (0, react_1.useEffect)(() => {
@@ -137,6 +137,7 @@ function ErrorOverlayBodyContents({ log, onRetry, }) {
137
137
  // eslint-disable-next-line react/jsx-no-bind
138
138
  onRetry: onRetry.bind(onRetry, 'component') })))));
139
139
  }
140
+ exports.ErrorOverlayBodyContents = ErrorOverlayBodyContents;
140
141
  const styles = react_native_1.StyleSheet.create({
141
142
  scrollBody: {
142
143
  backgroundColor: LogBoxStyle.getBackgroundColor(1),
@@ -1 +1 @@
1
- {"version":3,"file":"ErrorOverlay.js","sourceRoot":"","sources":["../../src/error-overlay/ErrorOverlay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;AA6BA,4DAOC;AAED,0CAwEC;AAED,4CAGC;AAED,4DAsDC;AA3KD;;;;;;GAMG;AACH,+CAAgE;AAChE,+CAAsE;AAEtE,8DAAgD;AAEhD,kDAA4D;AAC5D,8DAAgD;AAChD,iFAA8E;AAC9E,2EAA8F;AAC9F,2EAA8F;AAC9F,yFAAsF;AACtF,qFAAkF;AAElF,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,cAAc;IACtB,MAAM,EAAE,kCAAkC;IAC1C,SAAS,EAAE,cAAc;CAC1B,CAAC;AAEF,SAAgB,wBAAwB;IACtC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,IAAA,oBAAO,GAAE,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACnC,IAAI,GAAG,IAAI,IAAI,EAAE,CAAC;QAChB,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,8BAAC,eAAe,IAAC,GAAG,EAAE,GAAG,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,GAAI,CAAC;AACvF,CAAC;AAED,SAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,gBAAgB,EAChB,IAAI,GAKL;IACC,MAAM,SAAS,GAAG,IAAA,mBAAW,EAAC,GAAS,EAAE;QACvC,4DAA4D;QAC5D,qDAAqD;QACrD,8CAA8C;QAC9C,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,C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O,EAAE,OAAO,CAAC,GACvC,CACH;YACA,CAAC,CAAC,GAAG,EAAE,cAAc,EAAE,MAAM,IAAI,CAChC,8BAAC,uDAA0B,IACzB,IAAI,EAAC,WAAW;gBAChB,6CAA6C;gBAC7C,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,GAC3C,CACH,CACU,CACZ,CACJ,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,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,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
+ {"version":3,"file":"ErrorOverlay.js","sourceRoot":"","sources":["../../src/error-overlay/ErrorOverlay.tsx"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAAA;;;;;;GAMG;AACH,+CAAgE;AAChE,+CAAsE;AAEtE,8DAAgD;AAEhD,kDAA4D;AAC5D,8DAAgD;AAChD,iFAA8E;AAC9E,2EAA8F;AAC9F,2EAA8F;AAC9F,yFAAsF;AACtF,qFAAkF;AAElF,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,iBAAiB;IACvB,KAAK,EAAE,eAAe;IACtB,KAAK,EAAE,gBAAgB;IACvB,MAAM,EAAE,cAAc;IACtB,MAAM,EAAE,kCAAkC;IAC1C,SAAS,EAAE,cAAc;CAC1B,CAAC;AAEF,SAAgB,wBAAwB;IACtC,MAAM,EAAE,gBAAgB,EAAE,IAAI,EAAE,GAAG,IAAA,oBAAO,GAAE,CAAC;IAC7C,MAAM,GAAG,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC;IACnC,IAAI,GAAG,IAAI,IAAI,EAAE;QACf,OAAO,IAAI,CAAC;KACb;IACD,OAAO,8BAAC,eAAe,IAAC,GAAG,EAAE,GAAG,EAAE,gBAAgB,EAAE,gBAAgB,EAAE,IAAI,EAAE,IAAI,GAAI,CAAC;AACvF,CAAC;AAPD,4DAOC;AAED,SAAgB,eAAe,CAAC,EAC9B,GAAG,EACH,gBAAgB,EAChB,IAAI,GAKL;IACC,MAAM,SAAS,GAAG,IAAA,mBAAW,EAAC,GAAS,EAAE;QACvC,4DAA4D;QAC5D,qDAAqD;QACrD,8CAA8C;QAC9C,MAAM,SAAS,GAAG,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC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,GAAG,EAAE,cAAc,EAAE,MAAM,IAAI,CAChC,8BAAC,uDAA0B,IACzB,IAAI,EAAC,WAAW;gBAChB,6CAA6C;gBAC7C,OAAO,EAAE,OAAO,CAAC,IAAI,CAAC,OAAO,EAAE,WAAW,CAAC,GAC3C,CACH,CACU,CACZ,CACJ,CAAC;AACJ,CAAC;AAtDD,4DAsDC;AAED,MAAM,MAAM,GAAG,yBAAU,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,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 +1 @@
1
- {"version":3,"file":"LogBox.web.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAOH,IAAI,MAAe,CAAC;AAapB;;GAEG;AACH,IAAI,OAAO,EAAE,CAAC;IACZ,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChD,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAC1C,OAAO,CAAC,uBAAuB,CAA2C,CAAC;IAE7E,IAAI,oBAAsD,CAAC;IAC3D,IAAI,gBAAkD,CAAC;IAEvD,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,MAAM,GAAG;QACP,OAAO;YACL,IAAI,iBAAiB,EAAE,CAAC;gBACtB,OAAO;YACT,CAAC;YAED,iBAAiB,GAAG,IAAI,CAAC;YAEzB,yCAAyC;YACzC,kDAAkD;YAElD,wEAAwE;YACxE,mEAAmE;YACnE,0BAA0B;YAC1B,MAAM,cAAc,GAAG,oBAAoB,IAAI,IAAI,CAAC;YACpD,IAAI,cAAc,EAAE,CAAC;gBACnB,oBAAoB,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEnD,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE;oBAC1B,gBAAgB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC9B,CAAC,CAAC;YACJ,CAAC;YAED,gBAAgB,GAAG,aAAa,CAAC;YAEjC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE,CAAC;gBACpC,UAAU,CAAC,WAAW,CAAC,IAAI,CAAC,CAAC;YAC/B,CAAC;QACH,CAAC;QAED,SAA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AAC;QACvB,MAAM,CAAC,GAAY,IAAS,CAAC;QAC7B,YAAY,CAAC,EAAyB,IAAS,CAAC;KACjD,CAAC;AACJ,CAAC;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 { 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 (process.env.NODE_ENV === 'test') {\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
+ {"version":3,"file":"LogBox.web.js","sourceRoot":"","sources":["../../src/error-overlay/LogBox.web.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;AAOH,IAAI,MAAe,CAAC;AAapB;;GAEG;AACH,IAAI,OAAO,EAAE;IACX,MAAM,UAAU,GAAG,OAAO,CAAC,mBAAmB,CAAC,CAAC;IAChD,MAAM,EAAE,cAAc,EAAE,kBAAkB,EAAE,GAC1C,OAAO,CAAC,uBAAuB,CAA2C,CAAC;IAE7E,IAAI,oBAAsD,CAAC;IAC3D,IAAI,gBAAkD,CAAC;IAEvD,IAAI,iBAAiB,GAAY,KAAK,CAAC;IAEvC,MAAM,GAAG;QACP,OAAO;YACL,IAAI,iBAAiB,EAAE;gBACrB,OAAO;aACR;YAED,iBAAiB,GAAG,IAAI,CAAC;YAEzB,yCAAyC;YACzC,kDAAkD;YAElD,wEAAwE;YACxE,mEAAmE;YACnE,0BAA0B;YAC1B,MAAM,cAAc,GAAG,oBAAoB,IAAI,IAAI,CAAC;YACpD,IAAI,cAAc,EAAE;gBAClB,oBAAoB,GAAG,OAAO,CAAC,KAAK,CAAC,IAAI,CAAC,OAAO,CAAC,CAAC;gBAEnD,OAAO,CAAC,KAAK,GAAG,CAAC,GAAG,IAAI,EAAE,EAAE;oBAC1B,gBAAgB,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;gBAC9B,CAAC,CAAC;aACH;YAED,gBAAgB,GAAG,aAAa,CAAC;YAEjC,IAAI,OAAO,CAAC,GAAG,CAAC,QAAQ,KAAK,MAAM,EAAE;gBACnC,UA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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 { 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 (process.env.NODE_ENV === 'test') {\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"]}
@@ -3,7 +3,7 @@ var __importDefault = (this && this.__importDefault) || function (mod) {
3
3
  return (mod && mod.__esModule) ? mod : { "default": mod };
4
4
  };
5
5
  Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.Ansi = Ansi;
6
+ exports.Ansi = void 0;
7
7
  /**
8
8
  * Copyright (c) 650 Industries.
9
9
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -76,6 +76,7 @@ function Ansi({ text, style }) {
76
76
  return (react_1.default.createElement(react_native_1.Text, { style: [style, textStyle], key: key }, getText(bundle.content, key)));
77
77
  }))))));
78
78
  }
79
+ exports.Ansi = Ansi;
79
80
  const styles = react_native_1.StyleSheet.create({
80
81
  line: {
81
82
  flexDirection: 'row',
@@ -1 +1 @@
1
- {"version":3,"file":"AnsiHighlight.js","sourceRoot":"","sources":["../../../src/error-overlay/UI/AnsiHighlight.tsx"],"names":[],"mappings":";;;;;AAgCA,oBAyDC;AAzFD;;;;;;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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AAsB,CAAC,CAAC;QAChD,CAAC;aAAM,CAAC;YACN,OAAO,OAAO,CAAC;QACjB,CAAC;IACH,CAAC,CAAC;IAEF,OAAO,CACL,8BAAC,mBAAI,QACF,WAAW,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,CAAC,EAAE,EAAE,CAAC,CAC7B,8BAAC,mBAAI,IAAC,KAAK,EAAE,MAAM,CAAC,IAAI,EAAE,GAAG,EAAE,CAAC,IAC7B,KAAK,CAAC,GAAG,CAAC,CAAC,MAAM,EAAE,GAAG,EAAE,EAAE;QACzB,MAAM,SAAS,GACb,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;YAC5B,CAAC,CAAC;gBACE,eAAe,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC/C,KAAK,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;aACtC;YACH,CAAC,CAAC;gBACE,eAAe,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;aAChD,CAAC;QACR,OAAO,CACL,8BAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,IACtC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CACxB,CACR,CAAC;IACJ,CAAC,CAAC,CACG,CACR,CAAC,CACG,CACR,CAAC;AACJ,CAAC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,aAAa,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"]}
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,EAAE,IAAI,EAAE,KAAK,EAAiD;IACjF,IAAI,sBAAsB,GAAG,QAAQ,CAAC;IACtC,MAAM,WAAW,GAAG,IAAI,CAAC,KAAK,CAAC,IAAI,CAAC,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,EAAE,CAChD,eAAK,CAAC,UAAU,CA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CAAC,MAAM,CAAC,EAAE,CAAC;YAC5B,CAAC,CAAC;gBACE,eAAe,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;gBAC/C,KAAK,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;aACtC;YACH,CAAC,CAAC;gBACE,eAAe,EAAE,MAAM,CAAC,EAAE,IAAI,MAAM,CAAC,MAAM,CAAC,EAAE,CAAC;aAChD,CAAC;QACR,OAAO,CACL,8BAAC,mBAAI,IAAC,KAAK,EAAE,CAAC,KAAK,EAAE,SAAS,CAAC,EAAE,GAAG,EAAE,GAAG,IACtC,OAAO,CAAC,MAAM,CAAC,OAAO,EAAE,GAAG,CAAC,CACxB,CACR,CAAC;IACJ,CAAC,CAAC,CACG,CACR,CAAC,CACG,CACR,CAAC;AACJ,CAAC;AAzDD,oBAyDC;AAED,MAAM,MAAM,GAAG,yBAAU,CAAC,MAAM,CAAC;IAC/B,IAAI,EAAE;QACJ,aAAa,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"]}
@@ -23,7 +23,7 @@ var __importStar = (this && this.__importStar) || function (mod) {
23
23
  return result;
24
24
  };
25
25
  Object.defineProperty(exports, "__esModule", { value: true });
26
- exports.LogBoxButton = LogBoxButton;
26
+ exports.LogBoxButton = void 0;
27
27
  /**
28
28
  * Copyright (c) 650 Industries.
29
29
  * Copyright (c) Meta Platforms, Inc. and affiliates.
@@ -56,4 +56,5 @@ function LogBoxButton(props) {
56
56
  ] }, props.children));
57
57
  return props.onPress == null ? (content) : (react_1.default.createElement(react_native_1.Pressable, { hitSlop: props.hitSlop, onPress: props.onPress, onPressIn: () => setPressed(true), onPressOut: () => setPressed(false) }, content));
58
58
  }
59
+ exports.LogBoxButton = LogBoxButton;
59
60
  //# sourceMappingURL=LogBoxButton.js.map