miaoda-expo-devkit 0.1.1-beta.126 → 0.1.1-beta.127

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -79,6 +79,7 @@ Sentry.init({
79
79
  - `console.warn`、`console.error` 不再弹出 LogBox 底部通知;
80
80
  - 原始日志仍会输出到 Metro、ADB 或 Xcode 控制台;
81
81
  - 未捕获的 JavaScript 异常继续展示错误详情;未处理的 Promise 拒绝由 RN 与 Expo runtime 托管补丁单独自动打开详情,不受普通通知隐藏影响;
82
+ - 错误详情点「最小化」后,该条日志保留底部横幅作为重新打开入口(RN 托管补丁单独放行),点「关闭」或清除后横幅消失;其他日志的通知仍隐藏;
82
83
  - 如需临时恢复 LogBox,可在应用调试代码中调用 `LogBox.ignoreAllLogs(false)`。
83
84
 
84
85
  该策略属于 JavaScript Bundle 的公共启动注入,不修改业务页面,也不需要在每个应用中重复配置。未使用
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miaoda-expo-devkit",
3
- "version": "0.1.1-beta.126",
3
+ "version": "0.1.1-beta.127",
4
4
  "description": "Expo 应用开发工具集:Sentry DSN 替换 stub、错误/网络捕获、Metro 符号化",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -144,16 +144,20 @@ index 0000000..9b01194
144
144
  + };
145
145
  +}
146
146
  diff --git a/Libraries/LogBox/Data/LogBoxData.js b/Libraries/LogBox/Data/LogBoxData.js
147
- index 2ce92e0..da840bd 100644
147
+ index 2ce92e0..671733a 100644
148
148
  --- a/Libraries/LogBox/Data/LogBoxData.js
149
149
  +++ b/Libraries/LogBox/Data/LogBoxData.js
150
- @@ -139,24 +139,50 @@ function handleUpdate(): void {
150
+ @@ -139,24 +139,54 @@ function handleUpdate(): void {
151
151
  }
152
152
  }
153
153
 
