Skip to content

fix: use SourceMapSource in js side to support map method#7828

Merged
SyMind merged 10 commits intomainfrom
remove-compact-source
Sep 18, 2024
Merged

fix: use SourceMapSource in js side to support map method#7828
SyMind merged 10 commits intomainfrom
remove-compact-source

Conversation

@SyMind
Copy link
Copy Markdown
Member

@SyMind SyMind commented Sep 6, 2024

Summary

The CompatSource in Rust is unnecessary and can be simplified. Below are the steps detailing the changes for converting between Rust and JavaScript sources.

  1. Rust to JavaScript

    • If the source is a buffer or doesn't have a source map, JavaScript will expose it using RawSource.
    • If the source has a source map, JavaScript will expose it using SourceMapSource.
  2. JavaScript to Rust

    • The conversion process remains the same as above.

Fix: #7891

Checklist

  • Tests updated (or not required).
  • Documentation updated (or not required).

@github-actions github-actions bot added release: feature release: feature related release(mr only) team The issue/pr is created by the member of Rspack. labels Sep 6, 2024
@netlify
Copy link
Copy Markdown

netlify bot commented Sep 6, 2024

Deploy Preview for rspack canceled.

Name Link
🔨 Latest commit a167b1e
🔍 Latest deploy log https://app.netlify.com/sites/rspack/deploys/66ea8ddc8ab7c900085934e8

@SyMind SyMind force-pushed the remove-compact-source branch from 5eed549 to 7e3d36d Compare September 6, 2024 10:53
@web-infra-dev web-infra-dev deleted a comment from rspack-bot Sep 6, 2024
@web-infra-dev web-infra-dev deleted a comment from rspack-bot Sep 14, 2024
@web-infra-dev web-infra-dev deleted a comment from rspack-bot Sep 14, 2024
@SyMind SyMind marked this pull request as ready for review September 14, 2024 04:20
@web-infra-dev web-infra-dev deleted a comment from rspack-bot Sep 14, 2024
@SyMind SyMind force-pushed the remove-compact-source branch from bcf2854 to 17a388b Compare September 14, 2024 08:01
@SyMind
Copy link
Copy Markdown
Member Author

SyMind commented Sep 14, 2024

!bench

@rspack-bot
Copy link
Copy Markdown

rspack-bot commented Sep 14, 2024

📝 Benchmark detail: Open

Name Base (2024-09-14 0325a3d) Current Change
10000_development-mode + exec 2.21 s ± 28 ms 2.22 s ± 49 ms +0.46 %
10000_development-mode_hmr + exec 692 ms ± 21 ms 689 ms ± 21 ms -0.33 %
10000_production-mode + exec 2.83 s ± 40 ms 2.82 s ± 32 ms -0.37 %
arco-pro_development-mode + exec 1.81 s ± 84 ms 1.86 s ± 82 ms +2.37 %
arco-pro_development-mode_hmr + exec 434 ms ± 3.8 ms 432 ms ± 0.96 ms -0.53 %
arco-pro_production-mode + exec 3.25 s ± 78 ms 3.23 s ± 44 ms -0.80 %
arco-pro_production-mode_generate-package-json-webpack-plugin + exec 3.29 s ± 75 ms 3.3 s ± 95 ms +0.32 %
threejs_development-mode_10x + exec 1.68 s ± 20 ms 1.67 s ± 23 ms -0.65 %
threejs_development-mode_10x_hmr + exec 780 ms ± 13 ms 781 ms ± 9.7 ms +0.13 %
threejs_production-mode_10x + exec 5.17 s ± 16 ms 5.17 s ± 29 ms +0.05 %

@h-a-n-a
Copy link
Copy Markdown
Contributor

h-a-n-a commented Sep 18, 2024

Most part of this PR is a refactor and due to this PR including a fix, I would recommend you to use 'fix' as the title.

@SyMind SyMind changed the title feat: rm CompatSource fix: use SourceMapSource in js side to support map method Sep 18, 2024
@github-actions github-actions bot added release: bug fix release: bug related release(mr only) and removed release: feature release: feature related release(mr only) labels Sep 18, 2024
@SyMind SyMind merged commit f108cfa into main Sep 18, 2024
@SyMind SyMind deleted the remove-compact-source branch September 18, 2024 10:28
JSerFeng pushed a commit that referenced this pull request Sep 29, 2024
* feat: rm CompatSource

* perf: use String directly is better perf than Buffer

* perf: lazy parse source.map
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

release: bug fix release: bug related release(mr only) team The issue/pr is created by the member of Rspack.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

[Bug]: rsbuild fails to compile with compression-webpack-plugin

3 participants