import { Project } from "https://dotland.deno.dev/x/ts_morph@17.0.0/bootstrap/mod.ts";
Project that holds source files.
Methods
Asynchronously adds an existing source file from a file path or throws if it doesn't exist.
Will return the source file if it was already added.
Asynchronously adds a source file from a file path if it exists or returns undefined.
Will return the source file if it was already added.
Synchronously adds a source file from a file path if it exists or returns undefined.
Will return the source file if it was already added.
Synchronously adds an existing source file from a file path or throws if it doesn't exist.
Will return the source file if it was already added.
Asynchronously adds source files based on file globs.
Synchronously adds source files based on file globs.
Asynchronously adds all the source files from the specified tsconfig.json.
Note that this is done by default when specifying a tsconfig file in the constructor and not explicitly setting the
skipAddingSourceFilesFromTsConfig
option to true
.
Synchronously adds all the source files from the specified tsconfig.json.
Note that this is done by default when specifying a tsconfig file in the constructor and not explicitly setting the
skipAddingSourceFilesFromTsConfig
option to true
.
Creates a new program. Note: You should get a new program any time source files are added, removed, or changed.
Creates a source file at the specified file path with the specified text.
Note: The file will not be created and saved to the file system until .save() is called on the source file.
Formats an array of diagnostics with their color and context into a string.
Gets a source file by a file name or file path. Returns undefined if none exists.
Gets a source file by a search function. Returns undefined if none exists.
Gets a source file by a file name or file path. Throws an error if it doesn't exist.
Gets a source file by a search function. Throws an error if it doesn't exist.
Removes the provided source file based on its fileName
.
Adds the source files the project's source files depend on to the project.
Updates the source file stored in the project at the specified path.
Updates the source file stored in the project. The fileName
of the source file object is used to tell which file to update.