miaoda-expo-devkit 0.1.1-beta.71 → 0.1.1-beta.73

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/dist/metro.d.mts CHANGED
@@ -448,11 +448,23 @@ declare function withWasmSupport(config: MetroConfig): MetroConfig;
448
448
  declare function withTransformLogger(config: MetroConfig): MetroConfig;
449
449
 
450
450
  /**
451
- * withPersistentCache — 将 Metro transform cache 固定到可持久化目录
451
+ * withPersistentCache — 将 Metro transform cache 和 FileMap cache 固定到可持久化目录
452
452
  *
453
- * Metro 默认将 transform cache 写入系统临时目录(os.tmpdir()/metro-cache),
454
- * 系统随时可以清理,导致每次重启都是冷启动。
455
- * 此 wrapper 将 cacheStores 替换为指定目录,持久保留。
453
+ * Metro 默认将两套缓存写入系统临时目录(os.tmpdir()),系统随时可以清理,
454
+ * 导致每次重启都是冷启动。此 wrapper 将它们统一固定到同一个持久化目录。
455
+ *
456
+ * 【两套缓存的作用】
457
+ * transform cache(cacheStores)
458
+ * — JS/TS 编译结果,命中后跳过 Babel transform,节省 bundling 时间。
459
+ * FileMap cache(fileMapCacheDirectory)
460
+ * — 文件系统索引快照 + Watchman clock。命中后:
461
+ * · 有 Watchman:Metro 发 since=<clock> 增量查询,只拿变化文件,O(changes)。
462
+ * · 无 Watchman:跳过 mtime 未变文件的重新处理,减少 hash/resolve 工作量。
463
+ * 两种情况都能显著加快 Metro 冷启动速度。
464
+ *
465
+ * 【autoSaveCache】
466
+ * 运行时每隔 debounceMs(默认 5s)将 FileMap cache 写回磁盘,保证进程意外退出
467
+ * 后下次启动仍能命中缓存(默认只在正常关闭时写入)。
456
468
  *
457
469
  * 缓存路径解析优先级(高到低):
458
470
  * 1. 环境变量 METRO_CACHE_DIR(绝对路径,适用于容器/CI 挂载外部持久目录)
@@ -466,7 +478,7 @@ declare function withTransformLogger(config: MetroConfig): MetroConfig;
466
478
  * {
467
479
  * "type": "CACHE_CONFIG",
468
480
  * "cache_root": "/workspace/.metro-cache",
469
- * "store_class": "ExpoFileStore", // 生效的 store 类名
481
+ * "store_class": "ExpoFileStore",
470
482
  * "source": "env" | "option" | "default",
471
483
  * "t": 1234567890
472
484
  * }
package/dist/metro.d.ts CHANGED
@@ -448,11 +448,23 @@ declare function withWasmSupport(config: MetroConfig): MetroConfig;
448
448
  declare function withTransformLogger(config: MetroConfig): MetroConfig;
449
449
 
450
450
  /**
451
- * withPersistentCache — 将 Metro transform cache 固定到可持久化目录
451
+ * withPersistentCache — 将 Metro transform cache 和 FileMap cache 固定到可持久化目录
452
452
  *
453
- * Metro 默认将 transform cache 写入系统临时目录(os.tmpdir()/metro-cache),
454
- * 系统随时可以清理,导致每次重启都是冷启动。
455
- * 此 wrapper 将 cacheStores 替换为指定目录,持久保留。
453
+ * Metro 默认将两套缓存写入系统临时目录(os.tmpdir()),系统随时可以清理,
454
+ * 导致每次重启都是冷启动。此 wrapper 将它们统一固定到同一个持久化目录。
455
+ *
456
+ * 【两套缓存的作用】
457
+ * transform cache(cacheStores)
458
+ * — JS/TS 编译结果,命中后跳过 Babel transform,节省 bundling 时间。
459
+ * FileMap cache(fileMapCacheDirectory)
460
+ * — 文件系统索引快照 + Watchman clock。命中后:
461
+ * · 有 Watchman:Metro 发 since=<clock> 增量查询,只拿变化文件,O(changes)。
462
+ * · 无 Watchman:跳过 mtime 未变文件的重新处理,减少 hash/resolve 工作量。
463
+ * 两种情况都能显著加快 Metro 冷启动速度。
464
+ *
465
+ * 【autoSaveCache】
466
+ * 运行时每隔 debounceMs(默认 5s)将 FileMap cache 写回磁盘,保证进程意外退出
467
+ * 后下次启动仍能命中缓存(默认只在正常关闭时写入)。
456
468
  *
457
469
  * 缓存路径解析优先级(高到低):
458
470
  * 1. 环境变量 METRO_CACHE_DIR(绝对路径,适用于容器/CI 挂载外部持久目录)
@@ -466,7 +478,7 @@ declare function withTransformLogger(config: MetroConfig): MetroConfig;
466
478
  * {
467
479
  * "type": "CACHE_CONFIG",
468
480
  * "cache_root": "/workspace/.metro-cache",
469
- * "store_class": "ExpoFileStore", // 生效的 store 类名
481
+ * "store_class": "ExpoFileStore",
470
482
  * "source": "env" | "option" | "default",
471
483
  * "t": 1234567890
472
484
  * }
package/dist/metro.js CHANGED
@@ -615,7 +615,15 @@ function withPersistentCache(config, options = {}) {
615
615
  }
616
616
  return {
617
617
  ...config,
618
+ // transform cache:JS/TS 编译结果
618
619
  cacheStores: [new StoreClass({ root: cacheRoot })]
620
+ // FileMap cache 暂时禁用:pnpm install 每次重建 symlink 导致 30839 fake changes,
621
+ // 加载旧缓存反而比冷启动更慢,触发 120s 超时。
622
+ // fileMapCacheDirectory: cacheRoot,
623
+ // watcher: {
624
+ // ...config.watcher,
625
+ // unstable_autoSaveCache: { enabled: true },
626
+ // },
619
627
  };
620
628
  }
621
629
 
package/dist/metro.mjs CHANGED
@@ -566,7 +566,15 @@ function withPersistentCache(config, options = {}) {
566
566
  }
567
567
  return {
568
568
  ...config,
569
+ // transform cache:JS/TS 编译结果
569
570
  cacheStores: [new StoreClass({ root: cacheRoot })]
571
+ // FileMap cache 暂时禁用:pnpm install 每次重建 symlink 导致 30839 fake changes,
572
+ // 加载旧缓存反而比冷启动更慢,触发 120s 超时。
573
+ // fileMapCacheDirectory: cacheRoot,
574
+ // watcher: {
575
+ // ...config.watcher,
576
+ // unstable_autoSaveCache: { enabled: true },
577
+ // },
570
578
  };
571
579
  }
572
580
 
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "miaoda-expo-devkit",
3
- "version": "0.1.1-beta.71",
3
+ "version": "0.1.1-beta.73",
4
4
  "description": "Expo 应用开发工具集:Sentry DSN 替换 stub、错误/网络捕获、Metro 符号化",
5
5
  "license": "MIT",
6
6
  "main": "./dist/index.js",