This commit is contained in:
David Kale
2020-09-08 13:25:36 -04:00
parent e4246d2b5b
commit 91fcbb0108
4227 changed files with 416837 additions and 457884 deletions

View File

@@ -1,6 +1,6 @@
MIT License
Copyright (c) 2014-2018 Sebastian McKenzie and other contributors
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

View File

@@ -5,41 +5,19 @@ Object.defineProperty(exports, "__esModule", {
});
exports.default = _default;
function _helperGetFunctionArity() {
const data = _interopRequireDefault(require("@babel/helper-get-function-arity"));
var _helperGetFunctionArity = _interopRequireDefault(require("@babel/helper-get-function-arity"));
_helperGetFunctionArity = function () {
return data;
};
var _template = _interopRequireDefault(require("@babel/template"));
return data;
}
var t = _interopRequireWildcard(require("@babel/types"));
function _template() {
const data = _interopRequireDefault(require("@babel/template"));
function _getRequireWildcardCache() { if (typeof WeakMap !== "function") return null; var cache = new WeakMap(); _getRequireWildcardCache = function () { return cache; }; return cache; }
_template = 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 _interopRequireWildcard(obj) { if (obj && obj.__esModule) { return obj; } if (obj === null || typeof obj !== "object" && typeof obj !== "function") { return { default: obj }; } var cache = _getRequireWildcardCache(); if (cache && cache.has(obj)) { return cache.get(obj); } var newObj = {}; var hasPropertyDescriptor = Object.defineProperty && Object.getOwnPropertyDescriptor; for (var key in obj) { if (Object.prototype.hasOwnProperty.call(obj, key)) { var desc = hasPropertyDescriptor ? Object.getOwnPropertyDescriptor(obj, key) : null; if (desc && (desc.get || desc.set)) { Object.defineProperty(newObj, key, desc); } else { newObj[key] = obj[key]; } } } newObj.default = obj; if (cache) { cache.set(obj, newObj); } return newObj; }
function _interopRequireDefault(obj) { return obj && obj.__esModule ? obj : { default: obj }; }
const buildPropertyMethodAssignmentWrapper = (0, _template().default)(`
const buildPropertyMethodAssignmentWrapper = (0, _template.default)(`
(function (FUNCTION_KEY) {
function FUNCTION_ID() {
return FUNCTION_KEY.apply(this, arguments);
@@ -52,7 +30,7 @@ const buildPropertyMethodAssignmentWrapper = (0, _template().default)(`
return FUNCTION_ID;
})(FUNCTION)
`);
const buildGeneratorPropertyMethodAssignmentWrapper = (0, _template().default)(`
const buildGeneratorPropertyMethodAssignmentWrapper = (0, _template.default)(`
(function (FUNCTION_KEY) {
function* FUNCTION_ID() {
return yield* FUNCTION_KEY.apply(this, arguments);
@@ -77,15 +55,15 @@ const visitor = {
};
function getNameFromLiteralId(id) {
if (t().isNullLiteral(id)) {
if (t.isNullLiteral(id)) {
return "null";
}
if (t().isRegExpLiteral(id)) {
if (t.isRegExpLiteral(id)) {
return `_${id.pattern}_${id.flags}`;
}
if (t().isTemplateLiteral(id)) {
if (t.isTemplateLiteral(id)) {
return id.quasis.map(quasi => quasi.value.raw).join("");
}
@@ -101,7 +79,7 @@ function wrap(state, method, id, scope) {
if (scope.hasBinding(id.name) && !scope.hasGlobal(id.name)) {
scope.rename(id.name);
} else {
if (!t().isFunction(method)) return;
if (!t.isFunction(method)) return;
let build = buildPropertyMethodAssignmentWrapper;
if (method.generator) {
@@ -115,7 +93,7 @@ function wrap(state, method, id, scope) {
}).expression;
const params = template.callee.body.body[0].params;
for (let i = 0, len = (0, _helperGetFunctionArity().default)(method); i < len; i++) {
for (let i = 0, len = (0, _helperGetFunctionArity.default)(method); i < len; i++) {
params.push(scope.generateUidIdentifier("x"));
}
@@ -156,23 +134,25 @@ function _default({
}, localBinding = false) {
if (node.id) return;
if ((t().isObjectProperty(parent) || t().isObjectMethod(parent, {
if ((t.isObjectProperty(parent) || t.isObjectMethod(parent, {
kind: "method"
})) && (!parent.computed || t().isLiteral(parent.key))) {
})) && (!parent.computed || t.isLiteral(parent.key))) {
id = parent.key;
} else if (t().isVariableDeclarator(parent)) {
} else if (t.isVariableDeclarator(parent)) {
id = parent.id;
if (t().isIdentifier(id) && !localBinding) {
if (t.isIdentifier(id) && !localBinding) {
const binding = scope.parent.getBinding(id.name);
if (binding && binding.constant && scope.getBinding(id.name) === binding) {
node.id = t().cloneNode(id);
node.id[t().NOT_LOCAL_BINDING] = true;
node.id = t.cloneNode(id);
node.id[t.NOT_LOCAL_BINDING] = true;
return;
}
}
} else if (t().isAssignmentExpression(parent)) {
} else if (t.isAssignmentExpression(parent, {
operator: "="
})) {
id = parent.left;
} else if (!id) {
return;
@@ -180,9 +160,9 @@ function _default({
let name;
if (id && t().isLiteral(id)) {
if (id && t.isLiteral(id)) {
name = getNameFromLiteralId(id);
} else if (id && t().isIdentifier(id)) {
} else if (id && t.isIdentifier(id)) {
name = id.name;
}
@@ -190,9 +170,9 @@ function _default({
return;
}
name = t().toBindingIdentifierName(name);
id = t().identifier(name);
id[t().NOT_LOCAL_BINDING] = true;
name = t.toBindingIdentifierName(name);
id = t.identifier(name);
id[t.NOT_LOCAL_BINDING] = true;
const state = visit(node, name, scope);
return wrap(state, node, id, scope) || node;
}

View File

@@ -1,40 +1,41 @@
{
"_args": [
[
"@babel/helper-function-name@7.1.0",
"/Users/pjquirk/Source/GitHub/actions/labeler"
]
],
"_development": true,
"_from": "@babel/helper-function-name@7.1.0",
"_id": "@babel/helper-function-name@7.1.0",
"_from": "@babel/helper-function-name@^7.10.4",
"_id": "@babel/helper-function-name@7.10.4",
"_inBundle": false,
"_integrity": "sha512-A95XEoCpb3TO+KZzJ4S/5uW5fNe26DjBGqf1o9ucyLyCmi1dXq/B3c8iaWTfBk3VvetUxl16e8tIrd5teOCfGw==",
"_integrity": "sha512-YdaSyz1n8gY44EmN7x44zBn9zQ1Ry2Y+3GTA+3vH6Mizke1Vw0aWDM66FOYEPw8//qKkmqOckrGgTYa+6sceqQ==",
"_location": "/@babel/helper-function-name",
"_phantomChildren": {},
"_requested": {
"type": "version",
"type": "range",
"registry": true,
"raw": "@babel/helper-function-name@7.1.0",
"raw": "@babel/helper-function-name@^7.10.4",
"name": "@babel/helper-function-name",
"escapedName": "@babel%2fhelper-function-name",
"scope": "@babel",
"rawSpec": "7.1.0",
"rawSpec": "^7.10.4",
"saveSpec": null,
"fetchSpec": "7.1.0"
"fetchSpec": "^7.10.4"
},
"_requiredBy": [
"/@babel/traverse"
],
"_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.1.0.tgz",
"_spec": "7.1.0",
"_where": "/Users/pjquirk/Source/GitHub/actions/labeler",
"dependencies": {
"@babel/helper-get-function-arity": "^7.0.0",
"@babel/template": "^7.1.0",
"@babel/types": "^7.0.0"
"_resolved": "https://registry.npmjs.org/@babel/helper-function-name/-/helper-function-name-7.10.4.tgz",
"_shasum": "d2d3b20c59ad8c47112fa7d2a94bc09d5ef82f1a",
"_spec": "@babel/helper-function-name@^7.10.4",
"_where": "/Users/dakale/dev/GitHub/actions/labeler/node_modules/@babel/traverse",
"bugs": {
"url": "https://github.com/babel/babel/issues"
},
"bundleDependencies": false,
"dependencies": {
"@babel/helper-get-function-arity": "^7.10.4",
"@babel/template": "^7.10.4",
"@babel/types": "^7.10.4"
},
"deprecated": false,
"description": "Helper function to change the property 'name' of every function",
"gitHead": "7fd40d86a0d03ff0e9c3ea16b29689945433d4df",
"homepage": "https://github.com/babel/babel#readme",
"license": "MIT",
"main": "lib/index.js",
"name": "@babel/helper-function-name",
@@ -43,7 +44,8 @@
},
"repository": {
"type": "git",
"url": "https://github.com/babel/babel/tree/master/packages/babel-helper-function-name"
"url": "git+https://github.com/babel/babel.git",
"directory": "packages/babel-helper-function-name"
},
"version": "7.1.0"
"version": "7.10.4"
}