Do not delete "fake" source map comments from strings (#9960)

Instead of using `convert-source-map`'s `removeComments` method before
parsing the file, we can first parse the file with `@babel/parser` and then
analyze the comments.
This is needed because it is not possible to reliabily detect comments in
JavaScript without fully parsing the file:
https://github.com/thlorenz/convert-source-map/issues/63
This commit is contained in:
Nicolò Ribaudo
2019-08-14 17:05:55 +02:00
committed by GitHub
parent ee344c3e4c
commit f0c2364d01
6 changed files with 99 additions and 45 deletions

View File

@@ -181,7 +181,7 @@ declare module "convert-source-map" {
fromJSON(str: string): Converter,
fromBase64(str: string): Converter,
fromComment(str: string): Converter,
fromMapFileComment(str: string): Converter,
fromMapFileComment(str: string, dir: string): Converter,
fromSource(str: string): Converter,
fromMapFileSource(str: string, dir: string): Converter,
removeComments(str: string): string,