autopolyfiller
Advanced tools
Comparing version 1.0.9 to 1.0.10
@@ -0,1 +1,5 @@ | ||
Version 1.0.10: | ||
* polyfills for `requestAnimationFrame()`, `cancelAnimationFrame()` | ||
* it uses semver to compare versions | ||
Version 1.0.9: | ||
@@ -2,0 +6,0 @@ * polyfills for `btoa()`, `atob()`, `matchMedia()` |
@@ -8,2 +8,17 @@ var polyfill = require('polyfill'), | ||
var polyfillsCode = polyfill.source; | ||
// Scan souce folder for polyfills | ||
fs.readdirSync(__dirname + '/source').forEach(function (fileName) { | ||
// Add lazy loader | ||
var polyfillName = fileName.replace(/\.js$/, ''); | ||
polyfillsCode.__defineGetter__(polyfillName, function () { | ||
// Lazily load polyfill code | ||
var code = fs.readFileSync(__dirname + '/source/' + fileName, 'utf8'); | ||
delete polyfillsCode[polyfillName]; | ||
polyfillsCode[polyfillName] = code; | ||
return code; | ||
}); | ||
}); | ||
debug('got %d polyfills', Object.keys(polyfillsCode).length); | ||
@@ -10,0 +25,0 @@ |
{ | ||
"Opera Mini": [{ | ||
"fill": "Promise" | ||
"fill": "Promise Window.prototype.requestAnimationFrame" | ||
}], | ||
"Opera Mobile": [{ | ||
"fill": "Promise" | ||
}, { | ||
"min": "10", | ||
"max": "12.1", | ||
"fill": "Window.prototype.requestAnimationFrame" | ||
}], | ||
"Opera": [{ | ||
"fill": "Promise" | ||
}, { | ||
"min": "9", | ||
"max": "12.1", | ||
"fill": "Window.prototype.requestAnimationFrame" | ||
}], | ||
"Android": [{ | ||
"fill": "Promise" | ||
}, { | ||
"min": "2", | ||
"max": "4.3", | ||
"fill": "Window.prototype.requestAnimationFrame" | ||
}], | ||
"BlackBerry": [{ | ||
"fill": "Promise" | ||
"fill": "Promise Window.prototype.requestAnimationFrame" | ||
}], | ||
"Chrome iOS": [{ | ||
"fill": "Promise" | ||
"fill": "Promise Window.prototype.requestAnimationFrame" | ||
}], | ||
"Safari iOS": [{ | ||
"fill": "Promise" | ||
}, { | ||
"min": "3", | ||
"max": "6.1", | ||
"fill": "Window.prototype.requestAnimationFrame" | ||
}], | ||
"Chrome": [{ | ||
"fill": "Promise" | ||
}, { | ||
"min": "4", | ||
"max": "23", | ||
"fill": "Window.prototype.requestAnimationFrame" | ||
}], | ||
"Internet Explorer": [{ | ||
"fill": "Promise" | ||
}, { | ||
"min": "6", | ||
"max": "9", | ||
"fill": "Window.prototype.requestAnimationFrame" | ||
}], | ||
"Firefox": [{ | ||
"fill": "Promise" | ||
}, { | ||
"min": "2", | ||
"max": "22", | ||
"fill": "Window.prototype.requestAnimationFrame" | ||
}], | ||
"Safari": [{ | ||
"fill": "Promise" | ||
}, { | ||
"min": "3", | ||
"max": "6", | ||
"fill": "Window.prototype.requestAnimationFrame" | ||
}] | ||
} |
var Browsers = require('autoprefixer/lib/browsers'), | ||
browsersData = require('autoprefixer/data/browsers'), | ||
debug = require('debug')('polyfill:reduce'), | ||
polyfill = require('polyfill'); | ||
polyfill = require('polyfill'), | ||
semver = require('semver'); | ||
@@ -26,3 +27,25 @@ var polyFillSets = polyfill.agent.js; | ||
/** | ||
* 10 -> 10.0.0 | ||
* 11.5 -> 11.5.0 | ||
* 1.1.1 -> 1.1.1 | ||
* | ||
* @param {string|number} version | ||
* @returns {string} | ||
*/ | ||
function toSemver(version) { | ||
return String(version).split('.').concat(0, 0, 0).slice(0, 3).join('.'); | ||
} | ||
/** | ||
* @param {string} comparatorName | ||
* @param {string} a | ||
* @param {string} b | ||
* @returns {boolean} | ||
*/ | ||
function cmp(comparatorName, a, b) { | ||
return semver[comparatorName](toSemver(a), toSemver(b)); | ||
} | ||
/** | ||
* | ||
* @param {String} browserCode | ||
@@ -41,7 +64,7 @@ * @param {String} version | ||
// X === A | ||
(range.only && range.only === version) || | ||
(range.only && cmp('eq', version, range.only)) || | ||
// X >= A | ||
(range.min && !range.max && version >= range.min) || | ||
(range.min && !range.max && cmp('gte', version, range.min)) || | ||
// A <= X <= B | ||
(range.min && range.max && version >= range.min && version <= range.max) || | ||
(range.min && range.max && cmp('gte', version, range.min) && cmp('lte', version, range.max)) || | ||
// Always | ||
@@ -48,0 +71,0 @@ (!range.min && !range.max && !range.only); |
@@ -6,3 +6,5 @@ var astQuery = require('grasp-equery').query; | ||
'atob': 'Window.prototype.base64', | ||
'matchMedia': 'Window.prototype.matchMedia' | ||
'matchMedia': 'Window.prototype.matchMedia', | ||
'requestAnimationFrame': 'Window.prototype.requestAnimationFrame', | ||
'cancelAnimationFrame': 'Window.prototype.requestAnimationFrame' | ||
}; | ||
@@ -9,0 +11,0 @@ |
@@ -9,3 +9,7 @@ { | ||
"after": "\n}\n" | ||
}, | ||
"Window.prototype.requestAnimationFrame": { | ||
"before": "", | ||
"after": "" | ||
} | ||
} |
@@ -5,3 +5,3 @@ { | ||
"keywords": ["polyfill", "polyfills", "dom", "ecmascript", "ecmascript5", "ecmascript6", "postprocessor"], | ||
"version" : "1.0.9", | ||
"version" : "1.0.10", | ||
"author" : "Mikhail Davydov <i@azproduction.ru>", | ||
@@ -24,3 +24,3 @@ "contributors" : [ | ||
"grasp-equery": "~0.2.0", | ||
"autoprefixer": "~1.0.20140213", | ||
"autoprefixer": "1.1.x", | ||
"debug": "~0.7.4", | ||
@@ -31,3 +31,4 @@ "node.extend": "~1.0.9", | ||
"globule": "0.2.0", | ||
"mkdirp": "~0.3.5" | ||
"mkdirp": "~0.3.5", | ||
"semver": "~2.2.1" | ||
}, | ||
@@ -34,0 +35,0 @@ "devDependencies" : { |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
472295
46
9524
10
+ Addedsemver@~2.2.1
+ Addedamdefine@1.0.1(transitive)
+ Addedautoprefixer@1.1.20140605(transitive)
+ Addedbalanced-match@1.0.2(transitive)
+ Addedbase64-js@0.0.8(transitive)
+ Addedbrace-expansion@1.1.11(transitive)
+ Addedconcat-map@0.0.1(transitive)
+ Addedfs-extra@0.9.1(transitive)
+ Addedfs.realpath@1.0.0(transitive)
+ Addedglob@7.2.3(transitive)
+ Addedinflight@1.0.6(transitive)
+ Addedminimatch@3.1.2(transitive)
+ Addedminimist@1.2.8(transitive)
+ Addedmkdirp@0.5.6(transitive)
+ Addedncp@0.5.1(transitive)
+ Addedonce@1.4.0(transitive)
+ Addedpath-is-absolute@1.0.1(transitive)
+ Addedpostcss@0.3.5(transitive)
+ Addedrimraf@2.7.1(transitive)
+ Addedsemver@2.2.1(transitive)
+ Addedsource-map@0.1.43(transitive)
+ Addedwrappy@1.0.2(transitive)
- Removedautoprefixer@1.0.20140213(transitive)
- Removedfs-extra@0.8.1(transitive)
- Removedncp@0.4.2(transitive)
- Removedpostcss@0.2.0(transitive)
- Removedrimraf@2.2.8(transitive)
- Removedsource-map@0.7.4(transitive)
Updatedautoprefixer@1.1.x