miaoda-expo-devkit 0.1.1-dev.development-build.7 → 0.1.1-dev.development-build.9

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.
@@ -21,10 +21,28 @@ index e2b8941..355deae 100644
21
21
  "jest-expo": "~55.0.9",
22
22
  "lottie-react-native": "~7.3.4",
23
23
  diff --git a/src/async-require/hmr.ts b/src/async-require/hmr.ts
24
- index c0ea71e..9250e76 100644
24
+ index c0ea71e..bf5dc6c 100644
25
25
  --- a/src/async-require/hmr.ts
26
26
  +++ b/src/async-require/hmr.ts
27
- @@ -17,6 +17,7 @@ import {
27
+ @@ -11,12 +11,25 @@
28
+ import MetroHMRClient from '@expo/metro/metro-runtime/modules/HMRClient';
29
+ import prettyFormat, { plugins } from 'pretty-format';
30
+
31
+ +import {
32
+ + checkMiaodaHmrCompatibility,
33
+ + getMiaodaHmrCompatibilityState,
34
+ + isMiaodaHmrCompatibilityEnabled,
35
+ + setMiaodaHmrCompatibilityRetry,
36
+ +} from './miaodaHmrCompatibilityCheck';
37
+ +
38
+ +import {
39
+ + getMiaodaNativeBlockingStatus,
40
+ + onMiaodaNativeBlockingStatusAction,
41
+ +} from './miaodaNativeBlockingStatus';
42
+ +
43
+ import {
44
+ getConnectionError,
45
+ getFullBundlerUrl,
28
46
  handleCompileError,
29
47
  hideLoading,
30
48
  resetErrorOverlay,
@@ -32,7 +50,7 @@ index c0ea71e..9250e76 100644
32
50
  showLoading,
33
51
  } from './hmrUtils';
34
52
 
35
- @@ -29,6 +30,66 @@ let hmrClient: MetroHMRClient | null = null;
53
+ @@ -29,8 +42,183 @@ let hmrClient: MetroHMRClient | null = null;
36
54
  let hmrUnavailableReason: string | null = null;
37
55
  const buildErrorQueue = new Set<unknown>();
38
56
  let didConnect: boolean = false;
@@ -68,6 +86,68 @@ index c0ea71e..9250e76 100644
68
86
  +export function isMiaodaPaused(): boolean {
69
87
  + return miaodaPaused;
70
88
  +}
89
+ +
90
+ +let miaodaServerDisconnected = false;
91
+ +// 开发服务器断线状态订阅者:launch/ 里的回退横幅(旧客户端)据此提示用户
92
+ +// Metro 已不可达。新客户端上阻断 UI 由原生阻断页渲染,JS 只上报状态。
93
+ +const miaodaServerDisconnectedListeners = new Set<(disconnected: boolean) => void>();
94
+ +
95
+ +// miaodaServerDisconnected 的唯一写入入口:值真正变化时才广播,
96
+ +// 订阅者异常不能反过来打断 HMR 控制链路。
97
+ +function setMiaodaServerDisconnected(disconnected: boolean) {
98
+ + if (miaodaServerDisconnected === disconnected) return;
99
+ + miaodaServerDisconnected = disconnected;
100
+ + // 新客户端:断线挂原生阻断页(重新尝试 / 退出),恢复时收起。
101
+ + // 同一时刻只保留一个阻断页且连接优先:热更新确认页已在展示时不再切换
102
+ + //(该页本身已阻断交互,确认或退出后断线状态仍由轮询驱动重新挂出)。
103
+ + const native = getMiaodaNativeBlockingStatus();
104
+ + if (native != null && getMiaodaHmrCompatibilityState().status !== 'blocked') {
105
+ + if (disconnected) {
106
+ + void native.showBlockingStatus('disconnected');
107
+ + } else {
108
+ + void native.dismissBlockingStatus();
109
+ + }
110
+ + }
111
+ + for (const listener of miaodaServerDisconnectedListeners) {
112
+ + try {
113
+ + listener(disconnected);
114
+ + } catch {}
115
+ + }
116
+ +}
117
+ +
118
+ +// 原生阻断页「重新尝试」:立即探测一轮而不是等下一个 2 秒周期,
119
+ +// 探测结果仍由统一的轮询路径处理(成功即收起页面)。
120
+ +function probeMiaodaStatusNow() {
121
+ + if (miaodaPollTimer != null) {
122
+ + clearTimeout(miaodaPollTimer);
123
+ + miaodaPollTimer = null;
124
+ + }
125
+ + void pollMiaodaStatus();
126
+ +}
127
+ +
128
+ +// 原生阻断页按钮事件入口:断线页的「重新尝试」由 JS 触发立即探测
129
+ +//(「退出」在原生侧直接结束进程,不经过 JS)。
130
+ +onMiaodaNativeBlockingStatusAction((event) => {
131
+ + if (event.kind === 'disconnected' && event.action === 'retry') {
132
+ + probeMiaodaStatusNow();
133
+ + }
134
+ +});
135
+ +
136
+ +// 订阅断线状态变化,返回取消订阅函数(供 React useEffect 使用)。
137
+ +export function subscribeMiaodaServerDisconnected(
138
+ + listener: (disconnected: boolean) => void
139
+ +): () => void {
140
+ + miaodaServerDisconnectedListeners.add(listener);
141
+ + return () => {
142
+ + miaodaServerDisconnectedListeners.delete(listener);
143
+ + };
144
+ +}
145
+ +
146
+ +// 横幅挂载时读取当前值,避免错过订阅注册之前发生的断线。
147
+ +export function isMiaodaServerDisconnected(): boolean {
148
+ + return miaodaServerDisconnected;
149
+ +}
150
+ +
71
151
  +let fastRefreshRequested = false;
72
152
  +// 断线兜底轮询间隔。控制消息走 /hot WebSocket,轮询只用于 socket 断开期间的
73
153
  +// 状态同步,不需要很频繁。
@@ -96,10 +176,65 @@ index c0ea71e..9250e76 100644
96
176
  +// 也要按 reload 处理(暂停期间错过的批量编辑不能靠增量补齐)。
97
177
  +let miaodaObservedPaused = false;
98
178
  +let miaodaWebSocketDisconnected = false;
179
+ +// /_hmr/status 轮询的连续失败计数(按周期计:一个周期内协议重试仍算一次)。
180
+ +// 达到阈值才判定开发服务器断线并广播给顶部横幅。3 个周期(约 6 秒)
181
+ +// 跨过网关对 Metro 瞬时崩溃的一次自动恢复窗口(最长 5 秒 backoff),
182
+ +// 避免 Metro 快速重启时闪烁误报;WebSocket close 本身不触发横幅。
183
+ +let miaodaPollFailureCount = 0;
184
+ +const MIAODA_POLL_FAILURE_THRESHOLD = 3;
99
185
  const pendingLogs: [LogLevel, any[]][] = [];
100
186
 
187
+ +// 完整重载是独立于增量的待执行意图。轮询会反复返回同一个版本,用户暂缓后
188
+ +// 仍须记住它,同时禁止后续 resume 绕过检查直接应用增量。
189
+ +let miaodaReloadIntent: { key: string; attempted: boolean } | null = null;
190
+ +let miaodaReloadChecking = false;
191
+ +let miaodaReloadCommitted = false;
192
+ +let miaodaReloadEpoch = 0;
193
+ +
194
+ +function requestMiaodaReload(key: string) {
195
+ + if (miaodaReloadCommitted) return;
196
+ + if (!isMiaodaHmrCompatibilityEnabled()) {
197
+ + reload();
198
+ + return;
199
+ + }
200
+ + if (miaodaReloadIntent?.key !== key) {
201
+ + miaodaReloadIntent = { key, attempted: false };
202
+ + miaodaReloadEpoch += 1;
203
+ + hmrClient?.disable();
204
+ + }
205
+ + void attemptMiaodaReload();
206
+ +}
207
+ +
208
+ +async function attemptMiaodaReload() {
209
+ + const intent = miaodaReloadIntent;
210
+ + if (!intent || intent.attempted || miaodaReloadChecking || miaodaReloadCommitted || miaodaPaused) return;
211
+ + // 连接优先于能力:断线期间检查只会得到 unknown,等恢复后由轮询重新驱动。
212
+ + if (miaodaServerDisconnected) return;
213
+ + intent.attempted = true;
214
+ + miaodaReloadChecking = true;
215
+ + const epoch = miaodaReloadEpoch;
216
+ + const isCurrent = () => miaodaReloadIntent === intent && miaodaReloadEpoch === epoch && !miaodaPaused && !miaodaReloadCommitted;
217
+ + try {
218
+ + if (await checkMiaodaHmrCompatibility(isCurrent) && isCurrent()) {
219
+ + miaodaReloadCommitted = true;
220
+ + reload();
221
+ + }
222
+ + } catch {
223
+ + // 检查失败保留意图,用户可通过运行中的提示重试;不自动执行新 Bundle。
224
+ + } finally {
225
+ + miaodaReloadChecking = false;
226
+ + hideLoading();
227
+ + // 检查过程中收到更新的重载指令时,旧授权无效,新指令需要自己的检查。
228
+ + if (miaodaReloadIntent !== intent || miaodaReloadEpoch !== epoch) {
229
+ + void attemptMiaodaReload();
230
+ + }
231
+ + }
232
+ +}
233
+ +
101
234
  type LogLevel =
102
- @@ -42,6 +103,102 @@ type LogLevel =
235
+ | 'trace'
236
+ | 'info'
237
+ @@ -42,6 +230,127 @@ type LogLevel =
103
238
  | 'groupEnd'
104
239
  | 'debug';
105
240
 
@@ -148,10 +283,19 @@ index c0ea71e..9250e76 100644
148
283
  + clearTimeout(miaodaPollTimer);
149
284
  + miaodaPollTimer = null;
150
285
  + }
