gulp-sourcemaps / identity-map

Gulp plugin for generating an identity sourcemap for a file.
MIT License
3 stars 7 forks source link

JS hashbang error #3

Closed Delagen closed 7 years ago

Delagen commented 7 years ago

From gulp-sourcemaps plugin

.pipe(sourcemaps.identityMap());

crash when JS contains hashBang first line

I think need allowHashBang option enabled or way to pass it from gulp plugin

var tokenizer = acorn.tokenizer(fileContent, { allowHashBang: true, locations: true });
phated commented 7 years ago

@Delagen interesting. I thought hashbang was inside a comment, so it seems weird that they would crash on it.

Mind sending a PR with tests?

Delagen commented 7 years ago

I am not sure if expose it as option, or make it default? @phated how about your opinion?

phated commented 7 years ago

@Delagen It looks like the code is very specific (and not intrusive), so turning it on always seems fine. I don't think it needs to be paired with the locations option though.

Delagen commented 7 years ago

Created PR #4