import { Project } from "https://dotland.deno.dev/x/ts_morph@20.0.0/mod.ts";
Project that holds source files.
Methods
Adds an existing directory from the path or throws if it doesn't exist.
Will return the directory if it was already added.
Adds an existing directory from the path or returns undefined if it doesn't exist.
Will return the directory if it was already added.
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.
Adds a source file from a file path if it exists or returns undefined.
Will return the source file if it was already added.
Adds source files based on file globs.
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
skipAddingFilesFromTsConfig
option to true
.
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.
Asynchronously emits all the source files to the file system as JavaScript files.
Synchronously emits all the source files to the file system as JavaScript files.
Forgets the nodes created in the scope of the passed in block.
This is an advanced method that can be used to easily "forget" all the nodes created within the scope of the block.
Forgets the nodes created in the scope of the passed in block asynchronously.
This is an advanced method that can be used to easily "forget" all the nodes created within the scope of the block.
Formats an array of diagnostics with their color and context into a string.
Gets the specified ambient module symbol or returns undefined if not found.
Gets the specified ambient module symbol or throws if not found.
Gets the diagnostics found when parsing the tsconfig.json file provided in the project's constructor.
Gets a directory by the specified path or returns undefined if it doesn't exist.
Gets a directory by the specified path or throws if it doesn't exist.
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.
Gets all the source files added to the project that match a pattern.
Gets all the source files added to the project that match the passed in patterns.
Saves all the unsaved source files to the file system and deletes all deleted files.
Synchronously saves all the unsaved source files to the file system and deletes all deleted files.
Remarks: This might be very slow compared to the asynchronous version if there are a lot of files.