Skip to content

Conversation

@mattcompiles
Copy link
Contributor

This PR makes the following changes to the node resolver:

  • Refactor all alias logic into a separate alias.rs file
  • Add V3 specific feature unstable_alias which allows you to configure build specific aliases, rather than project wide ones
  • Fixes an issue where aliases could cause circular self references in some cases

unstable_alias

To remove our reliance on custom resolvers, this PR adds a new unstable_alias feature which let's you configure resolver aliases in the .parcelrc. The feature is currently a little half-baked as it's only supported in V3 builds and doesn't support config extending (only the top-level .parcelrc will be used). I've only added it to V3 as you'd have add code to each resolver plugin to make it work and the intention is to move away from custom resolvers, not add to them.

I didn't bother with extension support as this is really just a stepping stone feature before we get to the config file reboot. Outside of this above, the aliasing features should work as exactly the same as the one defined in package.json.

You can also continue to use the package.json ones alongside the unstable_alias ones. You'd want to do this if you have aliases that are actually valid for the whole project.

Checklist

  • Existing or new tests cover this change
  • There is a changeset for this change, or one is not required

@mattcompiles mattcompiles requested a review from a team as a code owner November 20, 2025 06:30
@changeset-bot
Copy link

changeset-bot bot commented Nov 20, 2025

🦋 Changeset detected

Latest commit: f0c7821

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

This PR includes changesets to release 109 packages
Name Type
@atlaspack/core Minor
@atlaspack/rust Minor
@atlaspack/bundler-experimental Patch
@atlaspack/config-default Major
@atlaspack/config-webextension Major
atlaspack Patch
@atlaspack/cli Patch
@atlaspack/register Patch
@atlaspack/test-utils Patch
@atlaspack/inspector Patch
@atlaspack/bundle-stats Patch
@atlaspack/query Patch
@atlaspack/optimizer-image Major
@atlaspack/reporter-bundle-stats Patch
@atlaspack/transformer-html Patch
@atlaspack/transformer-image Major
@atlaspack/transformer-js Major
@atlaspack/inspector-frontend Patch
@atlaspack/bundler-default Patch
@atlaspack/cache Patch
@atlaspack/fs Patch
@atlaspack/logger Patch
@atlaspack/source-map Patch
@atlaspack/utils Patch
@atlaspack/link Patch
@atlaspack/optimizer-inline-requires Patch
@atlaspack/packager-js Patch
@atlaspack/transformer-compiled-css-in-js Patch
@atlaspack/transformer-postcss Patch
@atlaspack/transformer-svg Patch
@atlaspack/transformer-tokens Patch
@atlaspack/node-resolver-core 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-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

self.map.get(specifier)
}

pub fn resolve_alias(&self, specifier: &Specifier) -> Option<Cow<'_, AliasValue>> {
Copy link
Contributor Author

Choose a reason for hiding this comment

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

The diff makes this look like all new code but it's just mostly moved from package_json.rs

