@expo/metro-runtime 2.2.4 → 3.0.0

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 (222) hide show
  1. package/README.md +17 -1
  2. package/async-require.d.ts +1 -1
  3. package/async-require.js +1 -1
  4. package/build/HMRClient.d.ts +1 -1
  5. package/build/HMRClient.d.ts.map +1 -1
  6. package/build/HMRClient.js +40 -68
  7. package/build/HMRClient.js.map +1 -1
  8. package/build/HMRClient.native.js +2 -4
  9. package/build/HMRClient.native.js.map +1 -1
  10. package/build/LoadingView.d.ts +1 -1
  11. package/build/LoadingView.d.ts.map +1 -1
  12. package/build/LoadingView.js +4 -10
  13. package/build/LoadingView.js.map +1 -1
  14. package/build/LoadingView.native.d.ts +2 -0
  15. package/build/LoadingView.native.d.ts.map +1 -1
  16. package/build/LoadingView.native.js +2 -2
  17. package/build/LoadingView.native.js.map +1 -1
  18. package/build/async-require/buildAsyncRequire.js +3 -7
  19. package/build/async-require/buildAsyncRequire.js.map +1 -1
  20. package/build/async-require/buildUrlForBundle.js +2 -6
  21. package/build/async-require/buildUrlForBundle.js.map +1 -1
  22. package/build/async-require/buildUrlForBundle.native.js +6 -9
  23. package/build/async-require/buildUrlForBundle.native.js.map +1 -1
  24. package/build/async-require/fetchAsync.d.ts.map +1 -1
  25. package/build/async-require/fetchAsync.js +4 -8
  26. package/build/async-require/fetchAsync.js.map +1 -1
  27. package/build/async-require/fetchAsync.native.d.ts +1 -1
  28. package/build/async-require/fetchAsync.native.d.ts.map +1 -1
  29. package/build/async-require/fetchAsync.native.js +14 -21
  30. package/build/async-require/fetchAsync.native.js.map +1 -1
  31. package/build/async-require/fetchThenEval.d.ts.map +1 -1
  32. package/build/async-require/fetchThenEval.js +5 -10
  33. package/build/async-require/fetchThenEval.js.map +1 -1
  34. package/build/async-require/fetchThenEval.web.d.ts.map +1 -1
  35. package/build/async-require/fetchThenEval.web.js +14 -27
  36. package/build/async-require/fetchThenEval.web.js.map +1 -1
  37. package/build/async-require/index.js +2 -6
  38. package/build/async-require/index.js.map +1 -1
  39. package/build/async-require/loadBundle.d.ts.map +1 -1
  40. package/build/async-require/loadBundle.js +14 -18
  41. package/build/async-require/loadBundle.js.map +1 -1
  42. package/build/effects.js +5 -7
  43. package/build/effects.js.map +1 -1
  44. package/build/effects.native.js +0 -1
  45. package/build/error-overlay/Data/LogBoxData.d.ts +5 -5
  46. package/build/error-overlay/Data/LogBoxData.d.ts.map +1 -1
  47. package/build/error-overlay/Data/LogBoxData.js +76 -127
  48. package/build/error-overlay/Data/LogBoxData.js.map +1 -1
  49. package/build/error-overlay/Data/LogBoxLog.d.ts +10 -10
  50. package/build/error-overlay/Data/LogBoxLog.d.ts.map +1 -1
  51. package/build/error-overlay/Data/LogBoxLog.js +46 -69
  52. package/build/error-overlay/Data/LogBoxLog.js.map +1 -1
  53. package/build/error-overlay/Data/LogBoxSymbolication.d.ts +2 -2
  54. package/build/error-overlay/Data/LogBoxSymbolication.js +9 -17
  55. package/build/error-overlay/Data/LogBoxSymbolication.js.map +1 -1
  56. package/build/error-overlay/Data/LogContext.d.ts +2 -2
  57. package/build/error-overlay/Data/LogContext.d.ts.map +1 -1
  58. package/build/error-overlay/Data/LogContext.js +12 -20
  59. package/build/error-overlay/Data/LogContext.js.map +1 -1
  60. package/build/error-overlay/Data/parseLogBoxLog.d.ts +2 -2
  61. package/build/error-overlay/Data/parseLogBoxLog.d.ts.map +1 -1
  62. package/build/error-overlay/Data/parseLogBoxLog.js +35 -50
  63. package/build/error-overlay/Data/parseLogBoxLog.js.map +1 -1
  64. package/build/error-overlay/ErrorOverlay.d.ts +10 -3
  65. package/build/error-overlay/ErrorOverlay.d.ts.map +1 -1
  66. package/build/error-overlay/ErrorOverlay.js +55 -86
  67. package/build/error-overlay/ErrorOverlay.js.map +1 -1
  68. package/build/error-overlay/LogBox.d.ts +2 -2
  69. package/build/error-overlay/LogBox.d.ts.map +1 -1
  70. package/build/error-overlay/LogBox.js +1 -4
  71. package/build/error-overlay/LogBox.js.map +1 -1
  72. package/build/error-overlay/LogBox.web.d.ts +3 -3
  73. package/build/error-overlay/LogBox.web.d.ts.map +1 -1
  74. package/build/error-overlay/LogBox.web.js +12 -17
  75. package/build/error-overlay/LogBox.web.js.map +1 -1
  76. package/build/error-overlay/UI/AnsiHighlight.d.ts +2 -2
  77. package/build/error-overlay/UI/AnsiHighlight.d.ts.map +1 -1
  78. package/build/error-overlay/UI/AnsiHighlight.js +28 -36
  79. package/build/error-overlay/UI/AnsiHighlight.js.map +1 -1
  80. package/build/error-overlay/UI/LogBoxButton.d.ts +1 -1
  81. package/build/error-overlay/UI/LogBoxButton.d.ts.map +1 -1
  82. package/build/error-overlay/UI/LogBoxButton.js +11 -40
  83. package/build/error-overlay/UI/LogBoxButton.js.map +1 -1
  84. package/build/error-overlay/UI/LogBoxMessage.d.ts +2 -2
  85. package/build/error-overlay/UI/LogBoxMessage.d.ts.map +1 -1
  86. package/build/error-overlay/UI/LogBoxMessage.js +10 -17
  87. package/build/error-overlay/UI/LogBoxMessage.js.map +1 -1
  88. package/build/error-overlay/UI/LogBoxStyle.d.ts +1 -1
  89. package/build/error-overlay/UI/LogBoxStyle.js +15 -32
  90. package/build/error-overlay/UI/LogBoxStyle.js.map +1 -1
  91. package/build/error-overlay/UI/constants.js +5 -8
  92. package/build/error-overlay/UI/constants.js.map +1 -1
  93. package/build/error-overlay/formatProjectFilePath.d.ts +1 -1
  94. package/build/error-overlay/formatProjectFilePath.d.ts.map +1 -1
  95. package/build/error-overlay/formatProjectFilePath.js +7 -14
  96. package/build/error-overlay/formatProjectFilePath.js.map +1 -1
  97. package/build/error-overlay/index.d.ts +1 -1
  98. package/build/error-overlay/index.d.ts.map +1 -1
  99. package/build/error-overlay/index.js +9 -17
  100. package/build/error-overlay/index.js.map +1 -1
  101. package/build/error-overlay/modules/ExceptionsManager/index.d.ts +1 -1
  102. package/build/error-overlay/modules/ExceptionsManager/index.d.ts.map +1 -1
  103. package/build/error-overlay/modules/ExceptionsManager/index.js +11 -21
  104. package/build/error-overlay/modules/ExceptionsManager/index.js.map +1 -1
  105. package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts +2 -1
  106. package/build/error-overlay/modules/ExceptionsManager/index.native.d.ts.map +1 -1
  107. package/build/error-overlay/modules/ExceptionsManager/index.native.js +3 -3
  108. package/build/error-overlay/modules/ExceptionsManager/index.native.js.map +1 -1
  109. package/build/error-overlay/modules/NativeLogBox/index.d.ts.map +1 -1
  110. package/build/error-overlay/modules/NativeLogBox/index.js +10 -15
  111. package/build/error-overlay/modules/NativeLogBox/index.js.map +1 -1
  112. package/build/error-overlay/modules/NativeLogBox/index.native.d.ts +1 -1
  113. package/build/error-overlay/modules/NativeLogBox/index.native.d.ts.map +1 -1
  114. package/build/error-overlay/modules/NativeLogBox/index.native.js +2 -8
  115. package/build/error-overlay/modules/NativeLogBox/index.native.js.map +1 -1
  116. package/build/error-overlay/modules/openFileInEditor/index.js +5 -7
  117. package/build/error-overlay/modules/openFileInEditor/index.js.map +1 -1
  118. package/build/error-overlay/modules/openFileInEditor/index.native.d.ts +1 -1
  119. package/build/error-overlay/modules/openFileInEditor/index.native.d.ts.map +1 -1
  120. package/build/error-overlay/modules/openFileInEditor/index.native.js +2 -8
  121. package/build/error-overlay/modules/openFileInEditor/index.native.js.map +1 -1
  122. package/build/error-overlay/modules/parseErrorStack/index.d.ts +1 -1
  123. package/build/error-overlay/modules/parseErrorStack/index.d.ts.map +1 -1
  124. package/build/error-overlay/modules/parseErrorStack/index.js +4 -7
  125. package/build/error-overlay/modules/parseErrorStack/index.js.map +1 -1
  126. package/build/error-overlay/modules/parseErrorStack/parseHermesStack.d.ts +1 -1
  127. package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js +2 -8
  128. package/build/error-overlay/modules/parseErrorStack/parseHermesStack.js.map +1 -1
  129. package/build/error-overlay/modules/stringifySafe/index.d.ts +1 -1
  130. package/build/error-overlay/modules/stringifySafe/index.d.ts.map +1 -1
  131. package/build/error-overlay/modules/stringifySafe/index.js +16 -22
  132. package/build/error-overlay/modules/stringifySafe/index.js.map +1 -1
  133. package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts +2 -2
  134. package/build/error-overlay/modules/symbolicateStackTrace/index.d.ts.map +1 -1
  135. package/build/error-overlay/modules/symbolicateStackTrace/index.js +6 -8
  136. package/build/error-overlay/modules/symbolicateStackTrace/index.js.map +1 -1
  137. package/build/error-overlay/modules/symbolicateStackTrace/index.native.d.ts +1 -1
  138. package/build/error-overlay/modules/symbolicateStackTrace/index.native.js +2 -7
  139. package/build/error-overlay/modules/symbolicateStackTrace/index.native.js.map +1 -1
  140. package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts +2 -2
  141. package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.d.ts.map +1 -1
  142. package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js +28 -59
  143. package/build/error-overlay/overlay/LogBoxInspectorCodeFrame.js.map +1 -1
  144. package/build/error-overlay/overlay/LogBoxInspectorFooter.d.ts.map +1 -1
  145. package/build/error-overlay/overlay/LogBoxInspectorFooter.js +34 -61
  146. package/build/error-overlay/overlay/LogBoxInspectorFooter.js.map +1 -1
  147. package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts +1 -1
  148. package/build/error-overlay/overlay/LogBoxInspectorHeader.d.ts.map +1 -1
  149. package/build/error-overlay/overlay/LogBoxInspectorHeader.js +36 -66
  150. package/build/error-overlay/overlay/LogBoxInspectorHeader.js.map +1 -1
  151. package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts +2 -2
  152. package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.d.ts.map +1 -1
  153. package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js +19 -49
  154. package/build/error-overlay/overlay/LogBoxInspectorMessageHeader.js.map +1 -1
  155. package/build/error-overlay/overlay/LogBoxInspectorSection.d.ts +2 -2
  156. package/build/error-overlay/overlay/LogBoxInspectorSection.js +13 -43
  157. package/build/error-overlay/overlay/LogBoxInspectorSection.js.map +1 -1
  158. package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts +2 -2
  159. package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.d.ts.map +1 -1
  160. package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js +26 -53
  161. package/build/error-overlay/overlay/LogBoxInspectorSourceMapStatus.js.map +1 -1
  162. package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts +2 -2
  163. package/build/error-overlay/overlay/LogBoxInspectorStackFrame.d.ts.map +1 -1
  164. package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js +23 -53
  165. package/build/error-overlay/overlay/LogBoxInspectorStackFrame.js.map +1 -1
  166. package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts +2 -2
  167. package/build/error-overlay/overlay/LogBoxInspectorStackFrames.d.ts.map +1 -1
  168. package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js +42 -76
  169. package/build/error-overlay/overlay/LogBoxInspectorStackFrames.js.map +1 -1
  170. package/build/error-overlay/toast/ErrorToast.d.ts +2 -2
  171. package/build/error-overlay/toast/ErrorToast.d.ts.map +1 -1
  172. package/build/error-overlay/toast/ErrorToast.js +43 -69
  173. package/build/error-overlay/toast/ErrorToast.js.map +1 -1
  174. package/build/error-overlay/toast/ErrorToastContainer.d.ts +1 -1
  175. package/build/error-overlay/toast/ErrorToastContainer.js +3 -9
  176. package/build/error-overlay/toast/ErrorToastContainer.js.map +1 -1
  177. package/build/error-overlay/toast/ErrorToastContainer.web.d.ts +2 -2
  178. package/build/error-overlay/toast/ErrorToastContainer.web.d.ts.map +1 -1
  179. package/build/error-overlay/toast/ErrorToastContainer.web.js +22 -49
  180. package/build/error-overlay/toast/ErrorToastContainer.web.js.map +1 -1
  181. package/build/error-overlay/toast/ErrorToastMessage.d.ts +1 -1
  182. package/build/error-overlay/toast/ErrorToastMessage.d.ts.map +1 -1
  183. package/build/error-overlay/toast/ErrorToastMessage.js +8 -38
  184. package/build/error-overlay/toast/ErrorToastMessage.js.map +1 -1
  185. package/build/error-overlay/useRejectionHandler.d.ts +1 -1
  186. package/build/error-overlay/useRejectionHandler.d.ts.map +1 -1
  187. package/build/error-overlay/useRejectionHandler.js +20 -28
  188. package/build/error-overlay/useRejectionHandler.js.map +1 -1
  189. package/build/getDevServer.d.ts.map +1 -1
  190. package/build/getDevServer.js +10 -16
  191. package/build/getDevServer.js.map +1 -1
  192. package/build/getDevServer.native.d.ts +2 -0
  193. package/build/getDevServer.native.d.ts.map +1 -1
  194. package/build/getDevServer.native.js +2 -2
  195. package/build/getDevServer.native.js.map +1 -1
  196. package/build/index.d.ts +2 -2
  197. package/build/index.js +4 -6
  198. package/build/index.js.map +1 -1
  199. package/build/location/Location.js +2 -7
  200. package/build/location/Location.js.map +1 -1
  201. package/build/location/Location.native.d.ts.map +1 -1
  202. package/build/location/Location.native.js +25 -32
  203. package/build/location/Location.native.js.map +1 -1
  204. package/build/location/install.js +0 -1
  205. package/build/location/install.native.d.ts +1 -1
  206. package/build/location/install.native.js +23 -34
  207. package/build/location/install.native.js.map +1 -1
  208. package/build/messageSocket.d.ts.map +1 -1
  209. package/build/messageSocket.js +5 -6
  210. package/build/messageSocket.js.map +1 -1
  211. package/build/setupFastRefresh.d.ts.map +1 -1
  212. package/build/setupFastRefresh.js +2 -4
  213. package/build/setupFastRefresh.js.map +1 -1
  214. package/build/setupHMR.js +5 -12
  215. package/build/setupHMR.js.map +1 -1
  216. package/build/symbolicate.d.ts +3 -3
  217. package/build/symbolicate.js +4 -25
  218. package/build/symbolicate.js.map +1 -1
  219. package/error-overlay.d.ts +1 -1
  220. package/error-overlay.js +1 -1
  221. package/package.json +25 -14
  222. package/LICENSE +0 -13
