-
-
Notifications
You must be signed in to change notification settings - Fork 35
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #313 from mydea/fn/fix-source-map-lookup
fix: Fix sourcemap file lookup
- Loading branch information
Showing
6 changed files
with
72 additions
and
5 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
'use strict'; | ||
|
||
// Forked from https://github.com/lydell/source-map-url/blob/master/source-map-url.js | ||
// We use a slightly adjusted regex here | ||
const convertSourceMap = require('convert-source-map'); | ||
|
||
module.exports = { | ||
regex: convertSourceMap.mapFileCommentRegex, | ||
|
||
reset() { | ||
this.regex = convertSourceMap.mapFileCommentRegex; | ||
}, | ||
|
||
getFrom(code) { | ||
const m = this.regex.exec(code); | ||
return m ? m[1] || m[2] : null; | ||
}, | ||
}; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,19 @@ | ||
function createURL(base64, sourcemapArg, enableUnicodeArg) { | ||
var sourcemap = sourcemapArg === undefined ? null : sourcemapArg; | ||
var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg; | ||
var source = decodeBase64(base64, enableUnicode); | ||
var start = source.indexOf('\n', 10) + 1; | ||
var body = source.substring(start) + (sourcemap ? '\/\/# sourceMappingURL=' + sourcemap : ''); | ||
var blob = new Blob([body], { type: 'application/javascript' }); | ||
return URL.createObjectURL(blob); | ||
} | ||
|
||
function createURL2(base64, sourcemapArg, enableUnicodeArg) { | ||
var sourcemap = sourcemapArg === undefined ? null : sourcemapArg; | ||
var enableUnicode = enableUnicodeArg === undefined ? false : enableUnicodeArg; | ||
var source = decodeBase64(base64, enableUnicode); | ||
var start = source.indexOf('\n', 10) + 1; | ||
var body = source.substring(start) + (sourcemap ? '//# sourceMappingURL=' + sourcemap : ''); | ||
var blob = new Blob([body], { type: 'application/javascript' }); | ||
return URL.createObjectURL(blob); | ||
} |
Oops, something went wrong.