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

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.128",
4
4
  "description": "Expo 应用开发工具集:Sentry DSN 替换 stub、错误/网络捕获、Metro 符号化",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",
@@ -1209,10 +1209,10 @@ index 0000000..6d47443
1209
1209
  +});
1210
1210
  diff --git a/src/launch/miaodaPromptCopy.ts b/src/launch/miaodaPromptCopy.ts
1211
1211
  new file mode 100644
1212
- index 0000000..3b829e4
1212
+ index 0000000..43ceee2
1213
1213
  --- /dev/null
1214
1214
  +++ b/src/launch/miaodaPromptCopy.ts
1215
- @@ -0,0 +1,41 @@
1215
+ @@ -0,0 +1,44 @@
1216
1216
  +// Development Build 提示文案的唯一事实源(devkit 补丁 JS 侧)。
1217
1217
  +//
1218
1218
  +// 连接问题与能力问题各只有一套文案,所有时机(热更新前、复制错误前、运行中
@@ -1245,13 +1245,16 @@ index 0000000..3b829e4
1245
1245
  + cancelButtonTitle: '取消',
1246
1246
  + copyRetryButtonTitle: '重试',
1247
1247
  +
1248
- + // 能力问题(复制错误前,仅旧客户端回退弹窗使用)。
1249
- + copyConfirmQuestion: '仍要复制错误给智能体修复吗?',
1250
- + copyConfirmButtonTitle: '仍要复制错误',
1248
+ + // 能力问题(复制错误前,仅旧客户端回退弹窗使用)。复制确认专用正文不复用
1249
+ + // incompatibleBody(其「强制加载」只适用于加载前的提示)。
1250
+ + copyIncompatibleBody:
1251
+ + '当前调试包不支持部分新增能力,建议前往电脑端重新构建并安装新的调试包。',
1252
+ + copyConfirmQuestion: '确定还要复制报错吗?',
1253
+ + copyConfirmButtonTitle: '仍要复制',
1251
1254
  +} as const;
1252
1255
  +
1253
1256
  +export const MIAODA_PROMPT_COPY_INCOMPATIBLE_MESSAGE =
1254
- + MIAODA_PROMPT_COPY.incompatibleBody + MIAODA_PROMPT_COPY.copyConfirmQuestion;
1257
+ + MIAODA_PROMPT_COPY.copyIncompatibleBody + MIAODA_PROMPT_COPY.copyConfirmQuestion;
1255
1258
  +export const MIAODA_PROMPT_COPY_UNKNOWN_MESSAGE =
1256
1259
  + MIAODA_PROMPT_COPY.unknownBody + MIAODA_PROMPT_COPY.copyConfirmQuestion;
1257
1260
  diff --git a/src/launch/withDevTools.ios.tsx b/src/launch/withDevTools.ios.tsx
@@ -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,12 +230,32 @@ 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
- index 0000000..19105cb
255
+ index 0000000..280c2d5
232
256
  --- /dev/null
233
257
  +++ b/Libraries/LogBox/Data/LogBoxPromptCopy.js
