Skip to content

Commit cef5140

Browse files
committed
Add support for utf8 name in input source map encoding
Backported from postcss/postcss@215ed88 Fixes #13
1 parent 07c1917 commit cef5140

File tree

1 file changed

+9
-1
lines changed

1 file changed

+9
-1
lines changed

src/previous-map.js

Lines changed: 9 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -36,15 +36,23 @@ export default class PreviousMap {
3636
}
3737

3838
decodeInline(text) {
39+
let utfd64 = 'data:application/json;charset=utf-8;base64,';
40+
let utf64 = 'data:application/json;charset=utf8;base64,';
41+
let b64 = 'data:application/json;base64,';
3942
let uri = 'data:application/json,';
40-
let base64 = 'data:application/json;base64,';
4143

4244
if ( this.startWith(text, uri) ) {
4345
return decodeURIComponent( text.substr(uri.length) );
4446

4547
} else if ( this.startWith(text, base64) ) {
4648
return Base64.decode( text.substr(base64.length) );
4749

50+
} else if ( this.startWith(text, utf64) ) {
51+
return Base64.decode( text.substr(utf64.length) );
52+
53+
} else if ( this.startWith(text, utfd64) ) {
54+
return Base64.decode( text.substr(utfd64.length) );
55+
4856
} else {
4957
let encoding = text.match(/data:application\/json;([^,]+),/)[1];
5058
throw new Error('Unsupported source map encoding ' + encoding);

0 commit comments

Comments
 (0)