@swmansion/argent 0.20.1-next.1 → 0.20.1-next.3
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/tool-server.cjs +62 -18
- package/package.json +1 -1
package/dist/tool-server.cjs
CHANGED
|
@@ -134485,7 +134485,7 @@ function renderCommit(summary, annotations, _sessionContext) {
|
|
|
134485
134485
|
const hiddenCount = (summary.totalComponentCount ?? summary.components.length) - summary.components.length;
|
|
134486
134486
|
if (hiddenCount > 0) {
|
|
134487
134487
|
lines.push(
|
|
134488
|
-
`- _Shown: ${roundedShown}ms self / ${summary.totalRenderMs}ms commit (${coveragePct}%) \u2014 ${hiddenCount} more components not shown. Use \`profiler-commit-query mode=by_index\` to see all._`
|
|
134488
|
+
`- _Shown: ${roundedShown}ms self / ${summary.totalRenderMs}ms commit (${coveragePct}%) \u2014 ${hiddenCount} more components not shown. Use \`profiler-commit-query mode=by_index commit_index=${summary.commitIndex}\` to see all._`
|
|
134489
134489
|
);
|
|
134490
134490
|
} else if (coveragePct < 80) {
|
|
134491
134491
|
lines.push(
|
|
@@ -139038,9 +139038,17 @@ async function analyzeNativeProfilerAndroid(api) {
|
|
|
139038
139038
|
});
|
|
139039
139039
|
}
|
|
139040
139040
|
|
|
139041
|
+
// ../tool-server/src/utils/debugger/device-id-param.ts
|
|
139042
|
+
init_zod();
|
|
139043
|
+
function metroDeviceIdParam(description) {
|
|
139044
|
+
return external_exports.string().min(1, "device_id must not be empty").describe(description).transform((id) => canonicalDeviceId(id) ?? id);
|
|
139045
|
+
}
|
|
139046
|
+
|
|
139041
139047
|
// ../tool-server/src/tools/profiler/native-profiler/native-profiler-start.ts
|
|
139042
139048
|
var zodSchema48 = external_exports.object({
|
|
139043
|
-
device_id:
|
|
139049
|
+
device_id: metroDeviceIdParam(
|
|
139050
|
+
"Target device id from `list-devices` (iOS UDID or Android serial)."
|
|
139051
|
+
),
|
|
139044
139052
|
app_process: external_exports.string().optional().describe(
|
|
139045
139053
|
"iOS: the CFBundleExecutable or display name of the app to profile. Android: the app's package name. If omitted, auto-detects the currently running foreground app. Only provide this if auto-detection picks the wrong app."
|
|
139046
139054
|
),
|
|
@@ -139089,7 +139097,9 @@ Fails if no app is running on the device, or the profiler cannot attach to the p
|
|
|
139089
139097
|
// ../tool-server/src/tools/profiler/native-profiler/native-profiler-stop.ts
|
|
139090
139098
|
init_zod();
|
|
139091
139099
|
var zodSchema49 = external_exports.object({
|
|
139092
|
-
device_id:
|
|
139100
|
+
device_id: metroDeviceIdParam(
|
|
139101
|
+
"Target device id from `list-devices` (iOS UDID or Android serial)."
|
|
139102
|
+
)
|
|
139093
139103
|
});
|
|
139094
139104
|
var capability24 = {
|
|
139095
139105
|
apple: { simulator: true, device: true },
|
|
@@ -139157,7 +139167,9 @@ Fails if no active native-profiler-start session exists for the given device_id.
|
|
|
139157
139167
|
// ../tool-server/src/tools/profiler/native-profiler/native-profiler-analyze.ts
|
|
139158
139168
|
init_zod();
|
|
139159
139169
|
var zodSchema50 = external_exports.object({
|
|
139160
|
-
device_id:
|
|
139170
|
+
device_id: metroDeviceIdParam(
|
|
139171
|
+
"Target device id from `list-devices` (iOS UDID or Android serial)."
|
|
139172
|
+
)
|
|
139161
139173
|
});
|
|
139162
139174
|
var capability25 = {
|
|
139163
139175
|
apple: { simulator: true, device: true },
|
|
@@ -140326,7 +140338,7 @@ var timeWindowSchema = external_exports.object({
|
|
|
140326
140338
|
});
|
|
140327
140339
|
var zodSchema53 = external_exports.object({
|
|
140328
140340
|
port: external_exports.coerce.number().default(8081).describe("Metro server port"),
|
|
140329
|
-
device_id:
|
|
140341
|
+
device_id: metroDeviceIdParam(
|
|
140330
140342
|
"Device logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId)."
|
|
140331
140343
|
),
|
|
140332
140344
|
mode: external_exports.enum(["top_functions", "time_window", "call_tree", "component_cpu"]).describe(
|
|
@@ -140663,7 +140675,7 @@ var timeRangeSchema = external_exports.object({
|
|
|
140663
140675
|
});
|
|
140664
140676
|
var zodSchema54 = external_exports.object({
|
|
140665
140677
|
port: external_exports.coerce.number().default(8081).describe("Metro server port"),
|
|
140666
|
-
device_id:
|
|
140678
|
+
device_id: metroDeviceIdParam(
|
|
140667
140679
|
"Device logicalDeviceId from debugger-connect (iOS simulator UDID or Android logicalDeviceId)."
|
|
140668
140680
|
),
|
|
140669
140681
|
mode: external_exports.enum(["by_component", "by_time_range", "by_index", "cascade_tree"]).describe(
|
|
@@ -140672,7 +140684,9 @@ var zodSchema54 = external_exports.object({
|
|
|
140672
140684
|
component_name: external_exports.string().optional().describe("Component name for by_component mode"),
|
|
140673
140685
|
time_range_ms: timeRangeSchema.optional().describe("Time range filter for by_time_range mode"),
|
|
140674
140686
|
commit_index: external_exports.coerce.number().int().optional().describe("Commit index for by_index and cascade_tree modes"),
|
|
140675
|
-
top_n: external_exports.coerce.number().int().positive().
|
|
140687
|
+
top_n: external_exports.coerce.number().int().positive().optional().describe(
|
|
140688
|
+
"Max results to return. Defaults to 20 for by_component / by_time_range, which count commits. by_index counts individual fibers and returns all of them unless this is set, because one commit's fibers collapse to far fewer distinct components \u2014 a small cap there can show less than the analyze report it is meant to expand on."
|
|
140689
|
+
)
|
|
140676
140690
|
});
|
|
140677
140691
|
async function getCommitTree(port, deviceId) {
|
|
140678
140692
|
const sessionPaths = getCachedProfilerPaths(port, deviceId);
|
|
@@ -140809,23 +140823,25 @@ function renderByTimeRange(commits, start2, end, topN2) {
|
|
|
140809
140823
|
}
|
|
140810
140824
|
return lines.join("\n");
|
|
140811
140825
|
}
|
|
140812
|
-
function renderByIndex(commits, commitIndex) {
|
|
140826
|
+
function renderByIndex(commits, commitIndex, topN2) {
|
|
140813
140827
|
const matching = commits.filter((c) => c.commitIndex === commitIndex);
|
|
140814
140828
|
if (matching.length === 0) {
|
|
140815
140829
|
return `_Commit #${commitIndex} not found in stored data._`;
|
|
140816
140830
|
}
|
|
140817
140831
|
const commitDuration = matching[0].commitDuration;
|
|
140818
140832
|
const timestamp = matching[0].timestamp;
|
|
140833
|
+
const sorted = [...matching].sort((a, b) => b.actualDuration - a.actualDuration);
|
|
140834
|
+
const shown = topN2 !== void 0 ? sorted.slice(0, topN2) : sorted;
|
|
140835
|
+
const hidden = sorted.length - shown.length;
|
|
140819
140836
|
const lines = [
|
|
140820
|
-
`## Commit #${commitIndex} \u2014 Full Detail`,
|
|
140837
|
+
`## Commit #${commitIndex} \u2014 ${hidden > 0 ? "Top Fibers" : "Full Detail"}`,
|
|
140821
140838
|
"",
|
|
140822
|
-
`**Time:** ${timestamp.toFixed(0)}ms **Duration:** ${commitDuration.toFixed(1)}ms **Fibers:** ${matching.length}`,
|
|
140839
|
+
`**Time:** ${timestamp.toFixed(0)}ms **Duration:** ${commitDuration.toFixed(1)}ms **Fibers:** ${matching.length}${hidden > 0 ? ` (showing ${shown.length})` : ""}`,
|
|
140823
140840
|
"",
|
|
140824
140841
|
"| Component | Duration (ms) | Self (ms) | Reason | Parent | Compiler |",
|
|
140825
140842
|
"|---|---|---|---|---|---|"
|
|
140826
140843
|
];
|
|
140827
|
-
const
|
|
140828
|
-
for (const c of sorted) {
|
|
140844
|
+
for (const c of shown) {
|
|
140829
140845
|
const reason = formatReason2(c);
|
|
140830
140846
|
const parent = c.parentName ?? "\u2014";
|
|
140831
140847
|
const compiler = c.isCompilerOptimized ? "\u2713" : "";
|
|
@@ -140833,6 +140849,12 @@ function renderByIndex(commits, commitIndex) {
|
|
|
140833
140849
|
`| \`${c.componentName}\` | ${c.actualDuration.toFixed(1)} | ${c.selfDuration.toFixed(1)} | ${reason} | \`${parent}\` | ${compiler} |`
|
|
140834
140850
|
);
|
|
140835
140851
|
}
|
|
140852
|
+
if (hidden > 0) {
|
|
140853
|
+
lines.push("");
|
|
140854
|
+
lines.push(
|
|
140855
|
+
`_Showing the ${shown.length} costliest of ${sorted.length} fibers \u2014 ${hidden} cheaper fibers hidden. Note these are fibers, not components: the full set covers ${new Set(sorted.map((c) => c.componentName)).size} distinct components and this view covers ${new Set(shown.map((c) => c.componentName)).size}. Omit top_n for everything._`
|
|
140856
|
+
);
|
|
140857
|
+
}
|
|
140836
140858
|
const withRootCause = matching.find((c) => c.rootCauseParent);
|
|
140837
140859
|
if (withRootCause?.rootCauseChain && withRootCause.rootCauseChain.length > 0) {
|
|
140838
140860
|
lines.push("");
|
|
@@ -140940,7 +140962,7 @@ Fails if react-profiler-stop has not been called or no commit data is stored.`,
|
|
|
140940
140962
|
error_kind: "validation"
|
|
140941
140963
|
});
|
|
140942
140964
|
}
|
|
140943
|
-
return renderByComponent(commitTree.commits, params.component_name, params.top_n);
|
|
140965
|
+
return renderByComponent(commitTree.commits, params.component_name, params.top_n ?? 20);
|
|
140944
140966
|
}
|
|
140945
140967
|
case "by_time_range": {
|
|
140946
140968
|
if (!params.time_range_ms) {
|
|
@@ -140955,7 +140977,7 @@ Fails if react-profiler-stop has not been called or no commit data is stored.`,
|
|
|
140955
140977
|
commitTree.commits,
|
|
140956
140978
|
params.time_range_ms.start,
|
|
140957
140979
|
params.time_range_ms.end,
|
|
140958
|
-
params.top_n
|
|
140980
|
+
params.top_n ?? 20
|
|
140959
140981
|
);
|
|
140960
140982
|
}
|
|
140961
140983
|
case "by_index": {
|
|
@@ -140967,7 +140989,7 @@ Fails if react-profiler-stop has not been called or no commit data is stored.`,
|
|
|
140967
140989
|
error_kind: "validation"
|
|
140968
140990
|
});
|
|
140969
140991
|
}
|
|
140970
|
-
return renderByIndex(commitTree.commits, params.commit_index);
|
|
140992
|
+
return renderByIndex(commitTree.commits, params.commit_index, params.top_n);
|
|
140971
140993
|
}
|
|
140972
140994
|
case "cascade_tree": {
|
|
140973
140995
|
if (params.commit_index == null) {
|
|
@@ -140995,7 +141017,7 @@ Fails if react-profiler-stop has not been called or no commit data is stored.`,
|
|
|
140995
141017
|
init_zod();
|
|
140996
141018
|
init_src();
|
|
140997
141019
|
var zodSchema55 = external_exports.object({
|
|
140998
|
-
device_id:
|
|
141020
|
+
device_id: metroDeviceIdParam("iOS Simulator UDID or Android serial."),
|
|
140999
141021
|
mode: external_exports.enum(["hang_stacks", "function_callers", "thread_breakdown", "leak_stacks"]).describe(
|
|
141000
141022
|
"Query mode: hang_stacks (full CPU context during a hang), function_callers (who calls a native function), thread_breakdown (CPU split by thread), leak_stacks (leak details by object type)"
|
|
141001
141023
|
),
|
|
@@ -141325,6 +141347,17 @@ Fails if native-profiler-analyze has not been run or no parsed trace data is in
|
|
|
141325
141347
|
}),
|
|
141326
141348
|
async execute(services, params) {
|
|
141327
141349
|
const api = services.session;
|
|
141350
|
+
if (!api.traceFile && !api.exportedFiles && !api.parsedData) {
|
|
141351
|
+
throw new FailureError(
|
|
141352
|
+
`No native profiler capture is loaded for device \`${params.device_id}\`. Run native-profiler-start \u2192 native-profiler-stop \u2192 native-profiler-analyze on this device first. (If that id came from debugger-connect, pass the id from list-devices instead \u2014 the simulator UDID or adb serial \u2014 since profiler sessions are keyed by that one.)`,
|
|
141353
|
+
{
|
|
141354
|
+
error_code: FAILURE_CODES.PROFILER_DATA_NOT_LOADED,
|
|
141355
|
+
failure_stage: "profiler_stack_query_load_native_data",
|
|
141356
|
+
failure_area: "tool_server",
|
|
141357
|
+
error_kind: "not_found"
|
|
141358
|
+
}
|
|
141359
|
+
);
|
|
141360
|
+
}
|
|
141328
141361
|
if (api.platform === "android") {
|
|
141329
141362
|
return executeAndroid(api, params);
|
|
141330
141363
|
}
|
|
@@ -141370,7 +141403,7 @@ function buildPerfettoAnchor(wallClockStartMs) {
|
|
|
141370
141403
|
// ../tool-server/src/tools/profiler/combined/profiler-combined-report.ts
|
|
141371
141404
|
var zodSchema56 = external_exports.object({
|
|
141372
141405
|
port: external_exports.coerce.number().default(8081).describe("Metro server port"),
|
|
141373
|
-
device_id:
|
|
141406
|
+
device_id: metroDeviceIdParam("iOS Simulator/device UDID or Android serial")
|
|
141374
141407
|
});
|
|
141375
141408
|
var profilerCombinedReportTool = {
|
|
141376
141409
|
id: "profiler-combined-report",
|
|
@@ -141412,6 +141445,17 @@ Fails if either react-profiler-analyze or native-profiler-analyze has not been c
|
|
|
141412
141445
|
}
|
|
141413
141446
|
);
|
|
141414
141447
|
}
|
|
141448
|
+
if (!nativeApi.traceFile && !nativeApi.exportedFiles && !nativeApi.parsedData) {
|
|
141449
|
+
throw new FailureError(
|
|
141450
|
+
`No native profiler capture is loaded for device \`${params.device_id}\`. Run native-profiler-start \u2192 native-profiler-stop \u2192 native-profiler-analyze on this device first. (If that id came from debugger-connect, pass the id from list-devices instead \u2014 the simulator UDID or adb serial \u2014 since profiler sessions are keyed by that one.)`,
|
|
141451
|
+
{
|
|
141452
|
+
error_code: FAILURE_CODES.PROFILER_DATA_NOT_LOADED,
|
|
141453
|
+
failure_stage: "profiler_combined_report_load_native_data",
|
|
141454
|
+
failure_area: "tool_server",
|
|
141455
|
+
error_kind: "not_found"
|
|
141456
|
+
}
|
|
141457
|
+
);
|
|
141458
|
+
}
|
|
141415
141459
|
let uiHangs;
|
|
141416
141460
|
let memoryLeaks;
|
|
141417
141461
|
if (nativeApi.platform === "android") {
|
|
@@ -141704,7 +141748,7 @@ var zodSchema57 = external_exports.object({
|
|
|
141704
141748
|
port: external_exports.coerce.number().default(8081).describe(
|
|
141705
141749
|
"Metro port \u2014 the loaded React data is cached under this port for query tools (default 8081)"
|
|
141706
141750
|
),
|
|
141707
|
-
device_id:
|
|
141751
|
+
device_id: metroDeviceIdParam(
|
|
141708
141752
|
"Target device id from `list-devices`. Used to cache the loaded React session under the correct port+device key, and required to resolve the native profiler session for load_native."
|
|
141709
141753
|
),
|
|
141710
141754
|
app_process: external_exports.string().optional().describe(
|
package/package.json
CHANGED