@@ -1,68 +1,46 @@
1
- "use strict";
2
1
  /**
3
- * Copyright (c) Evan Bacon.
2
+ * Copyright (c) 650 Industries.
4
3
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
4
  *
6
5
  * This source code is licensed under the MIT license found in the
7
6
  * LICENSE file in the root directory of this source tree.
8
7
  */
9
- var __createBinding = (this && this.__createBinding) || (Object.create ? (function(o, m, k, k2) {
10
- if (k2 === undefined) k2 = k;
11
- var desc = Object.getOwnPropertyDescriptor(m, k);
12
- if (!desc || ("get" in desc ? !m.__esModule : desc.writable || desc.configurable)) {
13
- desc = { enumerable: true, get: function() { return m[k]; } };
14
- }
15
- Object.defineProperty(o, k2, desc);
16
- }) : (function(o, m, k, k2) {
17
- if (k2 === undefined) k2 = k;
18
- o[k2] = m[k];
19
- }));
20
- var __setModuleDefault = (this && this.__setModuleDefault) || (Object.create ? (function(o, v) {
21
- Object.defineProperty(o, "default", { enumerable: true, value: v });
22
- }) : function(o, v) {
23
- o["default"] = v;
24
- });
25
- var __importStar = (this && this.__importStar) || function (mod) {
26
- if (mod && mod.__esModule) return mod;
27
- var result = {};
28
- if (mod != null) for (var k in mod) if (k !== "default" && Object.prototype.hasOwnProperty.call(mod, k)) __createBinding(result, mod, k);
29
- __setModuleDefault(result, mod);
30
- return result;
31
- };
32
- Object.defineProperty(exports, "__esModule", { value: true });
33
- exports.LogBoxLog = void 0;
34
- const LogBoxSymbolication = __importStar(require("./LogBoxSymbolication"));
8
+ import * as LogBoxSymbolication from './LogBoxSymbolication';
35
9
  function componentStackToStack(componentStack) {
36
- return componentStack.map((stack) => {
37
- var _a, _b, _c, _d;
38
- return ({
39
- file: stack.fileName,
40
- methodName: stack.content,
41
- lineNumber: (_b = (_a = stack.location) === null || _a === void 0 ? void 0 : _a.row) !== null && _b !== void 0 ? _b : 0,
42
- column: (_d = (_c = stack.location) === null || _c === void 0 ? void 0 : _c.column) !== null && _d !== void 0 ? _d : 0,
43
- arguments: [],
44
- });
45
- });
10
+ return componentStack.map((stack) => ({
11
+ file: stack.fileName,
12
+ methodName: stack.content,
13
+ lineNumber: stack.location?.row ?? 0,
14
+ column: stack.location?.column ?? 0,
15
+ arguments: [],
16
+ }));
46
17
  }
