miaoda-expo-devkit 0.1.1-beta.64 → 0.1.1-beta.65
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 +12 -4
- package/dist/metro.d.ts +12 -4
- package/dist/metro.js +10 -2
- package/dist/metro.mjs +10 -2
- package/package.json +1 -1
package/dist/metro.d.mts
CHANGED
|
@@ -111,7 +111,7 @@ declare function withRouteEndpoint(config: MetroConfig, options: RouteEndpointOp
|
|
|
111
111
|
* withDevkit — 一站式 Metro 配置入口
|
|
112
112
|
*
|
|
113
113
|
* 按固定顺序依次应用:
|
|
114
|
-
* withPersistentCache — 将 Metro transform cache
|
|
114
|
+
* withPersistentCache — 将 Metro transform cache 固定到持久目录(优先读取 METRO_CACHE_DIR 环境变量),重启不丢失
|
|
115
115
|
* withWorkspaceNodeModules — 修复沙箱中 node_modules 位于祖先目录时的模块解析问题
|
|
116
116
|
* withWasmSupport — 将 .wasm 加入 assetExts,修复 expo-sqlite web worker 打包失败
|
|
117
117
|
* withCssInterop — 为 expo-image / expo-camera 等注入 NativeWind cssInterop
|
|
@@ -435,11 +435,16 @@ declare function withWasmSupport(config: MetroConfig): MetroConfig;
|
|
|
435
435
|
declare function withTransformLogger(config: MetroConfig): MetroConfig;
|
|
436
436
|
|
|
437
437
|
/**
|
|
438
|
-
* withPersistentCache — 将 Metro transform cache
|
|
438
|
+
* withPersistentCache — 将 Metro transform cache 固定到可持久化目录
|
|
439
439
|
*
|
|
440
440
|
* Metro 默认将 transform cache 写入系统临时目录(os.tmpdir()/metro-cache),
|
|
441
441
|
* 系统随时可以清理,导致每次重启都是冷启动。
|
|
442
|
-
* 此 wrapper 将 cacheStores
|
|
442
|
+
* 此 wrapper 将 cacheStores 替换为指定目录,持久保留。
|
|
443
|
+
*
|
|
444
|
+
* 缓存路径解析优先级(高到低):
|
|
445
|
+
* 1. 环境变量 METRO_CACHE_DIR(绝对路径,适用于容器/CI 挂载外部持久目录)
|
|
446
|
+
* 2. options.cacheDir(绝对路径直接使用;相对路径拼接到 projectRoot)
|
|
447
|
+
* 3. 默认值:projectRoot/.metro-cache
|
|
443
448
|
*
|
|
444
449
|
* cache key 由文件内容 sha1 + 相对路径 + Babel/Metro 版本共同决定,
|
|
445
450
|
* 与项目绝对路径无关,换目录 clone 后缓存同样有效。
|
|
@@ -447,7 +452,10 @@ declare function withTransformLogger(config: MetroConfig): MetroConfig;
|
|
|
447
452
|
|
|
448
453
|
interface PersistentCacheOptions {
|
|
449
454
|
/**
|
|
450
|
-
* cache
|
|
455
|
+
* cache 目录。
|
|
456
|
+
* - 绝对路径:直接使用(适合挂载外部持久目录)
|
|
457
|
+
* - 相对路径:拼接到 projectRoot
|
|
458
|
+
* - 省略:使用环境变量 METRO_CACHE_DIR,否则默认 '.metro-cache'(相对 projectRoot)
|
|
451
459
|
*/
|
|
452
460
|
cacheDir?: string;
|
|
453
461
|
}
|
package/dist/metro.d.ts
CHANGED
|
@@ -111,7 +111,7 @@ declare function withRouteEndpoint(config: MetroConfig, options: RouteEndpointOp
|
|
|
111
111
|
* withDevkit — 一站式 Metro 配置入口
|
|
112
112
|
*
|
|
113
113
|
* 按固定顺序依次应用:
|
|
114
|
-
* withPersistentCache — 将 Metro transform cache
|
|
114
|
+
* withPersistentCache — 将 Metro transform cache 固定到持久目录(优先读取 METRO_CACHE_DIR 环境变量),重启不丢失
|
|
115
115
|
* withWorkspaceNodeModules — 修复沙箱中 node_modules 位于祖先目录时的模块解析问题
|
|
116
116
|
* withWasmSupport — 将 .wasm 加入 assetExts,修复 expo-sqlite web worker 打包失败
|
|
117
117
|
* withCssInterop — 为 expo-image / expo-camera 等注入 NativeWind cssInterop
|
|
@@ -435,11 +435,16 @@ declare function withWasmSupport(config: MetroConfig): MetroConfig;
|
|
|
435
435
|
declare function withTransformLogger(config: MetroConfig): MetroConfig;
|
|
436
436
|
|
|
437
437
|
/**
|
|
438
|
-
* withPersistentCache — 将 Metro transform cache
|
|
438
|
+
* withPersistentCache — 将 Metro transform cache 固定到可持久化目录
|
|
439
439
|
*
|
|
440
440
|
* Metro 默认将 transform cache 写入系统临时目录(os.tmpdir()/metro-cache),
|
|
441
441
|
* 系统随时可以清理,导致每次重启都是冷启动。
|
|
442
|
-
* 此 wrapper 将 cacheStores
|
|
442
|
+
* 此 wrapper 将 cacheStores 替换为指定目录,持久保留。
|
|
443
|
+
*
|
|
444
|
+
* 缓存路径解析优先级(高到低):
|
|
445
|
+
* 1. 环境变量 METRO_CACHE_DIR(绝对路径,适用于容器/CI 挂载外部持久目录)
|
|
446
|
+
* 2. options.cacheDir(绝对路径直接使用;相对路径拼接到 projectRoot)
|
|
447
|
+
* 3. 默认值:projectRoot/.metro-cache
|
|
443
448
|
*
|
|
444
449
|
* cache key 由文件内容 sha1 + 相对路径 + Babel/Metro 版本共同决定,
|
|
445
450
|
* 与项目绝对路径无关,换目录 clone 后缓存同样有效。
|
|
@@ -447,7 +452,10 @@ declare function withTransformLogger(config: MetroConfig): MetroConfig;
|
|
|
447
452
|
|
|
448
453
|
interface PersistentCacheOptions {
|
|
449
454
|
/**
|
|
450
|
-
* cache
|
|
455
|
+
* cache 目录。
|
|
456
|
+
* - 绝对路径:直接使用(适合挂载外部持久目录)
|
|
457
|
+
* - 相对路径:拼接到 projectRoot
|
|
458
|
+
* - 省略:使用环境变量 METRO_CACHE_DIR,否则默认 '.metro-cache'(相对 projectRoot)
|
|
451
459
|
*/
|
|
452
460
|
cacheDir?: string;
|
|
453
461
|
}
|
package/dist/metro.js
CHANGED
|
@@ -561,8 +561,16 @@ var import_path13 = __toESM(require("path"));
|
|
|
561
561
|
var import_metro_cache = require("metro-cache");
|
|
562
562
|
function withPersistentCache(config, options = {}) {
|
|
563
563
|
const projectRoot = config.projectRoot ?? process.cwd();
|
|
564
|
-
const { cacheDir
|
|
565
|
-
const
|
|
564
|
+
const { cacheDir } = options;
|
|
565
|
+
const envCacheDir = process.env["METRO_CACHE_DIR"];
|
|
566
|
+
let cacheRoot;
|
|
567
|
+
if (envCacheDir) {
|
|
568
|
+
cacheRoot = envCacheDir;
|
|
569
|
+
} else if (cacheDir) {
|
|
570
|
+
cacheRoot = import_path13.default.isAbsolute(cacheDir) ? cacheDir : import_path13.default.join(projectRoot, cacheDir);
|
|
571
|
+
} else {
|
|
572
|
+
cacheRoot = import_path13.default.join(projectRoot, ".metro-cache");
|
|
573
|
+
}
|
|
566
574
|
const existingStores = config.cacheStores;
|
|
567
575
|
const firstStore = Array.isArray(existingStores) ? existingStores[0] : void 0;
|
|
568
576
|
const StoreClass = firstStore ? Object.getPrototypeOf(firstStore).constructor : import_metro_cache.FileStore;
|
package/dist/metro.mjs
CHANGED
|
@@ -513,8 +513,16 @@ import path14 from "path";
|
|
|
513
513
|
import { FileStore } from "metro-cache";
|
|
514
514
|
function withPersistentCache(config, options = {}) {
|
|
515
515
|
const projectRoot = config.projectRoot ?? process.cwd();
|
|
516
|
-
const { cacheDir
|
|
517
|
-
const
|
|
516
|
+
const { cacheDir } = options;
|
|
517
|
+
const envCacheDir = process.env["METRO_CACHE_DIR"];
|
|
518
|
+
let cacheRoot;
|
|
519
|
+
if (envCacheDir) {
|
|
520
|
+
cacheRoot = envCacheDir;
|
|
521
|
+
} else if (cacheDir) {
|
|
522
|
+
cacheRoot = path14.isAbsolute(cacheDir) ? cacheDir : path14.join(projectRoot, cacheDir);
|
|
523
|
+
} else {
|
|
524
|
+
cacheRoot = path14.join(projectRoot, ".metro-cache");
|
|
525
|
+
}
|
|
518
526
|
const existingStores = config.cacheStores;
|
|
519
527
|
const firstStore = Array.isArray(existingStores) ? existingStores[0] : void 0;
|
|
520
528
|
const StoreClass = firstStore ? Object.getPrototypeOf(firstStore).constructor : FileStore;
|