From 51120bde9602e79de7c8d68e2c04a2becbe0c7f6 Mon Sep 17 00:00:00 2001 From: Andrey Taritsyn Date: Thu, 26 Apr 2018 18:07:41 +0300 Subject: [PATCH] In BundleTransformer.Autoprefixer added support of Autoprefixer version 8.3.0.1 --- .../BundleTransformer.Autoprefixer.nuspec | 6 +- .../BundleTransformer.Autoprefixer/readme.txt | 4 +- .../Resources/autoprefixer-combined.js | 83 ++++++++++--------- 3 files changed, 49 insertions(+), 44 deletions(-) diff --git a/NuGet/BundleTransformer.Autoprefixer/BundleTransformer.Autoprefixer.nuspec b/NuGet/BundleTransformer.Autoprefixer/BundleTransformer.Autoprefixer.nuspec index 009730bf0..275f6bbbe 100644 --- a/NuGet/BundleTransformer.Autoprefixer/BundleTransformer.Autoprefixer.nuspec +++ b/NuGet/BundleTransformer.Autoprefixer/BundleTransformer.Autoprefixer.nuspec @@ -10,11 +10,11 @@ https://github.com/Taritsyn/BundleTransformer https://raw.githubusercontent.com/Taritsyn/BundleTransformer/master/images/icons/128/BundleTransformer_Autoprefixer_Logo_128x128.png false - BundleTransformer.Autoprefixer contains one postprocessor-adapter for postprocessing of CSS code - `AutoprefixCssPostProcessor`. `AutoprefixCssPostProcessor` is based on the Andrey Sitnik's Autoprefixer (https://github.com/postcss/autoprefixer) version 8.3. + BundleTransformer.Autoprefixer contains one postprocessor-adapter for postprocessing of CSS code - `AutoprefixCssPostProcessor`. `AutoprefixCssPostProcessor` is based on the Andrey Sitnik's Autoprefixer (https://github.com/postcss/autoprefixer) version 8.3.0.1. As a JS engine is used the JavaScript Engine Switcher library (https://github.com/Taritsyn/JavaScriptEngineSwitcher). For correct working of this module, you need to install one of the following NuGet packages: JavaScriptEngineSwitcher.Msie (only in the Chakra JsRT modes), JavaScriptEngineSwitcher.V8 or JavaScriptEngineSwitcher.ChakraCore. - BundleTransformer.Autoprefixer contains one postprocessor-adapter for postprocessing of CSS code - `AutoprefixCssPostProcessor`. `AutoprefixCssPostProcessor` is based on the Andrey Sitnik's Autoprefixer version 8.3. - Added support of Autoprefixer version 8.3. + BundleTransformer.Autoprefixer contains one postprocessor-adapter for postprocessing of CSS code - `AutoprefixCssPostProcessor`. `AutoprefixCssPostProcessor` is based on the Andrey Sitnik's Autoprefixer version 8.3.0.1. + Added support of Autoprefixer version 8.3.0.1. Copyright (c) 2012-2018 Andrey Taritsyn - http://www.taritsyn.ru en-US BundleTransformer System.Web.Optimization IBundleTransform ASP.NET CSS Bundling Postprocessing Postprocessor Autoprefixer diff --git a/NuGet/BundleTransformer.Autoprefixer/readme.txt b/NuGet/BundleTransformer.Autoprefixer/readme.txt index 67be5a6e5..1c722ee65 100644 --- a/NuGet/BundleTransformer.Autoprefixer/readme.txt +++ b/NuGet/BundleTransformer.Autoprefixer/readme.txt @@ -14,7 +14,7 @@ BundleTransformer.Autoprefixer contains one postprocessor-adapter for postprocessing of CSS code - `AutoprefixCssPostProcessor`. `AutoprefixCssPostProcessor` is based on the Andrey Sitnik's Autoprefixer - (https://github.com/postcss/autoprefixer) version 8.3. + (https://github.com/postcss/autoprefixer) version 8.3.0.1. As a JS engine is used the JavaScript Engine Switcher library (https://github.com/Taritsyn/JavaScriptEngineSwitcher). @@ -22,7 +22,7 @@ ============= RELEASE NOTES ============= - Added support of Autoprefixer version 8.3. + Added support of Autoprefixer version 8.3.0.1. ==================== POST-INSTALL ACTIONS diff --git a/src/BundleTransformer.Autoprefixer/Resources/autoprefixer-combined.js b/src/BundleTransformer.Autoprefixer/Resources/autoprefixer-combined.js index 3f4d69a3d..003eea21d 100644 --- a/src/BundleTransformer.Autoprefixer/Resources/autoprefixer-combined.js +++ b/src/BundleTransformer.Autoprefixer/Resources/autoprefixer-combined.js @@ -128,7 +128,7 @@ if (!Object.hasOwnProperty('assign')) { } /*! - * Autoprefixer v8.3 + * Autoprefixer v8.3.0.1 * https://github.com/postcss/autoprefixer * https://github.com/ai/autoprefixer-rails * @@ -9275,51 +9275,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; @@ -9343,7 +9356,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 @@ -9355,19 +9367,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(''); } @@ -9593,7 +9598,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; @@ -9777,7 +9782,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); @@ -10121,7 +10126,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,