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

@@ -7,7 +7,7 @@ import { VISITOR_KEYS } from "../definitions";
*/
export default function traverseFast(
node: Object,
enter: (node: Node, opts?: Object) => void,
enter: (node: BabelNode, opts?: Object) => void,
opts?: Object,
): void {
if (!node) return;