Implement source maps (#2770)

* wip

* Begin computing source map tables

* source map progress

* external source maps

* fix merge

* remove `@as` coercion

* inline source maps and output source map shifts

* fix `codeWithSourceMapShifts()` after merge

* remove second call to `findReachableFiles()`

* use `worker.allocator`, remove comment

* don't reuse memory for source and sourceContents

* don't reuse `quote_buf`

* fix writing to stdout

* Add comment

* Don't include a sourcemap if the text was empty

* Make the parser faster

* +16% faster sourcemap generation

@dylan-conway I'll need you to look this over to make sure I didn't mess anything up

Though it currently doesn't generate the offsets in the right order...

* 30% performance improvement to Bun.build()

* Print `debugId` in source maps

cc @mitsuhiko @notzeeg

---------

Co-authored-by: Jarred Sumner <709451+Jarred-Sumner@users.noreply.github.com>
This commit is contained in:
Dylan Conway
2023-04-30 22:09:40 -07:00
committed by GitHub
parent 137dc6e19f
commit 0490bd3d2e
14 changed files with 1102 additions and 212 deletions

View File

@@ -25,6 +25,10 @@ pub const MutableString = struct {
};
}
pub fn isEmpty(this: *const MutableString) bool {
return this.list.items.len == 0;
}
pub fn deinit(str: *MutableString) void {
if (str.list.capacity > 0) {
str.list.expandToCapacity();