&& path == self.from
{
// Don't resolve alias that points to itself.
return Ok(None);
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This is the circular self reference fix

@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

📊 Type Coverage Report

Coverage Comparison

Metric Baseline Current Change
Coverage Percentage 92.06% 92.06% ➡️ 0.00%
Correctly Typed 202,796 202,834 +38
Total Expressions 220,268 220,308 +40
Untyped Expressions 17,472 17,474 +2

Files with Most Type Issues (Top 15)

File Issues Affected Lines
packages/core/integration-tests/test/javascript.ts 983 648
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/react-refresh.ts 197 71
packages/core/integration-tests/test/css-modules.ts 191 107
packages/core/core/src/requests/TargetRequest.ts 190 133
packages/core/integration-tests/test/babel.ts 187 115

This report was generated by the Type Coverage GitHub Action

@github-actions
Copy link
Contributor

github-actions bot commented Nov 20, 2025

📊 Benchmark Results

🎉 Performance improvements detected!

📊 Benchmark Results

Overall Performance

Test Duration JS Memory Peak Native Memory Peak vs Baseline Status
Three.js Real Repository (JS) 17.22s 1.80GB 1.92GB +1.14% duration, -6.89% JS memory 🟡 Neutral
Three.js Real Repository (Native) 30.96s 3.32GB 3.58GB -14.68% duration, -11.74% JS memory 🟢 Improvement

🔍 Detailed Phase Analysis

Three.js Real Repository (JS)

Phase Duration (avg) Duration (p95) Memory Peak (avg) Memory Peak (p95)
resolving 9.05s 9.46s 1.19GB 1.29GB
transforming 9.03s 9.46s 1.19GB 1.29GB
bundling 8.80s 9.22s 1.19GB 1.30GB
bundled 8.36s 8.82s 1.28GB 1.39GB
packaging 6.07s 6.34s 1.40GB 1.52GB
optimizing 5.88s 6.15s 1.80GB 1.87GB

Three.js Real Repository (Native)

Phase Duration (avg) Duration (p95) Memory Peak (avg) Memory Peak (p95)
bundling 18.80s 22.13s 2.53GB 2.81GB
bundled 18.37s 21.67s 2.70GB 2.99GB
packaging 7.95s 8.33s 2.91GB 3.21GB
optimizing 7.82s 8.19s 3.32GB 3.58GB

💾 Unified Memory Analysis

Three.js Real Repository (JS) Memory Statistics

Memory Type Metric Min Mean Median P95 P99 Max Std Dev
JavaScript RSS 1.31GB 1.61GB 1.71GB 1.87GB 1.87GB 1.87GB 215.08MB
Heap Used 79.83MB 89.99MB 93.20MB 104.42MB 104.42MB 104.42MB 10.37MB
Heap Total 95.85MB 118.82MB 139.33MB 141.64MB 141.64MB 141.64MB 21.43MB
External 38.94MB 106.03MB 173.09MB 173.09MB 173.09MB 173.09MB 67.05MB
Native (Rust) Physical Memory 1.21GB 1.45GB 1.44GB 1.73GB 1.86GB 1.92GB 181.32MB
Virtual Memory 30.01GB 30.74GB 30.80GB 31.00GB 31.15GB 31.22GB 206.81MB

Sample Counts: JS: 6, Native: 284

Three.js Real Repository (Native) Memory Statistics

Memory Type Metric Min Mean Median P95 P99 Max Std Dev
JavaScript RSS 2.56GB 3.07GB 3.09GB 3.58GB 3.58GB 3.58GB 339.59MB
Heap Used 76.94MB 77.27MB 77.24MB 77.65MB 77.65MB 77.65MB 0.24MB
Heap Total 86.20MB 92.11MB 90.70MB 99.20MB 99.20MB 99.20MB 4.93MB
External 179.53MB 182.44MB 185.32MB 185.34MB 185.34MB 185.34MB 2.89MB
Native (Rust) Physical Memory 2.63GB 2.94GB 3.01GB 3.35GB 3.58GB 3.58GB 229.81MB
Virtual Memory 30.69GB 33.29GB 33.40GB 33.77GB 33.97GB 33.97GB 542.13MB

Sample Counts: JS: 6, Native: 648

🖥️ Environment

  • Node.js: v22.17.0
  • Platform: linux (x64)
  • CPU: AMD EPYC 7763 64-Core Processor
  • Total Memory: 15.62GB
  • Git SHA: f0c7821
  • Branch: matt/configurable-alias
  • Timestamp: 2025-11-24T22:11:44.391Z

Copy link
Contributor

@marcins marcins left a comment

Choose a reason for hiding this comment

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

LGTM!

@mattcompiles mattcompiles merged commit a884bd2 into main Nov 24, 2025
26 checks passed
@mattcompiles mattcompiles deleted the matt/configurable-alias branch November 24, 2025 23:47
@atlaspack-ci atlaspack-ci bot mentioned this pull request Nov 25, 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.

3 participants