mirror of
https://github.com/shivammathur/setup-php.git
synced 2025-11-09 11:20:55 +07:00
Improve code quality and write tests
This commit is contained in:
22
node_modules/@babel/helper-define-map/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-define-map/LICENSE
generated
vendored
Normal file
@ -0,0 +1,22 @@
|
||||
MIT License
|
||||
|
||||
Copyright (c) 2014-present Sebastian McKenzie and other contributors
|
||||
|
||||
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.
|
||||
19
node_modules/@babel/helper-define-map/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-define-map/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# @babel/helper-define-map
|
||||
|
||||
> Helper function to define a map
|
||||
|
||||
See our website [@babel/helper-define-map](https://babeljs.io/docs/en/next/babel-helper-define-map.html) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save-dev @babel/helper-define-map
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-define-map --dev
|
||||
```
|
||||
165
node_modules/@babel/helper-define-map/lib/index.js
generated
vendored
Normal file
165
node_modules/@babel/helper-define-map/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,165 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.push = push;
|
||||
exports.hasComputed = hasComputed;
|
||||
exports.toComputedObjectFromClass = toComputedObjectFromClass;
|
||||
exports.toClassObject = toClassObject;
|
||||
exports.toDefineObject = toDefineObject;
|
||||
|
||||
function _helperFunctionName() {
|
||||
const data = _interopRequireDefault(require("@babel/helper-function-name"));
|
||||
|
||||
_helperFunctionName = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _has() {
|
||||
const data = _interopRequireDefault(require("lodash/has"));
|
||||
|
||||
_has = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function t() {
|
||||
const data = _interopRequireWildcard(require("@babel/types"));
|
||||
|
||||
t = function () {
|
||||
return data;
|
||||
};
|
||||
|
||||
return data;
|
||||
}
|
||||
|
||||
function _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } else { var newObj = {}; if (obj != null) { for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = Object.defineProperty && Object.getOwnPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : {}; if (desc.get || desc.set) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } } newObj.default = obj; return newObj; } }
|
||||
|
||||
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
|
||||
|
||||
function toKind(node) {
|
||||
if (t().isClassMethod(node) || t().isObjectMethod(node)) {
|
||||
if (node.kind === "get" || node.kind === "set") {
|
||||
return node.kind;
|
||||
}
|
||||
}
|
||||
|
||||
return "value";
|
||||
}
|
||||
|
||||
function push(mutatorMap, node, kind, file, scope) {
|
||||
const alias = t().toKeyAlias(node);
|
||||
let map = {};
|
||||
if ((0, _has().default)(mutatorMap, alias)) map = mutatorMap[alias];
|
||||
mutatorMap[alias] = map;
|
||||
map._inherits = map._inherits || [];
|
||||
|
||||
map._inherits.push(node);
|
||||
|
||||
map._key = node.key;
|
||||
|
||||
if (node.computed) {
|
||||
map._computed = true;
|
||||
}
|
||||
|
||||
if (node.decorators) {
|
||||
const decorators = map.decorators = map.decorators || t().arrayExpression([]);
|
||||
decorators.elements = decorators.elements.concat(node.decorators.map(dec => dec.expression).reverse());
|
||||
}
|
||||
|
||||
if (map.value || map.initializer) {
|
||||
throw file.buildCodeFrameError(node, "Key conflict with sibling node");
|
||||
}
|
||||
|
||||
let key, value;
|
||||
|
||||
if (t().isObjectProperty(node) || t().isObjectMethod(node) || t().isClassMethod(node)) {
|
||||
key = t().toComputedKey(node, node.key);
|
||||
}
|
||||
|
||||
if (t().isProperty(node)) {
|
||||
value = node.value;
|
||||
} else if (t().isObjectMethod(node) || t().isClassMethod(node)) {
|
||||
value = t().functionExpression(null, node.params, node.body, node.generator, node.async);
|
||||
value.returnType = node.returnType;
|
||||
}
|
||||
|
||||
const inheritedKind = toKind(node);
|
||||
|
||||
if (!kind || inheritedKind !== "value") {
|
||||
kind = inheritedKind;
|
||||
}
|
||||
|
||||
if (scope && t().isStringLiteral(key) && (kind === "value" || kind === "initializer") && t().isFunctionExpression(value)) {
|
||||
value = (0, _helperFunctionName().default)({
|
||||
id: key,
|
||||
node: value,
|
||||
scope
|
||||
});
|
||||
}
|
||||
|
||||
if (value) {
|
||||
t().inheritsComments(value, node);
|
||||
map[kind] = value;
|
||||
}
|
||||
|
||||
return map;
|
||||
}
|
||||
|
||||
function hasComputed(mutatorMap) {
|
||||
for (const key of Object.keys(mutatorMap)) {
|
||||
if (mutatorMap[key]._computed) {
|
||||
return true;
|
||||
}
|
||||
}
|
||||
|
||||
return false;
|
||||
}
|
||||
|
||||
function toComputedObjectFromClass(obj) {
|
||||
const objExpr = t().arrayExpression([]);
|
||||
|
||||
for (let i = 0; i < obj.properties.length; i++) {
|
||||
const prop = obj.properties[i];
|
||||
const val = prop.value;
|
||||
val.properties.unshift(t().objectProperty(t().identifier("key"), t().toComputedKey(prop)));
|
||||
objExpr.elements.push(val);
|
||||
}
|
||||
|
||||
return objExpr;
|
||||
}
|
||||
|
||||
function toClassObject(mutatorMap) {
|
||||
const objExpr = t().objectExpression([]);
|
||||
Object.keys(mutatorMap).forEach(function (mutatorMapKey) {
|
||||
const map = mutatorMap[mutatorMapKey];
|
||||
const mapNode = t().objectExpression([]);
|
||||
const propNode = t().objectProperty(map._key, mapNode, map._computed);
|
||||
Object.keys(map).forEach(function (key) {
|
||||
const node = map[key];
|
||||
if (key[0] === "_") return;
|
||||
const prop = t().objectProperty(t().identifier(key), node);
|
||||
t().inheritsComments(prop, node);
|
||||
t().removeComments(node);
|
||||
mapNode.properties.push(prop);
|
||||
});
|
||||
objExpr.properties.push(propNode);
|
||||
});
|
||||
return objExpr;
|
||||
}
|
||||
|
||||
function toDefineObject(mutatorMap) {
|
||||
Object.keys(mutatorMap).forEach(function (key) {
|
||||
const map = mutatorMap[key];
|
||||
if (map.value) map.writable = t().booleanLiteral(true);
|
||||
map.configurable = t().booleanLiteral(true);
|
||||
map.enumerable = t().booleanLiteral(true);
|
||||
});
|
||||
return toClassObject(mutatorMap);
|
||||
}
|
||||
49
node_modules/@babel/helper-define-map/package.json
generated
vendored
Normal file
49
node_modules/@babel/helper-define-map/package.json
generated
vendored
Normal file
@ -0,0 +1,49 @@
|
||||
{
|
||||
"_args": [
|
||||
[
|
||||
"@babel/helper-define-map@7.5.5",
|
||||
"E:\\python\\setup-php"
|
||||
]
|
||||
],
|
||||
"_from": "@babel/helper-define-map@7.5.5",
|
||||
"_id": "@babel/helper-define-map@7.5.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-fTfxx7i0B5NJqvUOBBGREnrqbTxRh7zinBANpZXAVDlsZxYdclDp467G1sQ8VZYMnAURY3RpBUAgOYT9GfzHBg==",
|
||||
"_location": "/@babel/helper-define-map",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "version",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-define-map@7.5.5",
|
||||
"name": "@babel/helper-define-map",
|
||||
"escapedName": "@babel%2fhelper-define-map",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "7.5.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "7.5.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/plugin-transform-classes"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-define-map/-/helper-define-map-7.5.5.tgz",
|
||||
"_spec": "7.5.5",
|
||||
"_where": "E:\\python\\setup-php",
|
||||
"dependencies": {
|
||||
"@babel/helper-function-name": "^7.1.0",
|
||||
"@babel/types": "^7.5.5",
|
||||
"lodash": "^4.17.13"
|
||||
},
|
||||
"description": "Helper function to define a map",
|
||||
"gitHead": "0407f034f09381b95e9cabefbf6b176c76485a43",
|
||||
"license": "MIT",
|
||||
"main": "lib/index.js",
|
||||
"name": "@babel/helper-define-map",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-define-map"
|
||||
},
|
||||
"version": "7.5.5"
|
||||
}
|
||||
Reference in New Issue
Block a user