miaoda-expo-devkit 0.1.1-beta.45 → 0.1.1-beta.46
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 +21 -7
- package/dist/metro.d.ts +21 -7
- package/dist/metro.js +45 -14
- package/dist/metro.mjs +45 -14
- package/dist/stubs/lgui-control.js +0 -13
- package/oxlint-config.json +2 -1
- package/package.json +1 -5
package/dist/metro.d.mts
CHANGED
|
@@ -339,22 +339,36 @@ declare function withEsbuildMinify(config: MetroConfig): MetroConfig;
|
|
|
339
339
|
declare function withWasmSupport(config: MetroConfig): MetroConfig;
|
|
340
340
|
|
|
341
341
|
/**
|
|
342
|
-
* withTransformLogger — Metro
|
|
342
|
+
* withTransformLogger — Metro bundle 整体耗时日志
|
|
343
343
|
*
|
|
344
|
-
*
|
|
344
|
+
* 通过 unstable_perfLoggerFactory 收集每次 bundle 请求的性能数据,写入 JSONL 文件。
|
|
345
|
+
* 该回调在主进程执行,不受 --max-workers 多进程影响。
|
|
345
346
|
*
|
|
346
347
|
* 激活条件(两者同时满足):
|
|
347
348
|
* 1. 环境变量 METRO_TRANSFORM_LOG 设置为目标文件路径
|
|
348
349
|
* 2. 当前处于开发模式(__DEV__ === true),expo export 生产构建时不记录
|
|
349
350
|
*
|
|
350
|
-
*
|
|
351
|
-
* {
|
|
352
|
-
*
|
|
351
|
+
* 每行格式(一次 bundle 请求写一条):
|
|
352
|
+
* {
|
|
353
|
+
* "type": "BUNDLING_REQUEST", // START_UP | BUNDLING_REQUEST | HMR
|
|
354
|
+
* "status": "SUCCESS", // SUCCESS | FAIL | CANCEL
|
|
355
|
+
* "duration_ms": 1234,
|
|
356
|
+
* "bundle_url": "index.bundle",
|
|
357
|
+
* "initial_build": true, // true=首次构建 false=增量更新
|
|
358
|
+
* "graph_node_count": 220, // 模块数量
|
|
359
|
+
* "bundle_length": 512000, // bundle 字节数
|
|
360
|
+
* "points": { // 各阶段耗时(ms,从 start 计算)
|
|
361
|
+
* "resolvingAndTransformingDependencies_start": 5,
|
|
362
|
+
* "resolvingAndTransformingDependencies_end": 980,
|
|
363
|
+
* "serializingBundle_start": 981,
|
|
364
|
+
* "serializingBundle_end": 1200
|
|
365
|
+
* },
|
|
366
|
+
* "t": 1234567890 // bundle 完成时的时间戳
|
|
367
|
+
* }
|
|
353
368
|
*/
|
|
354
369
|
|
|
355
370
|
/**
|
|
356
|
-
* 在开发模式下,若 METRO_TRANSFORM_LOG
|
|
357
|
-
* 该函数调用时即生效(挂监听器),Metro config 本身无需修改,返回原对象。
|
|
371
|
+
* 在开发模式下,若 METRO_TRANSFORM_LOG 已设置,则注入 unstable_perfLoggerFactory。
|
|
358
372
|
*/
|
|
359
373
|
declare function withTransformLogger(config: MetroConfig): MetroConfig;
|
|
360
374
|
|
package/dist/metro.d.ts
CHANGED
|
@@ -339,22 +339,36 @@ declare function withEsbuildMinify(config: MetroConfig): MetroConfig;
|
|
|
339
339
|
declare function withWasmSupport(config: MetroConfig): MetroConfig;
|
|
340
340
|
|
|
341
341
|
/**
|
|
342
|
-
* withTransformLogger — Metro
|
|
342
|
+
* withTransformLogger — Metro bundle 整体耗时日志
|
|
343
343
|
*
|
|
344
|
-
*
|
|
344
|
+
* 通过 unstable_perfLoggerFactory 收集每次 bundle 请求的性能数据,写入 JSONL 文件。
|
|
345
|
+
* 该回调在主进程执行,不受 --max-workers 多进程影响。
|
|
345
346
|
*
|
|
346
347
|
* 激活条件(两者同时满足):
|
|
347
348
|
* 1. 环境变量 METRO_TRANSFORM_LOG 设置为目标文件路径
|
|
348
349
|
* 2. 当前处于开发模式(__DEV__ === true),expo export 生产构建时不记录
|
|
349
350
|
*
|
|
350
|
-
*
|
|
351
|
-
* {
|
|
352
|
-
*
|
|
351
|
+
* 每行格式(一次 bundle 请求写一条):
|
|
352
|
+
* {
|
|
353
|
+
* "type": "BUNDLING_REQUEST", // START_UP | BUNDLING_REQUEST | HMR
|
|
354
|
+
* "status": "SUCCESS", // SUCCESS | FAIL | CANCEL
|
|
355
|
+
* "duration_ms": 1234,
|
|
356
|
+
* "bundle_url": "index.bundle",
|
|
357
|
+
* "initial_build": true, // true=首次构建 false=增量更新
|
|
358
|
+
* "graph_node_count": 220, // 模块数量
|
|
359
|
+
* "bundle_length": 512000, // bundle 字节数
|
|
360
|
+
* "points": { // 各阶段耗时(ms,从 start 计算)
|
|
361
|
+
* "resolvingAndTransformingDependencies_start": 5,
|
|
362
|
+
* "resolvingAndTransformingDependencies_end": 980,
|
|
363
|
+
* "serializingBundle_start": 981,
|
|
364
|
+
* "serializingBundle_end": 1200
|
|
365
|
+
* },
|
|
366
|
+
* "t": 1234567890 // bundle 完成时的时间戳
|
|
367
|
+
* }
|
|
353
368
|
*/
|
|
354
369
|
|
|
355
370
|
/**
|
|
356
|
-
* 在开发模式下,若 METRO_TRANSFORM_LOG
|
|
357
|
-
* 该函数调用时即生效(挂监听器),Metro config 本身无需修改,返回原对象。
|
|
371
|
+
* 在开发模式下,若 METRO_TRANSFORM_LOG 已设置,则注入 unstable_perfLoggerFactory。
|
|
358
372
|
*/
|
|
359
373
|
declare function withTransformLogger(config: MetroConfig): MetroConfig;
|
|
360
374
|
|
package/dist/metro.js
CHANGED
|
@@ -443,31 +443,62 @@ function withWasmSupport(config) {
|
|
|
443
443
|
// src/metro/withTransformLogger.ts
|
|
444
444
|
var import_node_fs = __toESM(require("fs"));
|
|
445
445
|
var import_node_path = __toESM(require("path"));
|
|
446
|
-
function
|
|
447
|
-
const { Logger } = require("metro-core");
|
|
446
|
+
function installPerfLogger(logFile, existingFactory) {
|
|
448
447
|
const dir = import_node_path.default.dirname(logFile);
|
|
449
448
|
if (!import_node_fs.default.existsSync(dir)) {
|
|
450
449
|
import_node_fs.default.mkdirSync(dir, { recursive: true });
|
|
451
450
|
}
|
|
452
451
|
import_node_fs.default.writeFileSync(logFile, "");
|
|
453
|
-
|
|
454
|
-
|
|
455
|
-
const
|
|
456
|
-
|
|
457
|
-
|
|
458
|
-
|
|
459
|
-
|
|
460
|
-
|
|
461
|
-
|
|
462
|
-
|
|
452
|
+
return (type, opts) => {
|
|
453
|
+
const upstream = existingFactory?.(type, opts) ?? null;
|
|
454
|
+
const startTime = process.hrtime.bigint();
|
|
455
|
+
const points = {};
|
|
456
|
+
const annotations = {};
|
|
457
|
+
const logger = {
|
|
458
|
+
start() {
|
|
459
|
+
upstream?.start?.();
|
|
460
|
+
},
|
|
461
|
+
end(status) {
|
|
462
|
+
const duration_ms = Number(process.hrtime.bigint() - startTime) / 1e6;
|
|
463
|
+
const line = JSON.stringify({
|
|
464
|
+
type,
|
|
465
|
+
status,
|
|
466
|
+
duration_ms: Math.round(duration_ms),
|
|
467
|
+
...annotations,
|
|
468
|
+
points,
|
|
469
|
+
t: Date.now()
|
|
470
|
+
});
|
|
471
|
+
import_node_fs.default.appendFileSync(logFile, line + "\n");
|
|
472
|
+
upstream?.end?.(status);
|
|
473
|
+
},
|
|
474
|
+
annotate(ann) {
|
|
475
|
+
for (const [, kv] of Object.entries(ann)) {
|
|
476
|
+
if (kv && typeof kv === "object") {
|
|
477
|
+
Object.assign(annotations, kv);
|
|
478
|
+
}
|
|
479
|
+
}
|
|
480
|
+
upstream?.annotate?.(ann);
|
|
481
|
+
},
|
|
482
|
+
point(name) {
|
|
483
|
+
points[name] = Math.round(Number(process.hrtime.bigint() - startTime) / 1e6);
|
|
484
|
+
upstream?.point?.(name);
|
|
485
|
+
},
|
|
486
|
+
subSpan(label) {
|
|
487
|
+
return upstream?.subSpan?.(label) ?? logger;
|
|
488
|
+
}
|
|
489
|
+
};
|
|
490
|
+
return logger;
|
|
491
|
+
};
|
|
463
492
|
}
|
|
464
493
|
function withTransformLogger(config) {
|
|
465
494
|
const logFile = process.env["METRO_TRANSFORM_LOG"];
|
|
466
495
|
if (!logFile) return config;
|
|
467
496
|
const isDev = typeof __DEV__ !== "undefined" ? __DEV__ : process.env["NODE_ENV"] !== "production";
|
|
468
497
|
if (!isDev) return config;
|
|
469
|
-
|
|
470
|
-
|
|
498
|
+
return {
|
|
499
|
+
...config,
|
|
500
|
+
unstable_perfLoggerFactory: installPerfLogger(logFile, config.unstable_perfLoggerFactory)
|
|
501
|
+
};
|
|
471
502
|
}
|
|
472
503
|
|
|
473
504
|
// src/metro/withDevkit.ts
|
package/dist/metro.mjs
CHANGED
|
@@ -399,31 +399,62 @@ function withWasmSupport(config) {
|
|
|
399
399
|
// src/metro/withTransformLogger.ts
|
|
400
400
|
import fs4 from "fs";
|
|
401
401
|
import path12 from "path";
|
|
402
|
-
function
|
|
403
|
-
const { Logger } = __require("metro-core");
|
|
402
|
+
function installPerfLogger(logFile, existingFactory) {
|
|
404
403
|
const dir = path12.dirname(logFile);
|
|
405
404
|
if (!fs4.existsSync(dir)) {
|
|
406
405
|
fs4.mkdirSync(dir, { recursive: true });
|
|
407
406
|
}
|
|
408
407
|
fs4.writeFileSync(logFile, "");
|
|
409
|
-
|
|
410
|
-
|
|
411
|
-
const
|
|
412
|
-
|
|
413
|
-
|
|
414
|
-
|
|
415
|
-
|
|
416
|
-
|
|
417
|
-
|
|
418
|
-
|
|
408
|
+
return (type, opts) => {
|
|
409
|
+
const upstream = existingFactory?.(type, opts) ?? null;
|
|
410
|
+
const startTime = process.hrtime.bigint();
|
|
411
|
+
const points = {};
|
|
412
|
+
const annotations = {};
|
|
413
|
+
const logger = {
|
|
414
|
+
start() {
|
|
415
|
+
upstream?.start?.();
|
|
416
|
+
},
|
|
417
|
+
end(status) {
|
|
418
|
+
const duration_ms = Number(process.hrtime.bigint() - startTime) / 1e6;
|
|
419
|
+
const line = JSON.stringify({
|
|
420
|
+
type,
|
|
421
|
+
status,
|
|
422
|
+
duration_ms: Math.round(duration_ms),
|
|
423
|
+
...annotations,
|
|
424
|
+
points,
|
|
425
|
+
t: Date.now()
|
|
426
|
+
});
|
|
427
|
+
fs4.appendFileSync(logFile, line + "\n");
|
|
428
|
+
upstream?.end?.(status);
|
|
429
|
+
},
|
|
430
|
+
annotate(ann) {
|
|
431
|
+
for (const [, kv] of Object.entries(ann)) {
|
|
432
|
+
if (kv && typeof kv === "object") {
|
|
433
|
+
Object.assign(annotations, kv);
|
|
434
|
+
}
|
|
435
|
+
}
|
|
436
|
+
upstream?.annotate?.(ann);
|
|
437
|
+
},
|
|
438
|
+
point(name) {
|
|
439
|
+
points[name] = Math.round(Number(process.hrtime.bigint() - startTime) / 1e6);
|
|
440
|
+
upstream?.point?.(name);
|
|
441
|
+
},
|
|
442
|
+
subSpan(label) {
|
|
443
|
+
return upstream?.subSpan?.(label) ?? logger;
|
|
444
|
+
}
|
|
445
|
+
};
|
|
446
|
+
return logger;
|
|
447
|
+
};
|
|
419
448
|
}
|
|
420
449
|
function withTransformLogger(config) {
|
|
421
450
|
const logFile = process.env["METRO_TRANSFORM_LOG"];
|
|
422
451
|
if (!logFile) return config;
|
|
423
452
|
const isDev = typeof __DEV__ !== "undefined" ? __DEV__ : process.env["NODE_ENV"] !== "production";
|
|
424
453
|
if (!isDev) return config;
|
|
425
|
-
|
|
426
|
-
|
|
454
|
+
return {
|
|
455
|
+
...config,
|
|
456
|
+
unstable_perfLoggerFactory: installPerfLogger(logFile, config.unstable_perfLoggerFactory)
|
|
457
|
+
};
|
|
427
458
|
}
|
|
428
459
|
|
|
429
460
|
// src/metro/withDevkit.ts
|
|
@@ -218,9 +218,6 @@ class EditorController {
|
|
|
218
218
|
case "editor-delete":
|
|
219
219
|
this.deleteActiveNode();
|
|
220
220
|
break;
|
|
221
|
-
case "editor-text-update":
|
|
222
|
-
this.updateActiveNodeText(e);
|
|
223
|
-
break;
|
|
224
221
|
}
|
|
225
222
|
};
|
|
226
223
|
}
|
|
@@ -363,16 +360,6 @@ class EditorController {
|
|
|
363
360
|
this.activeNode = null;
|
|
364
361
|
postToParent("iframe-node-clear");
|
|
365
362
|
}
|
|
366
|
-
/**
|
|
367
|
-
* 更新选中元素的文本内容
|
|
368
|
-
*/
|
|
369
|
-
updateActiveNodeText(e) {
|
|
370
|
-
if (!this.activeNode) return;
|
|
371
|
-
const text = e.data.value;
|
|
372
|
-
if (typeof text !== "string") return;
|
|
373
|
-
const node = this.activeNode;
|
|
374
|
-
node.innerHTML = text;
|
|
375
|
-
}
|
|
376
363
|
}
|
|
377
364
|
let controller = null;
|
|
378
365
|
function onGlobalMessage(e) {
|
package/oxlint-config.json
CHANGED
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "miaoda-expo-devkit",
|
|
3
|
-
"version": "0.1.1-beta.
|
|
3
|
+
"version": "0.1.1-beta.46",
|
|
4
4
|
"description": "Expo 应用开发工具集:Sentry DSN 替换 stub、错误/网络捕获、Metro 符号化",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -83,7 +83,6 @@
|
|
|
83
83
|
"@sentry/react-native": ">=8.0.0",
|
|
84
84
|
"metro": ">=0.80.0",
|
|
85
85
|
"metro-config": ">=0.80.0",
|
|
86
|
-
"metro-core": ">=0.80.0",
|
|
87
86
|
"metro-resolver": ">=0.80.0",
|
|
88
87
|
"nativewind": ">=4.0.0",
|
|
89
88
|
"react-native": ">=0.79.0",
|
|
@@ -103,9 +102,6 @@
|
|
|
103
102
|
"metro-config": {
|
|
104
103
|
"optional": true
|
|
105
104
|
},
|
|
106
|
-
"metro-core": {
|
|
107
|
-
"optional": true
|
|
108
|
-
},
|
|
109
105
|
"metro-resolver": {
|
|
110
106
|
"optional": true
|
|
111
107
|
},
|