Open
Description
I have created this feature request with permission got in Is there the programmatic API available for "vue-tsc"? discussion.
In this feature request ticket, I am asking for the Node.js API with JSON output similar to native TypeScript compiler:
import TypeScript from "typescript";
import Path from "path"
const typeScriptCompiler: TypeScript.Program = TypeScript.createProgram({
options: {},
rootNames: [
Path.join([
CONSUMING_PROJECT_ROOT_DIRECTORY_ABSOLUTE_PATH,
"01-Source/Server/ServerEntryPoint.ts"
]),
Path.join([
CONSUMING_PROJECT_ROOT_DIRECTORY_ABSOLUTE_PATH,
"01-Source/Client/ClientEntryPoint.ts"
])
]
});
const result: ReadonlyArray<TypeScript.Diagnostic> = typeScriptCompiler.getSemanticDiagnostics()
console.log(result[0].messageText);
What problem does this feature solve?
Well, I don't know how much the Vue community needs it, but in my case, I am going to integrate it to my projects building tool. Herewith, I don't need the formatted output, I need the JSON output for the several reasons like:
- Providing of the caching
- Unification of the formatted output with another ones of my project building tool.
What does the proposed solution look like?
Well, it could be similar to TypeScript API:
import TypeScript from "typescript";
import Path from "path"
const typeScriptCompiler: TypeScript.Program = TypeScript.createProgram({
options: {},
rootNames: [
Path.join([
CONSUMING_PROJECT_ROOT_DIRECTORY_ABSOLUTE_PATH,
"01-Source/Server/ServerEntryPoint.ts"
]),
Path.join([
CONSUMING_PROJECT_ROOT_DIRECTORY_ABSOLUTE_PATH,
"01-Source/Client/ClientEntryPoint.ts"
])
]
});
const result: ReadonlyArray<TypeScript.Diagnostic> = typeScriptCompiler.getSemanticDiagnostics()
console.log(result[0].messageText);
Metadata
Metadata
Assignees
Labels
No labels