Skip to content

Conversation

@OscarCookeAbbott
Copy link
Contributor

@OscarCookeAbbott OscarCookeAbbott commented Nov 24, 2025

Motivation

We are replacing various old Babel transformers with native reimplementations for performance and maintenance reasons.

Changes

  • Implement new react_async_import_lift transformer
  • Hook up the new transformer with correct ordering in lib.rs

Checklist

  • Existing or new tests cover this change
  • There is a changeset for this change, or one is not required
  • Added documentation for any new features to the docs/ folder

OscarCookeAbbott and others added 30 commits October 14, 2025 11:30
Hook up transformer using env to enable/disable
Hook up transformer using env to enable/disable
Hook up transformer using env to enable/disable
Implement new `unused_bindings_remover` transformer
Hook up transformers using env to enable/disable
Refactor and clean up `unused_bindings_remover`
Add a lot more tests
@changeset-bot
Copy link

changeset-bot bot commented Nov 24, 2025

🦋 Changeset detected

Latest commit: 24f5fc1

The changes in this PR will be included in the next version bump.

This PR includes changesets to release 110 packages
Name Type
@atlaspack/transformer-js Minor
@atlaspack/rust Minor
@atlaspack/config-default Patch
atlaspack Patch
@atlaspack/bundler-experimental Patch
@atlaspack/bundler-default Patch
@atlaspack/cache Patch
@atlaspack/core Patch
@atlaspack/fs Patch
@atlaspack/logger Patch
@atlaspack/source-map Patch
@atlaspack/utils Patch
@atlaspack/link Patch
@atlaspack/optimizer-image Patch
@atlaspack/optimizer-inline-requires Patch
@atlaspack/packager-js Patch
@atlaspack/transformer-compiled-css-in-js Patch
@atlaspack/transformer-html Patch
@atlaspack/transformer-postcss Patch
@atlaspack/transformer-svg Patch
@atlaspack/transformer-tokens Patch
@atlaspack/node-resolver-core Patch
@atlaspack/config-webextension Patch
@atlaspack/cli Patch
@atlaspack/register Patch
@atlaspack/test-utils Patch
@atlaspack/inspector Patch
@atlaspack/query Patch
@atlaspack/bundle-stats Patch
@atlaspack/reporter-bundle-stats Patch
@atlaspack/transformer-image Patch
@atlaspack/inspector-frontend Patch
@atlaspack/package-manager Patch
@atlaspack/profiler Patch
@atlaspack/workers Patch
@atlaspack/watcher-watchman-js Patch
@atlaspack/types-internal Patch
@atlaspack/optimizer-css Patch
@atlaspack/optimizer-cssnano Patch
@atlaspack/optimizer-swc Patch
@atlaspack/optimizer-terser Patch
@atlaspack/packager-css Patch
@atlaspack/transformer-babel Patch
@atlaspack/transformer-css Patch
@atlaspack/transformer-less Patch
@atlaspack/transformer-sass Patch
@atlaspack/transformer-typescript-tsc Patch
@atlaspack/transformer-typescript-types Patch
@atlaspack/optimizer-blob-url Patch
@atlaspack/optimizer-data-url Patch
@atlaspack/optimizer-svgo Patch
@atlaspack/packager-html Patch
@atlaspack/packager-raw-url Patch
@atlaspack/packager-svg Patch
@atlaspack/packager-webextension Patch
@atlaspack/packager-xml Patch
@atlaspack/reporter-build-metrics Patch
@atlaspack/reporter-bundle-analyzer Patch
@atlaspack/reporter-cli Patch
@atlaspack/reporter-dev-server-sw Patch
@atlaspack/reporter-dev-server Patch
@atlaspack/reporter-json Patch
@atlaspack/reporter-lsp Patch
@atlaspack/reporter-sourcemap-visualiser Patch
@atlaspack/reporter-tracer Patch
@atlaspack/resolver-glob Patch
@atlaspack/runtime-browser-hmr Patch
@atlaspack/runtime-js Patch
@atlaspack/runtime-react-refresh Patch
@atlaspack/runtime-service-worker Patch
@atlaspack/runtime-webextension Patch
@atlaspack/transformer-posthtml Patch
@atlaspack/transformer-react-refresh-wrap Patch
@atlaspack/transformer-webextension Patch
@atlaspack/transformer-webmanifest Patch
@atlaspack/validator-eslint Patch
@atlaspack/validator-typescript Patch
@atlaspack/resolver-default Patch
@atlaspack/resolver-tesseract Patch
@atlaspack/types Patch
@atlaspack/codeframe Patch
@atlaspack/graph Patch
@atlaspack/plugin Patch
@atlaspack/reporter-bundle-buddy Patch
@atlaspack/transformer-xml Patch
@atlaspack/ts-utils Patch
@atlaspack/packager-ts Patch
@atlaspack/transformer-jsonld Patch
@atlaspack/bundler-library Patch
@atlaspack/compressor-brotli Patch
@atlaspack/compressor-gzip Patch
@atlaspack/compressor-raw Patch
@atlaspack/namer-default Patch
@atlaspack/optimizer-htmlnano Patch
@atlaspack/packager-raw Patch
@atlaspack/packager-wasm Patch
@atlaspack/reporter-compiled-css-in-js-migration-map Patch
@atlaspack/reporter-conditional-manifest Patch
@atlaspack/transformer-glsl Patch
@atlaspack/transformer-graphql Patch
@atlaspack/transformer-inline-string Patch
@atlaspack/transformer-inline Patch
@atlaspack/transformer-json Patch
@atlaspack/transformer-mdx Patch
@atlaspack/transformer-pug Patch
@atlaspack/transformer-raw Patch
@atlaspack/transformer-svg-react Patch
@atlaspack/transformer-toml Patch
@atlaspack/transformer-worklet Patch
@atlaspack/transformer-yaml Patch

