diff options
Diffstat (limited to 'node_modules/caniuse-lite/dist')
9 files changed, 147 insertions, 0 deletions
diff --git a/node_modules/caniuse-lite/dist/lib/statuses.js b/node_modules/caniuse-lite/dist/lib/statuses.js new file mode 100644 index 0000000..4d73ab3 --- /dev/null +++ b/node_modules/caniuse-lite/dist/lib/statuses.js @@ -0,0 +1,9 @@ +module.exports = { + 1: 'ls', // WHATWG Living Standard + 2: 'rec', // W3C Recommendation + 3: 'pr', // W3C Proposed Recommendation + 4: 'cr', // W3C Candidate Recommendation + 5: 'wd', // W3C Working Draft + 6: 'other', // Non-W3C, but reputable + 7: 'unoff' // Unofficial, Editor's Draft or W3C "Note" +} diff --git a/node_modules/caniuse-lite/dist/lib/supported.js b/node_modules/caniuse-lite/dist/lib/supported.js new file mode 100644 index 0000000..3f81e4e --- /dev/null +++ b/node_modules/caniuse-lite/dist/lib/supported.js @@ -0,0 +1,9 @@ +module.exports = { + y: 1 << 0, + n: 1 << 1, + a: 1 << 2, + p: 1 << 3, + u: 1 << 4, + x: 1 << 5, + d: 1 << 6 +} diff --git a/node_modules/caniuse-lite/dist/unpacker/agents.js b/node_modules/caniuse-lite/dist/unpacker/agents.js new file mode 100644 index 0000000..0c8a790 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/agents.js @@ -0,0 +1,47 @@ +'use strict' + +const browsers = require('./browsers').browsers +const versions = require('./browserVersions').browserVersions +const agentsData = require('../../data/agents') + +function unpackBrowserVersions(versionsData) { + return Object.keys(versionsData).reduce((usage, version) => { + usage[versions[version]] = versionsData[version] + return usage + }, {}) +} + +module.exports.agents = Object.keys(agentsData).reduce((map, key) => { + let versionsData = agentsData[key] + map[browsers[key]] = Object.keys(versionsData).reduce((data, entry) => { + if (entry === 'A') { + data.usage_global = unpackBrowserVersions(versionsData[entry]) + } else if (entry === 'C') { + data.versions = versionsData[entry].reduce((list, version) => { + if (version === '') { + list.push(null) + } else { + list.push(versions[version]) + } + return list + }, []) + } else if (entry === 'D') { + data.prefix_exceptions = unpackBrowserVersions(versionsData[entry]) + } else if (entry === 'E') { + data.browser = versionsData[entry] + } else if (entry === 'F') { + data.release_date = Object.keys(versionsData[entry]).reduce( + (map2, key2) => { + map2[versions[key2]] = versionsData[entry][key2] + return map2 + }, + {} + ) + } else { + // entry is B + data.prefix = versionsData[entry] + } + return data + }, {}) + return map +}, {}) diff --git a/node_modules/caniuse-lite/dist/unpacker/browserVersions.js b/node_modules/caniuse-lite/dist/unpacker/browserVersions.js new file mode 100644 index 0000000..553526e --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/browserVersions.js @@ -0,0 +1 @@ +module.exports.browserVersions = require('../../data/browserVersions') diff --git a/node_modules/caniuse-lite/dist/unpacker/browsers.js b/node_modules/caniuse-lite/dist/unpacker/browsers.js new file mode 100644 index 0000000..85e68b4 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/browsers.js @@ -0,0 +1 @@ +module.exports.browsers = require('../../data/browsers') diff --git a/node_modules/caniuse-lite/dist/unpacker/feature.js b/node_modules/caniuse-lite/dist/unpacker/feature.js new file mode 100644 index 0000000..9440b8a --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/feature.js @@ -0,0 +1,48 @@ +'use strict' + +const statuses = require('../lib/statuses') +const supported = require('../lib/supported') +const browsers = require('./browsers').browsers +const versions = require('./browserVersions').browserVersions + +const MATH2LOG = Math.log(2) + +function unpackSupport(cipher) { + // bit flags + let stats = Object.keys(supported).reduce((list, support) => { + if (cipher & supported[support]) list.push(support) + return list + }, []) + + // notes + let notes = cipher >> 7 + let notesArray = [] + while (notes) { + let note = Math.floor(Math.log(notes) / MATH2LOG) + 1 + notesArray.unshift(`#${note}`) + notes -= Math.pow(2, note - 1) + } + + return stats.concat(notesArray).join(' ') +} + +function unpackFeature(packed) { + let unpacked = { status: statuses[packed.B], title: packed.C } + unpacked.stats = Object.keys(packed.A).reduce((browserStats, key) => { + let browser = packed.A[key] + browserStats[browsers[key]] = Object.keys(browser).reduce( + (stats, support) => { + let packedVersions = browser[support].split(' ') + let unpacked2 = unpackSupport(support) + packedVersions.forEach(v => (stats[versions[v]] = unpacked2)) + return stats + }, + {} + ) + return browserStats + }, {}) + return unpacked +} + +module.exports = unpackFeature +module.exports.default = unpackFeature diff --git a/node_modules/caniuse-lite/dist/unpacker/features.js b/node_modules/caniuse-lite/dist/unpacker/features.js new file mode 100644 index 0000000..8362aec --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/features.js @@ -0,0 +1,6 @@ +/* + * Load this dynamically so that it + * doesn't appear in the rollup bundle. + */ + +module.exports.features = require('../../data/features') diff --git a/node_modules/caniuse-lite/dist/unpacker/index.js b/node_modules/caniuse-lite/dist/unpacker/index.js new file mode 100644 index 0000000..12017e8 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/index.js @@ -0,0 +1,4 @@ +module.exports.agents = require('./agents').agents +module.exports.feature = require('./feature') +module.exports.features = require('./features').features +module.exports.region = require('./region') diff --git a/node_modules/caniuse-lite/dist/unpacker/region.js b/node_modules/caniuse-lite/dist/unpacker/region.js new file mode 100644 index 0000000..d5cc2b6 --- /dev/null +++ b/node_modules/caniuse-lite/dist/unpacker/region.js @@ -0,0 +1,22 @@ +'use strict' + +const browsers = require('./browsers').browsers + +function unpackRegion(packed) { + return Object.keys(packed).reduce((list, browser) => { + let data = packed[browser] + list[browsers[browser]] = Object.keys(data).reduce((memo, key) => { + let stats = data[key] + if (key === '_') { + stats.split(' ').forEach(version => (memo[version] = null)) + } else { + memo[key] = stats + } + return memo + }, {}) + return list + }, {}) +} + +module.exports = unpackRegion +module.exports.default = unpackRegion |