From 26105034da4fcce7ac883c899d781f016559310d Mon Sep 17 00:00:00 2001 From: ruki Date: Thu, 8 Nov 2018 00:38:48 +0800 Subject: switch to vuepress --- node_modules/caniuse-api/CHANGELOG.md | 79 +++++++++++++ node_modules/caniuse-api/LICENSE | 21 ++++ node_modules/caniuse-api/README.md | 129 +++++++++++++++++++++ node_modules/caniuse-api/dist/index.js | 99 ++++++++++++++++ node_modules/caniuse-api/dist/utils.js | 59 ++++++++++ .../caniuse-api/node_modules/.bin/browserslist | 1 + node_modules/caniuse-api/package.json | 47 ++++++++ 7 files changed, 435 insertions(+) create mode 100644 node_modules/caniuse-api/CHANGELOG.md create mode 100644 node_modules/caniuse-api/LICENSE create mode 100644 node_modules/caniuse-api/README.md create mode 100644 node_modules/caniuse-api/dist/index.js create mode 100644 node_modules/caniuse-api/dist/utils.js create mode 120000 node_modules/caniuse-api/node_modules/.bin/browserslist create mode 100644 node_modules/caniuse-api/package.json (limited to 'node_modules/caniuse-api') diff --git a/node_modules/caniuse-api/CHANGELOG.md b/node_modules/caniuse-api/CHANGELOG.md new file mode 100644 index 00000000..b007a41b --- /dev/null +++ b/node_modules/caniuse-api/CHANGELOG.md @@ -0,0 +1,79 @@ +# 1.6.1 - 2017-04-07 + +- Added: export the feature list + ([#48](https://github.com/Nyalab/caniuse-api/pull/48)) + +# 1.5.3 - 2017-02-01 + +- Removed unused dependency + ([#54](https://github.com/Nyalab/caniuse-api/pull/54) - @wtgtybhertgeghgtwtg) + +# 1.5.2 - 2016-09-05 + +- Fixed: no more generation `postinstall` hook ``\o/``. + ([#47](https://github.com/Nyalab/caniuse-api/pull/47) - @alexisvincent) + +# 1.5.1 - 2016-08-06 + +- Fixed: Do not fail when browserslist gives a browser that caniuse-api doesn't + know about + ([#45](https://github.com/Nyalab/caniuse-api/pull/45) - @onigoetz) + +# 1.5.0 - 2016-06-01 + +- Added: JSPM support with explicit file extensions ([#40](https://github.com/Nyalab/caniuse-api/issues/40)) +- Upgraded: dependecies (lodash.memoize, lodash.uniq, shelljs, babel-tape-runner, tape, tap-spec) +- Upgraded: ask travis to only test node stable +- Upgraded: some tests fixed, some tests added + +# 1.4.1 - 2015-10-18 + +- Fixed: `generator.js` was missing + +# 1.4.0 - 2015-10-18 + +- Upgraded: browserlist 1.x +- Upgraded: shelljs 0.5.x +- Added: output to notify if generation has been made or not +(related to [#25](https://github.com/Nyalab/caniuse-api/issues/25)) + +# 1.3.2 - 2015-06-23 + +- Fixed: lodash.uniq dep +([#31](https://github.com/Nyalab/caniuse-api/issues/31)) + +# 1.3.1 - 2015-03-31 + +- Fixed: Windows support + +# 1.3.0 - 2015-03-30 + +- Added: better exception messages +- Added: full browserify compatibility (by avoiding dynamic require) + +# 1.2.2 - 2015-02-06 + +- Fixed: postinstall hook for Windows + +# 1.2.1 - 2015-02-04 + +- Changed: Allow in browser usage by avoiding `require.resolve` and using a generated json instead or reading a directory ([#20](https://github.com/Nyalab/caniuse-api/pull/20)] + +# 1.2.0 [YANKED] + +# 1.1.0 - 2015-02-03 + +- Fixed: usage of caniuse-db outside the package itself +- Changed: upgrade to browserslist 0.2.x + +# 1.0.0 - 2014-12-16 + +- Added: package is now automatically tested by [Travis-CI](https://travis-ci.org/Nyalab/caniuse-api) + +# 0.1.0 - 2014-12-15 + +- Changed: complete API changes, released as `caniuse-api` package + +# 0.0.1 - 2014-12-09 + +✨Initial release diff --git a/node_modules/caniuse-api/LICENSE b/node_modules/caniuse-api/LICENSE new file mode 100644 index 00000000..6803e545 --- /dev/null +++ b/node_modules/caniuse-api/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2014 Sébastien Balayn + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE +SOFTWARE. diff --git a/node_modules/caniuse-api/README.md b/node_modules/caniuse-api/README.md new file mode 100644 index 00000000..4e9d4ceb --- /dev/null +++ b/node_modules/caniuse-api/README.md @@ -0,0 +1,129 @@ +# caniuse-api [![Build Status](https://travis-ci.org/Nyalab/caniuse-api.svg?branch=master)](https://travis-ci.org/Nyalab/caniuse-api) [![Build status](https://ci.appveyor.com/api/projects/status/6j3na522bv3bxfa5/branch/master?svg=true)](https://ci.appveyor.com/project/MoOx/caniuse-api/branch/master) + +request the caniuse data to check browsers compatibilities + +## Installation + +```console +$ npm install caniuse-api --save +``` + +## Usage + +```js +const caniuse = require('caniuse-api') + +caniuse.getSupport('border-radius') +caniuse.isSupported('border-radius', 'ie 8, ie 9') +caniuse.setBrowserScope('> 5%, last 1 version') +caniuse.getSupport('border-radius') +// ... +``` + +## API + +#### `caniuse.getSupport(feature)` + +_ask since which browsers versions a feature is available_ + +* `y`: Since which browser version the feature is available +* `n`: Up to which browser version the feature is unavailable +* `a`: Up to which browser version the feature is partially supported +* `X`: Up to which browser version the feature is prefixed + +```js +caniuse.getSupport('border-radius', true) +/* +[ safari: { y: 3.1, x: 4 }, + opera: { n: 10, y: 10.5 }, + ios_saf: { y: 3.2, x: 3.2 }, + ie_mob: { y: 10 }, + ie: { n: 8, y: 9 }, + firefox: { a: 2, x: 3.6, y: 3 }, + chrome: { y: 4, x: 4 }, + and_chr: { y: 39 } ] +*/ +``` + +#### `caniuse.isSupported(feature, browsers)` + +_ask if a feature is supported by some browsers_ + +```js +caniuse.isSupported('border-radius', 'ie 8, ie 9') // false +caniuse.isSupported('border-radius', 'ie 9') // true +``` + +#### `caniuse.find(query)` + +_search for a caniuse feature name_ + +Ex: + +```js +caniuse.find('radius') // ['border-radius'] +caniuse.find('nothingness') // [] +caniuse.find('css3') +/* +[ 'css3-boxsizing', + 'css3-colors', + 'css3-cursors-newer', + 'css3-cursors', + 'css3-tabsize' ] +*/ +``` + +#### `caniuse.getLatestStableBrowsers()` + +_get the current version for each browser_ + +```js +caniuse.getLatestStableBrowsers() +/* +[ 'safari 8', + 'opera 26', + 'ios_saf 8.1', + 'ie_mob 11', + 'ie 11', + 'firefox 33', + 'chrome 39' ] +*/ +``` + +#### `caniuse.getBrowserScope()` + +_returns a list of browsers currently used for the scope of operations_ + +```js +caniuse.getBrowserScope() +/* +[ 'safari', + 'opera', + 'op_mini', + 'ios_saf', + 'ie_mob', + 'ie', + 'firefox', + 'chrome', + 'android', + 'and_uc', + 'and_chr' ] +*/ +``` + +#### `caniuse.setBrowserScope(browserscope)` + +_if you do not like the default browser scope, you can set it globally by using this method_ + +* browserscope should be a 'autoprefixer' formatted string + +```js +caniuse.setBrowserScope('> 5%, last 2 versions, Firefox ESR, Opera 12.1') +``` + + +--- + +## [Changelog](CHANGELOG.md) + +## [License](LICENSE) diff --git a/node_modules/caniuse-api/dist/index.js b/node_modules/caniuse-api/dist/index.js new file mode 100644 index 00000000..8c0f4357 --- /dev/null +++ b/node_modules/caniuse-api/dist/index.js @@ -0,0 +1,99 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.getBrowserScope = exports.setBrowserScope = exports.getLatestStableBrowsers = exports.find = exports.isSupported = exports.getSupport = exports.features = undefined; + +var _lodash = require("lodash.memoize"); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _browserslist = require("browserslist"); + +var _browserslist2 = _interopRequireDefault(_browserslist); + +var _utils = require("./utils"); + +var _data = require("caniuse-db/data.json"); + +var _data2 = _interopRequireDefault(_data); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +var features = _data2.default.data; +var featuresList = Object.keys(features); + +var browsers = void 0; +function setBrowserScope(browserList) { + browsers = (0, _utils.cleanBrowsersList)(browserList); +} + +function getBrowserScope() { + return browsers; +} + +var parse = (0, _lodash2.default)(_utils.parseCaniuseData, function (feature, browsers) { + return feature.title + browsers; +}); + +function getSupport(query) { + var feature = void 0; + try { + feature = features[query]; + } catch (e) { + var res = find(query); + if (res.length === 1) return getSupport(res[0]); + throw new ReferenceError("Please provide a proper feature name. Cannot find " + query); + } + return parse(feature, browsers); +} + +function isSupported(feature, browsers) { + var data = void 0; + try { + data = features[feature]; + } catch (e) { + var res = find(feature); + if (res.length === 1) { + data = features[res[0]]; + } else { + throw new ReferenceError("Please provide a proper feature name. Cannot find " + feature); + } + } + + return (0, _browserslist2.default)(browsers).map(function (browser) { + return browser.split(" "); + }).every(function (browser) { + return data.stats[browser[0]] && data.stats[browser[0]][browser[1]] === "y"; + }); +} + +function find(query) { + if (typeof query !== "string") { + throw new TypeError("The `query` parameter should be a string."); + } + + if (~featuresList.indexOf(query)) { + // exact match + return query; + } + + return featuresList.filter(function (file) { + return (0, _utils.contains)(file, query); + }); +} + +function getLatestStableBrowsers() { + return _browserslist2.default.queries.lastVersions.select(1); +} + +setBrowserScope(); + +exports.features = featuresList; +exports.getSupport = getSupport; +exports.isSupported = isSupported; +exports.find = find; +exports.getLatestStableBrowsers = getLatestStableBrowsers; +exports.setBrowserScope = setBrowserScope; +exports.getBrowserScope = getBrowserScope; \ No newline at end of file diff --git a/node_modules/caniuse-api/dist/utils.js b/node_modules/caniuse-api/dist/utils.js new file mode 100644 index 00000000..211402de --- /dev/null +++ b/node_modules/caniuse-api/dist/utils.js @@ -0,0 +1,59 @@ +"use strict"; + +Object.defineProperty(exports, "__esModule", { + value: true +}); +exports.contains = contains; +exports.parseCaniuseData = parseCaniuseData; +exports.cleanBrowsersList = cleanBrowsersList; + +var _lodash = require("lodash.uniq"); + +var _lodash2 = _interopRequireDefault(_lodash); + +var _browserslist = require("browserslist"); + +var _browserslist2 = _interopRequireDefault(_browserslist); + +function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; } + +function contains(str, substr) { + return !!~str.indexOf(substr); +} + +function parseCaniuseData(feature, browsers) { + var support = {}; + var letters; + var letter; + + browsers.forEach(function (browser) { + support[browser] = {}; + for (var info in feature.stats[browser]) { + letters = feature.stats[browser][info].split(" "); + info = parseFloat(info.split("-")[0]); //if info is a range, take the left + if (isNaN(info)) continue; + for (var i = 0; i < letters.length; i++) { + letter = letters[i]; + if (letter === "y") { + // min support asked, need to find the min value + if (typeof support[browser][letter] === "undefined" || info < support[browser][letter]) { + support[browser][letter] = info; + } + } else { + // any other support, need to find the max value + if (typeof support[browser][letter] === "undefined" || info > support[browser][letter]) { + support[browser][letter] = info; + } + } + } + } + }); + + return support; +} + +function cleanBrowsersList(browserList) { + return (0, _lodash2.default)((0, _browserslist2.default)(browserList).map(function (browser) { + return browser.split(" ")[0]; + })); +} \ No newline at end of file diff --git a/node_modules/caniuse-api/node_modules/.bin/browserslist b/node_modules/caniuse-api/node_modules/.bin/browserslist new file mode 120000 index 00000000..c4cc06e3 --- /dev/null +++ b/node_modules/caniuse-api/node_modules/.bin/browserslist @@ -0,0 +1 @@ +../../../browserslist/cli.js \ No newline at end of file diff --git a/node_modules/caniuse-api/package.json b/node_modules/caniuse-api/package.json new file mode 100644 index 00000000..0b7f5e56 --- /dev/null +++ b/node_modules/caniuse-api/package.json @@ -0,0 +1,47 @@ +{ + "name": "caniuse-api", + "version": "1.6.1", + "description": "request the caniuse data to check browsers compatibilities", + "repository": "https://github.com/nyalab/caniuse-api.git", + "keywords": [ + "caniuse", + "browserslist" + ], + "authors": [ + "nyalab", + "MoOx" + ], + "license": "MIT", + "main": "dist/index.js", + "files": [ + "dist" + ], + "dependencies": { + "browserslist": "^1.3.6", + "caniuse-db": "^1.0.30000529", + "lodash.memoize": "^4.1.2", + "lodash.uniq": "^4.5.0" + }, + "devDependencies": { + "babel-cli": "^6.22.2", + "babel-eslint": "^5.0.0", + "babel-preset-latest": "^6.22.0", + "babel-tape-runner": "^2.0.1", + "jshint": "^2.5.10", + "npmpub": "^3.1.0", + "tap-spec": "^4.1.1", + "tape": "^4.6.0" + }, + "scripts": { + "build": "babel src --out-dir dist", + "lint": "jshint src", + "prepublish": "npm run build", + "test": "npm run lint && babel-tape-runner test/*.js | tap-spec", + "release": "npmpub" + }, + "babel": { + "presets":[ + "babel-preset-latest" + ] + } +} -- cgit v1.2.3