Not sure what this means? Click here to learn what changesets are.

Click here if you're a maintainer who wants to add another changeset to this PR

@github-actions
Copy link
Contributor

github-actions bot commented Nov 24, 2025

Rust Package Changeset Check

✅ The @atlaspack/rust package has been included in your changeset. Your Rust changes will be published.

@github-actions
Copy link
Contributor

github-actions bot commented Nov 24, 2025

📊 Type Coverage Report

Coverage Comparison

Metric Baseline Current Change
Coverage Percentage 92.09% 92.09% ➡️ 0.00%
Correctly Typed 203,647 203,674 +27
Total Expressions 221,139 221,166 +27
Untyped Expressions 17,492 17,492 +0

Files with Most Type Issues (Top 15)

File Issues Affected Lines
packages/core/integration-tests/test/javascript.ts 999 658
packages/core/integration-tests/test/cache.ts 885 626
packages/core/integration-tests/test/scope-hoisting.ts 623 490
packages/utils/node-resolver-core/test/resolver.ts 476 177
packages/core/integration-tests/test/html.ts 468 294
packages/core/integration-tests/test/sourcemaps.ts 356 176
packages/core/test-utils/src/utils.ts 330 205
packages/core/integration-tests/test/incremental-bundling.ts 298 206
packages/core/core/src/dumpGraphToGraphViz.ts 251 108
packages/core/integration-tests/test/output-formats.ts 227 161
packages/transformers/webextension/src/WebExtensionTransformer.ts 210 80
packages/core/integration-tests/test/css-modules.ts 191 107
packages/core/core/src/requests/TargetRequest.ts 190 133
packages/core/integration-tests/test/react-refresh.ts 188 65
packages/core/integration-tests/test/babel.ts 187 115

This report was generated by the Type Coverage GitHub Action

@marcins
Copy link
Contributor

marcins commented Nov 25, 2025

You've got a bunch of Clippy errors to resolve, and you'll need to merge in main to pick up the temp cache removal for Github Actions to make macOS builds work.

Base automatically changed from oscar/js-transformer/rest-of-the-owl to main November 27, 2025 02:56
@OscarCookeAbbott OscarCookeAbbott marked this pull request as ready for review November 27, 2025 03:09
@OscarCookeAbbott OscarCookeAbbott requested a review from a team as a code owner November 27, 2025 03:09
@OscarCookeAbbott OscarCookeAbbott enabled auto-merge (squash) November 27, 2025 03:10
@@ -437,7 +436,7 @@ pub fn transform(
unresolved_mark,
&config.sync_dynamic_import_config,
)),
config.is_tesseract && config.sync_dynamic_import_config.is_some()),
config.sync_dynamic_import_config.is_some()),
Copy link
Contributor

Choose a reason for hiding this comment

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

Was the config.is_tesseract since I last reviewed removed intentionally?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yeah it was from a prior version of Nathan's branch that he later changed, when I merged in main after that Git didn't know that had happened so it and a few other random lines hung around that I have just now realised and removed.

@@ -124,15 +124,15 @@ impl ReactAsyncImportLift {
});

