Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Avoid matching sourceMappingURL inside a template string #61

Closed
wants to merge 2 commits into from

Conversation

aleclarson
Copy link
Collaborator

Proof for issue #60

@aleclarson aleclarson changed the title Add tests for template strings Avoid matching sourceMappingURL inside a template string Nov 11, 2017
@aleclarson
Copy link
Collaborator Author

aleclarson commented Nov 11, 2017

Patch added. All tests passing. LGTM

This also removes the example comment, since this library may sometimes parse itself, resulting in false positives.

index.js Outdated
//Example (Extra space between slashes added to solve Safari bug. Exclude space in production):
// / /# sourceMappingURL=foo.js.map /*# sourceMappingURL=foo.js.map */
return /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg;
return /(?:\/\/[@#][ \t]+sourceMappingURL=([^\s'"`]+?)[ \t]*$)|(?:\/\*[@#][ \t]+sourceMappingURL=([^\*]+?)[ \t]*(?:\*\/){1}[ \t]*$)/mg;
}
Copy link
Owner

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Could we please keep the comments that were there?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

How about something more like:

// Matches sourceMappingURL in either // or /* comment styles.

The current comment interferes with global packages where two installations of convert-source-map end up parsing each other, causing an error to be thrown.

@thlorenz
Copy link
Owner

LGTM after the nit is fixed. Would like at least one more collab to have a look before merging.

@thlorenz
Copy link
Owner

@aleclarson made you collaborator.

Please merge to master following this guide.
I will then version and publish to npm.

Thanks.

@aleclarson
Copy link
Collaborator Author

@thlorenz Done 👍

@aleclarson aleclarson closed this Nov 23, 2017
@thlorenz
Copy link
Owner

Thanks published as patch v1.5.1.

@aleclarson aleclarson deleted the template-strings branch May 24, 2018 19:22
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants