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 d4ef930
Show file tree
Hide file tree
Showing 13 changed files with 42 additions and 22 deletions.
6 changes: 4 additions & 2 deletions dist/source-map.debug.js

Large diffs are not rendered by default.

4 changes: 3 additions & 1 deletion dist/source-map.js
Original file line number Diff line number Diff line change
Expand Up @@ -1150,7 +1150,9 @@ return /******/ (function(modules) { // webpackBootstrap
* 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 dist/source-map.min.js

Large diffs are not rendered by default.

2 changes: 1 addition & 1 deletion dist/source-map.min.js.map

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions dist/test/test_api.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions dist/test/test_array_set.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions dist/test/test_dog_fooding.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions dist/test/test_source_map_consumer.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions dist/test/test_source_map_generator.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions dist/test/test_source_node.js

Large diffs are not rendered by default.

6 changes: 4 additions & 2 deletions dist/test/test_util.js

Large diffs are not rendered by default.

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
4 changes: 2 additions & 2 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "source-map",
"name": "@42technologies/source-map",
"description": "Generates and consumes source maps",
"version": "0.6.1",
"version": "0.6.2",
"homepage": "https://github.com/mozilla/source-map",
"author": "Nick Fitzgerald <[email protected]>",
"contributors": [
Expand Down

0 comments on commit d4ef930

Please sign in to comment.