0.0.1 (2019-03-07)
Bug Fixes
- #104 - Fix documentation with compile errors. (9d16ab4)
- #125 - Inserting a namespace or class into an ambient module/namespace should not write as non-ambient. (a3c6291)
- #137 - Improve error message when manipulation throws error. (34620f0)
- #149 - "SourceFile.formatText() should respect indentation settings" (b0b9e53)
- #150 - Fix SourceFile.addImport not using the specified string char. (e704330)
- #192 - Fix forget block crashes when removing node. (3f195ea)
- #195 - Fixes emitting directory crashes when directory does not exist. (57c3381)
- #196 - Fixes directory.copy() crashing when directory already exists. (def2992)
- #203 - Source file will now be marked as "saved" when updating from file system. (fa0dd2c)
- #203 - Source file will now be marked as "saved" when updating from file system. (65f22ac)
- #218 - Throw an error when a node is constructed outside the library. (74fa8c1)
- #219 - Removing the last statement in a default or case clause will cause a double newline. (d46cbd0)
- #239 - Fix JSDoc.getInnerText() stripping leading spaces. (b9c56de)
- #244 - Fixes setOrder() bug where verify fails incorrectly. (c7bec28)
- #261 - sourceFile.getRelativePathToSourceFileAsModuleSpecifier(...) should not strip "index" file name when module resolution is classic. (5ce71ac)
- #262 - Write public keyword when specified. (6258c0e)
- #265 - Fix error thrown getting members in class containing semicolon terminated constructor & method declarations. (dfb979f)
- #269 - Support "extends" in tsconfig.json. (4964bb7)
- #270 - Fix relative path file globs not working when using .getSourceFiles(...) (fa19352)
- #271 - Fix SourceFile.move not deleting previous file on file system. (a4dfda9)
- #308 - Should not insert before the BOM. (07a2a51)
- #312 - StatementedNode uses inconsistent source for child count. (67a22b9)
- #314 - Fix moved source file not being marked as dirty in reference cache after move. (91b1fbd)
- #316 - Getting references between source files was broken when the importHelpers compiler option was true. (701e936)
- #335 - addStatements would throw if the containing block was only indented a portion of an indentation level. (c93104c)
- #336 - Calling .remove() incorrectly removes next sibling's leading comments. (aab1c1b)
- #345 - ArrowFunction should be a FunctionLikeDeclaration. (b3ea86f)
- #348 - project.getSourceFiles() would sometimes return multiple instances of the same source file. (8888967)
- #352 - Fixed reading relative files from tsconfig.json with multiple rootDirs (c2e948f)
- #354 - Support using ts-simple-ast in the browser without mocking "fs" or "fs-extra" (795fe55)
- #356 - Setting method as abstract in structure should not write method body. (8f70df2)
- #359 - Fix problems when manipulating within forEachChild or forEachDescendant. (bc124ed)
- #362 - SyntaxList.insertChildText(...) would throw when not inserting to the child syntax list. (738fb47)
- #365 - Replacing text of an identifier deep in a property access expression would throw. (4a7b1e2)
- #366 - Should be able to add a question token to a node without a type. (c43c1e7)
- #373 - Fix setType when only a question or exclamation token exists. (15d6a24)
- #374 - Surround parameter in parenthesis when there is none and setting its initializer, type, or adding a question token. (847dab6)
- #394 - Handle inconsistent file path casings on case insensitive file systems. (f7f6a3c)
- #397 - Fix type.getProperties() sometimes throwing an error. (8078772)
- #405 - "Error when renaming a file when @types exists" (a63400c)
- #410 -
sourceFile.getExportedDeclarations()
throws exception if file is empty (8d563ac) - #413 - .addExistingSourceFiles(...) will occasionally error for certain file globs. (15a6027)
- #414 - insertText() not working for namespace declaration (ee1fa55)
- #420 - Setting enum, namespace, or type alias as a default export should be done with a separate export assignment. (e81412c)
- #421 - "Adding a child to an empty namespace with dot notation in the name causes brace to be lost" (0b73d4f)
- #424 - UTF-8 bom causes incorrect indentation to be inserted. (c4a63a1)
- #437 - Fix
findReferencesAsNodes
having an undefined entry when the reference is within a string literal. (06943a9) - #460 - Calling setHasDeclareKeyword on interfaces and type aliases should modify them. (7d7c8e2)
- #468 - Removing class members should not assume it's in a class. (2c4db99)
- #482 - Import and export declaration should not include quotes in module specifier in structure (92c7f46)
- #483 -
getDerivedClasses()
fails when there exists an interface that extends the class (2bbcec5) - #484 - organizeImports() would sometimes throw. (447bcfc)
- #493 - Renaming sometimes renamed at wrong text location. (1f4316e)
- #507 - CompilerNodeToWrappedType sometimes resolved to any. (91e0e1e)
- #548 - Getting JS doc descendants by kind should find nodes. (2fd7cac)
- #557 - ExportableNode#isNamedExport() should work when named export is done via export statement. (7e18296)
- #560 - Type#isEnum() and isEnumLiteral() would not always return correct values. (98c82bc)
printNode
should get the source file from the passed in node if it exists. (3a77dbc)- Abstract methods were incorrectly returning true for .isOverload() (ef29ee1)
- Accidentally released with no jsdocs. (cf58690)
- BindingNamedNode should support BindingName. (611ea99)
- Blank line would be inserted when calling an addXs method and providing an empty array in some scenarios. (dfbf940)
- BooleanLiteral#setLiteralValue(value: boolean) should never return undefined. (d1ee709)
- Change formatting settings insertSpaceAfterSemicolonInForStatements to be true by default. (b74dfd9)
- Changing from namespace to module keyword and vice versa will now change the node kind. (38dc73b)
- ClassDeclaration.getBaseClass should return the base class when using mixins. (b455c60)
- createDirectory should throw if the directory exists. (93a9da2)
- Directory.copy should not update module specifiers pointing to other files in the directory being copied. (09244f9)
- Directory.getSourceFile should only return source files currently existing within the cache. (8db2d84)
- DocumentRegistry - Ensure any file paths sent from the compiler api are normalized. (1c06559)
- Exceptions occurring when synchronously calling forgetNodesCreatedInBlock weren't being thrown. (82798c1)
- Export Project as named export to match declaration file. (f529801)
- ExportableNode.isExported() takes into account all possible ways for a node to be exported from a file. (ad07c33)
- ExportableNode.setIsExported should not remove a default export on a different line. (fe0bcc0)
- ExportAssignmentStructure.isEqualsExport should be isExportEquals. Deprecated until next major. (1189352)
- ExportDeclaration.addNamedExport method overload was a duplicate of the other one. (3715875)
- Fix
sourceFile.getExportedDeclarations()
returning import identifiers in some scenarios (295ea4a) - Fix crashes when dealing with statemented nodes that don't have a body. (7a08ab1)
- Fix failing ts 2.4 test for IndexSignatureDeclaration. (654e5c2)
- Fix getting an ambient class' structure. (48c92b5)
- Fix getting the relative path as a module specifier to the index file in the root directory. (80ba49c)
- Fix inserting get and set accessors in an ambient context. (a282765)
- Fix intended method name. (cbdee2e)
- Fix JSDocParameterTag not being wrapped. (7363481)
- Fix node.findReferencesAsNodes() not returning references in initializers. (cfeba04)
- Fix out of date TypeGuards by regenerating them. (23eca82)
- Fix printing and getting structure of FunctionDeclaration in ambient contexts. (9940658)
- Fix scenario where adding a modifier would throw when there was an jsdoc on the parent in some scenarios. (1fbcee6)
- Fix some issues in generated ts definitions. (0d2c00d)
- Fix ts compiler types not being exported from declaration file. (0755aa2)
- Fix TypeAssertion not being wrapped. (58fc48c)
- Fixes setting node as a default export in ambientable situation would throw. (66ac7e6)
- For consistency, directory path should be relative to its path and not the parent. (f832035)
- forEachDescendant would error when the node in the callback parameter was forgotten. (152c785)
- getDiagnostics() should return the syntactic, semantic, and declaration diagnostics. (5ea5cfc)
- getRelativePathToSourceFileAsModuleSpecifier() should return
../
instead of ./../
when going back a directory. (a7954fa) - Getting TypeAliasDeclaration structure should use the type node and not the type. (aea96a3)
- ImportSpecifier and ExportSpecifier - Specifying an empty string to setAlias should not crash. (a7beb66)
- IndexSignatureDeclaration.getStructure() should use the node text and not the type text. (61f1345)
- Insert functions with a declaration keyword without a body. (c64009d)
- Internally use the first name when getting the SyntaxKind name. (cfab227)
- Lazily create program and type checker when necessary. (77b3889), closes #188
- Less strict ClassDeclaration getBaseClass (033deb8)
- More robust directory creation. (21ccc2e)
- NamespaceDeclaration#getDeclarationKindKeyword should never return undefined. (0b81c00)
- ParameterDeclaration.getScope() should return public for readonly parameter properties with an implicit scope. (c430eb4)
- Project.getSourceFile - Getting a source file by relative path should work. (d117ecc)
- Project.getSourceFile should normalize the passed in path. (c765b16)
- Project.getSourceFileOrThrow - Improve error message when the source file can't be found. (811ce1c)
- Project.getSourceFileOrThrow() should always output the passed in string in the error message. (c81081e)
- remove custom typings (c465e89)
- Removing a member throws when surrounding members have JS docs. (fdc64c9)
- Removing last modifier should not remove preceding comments. (3aa9390)
- Renamed setIsOptional to setHasQuestionToken for consistency. (ac45bba)
- replaceWithText should include the js docs if they exist. (304a86a)
- Setting string literal value by string should escape newlines and quote chars. (d68b6b9)
- ShorthandPropertyAssignment.removeObjectAssignmentInitializer was incorrectly returning undefined. (62e2971)
- Should escape quote char in passed in string to EnumMember.setValue(...); (7134702)
- Should properly add statements to a case or default clause with a block. (65d96bc)
- Should update a module specifier to a source file that was added after the internal reference cache was filled. (d6c02b1)
- Should write initializer if provided in EnumMemberStructure. (35095dc)
- core: add 2.4.2 version (c2a4022)
- Some interfaces were missing from being exported from the main file. (5330aba)
- core: linting issue (c231f9e)
- sourceFile.copy should return the current source file when copying to its own path. (6e737e7)
- sourceFile.getTrailingTriviaEnd() should return the end position of the source file. (ff6b3b3)
- sourceFile.isFromExternalLibrary() would become out of date after a manipulation. (43c6149)
- type-guards: A few nodes were not returning true for some type guards. (f2f64b6)
- Syntax kind to node mappings should include aliased kind names. (5c7109e)
- The wrapped Type should be a TypeParameter when it is a ts.TypeParameter. (23e7e94)
- tsconfig.json with "include" and "rootDir" would not have files correctly resolved. (b5b9af8)
- TypeGuards utility was missing some nodes. (3ddca5d)
- Update to code-block-writer 6.7.2. (eb5bd38)
- Use ReadonlyArray for array inputs. (2a5ed73)
- Virtual file system properly handles multiple globs. (74aaca7)
- WeakCache and KeyValueCache weren't falling back to support ES5. (eec9add)
- Write more with hanging indents (#461) (687e467)
- Writing a statemented node would not respect the manipulation settings. (179e327)
- manipulation: Brace possibly placed at wrong indentation when manipulating comma & newline separated node. (5318c0f)
- Writing enum member value that's a string should be surrounded in quotes. (d5da5b6)
chore
- Update FileSystemHost to have move and copy methods. (4401755)
- Update to code-block-writer 7.0.0. (7121e0d)
Code Refactoring
- #160 - Remove DocumentationableNode.getDocumentationComment (54c94b1)
- #170 - Rename methods on main api. (07f27c4)
- #181 Rename DocumentationableNode to JSDocableNode. (59a254e)
- #232 - HeritageClause: getTypes() -> getTypeNodes() (ef5a369)
- #429 - IndexSignatureDeclaration - Return type should be nullable. (bab0860)
- #441 - Make "XExtensionType" type aliases internal. (9ad6372)
JSDocTag.getName()
should be .getTagName()
(c362510)- addDirectoryIfExists -> addExistingDirectoryIfExists (6bb08cd)
- ast.addExistingSourceFiles now takes either a single glob or multiple globs passed as an array. (fb5b930)
- ClassDeclaration & InterfaceDeclaration: getAllMembers -> getMembers (cdb186a)
- code-block-writer is now a named export. (412482c)
- createDirectory will not throw if the directory exists. (7be9dba)
- Deprecate
project/sourceFile.getDiagnostics()
and program.getPreEmitDiagnostics()
. (7e1a21b) - getImport -> getImportDeclaration. (acd9d70)
- Getting and inserting/adding imports method names now includes "Declaration". (97812cf)
- ImportDeclaration.setDefaultImport should not rename. (f425bd8)
- JsxTagNamedNode.getTagName() is now getTagNameNode() for consistency. (36d4907)
- Project & Directory, addSourceFileIfExists -> addExistingSourceFileIfExists. (18caa1c)
- Project now accepts file system host on the options object rather than as a parameter. (7f892fb)
- Remove .getReferencingNodes() found on some nodes and languageService.getDefinitionReferencingNodes() (a20cd4e)
- Remove accidentally exposed properties on errors. (caa7e68)
- Remove CompilerNodeBrandPropertyNamesType. (ac0040e)
- Remove Directory.remove() (0ba8ba0)
- Remove getRelativePathToSourceFile and getRelativePathToSourceFileAsModuleSpecifier. (734b7a0)
- Remove Identifier.getDefinitionReferencingNodes() (2b1446a)
- Remove JSDocTag.getAtToken(). (20ccd0a)
- Remove typeParameter.getConstraintNode() and .getDefaultNode() (e84c374)
- Removed ExportAssignmentStructure.isEqualsExport (0b098a5)
- Rename AddDirectoryOptions to DirectoryAddOptions (ccd1627)
- Rename CreateSourceFileOptions to SourceFileCreateOptions and AddSourceFileOptions to SourceFileAddOptions. (0a39f15)
- Rename toggleDeclareKeyword to setHasDeclareKeyword for consistency. (0cecefe)
- Renamed QuoteType to QuoteKind. (964571a)
- file-system: Preparing for having the ability to queue deletions. (83e45f0)
- The
Options
interface was renamed to ProjectOptions
(15316a3) - Uses a WeakMap for wrapped Symbols, Types, etc. Internally created an Es5WeakMap. (177dfe6)
Features
- core: add 2.4.2 version (15519b0)
- core: support failing tests (f23a7dc)
- core: support multiple TypeScript versions (c52ad48), closes #144
- Manipulation: #65 - Setting and removing initializers from (Shorthand)PropertyAssignments (dc3a61c)
- #317 - Make Identifier a ReferenceFindableNode. (652d00d)
- navigation: #140 - Forget blocks. (f5a8b39)
- #103 - ClassDeclaration: Add .getBaseTypes() and .getBaseClass() (e84252b)
- #126 - Ability to emit to memory. (4f6fb5a)
- #131 - Ability to add statements within blocks. (f2bb4de)
- #138 - getInitializerIfKind improvement. (e0b88ba)
- #145 - Add JSDoc.getInnerText - Returns text without surrounding comment. (a62cec4)
- #148, #320 - Add WriterFunctions.object. (dab4cfb)
- #153 - Ability to insert named exports and imports with a writer. (aa5617e)
- #154 - Configuration for spaces surrounding named imports and exports. (76ce4ad)
- #161 - Rename getDocumentationCommentNodes to getDocNodes (d29820f)
- #164 - Support ExpressionStatements. (d7d48a1)
- #166 - Add ReturnStatement. (23eccf1)
- #168 - Add SourceFile.refreshFromFileSystem() (9ddcdd4)
- #169 - Directories. (332c44d)
- #173 - SemicolonToken type guard. (77d600a)
- #174 - Getting a source file by name or condition walks directories. (e4f4b45)
- #176 - Support transformations using the compiler API (
Node#transform(...)
) (3b39edb) - #177 - Ability to use virtual file system. (ae27f5b)
- #180 - Directory - isAncestorOf and isDescendantOf (7b259d9)
- #184 - Ability to copy directories. (18f1e7b)
- #185 - Ability to save all descendant files in a directory. (334f20b)
- #187 - Added TypeGuards.hasExpression. (6e37480)
- #191 - Add SourceFile.getEmitOutput(). (1707a7d)
- #194 - Add async version of forget block. (c73dd05)
- #199 - Add SourceFile.move(...), .getReferencingSourceFiles(), and .getReferencingImportAndExportDeclarations(). (f22db6c)
- #200 - Add BooleanLiteral. (6cc7917)
- #201 - Add BinaryExpression. (71a75bf)
- #204 - Add IfStatement. (095eb24)
- #204 - Add IterationStatement, Do, ForIn, ForOf, For, While (ce40dee)
- #204 - Add WithStatement. (215383a)
- #213 - Add NoSubstitutionTemplateLiteral. (e0fd583)
- #231 - Node.formatText() - Format individual nodes. (34f61ea)
- #237 - Add node.getLeadingCommentRanges() and .getTrailingCommentRanges(). (9678b3d)
- #240 - Ability to add/insert JSX attributes. (e2b4a99)
- #240 - Ability to remove JSX attributes. (1bf7642)
- #240 - Wrap JSX nodes. (aa4d70a)
- #242 - Wrap IndexSignatureDeclaration. (3dab39f)
- #245 - IndexSignatureDeclaration - Add support for readonly keyword. (2624f8b)
- #249 - Remove TypeScript compiler peer dependency. (db9f0fc)
- #250 - Accept strings for named imports and exports. (8867b71)
- #251 - Add importDeclaration.removeNamespaceImport() and .getNamespaceImportOrThrow() (0250138)
- #252 - Add Type.isNullable. (f2dfd1f)
- #256 - Add Directory.copyImmediately. (f2b01dc)
- #256 - Add Directory.move(...) (29b776a)
- #256 - Add Directory.moveImmediately. (255d01c)
- #259 - Wrap TypeLiteralNode. (d479100)
- #268 - Ancestor directories are now lazily loaded. (1169b54)
- #273 - Add overwrite option to createSourceFile. (ddcd03e)
- #276 - Improvements to moving source files. (dd03789)
- #278 - Add Type.isTupleType (d7c3c3d)
- #279 - Add StatementedNode.getDescendantStatements(). (3b8b093)
- #279 - Move .getDescendantStatements() to Node and improve performance. (e397aa2)
- #280 - Add setLiteralValue to more literals. (38c1570)
- #286 - Populate all directories as specified in tsconfig.json (206e795)
- #287 - Descendant directories are populated based on file globs passed to addExistingSourceFiles (402d395)
- #291 - Add Type: isNumberLiteral, isStringLiteral(), and isBooleanLiteral(). (10e40cb)
- #293 - Upgrade to TypeScript 2.8.1 (16e5962)
- #294 - Add sourceFile.organizeImports() (4f3b2ff)
- #294 - Wrap languageService.organizeImports(...). (154bf2e)
- #295 - ClassDeclaration now has a nullable name. (96b9857)
- #297 - Simpler findReferences() and getDefinitions() that only returns nodes. (4048116)
- #300 - Fix more nodes to have .findReferences() and .getReferencingNodes() (9ae7383)
- #302 - Add CompilerNodeToWrappedType. (0ce5af5)
- #304 - Improve getNodeProperty by using condition types. Add CompilerNodeToWrapperMappings. (5bd2926)
- #306 - Add Node.forEachChild and Node.forEachDescendant (9eabe57)
- #311 - Allow providing a string instead of a JSDoc structure. (a0b16e6)
- #320 - Add ability to set initializer in a structure with a writer function. (20e51ed)
- #324 - Added ClassDeclaration.insertConstructors() and addConstructors(). (2aefd93)
- #337 - Add DiagnosticWithLocation. (f1f700e)
- #337 - Add DocumentSpan - getOriginalTextSpan and getOriginalFileName (254bea8)
- #337 - DefinitionInfo now extends DocumentSpan as done in ts 2.9. (c1ff983)
- #338 - Add Diagnostic.getLineNumber() (4cba457)
- #339 - Add Directory.addExistingSourceFiles(...). (bb5cd6e)
- #342 - Finish work on removing property assignment. (9e35623)
- #343 - Ability to remove more object literal expression members (e82d45f)
- #347 - Add .skip() and .up() method to
forEachDescendant
. (361bcaf) - #355 - Add
getLengthFromLineStartAtPos
to replace getColumnAtPos
in next major. (e82cdff) - #363 - Add type guard overloads to methods with a condition for a node. (21da2fc)
- #369 - FunctionDeclaration should have an optional name. (176825d)
- #37 - Add StringLiteral.getQuoteType (adad446)
- #370 - Add RenameableNode. (1d18158)
- #375 - Add ObjectBindingPattern, ArrayBindingPattern, and BindingElement. (7d82126)
- #380 - Expose options to rename in comments and strings (29592c7)
- #381 - getParent() and getParentOrThrow() return the correct type based on the type of the current node. (efa7616)
- #383 - Update to TS 3.0 (547eb3d)
- #390 - Add Node.getFirstAncestor and getFirstAncestorOrThrow methods. (f83be80)
- #400 - Symbol - Add global exports. (2bbeff9)
- #406 - Wrap ParenthesizedTypeNode. (9429704)
- #409 - Add ability to specify custom transformers when emitting. (644eba5)
- #415 - Fix "typeRoots" compiler option not working. (5e4cd08)
- #418 - Add new .set methods and deprecate .fill (da40d99)
- #42 - Ability to pass in type checker to wrapped node. (62b377f)
- #423 - Add node.getText(true) for getting text with js docs. (0522510)
- #431 - Allow passing in a module specifier string to .getImportDeclaration and .getExportDeclaration (20b45d2)
- #436 - Add support for import and exports to NamespaceDeclaration (65d4bf2)
- #439 - Improve type guards to use extension type for mixins. (1ca6dd3)
- #443 Better support for
global
namespace declarations (d89fd96) - #445 - SourceFile, Directory - Add moveToDirectory and copyToDirectory. (fc806da)
- #449 - Wrap ImportClause. (c66ed65)
- #45 / #346 - Add .getStructure() (2d7351c)
- #454 - Wrap NamespaceImport. (001e7d0)
- #456 - Relax ts dependency to 3.0.1 and 3.0.3. (1029f75)
- #46 - Ability to set node from a structure using .set methods (22d4753)
- #467 - Move some ClassDeclaration functionality into ClassLikeDeclarationBase. (fdb5f42)
- #467 - Wrap ClassExpression. (92f4be3)
- #469 - ClassDeclaration - Add "Extract interface" (8b19131)
- #471 - Add
Project.formatDiagnosticsWithColorAndContext(diagnostics)
(3056a1e) - #472 - Add getBodyText() to BodiedNode and BodyableNode (e41c278)
- #473 - MethodDeclaration should extend QuestionTokenableNode. (674d3d2)
- #488 - LanguageService - getSuggestionDiagnostics, getEditsForRefactor, getCodeFixesAtPosition (9e42b10)
- #491 Add project.applyFileTextChanges (4de796c)
- #492 - Resolve dependencies when constructing a project and providing a tsconfig. (548ae43)
- #505 - TypeParameteredNodeStructure - Accept strings (a11ff0a)
- #506 - Get variable statement by a declaration's name. (6b94548)
- #508 - Expose Node.forgetDescendants. (ee87eac)
- #511 - createSourceFile - Added ability to pass in a writer function. (9a04103)
- #518 - Add SourceFile#fixMissingImports() (28d12e3)
- #520 - Search object and array binding patterns when looking for a node by a name. (20239d7)
- #522 - Project should not return implicitly resolved files and directories in most scenarios. (73c5a39)
- #523 - Resolved node_module source files or directories are no longer returned from Project#getSourceFiles() and getDirectories() (6cf2d40)
- #527 - Adding namespace with quotes defaults to ambient module. (fadeeea)
- #530 - Add JSDocTypeExpression (ddc1dd3)
- #532 - Expose isBracketed on JSDocPropertyLikeTag (1acc955)
- #535 - Add getTypeExpression() to JSDocReturnTag and JSDocTypeTag (61b71b3)
- #538 - Add Type#isAny() (1d3c2bb)
- #541 - Add TypeChecker#getResolvedSignature() (cf5104d)
- #543 - Wrap IndexedAccessTypeNode. (a1d5696)
- #547 - Wrap JSDocSignature and JSDocType. (9e1b0b2)
- #553 - VariableDeclaration now has read exportable methods like isDefaultExport(). (0991e96)
- #59 - Get parameter, type parameter, or decorator by name. (f889515)
- #65 - Navigation and manipulation of object literal expressions. (d9d1621)
- #7 - Ability to import files from tsconfig. (b538537)
- #7 - Some fixes to importing files from tsconfig. (2a95bc2)
- #7 - Specified compiler options and tsconfig path are both used to determine added files. (20e7b77)
- #74 - Add more "OrThrow" methods. (2d5c94d)
- Ability to add js docs with a writer function directly from the method. (4ad9614)
- Ability to add/insert an argument with a writer. (e1bcb6a)
- Ability to easily check if an external module reference is relative. (f8676f0)
- Ability to easily get an ImportEqualsDeclaration and ExternalModuleReference's referenced source file. (c6d7c7b)
- Ability to get a directory from directory based on a relative path. (b7714c5)
- Ability to get source file from directory based on relative or absolute path. (fb72396)
- Ability to set a DecoratorStructure's arguments using a writer function. (585793c)
- Ability to set a IndexSignatureDeclaration's return type using a writer function. (0d6526d)
- Ability to set a JSDoc's description in a structure by using a writer. (0250ae1)
- Ability to set a PropertyAssignment's initializer using a writer function. (b633937)
- Ability to set a return type with a writer. (3db81f8)
- Ability to set a SourceFileStructure's bodyText using a writer function. (792c530)
- Ability to set a SpreadAssignmentStructure's expression using a writer function. (e7e0158)
- Ability to set a type with a writer. (5dc3565)
- Ability to set an initializer's text using a writer. (2c1a9e5)
- Add .findReferencesAsNodes() to deprecate .getReferencingNodes() in next major. (a8a731a)
- Add .getType() to InterfaceDeclaration and ClassDeclaration. (3c8ca33)
- Add
.getSignature()
method to nodes that have a return type. (f65c529) - Add
Directory.getRelativePathAsModuleSpecifierTo
and getRelativePathTo
(5d5fa08) - Add
JSDocPropertyLikeTag.getName()
and .getNameNode()
(9804627) - Add
program.getGlobalDiagnostics()
. (a03d257) - Add
Project.getAmbientModules()
, .getAmbientModule(name: string)
, and .getAmbientModuleOrThrow(name: string)
(7f89eea) - Add ability to add/insert type parameters with a default type node. (cd05c3f)
- Add addDirectoryIfExists and addSourceFileIfExists (0ff4ff2)
- Add aliases CallLikeExpression and JsxOpeningLikeElement. (030c6df)
- Add ast.getFileSystem() (3364349)
- Add ast.getPreEmitDiagnostics() (a561994)
- Add ast.manipulationSettings.getEditorSettings() (mostly used internally for the default) (af82884)
- Add CallSignatureDeclaration. (3067c2b), closes #226
- Add ClassDeclaration - getExtendsOrThrow() and getBaseClassOrThrow. (3e24db4), closes #74
- Add deprecation warning to sourceFile.getDiagnostics() and project.getDiagnostics(). Use .getPreEmitDiagnostics instead. (dd90b1e)
- Add Directory.forget(). Will deprecate Directory.remove() in next major. (f584d20)
- Add Directory.getDescendantDirectories. (d576acb)
- Add ExportAssignment. (f2b346b)
- Add ExportAssignment.setExpression (0c6fcf0)
- Add ExportAssignment.setIsExportEquals. (43d3d84)
- Add ExportDeclaration.removeModuleSpecifier() (b64c665)
- Add ExportSpecifier.getName() (b6357c6)
- Add ExpressionedNode.setExpression (12e0ca7)
- Add ExternalModuleReference and ImportEqualsDeclaration. (c140982), closes #225
- Add FileTextChanges#getSourceFile() (85deec7)
- Add functions and variables to typescript declaration file. (451840b)
- Add getAttribute to JsxOpeningElement and JsxSelfClosingElement. (7dbe0f7)
- Add getAttributeOrThrow for jsx nodes with attributes. (93a0fbd)
- Add ImportDeclaration & ExportDeclaration .getModuleSpecifierValue(). (1785054)
- Add ImportDeclaration.getImportClause() and .getImportClauseOrThrow() (8d99c27)
- Add ImportDeclaration.removeDefaultImport() (87dd9cf)
- Add ImportDeclaration.renameDefaultImport. (1ba29be)
- Add ImportEqualsDeclaration.setExternalModuleReference(...). (e3396d3)
- Add ImportTypeNode. (3d0203c)
- Add isInStringAtPos to Node. (cfcf256)
- Add JSDocableNode to ExpressionStatement and LabeledStatement. (00c2a89), closes #193
- Add JSDocTag#getName(). (0c868e9)
- Add JsxAttribute .setInitializer & .removeInitializer (9436954)
- Add JsxElement setBodyText and setBodyTextInline. (1420786)
- Add JsxSpreadAttribute.setExpression (532131f)
- Add languageService.getIdentationAtPosition(...) (4de5f82)
- Add LanguageService#getCombinedCodeFix(...) (ef9f3a3)
- Add more type guards. (4a1a92d)
- Add new getImportStringLiterals() method. (a1b967f), closes #276
- Add new project.compilerOptions property that has the ability to change the compiler options. (4da80ba)
- Add Node.getEndLineNumber() (f00ca4c)
- Add Node.getFullStart (9d44185)
- Add Node.getLeadingTriviaWidth(). (09bdd01)
- Add Node.getStartColumn(), Node.getEndColumn(), SourceFile.getColumnAtPos(pos). (5119e83)
- Add Node.getSymbolOrThrow() (6abbe7f)
- Add Node.getTrailingTriviaEnd() and .getTrailingTriviaWidth() (98cd0b0)
- Add Node.getType() (2f15bd9)
- Add overwrite option to source file and directory copy. (0741180)
- Add printNode utility function and Node.print() (d6c2313)
- Add Program.getEmitModuleResolutionKind(). (447573f)
- Add Project.createWriter(). (914f503)
- Add SourceFile getRelativePathToSourceFile and getRelativePathToSourceFileAsModuleSpecifier. (99e8585)
- Add SourceFile.getDirectoryPath(). (708f3bb)
- Add SourceFile.getLanguageVersion(). Language version is now specific to file. (117433e)
- Add SourceFile.getPreEmitDiagnostics (d1ea9eb)
- Add sourceFile.getReferencingLiteralsInOtherSourceFiles(). (9f009cf)
- Add SourceFile.getRelativePathTo and getRelativePathAsModuleSpecifierTo. (04f91eb)
- Add SourceFile.isFromExternalLibrary (136a2da)
- Add SourceFile.isInNodeModules() (0a1817c)
- Add space before and after first & last import specifier. (ae23711)
- Add StringLiteral.setLiteralValue(...). (8d5ff33)
- Add support for strict property initialization (exclamation token). (1e787f2)
- Add Symbol.getEscapedName() (4360bab)
- Add Symbol.getValueDeclaration() (91da111)
- Add Symbol#getAliasedSymbolOrThrow() and Symbol#getExportByNameOrThrow(name: string). (78c7ea3)
- Add ts.Node brand to prevent using ts.Nodes created outside the ts named export. (ab7c353)
- Add Type: isUnionOrIntersection, isClass, and isClassOrInterface. (12c4710)
- Add Type.getConstraint() and getDefault(). (8850266)
- Add Type.getTupleElements(). (8c5dafc)
- Add type.isEnumLiteralType() and type.isLiteral() (56b26f8), closes #290
- Add Type.isTypeParameter type guard. (02c591f)
- Add Type#isUnknown() (30bb042)
- Add TypeParameterDeclaration - getConstraintOrThrow() and getDefaultOrThrow() (8e8166b)
- Add UserPreferences and new organizeImports parameter (a7864f1)
- Add UserPreferences on sourceFile.organizeImports() (6b0a089)
- Add VariableDeclaration#getVariableStatement() (bba33ee)
- Add WriterFunctions - objectType, unionType, intersectionType (d10877f)
- addExistingDirectory and addDirectoryExists now has a recursive option. (45efb2f)
- Align ClassDeclaration more with the compiler. (9b64bb5)
- ArrayLiteralExpression - Add ability to add elements with writer for each element. (1f8b1cb)
- Better error message when using a forgotten node. (762254f)
- BodyableNode - addBody, removeBody, hasBody (3f4175e)
- Deletes do not happen on the file system until
.save()
is called on the main ast
object. (d208cfd) - Deprecate renameName on ImportSpecifier and ExportSpecifier. (f94eed9)
- Deprecated node.getStartColumn() and node.getEndColumn(). Renamed sourceFile.getColumnAtPos(pos) to getLengthFromLineStartAtPos(pos). (d8b61b6)
- Emit a directory. (3cb455c)
- Export errors. (#402) (b719ed8)
- ExportSpecifier - getLocalTargetSymbol() and getLocalTargetDeclarations() (30eff42)
- Get exports from symbol. (c815955)
- Hide "Specific" structures in declaration file. (db55c33)
- ImportDeclaration & ExportDeclaration - getModuleSpecifierSourceFile (a42d6a1)
- ImportDeclaration and ExportDeclaration - isModuleSpecifierRelative() (2ef3064)
- ImportDeclaration.getDefaultImportOrThrow() (499c741)
- ImportDeclaration.setDefaultImport should remove the default import when providing an empty string. (f81f90a)
- ImportSpecifier and ExportSpecifier - .setAlias(...) does not the usages. (5f2f7c8)
- ImportSpecifier and ExportSpecifier - Add .removeAlias(). (b594113)
- ImportSpecifier and ExportSpecifier - Add removeAliasWithRename() (576db34)
- ImportSpecifier and ExportSpecifier - Renamed .setAlias to .renameAlias (0f446b6)
- ImportTypeNode - setArgument and setQualifier (e94bbd4)
- Improve inserting to ArrayLiteralExpressions. (b2e991f)
- Improvements to CompilerNodeToWrappedType. (384613a)
- InterfaceDeclaration - getBaseTypes() and getBaseDeclarations() (9785eeb)
- Node .getStart & .getStartLinePos - add includeJsDocComment. (af8bb55)
- Node.getStartLineNumber and SourceFile.getLineNumberFromPos. (64178fa)
- Node.preprendWhitespace(textOrWriterFunction) and .appendWhitespace(textOrWriterFunction) (a43cb65)
- Program - getSyntacticDiagnostics, getSemanticDiagnostics, getDeclarationDiagnostics, getPreEmitDiagnostics (56b5f58)
- Rename CompilerApiNodeBrandPropertyNamesType to CompilerNodeBrandPropertyNamesType. (1eb6a86)
- Rename sourceFile.getLineNumberFromPos(pos) to getLineNumberAtPos(pos) (fa5849a)
- Rename VariableDeclarationType to VariableDeclarationKind. (ce52ce3)
- Renamed getAliasIdentifier() to getAliasNode() on ImportSpecifier and ExportSpecifier. (e97de72)
- setModuleSpecifier accepts a source file. (c2a4d9a)
- SourceFile - copyImmediately and moveImmediately along with sync methods. (4183769)
- SourceFile - getExportedDeclarations() (61663aa)
- sourceFile.copy() will automatically update the new source file's import & export declarations' module specifiers if necessary. (e48949e)
- SourceFile.formatText uses the formatting API. (02e3feb), closes #157 #158
- sourceFile.getBaseNameWithoutExtension() (09a63d9)
- sourceFile.getExtension() (3906902)
- StatementedNode - getStatement(condition) and getStatementByKind(kind). (db34a13), closes #233
- Support deleting a file from the file system. (326b6e0)
- Support multiple globs when getting source files. (bb935d9)
- Support TS 2.4, 2.5, and 2.6 (57c87f8)
- Support TS 3.2. (e800f8b)
- Support TypeScript 3.1.1 and 3.1.3. (1598b96)
- Symbol - Add .getMembers(), .getMemberByName(name), and .getMemberByNameOrThrow(name). (6fb28b4)
- TextInsertableNode - Add removeText() overload with no parameters. (a4b5ef1)
- TypeGuards.hasBody(node). (4041dfd)
- TypeGuards.hasName(node) (efed188)
- TypeParameterDeclaration - Add .removeDefault() and .removeConstraint() (7a9d329)
- TypeParameterDeclaration - Add .setDefault(text) and .setConstraint(text) (de9d91b)
- Update code-block-writer version. Adds .tab(), .tabIfLastNot(), and .isLastTab(). (903b8ac)
- Update to TypeScript 2.9. (da45aae)
- Upgrade from TypeScript 2.8.1 to 2.8.3. (106e17e)
- Upgrade support to TypeScript 2.7. (dab428a)
- Upgrade to code-block-writer 6.2.0 (155f935)
- Upgrade to code-block-writer 6.6.0 (34c39a9)
- Upgrade to TypeScript 3.0.3. (c38f5c2)
- Node: Getting child of node at index. (cb0a800)
- Use readonly arrays for file globs (#401) (c96d987)
- Uses the language service to figure out the indentation level when writing. (76f9531)
- Wrap JSDocFunctionType. (8965da3)
- Wrap LanguageService.getEmitOutput(...). (40ecc32)
- Wrap ModuleBlock. (1507c8d)
- Wrap more type nodes. (9211350)
- Wrap NamedImports and NamedExports. (6a17fe8)
Performance Improvements
- #283 - Do not temporarily wrap new tree when doing a manipulation. (824819f)
- #393 - Use DocumentRegistry when creating language service. (d879071)
- #435 - Memoize only before source file manipulation for some wrapped language service source file dependent objects. (ad06259)
- #498 - OfKind and ByKind methods should use ts.forEachChild when appropriate. (5c249bf)
- Don't internally add nodes to the cache so often for common navigation methods. (7efc147)
- Make internal Es5HashSet O(1) instead of O(n) for lookups. (a12a92c)
- Reuse the old program when creating a new one. (6dc60f8)
BREAKING CHANGES
- Source files implicitly resolved in the node_modules directory are no longer returned by
Project#getSourcesFiles()
and getDirectories()
. Either add them to the project explicitly or navigate to them via methods like .getSourceFile("node_modules/library/pathToFile.d.ts")
or .getDirectory("node_modules")
. - QuestionTokenableNode.setIsOptional is now setHasQuestionToken.
node.getFirstChildByKind
and node.getChildrenOfKind
now search the parsed tree via .forEachChild(...)
when specifying a parsed node's syntax kind. Previously it would only search the results of node.getChildren()
.JSDocTag.getAtToken()
was removed because jsDocTag.atToken
no longer exists in ts 3.2.- The
Options
interface was renamed to ProjectOptions
. This was so it's less ambiguous. - The Project constructor changed to accept a file system host on the first options object parameter rather than as its own parameter.
- Referenced source files in module specifiers and references are now added to the project when constructing a project and providing a tsconfig. To revert back to the old behaviour, provide the
skipFileDependencyResolution
option and set it to true. JSDocTag
's .getName()
is now .getTagName()
. This was necessary because .getName()
should return a JSDocPropertyLikeTag
's name.- Removed CompilerNodeBrandPropertyNamesType.
- More declarations are being written with hanging indents.
- Upgraded to TS 3.0.3, which has some breaking changes in it from 3.0.1.
- IndexSignatureDeclaration's return type is now nullable to reflect what's done in the compiler API.
- The "XExtensionType" type aliases are now internal. They were hidden because they're not useful outside the library and only create noise in the named exports.
NamespaceDeclaration.setHasNamespaceKeyword
and setHasModuleKeyword
are now setDeclarationKind(kind: NamespaceDeclarationKind)
. NamespaceDeclarationStructure.hasModuleKeyword
and hasNamespaceKeyword
are now declarationKind
.- Some properties on thrown errors were removed. See commit for details.
- TypeParameterDeclaration's getConstraintNode() and getDefaultNode() are deprecated. Use getConstraint() and getDefault().
- JsxTagNamedNode.getTagName() is now .getTagNameNode()
- ImportDeclaration.setDefaultImport no longer renames the identifier. Use
.renameDefaultImport
instead. - .setAlias(...) does not rename the usages.
- .setAlias(...) is now .renameAlias(...).
.fill(...)
is now .set(...)
and will replace existing nodes.
If you want the old behaviour, use the .addX
methods or provide the structures of the nodes by using .getStructure()
(Ex. functionDeclaration.fill({ parameters: [...functionDeclaration.getParameters().map(p => p.getStructure()), { name: "myParam" }] });
)
- "Specific" structures are no longer exported from the declaration file.
This helps reduce the noise when looking at code completion for a named export from the library.
- Change to jsx spread attribute structure.
Co-authored-by: Sebastián Gurin sebastigurin@gmail.com
Co-authored-by: David Sherret dsherret@users.noreply.github.com
project/sourceFile.getDiagnostics()
and program.getPreEmitDiagnostics()
no longer exist. Use project/sourceFile.getPreEmitDiagnostics()
.- Removed ability to set a specific target for specific source files (all files are stored in a ts.DocumentRegistry now so that's not possible).
BindingNamedNode
now correctly may also return a BindingName
.- getImplementations()[i].getNode() now returns the identifier instead of the parent node. This was based on a change in the compiler api.
- Renamed sourceFile.getLineNumberFromPos(pos) to getLineNumberAtPos(pos) for consistency.
- node.getStartColumn() and node.getEndColumn() was removed. Renamed sourceFile.getColumnAtPos(pos) to getLengthFromLineStartAtPos(pos) for correctness.
- getAliasIdentifier() on ImportSpecifier and ExportSpecifier is now getAliasNode() for consistency.
- renameName on ImportSpecifier and ExportSpecifier is now deprecated. Use
importSpecifier.getNameNode().rename(newName)
. - CompilerApiNodeBrandPropertyNamesType is now CompilerNodeBrandPropertyNamesType for consistency.
- FunctionDeclaration now has an optional name to support cases where it does (ex.
export default function() {}
) getNodeProperty
functionality requires TS 2.8 or greater due to mapped types.- DefinitionInfo.getNode() is now DefinitionInfo.getDeclarationNode() for compatibility with DocumentSpan.
- getReferencingNodes and getDefinitionReferencingNodes are both renamed to .findReferencesAsNodes(). This is so the method is more discoverable in auto complete when looking at .findReferences().
- Renamed all Type.isXType() methods to Type.isX() to match what's done in the compiler api and to remove needless repetition in name.
- Updating to TypeScript 2.9 introduces some changes in behaviour and breaking changes in the compiler API declaration file.
- ClassDeclarationStructure.ctor is renamed ctors. It accepts multiple constructors now. Additionally, insertConstructor and addConstructor on ClassDeclaration does not remove the existing constructor if it exists.
- code-block-writer is now exported as a named export from the library (
CodeBlockWriter
). - Implicitly resolved files and directories are no longer returned when calling
project.getSourceFiles()
or project.getDirectories()
. They can be added by calling project.addExistingSourceFiles(...)
-like methods or project.addExistingDirectory(...)
. These source files and directories are still accessible when specifying their path though (ex. project.getSourceFile("node_modules/typescript/lib/typescript.d.ts")
) - AddDirectoryOptions -> DirectoryAddOptions
- CreateSourceFileOptions -> SourceFileCreateOptions, AddSourceFileOptions -> SourceFileAddOptions
- The FileSystemHost interface now has move and copy methods.
- createDirectory will not throw if the directory exists.
- Directory.remove() is now Directory.forget() for consistency with SourceFile.
- SourceFile.getRelativePathToSourceFile and getRelativePathToSourceFileAsModuleSpecifier is now getRelativePathTo and getRelativePathAsModuleSpecifierTo respectively.
- ExportAssignmentStructure.isEqualsExport is now isExportEquals. This was incorrectly named.
- Identifier.getDefinitionReferencingNodes() is now getReferencingNodes().
- Directory.copy correctly does not update module specifiers pointing to other files in the directory being copied.
- addDirectoryIfExists is now addExistingDirectoryIfExists for consistency with addExistingDirectory.
.getName()
and .getNameNode()
on ClassDeclaration can now possibly return undefined (ex. export default class { ... }
).- VariableDeclarationType is now VariableDeclarationKind. .getDeclarationType() is now .getDeclarationKind()
This was done to reduce confusion with the word "Type".
- QuoteType is now QuoteKind.
This was done to make it consistent with NewLineKind.
- ScriptTarget was moved from manipulation settings to be stored exclusively in the compiler options.
getReferencingImportAndExportDeclarations()
was removed. Use getReferencingNodesInOtherSourceFiles()
.ImportDeclaration
& ExportDeclaration
.getModuleSpecifier()
now returns the StringLiteral. Use .getModuleSpecifierValue()
for the previous behaviour.- Project & Directory's addSourceFileIfExists is now addExistingSourceFileIfExists.
This was done for consistency with addExistingSourceFile.
- Requesting an ancestor directory will no longer return undefined if it is an ancestor of a "root" directory.
- Removed Symbol.equals(symbol). You can use === to compare symbols now.
- ClassDeclaration.getMembers() no longer returns parameter properties.
-
- ast.saveUnsavedSourceFiles() is now ast.save()
- Directory.saveUnsavedSourceFiles() is now Directory.save()
- file-system: SourceFile/Directory: delete() and deleteSync() are now deleteImmediately() and deleteImmediatelySync().
- HeritageClause getTypes() renamed to getTypeNodes().
It was incorrectly named originally.
- ClassDeclaration & InterfaceDeclaration getAllMembers() renamed to getMembers().
- sourceFile.getImport is now getImportDeclaration for consistency.
- Access the TypeScript compiler via
import {ts} from "ts-simple-ast";
- NewLineKind is now the TypeScript compiler's enum.
- toggleDeclareKeyword is now setHasDeclareKeyword.
- Use an array when passing in multiple file globs to ast.addExistingSourceFiles.
This better expresses the intent of this method call.
- Files are added based on the tsconfig by default.
getCompilerOptionsFromTsConfig
now returns an object that includes the diagnostics. - All import methods on SourceFile have been renamed to include "declaration" (ex. getImports() -> getImportDeclarations()). This was done for consistency with getExports() -> getExportDeclarations().
- getDocs(), insertDoc(), etc. have been renamed to getJsDocs(), insertJsDoc(), etc...
- All export methods on SourceFile have been renamed to include "declaration" (ex. getExports() -> getExportDeclarations())
- Renamed methods for creating & adding source files. See #170 for details.
- Removed DocumentationableNode.getDocumentationComment.
- getDocumentationCommentNodes is now getDocNodes.
- createWrappedNode's signature changed.
- StringChar renamed to QuoteType. Manipulation setting's getStringChar() renamed to getQuoteType().
This was done for consistency.
- SourceFile.formatText now takes a FormatCodeSettings argument.
- Updated to code-block-writer 7.0.0. The writer methods
newLineIfLastNotNewLine
, blankLineIfLastNotBlankLine
, and spaceIfLastNotSpace
, are removed. Use the shorter method names like spaceIfLastNot
.