234
- @@ -0,0 +1,28 @@
258
+ @@ -0,0 +1,35 @@
235
259
  +/**
236
260
  + * Development Build 提示文案的唯一事实源(react-native 补丁 JS 侧,LogBox 复制链路)。
237
261
  + *
@@ -256,15 +280,60 @@ index 0000000..19105cb
256
280
  + cancelButtonTitle: '取消',
257
281
  + copyRetryButtonTitle: '重试',
258
282
  +
259
- + // 复制确认。
260
- + copyConfirmQuestion: '仍要复制错误给智能体修复吗?',
261
- + copyConfirmButtonTitle: '仍要复制错误',
283
+ + // 复制确认:点击「复制错误给智能体修复」且能力不兼容时的系统弹窗专用正文,
284
+ + // 不复用 incompatibleBody(其「强制加载」只适用于加载前的提示)。
285
+ + copyIncompatibleBody:
286
+ + '当前调试包不支持部分新增能力,建议前往电脑端重新构建并安装新的调试包。',
287
+ + copyConfirmQuestion: '确定还要复制报错吗?',
288
+ + copyConfirmButtonTitle: '仍要复制',
262
289
  +};
290
+ +
291
+ +// 复制确认弹窗正文:专用正文 + 提问,不追加缺失模块等原因列表。
292
+ +export const LOGBOX_COPY_INCOMPATIBLE_MESSAGE: string =
293
+ + LOGBOX_PROMPT_COPY.copyIncompatibleBody + LOGBOX_PROMPT_COPY.copyConfirmQuestion;
294
+ diff --git a/Libraries/LogBox/LogBoxInspectorContainer.js b/Libraries/LogBox/LogBoxInspectorContainer.js
295
+ index 3ccf93a..26ca59f 100644
296
+ --- a/Libraries/LogBox/LogBoxInspectorContainer.js
297
+ +++ b/Libraries/LogBox/LogBoxInspectorContainer.js
298
+ @@ -55,7 +55,7 @@ export class _LogBoxInspectorContainer extends React.Component<Props> {
299
+ };
300
+
301
+ _handleMinimize = (): void => {
302
+ - LogBoxData.setSelectedLog(-1);
303
+ + LogBoxData.minimizeSelectedLog();
304
+ };
305
+
306
+ _handleSetSelectedLog = (index: number): void => {
307
+ diff --git a/Libraries/LogBox/LogBoxNotificationContainer.js b/Libraries/LogBox/LogBoxNotificationContainer.js
308
+ index a3fa687..309f2d5 100644
309
+ --- a/Libraries/LogBox/LogBoxNotificationContainer.js
310
+ +++ b/Libraries/LogBox/LogBoxNotificationContainer.js
311
+ @@ -50,12 +50,17 @@ export function _LogBoxNotificationContainer(props: Props): React.Node {
312
+ setSelectedLog(index);
313
+ }
314
+
315
+ - if (logs.length === 0 || props.isDisabled === true) {
316
+ + // 通知被全局隐藏时只保留用户最小化的日志,作为重新打开详情的入口。
317
+ + const visibleLogs =
318
+ + props.isDisabled === true
319
+ + ? logs.filter(log => LogBoxData.isMinimized(log))
320
+ + : logs;
321
+ + if (visibleLogs.length === 0) {
322
+ return null;
323
+ }
324
+
325
+ - const warnings = logs.filter(log => log.level === 'warn');
326
+ - const errors = logs.filter(
327
+ + const warnings = visibleLogs.filter(log => log.level === 'warn');
328
+ + const errors = visibleLogs.filter(
329
+ log => log.level === 'error' || log.level === 'fatal',
330
+ );
331
+ return (
263
332
  diff --git a/Libraries/LogBox/UI/LogBoxInspector.js b/Libraries/LogBox/UI/LogBoxInspector.js
264
- index be889b0..854c1cf 100644
333
+ index be889b0..d5633f6 100644
265
334
  --- a/Libraries/LogBox/UI/LogBoxInspector.js
266
335
  +++ b/Libraries/LogBox/UI/LogBoxInspector.js
267
- @@ -8,6 +8,11 @@
336
+ @@ -8,6 +8,14 @@
268
337
  * @format
269
338
  */
270
339
 
@@ -272,11 +341,14 @@ index be889b0..854c1cf 100644
272
341
  +
273
342
  +import Alert from '../../Alert/Alert';
274
343
  +import {createLogBoxCopyController} from '../Data/LogBoxCopy';
275
- +import {LOGBOX_PROMPT_COPY} from '../Data/LogBoxPromptCopy';
344
+ +import {
345
+ + LOGBOX_COPY_INCOMPATIBLE_MESSAGE,
346
+ + LOGBOX_PROMPT_COPY,
347
+ +} from '../Data/LogBoxPromptCopy';
276
348
  import Keyboard from '../../Components/Keyboard/Keyboard';
277
349
  import View from '../../Components/View/View';
278
350
  import StyleSheet from '../../StyleSheet/StyleSheet';
279
- @@ -18,7 +23,97 @@ import LogBoxInspectorFooter from './LogBoxInspectorFooter';
351
+ @@ -18,7 +26,97 @@ import LogBoxInspectorFooter from './LogBoxInspectorFooter';
280
352
  import LogBoxInspectorHeader from './LogBoxInspectorHeader';
281
353
  import * as LogBoxStyle from './LogBoxStyle';
282
354
  import * as React from 'react';
@@ -375,7 +447,7 @@ index be889b0..854c1cf 100644
375
447
 
