Skip to content

Commit

Permalink
No commit message
Browse files Browse the repository at this point in the history
  • Loading branch information
NikolaRHristov committed Nov 4, 2024
1 parent 2efa81f commit b4a3b1f
Show file tree
Hide file tree
Showing 19 changed files with 188 additions and 430 deletions.
8 changes: 0 additions & 8 deletions Example/Output/Decorator.ts

This file was deleted.

5 changes: 0 additions & 5 deletions Example/Output/Namespace.ts

This file was deleted.

38 changes: 11 additions & 27 deletions Source/Function/Output.ts
Original file line number Diff line number Diff line change
@@ -1,44 +1,28 @@
import type Interface from "@Interface/Output.js";
import type Initializer from "@Type/Output/Visit/Initializer.js";
import type Usage from "@Type/Output/Visit/Usage.js";
import type { SourceFile } from "typescript";

/**
* @module Output
*
*/
export default (async (...[Source]) => {
const Node = ts.createSourceFile(
"temp.ts",
Source,
ts.ScriptTarget.Latest,
true,
);

const Usage: Usage = new Map([]);

const Initializer: Initializer = new Map([]);

(await import("@Function/Output/Visit.js")).default(
Usage,
Initializer,
)(Node);

return ts
export default (async (...[Source]) =>
ts
.createPrinter({
newLine: ts.NewLineKind.LineFeed,
removeComments: false,
omitTrailingSemicolon: false,
noEmitHelpers: false,
})
.printFile(
ts.transform(Node, [
(await import("@Function/Output/Transformer.js")).default(
Usage,
Initializer,
ts.transform(
ts.createSourceFile(
"temp.ts",
Source,
ts.ScriptTarget.Latest,
true,
),
]).transformed[0] as SourceFile,
);
}) satisfies Interface as Interface;
[(await import("@Function/Output/Transformer.js")).default],
).transformed[0] as SourceFile,
)) satisfies Interface as Interface;

export const ts = await import("typescript");
8 changes: 2 additions & 6 deletions Source/Function/Output/Transformer.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,13 +4,9 @@ import type Interface from "@Interface/Output/Transformer.js";
* @module Output
*
*/
export default ((Usage, Initializer) =>
(...[Context]) =>
export default ((...[Context]) =>
(Node) =>
ts.visitNode(
Node,
Visit(Usage, Initializer)(Context),
)) satisfies Interface as Interface;
ts.visitNode(Node, Visit(Context))) satisfies Interface as Interface;

export const { default: ts } = await import("typescript");

Expand Down
Loading

0 comments on commit b4a3b1f

Please sign in to comment.