286
+ + // 404 仍是服务端给出的应答(进程活着,只是没挂控制路由),不算断线。
287
+ + miaodaPollFailureCount = 0;
288
+ + setMiaodaServerDisconnected(false);
151
289
  + return;
152
290
  + }
153
291
  + if (!response.ok) {
154
292
  + // 5xx 等暂时性 HTTP 失败不停止轮询,下一轮继续重试。
293
+ + // 网关在 Metro 进程退出后可能返回 5xx 而非拒绝连接,与网络
294
+ + // 错误一样计入连续失败,达到阈值同样判定为断线。
295
+ + miaodaPollFailureCount += 1;
296
+ + if (miaodaPollFailureCount >= MIAODA_POLL_FAILURE_THRESHOLD) {
297
+ + setMiaodaServerDisconnected(true);
298
+ + }
155
299
  + return;
156
300
  + }
157
301
  +
@@ -160,6 +304,9 @@ index c0ea71e..9250e76 100644
160
304
  + const state = (await response.json()) as {
161
305
  + paused?: boolean; reloadPending?: boolean; stateVersion?: number; lastMode?: string | null;
162
306
  + };
307
+ + // 拿到合法状态响应说明开发服务器存活:清零失败计数并撤下断线提示。
308
+ + miaodaPollFailureCount = 0;
309
+ + setMiaodaServerDisconnected(false);
163
310
  + // Number.isInteger 不是 TS 类型守卫,先收窄 number 再判整数,
164
311
  + // 使 version 的类型收敛为 number | null。
165
312
  + const version = typeof state.stateVersion === 'number' && Number.isInteger(state.stateVersion) ? state.stateVersion : null;
@@ -168,6 +315,10 @@ index c0ea71e..9250e76 100644
168
315
  + if (miaodaSessionBaseVersion === null && version !== null) miaodaSessionBaseVersion = version;
169
316
  + if (state.paused) {
170
317
  + miaodaObservedPaused = true;
318
+ + if (!miaodaPaused) {
319
+ + miaodaReloadEpoch += 1;
320
+ + if (miaodaReloadIntent) miaodaReloadIntent.attempted = false;
321
+ + }
171
322
  + setMiaodaPaused(true);
172
323
  + hmrClient?.disable();
173
324
  + // 把观察到的这次暂停作为本地基线版本。之后若出现没有对应 WebSocket
@@ -186,14 +337,23 @@ index c0ea71e..9250e76 100644
186
337
  + setMiaodaPaused(false);
187
338
  + miaodaLastControlVersion = version;
188
339
  + if (shouldReload) {
189
- + reload();
340
+ + requestMiaodaReload(`state:${version}`);
341
+ + return;
342
+ + }
343
+ + if (miaodaReloadIntent) {
344
+ + void attemptMiaodaReload();
190
345
  + return;
191
346
  + }
192
347
  + if (fastRefreshRequested) HMRClient.enable();
193
348
  + }
194
349
  + } catch {
195
350
  + // 网络错误、超时、响应解析失败都属于暂时故障:不解除编辑闸门,
196
- + // 也不停止轮询,下一轮继续。
351
+ + // 也不停止轮询,下一轮继续。同时计入断线判定:连续多个周期都
352
+ + // 无法获得可用响应,就广播给顶部横幅提示用户开发服务器不可达。
353
+ + miaodaPollFailureCount += 1;
354
+ + if (miaodaPollFailureCount >= MIAODA_POLL_FAILURE_THRESHOLD) {
355
+ + setMiaodaServerDisconnected(true);
356
+ + }
197
357
  + } finally {
198
358
  + scheduleMiaodaStatusPoll();
199
359
  + }
@@ -202,17 +362,17 @@ index c0ea71e..9250e76 100644
202
362
  function assert(foo: any, msg: string): asserts foo {
203
363
  if (!foo) throw new Error(msg);
204
364
  }
