Skip to content

fix(pack): skip ecmascript transforms for URL references#3244

Merged
fireairforce merged 3 commits into
nextfrom
zoomdong/fix-static-url-transform
Jul 17, 2026
Merged

fix(pack): skip ecmascript transforms for URL references#3244
fireairforce merged 3 commits into
nextfrom
zoomdong/fix-static-url-transform

Conversation

@fireairforce

@fireairforce fireairforce commented Jul 16, 2026

Copy link
Copy Markdown
Member

Summary

  • exclude every URL reference subtype from ECMAScript transform rules
  • add a generic dependency snapshot covering service worker and worker new URL(..., import.meta.url) usage from node_modules
  • remove the stale invalid-module-type issue snapshots that the corrected rule no longer emits

Align the bahaviour with next.js turbopack: https://github.com/fireairforce/next.js/blob/canary/crates/next-core/src/next_shared/transforms/mod.rs#L108-L120

Validation

Update the snapshot test case

@gemini-code-assist gemini-code-assist Bot left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Code Review

This pull request updates the JS module rule matching logic in crates/pack-core/src/shared/transforms/mod.rs to match any URL reference type by replacing Some(UrlReferenceSubType::Undefined) with None. Additionally, it removes obsolete error snapshot files and introduces a new snapshot test, foreign_js_new_url, to verify the handling of new URL references in external modules. I have no further feedback to provide as there are no review comments.

Important

The consumer version of Gemini Code Assist on GitHub is being sunset. Starting June 18, 2026, new organization installations will be blocked, and all code review activity will officially cease on July 17, 2026.
For more details on the timeline and next steps, please review the Help Documentation.

@fireairforce
fireairforce marked this pull request as ready for review July 16, 2026 09:16
@github-actions

Copy link
Copy Markdown

📊 Performance Benchmark Report (with-antd)

Utoopack Performance Report

Report ID: utoopack_performance_report_20260716_093656
Generated: 2026-07-16 09:36:56
Trace File: trace_antd.json (0.4GB, 1.13M spans)
Test Project: examples/with-antd


Executive Summary

Metric Value Assessment
Total Wall Time 7,679.4 ms Baseline
Total Thread Work (de-duped) 22,036.0 ms Non-overlapping busy time
Effective Parallelism 2.9x thread_work / wall_time
Working Threads 9 Threads with actual spans
Thread Utilization 31.9% ⚠️ Suboptimal
Total Spans 1,128,144 All B/E + X events
Meaningful Spans (>= 10us) 367,922 (32.6% of total)
Tracing Noise (< 10us) 760,222 (67.4% of total)

Build Phase Timeline

Shows when each build phase is active and how much CPU it consumes.
Self-Time is the time spent exclusively in that phase (excluding children).

Phase Spans Inclusive (ms) Self-Time (ms) Wall Range (ms)
Resolve 95,919 2,758.6 2,146.0 3,838.8
Parse 10,119 1,238.9 1,167.2 7,139.9
Analyze 234,876 13,289.5 9,356.9 7,022.7
Chunk 8,701 3,566.2 1,098.4 2,848.2
Codegen 12,072 1,745.3 1,664.6 2,450.2
Emit 26 39.2 19.4 7.8
Other 6,209 6,497.7 3,745.9 7,679.4

Workload Distribution by Diagnostic Tier

Category Spans Inclusive (ms) % Work Self-Time (ms) % Self
P0: Scheduling & Resolution 333,396 16,463.2 74.7% 11,767.7 53.4%
P1: I/O & Heavy Tasks 2,903 121.5 0.6% 101.8 0.5%
P2: Architecture (Locks/Memory) 0 0.0 0.0% 0.0 0.0%
P3: Asset Pipeline 29,439 6,596.6 29.9% 3,976.5 18.0%
P4: Bridge/Interop 0 0.0 0.0% 0.0 0.0%
Other 2,184 5,953.8 27.0% 3,352.4 15.2%

Top 20 Tasks by Self-Time

Self-time is the exclusive duration: time spent in the task itself, not in sub-tasks.
This is the most accurate indicator of where CPU cycles are actually spent.