47
- class LogBoxLog {
18
+ export class LogBoxLog {
19
+ message;
20
+ type;
21
+ category;
22
+ componentStack;
23
+ stack;
24
+ count;
25
+ level;
26
+ codeFrame;
27
+ isComponentError;
28
+ symbolicated = {
29
+ stack: {
30
+ error: null,
31
+ stack: null,
32
+ status: 'NONE',
33
+ },
34
+ component: {
35
+ error: null,
36
+ stack: null,
37
+ status: 'NONE',
38
+ },
39
+ };
40
+ callbacks = new Map();
48
41
  constructor(data) {
49
- var _a, _b;
50
- this.symbolicated = {
51
- stack: {
52
- error: null,
53
- stack: null,
54
- status: "NONE",
55
- },
56
- component: {
57
- error: null,
58
- stack: null,
59
- status: "NONE",
60
- },
61
- };
62
- this.callbacks = new Map();
63
- this.componentStackCache = null;
64
42
  this.level = data.level;
65
- this.type = (_a = data.type) !== null && _a !== void 0 ? _a : "error";
43
+ this.type = data.type ?? 'error';
66
44
  this.message = data.message;
67
45
  this.stack = data.stack;
68
46
  this.category = data.category;
@@ -70,13 +48,13 @@ class LogBoxLog {
70
48
  this.codeFrame = data.codeFrame;
71
49
  this.isComponentError = data.isComponentError;
72
50
  this.count = 1;
73
- this.symbolicated = (_b = data.symbolicated) !== null && _b !== void 0 ? _b : this.symbolicated;
51
+ this.symbolicated = data.symbolicated ?? this.symbolicated;
74
52
  }
75
53
  incrementCount() {
76
54
  this.count += 1;
77
55
  }
78
56
  getAvailableStack(type) {
79
- if (this.symbolicated[type].status === "COMPLETE") {
57
+ if (this.symbolicated[type].status === 'COMPLETE') {
80
58
  return this.symbolicated[type].stack;
81
59
  }
82
60
  return this.getStack(type);
@@ -110,7 +88,7 @@ class LogBoxLog {
110
88
  this.pushCallback(type, callback);
111
89
  }
112
90
  const status = this.symbolicated[type].status;
113
- if (status === "COMPLETE") {
91
+ if (status === 'COMPLETE') {
114
92
  return this.flushCallbacks(type);
115
93
  }
116
94
  if (retry) {
@@ -118,13 +96,14 @@ class LogBoxLog {
118
96
  this.handleSymbolicate(type);
119
97
  }
120
98
  else {
121
- if (status === "NONE") {
99
+ if (status === 'NONE') {
122
100
  this.handleSymbolicate(type);
123
101
  }
124
102
  }
125
103
  }
104
+ componentStackCache = null;
126
105
  getStack(type) {
127
- if (type === "component") {
106
+ if (type === 'component') {
128
107
  if (this.componentStackCache == null) {
129
108
  this.componentStackCache = componentStackToStack(this.componentStack);
130
109
  }
@@ -133,14 +112,13 @@ class LogBoxLog {
133
112
  return this.stack;
134
113
  }
135
114
  handleSymbolicate(type) {
136
- var _a;
137
- if (type === "component" && !((_a = this.componentStack) === null || _a === void 0 ? void 0 : _a.length)) {
115
+ if (type === 'component' && !this.componentStack?.length) {
138
116
  return;
139
117
  }
140
- if (this.symbolicated[type].status !== "PENDING") {
118
+ if (this.symbolicated[type].status !== 'PENDING') {
141
119
  this.updateStatus(type, null, null, null);
142
120
  LogBoxSymbolication.symbolicate(this.getStack(type)).then((data) => {
143
- this.updateStatus(type, null, data === null || data === void 0 ? void 0 : data.stack, data === null || data === void 0 ? void 0 : data.codeFrame);
121
+ this.updateStatus(type, null, data?.stack, data?.codeFrame);
144
122
  }, (error) => {
145
123
  this.updateStatus(type, error, null, null);
146
124
  });
@@ -152,7 +130,7 @@ class LogBoxLog {
152
130
  this.symbolicated[type] = {
153
131
  error,
154
132
  stack: null,
155
- status: "FAILED",
133
+ status: 'FAILED',
156
134
  };
157
135
  }
158
136
  else if (stack != null) {
@@ -162,23 +140,22 @@ class LogBoxLog {
162
140
  this.symbolicated[type] = {
163
141
  error: null,
164
142
  stack,
165
- status: "COMPLETE",
143
+ status: 'COMPLETE',
166
144
  };
167
145
  }
168
146
  else {
169
147
  this.symbolicated[type] = {
170
148
  error: null,
171
149
  stack: null,
172
- status: "PENDING",
150
+ status: 'PENDING',
173
151
  };
174
152
  }
175
153
  const status = this.symbolicated[type].status;
176
154
  if (lastStatus !== status) {
177
- if (["COMPLETE", "FAILED"].includes(status)) {
155
+ if (['COMPLETE', 'FAILED'].includes(status)) {
178
156
  this.flushCallbacks(type);
179
157
  }
180
158
  }
181
159
  }
182
160
  }
183
- exports.LogBoxLog = LogBoxLog;
184
161
  //# sourceMappingURL=LogBoxLog.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogBoxLog.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogBoxLog.ts"],"names":[],"mappings":";AAAA;;;;;;GAMG;;;;;;;;;;;;;;;;;;;;;;;;;;AAEH,2EAA6D;AA0B7D,SAAS,qBAAqB,CAAC,cAA8B;IAC3D,OAAO,cAAc,CAAC,GAAG,CAAC,CAAC,KAAK,EAAE,EAAE;;QAAC,OAAA,CAAC;YACpC,IAAI,EAAE,KAAK,CAAC,QAAQ;YACpB,UAAU,EAAE,KAAK,CAAC,OAAO;YACzB,UAAU,EAAE,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,GAAG,mCAAI,CAAC;YACpC,MAAM,EAAE,MAAA,MAAA,KAAK,CAAC,QAAQ,0CAAE,MAAM,mCAAI,CAAC;YACnC,SAAS,EAAE,EAAE;SACd,CAAC,CAAA;KAAA,CAAC,CAAC;AACN,CAAC;AAUD,MAAa,SAAS;IAyBpB,YACE,IAEC;;QAlBH,iBAAY,GAA2C;YACrD,KAAK,EAAE;gBACL,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,MAAM;aACf;YACD,SAAS,EAAE;gBACT,KAAK,EAAE,IAAI;gBACX,KAAK,EAAE,IAAI;gBACX,MAAM,EAAE,MAAM;aACf;SACF,CAAC;QAEM,cAAS,GAA+C,IAAI,GAAG,EAAE,CAAC;QAwFlE,wBAAmB,GAAiB,IAAI,CAAC;QAjF/C,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,CAAC;QACxB,IAAI,CAAC,IAAI,GAAG,MAAA,IAAI,CAAC,IAAI,mCAAI,OAAO,CAAC;QACjC,IAAI,CAAC,OAAO,GAAG,IAAI,CAAC,OAAO,CAAC;QAC5B,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK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ACxB,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;AAnLD,8BAmLC","sourcesContent":["/**\n * Copyright (c) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\nimport * as LogBoxSymbolication from \"./LogBoxSymbolication\";\nimport type { Stack } from \"./LogBoxSymbolication\";\nimport type {\n Category,\n Message,\n ComponentStack,\n CodeFrame,\n} 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(\n type: StackType,\n callback?: (status: SymbolicationStatus) => void\n ): void {\n this._symbolicate(type, true, callback);\n }\n\n symbolicate(\n type: StackType,\n callback?: (status: SymbolicationStatus) => void\n ): 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,OAAO,KAAK,mBAAmB,MAAM,uBAAuB,C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,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","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,11 +1,11 @@
1
1
  /**
2
- * Copyright (c) Evan Bacon.
2
+ * Copyright (c) 650 Industries.
3
3
  * Copyright (c) Meta Platforms, Inc. and affiliates.
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
- import { StackFrame as UpstreamStackFrame } from "stacktrace-parser";
8
+ import { StackFrame as UpstreamStackFrame } from 'stacktrace-parser';
9
9
  type SymbolicatedStackTrace = any;
10
10
  type StackFrame = UpstreamStackFrame & {
11
11
  collapse?: boolean;
@@ -1,31 +1,25 @@
1
- "use strict";
2
1
  /**
3
- * Copyright (c) Evan Bacon.
2
+ * Copyright (c) 650 Industries.
4
3
  * Copyright (c) Meta Platforms, Inc. and affiliates.
5
4
  *
6
5
  * This source code is licensed under the MIT license found in the
7
6
  * LICENSE file in the root directory of this source tree.
8
7
  */
9
- var __importDefault = (this && this.__importDefault) || function (mod) {
10
- return (mod && mod.__esModule) ? mod : { "default": mod };
11
- };
12
- Object.defineProperty(exports, "__esModule", { value: true });
13
- exports.symbolicate = exports.deleteStack = void 0;
14
- const symbolicateStackTrace_1 = __importDefault(require("../modules/symbolicateStackTrace"));
8
+ import symbolicateStackTrace from '../modules/symbolicateStackTrace';
15
9
  const cache = new Map();
16
10
  /**
17
11
  * Sanitize because sometimes, `symbolicateStackTrace` gives us invalid values.
18
12
  */
19
13
  const sanitize = ({ stack: maybeStack, codeFrame, }) => {
20
14
  if (!Array.isArray(maybeStack)) {
21
- throw new Error("Expected stack to be an array.");
15
+ throw new Error('Expected stack to be an array.');
22
16
  }
23
17
  const stack = [];
24
18
  for (const maybeFrame of maybeStack) {
25
19
  let collapse = false;
26
- if ("collapse" in maybeFrame) {
27
- if (typeof maybeFrame.collapse !== "boolean") {
28
- throw new Error("Expected stack frame `collapse` to be a boolean.");
20
+ if ('collapse' in maybeFrame) {
21
+ if (typeof maybeFrame.collapse !== 'boolean') {
22
+ throw new Error('Expected stack frame `collapse` to be a boolean.');
29
23
  }
30
24
  collapse = maybeFrame.collapse;
31
25
  }
@@ -40,17 +34,15 @@ const sanitize = ({ stack: maybeStack, codeFrame, }) => {
40
34
  }
41
35
  return { stack, codeFrame };
42
36
  };
43
- function deleteStack(stack) {
37
+ export function deleteStack(stack) {
44
38
  cache.delete(stack);
45
39
  }
46
- exports.deleteStack = deleteStack;
47
- function symbolicate(stack) {
40
+ export function symbolicate(stack) {
48
41
  let promise = cache.get(stack);
49
42
  if (promise == null) {
50
- promise = (0, symbolicateStackTrace_1.default)(stack).then(sanitize);
43
+ promise = symbolicateStackTrace(stack).then(sanitize);
51
44
  cache.set(stack, promise);
52
45
  }
53
46
  return promise;
54
47
  }
55
- exports.symbolicate = symbolicate;
56
48
  //# sourceMappingURL=LogBoxSymbolication.js.map
@@ -1 +1 @@
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) Evan Bacon.\n * Copyright (c) Meta Platforms, Inc. and affiliates.\n *\n * This source code is licensed under the MIT license found in the\n * LICENSE file in the root directory of this source tree.\n */\n\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,OAAO,qBAAqB,MAAM,kCAAkC,CAAC;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,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,KAAK,CAAC,MAAM,CAAC,KAAK,CAAC,CAAC;AACtB,CAAC;AAED,MAAM,UAAU,WAAW,CAAC,KAAY;IACtC,IAAI,OAAO,GAAG,KAAK,CAAC,GAAG,CAAC,KAAK,CAAC,CAAC;IAC/B,IAAI,OAAO,IAAI,IAAI,EAAE;QACnB,OAAO,GAAG,qBAAqB,CAAC,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","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,5 +1,5 @@
1
- import React from "react";
2
- import { LogBoxLog } from "./LogBoxLog";
1
+ import React from 'react';
2
+ import { LogBoxLog } from './LogBoxLog';
3
3
  export declare const LogContext: React.Context<{
4
4
  selectedLogIndex: number;
5
5
  isDisabled: boolean;
@@ -1 +1 @@
1
- {"version":3,"file":"LogContext.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,eAAO,MAAM,UAAU;sBACH,MAAM;gBACZ,OAAO;UACb,SAAS,EAAE;SACJ,CAAC;AAEhB,wBAAgB,OAAO,IAAI;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB,CAmBA;AAED,wBAAgB,cAAc,cAG7B"}
1
+ {"version":3,"file":"LogContext.d.ts","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":"AAAA,OAAO,KAAK,MAAM,OAAO,CAAC;AAG1B,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAIxC,eAAO,MAAM,UAAU;sBACH,MAAM;gBACZ,OAAO;UACb,SAAS,EAAE;SACJ,CAAC;AAEhB,wBAAgB,OAAO,IAAI;IACzB,gBAAgB,EAAE,MAAM,CAAC;IACzB,UAAU,EAAE,OAAO,CAAC;IACpB,IAAI,EAAE,SAAS,EAAE,CAAC;CACnB,CAkBA;AAED,wBAAgB,cAAc,cAG7B"}
@@ -1,36 +1,28 @@
1
- "use strict";
2
- var __importDefault = (this && this.__importDefault) || function (mod) {
3
- return (mod && mod.__esModule) ? mod : { "default": mod };
4
- };
5
- Object.defineProperty(exports, "__esModule", { value: true });
6
- exports.useSelectedLog = exports.useLogs = exports.LogContext = void 0;
7
- const react_1 = __importDefault(require("react"));
8
- const react_native_1 = require("react-native");
9
- const LogBoxLog_1 = require("./LogBoxLog");
1
+ import React from 'react';
2
+ import { Platform } from 'react-native';
3
+ import { LogBoxLog } from './LogBoxLog';
10
4
  // Context provider for Array<LogBoxLog>
11
- exports.LogContext = react_1.default.createContext(null);
12
- function useLogs() {
13
- const logs = react_1.default.useContext(exports.LogContext);
5
+ export const LogContext = React.createContext(null);
6
+ export function useLogs() {
7
+ const logs = React.useContext(LogContext);
14
8
  if (!logs) {
15
- if (react_native_1.Platform.OS === "web" && typeof window !== "undefined") {
9
+ if (Platform.OS === 'web' && typeof window !== 'undefined') {
16
10
  // Logbox data that is pre-fetched on the dev server and rendered here.
17
- const expoCliStaticErrorElement = document.getElementById("_expo-static-error");
18
- if (expoCliStaticErrorElement === null || expoCliStaticErrorElement === void 0 ? void 0 : expoCliStaticErrorElement.textContent) {
11
+ const expoCliStaticErrorElement = document.getElementById('_expo-static-error');
12
+ if (expoCliStaticErrorElement?.textContent) {
19
13
  const raw = JSON.parse(expoCliStaticErrorElement.textContent);
20
14
  return {
21
15
  ...raw,
22
- logs: raw.logs.map((raw) => new LogBoxLog_1.LogBoxLog(raw)),
16
+ logs: raw.logs.map((raw) => new LogBoxLog(raw)),
23
17
  };
24
18
  }
25
19
  }
26
- throw new Error("useLogs must be used within a LogProvider");
20
+ throw new Error('useLogs must be used within a LogProvider');
27
21
  }
28
22
  return logs;
29
23
  }
30
- exports.useLogs = useLogs;
31
- function useSelectedLog() {
24
+ export function useSelectedLog() {
32
25
  const { selectedLogIndex, logs } = useLogs();
33
26
  return logs[selectedLogIndex];
34
27
  }
35
- exports.useSelectedLog = useSelectedLog;
36
28
  //# sourceMappingURL=LogContext.js.map
@@ -1 +1 @@
1
- {"version":3,"file":"LogContext.js","sourceRoot":"","sources":["../../../src/error-overlay/Data/LogContext.tsx"],"names":[],"mappings":";;;;;;AAAA,kDAA0B;AAC1B,+CAAwC;AAExC,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,uBAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YAC1D,uEAAuE;YACvE,MAAM,yBAAyB,GAC7B,QAAQ,CAAC,cAAc,CAAC,oBAAoB,CAAC,CAAC;YAChD,IAAI,yBAAyB,aAAzB,yBAAyB,uBAAzB,yBAAyB,CAAE,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;AAvBD,0BAuBC;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\";\nimport { Platform } from \"react-native\";\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 (Platform.OS === \"web\" && typeof window !== \"undefined\") {\n // Logbox data that is pre-fetched on the dev server and rendered here.\n const expoCliStaticErrorElement =\n 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,OAAO,KAAK,MAAM,OAAO,CAAC;AAC1B,OAAO,EAAE,QAAQ,EAAE,MAAM,cAAc,CAAC;AAExC,OAAO,EAAE,SAAS,EAAE,MAAM,aAAa,CAAC;AAExC,wCAAwC;AAExC,MAAM,CAAC,MAAM,UAAU,GAAG,KAAK,CAAC,aAAa,CAInC,IAAI,CAAC,CAAC;AAEhB,MAAM,UAAU,OAAO;IAKrB,MAAM,IAAI,GAAG,KAAK,CAAC,UAAU,CAAC,UAAU,CAAC,CAAC;IAC1C,IAAI,CAAC,IAAI,EAAE;QACT,IAAI,QAAQ,CAAC,EAAE,KAAK,KAAK,IAAI,OAAO,MAAM,KAAK,WAAW,EAAE;YAC1D,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,SAAS,CAAC,GAAG,CAAC,CAAC;iBACrD,CAAC;aACH;SACF;QAED,MAAM,IAAI,KAAK,CAAC,2CAA2C,CAAC,CAAC;KAC9D;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAED,MAAM,UAAU,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';\nimport { Platform } from 'react-native';\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 (Platform.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,11 +1,11 @@
1
1
  /**
2
- * Copyright (c) Evan Bacon.
2
+ * Copyright (c) 650 Industries.
3
3
  * Copyright (c) Meta Platforms, Inc. and affiliates.
4
4
  *
5
5
  * This source code is licensed under the MIT license found in the
6
6
  * LICENSE file in the root directory of this source tree.
7
7
  */
8
- import type { LogBoxLogData } from "./LogBoxLog";
8
+ import type { LogBoxLogData } from './LogBoxLog';
9
9
  type ExceptionData = any;
10
10
  export type ExtendedExceptionData = ExceptionData & {
11
11
  isComponentError: boolean;
@@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