@swmansion/argent 0.20.1-next.2 → 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.
@@ -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(
@@ -140684,7 +140684,9 @@ var zodSchema54 = external_exports.object({
140684
140684
  component_name: external_exports.string().optional().describe("Component name for by_component mode"),
140685
140685
  time_range_ms: timeRangeSchema.optional().describe("Time range filter for by_time_range mode"),
140686
140686
  commit_index: external_exports.coerce.number().int().optional().describe("Commit index for by_index and cascade_tree modes"),
140687
- top_n: external_exports.coerce.number().int().positive().default(20).describe("Max results to return (default 20)")
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
+ )
140688
140690
  });
140689
140691
  async function getCommitTree(port, deviceId) {
140690
140692
  const sessionPaths = getCachedProfilerPaths(port, deviceId);
@@ -140821,23 +140823,25 @@ function renderByTimeRange(commits, start2, end, topN2) {
140821
140823
  }
140822
140824
  return lines.join("\n");
140823
140825
  }
140824
- function renderByIndex(commits, commitIndex) {
140826
+ function renderByIndex(commits, commitIndex, topN2) {
140825
140827
  const matching = commits.filter((c) => c.commitIndex === commitIndex);
140826
140828
  if (matching.length === 0) {
140827
140829
  return `_Commit #${commitIndex} not found in stored data._`;
140828
140830
  }
140829
140831
  const commitDuration = matching[0].commitDuration;
140830
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;
140831
140836
  const lines = [
140832
- `## Commit #${commitIndex} \u2014 Full Detail`,
140837
+ `## Commit #${commitIndex} \u2014 ${hidden > 0 ? "Top Fibers" : "Full Detail"}`,
140833
140838
  "",
140834
- `**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})` : ""}`,
140835
140840
  "",
140836
140841
  "| Component | Duration (ms) | Self (ms) | Reason | Parent | Compiler |",
140837
140842
  "|---|---|---|---|---|---|"
140838
140843
  ];
140839
- const sorted = [...matching].sort((a, b) => b.actualDuration - a.actualDuration);
140840
- for (const c of sorted) {
140844
+ for (const c of shown) {
140841
140845
  const reason = formatReason2(c);
140842
140846
  const parent = c.parentName ?? "\u2014";
140843
140847
  const compiler = c.isCompilerOptimized ? "\u2713" : "";
@@ -140845,6 +140849,12 @@ function renderByIndex(commits, commitIndex) {
140845
140849
  `| \`${c.componentName}\` | ${c.actualDuration.toFixed(1)} | ${c.selfDuration.toFixed(1)} | ${reason} | \`${parent}\` | ${compiler} |`
140846
140850
  );
140847
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
+ }
140848
140858
  const withRootCause = matching.find((c) => c.rootCauseParent);
140849
140859
  if (withRootCause?.rootCauseChain && withRootCause.rootCauseChain.length > 0) {
140850
140860
  lines.push("");
@@ -140952,7 +140962,7 @@ Fails if react-profiler-stop has not been called or no commit data is stored.`,
140952
140962
  error_kind: "validation"
140953
140963
  });
140954
140964
  }
140955
- return renderByComponent(commitTree.commits, params.component_name, params.top_n);
140965
+ return renderByComponent(commitTree.commits, params.component_name, params.top_n ?? 20);
140956
140966
  }
140957
140967
  case "by_time_range": {
140958
140968
  if (!params.time_range_ms) {
@@ -140967,7 +140977,7 @@ Fails if react-profiler-stop has not been called or no commit data is stored.`,
140967
140977
  commitTree.commits,
140968
140978
  params.time_range_ms.start,
140969
140979
  params.time_range_ms.end,
140970
- params.top_n
140980
+ params.top_n ?? 20
140971
140981
  );
140972
140982
  }
140973
140983
  case "by_index": {
@@ -140979,7 +140989,7 @@ Fails if react-profiler-stop has not been called or no commit data is stored.`,
140979
140989
  error_kind: "validation"
140980
140990
  });
140981
140991
  }
140982
- return renderByIndex(commitTree.commits, params.commit_index);
140992
+ return renderByIndex(commitTree.commits, params.commit_index, params.top_n);
140983
140993
  }
140984
140994
  case "cascade_tree": {
140985
140995
  if (params.commit_index == null) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@swmansion/argent",
3
- "version": "0.20.1-next.2",
3
+ "version": "0.20.1-next.3",
4
4
  "mcpName": "io.github.software-mansion/argent",
5
5
  "description": "MCP server for iOS Simulator and Android Emulator control",
6
6
  "license": "Apache-2.0",