Self (ms) Inclusive (ms) Count Avg Self (us) P95 Self (ms) Max Self (ms) % Work Task Name Top Caller
4,919.9 7,036.1 148,659 33.1 0.1 13.1 22.3% module write all entrypoints to disk (1%)
2,090.0 2,129.0 26,006 80.4 0.2 258.7 9.5% analyze ecmascript module module (65%)
2,059.9 2,075.3 25 82395.1 332.2 503.0 9.3% save snapshot persist (4%)
1,366.3 1,497.3 53,101 25.7 0.0 8.9 6.2% internal resolving resolving (29%)
1,286.9 3,035.7 50,957 25.3 0.0 6.0 5.8% process module module (21%)
1,095.2 1,166.9 7,940 137.9 0.5 74.8 5.0% parse ecmascript process module (25%)
940.1 940.1 9,506 98.9 0.4 7.1 4.3% precompute code generation generate merged code (44%)
911.3 3,377.6 6,848 133.1 0.1 62.3 4.1% chunking compute async chunks (0%)
877.0 877.0 6,555 133.8 0.5 146.2 4.0% compute async module info compute merged modules (0%)
823.1 2,432.0 1,879 438.0 1.1 288.9 3.7% generate merged code chunking (52%)
769.4 1,250.9 42,120 18.3 0.0 4.2 3.5% resolving module (32%)
503.2 503.2 329 1529.6 1.5 299.1 2.3% generate source map code generation (83%)
429.0 883.7 175 2451.2 4.2 237.7 1.9% emit code generate merged code (33%)
359.7 507.3 3,593 100.1 0.0 198.4 1.6% write all entrypoints to disk None (0%)
221.3 301.9 2,237 98.9 0.2 50.1 1.0% code generation chunking (12%)
178.4 179.8 1,748 102.0 0.2 35.5 0.8% compute async chunks write all entrypoints to disk (0%)
118.3 118.3 726 162.9 0.0 40.3 0.5% compute binding usage info write all entrypoints to disk (1%)
71.5 71.5 2,168 33.0 0.1 2.7 0.3% read file parse ecmascript (91%)
51.9 51.9 1,913 27.1 0.0 11.9 0.2% collect mergeable modules compute merged modules (2%)
33.7 36.5 432 78.1 0.1 5.0 0.2% async reference write all entrypoints to disk (1%)

Critical Path Analysis

The longest sequential dependency chains that determine wall-clock time.
Focus on reducing the depth of these chains to improve parallelism.

Rank Self-Time (ms) Depth Path
1 526.6 3 chunking → generate merged code → emit code
2 511.2 3 persist → save snapshot → blocking
3 366.5 4 chunking → generate merged code → emit code → generate source map
4 258.8 2 process module → analyze ecmascript module
5 143.5 2 save snapshot → blocking

Batching Candidates

High-volume tasks dominated by a single parent. If the parent can batch them,
it drastically reduces scheduler overhead.

Task Name Count Top Caller (Attribution) Avg Self P95 Self Total Self
No obvious batching candidates found - - - - -

Duration Distribution

Range Count Percentage
<10us 760,222 67.4%
10us-100us 347,097 30.8%
100us-1ms 17,187 1.5%
1ms-10ms 3,510 0.3%
10ms-100ms 109 0.0%
>100ms 19 0.0%

Action Items

  1. [P0] Focus on tasks with the highest Self-Time — these are where CPU cycles are actually spent.
  2. [P0] Use Batching Candidates to identify callers that should use try_join or reduce #[turbo_tasks::function] granularity.
  3. [P1] Check Build Phase Timeline for phases with disproportionate wall range vs. self-time (= serialization).
  4. [P1] Inspect P95 Self (ms) for heavy monolith tasks. Focus on long-tail outliers, not averages.
  5. [P1] Review Critical Paths — reducing the longest chain depth directly improves wall-clock time.
  6. [P2] If Thread Utilization < 60%, investigate scheduling gaps (lock contention or deep dependency chains).

Report generated by Utoopack Performance Analysis Agent

@fireairforce
fireairforce merged commit 616130c into next Jul 17, 2026
47 checks passed
@fireairforce
fireairforce deleted the zoomdong/fix-static-url-transform branch July 17, 2026 02:06
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants