From 1b4639b6ad605a1be3796f61f42e28cff2e8a578 Mon Sep 17 00:00:00 2001 From: aak1247 Date: Thu, 27 Oct 2022 20:26:44 +0800 Subject: [PATCH 1/3] feat: parse sync --- src/TypescriptParser.ts | 29 +++++++++++++++++++++++++++++ 1 file changed, 29 insertions(+) diff --git a/src/TypescriptParser.ts b/src/TypescriptParser.ts index 1380470..93cf153 100644 --- a/src/TypescriptParser.ts +++ b/src/TypescriptParser.ts @@ -80,6 +80,20 @@ export class TypescriptParser { return parse[0]; } + /** + * Parses a single file into a parsed file synchronously. + * + * @param {string} filePath + * @param {string} rootPath + * @returns {File} + * + * @memberof TsResourceParser + */ + public parseFileSync(filePath: string, rootPath: string): File { + const parse = this.parseFilesSync([filePath], rootPath); + return parse[0]; + } + /** * Parses multiple files into parsed files. * @@ -92,6 +106,21 @@ export class TypescriptParser { public async parseFiles( filePathes: string[], rootPath: string): Promise { + return this.parseFilesSync(filePathes, rootPath); + } + + /** + * Parses multiple files into parsed files Synchronously. + * + * @param {string[]} filePathes + * @param {string} rootPath + * @returns {File[]} + * + * @memberof TsResourceParser + */ + public parseFilesSync( + filePathes: string[], + rootPath: string): File[] { return filePathes .map((o) => { let scriptKind: ScriptKind = ScriptKind.Unknown; From 2beace578fb3a3ce35b4b3a752ff3725145c06cd Mon Sep 17 00:00:00 2001 From: aak1247 Date: Mon, 15 Apr 2024 18:04:17 +0800 Subject: [PATCH 2/3] feat: version only --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 624c0ad..49670e3 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typescript-parser", - "version": "0.0.0-development", + "version": "2.6.1", "description": "Parser for typescript (and javascript) files, that compiles those files and generates a human understandable AST.", "main": "index.js", "typings": "index.d.ts", From cd5630546d563078f16bd8b0d2d4309cec40d292 Mon Sep 17 00:00:00 2001 From: aak1247 Date: Mon, 15 Apr 2024 18:04:28 +0800 Subject: [PATCH 3/3] feat: version only --- package.json | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/package.json b/package.json index 49670e3..fc7c91d 100644 --- a/package.json +++ b/package.json @@ -1,6 +1,6 @@ { "name": "typescript-parser", - "version": "2.6.1", + "version": "2.6.2", "description": "Parser for typescript (and javascript) files, that compiles those files and generates a human understandable AST.", "main": "index.js", "typings": "index.d.ts",