-
-
Notifications
You must be signed in to change notification settings - Fork 35
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
fix: Fix sourcemap file lookup #313
Merged
Merged
Changes from all commits
Commits
File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -16,6 +16,7 @@ Object { | |
background: white; | ||
}", | ||
"with-broken-sourcemap.js": "function meaningOfLife(){throw new Error(42)}", | ||
"with-sourcemap-like-string.js": "function createURL(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)}function createURL2(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)}", | ||
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. thanks a ton for the additional tests!!!! |
||
} | ||
`; | ||
|
||
|
@@ -65,6 +66,9 @@ function third(){ | |
"with-broken-sourcemap.js": "function meaningOfLife(){throw new Error(42)} | ||
//# sourceMappingURL=with-broken-sourcemap.map", | ||
"with-broken-sourcemap.map": "{\\"version\\":3,\\"sources\\":[\\"with-broken-sourcemap.js\\"],\\"names\\":[\\"meaningOfLife\\",\\"Error\\"],\\"mappings\\":\\"AAAA,SAASA,gBAEP,MAAM,IAAIC,MADa\\",\\"file\\":\\"with-broken-sourcemap.js\\"}", | ||
"with-sourcemap-like-string.js": "function createURL(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)}function createURL2(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)} | ||
//# sourceMappingURL=with-sourcemap-like-string.map", | ||
"with-sourcemap-like-string.map": "{\\"version\\":3,\\"sources\\":[\\"with-sourcemap-like-string.js\\"],\\"names\\":[\\"createURL\\",\\"base64\\",\\"sourcemapArg\\",\\"enableUnicodeArg\\",\\"sourcemap\\",\\"undefined\\",\\"source\\",\\"decodeBase64\\",\\"start\\",\\"indexOf\\",\\"body\\",\\"substring\\",\\"blob\\",\\"Blob\\",\\"type\\",\\"URL\\",\\"createObjectURL\\",\\"createURL2\\"],\\"mappings\\":\\"AAAA,SAASA,UAAUC,EAAQC,EAAcC,GACrC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA4BA,EAAY,IACtFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ,GAG/B,SAASK,WAAWhB,EAAQC,EAAcC,GACtC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA0BA,EAAY,IACpFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ\\",\\"file\\":\\"with-sourcemap-like-string.js\\"}", | ||
} | ||
`; | ||
|
||
|
@@ -102,6 +106,9 @@ Object { | |
"with-broken-sourcemap.js": "function meaningOfLife(){throw new Error(42)} | ||
//# sourceMappingURL=with-broken-sourcemap.map", | ||
"with-broken-sourcemap.map": "{\\"version\\":3,\\"sources\\":[\\"with-broken-sourcemap.js\\"],\\"names\\":[\\"meaningOfLife\\",\\"Error\\"],\\"mappings\\":\\"AAAA,SAASA,gBAEP,MAAM,IAAIC,MADa\\",\\"file\\":\\"with-broken-sourcemap.js\\"}", | ||
"with-sourcemap-like-string.js": "function createURL(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)}function createURL2(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)} | ||
//# sourceMappingURL=with-sourcemap-like-string.map", | ||
"with-sourcemap-like-string.map": "{\\"version\\":3,\\"sources\\":[\\"with-sourcemap-like-string.js\\"],\\"names\\":[\\"createURL\\",\\"base64\\",\\"sourcemapArg\\",\\"enableUnicodeArg\\",\\"sourcemap\\",\\"undefined\\",\\"source\\",\\"decodeBase64\\",\\"start\\",\\"indexOf\\",\\"body\\",\\"substring\\",\\"blob\\",\\"Blob\\",\\"type\\",\\"URL\\",\\"createObjectURL\\",\\"createURL2\\"],\\"mappings\\":\\"AAAA,SAASA,UAAUC,EAAQC,EAAcC,GACrC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA4BA,EAAY,IACtFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ,GAG/B,SAASK,WAAWhB,EAAQC,EAAcC,GACtC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA0BA,EAAY,IACpFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ\\",\\"file\\":\\"with-sourcemap-like-string.js\\"}", | ||
} | ||
`; | ||
|
||
|
@@ -131,6 +138,9 @@ Object { | |
"with-broken-sourcemap.js": "function meaningOfLife(){throw new Error(42)} | ||
//# sourceMappingURL=with-broken-sourcemap.map", | ||
"with-broken-sourcemap.map": "{\\"version\\":3,\\"sources\\":[\\"with-broken-sourcemap.js\\"],\\"names\\":[\\"meaningOfLife\\",\\"Error\\"],\\"mappings\\":\\"AAAA,SAASA,gBAEP,MAAM,IAAIC,MADa\\",\\"file\\":\\"with-broken-sourcemap.js\\"}", | ||
"with-sourcemap-like-string.js": "function createURL(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)}function createURL2(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)} | ||
//# sourceMappingURL=with-sourcemap-like-string.map", | ||
"with-sourcemap-like-string.map": "{\\"version\\":3,\\"sources\\":[\\"with-sourcemap-like-string.js\\"],\\"names\\":[\\"createURL\\",\\"base64\\",\\"sourcemapArg\\",\\"enableUnicodeArg\\",\\"sourcemap\\",\\"undefined\\",\\"source\\",\\"decodeBase64\\",\\"start\\",\\"indexOf\\",\\"body\\",\\"substring\\",\\"blob\\",\\"Blob\\",\\"type\\",\\"URL\\",\\"createObjectURL\\",\\"createURL2\\"],\\"mappings\\":\\"AAAA,SAASA,UAAUC,EAAQC,EAAcC,GACrC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA4BA,EAAY,IACtFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ,GAG/B,SAASK,WAAWhB,EAAQC,EAAcC,GACtC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA0BA,EAAY,IACpFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ\\",\\"file\\":\\"with-sourcemap-like-string.js\\"}", | ||
} | ||
`; | ||
|
||
|
@@ -164,6 +174,9 @@ Object { | |
"with-broken-sourcemap.js": "function meaningOfLife(){throw new Error(42)} | ||
//# sourceMappingURL=with-broken-sourcemap.map", | ||
"with-broken-sourcemap.map": "{\\"version\\":3,\\"sources\\":[\\"with-broken-sourcemap.js\\"],\\"names\\":[\\"meaningOfLife\\",\\"Error\\"],\\"mappings\\":\\"AAAA,SAASA,gBAEP,MAAM,IAAIC,MADa\\",\\"file\\":\\"with-broken-sourcemap.js\\"}", | ||
"with-sourcemap-like-string.js": "function createURL(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)}function createURL2(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)} | ||
//# sourceMappingURL=with-sourcemap-like-string.map", | ||
"with-sourcemap-like-string.map": "{\\"version\\":3,\\"sources\\":[\\"with-sourcemap-like-string.js\\"],\\"names\\":[\\"createURL\\",\\"base64\\",\\"sourcemapArg\\",\\"enableUnicodeArg\\",\\"sourcemap\\",\\"undefined\\",\\"source\\",\\"decodeBase64\\",\\"start\\",\\"indexOf\\",\\"body\\",\\"substring\\",\\"blob\\",\\"Blob\\",\\"type\\",\\"URL\\",\\"createObjectURL\\",\\"createURL2\\"],\\"mappings\\":\\"AAAA,SAASA,UAAUC,EAAQC,EAAcC,GACrC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA4BA,EAAY,IACtFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ,GAG/B,SAASK,WAAWhB,EAAQC,EAAcC,GACtC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA0BA,EAAY,IACpFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ\\",\\"file\\":\\"with-sourcemap-like-string.js\\"}", | ||
} | ||
`; | ||
|
||
|
@@ -178,6 +191,7 @@ Object { | |
"no-upstream-sourcemap.map": "{\\"version\\":3,\\"sources\\":[\\"no-upstream-sourcemap.js\\"],\\"names\\":[\\"meaningOfLife\\",\\"Error\\",\\"boom\\",\\"somethingElse\\",\\"fourth\\",\\"third\\"],\\"mappings\\":\\"AACA,SAASA,gBAEP,MAAM,IAAIC,MADa,IAIzB,SAASC,OACP,MAAM,IAAID,MAAM,QAGlB,SAASE,gBACP,MAAM,IAAIF,MAAM,kBAMlB,SAASG,SACP,MAAM,IAAIH,MAAM,UAGlB,SAASI,QACP,MAAM,IAAIJ,MAAM\\",\\"file\\":\\"no-upstream-sourcemap.js\\"}", | ||
"with-broken-sourcemap.map": "{\\"version\\":3,\\"sources\\":[\\"with-broken-sourcemap.js\\"],\\"names\\":[\\"meaningOfLife\\",\\"Error\\"],\\"mappings\\":\\"AAAA,SAASA,gBAEP,MAAM,IAAIC,MADa\\",\\"file\\":\\"with-broken-sourcemap.js\\"}", | ||
"with-multi-sourcemap.map": "{\\"version\\":3,\\"sources\\":[\\"/inner/first.js\\",\\"/inner/second.js\\",\\"/other/fourth.js\\",\\"/other/third.js\\"],\\"names\\":[\\"meaningOfLife\\",\\"Error\\",\\"boom\\",\\"somethingElse\\",\\"fourth\\",\\"third\\"],\\"mappings\\":\\"AAAA,SAAAA,gBAEA,MAAA,IAAAC,MADA,IAIA,SAAAC,OACA,MAAA,IAAAD,MAAA,QCNA,SAAAE,gBACA,MAAA,IAAAF,MAAA,kBCEA,SAAAG,SACA,MAAA,IAAAH,MAAA,UCJA,SAAAI,QACA,MAAA,IAAAJ,MAAA\\",\\"file\\":\\"with-multi-sourcemap.js\\",\\"sourcesContent\\":[\\"function meaningOfLife() {\\\\n var thisIsALongLocal = 42;\\\\n throw new Error(thisIsALongLocal);\\\\n}\\\\n\\\\nfunction boom() {\\\\n throw new Error('boom');\\\\n}\\\\n\\",\\"function somethingElse() {\\\\n throw new Error(\\\\\\"somethign else\\\\\\");\\\\n}\\\\n\\",\\"\\\\n// Hello world\\\\n\\\\nfunction fourth(){\\\\n throw new Error('fourth');\\\\n}\\\\n\\",\\"function third(){\\\\n throw new Error(\\\\\\"oh no\\\\\\");\\\\n}\\\\n\\"]}", | ||
"with-sourcemap-like-string.map": "{\\"version\\":3,\\"sources\\":[\\"with-sourcemap-like-string.js\\"],\\"names\\":[\\"createURL\\",\\"base64\\",\\"sourcemapArg\\",\\"enableUnicodeArg\\",\\"sourcemap\\",\\"undefined\\",\\"source\\",\\"decodeBase64\\",\\"start\\",\\"indexOf\\",\\"body\\",\\"substring\\",\\"blob\\",\\"Blob\\",\\"type\\",\\"URL\\",\\"createObjectURL\\",\\"createURL2\\"],\\"mappings\\":\\"AAAA,SAASA,UAAUC,EAAQC,EAAcC,GACrC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA4BA,EAAY,IACtFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ,GAG/B,SAASK,WAAWhB,EAAQC,EAAcC,GACtC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA0BA,EAAY,IACpFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ\\",\\"file\\":\\"with-sourcemap-like-string.js\\"}", | ||
"with-upstream-sourcemap.map": "{\\"version\\":3,\\"sources\\":[\\"/inner/first.js\\",\\"/inner/second.js\\",\\"/other/fourth.js\\",\\"/other/third.js\\"],\\"names\\":[\\"meaningOfLife\\",\\"Error\\",\\"boom\\",\\"somethingElse\\",\\"fourth\\",\\"third\\"],\\"mappings\\":\\"AAAA,SAAAA,gBAEA,MAAA,IAAAC,MADA,IAIA,SAAAC,OACA,MAAA,IAAAD,MAAA,QCNA,SAAAE,gBACA,MAAA,IAAAF,MAAA,kBCEA,SAAAG,SACA,MAAA,IAAAH,MAAA,UCJA,SAAAI,QACA,MAAA,IAAAJ,MAAA\\",\\"file\\":\\"with-upstream-sourcemap.js\\",\\"sourcesContent\\":[\\"function meaningOfLife() {\\\\n var thisIsALongLocal = 42;\\\\n throw new Error(thisIsALongLocal);\\\\n}\\\\n\\\\nfunction boom() {\\\\n throw new Error('boom');\\\\n}\\\\n\\",\\"function somethingElse() {\\\\n throw new Error(\\\\\\"somethign else\\\\\\");\\\\n}\\\\n\\",\\"\\\\n// Hello world\\\\n\\\\nfunction fourth(){\\\\n throw new Error('fourth');\\\\n}\\\\n\\",\\"function third(){\\\\n throw new Error(\\\\\\"oh no\\\\\\");\\\\n}\\\\n\\"]}", | ||
}, | ||
"mjs": Object { | ||
|
@@ -195,6 +209,8 @@ Object { | |
}", | ||
"with-broken-sourcemap.js": "function meaningOfLife(){throw new Error(42)} | ||
//# sourceMappingURL=/maps/with-broken-sourcemap.map", | ||
"with-sourcemap-like-string.js": "function createURL(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)}function createURL2(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)} | ||
//# sourceMappingURL=/maps/with-sourcemap-like-string.map", | ||
} | ||
`; | ||
|
||
|
@@ -219,6 +235,8 @@ Object { | |
}", | ||
"with-broken-sourcemap.js": "function meaningOfLife(){throw new Error(42)}", | ||
"with-broken-sourcemap.map": "{\\"version\\":3,\\"sources\\":[\\"with-broken-sourcemap.js\\"],\\"names\\":[\\"meaningOfLife\\",\\"Error\\"],\\"mappings\\":\\"AAAA,SAASA,gBAEP,MAAM,IAAIC,MADa\\",\\"file\\":\\"with-broken-sourcemap.js\\"}", | ||
"with-sourcemap-like-string.js": "function createURL(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)}function createURL2(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)}", | ||
"with-sourcemap-like-string.map": "{\\"version\\":3,\\"sources\\":[\\"with-sourcemap-like-string.js\\"],\\"names\\":[\\"createURL\\",\\"base64\\",\\"sourcemapArg\\",\\"enableUnicodeArg\\",\\"sourcemap\\",\\"undefined\\",\\"source\\",\\"decodeBase64\\",\\"start\\",\\"indexOf\\",\\"body\\",\\"substring\\",\\"blob\\",\\"Blob\\",\\"type\\",\\"URL\\",\\"createObjectURL\\",\\"createURL2\\"],\\"mappings\\":\\"AAAA,SAASA,UAAUC,EAAQC,EAAcC,GACrC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA4BA,EAAY,IACtFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ,GAG/B,SAASK,WAAWhB,EAAQC,EAAcC,GACtC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA0BA,EAAY,IACpFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ\\",\\"file\\":\\"with-sourcemap-like-string.js\\"}", | ||
} | ||
`; | ||
|
||
|
@@ -248,5 +266,8 @@ Object { | |
"with-broken-sourcemap.js": "function meaningOfLife(){throw new Error(42)} | ||
//# sourceMappingURL=https://example.com/with-broken-sourcemap.map", | ||
"with-broken-sourcemap.map": "{\\"version\\":3,\\"sources\\":[\\"with-broken-sourcemap.js\\"],\\"names\\":[\\"meaningOfLife\\",\\"Error\\"],\\"mappings\\":\\"AAAA,SAASA,gBAEP,MAAM,IAAIC,MADa\\",\\"file\\":\\"with-broken-sourcemap.js\\"}", | ||
"with-sourcemap-like-string.js": "function createURL(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)}function createURL2(e,n,a){var i=void 0===n?null:n,t=decodeBase64(e,void 0!==a&&a),c=t.indexOf(\\"\\\\n\\",10)+1,r=t.substring(c)+(i?\\"//# sourceMappingURL=\\"+i:\\"\\"),o=new Blob([r],{type:\\"application/javascript\\"});return URL.createObjectURL(o)} | ||
//# sourceMappingURL=https://example.com/with-sourcemap-like-string.map", | ||
"with-sourcemap-like-string.map": "{\\"version\\":3,\\"sources\\":[\\"with-sourcemap-like-string.js\\"],\\"names\\":[\\"createURL\\",\\"base64\\",\\"sourcemapArg\\",\\"enableUnicodeArg\\",\\"sourcemap\\",\\"undefined\\",\\"source\\",\\"decodeBase64\\",\\"start\\",\\"indexOf\\",\\"body\\",\\"substring\\",\\"blob\\",\\"Blob\\",\\"type\\",\\"URL\\",\\"createObjectURL\\",\\"createURL2\\"],\\"mappings\\":\\"AAAA,SAASA,UAAUC,EAAQC,EAAcC,GACrC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA4BA,EAAY,IACtFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ,GAG/B,SAASK,WAAWhB,EAAQC,EAAcC,GACtC,IAAIC,OAA6BC,IAAjBH,EAA6B,KAAOA,EAEhDI,EAASC,aAAaN,OADeI,IAArBF,GAAyCA,GAEzDK,EAAQF,EAAOG,QAAQ,KAAM,IAAM,EACnCC,EAAOJ,EAAOK,UAAUH,IAAUJ,EAAY,wBAA0BA,EAAY,IACpFQ,EAAO,IAAIC,KAAK,CAACH,GAAO,CAAEI,KAAM,2BACpC,OAAOC,IAAIC,gBAAgBJ\\",\\"file\\":\\"with-sourcemap-like-string.js\\"}", | ||
} | ||
`; |
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.
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
any way we can use convert-source-map directly instead of needing teh lib/source-map-url.js file?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
It seems to work a bit differently, and I didn't find a good method it exposed (?) to just get all source map URLs in a file - there is a method to just get the last one, and a method to remove all of them in the file, both of which are not suited to what we need here 😓