From 9c0ab6294a5043bfe63ff920c1adb8964125106a Mon Sep 17 00:00:00 2001 From: Nikola Hristov Date: Sat, 9 Nov 2024 10:24:07 +0200 Subject: [PATCH] s Signed-off-by: Nikola Hristov --- Example/Input/Erroring/Import.ts | 91 ------ Source/Function/Output/Transformer/Visit.ts | 142 ++++----- .../Function/Output/Transformer/Visit/Get.ts | 2 +- Source/Interface/Output/Visit/Get.ts | 2 +- Target/Class/Eliminate.js | 9 +- Target/Class/Eliminate.js.map | 7 - Target/Function/Eliminate.js | 39 +-- Target/Function/Eliminate.js.map | 7 - Target/Function/File.js | 35 +-- Target/Function/File.js.map | 7 - Target/Function/Merge.js | 8 +- Target/Function/Merge.js.map | 7 - Target/Function/Output.js | 25 +- Target/Function/Output.js.map | 7 - Target/Function/Output/Transformer.js | 12 +- Target/Function/Output/Transformer.js.map | 7 - Target/Function/Output/Transformer/Visit.js | 278 +----------------- .../Function/Output/Transformer/Visit.js.map | 7 - .../Output/Transformer/Visit/Analyze.js | 1 - .../Output/Transformer/Visit/Analyze.js.map | 7 - .../Function/Output/Transformer/Visit/Get.js | 10 +- .../Output/Transformer/Visit/Get.js.map | 7 - Target/Interface/Eliminate.js | 1 - Target/Interface/Eliminate.js.map | 7 - Target/Interface/File.js | 1 - Target/Interface/File.js.map | 7 - Target/Interface/Option.js | 1 - Target/Interface/Option.js.map | 7 - Target/Interface/Output.js | 1 - Target/Interface/Output.js.map | 7 - Target/Interface/Output/Transformer.js | 1 - Target/Interface/Output/Transformer.js.map | 7 - Target/Interface/Output/Transformer/Visit.js | 1 - .../Interface/Output/Transformer/Visit.js.map | 7 - Target/Interface/Output/Visit.js | 1 - Target/Interface/Output/Visit.js.map | 7 - Target/Interface/Output/Visit/Get.js | 1 - Target/Interface/Output/Visit/Get.js.map | 7 - Target/Type/Output/Visit/Initializer.js | 1 - Target/Type/Output/Visit/Initializer.js.map | 7 - .../Output/Visit/Initializer/Initializer.js | 1 - .../Visit/Initializer/Initializer.js.map | 7 - Target/Type/Output/Visit/Usage.js | 1 - Target/Type/Output/Visit/Usage.js.map | 7 - Target/Type/Output/Visit/Usage/Text.js | 1 - Target/Type/Output/Visit/Usage/Text.js.map | 7 - Target/Type/Output/Visit/Usage/Usage.js | 1 - Target/Type/Output/Visit/Usage/Usage.js.map | 7 - Target/Variable/Eliminate.js | 9 +- Target/Variable/Eliminate.js.map | 7 - 50 files changed, 87 insertions(+), 750 deletions(-) delete mode 100644 Example/Input/Erroring/Import.ts delete mode 100644 Target/Class/Eliminate.js.map delete mode 100644 Target/Function/Eliminate.js.map delete mode 100644 Target/Function/File.js.map delete mode 100644 Target/Function/Merge.js.map delete mode 100644 Target/Function/Output.js.map delete mode 100644 Target/Function/Output/Transformer.js.map delete mode 100644 Target/Function/Output/Transformer/Visit.js.map delete mode 100644 Target/Function/Output/Transformer/Visit/Analyze.js.map delete mode 100644 Target/Function/Output/Transformer/Visit/Get.js.map delete mode 100644 Target/Interface/Eliminate.js.map delete mode 100644 Target/Interface/File.js.map delete mode 100644 Target/Interface/Option.js.map delete mode 100644 Target/Interface/Output.js.map delete mode 100644 Target/Interface/Output/Transformer.js.map delete mode 100644 Target/Interface/Output/Transformer/Visit.js.map delete mode 100644 Target/Interface/Output/Visit.js.map delete mode 100644 Target/Interface/Output/Visit/Get.js.map delete mode 100644 Target/Type/Output/Visit/Initializer.js.map delete mode 100644 Target/Type/Output/Visit/Initializer/Initializer.js.map delete mode 100644 Target/Type/Output/Visit/Usage.js.map delete mode 100644 Target/Type/Output/Visit/Usage/Text.js.map delete mode 100644 Target/Type/Output/Visit/Usage/Usage.js.map delete mode 100644 Target/Variable/Eliminate.js.map diff --git a/Example/Input/Erroring/Import.ts b/Example/Input/Erroring/Import.ts deleted file mode 100644 index 1616b634..00000000 --- a/Example/Input/Erroring/Import.ts +++ /dev/null @@ -1,91 +0,0 @@ -/*--------------------------------------------------------------------------------------------- - * Copyright (c) Microsoft Corporation. All rights reserved. - * Licensed under the MIT License. See License.txt in the project root for license information. - *--------------------------------------------------------------------------------------------*/ -import { basename } from "path"; -import { Octokit } from "@octokit/rest"; -import * as vscode from "vscode"; - -import { agent } from "./node/net"; - -class GitHubGistProfileContentHandler implements vscode.ProfileContentHandler { - readonly name = vscode.l10n.t("GitHub"); - readonly description = vscode.l10n.t("gist"); - private _octokit: Promise | undefined; - private getOctokit(): Promise { - if (!this._octokit) { - this._octokit = (async () => { - const session = await vscode.authentication.getSession( - "github", - ["gist", "user:email"], - { createIfNone: true }, - ); - const token = session.accessToken; - const { Octokit } = await import("@octokit/rest"); - return new Octokit({ - request: { agent }, - userAgent: "GitHub VSCode", - auth: `token ${token}`, - }); - })(); - } - return this._octokit; - } - async saveProfile( - name: string, - content: string, - ): Promise<{ - readonly id: string; - readonly link: vscode.Uri; - } | null> { - const octokit = await this.getOctokit(); - const result = await octokit.gists.create({ - public: false, - files: { - [name]: { - content, - }, - }, - }); - if (result.data.id && result.data.html_url) { - const link = vscode.Uri.parse(result.data.html_url); - return { id: result.data.id, link }; - } - return null; - } - private _public_octokit: Promise | undefined; - private getPublicOctokit(): Promise { - if (!this._public_octokit) { - this._public_octokit = (async () => { - const { Octokit } = await import("@octokit/rest"); - return new Octokit({ - request: { agent }, - userAgent: "GitHub VSCode", - }); - })(); - } - return this._public_octokit; - } - async readProfile(id: string): Promise; - async readProfile(uri: vscode.Uri): Promise; - async readProfile(arg: string | vscode.Uri): Promise { - const gist_id = typeof arg === "string" ? arg : basename(arg.path); - const octokit = await this.getPublicOctokit(); - try { - const gist = await octokit.gists.get({ gist_id }); - if (gist.data.files) { - return ( - gist.data.files[Object.keys(gist.data.files)[0]]?.content ?? - null - ); - } - } catch (error) { - // ignore - } - return null; - } -} -vscode.window.registerProfileContentHandler( - "github", - new GitHubGistProfileContentHandler(), -); diff --git a/Source/Function/Output/Transformer/Visit.ts b/Source/Function/Output/Transformer/Visit.ts index 4881ab6d..dab7c843 100644 --- a/Source/Function/Output/Transformer/Visit.ts +++ b/Source/Function/Output/Transformer/Visit.ts @@ -19,7 +19,7 @@ class Track { Count: CountInitializer = new Map(); Variable(Name: string, Node: Node): void { - const Result = Get(Name, "Name", this.Count); + const Result = Get(Name, "Name", this.Count)?.[0]; if (Result) { this.Count.get(Result)?.Usage.add({ @@ -54,7 +54,7 @@ class Track { Node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken && Node.parent.left === Node ) { - const Result = Get(Node.text, "Name", this.Count); + const Result = Get(Node.text, "Name", this.Count)?.[0]; if (Result) { this.Count.delete(Result); @@ -83,7 +83,7 @@ class Track { Inline(Name: string, _Node?: Node): boolean { try { - const Result = Get(Name, "Name", this.Count); + const Result = Get(Name, "Name", this.Count)?.[0]; if (!Result) { return false; @@ -95,58 +95,60 @@ class Track { return false; } - // If we have a current scope, check all usages are in same scope - if (_Node) { - while ( - _Node && - !ts.isFunctionDeclaration(_Node) && - !ts.isMethodDeclaration(_Node) && - !ts.isSourceFile(_Node) - ) { - _Node = _Node.parent; - } - - // Check if all usages are in the same function/method scope - const _UsageNode = Array.from(Initializer.Usage).every( - ({ Node }) => { - while ( - Node && - !ts.isFunctionDeclaration(Node) && - !ts.isMethodDeclaration(Node) && - !ts.isSourceFile(Node) - ) { - Node = Node.parent; - } - - return Node === _Node; - }, - ); - - if (!_UsageNode) { - return false; - } - } - - if ( - ts.isArrayLiteralExpression(Result) || - // ts.isAwaitExpression(Result) || - // ts.isMethodDeclaration(Result) || - // ts.isFunctionDeclaration(Result) || - ts.isBinaryExpression(Result) || - // ts.isCallExpression(Result) || - ts.isNewExpression(Result) - ) { - return false; - } + // // If we have a current scope, check all usages are in same scope + // if (_Node) { + // while ( + // _Node && + // !ts.isFunctionDeclaration(_Node) && + // !ts.isMethodDeclaration(_Node) && + // !ts.isSourceFile(_Node) + // ) { + // _Node = _Node.parent; + // } + + // // Check if all usages are in the same function/method scope + // const _UsageNode = Array.from(Initializer.Usage).every( + // ({ Node }) => { + // while ( + // Node && + // !ts.isFunctionDeclaration(Node) && + // !ts.isMethodDeclaration(Node) && + // !ts.isSourceFile(Node) + // ) { + // Node = Node.parent; + // } + + // return Node === _Node; + // }, + // ); + + // if (!_UsageNode) { + // return false; + // } + // } + + // if ( + // ts.isArrayLiteralExpression(Result) || + // // ts.isAwaitExpression(Result) || + // // ts.isMethodDeclaration(Result) || + // // ts.isFunctionDeclaration(Result) || + // ts.isBinaryExpression(Result) || + // // ts.isCallExpression(Result) || + // ts.isNewExpression(Result) + // ) { + // return false; + // } + + console.log(Initializer.Name); + console.log(Initializer.Usage); const Count = Initializer.Usage.size; return ( Count === 1 || ts.isIdentifier(Result) || - // Include conditional expressions as valid nodes for inlining ts.isConditionalExpression(Result) || - (ts.isLiteralExpression(Result) && Count <= 3) + ts.isLiteralExpression(Result) ); } catch (error) { console.log(error); @@ -216,32 +218,40 @@ class Transformer { } if ( - // Parameter in function/method declaration + // Parameter and function-related checks ts.isParameter(Node.parent) || - // Property access (e.g., obj.prop) + ts.isMethodDeclaration(Node.parent) || + ts.isConstructorDeclaration(Node.parent) || + ts.isFunctionDeclaration(Node.parent) || + // Property and class-related checks + ts.isPropertyDeclaration(Node.parent) || (ts.isPropertyAccessExpression(Node.parent) && Node.parent.name === Node) || - // Variable declaration + (ts.isPropertyAssignment(Node.parent) && + Node.parent.name === Node) || + // Variable and binding checks ts.isVariableDeclaration(Node.parent) || - // Binding patterns ts.isBindingElement(Node.parent) || - // Class member - ts.isMethodDeclaration(Node.parent) || - ts.isPropertyDeclaration(Node.parent) || - ts.isConstructorDeclaration(Node.parent) || - // Import/Export statements + // Import/Export checks ts.isImportSpecifier(Node.parent) || ts.isExportSpecifier(Node.parent) || - // Object literal property names - (ts.isPropertyAssignment(Node.parent) && - Node.parent.name === Node) || - // Method parameters - ts.isMethodSignature(Node.parent) || - // Type annotations + // Type-related checks ts.isTypeReferenceNode(Node.parent) || + ts.isTypeLiteralNode(Node.parent) || + ts.isTypeAliasDeclaration(Node.parent) || + ts.isTypeParameterDeclaration(Node.parent) || + ts.isIndexSignatureDeclaration(Node.parent) || + ts.isPropertySignature(Node.parent) || + ts.isTypePredicateNode(Node.parent) || + ts.isPartOfTypeNode(Node.parent) || + ts.isInterfaceDeclaration(Node.parent) || + ts.isMethodSignature(Node.parent) || + // Check if part of type annotations + ts.isMethodDeclaration(Node.parent) || + ts.isParameter(Node.parent) || + ts.isPropertyDeclaration(Node.parent) || // Class/Interface declarations - ts.isClassDeclaration(Node.parent) || - ts.isInterfaceDeclaration(Node.parent) + ts.isClassDeclaration(Node.parent) ) { return Node; } @@ -254,7 +264,7 @@ class Transformer { return undefined; } - const Result = Get(Name, "Name", this.Tracker.Count); + const Result = Get(Name, "Name", this.Tracker.Count)?.[0]; if (!Result) { return undefined; diff --git a/Source/Function/Output/Transformer/Visit/Get.ts b/Source/Function/Output/Transformer/Visit/Get.ts index 0bbde887..5a671d43 100644 --- a/Source/Function/Output/Transformer/Visit/Get.ts +++ b/Source/Function/Output/Transformer/Visit/Get.ts @@ -7,4 +7,4 @@ import type Interface from "@Interface/Output/Visit/Get.js"; export default ((...[Search, In, Map]) => [...Map.entries()].find( ([_Key, Value]) => Value[In] === Search, - )?.[0]) satisfies Interface as Interface; + )) satisfies Interface as Interface; diff --git a/Source/Interface/Output/Visit/Get.ts b/Source/Interface/Output/Visit/Get.ts index 32bfcd0e..1a01db3b 100644 --- a/Source/Interface/Output/Visit/Get.ts +++ b/Source/Interface/Output/Visit/Get.ts @@ -9,5 +9,5 @@ export default interface Interface { Search: Value[K], In: K, Map: Map, - ): Initializer | undefined; + ): [Initializer, Record] | undefined; } diff --git a/Target/Class/Eliminate.js b/Target/Class/Eliminate.js index 790f5123..401af516 100644 --- a/Target/Class/Eliminate.js +++ b/Target/Class/Eliminate.js @@ -1,9 +1,2 @@ #!/usr/bin/env node -var Eliminate_default = new (await import("commander")).Command().name("Eliminate").version("0.0.5").description("\u2198\uFE0F\u2001Eliminate\u2001\u2014").argument( - "-E, --Eliminate ", - "\u{1F4DC}\u2001Eliminate configuration file\u2001\u2014" -).action((await import("../Function/Eliminate.js")).default).parse(); -export { - Eliminate_default as default -}; -//# sourceMappingURL=Eliminate.js.map +var i=new(await import("commander")).Command().name("Eliminate").version("0.0.5").description("\u2198\uFE0F\u2001Eliminate\u2001\u2014").argument("-E, --Eliminate ","\u{1F4DC}\u2001Eliminate configuration file\u2001\u2014").action((await import("../Function/Eliminate.js")).default).parse();export{i as default}; diff --git a/Target/Class/Eliminate.js.map b/Target/Class/Eliminate.js.map deleted file mode 100644 index 597c24e5..00000000 --- a/Target/Class/Eliminate.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../Source/Class/Eliminate.ts"], - "sourcesContent": ["#!/usr/bin/env node\n\n/**\n * @module Eliminate\n *\n */\nexport default new (await import(\"commander\")).Command()\n\t.name(\"Eliminate\")\n\t.version(process.env[\"VERSION_PACKAGE\"] ?? \"0.0.1\")\n\t.description(\"\u2198\uFE0F\u2001Eliminate\u2001\u2014\")\n\t.argument(\n\t\t\"-E, --Eliminate \",\n\t\t\"\uD83D\uDCDC\u2001Eliminate configuration file\u2001\u2014\",\n\t)\n\t.action((await import(\"../Function/Eliminate.js\")).default)\n\t.parse();\n"], - "mappings": ";AAMA,IAAO,oBAAQ,KAAK,MAAM,OAAO,WAAW,GAAG,QAAQ,EACrD,KAAK,WAAW,EAChB,QAAQ,OAAyC,EACjD,YAAY,yCAAgB,EAC5B;AAAA,EACA;AAAA,EACA;AACD,EACC,QAAQ,MAAM,OAAO,0BAA0B,GAAG,OAAO,EACzD,MAAM;", - "names": [] -} diff --git a/Target/Function/Eliminate.js b/Target/Function/Eliminate.js index 560b330b..e46f4d17 100644 --- a/Target/Function/Eliminate.js +++ b/Target/Function/Eliminate.js @@ -1,38 +1 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -var Eliminate_default = /* @__PURE__ */ __name(async (...[Eliminate]) => { - let Configuration = Merge( - (await import("../Variable/Eliminate.js")).default, - {} - ); - Configuration = Eliminate ? Merge( - Configuration, - await (await import("../Function/File.js")).default(Eliminate) - ) : Configuration; - const { Path, File, Action } = Configuration; - const Paths = /* @__PURE__ */ new Set(); - if (typeof Path !== "undefined") { - if (Array.isArray(Path) || Path instanceof Set) { - Path.forEach((Path2) => Paths.add(Path2)); - } - if (Path instanceof Map) { - Paths.add(Path); - } - } - for (const Path2 of Paths) { - if (typeof File !== "undefined" && typeof File !== "boolean" && typeof Action !== "boolean") { - await (await (await (await new (await import("@playform/pipe")).default( - Configuration.Cache, - Configuration.Logger - ).In(Path2)).By(File)).Not(Configuration.Exclude)).Pipe(Action); - } - } -}, "default"); -const { default: Merge } = await import("../Function/Merge.js"); -const Pipe = []; -export { - Merge, - Pipe, - Eliminate_default as default -}; -//# sourceMappingURL=Eliminate.js.map +var p=async(...[f])=>{let t=r((await import("../Variable/Eliminate.js")).default,{});t=f?r(t,await(await import("../Function/File.js")).default(f)):t;const{Path:a,File:e,Action:n}=t,o=new Set;typeof a<"u"&&((Array.isArray(a)||a instanceof Set)&&a.forEach(i=>o.add(i)),a instanceof Map&&o.add(a));for(const i of o)typeof e<"u"&&typeof e!="boolean"&&typeof n!="boolean"&&await(await(await(await new(await import("@playform/pipe")).default(t.Cache,t.Logger).In(i)).By(e)).Not(t.Exclude)).Pipe(n)};const{default:r}=await import("../Function/Merge.js"),s=[];export{r as Merge,s as Pipe,p as default}; diff --git a/Target/Function/Eliminate.js.map b/Target/Function/Eliminate.js.map deleted file mode 100644 index bf0d9bfc..00000000 --- a/Target/Function/Eliminate.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../Source/Function/Eliminate.ts"], - "sourcesContent": ["import type Path from \"@playform/pipe/Target/Type/Path.js\";\n\nimport type Interface from \"../Interface/Eliminate.js\";\nimport type Option from \"../Interface/Option.js\";\n\n/**\n * @module Eliminate\n *\n */\nexport default (async (...[Eliminate]) => {\n\tlet Configuration: Option = Merge(\n\t\t(await import(\"../Variable/Eliminate.js\")).default,\n\t\t{},\n\t);\n\n\tConfiguration = Eliminate\n\t\t? Merge(\n\t\t\t\tConfiguration,\n\t\t\t\tawait (await import(\"../Function/File.js\")).default(Eliminate),\n\t\t\t)\n\t\t: Configuration;\n\n\tconst { Path, File, Action } = Configuration;\n\n\tconst Paths = new Set();\n\n\tif (typeof Path !== \"undefined\") {\n\t\tif (Array.isArray(Path) || Path instanceof Set) {\n\t\t\tPath.forEach((Path) => Paths.add(Path));\n\t\t}\n\n\t\tif (Path instanceof Map) {\n\t\t\tPaths.add(Path);\n\t\t}\n\t}\n\n\tfor (const Path of Paths) {\n\t\tif (\n\t\t\ttypeof File !== \"undefined\" &&\n\t\t\ttypeof File !== \"boolean\" &&\n\t\t\ttypeof Action !== \"boolean\"\n\t\t) {\n\t\t\tawait (\n\t\t\t\tawait (\n\t\t\t\t\tawait (\n\t\t\t\t\t\tawait new (await import(\"@playform/pipe\")).default(\n\t\t\t\t\t\t\tConfiguration.Cache,\n\t\t\t\t\t\t\tConfiguration.Logger,\n\t\t\t\t\t\t).In(Path)\n\t\t\t\t\t).By(File)\n\t\t\t\t).Not(Configuration.Exclude)\n\t\t\t).Pipe(Action);\n\t\t}\n\t}\n}) satisfies Interface as Interface;\n\nexport const { default: Merge } = await import(\"../Function/Merge.js\");\n\nexport const Pipe: string[] = [];\n"], - "mappings": ";;AASA,IAAO,oBAAS,iCAAU,CAAC,SAAS,MAAM;AACzC,MAAI,gBAAwB;AAAA,KAC1B,MAAM,OAAO,0BAA0B,GAAG;AAAA,IAC3C,CAAC;AAAA,EACF;AAEA,kBAAgB,YACb;AAAA,IACA;AAAA,IACA,OAAO,MAAM,OAAO,qBAAqB,GAAG,QAAQ,SAAS;AAAA,EAC9D,IACC;AAEH,QAAM,EAAE,MAAM,MAAM,OAAO,IAAI;AAE/B,QAAM,QAAQ,oBAAI,IAAU;AAE5B,MAAI,OAAO,SAAS,aAAa;AAChC,QAAI,MAAM,QAAQ,IAAI,KAAK,gBAAgB,KAAK;AAC/C,WAAK,QAAQ,CAACA,UAAS,MAAM,IAAIA,KAAI,CAAC;AAAA,IACvC;AAEA,QAAI,gBAAgB,KAAK;AACxB,YAAM,IAAI,IAAI;AAAA,IACf;AAAA,EACD;AAEA,aAAWA,SAAQ,OAAO;AACzB,QACC,OAAO,SAAS,eAChB,OAAO,SAAS,aAChB,OAAO,WAAW,WACjB;AACD,aACC,OACC,OACC,MAAM,KAAK,MAAM,OAAO,gBAAgB,GAAG;AAAA,QAC1C,cAAc;AAAA,QACd,cAAc;AAAA,MACf,EAAE,GAAGA,KAAI,GACR,GAAG,IAAI,GACR,IAAI,cAAc,OAAO,GAC1B,KAAK,MAAM;AAAA,IACd;AAAA,EACD;AACD,GA7CgB;AA+CT,MAAM,EAAE,SAAS,MAAM,IAAI,MAAM,OAAO,sBAAsB;AAE9D,MAAM,OAAiB,CAAC;", - "names": ["Path"] -} diff --git a/Target/Function/File.js b/Target/Function/File.js index 0c5218e3..4f9dd1ef 100644 --- a/Target/Function/File.js +++ b/Target/Function/File.js @@ -1,34 +1 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -var File_default = /* @__PURE__ */ __name(async (...[Path]) => { - if (Path.split(".").pop() === "ts") { - const projectRoot = (await import("path")).resolve( - (await import("path")).dirname( - (await import("url")).fileURLToPath(import.meta.url) - ), - "../.." - ); - await (await import("fs/promises")).writeFile( - Path.replace(".ts", ".js"), - (await import("typescript")).transpile( - (await (await import("fs/promises")).readFile(Path, "utf-8")).toString(), - (await import("typescript")).parseJsonConfigFileContent( - (await import("typescript")).readConfigFile( - (await import("path")).join( - projectRoot, - "tsconfig.json" - ), - (await import("typescript")).sys.readFile - ).config, - (await import("typescript")).sys, - projectRoot - ).options - ) - ); - } - return (await import((await import("url")).pathToFileURL(Path).toString().replace(".ts", ".js"))).default; -}, "default"); -export { - File_default as default -}; -//# sourceMappingURL=File.js.map +var a=async(...[t])=>{if(t.split(".").pop()==="ts"){const i=(await import("path")).resolve((await import("path")).dirname((await import("url")).fileURLToPath(import.meta.url)),"../..");await(await import("fs/promises")).writeFile(t.replace(".ts",".js"),(await import("typescript")).transpile((await(await import("fs/promises")).readFile(t,"utf-8")).toString(),(await import("typescript")).parseJsonConfigFileContent((await import("typescript")).readConfigFile((await import("path")).join(i,"tsconfig.json"),(await import("typescript")).sys.readFile).config,(await import("typescript")).sys,i).options))}return(await import((await import("url")).pathToFileURL(t).toString().replace(".ts",".js"))).default};export{a as default}; diff --git a/Target/Function/File.js.map b/Target/Function/File.js.map deleted file mode 100644 index 19695e75..00000000 --- a/Target/Function/File.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../Source/Function/File.ts"], - "sourcesContent": ["import type Interface from \"../Interface/File.js\";\n\n/**\n * @module File\n *\n */\nexport default (async (...[Path]) => {\n\tif (Path.split(\".\").pop() === \"ts\") {\n\t\tconst projectRoot = (await import(\"path\")).resolve(\n\t\t\t(await import(\"path\")).dirname(\n\t\t\t\t(await import(\"url\")).fileURLToPath(import.meta.url),\n\t\t\t),\n\t\t\t\"../..\",\n\t\t);\n\n\t\tawait (\n\t\t\tawait import(\"fs/promises\")\n\t\t).writeFile(\n\t\t\tPath.replace(\".ts\", \".js\"),\n\t\t\t(await import(\"typescript\")).transpile(\n\t\t\t\t(\n\t\t\t\t\tawait (await import(\"fs/promises\")).readFile(Path, \"utf-8\")\n\t\t\t\t).toString(),\n\t\t\t\t(await import(\"typescript\")).parseJsonConfigFileContent(\n\t\t\t\t\t(await import(\"typescript\")).readConfigFile(\n\t\t\t\t\t\t(await import(\"path\")).join(\n\t\t\t\t\t\t\tprojectRoot,\n\t\t\t\t\t\t\t\"tsconfig.json\",\n\t\t\t\t\t\t),\n\t\t\t\t\t\t(await import(\"typescript\")).sys.readFile,\n\t\t\t\t\t).config,\n\t\t\t\t\t(await import(\"typescript\")).sys,\n\t\t\t\t\tprojectRoot,\n\t\t\t\t).options,\n\t\t\t),\n\t\t);\n\t}\n\n\treturn (\n\t\tawait import(\n\t\t\t(await import(\"url\"))\n\t\t\t\t.pathToFileURL(Path)\n\t\t\t\t.toString()\n\t\t\t\t.replace(\".ts\", \".js\")\n\t\t)\n\t).default;\n}) satisfies Interface as Interface;\n"], - "mappings": ";;AAMA,IAAO,eAAS,iCAAU,CAAC,IAAI,MAAM;AACpC,MAAI,KAAK,MAAM,GAAG,EAAE,IAAI,MAAM,MAAM;AACnC,UAAM,eAAe,MAAM,OAAO,MAAM,GAAG;AAAA,OACzC,MAAM,OAAO,MAAM,GAAG;AAAA,SACrB,MAAM,OAAO,KAAK,GAAG,cAAc,YAAY,GAAG;AAAA,MACpD;AAAA,MACA;AAAA,IACD;AAEA,WACC,MAAM,OAAO,aAAa,GACzB;AAAA,MACD,KAAK,QAAQ,OAAO,KAAK;AAAA,OACxB,MAAM,OAAO,YAAY,GAAG;AAAA,SAE3B,OAAO,MAAM,OAAO,aAAa,GAAG,SAAS,MAAM,OAAO,GACzD,SAAS;AAAA,SACV,MAAM,OAAO,YAAY,GAAG;AAAA,WAC3B,MAAM,OAAO,YAAY,GAAG;AAAA,aAC3B,MAAM,OAAO,MAAM,GAAG;AAAA,cACtB;AAAA,cACA;AAAA,YACD;AAAA,aACC,MAAM,OAAO,YAAY,GAAG,IAAI;AAAA,UAClC,EAAE;AAAA,WACD,MAAM,OAAO,YAAY,GAAG;AAAA,UAC7B;AAAA,QACD,EAAE;AAAA,MACH;AAAA,IACD;AAAA,EACD;AAEA,UACC,MAAM,QACJ,MAAM,OAAO,KAAK,GACjB,cAAc,IAAI,EAClB,SAAS,EACT,QAAQ,OAAO,KAAK,IAEtB;AACH,GAxCgB;", - "names": [] -} diff --git a/Target/Function/Merge.js b/Target/Function/Merge.js index 92aea8c6..e898449a 100644 --- a/Target/Function/Merge.js +++ b/Target/Function/Merge.js @@ -1,7 +1 @@ -var Merge_default = (await import("deepmerge-ts")).deepmergeCustom({ - mergeArrays: false -}); -export { - Merge_default as default -}; -//# sourceMappingURL=Merge.js.map +var e=(await import("deepmerge-ts")).deepmergeCustom({mergeArrays:!1});export{e as default}; diff --git a/Target/Function/Merge.js.map b/Target/Function/Merge.js.map deleted file mode 100644 index 0f843155..00000000 --- a/Target/Function/Merge.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../Source/Function/Merge.ts"], - "sourcesContent": ["/**\n * @module Merge\n *\n */\nexport default (await import(\"deepmerge-ts\")).deepmergeCustom({\n\tmergeArrays: false,\n});\n"], - "mappings": "AAIA,IAAO,iBAAS,MAAM,OAAO,cAAc,GAAG,gBAAgB;AAAA,EAC7D,aAAa;AACd,CAAC;", - "names": [] -} diff --git a/Target/Function/Output.js b/Target/Function/Output.js index 29013819..d70663d7 100644 --- a/Target/Function/Output.js +++ b/Target/Function/Output.js @@ -1,24 +1 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -var Output_default = /* @__PURE__ */ __name(async (...[Source]) => ts.createPrinter({ - newLine: ts.NewLineKind.LineFeed, - removeComments: false, - omitTrailingSemicolon: false, - noEmitHelpers: false -}).printFile( - ts.transform( - ts.createSourceFile( - "temp.ts", - Source, - ts.ScriptTarget.Latest, - true - ), - [(await import("./Output/Transformer.js")).default] - ).transformed[0] -), "default"); -const ts = await import("typescript"); -export { - Output_default as default, - ts -}; -//# sourceMappingURL=Output.js.map +var r=async(...[t])=>e.createPrinter({newLine:e.NewLineKind.LineFeed,removeComments:!1,omitTrailingSemicolon:!1,noEmitHelpers:!1}).printFile(e.transform(e.createSourceFile("temp.ts",t,e.ScriptTarget.Latest,!0),[(await import("./Output/Transformer.js")).default]).transformed[0]);const e=await import("typescript");export{r as default,e as ts}; diff --git a/Target/Function/Output.js.map b/Target/Function/Output.js.map deleted file mode 100644 index 25033757..00000000 --- a/Target/Function/Output.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../Source/Function/Output.ts"], - "sourcesContent": ["import type Interface from \"@Interface/Output.js\";\nimport type { SourceFile } from \"typescript\";\n\n/**\n * @module Output\n *\n */\nexport default (async (...[Source]) =>\n\tts\n\t\t.createPrinter({\n\t\t\tnewLine: ts.NewLineKind.LineFeed,\n\t\t\tremoveComments: false,\n\t\t\tomitTrailingSemicolon: false,\n\t\t\tnoEmitHelpers: false,\n\t\t})\n\t\t.printFile(\n\t\t\tts.transform(\n\t\t\t\tts.createSourceFile(\n\t\t\t\t\t\"temp.ts\",\n\t\t\t\t\tSource,\n\t\t\t\t\tts.ScriptTarget.Latest,\n\t\t\t\t\ttrue,\n\t\t\t\t),\n\t\t\t\t[(await import(\"@Function/Output/Transformer.js\")).default],\n\t\t\t).transformed[0] as SourceFile,\n\t\t)) satisfies Interface as Interface;\n\nexport const ts = await import(\"typescript\");\n"], - "mappings": ";;AAOA,IAAO,iBAAS,iCAAU,CAAC,MAAM,MAChC,GACE,cAAc;AAAA,EACd,SAAS,GAAG,YAAY;AAAA,EACxB,gBAAgB;AAAA,EAChB,uBAAuB;AAAA,EACvB,eAAe;AAChB,CAAC,EACA;AAAA,EACA,GAAG;AAAA,IACF,GAAG;AAAA,MACF;AAAA,MACA;AAAA,MACA,GAAG,aAAa;AAAA,MAChB;AAAA,IACD;AAAA,IACA,EAAE,MAAM,OAAO,iCAAiC,GAAG,OAAO;AAAA,EAC3D,EAAE,YAAY,CAAC;AAChB,GAlBc;AAoBT,MAAM,KAAK,MAAM,OAAO,YAAY;", - "names": [] -} diff --git a/Target/Function/Output/Transformer.js b/Target/Function/Output/Transformer.js index 1f1559c8..2ac053f2 100644 --- a/Target/Function/Output/Transformer.js +++ b/Target/Function/Output/Transformer.js @@ -1,11 +1 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -var Transformer_default = /* @__PURE__ */ __name((...[Context]) => (Node) => ts.visitNode(Node, Visit(Context)), "default"); -const { default: ts } = await import("typescript"); -const { default: Visit } = await import("../Output/Transformer/Visit.js"); -export { - Visit, - Transformer_default as default, - ts -}; -//# sourceMappingURL=Transformer.js.map +var i=(...[t])=>e=>a.visitNode(e,r(t));const{default:a}=await import("typescript"),{default:r}=await import("../Output/Transformer/Visit.js");export{r as Visit,i as default,a as ts}; diff --git a/Target/Function/Output/Transformer.js.map b/Target/Function/Output/Transformer.js.map deleted file mode 100644 index c64d14c0..00000000 --- a/Target/Function/Output/Transformer.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../../Source/Function/Output/Transformer.ts"], - "sourcesContent": ["import type Interface from \"@Interface/Output/Transformer.js\";\n\n/**\n * @module Output\n *\n */\nexport default ((...[Context]) =>\n\t(Node) =>\n\t\tts.visitNode(Node, Visit(Context))) satisfies Interface as Interface;\n\nexport const { default: ts } = await import(\"typescript\");\n\nexport const { default: Visit } = await import(\n\t\"@Function/Output/Transformer/Visit.js\"\n);\n"], - "mappings": ";;AAMA,IAAO,sBAAS,2BAAI,CAAC,OAAO,MAC3B,CAAC,SACA,GAAG,UAAU,MAAM,MAAM,OAAO,CAAC,GAFnB;AAIT,MAAM,EAAE,SAAS,GAAG,IAAI,MAAM,OAAO,YAAY;AAEjD,MAAM,EAAE,SAAS,MAAM,IAAI,MAAM,OACvC,uCACD;", - "names": [] -} diff --git a/Target/Function/Output/Transformer/Visit.js b/Target/Function/Output/Transformer/Visit.js index 9b24334b..fd5aef57 100644 --- a/Target/Function/Output/Transformer/Visit.js +++ b/Target/Function/Output/Transformer/Visit.js @@ -1,277 +1 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -class Track { - static { - __name(this, "Track"); - } - Count = /* @__PURE__ */ new Map(); - Variable(Name, Node) { - const Result = Get(Name, "Name", this.Count); - if (Result) { - this.Count.get(Result)?.Usage.add({ - Node, - Position: Node.pos - }); - } - } - Initializer(Variable, Initializer) { - if (!this.Count.has(Initializer)) { - this.Count.set(Initializer, { - Name: Variable, - Usage: /* @__PURE__ */ new Set() - }); - } - } - Scope(Node) { - ts.forEachChild(Node, (Node2) => this.Scope(Node2)); - if (!Node) { - return; - } - if (ts.isIdentifier(Node)) { - if (Node.parent && ts.isBinaryExpression(Node.parent) && Node.parent.operatorToken.kind === ts.SyntaxKind.EqualsToken && Node.parent.left === Node) { - const Result = Get(Node.text, "Name", this.Count); - if (Result) { - this.Count.delete(Result); - } - } - if (!Node.parent || !ts.isVariableDeclaration(Node.parent)) { - this.Variable(Node.text, Node); - } - } else if (ts.isVariableStatement(Node)) { - Node.declarationList.declarations.forEach((decl) => { - if (ts.isIdentifier(decl.name) && decl.initializer) { - if (!(Node.modifiers?.some( - (m) => m.kind === ts.SyntaxKind.ExportKeyword - ) ?? false)) { - this.Initializer(decl.name.text, decl.initializer); - } - } - }); - } - } - Inline(Name, _Node) { - try { - const Result = Get(Name, "Name", this.Count); - if (!Result) { - return false; - } - const Initializer = this.Count.get(Result); - if (!Initializer) { - return false; - } - if (_Node) { - while (_Node && !ts.isFunctionDeclaration(_Node) && !ts.isMethodDeclaration(_Node) && !ts.isSourceFile(_Node)) { - _Node = _Node.parent; - } - const _UsageNode = Array.from(Initializer.Usage).every( - ({ Node }) => { - while (Node && !ts.isFunctionDeclaration(Node) && !ts.isMethodDeclaration(Node) && !ts.isSourceFile(Node)) { - Node = Node.parent; - } - return Node === _Node; - } - ); - if (!_UsageNode) { - return false; - } - } - if (ts.isArrayLiteralExpression(Result) || // ts.isAwaitExpression(Result) || - // ts.isMethodDeclaration(Result) || - // ts.isFunctionDeclaration(Result) || - ts.isBinaryExpression(Result) || // ts.isCallExpression(Result) || - ts.isNewExpression(Result)) { - return false; - } - const Count = Initializer.Usage.size; - return Count === 1 || ts.isIdentifier(Result) || // Include conditional expressions as valid nodes for inlining - ts.isConditionalExpression(Result) || ts.isLiteralExpression(Result) && Count <= 3; - } catch (error) { - console.log(error); - } - return false; - } -} -class Transformer { - static { - __name(this, "Transformer"); - } - Context; - Tracker; - constructor(Context) { - this.Context = Context; - this.Tracker = new Track(); - } - Variable(Node) { - const Processed = Node.declarationList.declarations.map((Node2) => { - if (Node2.initializer && ts.isIdentifier(Node2.initializer)) { - const Resolved = this.Resolve(Node2.initializer.text, Node2); - if (Resolved) { - return ts.factory.updateVariableDeclaration( - Node2, - Node2.name, - Node2.exclamationToken, - Node2.type, - Resolved - ); - } - } - return Node2; - }); - const Remaining = Processed.filter((Variable) => { - if (ts.isIdentifier(Variable.name)) { - return !this.Tracker.Inline(Variable.name.text, Variable); - } - return true; - }); - if (Remaining.length === 0) { - return void 0; - } - return ts.factory.createVariableStatement( - Node.modifiers, - ts.factory.createVariableDeclarationList( - Remaining, - Node.declarationList.flags - ) - ); - } - Identifier(Node) { - const Name = Node.text; - if (!Node.parent) { - return Node; - } - if ( - // Parameter in function/method declaration - ts.isParameter(Node.parent) || // Property access (e.g., obj.prop) - ts.isPropertyAccessExpression(Node.parent) && Node.parent.name === Node || // Variable declaration - ts.isVariableDeclaration(Node.parent) || // Binding patterns - ts.isBindingElement(Node.parent) || // Class member - ts.isMethodDeclaration(Node.parent) || ts.isPropertyDeclaration(Node.parent) || ts.isConstructorDeclaration(Node.parent) || // Import/Export statements - ts.isImportSpecifier(Node.parent) || ts.isExportSpecifier(Node.parent) || // Object literal property names - ts.isPropertyAssignment(Node.parent) && Node.parent.name === Node || // Method parameters - ts.isMethodSignature(Node.parent) || // Type annotations - ts.isTypeReferenceNode(Node.parent) || // Class/Interface declarations - ts.isClassDeclaration(Node.parent) || ts.isInterfaceDeclaration(Node.parent) - ) { - return Node; - } - return this.Resolve(Name, Node) || Node; - } - Resolve(Name, Node) { - if (!this.Tracker.Inline(Name, Node)) { - return void 0; - } - const Result = Get(Name, "Name", this.Tracker.Count); - if (!Result) { - return void 0; - } - if (ts.isShorthandPropertyAssignment(Result.parent)) { - return Result; - } - if (ts.isIdentifier(Result)) { - return this.Resolve(Result.text, Node) || Result; - } - return Result; - } - Look(Node) { - let Result; - switch (true) { - case ts.isVariableStatement(Node): - Result = this.Variable(Node); - break; - case ts.isIdentifier(Node): - Result = this.Identifier(Node); - break; - case ts.isShorthandPropertyAssignment(Node): - const Name = Node.name.text; - const Resolved = this.Resolve(Name, Node); - if (Resolved) { - Result = ts.factory.createPropertyAssignment( - ts.factory.createIdentifier(Name), - ts.isConditionalExpression(Resolved) ? ts.factory.createParenthesizedExpression(Resolved) : Resolved - ); - } else { - Result = Node; - } - break; - // Class-related nodes - case ts.isPropertyDeclaration(Node): - case ts.isMethodDeclaration(Node): - case ts.isConstructorDeclaration(Node): - case ts.isGetAccessor(Node): - case ts.isSetAccessor(Node): - case ts.isClassExpression(Node): - // Function-related nodes - case ts.isFunctionDeclaration(Node): - case ts.isFunctionExpression(Node): - case ts.isArrowFunction(Node): - case ts.isCallExpression(Node): - case ts.isNewExpression(Node): - // Complex expressions - case ts.isAwaitExpression(Node): - case ts.isYieldExpression(Node): - case ts.isSpreadElement(Node): - case ts.isTemplateLiteral(Node): - case ts.isTaggedTemplateExpression(Node): - case ts.isJsxElement(Node): - case ts.isJsxFragment(Node): - // Object and property nodes - case ts.isObjectLiteralExpression(Node): - case ts.isPropertyAccessExpression(Node): - case ts.isElementAccessExpression(Node): - // Control flow nodes - case ts.isIfStatement(Node): - case ts.isSwitchStatement(Node): - case ts.isForStatement(Node): - case ts.isWhileStatement(Node): - case ts.isDoStatement(Node): - case ts.isTryStatement(Node): - Result = Node; - break; - default: - Result = Node; - } - return ts.visitEachChild( - Result, - (Node2) => this.Look(Node2), - this.Context - ); - } - Visit(_Node, Collection = 0) { - const Failed = 10; - if (Collection >= Failed) { - return _Node; - } - this.Tracker = new Track(); - this.Tracker.Scope(_Node); - let Node = _Node; - try { - Node = this.Look(_Node) ?? _Node; - } catch (_Error) { - console.log("-------------------------"); - console.log("Could not transform Node:"); - console.log(_Node.getText()); - console.log("--------------"); - console.log("Errored with:"); - console.log(_Error); - } - if (Node && Node !== _Node) { - return this.Visit(Node, Collection + 1); - } - return _Node; - } -} -const { - default: ts, - isIdentifier, - factory -} = await import("typescript"); -var Visit_default = /* @__PURE__ */ __name((context) => (rootNode) => new Transformer(context).Visit(rootNode), "default"); -const { default: Get } = await import("../../Output/Transformer/Visit/Get.js"); -export { - Get, - Visit_default as default, - factory, - isIdentifier, - ts -}; -//# sourceMappingURL=Visit.js.map +class l{Count=new Map;Variable(t,i){const r=c(t,"Name",this.Count);r&&this.Count.get(r)?.Usage.add({Node:i,Position:i.pos})}Initializer(t,i){this.Count.has(i)||this.Count.set(i,{Name:t,Usage:new Set})}Scope(t){if(e.forEachChild(t,i=>this.Scope(i)),!!t)if(e.isIdentifier(t)){if(t.parent&&e.isBinaryExpression(t.parent)&&t.parent.operatorToken.kind===e.SyntaxKind.EqualsToken&&t.parent.left===t){const i=c(t.text,"Name",this.Count);i&&this.Count.delete(i)}(!t.parent||!e.isVariableDeclaration(t.parent))&&this.Variable(t.text,t)}else e.isVariableStatement(t)&&t.declarationList.declarations.forEach(i=>{e.isIdentifier(i.name)&&i.initializer&&((t.modifiers?.some(r=>r.kind===e.SyntaxKind.ExportKeyword)??!1)||this.Initializer(i.name.text,i.initializer))})}Inline(t,i){try{const r=c(t,"Name",this.Count);if(!r)return!1;const s=this.Count.get(r);if(!s)return!1;if(i){for(;i&&!e.isFunctionDeclaration(i)&&!e.isMethodDeclaration(i)&&!e.isSourceFile(i);)i=i.parent;if(!Array.from(s.Usage).every(({Node:n})=>{for(;n&&!e.isFunctionDeclaration(n)&&!e.isMethodDeclaration(n)&&!e.isSourceFile(n);)n=n.parent;return n===i}))return!1}if(e.isArrayLiteralExpression(r)||e.isBinaryExpression(r)||e.isNewExpression(r))return!1;const a=s.Usage.size;return a===1||e.isIdentifier(r)||e.isConditionalExpression(r)||e.isLiteralExpression(r)&&a<=3}catch{}return!1}}class f{Context;Tracker;constructor(t){this.Context=t,this.Tracker=new l}Variable(t){const r=t.declarationList.declarations.map(s=>{if(s.initializer&&e.isIdentifier(s.initializer)){const a=this.Resolve(s.initializer.text,s);if(a)return e.factory.updateVariableDeclaration(s,s.name,s.exclamationToken,s.type,a)}return s}).filter(s=>e.isIdentifier(s.name)?!this.Tracker.Inline(s.name.text,s):!0);if(r.length!==0)return e.factory.createVariableStatement(t.modifiers,e.factory.createVariableDeclarationList(r,t.declarationList.flags))}Identifier(t){const i=t.text;return!t.parent||e.isParameter(t.parent)||e.isPropertyAccessExpression(t.parent)&&t.parent.name===t||e.isVariableDeclaration(t.parent)||e.isBindingElement(t.parent)||e.isMethodDeclaration(t.parent)||e.isPropertyDeclaration(t.parent)||e.isConstructorDeclaration(t.parent)||e.isImportSpecifier(t.parent)||e.isExportSpecifier(t.parent)||e.isPropertyAssignment(t.parent)&&t.parent.name===t||e.isMethodSignature(t.parent)||e.isTypeReferenceNode(t.parent)||e.isClassDeclaration(t.parent)||e.isInterfaceDeclaration(t.parent)?t:this.Resolve(i,t)||t}Resolve(t,i){if(!this.Tracker.Inline(t,i))return;const r=c(t,"Name",this.Tracker.Count);if(r)return e.isShorthandPropertyAssignment(r.parent)?r:e.isIdentifier(r)&&this.Resolve(r.text,i)||r}Look(t){let i;switch(!0){case e.isVariableStatement(t):i=this.Variable(t);break;case e.isIdentifier(t):i=this.Identifier(t);break;case e.isShorthandPropertyAssignment(t):const r=t.name.text,s=this.Resolve(r,t);s?i=e.factory.createPropertyAssignment(e.factory.createIdentifier(r),e.isConditionalExpression(s)?e.factory.createParenthesizedExpression(s):s):i=t;break;case e.isPropertyDeclaration(t):case e.isMethodDeclaration(t):case e.isConstructorDeclaration(t):case e.isGetAccessor(t):case e.isSetAccessor(t):case e.isClassExpression(t):case e.isFunctionDeclaration(t):case e.isFunctionExpression(t):case e.isArrowFunction(t):case e.isCallExpression(t):case e.isNewExpression(t):case e.isAwaitExpression(t):case e.isYieldExpression(t):case e.isSpreadElement(t):case e.isTemplateLiteral(t):case e.isTaggedTemplateExpression(t):case e.isJsxElement(t):case e.isJsxFragment(t):case e.isObjectLiteralExpression(t):case e.isPropertyAccessExpression(t):case e.isElementAccessExpression(t):case e.isIfStatement(t):case e.isSwitchStatement(t):case e.isForStatement(t):case e.isWhileStatement(t):case e.isDoStatement(t):case e.isTryStatement(t):i=t;break;default:i=t}return e.visitEachChild(i,r=>this.Look(r),this.Context)}Visit(t,i=0){if(i>=10)return t;this.Tracker=new l,this.Tracker.Scope(t);let s=t;try{s=this.Look(t)??t}catch{}return s&&s!==t?this.Visit(s,i+1):t}}const{default:e,isIdentifier:u,factory:m}=await import("typescript");var h=o=>t=>new f(o).Visit(t);const{default:c}=await import("../../Output/Transformer/Visit/Get.js");export{c as Get,h as default,m as factory,u as isIdentifier,e as ts}; diff --git a/Target/Function/Output/Transformer/Visit.js.map b/Target/Function/Output/Transformer/Visit.js.map deleted file mode 100644 index 6ca15e2b..00000000 --- a/Target/Function/Output/Transformer/Visit.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "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\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,EAE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,IAAI,MAAM,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;", - "names": ["Node"] -} diff --git a/Target/Function/Output/Transformer/Visit/Analyze.js b/Target/Function/Output/Transformer/Visit/Analyze.js index f1be6cbe..e69de29b 100644 --- a/Target/Function/Output/Transformer/Visit/Analyze.js +++ b/Target/Function/Output/Transformer/Visit/Analyze.js @@ -1 +0,0 @@ -//# sourceMappingURL=Analyze.js.map diff --git a/Target/Function/Output/Transformer/Visit/Analyze.js.map b/Target/Function/Output/Transformer/Visit/Analyze.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Function/Output/Transformer/Visit/Analyze.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Function/Output/Transformer/Visit/Get.js b/Target/Function/Output/Transformer/Visit/Get.js index c7d6683b..e2ee462a 100644 --- a/Target/Function/Output/Transformer/Visit/Get.js +++ b/Target/Function/Output/Transformer/Visit/Get.js @@ -1,9 +1 @@ -var __defProp = Object.defineProperty; -var __name = (target, value) => __defProp(target, "name", { value, configurable: true }); -var Get_default = /* @__PURE__ */ __name((...[Search, In, Map]) => [...Map.entries()].find( - ([_Key, Value]) => Value[In] === Search -)?.[0], "default"); -export { - Get_default as default -}; -//# sourceMappingURL=Get.js.map +var i=(...[e,t,f])=>[...f.entries()].find(([a,r])=>r[t]===e)?.[0];export{i as default}; diff --git a/Target/Function/Output/Transformer/Visit/Get.js.map b/Target/Function/Output/Transformer/Visit/Get.js.map deleted file mode 100644 index 380ffdbd..00000000 --- a/Target/Function/Output/Transformer/Visit/Get.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../../../../Source/Function/Output/Transformer/Visit/Get.ts"], - "sourcesContent": ["import type Interface from \"@Interface/Output/Visit/Get.js\";\n\n/**\n * @module Output\n *\n */\nexport default ((...[Search, In, Map]) =>\n\t[...Map.entries()].find(\n\t\t([_Key, Value]) => Value[In] === Search,\n\t)?.[0]) satisfies Interface as Interface;\n"], - "mappings": ";;AAMA,IAAO,cAAS,2BAAI,CAAC,QAAQ,IAAI,GAAG,MACnC,CAAC,GAAG,IAAI,QAAQ,CAAC,EAAE;AAAA,EAClB,CAAC,CAAC,MAAM,KAAK,MAAM,MAAM,EAAE,MAAM;AAClC,IAAI,CAAC,GAHU;", - "names": [] -} diff --git a/Target/Interface/Eliminate.js b/Target/Interface/Eliminate.js index 00b559f6..e69de29b 100644 --- a/Target/Interface/Eliminate.js +++ b/Target/Interface/Eliminate.js @@ -1 +0,0 @@ -//# sourceMappingURL=Eliminate.js.map diff --git a/Target/Interface/Eliminate.js.map b/Target/Interface/Eliminate.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Interface/Eliminate.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Interface/File.js b/Target/Interface/File.js index 40d173a7..e69de29b 100644 --- a/Target/Interface/File.js +++ b/Target/Interface/File.js @@ -1 +0,0 @@ -//# sourceMappingURL=File.js.map diff --git a/Target/Interface/File.js.map b/Target/Interface/File.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Interface/File.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Interface/Option.js b/Target/Interface/Option.js index d1e997cb..e69de29b 100644 --- a/Target/Interface/Option.js +++ b/Target/Interface/Option.js @@ -1 +0,0 @@ -//# sourceMappingURL=Option.js.map diff --git a/Target/Interface/Option.js.map b/Target/Interface/Option.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Interface/Option.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Interface/Output.js b/Target/Interface/Output.js index 9242fcfd..e69de29b 100644 --- a/Target/Interface/Output.js +++ b/Target/Interface/Output.js @@ -1 +0,0 @@ -//# sourceMappingURL=Output.js.map diff --git a/Target/Interface/Output.js.map b/Target/Interface/Output.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Interface/Output.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Interface/Output/Transformer.js b/Target/Interface/Output/Transformer.js index f0e8d4fc..e69de29b 100644 --- a/Target/Interface/Output/Transformer.js +++ b/Target/Interface/Output/Transformer.js @@ -1 +0,0 @@ -//# sourceMappingURL=Transformer.js.map diff --git a/Target/Interface/Output/Transformer.js.map b/Target/Interface/Output/Transformer.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Interface/Output/Transformer.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Interface/Output/Transformer/Visit.js b/Target/Interface/Output/Transformer/Visit.js index 441f988d..e69de29b 100644 --- a/Target/Interface/Output/Transformer/Visit.js +++ b/Target/Interface/Output/Transformer/Visit.js @@ -1 +0,0 @@ -//# sourceMappingURL=Visit.js.map diff --git a/Target/Interface/Output/Transformer/Visit.js.map b/Target/Interface/Output/Transformer/Visit.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Interface/Output/Transformer/Visit.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Interface/Output/Visit.js b/Target/Interface/Output/Visit.js index 441f988d..e69de29b 100644 --- a/Target/Interface/Output/Visit.js +++ b/Target/Interface/Output/Visit.js @@ -1 +0,0 @@ -//# sourceMappingURL=Visit.js.map diff --git a/Target/Interface/Output/Visit.js.map b/Target/Interface/Output/Visit.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Interface/Output/Visit.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Interface/Output/Visit/Get.js b/Target/Interface/Output/Visit/Get.js index a397ac46..e69de29b 100644 --- a/Target/Interface/Output/Visit/Get.js +++ b/Target/Interface/Output/Visit/Get.js @@ -1 +0,0 @@ -//# sourceMappingURL=Get.js.map diff --git a/Target/Interface/Output/Visit/Get.js.map b/Target/Interface/Output/Visit/Get.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Interface/Output/Visit/Get.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Type/Output/Visit/Initializer.js b/Target/Type/Output/Visit/Initializer.js index a8970056..e69de29b 100644 --- a/Target/Type/Output/Visit/Initializer.js +++ b/Target/Type/Output/Visit/Initializer.js @@ -1 +0,0 @@ -//# sourceMappingURL=Initializer.js.map diff --git a/Target/Type/Output/Visit/Initializer.js.map b/Target/Type/Output/Visit/Initializer.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Type/Output/Visit/Initializer.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Type/Output/Visit/Initializer/Initializer.js b/Target/Type/Output/Visit/Initializer/Initializer.js index a8970056..e69de29b 100644 --- a/Target/Type/Output/Visit/Initializer/Initializer.js +++ b/Target/Type/Output/Visit/Initializer/Initializer.js @@ -1 +0,0 @@ -//# sourceMappingURL=Initializer.js.map diff --git a/Target/Type/Output/Visit/Initializer/Initializer.js.map b/Target/Type/Output/Visit/Initializer/Initializer.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Type/Output/Visit/Initializer/Initializer.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Type/Output/Visit/Usage.js b/Target/Type/Output/Visit/Usage.js index 123fb715..e69de29b 100644 --- a/Target/Type/Output/Visit/Usage.js +++ b/Target/Type/Output/Visit/Usage.js @@ -1 +0,0 @@ -//# sourceMappingURL=Usage.js.map diff --git a/Target/Type/Output/Visit/Usage.js.map b/Target/Type/Output/Visit/Usage.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Type/Output/Visit/Usage.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Type/Output/Visit/Usage/Text.js b/Target/Type/Output/Visit/Usage/Text.js index e2293069..e69de29b 100644 --- a/Target/Type/Output/Visit/Usage/Text.js +++ b/Target/Type/Output/Visit/Usage/Text.js @@ -1 +0,0 @@ -//# sourceMappingURL=Text.js.map diff --git a/Target/Type/Output/Visit/Usage/Text.js.map b/Target/Type/Output/Visit/Usage/Text.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Type/Output/Visit/Usage/Text.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Type/Output/Visit/Usage/Usage.js b/Target/Type/Output/Visit/Usage/Usage.js index 123fb715..e69de29b 100644 --- a/Target/Type/Output/Visit/Usage/Usage.js +++ b/Target/Type/Output/Visit/Usage/Usage.js @@ -1 +0,0 @@ -//# sourceMappingURL=Usage.js.map diff --git a/Target/Type/Output/Visit/Usage/Usage.js.map b/Target/Type/Output/Visit/Usage/Usage.js.map deleted file mode 100644 index 98652118..00000000 --- a/Target/Type/Output/Visit/Usage/Usage.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": [], - "sourcesContent": [], - "mappings": "", - "names": [] -} diff --git a/Target/Variable/Eliminate.js b/Target/Variable/Eliminate.js index 4b89c2bf..00151847 100644 --- a/Target/Variable/Eliminate.js +++ b/Target/Variable/Eliminate.js @@ -1,8 +1 @@ -var Eliminate_default = (await import("../Function/Merge.js")).default( - (await import("@playform/pipe/Target/Variable/Option.js")).default, - {} -); -export { - Eliminate_default as default -}; -//# sourceMappingURL=Eliminate.js.map +var t=(await import("../Function/Merge.js")).default((await import("@playform/pipe/Target/Variable/Option.js")).default,{});export{t as default}; diff --git a/Target/Variable/Eliminate.js.map b/Target/Variable/Eliminate.js.map deleted file mode 100644 index 9a67fbb8..00000000 --- a/Target/Variable/Eliminate.js.map +++ /dev/null @@ -1,7 +0,0 @@ -{ - "version": 3, - "sources": ["../../Source/Variable/Eliminate.ts"], - "sourcesContent": ["import type Interface from \"../Interface/Option.js\";\n\n/**\n * @module Option\n *\n */\nexport default (await import(\"../Function/Merge.js\")).default(\n\t(await import(\"@playform/pipe/Target/Variable/Option.js\")).default,\n\t{} satisfies Interface,\n);\n"], - "mappings": "AAMA,IAAO,qBAAS,MAAM,OAAO,sBAAsB,GAAG;AAAA,GACpD,MAAM,OAAO,0CAA0C,GAAG;AAAA,EAC3D,CAAC;AACF;", - "names": [] -}