Skip to content

Commit d4ef930

Browse files
committed
Ignore false matches from CoffeeScript codebase
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
1 parent ac518d2 commit d4ef930

13 files changed

+42
-22
lines changed

dist/source-map.debug.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/source-map.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -1150,7 +1150,9 @@ return /******/ (function(modules) { // webpackBootstrap
11501150
* JSON.
11511151
*/
11521152
function parseSourceMapInput(str) {
1153-
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
1153+
// Ignore false matches from CoffeeScript codebase.
1154+
if (str.startsWith('zw(u')) return { version: 3, sources: [], mappings: [] }
1155+
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
11541156
}
11551157
exports.parseSourceMapInput = parseSourceMapInput;
11561158

dist/source-map.min.js

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/source-map.min.js.map

+1-1
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_api.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_array_set.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_dog_fooding.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_source_map_consumer.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_source_map_generator.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_source_node.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

dist/test/test_util.js

+4-2
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

lib/util.js

+3-1
Original file line numberDiff line numberDiff line change
@@ -430,7 +430,9 @@ exports.compareByGeneratedPositionsInflated = compareByGeneratedPositionsInflate
430430
* JSON.
431431
*/
432432
function parseSourceMapInput(str) {
433-
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ''));
433+
// Ignore false matches from CoffeeScript codebase.
434+
if (str.startsWith('zw(u')) return { version: 3, sources: [], mappings: [] }
435+
return JSON.parse(str.replace(/^\)]}'[^\n]*\n/, ""));
434436
}
435437
exports.parseSourceMapInput = parseSourceMapInput;
436438

package.json

+2-2
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "source-map",
2+
"name": "@42technologies/source-map",
33
"description": "Generates and consumes source maps",
4-
"version": "0.6.1",
4+
"version": "0.6.2",
55
"homepage": "https://github.com/mozilla/source-map",
66
"author": "Nick Fitzgerald <[email protected]>",
77
"contributors": [

0 commit comments

Comments
 (0)