summaryrefslogtreecommitdiff
path: root/node_modules/babel-plugin-transform-merge-sibling-variables
diff options
context:
space:
mode:
authorlittleblack111 <littleblack11111@gmail.com>2026-05-18 23:10:59 +0800
committerlittleblack111 <littleblack11111@gmail.com>2026-05-18 23:41:44 +0800
commitfc87c009806dcc98867f6b58efe29b042aa01dee (patch)
tree8f59b3f4a5b66e9dfef2d40c8d318e258a521228 /node_modules/babel-plugin-transform-merge-sibling-variables
parent3336b2356ee6152d9c6ae59bd9b87ccbc0958407 (diff)
node: updatemain
Diffstat (limited to 'node_modules/babel-plugin-transform-merge-sibling-variables')
-rw-r--r--node_modules/babel-plugin-transform-merge-sibling-variables/LICENSE22
-rw-r--r--node_modules/babel-plugin-transform-merge-sibling-variables/README.md60
-rw-r--r--node_modules/babel-plugin-transform-merge-sibling-variables/lib/index.js109
-rw-r--r--node_modules/babel-plugin-transform-merge-sibling-variables/package.json15
4 files changed, 0 insertions, 206 deletions
diff --git a/node_modules/babel-plugin-transform-merge-sibling-variables/LICENSE b/node_modules/babel-plugin-transform-merge-sibling-variables/LICENSE
deleted file mode 100644
index f9f0a7f3..00000000
--- a/node_modules/babel-plugin-transform-merge-sibling-variables/LICENSE
+++ /dev/null
@@ -1,22 +0,0 @@
-Copyright (c) 2015-2016 Amjad Masad <amjad.masad@gmail.com>
-
-MIT License
-
-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.
diff --git a/node_modules/babel-plugin-transform-merge-sibling-variables/README.md b/node_modules/babel-plugin-transform-merge-sibling-variables/README.md
deleted file mode 100644
index 0382fbc0..00000000
--- a/node_modules/babel-plugin-transform-merge-sibling-variables/README.md
+++ /dev/null
@@ -1,60 +0,0 @@
-# babel-plugin-transform-merge-sibling-variables
-
-Merge sibling variables into one.
-
-## Example
-
-**In**
-
-```javascript
-// merge into a single VariableDeclaration
-var foo = "bar";
-var bar = "foo";
-foobar();
-
-// merge into the next for loop
-var i = 0;
-for (var x = 0; x < 10; x++) {}
-```
-
-**Out**
-
-```javascript
-var foo = "bar",
- bar = "foo";
-foobar();
-
-for (var i = 0, x = 0; x < 10; x++) {}
-```
-
-## Installation
-
-```sh
-npm install babel-plugin-transform-merge-sibling-variables --save-dev
-```
-
-## Usage
-
-### Via `.babelrc` (Recommended)
-
-**.babelrc**
-
-```json
-{
- "plugins": ["transform-merge-sibling-variables"]
-}
-```
-
-### Via CLI
-
-```sh
-babel --plugins transform-merge-sibling-variables script.js
-```
-
-### Via Node API
-
-```javascript
-require("@babel/core").transform("code", {
- plugins: ["transform-merge-sibling-variables"]
-});
-```
diff --git a/node_modules/babel-plugin-transform-merge-sibling-variables/lib/index.js b/node_modules/babel-plugin-transform-merge-sibling-variables/lib/index.js
deleted file mode 100644
index 7771b00c..00000000
--- a/node_modules/babel-plugin-transform-merge-sibling-variables/lib/index.js
+++ /dev/null
@@ -1,109 +0,0 @@
-"use strict";
-
-module.exports = function ({
- types: t
-}) {
- function liftDeclaration(path, body, kind) {
- if (body[0] && body[0].isVariableDeclaration({
- kind: kind
- })) {
- if (body[0].node.declarations.length > 1) {
- return;
- }
-
- if (body[1] && body[1].isVariableDeclaration({
- kind: kind
- })) {
- return;
- }
-
- const firstNode = body[0].node.declarations[0];
-
- if (!t.isIdentifier(firstNode.id) || !firstNode.init) {
- return;
- }
-
- const init = path.get("init");
-
- if (!init.isVariableDeclaration({
- kind: kind
- })) {
- return;
- }
-
- init.pushContainer("declarations", t.variableDeclarator(firstNode.id));
- body[0].replaceWith(t.assignmentExpression("=", t.clone(firstNode.id), t.clone(firstNode.init)));
- }
- }
-
- return {
- name: "transform-merge-sibling-variables",
- visitor: {
- ForStatement(path) {
- // Lift declarations to the loop initializer
- let body = path.get("body");
- body = body.isBlockStatement() ? body.get("body") : [body];
- liftDeclaration(path, body, "var");
- liftDeclaration(path, body, "let");
- },
-
- VariableDeclaration: {
- enter: [// concat variables of the same kind with their siblings
- function (path) {
- if (!path.inList) {
- return;
- }
-
- const node = path.node;
- let sibling = path.getSibling(path.key + 1);
- let declarations = [];
-
- while (sibling.isVariableDeclaration({
- kind: node.kind
- })) {
- declarations = declarations.concat(sibling.node.declarations);
- sibling.remove();
- sibling = path.getSibling(path.key + 1);
- }
-
- if (declarations.length > 0) {
- path.replaceWith(t.variableDeclaration(node.kind, [...node.declarations, ...declarations]));
- }
- }, // concat `var` declarations next to for loops with it's initialisers.
- // block-scoped `let` and `const` are not moved because the for loop
- // is a different block scope.
- function (path) {
- if (!path.inList) {
- return;
- }
-
- const node = path.node;
-
- if (node.kind !== "var") {
- return;
- }
-
- const next = path.getSibling(path.key + 1);
-
- if (!next.isForStatement()) {
- return;
- }
-
- const init = next.get("init");
-
- if (!init.isVariableDeclaration({
- kind: node.kind
- })) {
- return;
- }
-
- const declarations = node.declarations.concat(init.node.declarations); // temporary workaround to forces babel recalculate scope,
- // references and binding until babel/babel#4818 resolved
-
- path.remove();
- init.replaceWith(t.variableDeclaration("var", declarations));
- }]
- }
- }
- };
-}; \ No newline at end of file
diff --git a/node_modules/babel-plugin-transform-merge-sibling-variables/package.json b/node_modules/babel-plugin-transform-merge-sibling-variables/package.json
deleted file mode 100644
index 1f843b56..00000000
--- a/node_modules/babel-plugin-transform-merge-sibling-variables/package.json
+++ /dev/null
@@ -1,15 +0,0 @@
-{
- "name": "babel-plugin-transform-merge-sibling-variables",
- "version": "6.9.5",
- "description": "Merge sibling variables into one.",
- "keywords": [
- "babel-plugin"
- ],
- "homepage": "https://github.com/babel/minify#readme",
- "bugs": "https://github.com/babel/minify/issues",
- "license": "MIT",
- "author": "amasad",
- "main": "lib/index.js",
- "repository": "https://github.com/babel/minify/tree/master/packages/babel-plugin-transform-merge-sibling-variables",
- "gitHead": "8f9c7c0a32103653bd6793d0ce44730f937e1ddf"
-}