Skip to content

Commit

Permalink
Update autoprefixer.js with new Browserslist
Browse files Browse the repository at this point in the history
  • Loading branch information
ai committed Apr 26, 2018
1 parent e8a1e12 commit 10db176
Showing 1 changed file with 43 additions and 38 deletions.
81 changes: 43 additions & 38 deletions vendor/autoprefixer.js
Original file line number Diff line number Diff line change
Expand Up @@ -9138,51 +9138,64 @@ for (var i = 0, len = code.length; i < len; ++i) {
revLookup['-'.charCodeAt(0)] = 62;
revLookup['_'.charCodeAt(0)] = 63;

function placeHoldersCount(b64) {
function getLens(b64) {
var len = b64.length;

if (len % 4 > 0) {
throw new Error('Invalid string. Length must be a multiple of 4');
}

// the number of equal signs (place holders)
// if there are two placeholders, than the two characters before it
// represent one byte
// if there is only one, then the three characters before it represent 2 bytes
// this is just a cheap hack to not do indexOf twice
return b64[len - 2] === '=' ? 2 : b64[len - 1] === '=' ? 1 : 0;
// Trim off extra bytes after placeholder bytes are found
// See: https://github.com/beatgammit/base64-js/issues/42
var validLen = b64.indexOf('=');
if (validLen === -1) validLen = len;

var placeHoldersLen = validLen === len ? 0 : 4 - validLen % 4;

return [validLen, placeHoldersLen];
}

// base64 is 4/3 + up to two characters of the original data
function byteLength(b64) {
// base64 is 4/3 + up to two characters of the original data
return b64.length * 3 / 4 - placeHoldersCount(b64);
var lens = getLens(b64);
var validLen = lens[0];
var placeHoldersLen = lens[1];
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
}

function _byteLength(b64, validLen, placeHoldersLen) {
return (validLen + placeHoldersLen) * 3 / 4 - placeHoldersLen;
}

function toByteArray(b64) {
var i, l, tmp, placeHolders, arr;
var len = b64.length;
placeHolders = placeHoldersCount(b64);
var tmp;
var lens = getLens(b64);
var validLen = lens[0];
var placeHoldersLen = lens[1];

arr = new Arr(len * 3 / 4 - placeHolders);
var arr = new Arr(_byteLength(b64, validLen, placeHoldersLen));

// if there are placeholders, only get up to the last complete 4 chars
l = placeHolders > 0 ? len - 4 : len;
var curByte = 0;

var L = 0;
// if there are placeholders, only get up to the last complete 4 chars
var len = placeHoldersLen > 0 ? validLen - 4 : validLen;

for (i = 0; i < l; i += 4) {
for (var i = 0; i < len; i += 4) {
tmp = revLookup[b64.charCodeAt(i)] << 18 | revLookup[b64.charCodeAt(i + 1)] << 12 | revLookup[b64.charCodeAt(i + 2)] << 6 | revLookup[b64.charCodeAt(i + 3)];
arr[L++] = tmp >> 16 & 0xFF;
arr[L++] = tmp >> 8 & 0xFF;
arr[L++] = tmp & 0xFF;
arr[curByte++] = tmp >> 16 & 0xFF;
arr[curByte++] = tmp >> 8 & 0xFF;
arr[curByte++] = tmp & 0xFF;
}

if (placeHolders === 2) {
if (placeHoldersLen === 2) {
tmp = revLookup[b64.charCodeAt(i)] << 2 | revLookup[b64.charCodeAt(i + 1)] >> 4;
arr[L++] = tmp & 0xFF;
} else if (placeHolders === 1) {
arr[curByte++] = tmp & 0xFF;
}

if (placeHoldersLen === 1) {
tmp = revLookup[b64.charCodeAt(i)] << 10 | revLookup[b64.charCodeAt(i + 1)] << 4 | revLookup[b64.charCodeAt(i + 2)] >> 2;
arr[L++] = tmp >> 8 & 0xFF;
arr[L++] = tmp & 0xFF;
arr[curByte++] = tmp >> 8 & 0xFF;
arr[curByte++] = tmp & 0xFF;
}

return arr;
Expand All @@ -9206,7 +9219,6 @@ function fromByteArray(uint8) {
var tmp;
var len = uint8.length;
var extraBytes = len % 3; // if we have 1 byte left, pad 2 bytes
var output = '';
var parts = [];
var maxChunkLength = 16383; // must be multiple of 3

Expand All @@ -9218,19 +9230,12 @@ function fromByteArray(uint8) {
// pad the end with zeros, but make sure to not forget the extra bytes
if (extraBytes === 1) {
tmp = uint8[len - 1];
output += lookup[tmp >> 2];
output += lookup[tmp << 4 & 0x3F];
output += '==';
parts.push(lookup[tmp >> 2] + lookup[tmp << 4 & 0x3F] + '==');
} else if (extraBytes === 2) {
tmp = (uint8[len - 2] << 8) + uint8[len - 1];
output += lookup[tmp >> 10];
output += lookup[tmp >> 4 & 0x3F];
output += lookup[tmp << 2 & 0x3F];
output += '=';
parts.push(lookup[tmp >> 10] + lookup[tmp >> 4 & 0x3F] + lookup[tmp << 2 & 0x3F] + '=');
}

parts.push(output);

return parts.join('');
}

Expand Down Expand Up @@ -9433,7 +9438,7 @@ function resolve(queries, context) {
var array = type.select.apply(browserslist, args);
if (isExclude) {
array = array.concat(array.map(function (j) {
return j.replace(/\s\d+/, ' 0');
return j.replace(/\s[^\s]+/, ' 0');
}));
return result.filter(function (j) {
return array.indexOf(j) === -1;
Expand Down Expand Up @@ -9617,7 +9622,7 @@ browserslist.coverage = function (browsers, stats) {
return browsers.reduce(function (all, i) {
var usage = data[i];
if (usage === undefined) {
usage = data[i.replace(/ [\d.]+$/, ' 0')];
usage = data[i.replace(/ [^\s]+$/, ' 0')];
}
return all + (usage || 0);
}, 0);
Expand Down Expand Up @@ -9961,7 +9966,7 @@ var QUERIES = [{
}, {
regexp: /^dead$/i,
select: function select() {
return ['ie 10', 'ie_mob 10', 'bb 10', 'bb 7'];
return ['ie 10', 'ie_mob 10', 'bb 10', 'bb 7', 'op_mob 12.1'];
}
}, {
regexp: /^(\w+)$/i,
Expand Down

0 comments on commit 10db176

Please sign in to comment.