feat: refactoring project

This commit is contained in:
Carlos
2024-11-23 14:56:07 -05:00
parent f0c2a50c18
commit 1c6db5818d
2351 changed files with 39323 additions and 60326 deletions

View File

@@ -39,7 +39,7 @@ var _default = exports.default = (0, _helperPluginUtils.declare)((api, options)
const {
node
} = path;
const ref = node.id || path.scope.generateUidIdentifier("class");
const ref = node.id ? _core.types.cloneNode(node.id) : path.scope.generateUidIdentifier("class");
path.replaceWith(_core.types.variableDeclaration("let", [_core.types.variableDeclarator(ref, _core.types.toExpression(node))]));
},
ClassExpression(path, state) {

File diff suppressed because one or more lines are too long

View File

@@ -258,11 +258,34 @@ function transformClass(path, file, builtinClasses, isLoose, assumptions, suppor
maxGuaranteedSuperBeforeIndex = Math.min(maxGuaranteedSuperBeforeIndex, lastParentPath.key);
return true;
}
if (parentPath.isLoop() || parentPath.isConditional() || parentPath.isArrowFunctionExpression()) {
maxGuaranteedSuperBeforeIndex = -1;
return true;
const {
type
} = parentPath;
switch (type) {
case "ExpressionStatement":
case "SequenceExpression":
case "AssignmentExpression":
case "BinaryExpression":
case "MemberExpression":
case "CallExpression":
case "NewExpression":
case "VariableDeclarator":
case "VariableDeclaration":
case "BlockStatement":
case "ArrayExpression":
case "ObjectExpression":
case "ObjectProperty":
case "TemplateLiteral":
lastParentPath = parentPath;
return false;
default:
if (type === "LogicalExpression" && parentPath.node.left === lastParentPath.node || parentPath.isConditional() && parentPath.node.test === lastParentPath.node || type === "OptionalCallExpression" && parentPath.node.callee === lastParentPath.node || type === "OptionalMemberExpression" && parentPath.node.object === lastParentPath.node) {
lastParentPath = parentPath;
return false;
}
}
lastParentPath = parentPath;
maxGuaranteedSuperBeforeIndex = -1;
return true;
});
}
}

File diff suppressed because one or more lines are too long

View File

@@ -1,6 +1,6 @@
{
"name": "@babel/plugin-transform-classes",
"version": "7.25.0",
"version": "7.25.9",
"description": "Compile ES2015 classes to ES5",
"repository": {
"type": "git",
@@ -14,11 +14,11 @@
},
"main": "./lib/index.js",
"dependencies": {
"@babel/helper-annotate-as-pure": "^7.24.7",
"@babel/helper-compilation-targets": "^7.24.8",
"@babel/helper-plugin-utils": "^7.24.8",
"@babel/helper-replace-supers": "^7.25.0",
"@babel/traverse": "^7.25.0",
"@babel/helper-annotate-as-pure": "^7.25.9",
"@babel/helper-compilation-targets": "^7.25.9",
"@babel/helper-plugin-utils": "^7.25.9",
"@babel/helper-replace-supers": "^7.25.9",
"@babel/traverse": "^7.25.9",
"globals": "^11.1.0"
},
"keywords": [
@@ -28,8 +28,8 @@
"@babel/core": "^7.0.0-0"
},
"devDependencies": {
"@babel/core": "^7.24.9",
"@babel/helper-plugin-test-runner": "^7.24.7"
"@babel/core": "^7.25.9",
"@babel/helper-plugin-test-runner": "^7.25.9"
},
"engines": {
"node": ">=6.9.0"

View File

@@ -1,23 +0,0 @@
/* This file is automatically generated by scripts/generators/tsconfig.js */
{
"extends": [
"../../tsconfig.base.json",
"../../tsconfig.paths.json"
],
"include": [
"../../packages/babel-plugin-transform-classes/src/**/*.ts",
"../../lib/globals.d.ts",
"../../scripts/repo-utils/*.d.ts"
],
"references": [
{
"path": "../../packages/babel-helper-plugin-utils"
},
{
"path": "../../packages/babel-helper-annotate-as-pure"
},
{
"path": "../../packages/babel-helper-replace-supers"
}
]
}

File diff suppressed because one or more lines are too long