import { SourceFile } from "https://deno.land/x/ts_morph@16.0.0/ts_morph.d.ts";
Methods
Applies the text changes to the source file.
WARNING! This will forget all the nodes in the file! It's best to do this after you're all done with the file.
Copy this source file to a new file.
This will modify the module specifiers in the new file, if necessary.
Copy this source file to a new file and immediately saves it to the file system asynchronously.
This will modify the module specifiers in the new file, if necessary.
Copy this source file to a new file and immediately saves it to the file system synchronously.
This will modify the module specifiers in the new file, if necessary.
Copies this source file to the specified directory.
This will modify the module specifiers in the new file, if necessary.
Queues a deletion of the file to the file system.
The file will be deleted when you call ast.save(). If you wish to immediately delete the file, then use deleteImmediately().
Asynchronously deletes the file from the file system.
Synchronously deletes the file from the file system.
Asynchronously emits the source file as a JavaScript file.
Synchronously emits the source file as a JavaScript file.
Code fix to add import declarations for identifiers that are referenced, but not imported in the source file.
Removes all unused declarations like interfaces, classes, enums, functions, variables, parameters, methods, properties, imports, etc. from this file.
Tip: For optimal results, sometimes this method needs to be called more than once. There could be nodes that are only referenced in unused declarations and in this case, another call will also remove them.
WARNING! This will forget all the nodes in the file! It's best to do this after you're all done with the file.
Formats the source file text using the internal TypeScript formatting API.
Gets the file path's base name.
Gets the file path's base name without the extension.
Gets the directory that the source file is contained in.
Gets the directory path that the source file is contained in.
Gets the emit output of this source file.
Gets the file path's extension.
Gets the file path.
Gets the full text with leading trivia.
Gets all the descendant string literals that reference a module.
Gets the language variant of the source file.
Gets the script target of the source file.
Gets the character count from the start of the line to the provided position.
Gets any /// <reference lib="..." />
comments.
Gets the line and column number at the provided position (1-indexed).
Gets the string literals in this source file that references other source files.
Gets the nodes that reference other source files in string literals.
Gets any /// <reference path="..." />
comments.
Gets the pre-emit diagnostics of the specified source file.
Gets the source files this source file references in string literals.
Gets the string literals in other source files that reference this source file.
Gets the import and exports in other source files that reference this source file.
Gets any source files that reference this source file.
Gets the relative path to the specified file path as a module specifier.
Gets the relative path to the specified source file as a module specifier.
Gets the relative path to the specified directory as a module specifier.
Gets the relative path to the specified path.
Gets the relative path to another source file.
Gets the relative path to another directory.
Gets the script kind of the source file.
Gets the structure equivalent to this node.
Gets any /// <reference types="..." />
comments.
Indents the line at the specified position.
Indents the lines within the specified range.
Gets if this is a declaration file.
Gets if the source file was discovered while loading an external library.
Gets if the source file is a descendant of a node_modules directory.
Gets if this source file has been saved or if the latest changes have been saved.
Moves this source file to a new file.
This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
Moves this source file to a new file and asynchronously updates the file system immediately.
This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
Moves this source file to a new file and synchronously updates the file system immediately.
This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
Moves this source file to the specified directory.
This will modify the module specifiers in other files that specify this file and the module specifiers in the current file, if necessary.
Subscribe to when the source file is modified.
Organizes the imports in the file.
WARNING! This will forget all the nodes in the file! It's best to do this after you're all done with the file.
Refresh the source file from the file system.
WARNING: When updating from the file system, this will "forget" any previously navigated nodes.
Synchronously refreshes the source file from the file system.
WARNING: When updating from the file system, this will "forget" any previously navigated nodes.
Asynchronously saves this file with any changes.
Synchronously saves this file with any changes.
Sets the node from a structure.
Deindents the line at the specified position.
Deindents the lines within the specified range.