feat(ngcc): implement source-map flattening (#35132)

The library used by ngcc to update the source files (MagicString) is able
to generate a source-map but it is not able to account for any previous
source-map that the input text is already associated with.

There have been various attempts to fix this but none have been very
successful, since it is not a trivial problem to solve.

This commit contains a novel approach that is able to load up a tree of
source-files connected by source-maps and flatten them down into a single
source-map that maps directly from the final generated file to the original
sources referenced by the intermediate source-maps.

PR Close #35132
This commit is contained in:
Pete Bacon Darwin
2020-02-16 21:07:30 +01:00
committed by Miško Hevery
parent 2a8dd4758c
commit df816c9c80
16 changed files with 1273 additions and 181 deletions

View File

@ -35,6 +35,7 @@ ts_library(
"@npm//magic-string",
"@npm//semver",
"@npm//source-map",
"@npm//sourcemap-codec",
"@npm//typescript",
],
)