Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Trace output's source maps through input's source map #6494

Merged
merged 9 commits into from
Dec 14, 2023

Conversation

jridgewell
Copy link
Contributor

@jridgewell jridgewell commented Nov 17, 2023

Description

This preserves an input file's original source map so that the transformed output source map can be traced through it.

Testing Instructions

Closes PACK-1980
Closes PACK-537

Copy link

vercel bot commented Nov 17, 2023

The latest updates on your projects. Learn more about Vercel for Git ↗︎

Name Status Preview Comments Updated (UTC)
examples-native-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Dec 14, 2023 0:13am
examples-tailwind-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Dec 14, 2023 0:13am
examples-vite-web 🔄 Building (Inspect) Visit Preview 💬 Add feedback Dec 14, 2023 0:13am
rust-docs ❌ Failed (Inspect) Dec 14, 2023 0:13am
8 Ignored Deployments
Name Status Preview Comments Updated (UTC)
examples-basic-web ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 0:13am
examples-cra-web ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 0:13am
examples-designsystem-docs ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 0:13am
examples-gatsby-web ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 0:13am
examples-kitchensink-blog ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 0:13am
examples-nonmonorepo ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 0:13am
examples-svelte-web ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 0:13am
turbo-site ⬜️ Ignored (Inspect) Visit Preview Dec 14, 2023 0:13am

Copy link
Contributor

✅ This change can build next-swc

Copy link
Contributor

github-actions bot commented Nov 17, 2023

🟢 CI successful 🟢

Thanks

Copy link
Contributor

github-actions bot commented Nov 17, 2023

🟢 Turbopack Benchmark CI successful 🟢

Thanks

Comment on lines 73 to +74
/// Confusingly, SWC's SourceMap is not a mapping of transformed locations
/// to source locations. I don't know what it is, really, but it's not
/// that.
/// to source locations. It's a map of filesnames to file contents.
Copy link
Member

Choose a reason for hiding this comment

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

🤣

/// original tokens. Useful for cases like mapping tokens from a minified
/// chunk back to its original sources.
#[turbo_tasks::function]
pub async fn trace(self: Vc<Self>, other: Vc<SourceMap>) -> Result<Vc<SourceMap>> {
Copy link
Member

Choose a reason for hiding this comment

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

Don't we need that for the next.js source map resolving from the error overlay?

Comment on lines +232 to +238
let mut source_map = None;
for map in self.source_maps {
if let Some(map) = &*map.await? {
source_map = Some(map.resolve().await?);
break;
}
}
Copy link
Member

Choose a reason for hiding this comment

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

Why are we collecting multiple Source Maps, when we only use the first one?

And: Should be use the last one instead?

Copy link
Contributor

github-actions bot commented Dec 5, 2023

Linux Benchmark for 4f979f0

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 21.44ms ± 0.83ms 21.46ms ± 0.85ms +0.07%
bench_hmr_to_eval/Turbopack CSR/1000 modules 21.06ms ± 0.83ms 21.16ms ± 0.85ms +0.48%
bench_startup/Turbopack CSR/1000 modules 1096.88ms ± 3.52ms 1085.73ms ± 9.46ms -1.02%

Copy link
Contributor

github-actions bot commented Dec 6, 2023

Linux Benchmark for f3d351f

Click to view benchmark
Test Base PR % Significant %
bench_hmr_to_commit/Turbopack CSR/1000 modules 24.54ms ± 0.81ms 24.54ms ± 0.79ms -0.01%
bench_hmr_to_eval/Turbopack CSR/1000 modules 24.15ms ± 0.77ms 24.51ms ± 0.65ms +1.49%
bench_startup/Turbopack CSR/1000 modules 1377.99ms ± 3.14ms 1386.39ms ± 17.41ms +0.61%

@wbinnssmith wbinnssmith merged commit 000d264 into main Dec 14, 2023
52 of 53 checks passed
@wbinnssmith wbinnssmith deleted the jrl-input-source-map branch December 14, 2023 19:25
kdy1 added a commit to vercel/next.js that referenced this pull request Jan 2, 2024
### What?

Update SWC crates

### Why?

It's required to fix some next.js isssues

### How?

Closes PACK-2174
Turbopack counterpart: vercel/turborepo#6843

---


# Turbopack

* vercel/turborepo#6737 <!-- Nicholas Yang - feat:
Nice errors for shim flag parsing -->
* vercel/turborepo#6494 <!-- Justin Ridgewell -
Trace output's source maps through input's source map -->
* vercel/turborepo#6778 <!-- Will Binns-Smith -
turbopack-css: fix rule duplication -->
* vercel/turborepo#6807 <!-- Mehul Kar - fix: add
missing dependency to cargo lockfile -->
* vercel/turborepo#6809 <!-- Nicholas Yang -
refactor: Remove bookkeeping abstraction from turbo config -->
* vercel/turborepo#6838 <!-- Nicholas Yang - fix:
Allow for long symlinks by using append_link -->
* vercel/turborepo#6845 <!-- Donny/강동윤 - perf: Use
`&'static str` instead of `String` if possible -->
* vercel/turborepo#6843 <!-- Donny/강동윤 - Update
`swc_core` to `v0.87.10` -->
agustints pushed a commit to agustints/next.js that referenced this pull request Jan 6, 2024
### What?

Update SWC crates

### Why?

It's required to fix some next.js isssues

### How?

Closes PACK-2174
Turbopack counterpart: vercel/turborepo#6843

---


# Turbopack

* vercel/turborepo#6737 <!-- Nicholas Yang - feat:
Nice errors for shim flag parsing -->
* vercel/turborepo#6494 <!-- Justin Ridgewell -
Trace output's source maps through input's source map -->
* vercel/turborepo#6778 <!-- Will Binns-Smith -
turbopack-css: fix rule duplication -->
* vercel/turborepo#6807 <!-- Mehul Kar - fix: add
missing dependency to cargo lockfile -->
* vercel/turborepo#6809 <!-- Nicholas Yang -
refactor: Remove bookkeeping abstraction from turbo config -->
* vercel/turborepo#6838 <!-- Nicholas Yang - fix:
Allow for long symlinks by using append_link -->
* vercel/turborepo#6845 <!-- Donny/강동윤 - perf: Use
`&'static str` instead of `String` if possible -->
* vercel/turborepo#6843 <!-- Donny/강동윤 - Update
`swc_core` to `v0.87.10` -->
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 25, 2024
…po#6494)

### Description

This preserves an input file's original source map so that the
transformed output source map can be traced through it.

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->


Closes PACK-1980
Closes PACK-537

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Will Binns-Smith <wbinnssmith@gmail.com>
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
…po#6494)

### Description

This preserves an input file's original source map so that the
transformed output source map can be traced through it.

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->


Closes PACK-1980
Closes PACK-537

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Will Binns-Smith <wbinnssmith@gmail.com>
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Jul 29, 2024
…po#6494)

### Description

This preserves an input file's original source map so that the
transformed output source map can be traced through it.

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->


Closes PACK-1980
Closes PACK-537

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Will Binns-Smith <wbinnssmith@gmail.com>
ForsakenHarmony pushed a commit to vercel/next.js that referenced this pull request Aug 1, 2024
…po#6494)

### Description

This preserves an input file's original source map so that the
transformed output source map can be traced through it.

### Testing Instructions

<!--
  Give a quick description of steps to test your changes.
-->


Closes PACK-1980
Closes PACK-537

---------

Co-authored-by: Tobias Koppers <tobias.koppers@googlemail.com>
Co-authored-by: Will Binns-Smith <wbinnssmith@gmail.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants