Skip to content

Commit 357f56c

Browse files
authored
Fix retrieveSourceMapURL to prevent false matches in CoffeeScript codebase
This bug was hard to track down! It breaks all my tests, and has been a real hinderance to my _[jest-preset-coffeescript](https://github.com/danielbayley/jest-preset-coffeescript/runs/1254200867?check_suite_focus=true)_ package. Fixes evanw#254.
1 parent d29e9c8 commit 357f56c

File tree

1 file changed

+2
-0
lines changed

1 file changed

+2
-0
lines changed

source-map-support.js

+2
Original file line numberDiff line numberDiff line change
@@ -147,6 +147,8 @@ function retrieveSourceMapURL(source) {
147147

148148
// Get the URL of the source map
149149
fileData = retrieveFile(source);
150+
// Skip sourceMappingURL in coffeescript.js, meant for emitting source maps.
151+
if (source.endsWith('node_modules/coffeescript/lib/coffeescript/coffeescript.js')) return null
150152
var re = /(?:\/\/[@#][\s]*sourceMappingURL=([^\s'"]+)[\s]*$)|(?:\/\*[@#][\s]*sourceMappingURL=([^\s*'"]+)[\s]*(?:\*\/)[\s]*$)/mg;
151153
// Keep executing the search to find the *last* sourceMappingURL to avoid
152154
// picking up sourceMappingURLs from comments, strings, etc.

0 commit comments

Comments
 (0)