-
Notifications
You must be signed in to change notification settings - Fork 2.8k
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
fix(bundler): some sourcemap generation bugs #11344
Conversation
❌ @paperdave, your commit has failing tests :( 💻 3 failing tests Darwin x64 baseline
💻 2 failing tests Darwin x64
🐧💪 1 failing tests Linux AARCH64
🐧🖥 1 failing tests Linux x64 baseline
🐧🖥 1 failing tests Linux x64
🪟💻 9 failing tests Windows x64 baseline
🪟💻 5 failing tests Windows x64
|
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Serializing IRL discussion:
Snapshot-based sourcemap tests will be hard to debug when we inevitably change the output of the transpiler. They're certainly better than nothing though.
Also, Windows tests are failing
Overall looks great though
Great progress here! I love the screenshots (how did you make those arrows with the highlighted text?). A few updates from my testing:
Seems like we're getting close. |
Here's the sourcemap from above with the sourcecode redacted. Notice
{
"version": 3,
"sources": ["../src/index.mts", "../node_modules/@mangs/bun-utils/src/routerUtils.mts", "../node_modules/@mangs/bun-utils/src/routerUtils.mts", "../src/types.mts", "../src/utils/awsSecretsManager.mts", "../src/index.mts"],
"sourcesContent": [
"<redacted>"
],
"mappings": ";AACAACIAAC0HA,IAAS,UAA2B,CAAC,EAA0D,CAC7F,cACS,IAAa,UACpB,IAAa,QACX,WAAY,IAAY,MAAM,QAAQ,EAAS,MAAM,IACpD,iBAAkB,IAAY,MAAM,QAAQ,EAAS,YAAYAC5DxE,IAAS,UAAkC,CAAC,EAAsB,CAChE,MAAM,EAA6B,IAAI,IACvC,QAAW,KAAO,QAAQ,IACxB,GAAI,OAAO,OAAO,QAAQ,IAAK,CAAG,GAAK,EAAI,SAAS,CAAY,EAC9D,EAA2B,IAAI,EAAK,EAAS,QAAQ,IAAI,GAAO,CAAY,CAAC,EAGjF,OAAO,GAIT,eAAe,CAAiB,CAAC,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Ae,CAA6B,CAAC,EAAsB,CACjE,MAAM,EAAgC,EAAmC,CAAY,EACrF,GAAI,EAA8B,OAAS,EAAG,CAC5C,GAAI,QAAQ,IAAI,MACd,QAAQ,MAAM,4CAA4C,EAE5D,OAEF,GAAI,QAAQ,IAAI,MAAO,CACrB,MAAM,EAAS,EAA8B,OAAS,EACtD,QAAQ,MACN,GAAG,EAA8B,mCAAmC,EAAS,GAAK,YAClF,CACF,EAEF,MAAM,EAAe,MAAM,EACzB,CAAC,GAAG,EAA8B,KAAK,CAAC,EACxC,CACF,EAEA,QAAa,OAAM,kBAAkB,EAAc,CACjD,IAAK,IAAS,EACZ,SAEF,MAAM,EAAiB,EAA8B,IAAI,CAAI,EAC7D,GAAI,EAAgB,CAClB,MAAM,EAAoB,EAAK,QAAQ,IAAI,OAAO,GAAG,KAAe,EAAG,EAAE,GACjE,WAAY,EAAe,OAC7B,EAAc,EACf,KAAK,MAAM,CAAY,EAA6B,GACrD,EACJ,GAAI,KAAqB,QAAQ,IAC/B,MAAM,IAAI,MACR,8FACA,CACE,MAAO,CACL,KAAM,EACN,mBACF,CACF,CACF,EAEF,QAAQ,IAAI,GAAqB,IA7HvC,IAAM,EACJ,4JACI,EAAe",
"debugId": "F659283F1B37485A64756e2164756e21",
"names": []
} |
After reading over the spec for source map version 3 and understanding more how this all works, it looks like the As for tests, I found a good article about VLQ encoding/decoding that has a simple NPM package associated with it that might be helpful for writing test assertions for the |
the leading character can be a ;. this indicates there are no mappings on the first line. the invalid part of that sourcemap is this mapping "AACAACIAAC0HA" which looking at it by hand seems to be three mappings at once: "aaca", "acia", and "ac0ha" so yes more to be done |
As requested, the following is for the entry point code file and its accompanying source map: 1. No minify
2. No splitting
3. No minify or splitting
|
Thanks for the error samples, looks like there is more than one issue the following combo:
is very worrysome as it means it generated a valid sourcemap, loaded it back into memory, but has corrupt mappings. The plan is going to be to merge this PR with test fixes, and continue mangs' issue in another followup PR, repeating this process until their issues are fixed. |
Co-authored-by: nektro <nektro@users.noreply.github.com> Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
@paperdave you left this
Co-authored-by: Jarred Sumner <jarred@jarredsumner.com>
Before, if you bundled and minified
console.log(React)
you would get an invalid sourcemapIf you manually fixed the error causing this invalid data to be written, the rest of the sourcemap is off by ~375 bytes. Notice how nothing really aligns
Now:
Thanks to source map visualizer, vlq encoder/decoder, and mangs for helping me get a reproduction.
how did you verify your code works
no tests yet, all manual. i'd like to write some sourcemap tests, which will probably be snapshots to simplify the process.