Improve code quality and write tests

This commit is contained in:
Shivam Mathur
2019-09-20 08:11:20 +05:30
parent db44db4b97
commit 43178a7254
3597 changed files with 255478 additions and 785554 deletions

19
node_modules/core-js-compat/LICENSE generated vendored Normal file
View File

@ -0,0 +1,19 @@
Copyright (c) 2014-2019 Denis Pushkarev
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.

37
node_modules/core-js-compat/README.md generated vendored Normal file
View File

@ -0,0 +1,37 @@
[`core-js-compat` package](https://github.com/zloirock/core-js/packages/core-js-compat) contains data about the necessity of [`core-js`](https://github.com/zloirock/core-js) modules and API for getting a list of required core-js modules by browserslist query.
```js
const {
list, // array of required modules
targets, // object with targets for each module
} = require('core-js-compat')({
targets: '> 2.5%', // browserslist query
filter: 'es.', // optional filter - string-prefix, regexp or list of modules
});
console.log(targets);
/* =>
{
'es.symbol.description': { ios: '12.0-12.1' },
'es.array.reverse': { ios: '12.0-12.1' },
'es.string.replace': { firefox: '63', ios: '12.0-12.1' },
'es.string.trim': { ios: '12.0-12.1' },
'es.promise': { firefox: '63' },
'es.promise.finally': { firefox: '63' },
'es.array-buffer.slice': { ios: '12.0-12.1' },
'es.typed-array.int8-array': { ios: '12.0-12.1' },
'es.typed-array.uint8-array': { ios: '12.0-12.1' },
'es.typed-array.uint8-clamped-array': { ios: '12.0-12.1' },
'es.typed-array.int16-array': { ios: '12.0-12.1' },
'es.typed-array.uint16-array': { ios: '12.0-12.1' },
'es.typed-array.int32-array': { ios: '12.0-12.1' },
'es.typed-array.uint32-array': { ios: '12.0-12.1' },
'es.typed-array.float32-array': { ios: '12.0-12.1' },
'es.typed-array.float64-array': { ios: '12.0-12.1' },
'es.typed-array.from': { ios: '12.0-12.1' },
'es.typed-array.of': { ios: '12.0-12.1' }
}
*/
```
If you want to add new / update data about modules required for target engines, [follow this instruction](https://github.com/zloirock/core-js/blob/master/CONTRIBUTING.md#updating-core-js-compat-data).

2401
node_modules/core-js-compat/data.json generated vendored Normal file

File diff suppressed because it is too large Load Diff

7589
node_modules/core-js-compat/entries.json generated vendored Normal file

File diff suppressed because it is too large Load Diff

View File

@ -0,0 +1,17 @@
'use strict';
const { coerce, lte } = require('semver');
const modulesByVersions = require('./modules-by-versions');
module.exports = function (raw) {
const corejs = coerce(String(raw));
if (corejs.major !== 3) {
throw RangeError('This version of `core-js-compat` works only with `core-js@3`.');
}
const result = [];
for (const version of Object.keys(modulesByVersions)) {
if (lte(coerce(version), corejs)) {
result.push(...modulesByVersions[version]);
}
}
return result;
};

105
node_modules/core-js-compat/index.js generated vendored Normal file
View File

@ -0,0 +1,105 @@
'use strict';
const { coerce, lt, lte } = require('semver');
const browserslist = require('browserslist');
const data = require('./data');
const getModulesListForTargetVersion = require('./get-modules-list-for-target-version');
const has = Function.call.bind({}.hasOwnProperty);
const mapping = new Map([
['ios_saf', 'ios'],
['and_chr', 'chrome'],
['and_ff', 'firefox'],
]);
const validTargets = new Set([
'android',
'chrome',
'edge',
'electron',
'firefox',
'ie',
'ios',
'node',
'opera',
'phantom',
'safari',
'samsung',
]);
function coercedLte(a, b) {
return lte(coerce(a), coerce(b));
}
function coercedLt(a, b) {
return lt(coerce(a), coerce(b));
}
function normalizeBrowsersList(list) {
return list.map(it => {
let [engine, version] = it.split(' ');
if (mapping.has(engine)) engine = mapping.get(engine);
else if (engine === 'android' && !coercedLte(version, '4.4.4')) engine = 'chrome';
return [engine, version];
}).filter(([engine]) => validTargets.has(engine));
}
function reduceByMinVersion(list) {
const targets = new Map();
for (const [engine, version] of list) {
if (!targets.has(engine) || coercedLte(version, targets.get(engine))) {
targets.set(engine, version);
}
}
return targets;
}
function checkModule(name, targets) {
if (!has(data, name)) throw new TypeError(`Incorrect module: ${ name }`);
const requirements = data[name];
const result = {
required: false,
targets: {},
};
for (const [engine, version] of targets) {
if (!has(requirements, engine) || coercedLt(version, requirements[engine])) {
result.required = true;
result.targets[engine] = version;
}
}
return result;
}
function compat({ targets, filter, version }) {
const list = browserslist(targets);
const engines = normalizeBrowsersList(list);
const reducedTargets = reduceByMinVersion(engines);
const result = {
list: [],
targets: {},
};
let modules = Array.isArray(filter) ? filter : Object.keys(data);
if (filter instanceof RegExp) modules = modules.filter(it => filter.test(it));
else if (typeof filter == 'string') modules = modules.filter(it => it.startsWith(filter));
if (version) {
const availableModules = new Set(getModulesListForTargetVersion(version));
modules = modules.filter(name => availableModules.has(name));
}
modules.forEach(key => {
const check = checkModule(key, reducedTargets);
if (check.required) {
result.list.push(key);
result.targets[key] = check.targets;
}
});
return result;
}
module.exports = compat;
module.exports.compat = compat;
module.exports.getModulesListForTargetVersion = getModulesListForTargetVersion;

305
node_modules/core-js-compat/modules-by-versions.json generated vendored Normal file
View File

@ -0,0 +1,305 @@
{
"3.0": [
"es.symbol",
"es.symbol.description",
"es.symbol.async-iterator",
"es.symbol.has-instance",
"es.symbol.is-concat-spreadable",
"es.symbol.iterator",
"es.symbol.match",
"es.symbol.replace",
"es.symbol.search",
"es.symbol.species",
"es.symbol.split",
"es.symbol.to-primitive",
"es.symbol.to-string-tag",
"es.symbol.unscopables",
"es.array.concat",
"es.array.copy-within",
"es.array.every",
"es.array.fill",
"es.array.filter",
"es.array.find",
"es.array.find-index",
"es.array.flat",
"es.array.flat-map",
"es.array.for-each",
"es.array.from",
"es.array.includes",
"es.array.index-of",
"es.array.is-array",
"es.array.iterator",
"es.array.join",
"es.array.last-index-of",
"es.array.map",
"es.array.of",
"es.array.reduce",
"es.array.reduce-right",
"es.array.reverse",
"es.array.slice",
"es.array.some",
"es.array.sort",
"es.array.species",
"es.array.splice",
"es.array.unscopables.flat",
"es.array.unscopables.flat-map",
"es.array-buffer.constructor",
"es.array-buffer.is-view",
"es.array-buffer.slice",
"es.data-view",
"es.date.now",
"es.date.to-iso-string",
"es.date.to-json",
"es.date.to-primitive",
"es.date.to-string",
"es.function.bind",
"es.function.has-instance",
"es.function.name",
"es.json.to-string-tag",
"es.map",
"es.math.acosh",
"es.math.asinh",
"es.math.atanh",
"es.math.cbrt",
"es.math.clz32",
"es.math.cosh",
"es.math.expm1",
"es.math.fround",
"es.math.hypot",
"es.math.imul",
"es.math.log10",
"es.math.log1p",
"es.math.log2",
"es.math.sign",
"es.math.sinh",
"es.math.tanh",
"es.math.to-string-tag",
"es.math.trunc",
"es.number.constructor",
"es.number.epsilon",
"es.number.is-finite",
"es.number.is-integer",
"es.number.is-nan",
"es.number.is-safe-integer",
"es.number.max-safe-integer",
"es.number.min-safe-integer",
"es.number.parse-float",
"es.number.parse-int",
"es.number.to-fixed",
"es.number.to-precision",
"es.object.assign",
"es.object.create",
"es.object.define-getter",
"es.object.define-properties",
"es.object.define-property",
"es.object.define-setter",
"es.object.entries",
"es.object.freeze",
"es.object.from-entries",
"es.object.get-own-property-descriptor",
"es.object.get-own-property-descriptors",
"es.object.get-own-property-names",
"es.object.get-prototype-of",
"es.object.is",
"es.object.is-extensible",
"es.object.is-frozen",
"es.object.is-sealed",
"es.object.keys",
"es.object.lookup-getter",
"es.object.lookup-setter",
"es.object.prevent-extensions",
"es.object.seal",
"es.object.set-prototype-of",
"es.object.to-string",
"es.object.values",
"es.parse-float",
"es.parse-int",
"es.promise",
"es.promise.finally",
"es.reflect.apply",
"es.reflect.construct",
"es.reflect.define-property",
"es.reflect.delete-property",
"es.reflect.get",
"es.reflect.get-own-property-descriptor",
"es.reflect.get-prototype-of",
"es.reflect.has",
"es.reflect.is-extensible",
"es.reflect.own-keys",
"es.reflect.prevent-extensions",
"es.reflect.set",
"es.reflect.set-prototype-of",
"es.regexp.constructor",
"es.regexp.exec",
"es.regexp.flags",
"es.regexp.to-string",
"es.set",
"es.string.code-point-at",
"es.string.ends-with",
"es.string.from-code-point",
"es.string.includes",
"es.string.iterator",
"es.string.match",
"es.string.pad-end",
"es.string.pad-start",
"es.string.raw",
"es.string.repeat",
"es.string.replace",
"es.string.search",
"es.string.split",
"es.string.starts-with",
"es.string.trim",
"es.string.trim-end",
"es.string.trim-start",
"es.string.anchor",
"es.string.big",
"es.string.blink",
"es.string.bold",
"es.string.fixed",
"es.string.fontcolor",
"es.string.fontsize",
"es.string.italics",
"es.string.link",
"es.string.small",
"es.string.strike",
"es.string.sub",
"es.string.sup",
"es.typed-array.float32-array",
"es.typed-array.float64-array",
"es.typed-array.int8-array",
"es.typed-array.int16-array",
"es.typed-array.int32-array",
"es.typed-array.uint8-array",
"es.typed-array.uint8-clamped-array",
"es.typed-array.uint16-array",
"es.typed-array.uint32-array",
"es.typed-array.copy-within",
"es.typed-array.every",
"es.typed-array.fill",
"es.typed-array.filter",
"es.typed-array.find",
"es.typed-array.find-index",
"es.typed-array.for-each",
"es.typed-array.from",
"es.typed-array.includes",
"es.typed-array.index-of",
"es.typed-array.iterator",
"es.typed-array.join",
"es.typed-array.last-index-of",
"es.typed-array.map",
"es.typed-array.of",
"es.typed-array.reduce",
"es.typed-array.reduce-right",
"es.typed-array.reverse",
"es.typed-array.set",
"es.typed-array.slice",
"es.typed-array.some",
"es.typed-array.sort",
"es.typed-array.subarray",
"es.typed-array.to-locale-string",
"es.typed-array.to-string",
"es.weak-map",
"es.weak-set",
"esnext.aggregate-error",
"esnext.array.last-index",
"esnext.array.last-item",
"esnext.composite-key",
"esnext.composite-symbol",
"esnext.global-this",
"esnext.map.delete-all",
"esnext.map.every",
"esnext.map.filter",
"esnext.map.find",
"esnext.map.find-key",
"esnext.map.from",
"esnext.map.group-by",
"esnext.map.includes",
"esnext.map.key-by",
"esnext.map.key-of",
"esnext.map.map-keys",
"esnext.map.map-values",
"esnext.map.merge",
"esnext.map.of",
"esnext.map.reduce",
"esnext.map.some",
"esnext.map.update",
"esnext.math.clamp",
"esnext.math.deg-per-rad",
"esnext.math.degrees",
"esnext.math.fscale",
"esnext.math.iaddh",
"esnext.math.imulh",
"esnext.math.isubh",
"esnext.math.rad-per-deg",
"esnext.math.radians",
"esnext.math.scale",
"esnext.math.seeded-prng",
"esnext.math.signbit",
"esnext.math.umulh",
"esnext.number.from-string",
"esnext.observable",
"esnext.promise.all-settled",
"esnext.promise.any",
"esnext.promise.try",
"esnext.reflect.define-metadata",
"esnext.reflect.delete-metadata",
"esnext.reflect.get-metadata",
"esnext.reflect.get-metadata-keys",
"esnext.reflect.get-own-metadata",
"esnext.reflect.get-own-metadata-keys",
"esnext.reflect.has-metadata",
"esnext.reflect.has-own-metadata",
"esnext.reflect.metadata",
"esnext.set.add-all",
"esnext.set.delete-all",
"esnext.set.difference",
"esnext.set.every",
"esnext.set.filter",
"esnext.set.find",
"esnext.set.from",
"esnext.set.intersection",
"esnext.set.is-disjoint-from",
"esnext.set.is-subset-of",
"esnext.set.is-superset-of",
"esnext.set.join",
"esnext.set.map",
"esnext.set.of",
"esnext.set.reduce",
"esnext.set.some",
"esnext.set.symmetric-difference",
"esnext.set.union",
"esnext.string.at",
"esnext.string.code-points",
"esnext.string.match-all",
"esnext.string.replace-all",
"esnext.symbol.dispose",
"esnext.symbol.observable",
"esnext.symbol.pattern-match",
"esnext.weak-map.delete-all",
"esnext.weak-map.from",
"esnext.weak-map.of",
"esnext.weak-set.add-all",
"esnext.weak-set.delete-all",
"esnext.weak-set.from",
"esnext.weak-set.of",
"web.dom-collections.for-each",
"web.dom-collections.iterator",
"web.immediate",
"web.queue-microtask",
"web.timers",
"web.url",
"web.url.to-json",
"web.url-search-params"
],
"3.1": [
"es.string.match-all",
"es.symbol.match-all",
"esnext.symbol.replace-all"
],
"3.2": [
"es.promise.all-settled",
"esnext.array.is-template-object",
"esnext.map.update-or-insert",
"esnext.symbol.async-dispose"
]
}

52
node_modules/core-js-compat/package.json generated vendored Normal file
View File

@ -0,0 +1,52 @@
{
"_args": [
[
"core-js-compat@3.2.1",
"E:\\python\\setup-php"
]
],
"_from": "core-js-compat@3.2.1",
"_id": "core-js-compat@3.2.1",
"_inBundle": false,
"_integrity": "sha512-MwPZle5CF9dEaMYdDeWm73ao/IflDH+FjeJCWEADcEgFSE9TLimFKwJsfmkwzI8eC0Aj0mgvMDjeQjrElkz4/A==",
"_location": "/core-js-compat",
"_phantomChildren": {},
"_requested": {
"type": "version",
"registry": true,
"raw": "core-js-compat@3.2.1",
"name": "core-js-compat",
"escapedName": "core-js-compat",
"rawSpec": "3.2.1",
"saveSpec": null,
"fetchSpec": "3.2.1"
},
"_requiredBy": [
"/@babel/preset-env"
],
"_resolved": "https://registry.npmjs.org/core-js-compat/-/core-js-compat-3.2.1.tgz",
"_spec": "3.2.1",
"_where": "E:\\python\\setup-php",
"bugs": {
"url": "https://github.com/zloirock/core-js/issues"
},
"dependencies": {
"browserslist": "^4.6.6",
"semver": "^6.3.0"
},
"description": "core-js compat",
"devDependencies": {
"detective": "^5.2.0",
"electron-to-chromium": "^1.3.224",
"glob": "^7.1.4"
},
"homepage": "https://github.com/zloirock/core-js#readme",
"license": "MIT",
"main": "index.js",
"name": "core-js-compat",
"repository": {
"type": "git",
"url": "git+https://github.com/zloirock/core-js.git"
},
"version": "3.2.1"
}