From a4ec1e91d76c8881b00fef0f7fbcc73f0473da86 Mon Sep 17 00:00:00 2001 From: Nikola Hristov Date: Sat, 9 Nov 2024 02:23:10 +0200 Subject: [PATCH] --- Source/Function/Output/Transformer/Visit.ts | 29 ++----------------- Target/Function/Output/Transformer/Visit.js | 27 ++++------------- .../Function/Output/Transformer/Visit.js.map | 4 +-- 3 files changed, 10 insertions(+), 50 deletions(-) diff --git a/Source/Function/Output/Transformer/Visit.ts b/Source/Function/Output/Transformer/Visit.ts index 95c4c43c..4881ab6d 100644 --- a/Source/Function/Output/Transformer/Visit.ts +++ b/Source/Function/Output/Transformer/Visit.ts @@ -95,33 +95,8 @@ class Track { return false; } + // If we have a current scope, check all usages are in same scope if (_Node) { - let Node = _Node; - - while (Node.parent) { - if (ts.isMethodDeclaration(Node.parent)) { - const Method = (Node.parent.name as Identifier) - .text; - - let Overload = 0; - - ts.forEachChild(Node.getSourceFile(), (node) => { - if ( - ts.isMethodDeclaration(node) && - (node.name as Identifier).text === Method - ) { - Overload++; - } - }); - - if (Overload > 1) { - return false; - } - } - - Node = Node.parent; - } - while ( _Node && !ts.isFunctionDeclaration(_Node) && @@ -155,7 +130,7 @@ class Track { if ( ts.isArrayLiteralExpression(Result) || // ts.isAwaitExpression(Result) || - ts.isMethodDeclaration(Result) || + // ts.isMethodDeclaration(Result) || // ts.isFunctionDeclaration(Result) || ts.isBinaryExpression(Result) || // ts.isCallExpression(Result) || diff --git a/Target/Function/Output/Transformer/Visit.js b/Target/Function/Output/Transformer/Visit.js index b9c175bc..9b24334b 100644 --- a/Target/Function/Output/Transformer/Visit.js +++ b/Target/Function/Output/Transformer/Visit.js @@ -60,31 +60,15 @@ class Track { return false; } if (_Node) { - let Node = _Node; - while (Node.parent) { - if (ts.isMethodDeclaration(Node.parent)) { - const Method = Node.parent.name.text; - let Overload = 0; - ts.forEachChild(Node.getSourceFile(), (node) => { - if (ts.isMethodDeclaration(node) && node.name.text === Method) { - Overload++; - } - }); - if (Overload > 1) { - return false; - } - } - Node = Node.parent; - } while (_Node && !ts.isFunctionDeclaration(_Node) && !ts.isMethodDeclaration(_Node) && !ts.isSourceFile(_Node)) { _Node = _Node.parent; } const _UsageNode = Array.from(Initializer.Usage).every( - ({ Node: Node2 }) => { - while (Node2 && !ts.isFunctionDeclaration(Node2) && !ts.isMethodDeclaration(Node2) && !ts.isSourceFile(Node2)) { - Node2 = Node2.parent; + ({ Node }) => { + while (Node && !ts.isFunctionDeclaration(Node) && !ts.isMethodDeclaration(Node) && !ts.isSourceFile(Node)) { + Node = Node.parent; } - return Node2 === _Node; + return Node === _Node; } ); if (!_UsageNode) { @@ -92,7 +76,8 @@ class Track { } } if (ts.isArrayLiteralExpression(Result) || // ts.isAwaitExpression(Result) || - ts.isMethodDeclaration(Result) || // ts.isFunctionDeclaration(Result) || + // ts.isMethodDeclaration(Result) || + // ts.isFunctionDeclaration(Result) || ts.isBinaryExpression(Result) || // ts.isCallExpression(Result) || ts.isNewExpression(Result)) { return false; diff --git a/Target/Function/Output/Transformer/Visit.js.map b/Target/Function/Output/Transformer/Visit.js.map index 75f10b66..6ca15e2b 100644 --- a/Target/Function/Output/Transformer/Visit.js.map +++ b/Target/Function/Output/Transformer/Visit.js.map @@ -1,7 +1,7 @@ { "version": 3, "sources": ["../../../../Source/Function/Output/Transformer/Visit.ts"], - "sourcesContent": ["import type Interface from \"@Interface/Output/Transformer/Visit.js\";\nimport type CountInitializer from \"@Type/Output/Visit/Initializer.js\";\nimport type Initializer from \"@Type/Output/Visit/Initializer/Initializer.js\";\nimport type {\n\tExpression,\n\tIdentifier,\n\tNode,\n\tStatement,\n\tTransformationContext,\n\tVariableStatement,\n} from \"typescript\";\n\n/**\n * @module Output\n *\n */\n\nclass Track {\n\tCount: CountInitializer = new Map();\n\n\tVariable(Name: string, Node: Node): void {\n\t\tconst Result = Get(Name, \"Name\", this.Count);\n\n\t\tif (Result) {\n\t\t\tthis.Count.get(Result)?.Usage.add({\n\t\t\t\tNode: Node,\n\n\t\t\t\tPosition: Node.pos,\n\t\t\t});\n\t\t}\n\t}\n\n\tInitializer(Variable: string, Initializer: Initializer): void {\n\t\tif (!this.Count.has(Initializer)) {\n\t\t\tthis.Count.set(Initializer, {\n\t\t\t\tName: Variable,\n\t\t\t\tUsage: new Set(),\n\t\t\t});\n\t\t}\n\t}\n\n\tScope(Node: Node): void {\n\t\tts.forEachChild(Node, (Node) => this.Scope(Node));\n\n\t\tif (!Node) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (ts.isIdentifier(Node)) {\n\t\t\t// Check for reassignment in assignment expressions\n\t\t\tif (\n\t\t\t\tNode.parent &&\n\t\t\t\tts.isBinaryExpression(Node.parent) &&\n\t\t\t\tNode.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n\t\t\t\tNode.parent.left === Node\n\t\t\t) {\n\t\t\t\tconst Result = Get(Node.text, \"Name\", this.Count);\n\n\t\t\t\tif (Result) {\n\t\t\t\t\tthis.Count.delete(Result);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!Node.parent || !ts.isVariableDeclaration(Node.parent)) {\n\t\t\t\tthis.Variable(Node.text, Node);\n\t\t\t}\n\t\t} else if (ts.isVariableStatement(Node)) {\n\t\t\tNode.declarationList.declarations.forEach((decl) => {\n\t\t\t\tif (ts.isIdentifier(decl.name) && decl.initializer) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t!(\n\t\t\t\t\t\t\tNode.modifiers?.some(\n\t\t\t\t\t\t\t\t(m) => m.kind === ts.SyntaxKind.ExportKeyword,\n\t\t\t\t\t\t\t) ?? false\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.Initializer(decl.name.text, decl.initializer);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tInline(Name: string, _Node?: Node): boolean {\n\t\ttry {\n\t\t\tconst Result = Get(Name, \"Name\", this.Count);\n\n\t\t\tif (!Result) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst Initializer = this.Count.get(Result);\n\n\t\t\tif (!Initializer) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tif (_Node) {\n\t\t\t\tlet Node = _Node;\n\n\t\t\t\twhile (Node.parent) {\n\t\t\t\t\tif (ts.isMethodDeclaration(Node.parent)) {\n\t\t\t\t\t\tconst Method = (Node.parent.name as Identifier)\n\t\t\t\t\t\t\t.text;\n\n\t\t\t\t\t\tlet Overload = 0;\n\n\t\t\t\t\t\tts.forEachChild(Node.getSourceFile(), (node) => {\n\t\t\t\t\t\t\tif (\n\t\t\t\t\t\t\t\tts.isMethodDeclaration(node) &&\n\t\t\t\t\t\t\t\t(node.name as Identifier).text === Method\n\t\t\t\t\t\t\t) {\n\t\t\t\t\t\t\t\tOverload++;\n\t\t\t\t\t\t\t}\n\t\t\t\t\t\t});\n\n\t\t\t\t\t\tif (Overload > 1) {\n\t\t\t\t\t\t\treturn false;\n\t\t\t\t\t\t}\n\t\t\t\t\t}\n\n\t\t\t\t\tNode = Node.parent;\n\t\t\t\t}\n\n\t\t\t\twhile (\n\t\t\t\t\t_Node &&\n\t\t\t\t\t!ts.isFunctionDeclaration(_Node) &&\n\t\t\t\t\t!ts.isMethodDeclaration(_Node) &&\n\t\t\t\t\t!ts.isSourceFile(_Node)\n\t\t\t\t) {\n\t\t\t\t\t_Node = _Node.parent;\n\t\t\t\t}\n\n\t\t\t\t// Check if all usages are in the same function/method scope\n\t\t\t\tconst _UsageNode = Array.from(Initializer.Usage).every(\n\t\t\t\t\t({ Node }) => {\n\t\t\t\t\t\twhile (\n\t\t\t\t\t\t\tNode &&\n\t\t\t\t\t\t\t!ts.isFunctionDeclaration(Node) &&\n\t\t\t\t\t\t\t!ts.isMethodDeclaration(Node) &&\n\t\t\t\t\t\t\t!ts.isSourceFile(Node)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tNode = Node.parent;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn Node === _Node;\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tif (!_UsageNode) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tts.isArrayLiteralExpression(Result) ||\n\t\t\t\t// ts.isAwaitExpression(Result) ||\n\t\t\t\tts.isMethodDeclaration(Result) ||\n\t\t\t\t// ts.isFunctionDeclaration(Result) ||\n\t\t\t\tts.isBinaryExpression(Result) ||\n\t\t\t\t// ts.isCallExpression(Result) ||\n\t\t\t\tts.isNewExpression(Result)\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst Count = Initializer.Usage.size;\n\n\t\t\treturn (\n\t\t\t\tCount === 1 ||\n\t\t\t\tts.isIdentifier(Result) ||\n\t\t\t\t// Include conditional expressions as valid nodes for inlining\n\t\t\t\tts.isConditionalExpression(Result) ||\n\t\t\t\t(ts.isLiteralExpression(Result) && Count <= 3)\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconsole.log(error);\n\t\t}\n\n\t\treturn false;\n\t}\n}\n\nclass Transformer {\n\treadonly Context: TransformationContext;\n\n\tTracker: Track;\n\n\tconstructor(Context: TransformationContext) {\n\t\tthis.Context = Context;\n\n\t\tthis.Tracker = new Track();\n\t}\n\n\tVariable(Node: VariableStatement): Statement | undefined {\n\t\tconst Processed = Node.declarationList.declarations.map((Node) => {\n\t\t\tif (Node.initializer && ts.isIdentifier(Node.initializer)) {\n\t\t\t\tconst Resolved = this.Resolve(Node.initializer.text, Node);\n\n\t\t\t\tif (Resolved) {\n\t\t\t\t\treturn ts.factory.updateVariableDeclaration(\n\t\t\t\t\t\tNode,\n\t\t\t\t\t\tNode.name,\n\t\t\t\t\t\tNode.exclamationToken,\n\t\t\t\t\t\tNode.type,\n\t\t\t\t\t\tResolved,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn Node;\n\t\t});\n\n\t\tconst Remaining = Processed.filter((Variable) => {\n\t\t\tif (ts.isIdentifier(Variable.name)) {\n\t\t\t\treturn !this.Tracker.Inline(Variable.name.text, Variable);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t});\n\n\t\tif (Remaining.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn ts.factory.createVariableStatement(\n\t\t\tNode.modifiers,\n\t\t\tts.factory.createVariableDeclarationList(\n\t\t\t\tRemaining,\n\t\t\t\tNode.declarationList.flags,\n\t\t\t),\n\t\t);\n\t}\n\n\tIdentifier(Node: Identifier) {\n\t\tconst Name = Node.text;\n\n\t\t// Add null checks for Node.parent\n\t\tif (!Node.parent) {\n\t\t\treturn Node;\n\t\t}\n\n\t\tif (\n\t\t\t// Parameter in function/method declaration\n\t\t\tts.isParameter(Node.parent) ||\n\t\t\t// Property access (e.g., obj.prop)\n\t\t\t(ts.isPropertyAccessExpression(Node.parent) &&\n\t\t\t\tNode.parent.name === Node) ||\n\t\t\t// Variable declaration\n\t\t\tts.isVariableDeclaration(Node.parent) ||\n\t\t\t// Binding patterns\n\t\t\tts.isBindingElement(Node.parent) ||\n\t\t\t// Class member\n\t\t\tts.isMethodDeclaration(Node.parent) ||\n\t\t\tts.isPropertyDeclaration(Node.parent) ||\n\t\t\tts.isConstructorDeclaration(Node.parent) ||\n\t\t\t// Import/Export statements\n\t\t\tts.isImportSpecifier(Node.parent) ||\n\t\t\tts.isExportSpecifier(Node.parent) ||\n\t\t\t// Object literal property names\n\t\t\t(ts.isPropertyAssignment(Node.parent) &&\n\t\t\t\tNode.parent.name === Node) ||\n\t\t\t// Method parameters\n\t\t\tts.isMethodSignature(Node.parent) ||\n\t\t\t// Type annotations\n\t\t\tts.isTypeReferenceNode(Node.parent) ||\n\t\t\t// Class/Interface declarations\n\t\t\tts.isClassDeclaration(Node.parent) ||\n\t\t\tts.isInterfaceDeclaration(Node.parent)\n\t\t) {\n\t\t\treturn Node;\n\t\t}\n\n\t\treturn this.Resolve(Name, Node) || Node;\n\t}\n\n\tResolve(Name: string, Node: Node): Expression | undefined {\n\t\tif (!this.Tracker.Inline(Name, Node)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst Result = Get(Name, \"Name\", this.Tracker.Count);\n\n\t\tif (!Result) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (ts.isShorthandPropertyAssignment(Result.parent)) {\n\t\t\treturn Result as Expression;\n\t\t}\n\n\t\tif (ts.isIdentifier(Result)) {\n\t\t\treturn this.Resolve(Result.text, Node) || Result;\n\t\t}\n\n\t\treturn Result;\n\t}\n\n\tLook(Node: Node): Node | undefined {\n\t\tlet Result: Node | undefined;\n\n\t\tswitch (true) {\n\t\t\tcase ts.isVariableStatement(Node):\n\t\t\t\tResult = this.Variable(Node);\n\n\t\t\t\tbreak;\n\n\t\t\tcase ts.isIdentifier(Node):\n\t\t\t\tResult = this.Identifier(Node);\n\n\t\t\t\tbreak;\n\n\t\t\tcase ts.isShorthandPropertyAssignment(Node):\n\t\t\t\tconst Name = Node.name.text;\n\t\t\t\tconst Resolved = this.Resolve(Name, Node);\n\n\t\t\t\tif (Resolved) {\n\t\t\t\t\tResult = ts.factory.createPropertyAssignment(\n\t\t\t\t\t\tts.factory.createIdentifier(Name),\n\t\t\t\t\t\tts.isConditionalExpression(Resolved)\n\t\t\t\t\t\t\t? ts.factory.createParenthesizedExpression(Resolved)\n\t\t\t\t\t\t\t: Resolved,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tResult = Node;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t// Class-related nodes\n\t\t\tcase ts.isPropertyDeclaration(Node):\n\t\t\tcase ts.isMethodDeclaration(Node):\n\t\t\tcase ts.isConstructorDeclaration(Node):\n\t\t\tcase ts.isGetAccessor(Node):\n\t\t\tcase ts.isSetAccessor(Node):\n\t\t\tcase ts.isClassExpression(Node):\n\n\t\t\t// Function-related nodes\n\t\t\tcase ts.isFunctionDeclaration(Node):\n\t\t\tcase ts.isFunctionExpression(Node):\n\t\t\tcase ts.isArrowFunction(Node):\n\t\t\tcase ts.isCallExpression(Node):\n\t\t\tcase ts.isNewExpression(Node):\n\n\t\t\t// Complex expressions\n\t\t\tcase ts.isAwaitExpression(Node):\n\t\t\tcase ts.isYieldExpression(Node):\n\t\t\tcase ts.isSpreadElement(Node):\n\t\t\tcase ts.isTemplateLiteral(Node):\n\t\t\tcase ts.isTaggedTemplateExpression(Node):\n\t\t\tcase ts.isJsxElement(Node):\n\t\t\tcase ts.isJsxFragment(Node):\n\n\t\t\t// Object and property nodes\n\t\t\tcase ts.isObjectLiteralExpression(Node):\n\t\t\tcase ts.isPropertyAccessExpression(Node):\n\t\t\tcase ts.isElementAccessExpression(Node):\n\n\t\t\t// Control flow nodes\n\t\t\tcase ts.isIfStatement(Node):\n\t\t\tcase ts.isSwitchStatement(Node):\n\t\t\tcase ts.isForStatement(Node):\n\t\t\tcase ts.isWhileStatement(Node):\n\t\t\tcase ts.isDoStatement(Node):\n\t\t\tcase ts.isTryStatement(Node):\n\t\t\t\tResult = Node; // Preserve these nodes as-is\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tResult = Node;\n\t\t}\n\n\t\treturn ts.visitEachChild(\n\t\t\tResult,\n\t\t\t(Node) => this.Look(Node),\n\t\t\tthis.Context,\n\t\t);\n\t}\n\n\tVisit(_Node: Node, Collection: number = 0): Node {\n\t\tconst Failed = 10;\n\n\t\tif (Collection >= Failed) {\n\t\t\treturn _Node;\n\t\t}\n\n\t\tthis.Tracker = new Track();\n\t\tthis.Tracker.Scope(_Node);\n\n\t\tlet Node = _Node;\n\n\t\ttry {\n\t\t\tNode = this.Look(_Node) ?? _Node;\n\t\t} catch (_Error) {\n\t\t\tconsole.log(\"-------------------------\");\n\t\t\tconsole.log(\"Could not transform Node:\");\n\t\t\tconsole.log(_Node.getText());\n\n\t\t\tconsole.log(\"--------------\");\n\t\t\tconsole.log(\"Errored with:\");\n\t\t\tconsole.log(_Error);\n\t\t}\n\n\t\tif (Node && Node !== _Node) {\n\t\t\treturn this.Visit(Node, Collection + 1);\n\t\t}\n\n\t\treturn _Node;\n\t}\n}\n\nexport const {\n\tdefault: ts,\n\n\tisIdentifier,\n\n\tfactory,\n} = await import(\"typescript\");\n\nexport default ((context: TransformationContext) => (rootNode) =>\n\tnew Transformer(context).Visit(rootNode)) satisfies Interface as Interface;\n\nexport const { default: Get } = await import(\n\t\"@Function/Output/Transformer/Visit/Get.js\"\n);\n"], - "mappings": ";;AAiBA,MAAM,MAAM;AAAA,EAjBZ,OAiBY;AAAA;AAAA;AAAA,EACX,QAA0B,oBAAI,IAAI;AAAA,EAElC,SAAS,MAAc,MAAkB;AACxC,UAAM,SAAS,IAAI,MAAM,QAAQ,KAAK,KAAK;AAE3C,QAAI,QAAQ;AACX,WAAK,MAAM,IAAI,MAAM,GAAG,MAAM,IAAI;AAAA,QACjC;AAAA,QAEA,UAAU,KAAK;AAAA,MAChB,CAAC;AAAA,IACF;AAAA,EACD;AAAA,EAEA,YAAY,UAAkB,aAAgC;AAC7D,QAAI,CAAC,KAAK,MAAM,IAAI,WAAW,GAAG;AACjC,WAAK,MAAM,IAAI,aAAa;AAAA,QAC3B,MAAM;AAAA,QACN,OAAO,oBAAI,IAAI;AAAA,MAChB,CAAC;AAAA,IACF;AAAA,EACD;AAAA,EAEA,MAAM,MAAkB;AACvB,OAAG,aAAa,MAAM,CAACA,UAAS,KAAK,MAAMA,KAAI,CAAC;AAEhD,QAAI,CAAC,MAAM;AACV;AAAA,IACD;AAEA,QAAI,GAAG,aAAa,IAAI,GAAG;AAE1B,UACC,KAAK,UACL,GAAG,mBAAmB,KAAK,MAAM,KACjC,KAAK,OAAO,cAAc,SAAS,GAAG,WAAW,eACjD,KAAK,OAAO,SAAS,MACpB;AACD,cAAM,SAAS,IAAI,KAAK,MAAM,QAAQ,KAAK,KAAK;AAEhD,YAAI,QAAQ;AACX,eAAK,MAAM,OAAO,MAAM;AAAA,QACzB;AAAA,MACD;AAEA,UAAI,CAAC,KAAK,UAAU,C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M,QAAQ,CAAC;AAE3B,cAAQ,IAAI,gBAAgB;AAC5B,cAAQ,IAAI,eAAe;AAC3B,cAAQ,IAAI,MAAM;AAAA,IACnB;AAEA,QAAI,QAAQ,SAAS,OAAO;AAC3B,aAAO,KAAK,MAAM,MAAM,aAAa,CAAC;AAAA,IACvC;AAEA,WAAO;AAAA,EACR;AACD;AAEO,MAAM;AAAA,EACZ,SAAS;AAAA,EAET;AAAA,EAEA;AACD,IAAI,MAAM,OAAO,YAAY;AAE7B,IAAO,gBAAS,wBAAC,YAAmC,CAAC,aACpD,IAAI,YAAY,OAAO,EAAE,MAAM,QAAQ,GADxB;AAGT,MAAM,EAAE,SAAS,IAAI,IAAI,MAAM,OACrC,2CACD;", + "sourcesContent": ["import type Interface from \"@Interface/Output/Transformer/Visit.js\";\nimport type CountInitializer from \"@Type/Output/Visit/Initializer.js\";\nimport type Initializer from \"@Type/Output/Visit/Initializer/Initializer.js\";\nimport type {\n\tExpression,\n\tIdentifier,\n\tNode,\n\tStatement,\n\tTransformationContext,\n\tVariableStatement,\n} from \"typescript\";\n\n/**\n * @module Output\n *\n */\n\nclass Track {\n\tCount: CountInitializer = new Map();\n\n\tVariable(Name: string, Node: Node): void {\n\t\tconst Result = Get(Name, \"Name\", this.Count);\n\n\t\tif (Result) {\n\t\t\tthis.Count.get(Result)?.Usage.add({\n\t\t\t\tNode: Node,\n\n\t\t\t\tPosition: Node.pos,\n\t\t\t});\n\t\t}\n\t}\n\n\tInitializer(Variable: string, Initializer: Initializer): void {\n\t\tif (!this.Count.has(Initializer)) {\n\t\t\tthis.Count.set(Initializer, {\n\t\t\t\tName: Variable,\n\t\t\t\tUsage: new Set(),\n\t\t\t});\n\t\t}\n\t}\n\n\tScope(Node: Node): void {\n\t\tts.forEachChild(Node, (Node) => this.Scope(Node));\n\n\t\tif (!Node) {\n\t\t\treturn;\n\t\t}\n\n\t\tif (ts.isIdentifier(Node)) {\n\t\t\t// Check for reassignment in assignment expressions\n\t\t\tif (\n\t\t\t\tNode.parent &&\n\t\t\t\tts.isBinaryExpression(Node.parent) &&\n\t\t\t\tNode.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken &&\n\t\t\t\tNode.parent.left === Node\n\t\t\t) {\n\t\t\t\tconst Result = Get(Node.text, \"Name\", this.Count);\n\n\t\t\t\tif (Result) {\n\t\t\t\t\tthis.Count.delete(Result);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (!Node.parent || !ts.isVariableDeclaration(Node.parent)) {\n\t\t\t\tthis.Variable(Node.text, Node);\n\t\t\t}\n\t\t} else if (ts.isVariableStatement(Node)) {\n\t\t\tNode.declarationList.declarations.forEach((decl) => {\n\t\t\t\tif (ts.isIdentifier(decl.name) && decl.initializer) {\n\t\t\t\t\tif (\n\t\t\t\t\t\t!(\n\t\t\t\t\t\t\tNode.modifiers?.some(\n\t\t\t\t\t\t\t\t(m) => m.kind === ts.SyntaxKind.ExportKeyword,\n\t\t\t\t\t\t\t) ?? false\n\t\t\t\t\t\t)\n\t\t\t\t\t) {\n\t\t\t\t\t\tthis.Initializer(decl.name.text, decl.initializer);\n\t\t\t\t\t}\n\t\t\t\t}\n\t\t\t});\n\t\t}\n\t}\n\n\tInline(Name: string, _Node?: Node): boolean {\n\t\ttry {\n\t\t\tconst Result = Get(Name, \"Name\", this.Count);\n\n\t\t\tif (!Result) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst Initializer = this.Count.get(Result);\n\n\t\t\tif (!Initializer) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\t// If we have a current scope, check all usages are in same scope\n\t\t\tif (_Node) {\n\t\t\t\twhile (\n\t\t\t\t\t_Node &&\n\t\t\t\t\t!ts.isFunctionDeclaration(_Node) &&\n\t\t\t\t\t!ts.isMethodDeclaration(_Node) &&\n\t\t\t\t\t!ts.isSourceFile(_Node)\n\t\t\t\t) {\n\t\t\t\t\t_Node = _Node.parent;\n\t\t\t\t}\n\n\t\t\t\t// Check if all usages are in the same function/method scope\n\t\t\t\tconst _UsageNode = Array.from(Initializer.Usage).every(\n\t\t\t\t\t({ Node }) => {\n\t\t\t\t\t\twhile (\n\t\t\t\t\t\t\tNode &&\n\t\t\t\t\t\t\t!ts.isFunctionDeclaration(Node) &&\n\t\t\t\t\t\t\t!ts.isMethodDeclaration(Node) &&\n\t\t\t\t\t\t\t!ts.isSourceFile(Node)\n\t\t\t\t\t\t) {\n\t\t\t\t\t\t\tNode = Node.parent;\n\t\t\t\t\t\t}\n\n\t\t\t\t\t\treturn Node === _Node;\n\t\t\t\t\t},\n\t\t\t\t);\n\n\t\t\t\tif (!_UsageNode) {\n\t\t\t\t\treturn false;\n\t\t\t\t}\n\t\t\t}\n\n\t\t\tif (\n\t\t\t\tts.isArrayLiteralExpression(Result) ||\n\t\t\t\t// ts.isAwaitExpression(Result) ||\n\t\t\t\t// ts.isMethodDeclaration(Result) ||\n\t\t\t\t// ts.isFunctionDeclaration(Result) ||\n\t\t\t\tts.isBinaryExpression(Result) ||\n\t\t\t\t// ts.isCallExpression(Result) ||\n\t\t\t\tts.isNewExpression(Result)\n\t\t\t) {\n\t\t\t\treturn false;\n\t\t\t}\n\n\t\t\tconst Count = Initializer.Usage.size;\n\n\t\t\treturn (\n\t\t\t\tCount === 1 ||\n\t\t\t\tts.isIdentifier(Result) ||\n\t\t\t\t// Include conditional expressions as valid nodes for inlining\n\t\t\t\tts.isConditionalExpression(Result) ||\n\t\t\t\t(ts.isLiteralExpression(Result) && Count <= 3)\n\t\t\t);\n\t\t} catch (error) {\n\t\t\tconsole.log(error);\n\t\t}\n\n\t\treturn false;\n\t}\n}\n\nclass Transformer {\n\treadonly Context: TransformationContext;\n\n\tTracker: Track;\n\n\tconstructor(Context: TransformationContext) {\n\t\tthis.Context = Context;\n\n\t\tthis.Tracker = new Track();\n\t}\n\n\tVariable(Node: VariableStatement): Statement | undefined {\n\t\tconst Processed = Node.declarationList.declarations.map((Node) => {\n\t\t\tif (Node.initializer && ts.isIdentifier(Node.initializer)) {\n\t\t\t\tconst Resolved = this.Resolve(Node.initializer.text, Node);\n\n\t\t\t\tif (Resolved) {\n\t\t\t\t\treturn ts.factory.updateVariableDeclaration(\n\t\t\t\t\t\tNode,\n\t\t\t\t\t\tNode.name,\n\t\t\t\t\t\tNode.exclamationToken,\n\t\t\t\t\t\tNode.type,\n\t\t\t\t\t\tResolved,\n\t\t\t\t\t);\n\t\t\t\t}\n\t\t\t}\n\n\t\t\treturn Node;\n\t\t});\n\n\t\tconst Remaining = Processed.filter((Variable) => {\n\t\t\tif (ts.isIdentifier(Variable.name)) {\n\t\t\t\treturn !this.Tracker.Inline(Variable.name.text, Variable);\n\t\t\t}\n\n\t\t\treturn true;\n\t\t});\n\n\t\tif (Remaining.length === 0) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\treturn ts.factory.createVariableStatement(\n\t\t\tNode.modifiers,\n\t\t\tts.factory.createVariableDeclarationList(\n\t\t\t\tRemaining,\n\t\t\t\tNode.declarationList.flags,\n\t\t\t),\n\t\t);\n\t}\n\n\tIdentifier(Node: Identifier) {\n\t\tconst Name = Node.text;\n\n\t\t// Add null checks for Node.parent\n\t\tif (!Node.parent) {\n\t\t\treturn Node;\n\t\t}\n\n\t\tif (\n\t\t\t// Parameter in function/method declaration\n\t\t\tts.isParameter(Node.parent) ||\n\t\t\t// Property access (e.g., obj.prop)\n\t\t\t(ts.isPropertyAccessExpression(Node.parent) &&\n\t\t\t\tNode.parent.name === Node) ||\n\t\t\t// Variable declaration\n\t\t\tts.isVariableDeclaration(Node.parent) ||\n\t\t\t// Binding patterns\n\t\t\tts.isBindingElement(Node.parent) ||\n\t\t\t// Class member\n\t\t\tts.isMethodDeclaration(Node.parent) ||\n\t\t\tts.isPropertyDeclaration(Node.parent) ||\n\t\t\tts.isConstructorDeclaration(Node.parent) ||\n\t\t\t// Import/Export statements\n\t\t\tts.isImportSpecifier(Node.parent) ||\n\t\t\tts.isExportSpecifier(Node.parent) ||\n\t\t\t// Object literal property names\n\t\t\t(ts.isPropertyAssignment(Node.parent) &&\n\t\t\t\tNode.parent.name === Node) ||\n\t\t\t// Method parameters\n\t\t\tts.isMethodSignature(Node.parent) ||\n\t\t\t// Type annotations\n\t\t\tts.isTypeReferenceNode(Node.parent) ||\n\t\t\t// Class/Interface declarations\n\t\t\tts.isClassDeclaration(Node.parent) ||\n\t\t\tts.isInterfaceDeclaration(Node.parent)\n\t\t) {\n\t\t\treturn Node;\n\t\t}\n\n\t\treturn this.Resolve(Name, Node) || Node;\n\t}\n\n\tResolve(Name: string, Node: Node): Expression | undefined {\n\t\tif (!this.Tracker.Inline(Name, Node)) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tconst Result = Get(Name, \"Name\", this.Tracker.Count);\n\n\t\tif (!Result) {\n\t\t\treturn undefined;\n\t\t}\n\n\t\tif (ts.isShorthandPropertyAssignment(Result.parent)) {\n\t\t\treturn Result as Expression;\n\t\t}\n\n\t\tif (ts.isIdentifier(Result)) {\n\t\t\treturn this.Resolve(Result.text, Node) || Result;\n\t\t}\n\n\t\treturn Result;\n\t}\n\n\tLook(Node: Node): Node | undefined {\n\t\tlet Result: Node | undefined;\n\n\t\tswitch (true) {\n\t\t\tcase ts.isVariableStatement(Node):\n\t\t\t\tResult = this.Variable(Node);\n\n\t\t\t\tbreak;\n\n\t\t\tcase ts.isIdentifier(Node):\n\t\t\t\tResult = this.Identifier(Node);\n\n\t\t\t\tbreak;\n\n\t\t\tcase ts.isShorthandPropertyAssignment(Node):\n\t\t\t\tconst Name = Node.name.text;\n\t\t\t\tconst Resolved = this.Resolve(Name, Node);\n\n\t\t\t\tif (Resolved) {\n\t\t\t\t\tResult = ts.factory.createPropertyAssignment(\n\t\t\t\t\t\tts.factory.createIdentifier(Name),\n\t\t\t\t\t\tts.isConditionalExpression(Resolved)\n\t\t\t\t\t\t\t? ts.factory.createParenthesizedExpression(Resolved)\n\t\t\t\t\t\t\t: Resolved,\n\t\t\t\t\t);\n\t\t\t\t} else {\n\t\t\t\t\tResult = Node;\n\t\t\t\t}\n\n\t\t\t\tbreak;\n\n\t\t\t// Class-related nodes\n\t\t\tcase ts.isPropertyDeclaration(Node):\n\t\t\tcase ts.isMethodDeclaration(Node):\n\t\t\tcase ts.isConstructorDeclaration(Node):\n\t\t\tcase ts.isGetAccessor(Node):\n\t\t\tcase ts.isSetAccessor(Node):\n\t\t\tcase ts.isClassExpression(Node):\n\n\t\t\t// Function-related nodes\n\t\t\tcase ts.isFunctionDeclaration(Node):\n\t\t\tcase ts.isFunctionExpression(Node):\n\t\t\tcase ts.isArrowFunction(Node):\n\t\t\tcase ts.isCallExpression(Node):\n\t\t\tcase ts.isNewExpression(Node):\n\n\t\t\t// Complex expressions\n\t\t\tcase ts.isAwaitExpression(Node):\n\t\t\tcase ts.isYieldExpression(Node):\n\t\t\tcase ts.isSpreadElement(Node):\n\t\t\tcase ts.isTemplateLiteral(Node):\n\t\t\tcase ts.isTaggedTemplateExpression(Node):\n\t\t\tcase ts.isJsxElement(Node):\n\t\t\tcase ts.isJsxFragment(Node):\n\n\t\t\t// Object and property nodes\n\t\t\tcase ts.isObjectLiteralExpression(Node):\n\t\t\tcase ts.isPropertyAccessExpression(Node):\n\t\t\tcase ts.isElementAccessExpression(Node):\n\n\t\t\t// Control flow nodes\n\t\t\tcase ts.isIfStatement(Node):\n\t\t\tcase ts.isSwitchStatement(Node):\n\t\t\tcase ts.isForStatement(Node):\n\t\t\tcase ts.isWhileStatement(Node):\n\t\t\tcase ts.isDoStatement(Node):\n\t\t\tcase ts.isTryStatement(Node):\n\t\t\t\tResult = Node; // Preserve these nodes as-is\n\t\t\t\tbreak;\n\n\t\t\tdefault:\n\t\t\t\tResult = Node;\n\t\t}\n\n\t\treturn ts.visitEachChild(\n\t\t\tResult,\n\t\t\t(Node) => this.Look(Node),\n\t\t\tthis.Context,\n\t\t);\n\t}\n\n\tVisit(_Node: Node, Collection: number = 0): Node {\n\t\tconst Failed = 10;\n\n\t\tif (Collection >= Failed) {\n\t\t\treturn _Node;\n\t\t}\n\n\t\tthis.Tracker = new Track();\n\t\tthis.Tracker.Scope(_Node);\n\n\t\tlet Node = _Node;\n\n\t\ttry {\n\t\t\tNode = this.Look(_Node) ?? _Node;\n\t\t} catch (_Error) {\n\t\t\tconsole.log(\"-------------------------\");\n\t\t\tconsole.log(\"Could not transform Node:\");\n\t\t\tconsole.log(_Node.getText());\n\n\t\t\tconsole.log(\"--------------\");\n\t\t\tconsole.log(\"Errored with:\");\n\t\t\tconsole.log(_Error);\n\t\t}\n\n\t\tif (Node && Node !== _Node) {\n\t\t\treturn this.Visit(Node, Collection + 1);\n\t\t}\n\n\t\treturn _Node;\n\t}\n}\n\nexport const {\n\tdefault: ts,\n\n\tisIdentifier,\n\n\tfactory,\n} = await import(\"typescript\");\n\nexport default ((context: TransformationContext) => (rootNode) =>\n\tnew Transformer(context).Visit(rootNode)) satisfies Interface as Interface;\n\nexport const { default: Get } = await import(\n\t\"@Function/Output/Transformer/Visit/Get.js\"\n);\n"], + "mappings": ";;AAiBA,MAAM,MAAM;AAAA,EAjBZ,OAiBY;AAAA;AAAA;AAAA,EACX,QAA0B,oBAAI,IAAI;AAAA,EAElC,SAAS,MAAc,MAAkB;AACxC,UAAM,SAAS,IAAI,MAAM,QAAQ,KAAK,KAAK;AAE3C,QAAI,QAAQ;AACX,WAAK,MAAM,IAAI,MAAM,GAAG,MAAM,IAAI;AAAA,QACjC;AAAA,QAEA,UAAU,KAAK;AAAA,MAChB,CAAC;AAAA,IACF;AAAA,EACD;AAAA,EAEA,YAAY,UAAkB,aAAgC;AAC7D,QAAI,CAAC,KAAK,MAAM,IAAI,WAAW,GAAG;AACjC,WAAK,MAAM,IAAI,aAAa;AAAA,QAC3B,MAAM;AAAA,QACN,OAAO,oBAAI,IAAI;AAAA,MAChB,CAAC;AAAA,IACF;AAAA,EACD;AAAA,EAEA,MAAM,MAAkB;AACvB,OAAG,aAAa,MAAM,CAACA,UAAS,KAAK,MAAMA,KAAI,CAAC;AAEhD,QAAI,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