import { SourceFile } from "https://dotland.deno.dev/x/ts_morph@17.0.0/mod.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 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 emit output of this source file.
Gets the character count from the start of the line to the provided position.
Gets the line and column number at the provided position (1-indexed).
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.
Indents the lines within the specified range.
Gets if the source file was discovered while loading an external library.
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.
Deindents the lines within the specified range.