Skip to content

Commit

Permalink
Ignore false matches from CoffeeScript codebase
Browse files Browse the repository at this point in the history
I'm not sure this is the best fix for this bug, which was hard to track down! But I have also attempted to address it here: https://github.com/evanw/node-source-map-support/pull/283… although looking at the activity on that repo, I don't have much hope of it being merged any time soon… Hence the reason for this PR.

See also: evanw/node-source-map-support#254
# Conflicts:
#	lib/util.js
  • Loading branch information
surjikal committed May 6, 2023
1 parent ac518d2 commit 9639154
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
4 changes: 3 additions & 1 deletion lib/util.js
Original file line number Diff line number Diff line change
Expand Up @@ -430,7 +430,9 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate
* JSON.
*/
function parseSourceMapInput(str) {
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
// Ignore false matches from CoffeeScript codebase.
if (str.startsWith('zw(u')) return { version: 3, sources: [], mappings: [] }
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
}
exports.parseSourceMapInput = parseSourceMapInput;

Expand Down
2 changes: 1 addition & 1 deletion package.json
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
{
"name": "source-map",
"name": "@42technologies/source-map",
"description": "Generates and consumes source maps",
"version": "0.6.1",
"homepage": "https://github.com/mozilla/source-map",
Expand Down

0 comments on commit 9639154

Please sign in to comment.