first
This commit is contained in:
22
node_modules/@babel/helper-hoist-variables/LICENSE
generated
vendored
Normal file
22
node_modules/@babel/helper-hoist-variables/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-hoist-variables/README.md
generated
vendored
Normal file
19
node_modules/@babel/helper-hoist-variables/README.md
generated
vendored
Normal file
@ -0,0 +1,19 @@
|
||||
# @babel/helper-hoist-variables
|
||||
|
||||
> Helper function to hoist variables
|
||||
|
||||
See our website [@babel/helper-hoist-variables](https://babeljs.io/docs/en/babel-helper-hoist-variables) for more information.
|
||||
|
||||
## Install
|
||||
|
||||
Using npm:
|
||||
|
||||
```sh
|
||||
npm install --save @babel/helper-hoist-variables
|
||||
```
|
||||
|
||||
or using yarn:
|
||||
|
||||
```sh
|
||||
yarn add @babel/helper-hoist-variables
|
||||
```
|
50
node_modules/@babel/helper-hoist-variables/lib/index.js
generated
vendored
Normal file
50
node_modules/@babel/helper-hoist-variables/lib/index.js
generated
vendored
Normal file
@ -0,0 +1,50 @@
|
||||
"use strict";
|
||||
|
||||
Object.defineProperty(exports, "__esModule", {
|
||||
value: true
|
||||
});
|
||||
exports.default = hoistVariables;
|
||||
var _t = require("@babel/types");
|
||||
const {
|
||||
assignmentExpression,
|
||||
expressionStatement,
|
||||
identifier
|
||||
} = _t;
|
||||
const visitor = {
|
||||
Scope(path, state) {
|
||||
if (state.kind === "let") path.skip();
|
||||
},
|
||||
FunctionParent(path) {
|
||||
path.skip();
|
||||
},
|
||||
VariableDeclaration(path, state) {
|
||||
if (state.kind && path.node.kind !== state.kind) return;
|
||||
const nodes = [];
|
||||
const declarations = path.get("declarations");
|
||||
let firstId;
|
||||
for (const declar of declarations) {
|
||||
firstId = declar.node.id;
|
||||
if (declar.node.init) {
|
||||
nodes.push(expressionStatement(assignmentExpression("=", declar.node.id, declar.node.init)));
|
||||
}
|
||||
for (const name of Object.keys(declar.getBindingIdentifiers())) {
|
||||
state.emit(identifier(name), name, declar.node.init !== null);
|
||||
}
|
||||
}
|
||||
if (path.parentPath.isFor({
|
||||
left: path.node
|
||||
})) {
|
||||
path.replaceWith(firstId);
|
||||
} else {
|
||||
path.replaceWithMultiple(nodes);
|
||||
}
|
||||
}
|
||||
};
|
||||
function hoistVariables(path, emit, kind = "var") {
|
||||
path.traverse(visitor, {
|
||||
kind,
|
||||
emit
|
||||
});
|
||||
}
|
||||
|
||||
//# sourceMappingURL=index.js.map
|
1
node_modules/@babel/helper-hoist-variables/lib/index.js.map
generated
vendored
Normal file
1
node_modules/@babel/helper-hoist-variables/lib/index.js.map
generated
vendored
Normal file
@ -0,0 +1 @@
|
||||
{"version":3,"names":["_t","require","assignmentExpression","expressionStatement","identifier","visitor","Scope","path","state","kind","skip","FunctionParent","VariableDeclaration","node","nodes","declarations","get","firstId","declar","id","init","push","name","Object","keys","getBindingIdentifiers","emit","parentPath","isFor","left","replaceWith","replaceWithMultiple","hoistVariables","traverse"],"sources":["../src/index.ts"],"sourcesContent":["import {\n assignmentExpression,\n expressionStatement,\n identifier,\n} from \"@babel/types\";\nimport type * as t from \"@babel/types\";\nimport type { NodePath, Visitor } from \"@babel/traverse\";\n\nexport type EmitFunction = (\n id: t.Identifier,\n idName: string,\n hasInit: boolean,\n) => any;\n\ntype State = {\n kind: \"var\" | \"let\";\n emit: EmitFunction;\n};\n\ntype Unpacked<T> = T extends (infer U)[] ? U : T;\n\nconst visitor: Visitor<State> = {\n Scope(path, state) {\n if (state.kind === \"let\") path.skip();\n },\n\n FunctionParent(path) {\n path.skip();\n },\n\n VariableDeclaration(path, state) {\n if (state.kind && path.node.kind !== state.kind) return;\n\n const nodes = [];\n\n const declarations: ReadonlyArray<\n NodePath<Unpacked<t.VariableDeclaration[\"declarations\"]>>\n > = path.get(\"declarations\");\n let firstId;\n\n for (const declar of declarations) {\n firstId = declar.node.id;\n\n if (declar.node.init) {\n nodes.push(\n expressionStatement(\n assignmentExpression(\"=\", declar.node.id, declar.node.init),\n ),\n );\n }\n\n for (const name of Object.keys(declar.getBindingIdentifiers())) {\n state.emit(identifier(name), name, declar.node.init !== null);\n }\n }\n\n // for (var i in test)\n if (path.parentPath.isFor({ left: path.node })) {\n path.replaceWith(firstId);\n } else {\n path.replaceWithMultiple(nodes);\n }\n },\n};\n\nexport default function hoistVariables(\n path: NodePath,\n emit: EmitFunction,\n kind: \"var\" | \"let\" = \"var\",\n) {\n path.traverse(visitor, { kind, emit });\n}\n"],"mappings":";;;;;;AAAA,IAAAA,EAAA,GAAAC,OAAA;AAIsB;EAHpBC,oBAAoB;EACpBC,mBAAmB;EACnBC;AAAU,IAAAJ,EAAA;AAkBZ,MAAMK,OAAuB,GAAG;EAC9BC,KAAKA,CAACC,IAAI,EAAEC,KAAK,EAAE;IACjB,IAAIA,KAAK,CAACC,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ACpCzB,IAAc,EACdmB,IAAkB,EAClBjB,IAAmB,GAAG,KAAK,EAC3B;EACAF,IAAI,CAAC0B,QAAQ,CAAC5B,OAAO,EAAE;IAAEI,IAAI;IAAEiB;EAAK,CAAC,CAAC;AACxC"}
|
61
node_modules/@babel/helper-hoist-variables/package.json
generated
vendored
Normal file
61
node_modules/@babel/helper-hoist-variables/package.json
generated
vendored
Normal file
@ -0,0 +1,61 @@
|
||||
{
|
||||
"TODO": "The @babel/traverse dependency is only needed for the NodePath TS type. We can consider exporting it from @babel/core.",
|
||||
"_from": "@babel/helper-hoist-variables@^7.22.5",
|
||||
"_id": "@babel/helper-hoist-variables@7.22.5",
|
||||
"_inBundle": false,
|
||||
"_integrity": "sha512-wGjk9QZVzvknA6yKIUURb8zY3grXCcOZt+/7Wcy8O2uctxhplmUPkOdlgoNhmdVee2c92JXbf1xpMtVNbfoxRw==",
|
||||
"_location": "/@babel/helper-hoist-variables",
|
||||
"_phantomChildren": {},
|
||||
"_requested": {
|
||||
"type": "range",
|
||||
"registry": true,
|
||||
"raw": "@babel/helper-hoist-variables@^7.22.5",
|
||||
"name": "@babel/helper-hoist-variables",
|
||||
"escapedName": "@babel%2fhelper-hoist-variables",
|
||||
"scope": "@babel",
|
||||
"rawSpec": "^7.22.5",
|
||||
"saveSpec": null,
|
||||
"fetchSpec": "^7.22.5"
|
||||
},
|
||||
"_requiredBy": [
|
||||
"/@babel/plugin-transform-modules-systemjs",
|
||||
"/@babel/traverse"
|
||||
],
|
||||
"_resolved": "https://registry.npmjs.org/@babel/helper-hoist-variables/-/helper-hoist-variables-7.22.5.tgz",
|
||||
"_shasum": "c01a007dac05c085914e8fb652b339db50d823bb",
|
||||
"_spec": "@babel/helper-hoist-variables@^7.22.5",
|
||||
"_where": "C:\\Users\\zhouxueli\\Desktop\\scheduling-app\\node_modules\\@babel\\traverse",
|
||||
"author": {
|
||||
"name": "The Babel Team",
|
||||
"url": "https://babel.dev/team"
|
||||
},
|
||||
"bugs": {
|
||||
"url": "https://github.com/babel/babel/issues"
|
||||
},
|
||||
"bundleDependencies": false,
|
||||
"dependencies": {
|
||||
"@babel/types": "^7.22.5"
|
||||
},
|
||||
"deprecated": false,
|
||||
"description": "Helper function to hoist variables",
|
||||
"devDependencies": {
|
||||
"@babel/traverse": "^7.22.5"
|
||||
},
|
||||
"engines": {
|
||||
"node": ">=6.9.0"
|
||||
},
|
||||
"homepage": "https://babel.dev/docs/en/next/babel-helper-hoist-variables",
|
||||
"license": "MIT",
|
||||
"main": "./lib/index.js",
|
||||
"name": "@babel/helper-hoist-variables",
|
||||
"publishConfig": {
|
||||
"access": "public"
|
||||
},
|
||||
"repository": {
|
||||
"type": "git",
|
||||
"url": "git+https://github.com/babel/babel.git",
|
||||
"directory": "packages/babel-helper-hoist-variables"
|
||||
},
|
||||
"type": "commonjs",
|
||||
"version": "7.22.5"
|
||||
}
|
Reference in New Issue
Block a user