205
- @@ -52,6 +209,9 @@ function assert(foo: any, msg: string): asserts foo {
365
+ @@ -52,6 +361,9 @@ function assert(foo: any, msg: string): asserts foo {
206
366
  */
207
367
  const HMRClient = {
208
368
  enable() {
209
369
  + fastRefreshRequested = true;
210
370
  + // Agent 编辑闸门优先于用户操作:暂停期间只记录意图,等 resume 再恢复。
211
- + if (miaodaPaused) return;
371
+ + if (miaodaPaused || miaodaReloadIntent || miaodaReloadCommitted) return;
212
372
  if (hmrUnavailableReason !== null) {
213
373
  // If HMR became unavailable while you weren't using it,
214
374
  // explain why when you try to turn it on.
215
- @@ -87,6 +247,7 @@ const HMRClient = {
375
+ @@ -87,6 +399,7 @@ const HMRClient = {
216
376
  },
217
377
 
218
378
  disable() {
@@ -220,10 +380,39 @@ index c0ea71e..9250e76 100644
220
380
  assert(hmrClient, 'Expected HMRClient.setup() call at startup.');
221
381
  hmrClient.disable();
222
382
  },
223
- @@ -180,6 +341,13 @@ const HMRClient = {
383
+ @@ -180,6 +493,42 @@ const HMRClient = {
224
384
  const origin = `${serverScheme}://${serverHost}`;
225
385
  const client = new MetroHMRClient(`${origin}/hot`);
226
386
  hmrClient = client;
387
+ + if (isMiaodaHmrCompatibilityEnabled()) {
388
+ + // 必须在 enable 和 entrypoint 注册之前安装:初始追赶增量也可能包含新原生依赖。
389
+ + const gatedClient = client as MetroHMRClient & {
390
+ + setUpdateGate: (gate: (isCurrent: () => boolean) => Promise<boolean>) => void;
391
+ + retryPendingUpdate: () => void;
392
+ + };
393
+ + gatedClient.setUpdateGate((isCurrent) => checkMiaodaHmrCompatibility(
394
+ + () => isCurrent() && hmrClient === client && !miaodaPaused && !miaodaReloadIntent && !miaodaReloadCommitted
395
+ + ));
396
+ + setMiaodaHmrCompatibilityRetry(() => {
397
+ + if (miaodaPaused || miaodaReloadCommitted) return;
398
+ + if (miaodaReloadIntent) {
399
+ + miaodaReloadIntent.attempted = false;
400
+ + void attemptMiaodaReload();
401
+ + } else if (fastRefreshRequested) {
402
+ + gatedClient.retryPendingUpdate();
403
+ + }
404
+ + });
405
+ + client.on('update-applied', (update: { isInitialUpdate?: boolean }) => {
406
+ + if (!update.isInitialUpdate) resetErrorOverlay();
407
+ + hideLoading();
408
+ + });
409
+ + client.on('update-gate-error', () => hideLoading());
410
+ + client.on('update-apply-error', (error: Error) => {
411
+ + hideLoading();
412
+ + // 模块可能已经部分执行,不能自动重放同一增量;显示错误并保留完整重载入口。
413
+ + handleCompileError(error);
414
+ + });
415
+ + }
227
416
  + if (process.env.EXPO_OS !== 'web') {
228
417
  + // 仅 native 客户端启用状态轮询。初始协议跟随 bundle URL 的 scheme:
229
418
  + // 设备可能拿到证书无效的 HTTPS 开发地址,也有环境只暴露 HTTPS,
@@ -234,7 +423,7 @@ index c0ea71e..9250e76 100644
234
423
 
235
424
  pendingEntryPoints.push(
236
425
  // HMRServer understands regular bundle URLs, so prefer that in case
237
- @@ -193,6 +361,55 @@ const HMRClient = {
426
+ @@ -193,6 +542,61 @@ const HMRClient = {
238
427
  })
239
428
  );
240
429
 
@@ -243,6 +432,9 @@ index c0ea71e..9250e76 100644
243
432
  + // 重连对面的 Metro 可能是另一个进程(例如这次开启了 HMR 控制),
244
433
  + // 重置 404 停止标志,重新探测一次。
245
434
  + miaodaStatusPollingStopped = false;
435
+ + // WebSocket 重新连上说明服务已恢复:清零失败计数并撤下断线提示。
436
+ + miaodaPollFailureCount = 0;
437
+ + setMiaodaServerDisconnected(false);
246
438
  + scheduleMiaodaStatusPoll();
247
439
  + });
248
440
  +
@@ -261,6 +453,8 @@ index c0ea71e..9250e76 100644
261
453
  + case 'pause':
262
454
  + // 立即闸住 HMR 并隐藏刷新提示,然后回 ack——服务端要等所有客户端
263
455
  + // ack 后才认为暂停完成,ack 之前 Agent 不会开始写文件。
456
+ + miaodaReloadEpoch += 1;
457
+ + if (miaodaReloadIntent) miaodaReloadIntent.attempted = false;
264
458
  + setMiaodaPaused(true);
265
459
  + client.disable();
266
460
  + hideLoading();
@@ -270,13 +464,14 @@ index c0ea71e..9250e76 100644
270
464
  + // 解除 Agent 闸门;用户自己的 Fast Refresh 开关保持独立,
271
465
  + // 只有它开着才真正恢复更新。
272
466
  + setMiaodaPaused(false);
273
- + if (fastRefreshRequested) HMRClient.enable();
467
+ + if (miaodaReloadIntent) void attemptMiaodaReload();
468
+ + else if (fastRefreshRequested) HMRClient.enable();
274
469
  + break;
275
470
  + case 'reload':
276
- + // 完整加载前也保持闸门,避免 reload 完成前又有增量进来。
277
- + setMiaodaPaused(true);
471
+ + // 完整重载意图保持增量闸门,但不使用编辑遮罩困住选择保留旧应用的用户。
472
+ + setMiaodaPaused(false);
278
473
  + client.disable();
279
- + reload();
474
+ + requestMiaodaReload(`state:${message.stateVersion ?? 'socket'}`);
280
475
  + break;
281
476
  + case 'error':
282
477
  + // 批次最终编译失败:闸门仍然关着(服务端等 Agent 修好重试),
@@ -290,7 +485,22 @@ index c0ea71e..9250e76 100644
290
485
  client.on('connection-error', (e: Error) => {
291
486
  setHMRUnavailableReason(getConnectionError(serverHost, e));
292
487
  });
293
- @@ -234,6 +451,10 @@ const HMRClient = {
488
+ @@ -221,7 +625,13 @@ const HMRClient = {
489
+ }) => {
490
+ // NOTE(@krystofwoldrich): I don't know why sometimes empty updates are sent. But they should not reset the overlay.
491
+ const isEmpty = added.length === 0 && modified.length === 0 && deleted.length === 0;
492
+ - if (client.isEnabled() && !isInitialUpdate && !isEmpty) {
493
+ + if (!isEmpty && miaodaReloadIntent && !miaodaReloadCommitted) {
494
+ + // 重载检查期间项目又有变化,旧检查及弹框授权不能放行新的完整 Bundle。
495
+ + miaodaReloadEpoch += 1;
496
+ + miaodaReloadIntent.attempted = false;
497
+ + void attemptMiaodaReload();
498
+ + }
499
+ + if (!isMiaodaHmrCompatibilityEnabled() && client.isEnabled() && !isInitialUpdate && !isEmpty) {
500
+ resetErrorOverlay();
501
+ }
502
+ }
503
+ @@ -234,6 +644,10 @@ const HMRClient = {
294
504
  client.on('error', (data) => this._onMetroError(data));
295
505
 
296
506
  client.on('close', (closeEvent?: { code: number; reason: string }) => {
@@ -301,7 +511,17 @@ index c0ea71e..9250e76 100644
301
511
  hideLoading();
302
512
  const reason = closeEvent?.reason;
303
513
  const code = closeEvent?.code || 1000;
304
- @@ -326,6 +547,9 @@ function registerBundleEntryPoints(client: MetroHMRClient | null) {
514
+ @@ -318,7 +732,8 @@ function setHMRUnavailableReason(reason: string) {
515
+ function registerBundleEntryPoints(client: MetroHMRClient | null) {
516
+ if (hmrUnavailableReason != null) {
517
+ // "Bundle Splitting – Metro disconnected"
518
+ - window.location.reload();
519
+ + if (process.env.EXPO_OS === 'web') window.location.reload();
520
+ + else requestMiaodaReload('entrypoint-unavailable');
521
+ return;
522
+ }
523
+
524
+ @@ -326,6 +741,9 @@ function registerBundleEntryPoints(client: MetroHMRClient | null) {
305
525
  client?.send(
306
526
  JSON.stringify({
307
527
  type: 'register-entrypoints',
@@ -311,9 +531,496 @@ index c0ea71e..9250e76 100644
311
531
  entryPoints: pendingEntryPoints,
312
532
  })
313
533
  );
534
+ diff --git a/src/async-require/miaodaHmrCompatibility.ts b/src/async-require/miaodaHmrCompatibility.ts
535
+ new file mode 100644
536
+ index 0000000..3b44065
537
+ --- /dev/null
538
+ +++ b/src/async-require/miaodaHmrCompatibility.ts
539
+ @@ -0,0 +1,149 @@
540
+ +export type HmrCompatibilityState = {
541
+ + status: 'idle' | 'checking' | 'blocked';
542
+ + reason?: string;
543
+ + reasons?: string[];
544
+ +};
545
+ +
546
+ +export type HmrCompatibilityDecision = 'hold' | 'retry' | 'update';
547
+ +
548
+ +type HmrCompatibilityStatus = 'compatible' | 'incompatible' | 'unknown';
549
+ +
550
+ +type Dependencies = {
551
+ + isEnabled: () => boolean;
552
+ + check: () => Promise<unknown>;
553
+ + confirm: (
554
+ + status: 'incompatible' | 'unknown',
555
+ + reason: string,
556
+ + reasons: string[]
557
+ + ) => Promise<HmrCompatibilityDecision>;
558
+ + timeoutMs?: number;
559
+ +};
560
+ +
561
+ +const idle: HmrCompatibilityState = { status: 'idle' };
562
+ +
563
+ +// 纯协调器不依赖 RN,检查和弹框共用队列,旧弹框必须由用户关闭后才释放队列。
564
+ +export function createHmrCompatibilityController(deps: Dependencies) {
565
+ + let state = idle;
566
+ + let queue: Promise<unknown> = Promise.resolve();
567
+ + let retry: (() => void) | undefined;
568
+ + const listeners = new Set<(state: HmrCompatibilityState) => void>();
569
+ +
570
+ + function publish(next: HmrCompatibilityState) {
571
+ + state = next;
572
+ + for (const listener of listeners) {
573
+ + try {
574
+ + listener(state);
575
+ + } catch {
576
+ + // 横幅订阅异常不能中断校验,也不能阻止其他订阅者接收状态。
577
+ + }
578
+ + }
579
+ + }
580
+ +
581
+ + async function inspect(): Promise<{
582
+ + status: HmrCompatibilityStatus;
583
+ + reason: string;
584
+ + reasons: string[];
585
+ + }> {
586
+ + let timer: ReturnType<typeof setTimeout> | undefined;
587
+ + try {
588
+ + const result = await Promise.race([
589
+ + Promise.resolve().then(deps.check),
590
+ + new Promise<never>((_, reject) => {
591
+ + timer = setTimeout(
592
+ + () => reject(new Error('兼容性检查超过 8 秒,请检查网络后重试。')),
593
+ + deps.timeoutMs ?? 8000
594
+ + );
595
+ + }),
596
+ + ]);
597
+ + const value = result as { status?: unknown; reason?: unknown; reasons?: unknown } | null;
598
+ + const reason = typeof value?.reason === 'string' ? value.reason.trim() : '';
599
+ + // 结构化原因列表优先(新客户端);旧客户端回退用 reason 按行拆分。
600
+ + const reasons = Array.isArray(value?.reasons)
601
+ + ? (value.reasons as unknown[]).filter((item): item is string => typeof item === 'string' && item !== '')
602
+ + : reason.split('\n').map((line) => line.trim()).filter((line) => line !== '');
603
+ + if (value?.status === 'compatible') {
604
+ + return { status: 'compatible', reason, reasons };
605
+ + }
606
+ + if (value?.status === 'incompatible') {
607
+ + return {
608
+ + status: 'incompatible',
609
+ + reason: reason || '当前开发构建缺少项目所需的原生能力。',
610
+ + reasons,
611
+ + };
612
+ + }
613
+ + return {
614
+ + status: 'unknown',
615
+ + reason: reason || '兼容性检查未返回明确结果,请更新开发客户端后重试。',
616
+ + reasons,
617
+ + };
618
+ + } catch (error) {
619
+ + return {
620
+ + status: 'unknown',
621
+ + reason: error instanceof Error ? error.message : '兼容性检查失败,请检查网络后重试。',
622
+ + reasons: [],
623
+ + };
624
+ + } finally {
625
+ + clearTimeout(timer);
626
+ + }
627
+ + }
628
+ +
629
+ + async function run(isCurrent: () => boolean): Promise<boolean> {
630
+ + if (!isCurrent()) {
631
+ + return false;
632
+ + }
633
+ + if (!deps.isEnabled()) {
634
+ + return true;
635
+ + }
636
+ + while (isCurrent()) {
637
+ + publish({ status: 'checking' });
638
+ + const result = await inspect();
639
+ + if (!isCurrent()) {
640
+ + return false;
641
+ + }
642
+ + if (result.status === 'compatible') {
643
+ + publish(idle);
644
+ + return true;
645
+ + }
646
+ + publish({ status: 'blocked', reason: result.reason, reasons: result.reasons });
647
+ + let decision: HmrCompatibilityDecision;
648
+ + try {
649
+ + decision = await deps.confirm(result.status, result.reason, result.reasons);
650
+ + } catch {
651
+ + // 弹框异常也保留暂停状态,横幅仍可触发重试。
652
+ + return false;
653
+ + }
654
+ + if (!isCurrent()) {
655
+ + return false;
656
+ + }
657
+ + if (decision === 'update') {
658
+ + publish(idle);
659
+ + return true;
660
+ + }
661
+ + if (decision !== 'retry') {
662
+ + return false;
663
+ + }
664
+ + }
665
+ + return false;
666
+ + }
667
+ +
668
+ + return {
669
+ + checkMiaodaHmrCompatibility(isCurrent: () => boolean): Promise<boolean> {
670
+ + const task = queue.then(() => run(isCurrent));
671
+ + // 检查异常不能阻塞后续目标的校验。
672
+ + queue = task.catch(() => {});
673
+ + return task;
674
+ + },
675
+ + isMiaodaHmrCompatibilityEnabled: deps.isEnabled,
676
+ + getMiaodaHmrCompatibilityState: () => state,
677
+ + subscribeMiaodaHmrCompatibility(listener: (state: HmrCompatibilityState) => void) {
678
+ + listeners.add(listener);
679
+ + return () => { listeners.delete(listener); };
680
+ + },
681
+ + setMiaodaHmrCompatibilityRetry(callback: () => void) {
682
+ + retry = callback;
683
+ + },
684
+ + retryMiaodaHmrCompatibility() {
685
+ + retry?.();
686
+ + },
687
+ + };
688
+ +}
689
+ diff --git a/src/async-require/miaodaHmrCompatibilityCheck.native.ts b/src/async-require/miaodaHmrCompatibilityCheck.native.ts
690
+ new file mode 100644
691
+ index 0000000..de12dc6
692
+ --- /dev/null
693
+ +++ b/src/async-require/miaodaHmrCompatibilityCheck.native.ts
694
+ @@ -0,0 +1,85 @@
695
+ +import { Alert } from 'react-native';
696
+ +
697
+ +import { createHmrCompatibilityController } from './miaodaHmrCompatibility';
698
+ +import {
699
+ + getMiaodaNativeBlockingStatus,
700
+ + onMiaodaNativeBlockingStatusAction,
701
+ +} from './miaodaNativeBlockingStatus';
702
+ +import { MIAODA_PROMPT_COPY } from '../launch/miaodaPromptCopy';
703
+ +import { isRunningInExpoGo } from '../environment/ExpoGo';
704
+ +
705
+ +export type { HmrCompatibilityState } from './miaodaHmrCompatibility';
706
+ +
707
+ +const controller = createHmrCompatibilityController({
708
+ + isEnabled: () => !isRunningInExpoGo(),
709
+ + check: async () => {
710
+ + // 按 LogBox 的延迟注册方式取模块,兼容桥接模块尚未安装的初始化阶段。
711
+ + const runtime = globalThis as typeof globalThis & {
712
+ + expo?: { modules?: { ExpoDevLauncher?: { checkCopyCompatibility?: () => Promise<unknown> } } };
713
+ + };
714
+ + if (runtime.expo == null) {
715
+ + const registry = require('react-native/Libraries/TurboModule/TurboModuleRegistry');
716
+ + registry.get('ExpoModulesCore')?.installModules?.();
717
+ + }
718
+ + const module = runtime.expo?.modules?.ExpoDevLauncher;
719
+ + if (typeof module?.checkCopyCompatibility !== 'function') {
720
+ + throw new Error('当前开发客户端不支持兼容性检查,请升级开发客户端并重新构建应用。');
721
+ + }
722
+ + // 只读取兼容性结果,不触发任何剪贴板写入。
723
+ + return module.checkCopyCompatibility();
724
+ + },
725
+ + // 热更新执行前的确认:新客户端交给原生阻断页(仍要使用 / 退出),文案与
726
+ + // 连接问题、加载前确认共用一套;旧客户端回退三按钮 Alert(JS 无法退出进程,
727
+ + // 保留「保留当前应用 / 重新检查」两个安全选项)。
728
+ + confirm: (status, reason, reasons) =>
729
+ + new Promise((resolve) => {
730
+ + const native = getMiaodaNativeBlockingStatus();
731
+ + if (native != null) {
732
+ + void (async () => {
733
+ + const shown = await native.showBlockingStatus('hmrCapability', { status, reasons });
734
+ + if (!shown) {
735
+ + showLegacyAlert(status, reason, resolve);
736
+ + return;
737
+ + }
738
+ + let remove: () => void = () => {};
739
+ + remove = onMiaodaNativeBlockingStatusAction((event) => {
740
+ + if (event.kind === 'hmrCapability' && event.action === 'continue') {
741
+ + remove();
742
+ + resolve('update');
743
+ + }
744
+ + });
745
+ + })();
746
+ + return;
747
+ + }
748
+ + showLegacyAlert(status, reason, resolve);
749
+ + }),
750
+ +});
751
+ +
752
+ +// 旧客户端回退弹窗:标题已与统一文案表对齐,正文保留三按钮语义的完整说明。
753
+ +function showLegacyAlert(
754
+ + status: 'incompatible' | 'unknown',
755
+ + reason: string,
756
+ + resolve: (decision: 'hold' | 'retry' | 'update') => void
757
+ +) {
758
+ + Alert.alert(
759
+ + status === 'incompatible'
760
+ + ? MIAODA_PROMPT_COPY.incompatibleTitle
761
+ + : MIAODA_PROMPT_COPY.unknownTitle,
762
+ + `${reason}\n\n更新已暂停,当前应用仍可继续使用。建议根据项目最新原生依赖重新构建并安装开发客户端后再更新。仍要更新可能导致应用无法运行。`,
763
+ + [
764
+ + { text: '保留当前应用', style: 'cancel', onPress: () => resolve('hold') },
765
+ + { text: '重新检查', onPress: () => resolve('retry') },
766
+ + { text: '仍要更新', style: 'destructive', onPress: () => resolve('update') },
767
+ + ],
768
+ + { cancelable: false }
769
+ + );
770
+ +}
771
+ +
772
+ +export const {
773
+ + checkMiaodaHmrCompatibility,
774
+ + isMiaodaHmrCompatibilityEnabled,
775
+ + subscribeMiaodaHmrCompatibility,
776
+ + getMiaodaHmrCompatibilityState,
777
+ + setMiaodaHmrCompatibilityRetry,
778
+ + retryMiaodaHmrCompatibility,
779
+ +} = controller;
780
+ diff --git a/src/async-require/miaodaHmrCompatibilityCheck.ts b/src/async-require/miaodaHmrCompatibilityCheck.ts
781
+ new file mode 100644
782
+ index 0000000..1487079
783
+ --- /dev/null
784
+ +++ b/src/async-require/miaodaHmrCompatibilityCheck.ts
785
+ @@ -0,0 +1,18 @@
786
+ +import { createHmrCompatibilityController } from './miaodaHmrCompatibility';
787
+ +
788
+ +export type { HmrCompatibilityState } from './miaodaHmrCompatibility';
789
+ +
790
+ +const controller = createHmrCompatibilityController({
791
+ + isEnabled: () => false,
792
+ + check: async () => ({ status: 'compatible' }),
793
+ + confirm: async () => 'hold',
794
+ +});
795
+ +
796
+ +export const {
797
+ + checkMiaodaHmrCompatibility,
798
+ + isMiaodaHmrCompatibilityEnabled,
799
+ + subscribeMiaodaHmrCompatibility,
800
+ + getMiaodaHmrCompatibilityState,
801
+ + setMiaodaHmrCompatibilityRetry,
802
+ + retryMiaodaHmrCompatibility,
803
+ +} = controller;
804
+ diff --git a/src/async-require/miaodaNativeBlockingStatus.ts b/src/async-require/miaodaNativeBlockingStatus.ts
805
+ new file mode 100644
806
+ index 0000000..ea5ddd5
807
+ --- /dev/null
808
+ +++ b/src/async-require/miaodaNativeBlockingStatus.ts
809
+ @@ -0,0 +1,78 @@
810
+ +// dev-launcher 原生阻断页桥接:新客户端上运行中阻断 UI(断线页 / 热更新能力
811
+ +// 确认页)由原生渲染(复用吉祥物资产与统一文案),JS 只负责检测与状态上报。
812
+ +// 旧开发客户端没有这组接口,调用方据此回退自有 UI(断线横幅 / 确认弹窗)。
813
+ +
814
+ +type MiaodaBlockingStatusActionEvent = {
815
+ + kind: string;
816
+ + action: string;
817
+ +};
818
+ +
819
+ +type NativeBlockingStatusModule = {
820
+ + showBlockingStatus: (
821
+ + kind: string,
822
+ + payload?: Record<string, unknown>
823
+ + ) => Promise<boolean> | boolean;
824
+ + dismissBlockingStatus: () => void | Promise<void>;
825
+ + addListener: (
826
+ + eventName: string,
827
+ + listener: (event: MiaodaBlockingStatusActionEvent) => void
828
+ + ) => { remove: () => void };
829
+ +};
830
+ +
831
+ +type NativeModuleRegistry = {
832
+ + expo?: {
833
+ + modules?: {
834
+ + ExpoDevLauncher?: Record<string, unknown>;
835
+ + };
836
+ + };
837
+ +};
838
+ +
839
+ +function getRuntime(): NativeModuleRegistry {
840
+ + return globalThis as typeof globalThis & NativeModuleRegistry;
841
+ +}
842
+ +
843
+ +// 按需安装 Expo 模块:初始化阶段桥接模块可能尚未就绪(与 LogBox 的延迟注册
844
+ +// 方式一致)。安装失败不抛错,由调用方按旧客户端回退。
845
+ +function ensureNativeModulesInstalled() {
846
+ + const runtime = getRuntime();
847
+ + if (runtime.expo == null) {
848
+ + const registry = require('react-native/Libraries/TurboModule/TurboModuleRegistry');
849
+ + registry.get('ExpoModulesCore')?.installModules?.();
850
+ + }
851
+ +}
852
+ +
853
+ +/**
854
+ + * 取原生阻断页接口;三接口齐全才算新客户端,否则返回 null。
855
+ + * 任何一步异常都按「不支持」处理,让调用方回退旧 UI。
856
+ + */
857
+ +export function getMiaodaNativeBlockingStatus(): NativeBlockingStatusModule | null {
858
+ + try {
859
+ + ensureNativeModulesInstalled();
860
+ + const module = getRuntime().expo?.modules?.ExpoDevLauncher;
861
+ + if (module == null) return null;
862
+ + const candidate = module as Partial<NativeBlockingStatusModule>;
863
+ + if (
864
+ + typeof candidate.showBlockingStatus !== 'function' ||
865
+ + typeof candidate.dismissBlockingStatus !== 'function' ||
866
+ + typeof candidate.addListener !== 'function'
867
+ + ) {
868
+ + return null;
869
+ + }
870
+ + return candidate as NativeBlockingStatusModule;
871
+ + } catch {
872
+ + return null;
873
+ + }
874
+ +}
875
+ +
876
+ +/**
877
+ + * 订阅原生阻断页按钮事件;原生不可用时为 no-op。
878
+ + * 返回取消订阅函数(供一次性等待的调用方清理)。
879
+ + */
880
+ +export function onMiaodaNativeBlockingStatusAction(
881
+ + listener: (event: MiaodaBlockingStatusActionEvent) => void
882
+ +): () => void {
883
+ + const module = getMiaodaNativeBlockingStatus();
884
+ + if (module == null) return () => {};
885
+ + const subscription = module.addListener('onBlockingStatusAction', listener);
886
+ + return () => subscription.remove();
887
+ +}
888
+ diff --git a/src/launch/MiaodaDevServerBanner.tsx b/src/launch/MiaodaDevServerBanner.tsx
889
+ new file mode 100644
890
+ index 0000000..13037b7
891
+ --- /dev/null
892
+ +++ b/src/launch/MiaodaDevServerBanner.tsx
893
+ @@ -0,0 +1,50 @@
894
+ +import * as React from 'react';
895
+ +import { StyleSheet, Text, View } from 'react-native';
896
+ +
897
+ +import { isMiaodaServerDisconnected, subscribeMiaodaServerDisconnected } from '../async-require/hmr';
898
+ +import { getMiaodaNativeBlockingStatus } from '../async-require/miaodaNativeBlockingStatus';
899
+ +import { MIAODA_PROMPT_COPY } from './miaodaPromptCopy';
900
+ +import { getInitialSafeArea } from '../environment/getInitialSafeArea';
901
+ +
902
+ +// 开发服务器断线提示横幅(旧客户端回退):/_hmr/status 轮询连续失败达到阈值后
903
+ +// 显示,服务恢复或 WebSocket 重连后自动消失。非阻断(pointerEvents: 'none'),
904
+ +// 不影响应用交互;已加载的 JS 继续运行,只有代码更新会中断。
905
+ +// 新客户端上阻断 UI 由原生阻断页渲染(重新尝试 / 退出),本横幅不再出现。
906
+ +export default function MiaodaDevServerBanner(): React.ReactElement | null {
907
+ + const [disconnected, setDisconnected] = React.useState(isMiaodaServerDisconnected);
908
+ + React.useEffect(() => subscribeMiaodaServerDisconnected(setDisconnected), []);
909
+ + if (!disconnected || getMiaodaNativeBlockingStatus() != null) return null;
910
+ + return (
911
+ + <View style={styles.container}>
912
+ + <Text style={styles.title}>{MIAODA_PROMPT_COPY.disconnectedTitle}</Text>
913
+ + <Text style={styles.subtitle}>应用仍可继续使用,服务恢复后将自动重连</Text>
914
+ + </View>
915
+ + );
916
+ +}
917
+ +
918
+ +const styles = StyleSheet.create({
919
+ + container: {
920
+ + position: 'absolute',
921
+ + top: 0,
922
+ + left: 0,
923
+ + right: 0,
924
+ + alignItems: 'center',
925
+ + paddingTop: 12 + getInitialSafeArea().top,
926
+ + paddingBottom: 12,
927
+ + backgroundColor: 'rgba(0,0,0,0.75)',
928
+ + // 与 Expo 自带的 Fast Refresh 横幅同层,盖在应用内容之上。
929
+ + zIndex: 42,
930
+ + // 非阻断:整条横幅不接收任何触摸事件,应用照常可交互。
931
+ + pointerEvents: 'none',
932
+ + },
933
+ + title: {
934
+ + color: '#ffffff',
935
+ + fontSize: 15,
936
+ + fontWeight: '600',
937
+ + },
938
+ + subtitle: {
939
+ + color: 'rgba(255,255,255,0.8)',
940
+ + fontSize: 13,
941
+ + marginTop: 4,
942
+ + },
943
+ +});
944
+ diff --git a/src/launch/MiaodaHmrCompatibilityBanner.tsx b/src/launch/MiaodaHmrCompatibilityBanner.tsx
945
+ new file mode 100644
946
+ index 0000000..4aecd61
947
+ --- /dev/null
948
+ +++ b/src/launch/MiaodaHmrCompatibilityBanner.tsx
949
+ @@ -0,0 +1,71 @@
950
+ +import * as React from 'react';
951
+ +import { Pressable, StyleSheet, Text, View } from 'react-native';
952
+ +
953
+ +import {
954
+ + getMiaodaHmrCompatibilityState,
955
+ + isMiaodaHmrCompatibilityEnabled,
956
+ + retryMiaodaHmrCompatibility,
957
+ + subscribeMiaodaHmrCompatibility,
958
+ +} from '../async-require/miaodaHmrCompatibilityCheck';
959
+ +import { getMiaodaNativeBlockingStatus } from '../async-require/miaodaNativeBlockingStatus';
960
+ +import { getInitialSafeArea } from '../environment/getInitialSafeArea';
961
+ +
962
+ +// 热更新能力确认横幅(旧客户端回退):确认弹窗关闭但检查仍未通过时提示
963
+ +// 用户更新处于暂停。新客户端上确认由原生阻断页(仍要使用 / 退出)承担,
964
+ +// 本横幅不再出现。
965
+ +export default function MiaodaHmrCompatibilityBanner(): React.ReactElement | null {
966
+ + const [state, setState] = React.useState(getMiaodaHmrCompatibilityState);
967
+ + React.useEffect(() => {
968
+ + const unsubscribe = subscribeMiaodaHmrCompatibility(setState);
969
+ + setState(getMiaodaHmrCompatibilityState());
970
+ + return unsubscribe;
971
+ + }, []);
972
+ + if (
973
+ + !isMiaodaHmrCompatibilityEnabled() ||
974
+ + state.status !== 'blocked' ||
975
+ + getMiaodaNativeBlockingStatus() != null
976
+ + ) {
977
+ + return null;
978
+ + }
979
+ + return (
980
+ + <View pointerEvents="box-none" style={styles.container}>
981
+ + <View style={styles.banner}>
982
+ + <Text style={styles.title}>更新已暂停</Text>
983
+ + <Text style={styles.subtitle}>当前应用仍可使用,建议重新构建开发客户端</Text>
984
+ + <Pressable
985
+ + accessibilityRole="button"
986
+ + accessibilityLabel="重试检查开发构建兼容性"
987
+ + onPress={retryMiaodaHmrCompatibility}
988
+ + style={styles.retry}>
989
+ + <Text style={styles.retryText}>重试检查</Text>
990
+ + </Pressable>
991
+ + </View>
992
+ + </View>
993
+ + );
994
+ +}
995
+ +
996
+ +const styles = StyleSheet.create({
997
+ + container: {
998
+ + position: 'absolute',
999
+ + left: 0,
1000
+ + right: 0,
1001
+ + bottom: 12 + getInitialSafeArea().bottom,
1002
+ + alignItems: 'center',
1003
+ + // 底部悬浮避免遮住顶部断线横幅,容器外的应用内容仍可交互。
1004
+ + zIndex: 42,
1005
+ + },
1006
+ + banner: {
1007
+ + alignItems: 'center',
1008
+ + maxWidth: 420,
1009
+ + marginHorizontal: 12,
1010
+ + paddingHorizontal: 16,
1011
+ + paddingTop: 12,
1012
+ + paddingBottom: 8,
1013
+ + borderRadius: 12,
1014
+ + backgroundColor: 'rgba(0,0,0,0.8)',
1015
+ + },
1016
+ + title: { color: '#ffffff', fontSize: 15, fontWeight: '600' },
1017
+ + subtitle: { color: 'rgba(255,255,255,0.8)', fontSize: 13, marginTop: 4, textAlign: 'center' },
1018
+ + retry: { paddingHorizontal: 16, paddingVertical: 10, marginTop: 2 },
1019
+ + retryText: { color: '#ffffff', fontSize: 14, fontWeight: '600' },
1020
+ +});
314
1021
  diff --git a/src/launch/MiaodaHmrOverlay.tsx b/src/launch/MiaodaHmrOverlay.tsx
315
1022
  new file mode 100644
316
- index 0000000..2db61b9
1023
+ index 0000000..8b8cef4
317
1024
  --- /dev/null
318
1025
  +++ b/src/launch/MiaodaHmrOverlay.tsx
319
1026
  @@ -0,0 +1,58 @@
@@ -345,7 +1052,7 @@ index 0000000..2db61b9
345
1052
  + return (
346
1053
  + <View style={styles.container}>
347
1054
  + <ActivityIndicator color="#ffffff" size="large" />
348
- + <Text style={styles.title}>应用正在更新中</Text>
1055
+ + <Text style={styles.title}>应用正在修改中</Text>
349
1056
  + <Text style={styles.subtitle}>暂时无法使用,更新完成后将自动恢复</Text>
350
1057
  + </View>
351
1058
  + );
@@ -375,24 +1082,75 @@ index 0000000..2db61b9
375
1082
  + marginTop: 8,
376
1083
  + },
377
1084
  +});
1085
+ diff --git a/src/launch/miaodaPromptCopy.ts b/src/launch/miaodaPromptCopy.ts
1086
+ new file mode 100644
1087
+ index 0000000..d2556eb
1088
+ --- /dev/null
1089
+ +++ b/src/launch/miaodaPromptCopy.ts
1090
+ @@ -0,0 +1,41 @@
1091
+ +// Development Build 提示文案的唯一事实源(devkit 补丁 JS 侧)。
1092
+ +//
1093
+ +// 连接问题与能力问题各只有一套文案,所有时机(热更新前、复制错误前、运行中
1094
+ +// 断线)共用。与 iOS 的 DevLauncherPromptCopy.swift、Android 的
1095
+ +// DevLauncherPromptCopy.kt、react-native 补丁的 LogBoxPromptCopy.js 逐字对应,
1096
+ +// 由 devkit 的文案一致性测试(promptCopyConsistency.test.ts)锁定;修改任何
1097
+ +// 一端必须同步其余三端。
1098
+ +
1099
+ +export const MIAODA_PROMPT_COPY = {
1100
+ + // 连接问题(运行中断线阻断页;加载前由原生吉祥物状态页承担)。
1101
+ + connectingTitle: '正在连接开发服务器',
1102
+ + connectFailedTitle: '无法连接开发服务器',
1103
+ + connectFailedBody: '请确认开发服务器正在运行,或访问秒哒重新打开此应用。',
1104
+ + retryButtonTitle: '重新尝试',
1105
+ + retryingButtonTitle: '正在重新尝试',
1106
+ + disconnectedTitle: '已断开开发服务器',
1107
+ + disconnectedBody: '当前应用已暂停使用,恢复连接后将自动返回。也可以重新尝试,或退出开发客户端。',
1108
+ +
1109
+ + // 能力问题(热更新前确认)。
1110
+ + incompatibleTitle: '当前开发构建能力不完整',
1111
+ + incompatibleBody:
1112
+ + '当前开发构建的原生能力与项目不匹配,继续使用可能导致应用无法运行。建议重新构建开发客户端。',
1113
+ + unknownTitle: '无法确认当前开发构建是否适用',
1114
+ + unknownBody:
1115
+ + '暂时无法完成原生能力检查,继续使用可能导致应用无法运行。建议检查网络后重新进入,或重新构建开发客户端。',
1116
+ + continueButtonTitle: '仍要使用',
1117
+ +
1118
+ + // 通用按钮。
1119
+ + exitButtonTitle: '退出',
1120
+ + cancelButtonTitle: '取消',
1121
+ + copyRetryButtonTitle: '重试',
1122
+ +
1123
+ + // 能力问题(复制错误前,仅旧客户端回退弹窗使用)。
1124
+ + copyConfirmQuestion: '仍要复制错误给智能体修复吗?',
1125
+ + copyConfirmButtonTitle: '仍要复制错误',
1126
+ +} as const;
1127
+ +
1128
+ +export const MIAODA_PROMPT_COPY_INCOMPATIBLE_MESSAGE =
1129
+ + MIAODA_PROMPT_COPY.incompatibleBody + MIAODA_PROMPT_COPY.copyConfirmQuestion;
1130
+ +export const MIAODA_PROMPT_COPY_UNKNOWN_MESSAGE =
1131
+ + MIAODA_PROMPT_COPY.unknownBody + MIAODA_PROMPT_COPY.copyConfirmQuestion;
378
1132
  diff --git a/src/launch/withDevTools.ios.tsx b/src/launch/withDevTools.ios.tsx
379
- index f1f686c..0029bfa 100644
1133
+ index f1f686c..c64b1ca 100644
380
1134
  --- a/src/launch/withDevTools.ios.tsx
381
1135
  +++ b/src/launch/withDevTools.ios.tsx
382
- @@ -3,6 +3,8 @@ import * as React from 'react';
1136
+ @@ -3,6 +3,10 @@ import * as React from 'react';
383
1137
  import DevLoadingView from '../environment/DevLoadingView';
384
1138
  import { isRunningInExpoGo } from '../environment/ExpoGo';
385
1139
 
1140
+ +import MiaodaDevServerBanner from './MiaodaDevServerBanner';
386
1141
  +import MiaodaHmrOverlay from './MiaodaHmrOverlay';
1142
+ +import MiaodaHmrCompatibilityBanner from './MiaodaHmrCompatibilityBanner';
387
1143
  +
388
1144
  /**
389
1145
  * Append the Expo Fast Refresh view and optionally
390
1146
  * keep the screen awake if `expo-keep-awake` is installed.
391
- @@ -31,11 +33,17 @@ export function withDevTools<TComponent extends React.ComponentType<any>>(
1147
+ @@ -31,11 +35,21 @@ export function withDevTools<TComponent extends React.ComponentType<any>>(
392
1148
  <>
393
1149
  <AppRootComponent {...props} />
394
1150
  <DevLoadingView />
395
1151
  + <MiaodaHmrOverlay />
1152
+ + <MiaodaDevServerBanner />
1153
+ + <MiaodaHmrCompatibilityBanner />
396
1154
  </>
397
1155
  );
398
1156
  }
@@ -402,24 +1160,28 @@ index f1f686c..0029bfa 100644
402
1160
  + <>
403
1161
  + <AppRootComponent {...props} />
404
1162
  + <MiaodaHmrOverlay />
1163
+ + <MiaodaDevServerBanner />
1164
+ + <MiaodaHmrCompatibilityBanner />
405
1165
  + </>
406
1166
  + );
407
1167
  }
408
1168
 
409
1169
  if (process.env.NODE_ENV !== 'production') {
410
1170
  diff --git a/src/launch/withDevTools.tsx b/src/launch/withDevTools.tsx
411
- index 5a98062..6a6c3b7 100644
1171
+ index 5a98062..c97b70d 100644
412
1172
  --- a/src/launch/withDevTools.tsx
413
1173
  +++ b/src/launch/withDevTools.tsx
414
- @@ -1,5 +1,7 @@
1174
+ @@ -1,5 +1,9 @@
415
1175
  import * as React from 'react';
416
1176
 
1177
+ +import MiaodaDevServerBanner from './MiaodaDevServerBanner';
417
1178
  +import MiaodaHmrOverlay from './MiaodaHmrOverlay';
1179
+ +import MiaodaHmrCompatibilityBanner from './MiaodaHmrCompatibilityBanner';
418
1180
  +
419
1181
  // Keep the screen awake on Android, we don't use the Fast Refresh overlay here.
420
1182
  // The default behavior here is to skip the custom Fast Refresh indicator.
421
1183
  export function withDevTools<TComponent extends React.ComponentType<any>>(
422
- @@ -18,7 +20,12 @@ export function withDevTools<TComponent extends React.ComponentType<any>>(
1184
+ @@ -18,7 +22,14 @@ export function withDevTools<TComponent extends React.ComponentType<any>>(
423
1185
 
424
1186
  function WithDevTools(props: React.ComponentProps<TComponent>) {
425
1187
  useOptionalKeepAwake();
@@ -428,6 +1190,8 @@ index 5a98062..6a6c3b7 100644
428
1190
  + <>
429
1191
  + <AppRootComponent {...props} />
430
1192
  + <MiaodaHmrOverlay />
1193
+ + <MiaodaDevServerBanner />
1194
+ + <MiaodaHmrCompatibilityBanner />
431
1195
  + </>
432
1196
  + );
433
1197
  }