$
This commit is contained in:
22
node_modules/@babel/helper-explode-assignable-expression/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-explode-assignable-expression/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-explode-assignable-expression/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-explode-assignable-expression/README.md
generated
vendored
Normal file
@@ -0,0 +1,19 @@
|
||||
# @babel/helper-explode-assignable-expression
|
||||
|
||||
> Helper function to explode an assignable expression
|
||||
|
||||
See our website [@babel/helper-explode-assignable-expression](https://babeljs.io/docs/en/babel-helper-explode-assignable-expression) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save @babel/helper-explode-assignable-expression
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-explode-assignable-expression
|
||||
```
|
92
node_modules/@babel/helper-explode-assignable-expression/lib/index.js
generated
vendored
Normal file
92
node_modules/@babel/helper-explode-assignable-expression/lib/index.js
generated
vendored
Normal file
@@ -0,0 +1,92 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = _default;
|
||||
|
||||
var _t = require("@babel/types");
|
||||
|
||||
const {
|
||||
assignmentExpression,
|
||||
cloneNode,
|
||||
isIdentifier,
|
||||
isLiteral,
|
||||
isMemberExpression,
|
||||
isPrivateName,
|
||||
isPureish,
|
||||
isSuper,
|
||||
memberExpression,
|
||||
toComputedKey
|
||||
} = _t;
|
||||
|
||||
function getObjRef(node, nodes, scope) {
|
||||
let ref;
|
||||
|
||||
if (isIdentifier(node)) {
|
||||
if (scope.hasBinding(node.name)) {
|
||||
return node;
|
||||
} else {
|
||||
ref = node;
|
||||
}
|
||||
} else if (isMemberExpression(node)) {
|
||||
ref = node.object;
|
||||
|
||||
if (isSuper(ref) || isIdentifier(ref) && scope.hasBinding(ref.name)) {
|
||||
return ref;
|
||||
}
|
||||
} else {
|
||||
throw new Error(`We can't explode this node type ${node["type"]}`);
|
||||
}
|
||||
|
||||
const temp = scope.generateUidIdentifierBasedOnNode(ref);
|
||||
scope.push({
|
||||
id: temp
|
||||
});
|
||||
nodes.push(assignmentExpression("=", cloneNode(temp), cloneNode(ref)));
|
||||
return temp;
|
||||
}
|
||||
|
||||
function getPropRef(node, nodes, scope) {
|
||||
const prop = node.property;
|
||||
|
||||
if (isPrivateName(prop)) {
|
||||
throw new Error("We can't generate property ref for private name, please install `@babel/plugin-proposal-class-properties`");
|
||||
}
|
||||
|
||||
const key = toComputedKey(node, prop);
|
||||
if (isLiteral(key) && isPureish(key)) return key;
|
||||
const temp = scope.generateUidIdentifierBasedOnNode(prop);
|
||||
scope.push({
|
||||
id: temp
|
||||
});
|
||||
nodes.push(assignmentExpression("=", cloneNode(temp), cloneNode(prop)));
|
||||
return temp;
|
||||
}
|
||||
|
||||
function _default(node, nodes, file, scope, allowedSingleIdent) {
|
||||
let obj;
|
||||
|
||||
if (isIdentifier(node) && allowedSingleIdent) {
|
||||
obj = node;
|
||||
} else {
|
||||
obj = getObjRef(node, nodes, scope);
|
||||
}
|
||||
|
||||
let ref, uid;
|
||||
|
||||
if (isIdentifier(node)) {
|
||||
ref = cloneNode(node);
|
||||
uid = obj;
|
||||
} else {
|
||||
const prop = getPropRef(node, nodes, scope);
|
||||
const computed = node.computed || isLiteral(prop);
|
||||
uid = memberExpression(cloneNode(obj), cloneNode(prop), computed);
|
||||
ref = memberExpression(cloneNode(obj), cloneNode(prop), computed);
|
||||
}
|
||||
|
||||
return {
|
||||
uid: uid,
|
||||
ref: ref
|
||||
};
|
||||
}
|
27
node_modules/@babel/helper-explode-assignable-expression/package.json
generated
vendored
Normal file
27
node_modules/@babel/helper-explode-assignable-expression/package.json
generated
vendored
Normal file
@@ -0,0 +1,27 @@
|
||||
{
|
||||
"name": "@babel/helper-explode-assignable-expression",
|
||||
"version": "7.18.6",
|
||||
"description": "Helper function to explode an assignable expression",
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-explode-assignable-expression"
|
||||
},
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-helper-explode-assignable-expression",
|
||||
"license": "MIT",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"main": "./lib/index.js",
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.18.6"
|
||||
},
|
||||
"devDependencies": {
|
||||
"@babel/traverse": "^7.18.6"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"author": "The Babel Team (https://babel.dev/team)",
|
||||
"type": "commonjs"
|
||||
}
|
Reference in New Issue
Block a user