denoland / deno_ast

Source text parsing, lexing, and AST related functionality for Deno
https://crates.io/crates/deno_ast
MIT License
155 stars 46 forks source link

Revert "fix: allow specifying a base for source maps" #92

Closed dsherret closed 2 years ago

dsherret commented 2 years ago

Temporarily reverting this one because it causes source maps to have blank source file names and there's too much to deal with WRT the latest swc upgrade (so let's do a follow up PR).

image

Reverts denoland/deno_ast#87

cc @kitsonk

kitsonk commented 2 years ago

I think the base shouldn't generally be the same file as a file in the source map. Was there a specific scenario where the screen grab was from?

dsherret commented 2 years ago

@kitsonk yeah, this is v2::tests::import_map in eszip

It seems they were the same because of this line?

https://github.com/denoland/deno_ast/pull/92/files#diff-c865a1cff44ff278a457dcd63af4492767b0f67655e139b489dd961b5c1b8e3eL182

kitsonk commented 2 years ago

Ok, I think the fix would be to guard against equality and to just output the basename in such cases. I guess eszip keeps the same files indexed by their original filename versus an output filename. Should be a straight forward fix.