// Replace import() with the lifted identifier in the expression tree
self.replace_import_with_ident(expr, &lifted_id);
Self::replace_import_with_ident(expr, &lifted_id);
Copy link
Contributor

Choose a reason for hiding this comment

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

What is the reason for this change from self. to Self::? Is it some "method doesn't actually use self so can be static" check?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Yep. The &self function params in a few functions were redundant since I had changed how the functions worked but had forgotten to remove them.

@github-actions
Copy link
Contributor

📊 Benchmark Results

No significant performance changes detected.

📊 Benchmark Results

Overall Performance

Test Duration JS Memory Peak Native Memory Peak vs Baseline Status
Three.js Real Repository (JS) 17.02s 2.04GB 2.30GB N/A ⚪ New
Three.js Real Repository (V3) 28.14s 3.67GB 4.17GB N/A ⚪ New

🔍 Detailed Phase Analysis

Three.js Real Repository (JS)

Phase Duration (avg) Duration (p95) Memory Peak (avg) Memory Peak (p95)
resolving 9.08s 9.55s 1.46GB 1.79GB
transforming 9.07s 9.55s 1.46GB 1.79GB
bundling 8.87s 9.36s 1.46GB 1.79GB
bundled 8.46s 8.95s 1.56GB 1.87GB
packaging 6.16s 6.53s 1.68GB 1.96GB
optimizing 6.00s 6.33s 2.04GB 2.26GB

Three.js Real Repository (V3)

Phase Duration (avg) Duration (p95) Memory Peak (avg) Memory Peak (p95)
bundling 18.30s 26.35s 2.91GB 3.44GB
bundled 17.87s 25.79s 3.09GB 3.62GB
packaging 8.12s 8.42s 3.26GB 3.82GB
optimizing 7.97s 8.30s 3.67GB 4.17GB

💾 Unified Memory Analysis

Three.js Real Repository (JS) Memory Statistics

Memory Type Metric Min Mean Median P95 P99 Max Std Dev
JavaScript RSS 1.48GB 1.86GB 1.93GB 2.26GB 2.26GB 2.26GB 241.08MB
Heap Used 80.29MB 87.25MB 83.57MB 99.63MB 99.63MB 99.63MB 7.12MB
Heap Total 102.60MB 134.32MB 132.10MB 178.60MB 178.60MB 178.60MB 22.16MB
External 38.89MB 105.97MB 173.03MB 173.03MB 173.03MB 173.03MB 67.06MB
Native (Rust) Physical Memory 1.72GB 1.91GB 1.91GB 2.13GB 2.26GB 2.30GB 133.97MB
Virtual Memory 30.26GB 30.93GB 30.94GB 31.15GB 31.25GB 31.36GB 161.73MB

Sample Counts: JS: 14, Native: 284

Three.js Real Repository (V3) Memory Statistics

Memory Type Metric Min Mean Median P95 P99 Max Std Dev
JavaScript RSS 2.53GB 3.42GB 3.50GB 4.17GB 4.17GB 4.17GB 462.99MB
Heap Used 77.26MB 77.94MB 77.96MB 78.31MB 78.31MB 78.31MB 0.27MB
Heap Total 85.20MB 90.05MB 89.45MB 102.45MB 102.45MB 102.45MB 4.68MB
External 179.72MB 182.61MB 185.50MB 185.50MB 185.50MB 185.50MB 2.89MB
Native (Rust) Physical Memory 3.31GB 3.60GB 3.64GB 3.92GB 4.17GB 4.17GB 209.32MB
Virtual Memory 30.99GB 33.48GB 33.80GB 34.11GB 34.35GB 34.35GB 865.09MB

Sample Counts: JS: 14, Native: 538

🖥️ Environment

  • Node.js: v22.17.0
  • Platform: linux (x64)
  • CPU: AMD EPYC 7763 64-Core Processor
  • Total Memory: 15.62GB
  • Git SHA: 24f5fc1
  • Branch: oscar/js-transformer/react-async-import-lift
  • Timestamp: 2025-11-27T03:29:59.625Z

@OscarCookeAbbott OscarCookeAbbott merged commit 308e7ff into main Nov 27, 2025
27 checks passed
@OscarCookeAbbott OscarCookeAbbott deleted the oscar/js-transformer/react-async-import-lift branch November 27, 2025 04:05
@atlaspack-ci atlaspack-ci bot mentioned this pull request Nov 27, 2025
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.

4 participants