154
154
  -function appendNewLog(newLog: LogBoxLog) {
155
155
  +// Promise 拒绝仍保留 error 级别,仅改变展示策略;弱引用不延长日志生命周期。
156
156
  +const promiseRejectionLogs: WeakSet<LogBoxLog> = new WeakSet();
157
+ +// 用户主动最小化的日志。DevKit 默认 ignoreAllLogs(true) 隐藏普通通知,
158
+ +// 最小化的日志仍需保留底部横幅作为重新打开详情的入口,否则与关闭无异。
159
+ +// 关闭或清空后日志离开 logs,横幅随之消失,无需额外清理。
160
+ +const minimizedLogs: WeakSet<LogBoxLog> = new WeakSet();
157
161
  +
158
162
  +function appendNewLog(newLog: LogBoxLog, isPromiseRejection: boolean = false) {
159
163
  // Don't want store these logs because they trigger a
@@ -205,7 +209,7 @@ index 2ce92e0..da840bd 100644
205
209
  // If possible, to avoid jank, we don't want to open the error before
206
210
  // it's symbolicated. To do that, we optimistically wait for
207
211
  // symbolication for up to a second before adding the log.
208
- @@ -164,7 +190,7 @@ function appendNewLog(newLog: LogBoxLog) {
212
+ @@ -164,7 +194,7 @@ function appendNewLog(newLog: LogBoxLog) {
209
213
 
210
214
  let addPendingLog: ?() => void = () => {
211
215
  logs.add(newLog);
@@ -214,7 +218,7 @@ index 2ce92e0..da840bd 100644
214
218
  setSelectedLog(logs.size - 1);
215
219
  } else {
216
220
  handleUpdate();
217
- @@ -251,7 +277,10 @@ export function addException(error: ExtendedExceptionData): void {
221
+ @@ -251,7 +281,10 @@ export function addException(error: ExtendedExceptionData): void {
218
222
  // otherwise spammy logs would pause rendering.
219
223
  setImmediate(() => {
220
224
  try {
@@ -226,6 +230,26 @@ index 2ce92e0..da840bd 100644
226
230
  } catch (loggingError) {
227
231
  reportLogBoxError(loggingError);
228
232
  }
233
+ @@ -308,6 +341,19 @@ export function setSelectedLog(proposedNewIndex: number): void {
234
+ }
235
+ }
236
+
237
+ +// 收起当前详情并保留其通知入口;语法错误仍由 setSelectedLog 强制展示。
238
+ +export function minimizeSelectedLog(): void {
239
+ + const selected = Array.from(logs)[_selectedIndex];
240
+ + if (selected != null) {
241
+ + minimizedLogs.add(selected);
242
+ + }
243
+ + setSelectedLog(-1);
244
+ +}
245
+ +
246
+ +export function isMinimized(log: LogBoxLog): boolean {
247
+ + return minimizedLogs.has(log);
248
+ +}
249
+ +
250
+ export function clearWarnings(): void {
251
+ const newLogs = Array.from(logs).filter(log => log.level !== 'warn');
252
+ if (newLogs.length !== logs.size) {
229
253
  diff --git a/Libraries/LogBox/Data/LogBoxPromptCopy.js b/Libraries/LogBox/Data/LogBoxPromptCopy.js
230
254
  new file mode 100644
231
255
  index 0000000..19105cb
@@ -260,6 +284,44 @@ index 0000000..19105cb
260
284
  + copyConfirmQuestion: '仍要复制错误给智能体修复吗?',
261
285
  + copyConfirmButtonTitle: '仍要复制错误',
262
286
  +};
287
+ diff --git a/Libraries/LogBox/LogBoxInspectorContainer.js b/Libraries/LogBox/LogBoxInspectorContainer.js
288
+ index 3ccf93a..26ca59f 100644
289
+ --- a/Libraries/LogBox/LogBoxInspectorContainer.js
290
+ +++ b/Libraries/LogBox/LogBoxInspectorContainer.js
291
+ @@ -55,7 +55,7 @@ export class _LogBoxInspectorContainer extends React.Component<Props> {
292
+ };
293
+
294
+ _handleMinimize = (): void => {
295
+ - LogBoxData.setSelectedLog(-1);
296
+ + LogBoxData.minimizeSelectedLog();
297
+ };
298
+
299
+ _handleSetSelectedLog = (index: number): void => {
300
+ diff --git a/Libraries/LogBox/LogBoxNotificationContainer.js b/Libraries/LogBox/LogBoxNotificationContainer.js
301
+ index a3fa687..309f2d5 100644
302
+ --- a/Libraries/LogBox/LogBoxNotificationContainer.js
303
+ +++ b/Libraries/LogBox/LogBoxNotificationContainer.js
304
+ @@ -50,12 +50,17 @@ export function _LogBoxNotificationContainer(props: Props): React.Node {
305
+ setSelectedLog(index);
306
+ }
307
+
308
+ - if (logs.length === 0 || props.isDisabled === true) {
309
+ + // 通知被全局隐藏时只保留用户最小化的日志,作为重新打开详情的入口。
310
+ + const visibleLogs =
311
+ + props.isDisabled === true
312
+ + ? logs.filter(log => LogBoxData.isMinimized(log))
313
+ + : logs;
314
+ + if (visibleLogs.length === 0) {
315
+ return null;
316
+ }
317
+
318
+ - const warnings = logs.filter(log => log.level === 'warn');
319
+ - const errors = logs.filter(
320
+ + const warnings = visibleLogs.filter(log => log.level === 'warn');
321
+ + const errors = visibleLogs.filter(
322
+ log => log.level === 'error' || log.level === 'fatal',
323
+ );
324
+ return (
263
325
  diff --git a/Libraries/LogBox/UI/LogBoxInspector.js b/Libraries/LogBox/UI/LogBoxInspector.js
264
326
  index be889b0..854c1cf 100644
265
327
  --- a/Libraries/LogBox/UI/LogBoxInspector.js
package/pnpmfile.cjs CHANGED
@@ -11,6 +11,7 @@ const managedPatches = {
11
11
  [REACT_NATIVE_PATCH_SELECTOR]: {
12
12
  filename: 'react-native@0.83.2.patch',
13
13
  legacyHashes: new Set([
14
+ '7c80a1caedd1c4397c7d3a8cf253b76a5d93c25779150c5cbadcac1a270f0312',
14
15
  '5506d130966fbe0539c3a7de1b4b0dac4f39fe21efde52307bb3c4b99837c01c',
15
16
  'd7f25406e993a4d0f2a0f0ee508769ffc630e293456348492f5a1ffa000271d0',
16
17
  'a5cb4e26aa64ec29e7a81bbec0f9ea36bcac15e2eea53b15491cd01095885296',