-
Notifications
You must be signed in to change notification settings - Fork 2.5k
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
feat: load sourcemaps at runtime when using a bun build --target=bun
bundle
#10998
Merged
Conversation
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
not complete yet, needs a better comment parser
paperdave
changed the title
Dave/runtime sourcemap
feat: load sourcemaps at runtime when using a May 11, 2024
bun build --target=bun
bundle
paperdave
commented
May 13, 2024
src/bun.js/javascript.zig
Outdated
@@ -3825,4 +3890,12 @@ pub fn NewHotReloader(comptime Ctx: type, comptime EventLoopType: type, comptime | |||
}; | |||
} | |||
|
|||
export fn Bun__addSourceProviderSourceMap(bun_vm: *anyopaque, opaque_source_provider: *anyopaque, specifier: *bun.String) void { |
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.
*anyopaque -> VirtualMachine
Needs a test that does hot reloading with source maps enabled and makes sure it doesn't crash due to ref/unref of SourceProvider |
Also needs a test for Bun.inspect on |
paperdave
commented
May 14, 2024
Followup TODO:
|
@paperdave the windows tests are timing out? |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
This makes it so when using sourcemaps with
bun build --target=bun
, those maps actually get loaded and used for errors:The main api change to our sourcemap functions is you can now specify an intent for resolving mappings, one that includes source code information, and one that does not.
if (this.source_mappings.resolveMapping( source_url.slice(), @max(frame.position.line, 0), @max(frame.position.column_start, 0), + .no_source_contents, )) |lookup| {
This was not needed before because we assumed the source is always the untranspiled code. But with --target=bun and it's
// @bun
annotation, the untranspiled code IS the transpiled code, and the source is stored in the sourcemap.We are not ready yet:
error.stack
works.map
fileZigSourceProvider__getSourceSlice
getSourceCode()
returns nullgetSourceCode
, this is when you load a sourcemap without file contents but then later need them.toParsedSourceMap
.