376
448
  type Props = $ReadOnly<{
377
449
  onDismiss: () => void,
378
- @@ -32,6 +127,10 @@ type Props = $ReadOnly<{
450
+ @@ -32,6 +130,10 @@ type Props = $ReadOnly<{
379
451
  export default function LogBoxInspector(props: Props): React.Node {
380
452
  const {logs, selectedIndex} = props;
381
453
  let log = logs[selectedIndex];
@@ -386,7 +458,7 @@ index be889b0..854c1cf 100644
386
458
 
387
459
  useEffect(() => {
388
460
  if (log) {
389
- @@ -55,10 +154,85 @@ export default function LogBoxInspector(props: Props): React.Node {
461
+ @@ -55,10 +157,87 @@ export default function LogBoxInspector(props: Props): React.Node {
390
462
  Keyboard.dismiss();
391
463
  }, []);
392
464
 
@@ -426,19 +498,21 @@ index be889b0..854c1cf 100644
426
498
  + {cancelable: true}
427
499
  + );
428
500
  + },
429
- + reason => new Promise(resolve => {
501
+ + // 缺失模块等原因列表对用户没有行动价值,弹窗只展示统一的复制确认文案。
502
+ + () => new Promise(resolve => {
430
503
  + if (currentLog.current !== log) {
431
504
  + resolve(false);
432
505
  + return;
433
506
  + }
434
507
  + Alert.alert(
435
508
  + LOGBOX_PROMPT_COPY.incompatibleTitle,
436
- + `${LOGBOX_PROMPT_COPY.incompatibleBody}${
437
- + reason ? '\n' + reason : ''
438
- + }${LOGBOX_PROMPT_COPY.copyConfirmQuestion}`,
509
+ + LOGBOX_COPY_INCOMPATIBLE_MESSAGE,
510
+ + // 「仍要复制」在左、「取消」在右。Android 按「中性、否定、肯定」从左到右排列,
511
+ + // iOS 会把 cancel 样式的按钮固定在左侧,所以这里不设 style: 'cancel',
512
+ + // 两端都按数组顺序展示;返回键与点外部仍由 onDismiss 视为取消。
439
513
  + [
440
- + {text: LOGBOX_PROMPT_COPY.cancelButtonTitle, style: 'cancel', onPress: () => resolve(false)},
441
514
  + {text: LOGBOX_PROMPT_COPY.copyConfirmButtonTitle, onPress: () => resolve(true)},
515
+ + {text: LOGBOX_PROMPT_COPY.cancelButtonTitle, onPress: () => resolve(false)},
442
516
  + ],
443
517
  + {cancelable: true, onDismiss: () => resolve(false)}
444
518
  + );
@@ -472,7 +546,7 @@ index be889b0..854c1cf 100644
472
546
  if (log == null) {
473
547
  return null;
474
548
  }
475
- @@ -73,6 +247,8 @@ export default function LogBoxInspector(props: Props): React.Node {
549
+ @@ -73,6 +252,8 @@ export default function LogBoxInspector(props: Props): React.Node {
476
550
  />
477
551
  <LogBoxInspectorBody log={log} onRetry={_handleRetry} />
478
552
  <LogBoxInspectorFooter
package/pnpmfile.cjs CHANGED
@@ -11,6 +11,8 @@ const managedPatches = {
11
11
  [REACT_NATIVE_PATCH_SELECTOR]: {
12
12
  filename: 'react-native@0.83.2.patch',
13
13
  legacyHashes: new Set([
14
+ '8d2725c46977a73050e59f9dda17db4b819cd691a32f5a970fe832dcae480e8f',
15
+ '7c80a1caedd1c4397c7d3a8cf253b76a5d93c25779150c5cbadcac1a270f0312',
14
16
  '5506d130966fbe0539c3a7de1b4b0dac4f39fe21efde52307bb3c4b99837c01c',
15
17
  'd7f25406e993a4d0f2a0f0ee508769ffc630e293456348492f5a1ffa000271d0',
16
18
  'a5cb4e26aa64ec29e7a81bbec0f9ea36bcac15e2eea53b15491cd01095885296',
@@ -62,6 +64,7 @@ const managedPatches = {
62
64
  'expo@55.0.6': {
63
65
  filename: 'expo@55.0.6.patch',
64
66
  legacyHashes: new Set([
67
+ '461da64df53d44e7ddf87725838bb3d18e6d7206e3b40ae288641f5072296ff8',
65
68
  '573ac35a3a68be0d5eefd1e958929082bcfcf3efc233b6e18e7466b4f33fadbb',
66
69
  '4f93951e5181dd109fb84a1a0549cf26aee37e0a8077e77bb4df82f674ff6da9',
67
70
  '53974f8fd1e682b4da10cbcf0f395996c3734eae2372a9516dee067a3c5ade48',