Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: dsherret/ts-morph
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 16.0.0
Choose a base ref
...
head repository: dsherret/ts-morph
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: 17.0.0
Choose a head ref
  • 7 commits
  • 119 files changed
  • 3 contributors

Commits on Oct 1, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    7680bae View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    f927d01 View commit details

Commits on Nov 19, 2022

  1. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    6b88a0b View commit details
  2. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    3d64776 View commit details
  3. Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    e334437 View commit details
  4. feat: allow providing custom error messages to OrThrow methods (#1327)

    Also shows the source of an error.
    jantimon authored Nov 19, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    05916d3 View commit details

Commits on Nov 20, 2022

  1. 17.0.0

    dsherret authored Nov 20, 2022

    Verified

    This commit was created on GitHub.com and signed with GitHub’s verified signature. The key has expired.
    Copy the full SHA
    a583f58 View commit details
Showing with 17,664 additions and 15,136 deletions.
  1. +1 −1 .editorconfig
  2. +5 −5 deno/bootstrap/ts_morph_bootstrap.js
  3. +19 −10 deno/common/ts_morph_common.d.ts
  4. +72 −32 deno/common/ts_morph_common.js
  5. +294 −260 deno/common/typescript.d.ts
  6. +11,590 −9,928 deno/common/typescript.js
  7. +343 −323 deno/ts_morph.d.ts
  8. +346 −305 deno/ts_morph.js
  9. +1 −1 dprint.json
  10. +1 −1 packages/bootstrap/.npmignore
  11. +298 −250 packages/bootstrap/package-lock.json
  12. +9 −9 packages/bootstrap/package.json
  13. 0 packages/bootstrap/{rollup.config.js → rollup.config.mjs}
  14. +5 −5 packages/bootstrap/src/Project.ts
  15. +1 −1 packages/common/.npmignore
  16. +19 −10 packages/common/lib/ts-morph-common.d.ts
  17. +294 −260 packages/common/lib/typescript.d.ts
  18. +269 −221 packages/common/package-lock.json
  19. +11 −11 packages/common/package.json
  20. 0 packages/common/{rollup.config.js → rollup.config.mjs}
  21. +12 −9 packages/common/src/data/libFiles.ts
  22. +83 −23 packages/common/src/errors.ts
  23. +205 −130 packages/common/src/tests/errorsTests.ts
  24. +1 −1 packages/ts-morph/.npmignore
  25. +21 −0 packages/ts-morph/CHANGELOG.md
  26. +343 −323 packages/ts-morph/lib/ts-morph.d.ts
  27. +2,721 −2,661 packages/ts-morph/package-lock.json
  28. +10 −10 packages/ts-morph/package.json
  29. 0 packages/ts-morph/{rollup.config.js → rollup.config.mjs}
  30. +1 −1 packages/ts-morph/scripts/generation/createDeclarationFile.ts
  31. +4 −4 packages/ts-morph/src/Project.ts
  32. +3 −3 packages/ts-morph/src/compiler/ast/base/AmbientableNode.ts
  33. +3 −3 packages/ts-morph/src/compiler/ast/base/AsyncableNode.ts
  34. +2 −2 packages/ts-morph/src/compiler/ast/base/AwaitableNode.ts
  35. +3 −3 packages/ts-morph/src/compiler/ast/base/BodyableNode.ts
  36. +3 −2 packages/ts-morph/src/compiler/ast/base/DecoratableNode.ts
  37. +3 −3 packages/ts-morph/src/compiler/ast/base/DotDotDotTokenableNode.ts
  38. +3 −3 packages/ts-morph/src/compiler/ast/base/ExclamationTokenableNode.ts
  39. +3 −3 packages/ts-morph/src/compiler/ast/base/GeneratorableNode.ts
  40. +6 −2 packages/ts-morph/src/compiler/ast/base/HeritageClauseableNode.ts
  41. +10 −3 packages/ts-morph/src/compiler/ast/base/ModifierableNode.ts
  42. +26 −17 packages/ts-morph/src/compiler/ast/base/ModuledNode.ts
  43. +3 −3 packages/ts-morph/src/compiler/ast/base/OverrideableNode.ts
  44. +3 −3 packages/ts-morph/src/compiler/ast/base/QuestionDotTokenableNode.ts
  45. +3 −3 packages/ts-morph/src/compiler/ast/base/QuestionTokenableNode.ts
  46. +3 −3 packages/ts-morph/src/compiler/ast/base/ReadonlyableNode.ts
  47. +3 −3 packages/ts-morph/src/compiler/ast/base/ReturnTypedNode.ts
  48. +3 −3 packages/ts-morph/src/compiler/ast/base/StaticableNode.ts
  49. +15 −6 packages/ts-morph/src/compiler/ast/base/TypeElementMemberedNode.ts
  50. +3 −3 packages/ts-morph/src/compiler/ast/base/TypedNode.ts
  51. +6 −6 packages/ts-morph/src/compiler/ast/base/export/ExportGetableNode.ts
  52. +9 −5 packages/ts-morph/src/compiler/ast/base/initializer/InitializerExpressionGetableNode.ts
  53. +6 −6 packages/ts-morph/src/compiler/ast/base/name/NameableNode.ts
  54. +2 −2 packages/ts-morph/src/compiler/ast/binding/BindingElement.ts
  55. +6 −2 packages/ts-morph/src/compiler/ast/class/GetAccessorDeclaration.ts
  56. +14 −0 packages/ts-morph/src/compiler/ast/class/PropertyDeclaration.ts
  57. +6 −2 packages/ts-morph/src/compiler/ast/class/SetAccessorDeclaration.ts
  58. +3 −3 packages/ts-morph/src/compiler/ast/class/base/AbstractableNode.ts
  59. +6 −6 packages/ts-morph/src/compiler/ast/class/base/ClassLikeDeclarationBase.ts
  60. +81 −71 packages/ts-morph/src/compiler/ast/common/Node.ts
  61. +2 −2 packages/ts-morph/src/compiler/ast/decorator/Decorator.ts
  62. +2 −2 packages/ts-morph/src/compiler/ast/doc/JSDocTemplateTag.ts
  63. +3 −3 packages/ts-morph/src/compiler/ast/doc/base/JSDocPropertyLikeTag.ts
  64. +3 −3 packages/ts-morph/src/compiler/ast/doc/base/JSDocTypeExpressionableTag.ts
  65. +2 −2 packages/ts-morph/src/compiler/ast/expression/ElementAccessExpression.ts
  66. +9 −0 packages/ts-morph/src/compiler/ast/expression/SatisfiesExpression.ts
  67. +9 −5 packages/ts-morph/src/compiler/ast/expression/expressioned/ExpressionableNode.ts
  68. +6 −2 packages/ts-morph/src/compiler/ast/expression/expressioned/ExpressionedNode.ts
  69. +1 −0 packages/ts-morph/src/compiler/ast/expression/index.ts
  70. +4 −4 packages/ts-morph/src/compiler/ast/expression/object/ShorthandPropertyAssignment.ts
  71. +16 −8 packages/ts-morph/src/compiler/ast/function/OverloadableNode.ts
  72. +2 −2 packages/ts-morph/src/compiler/ast/jsx/JsxAttribute.ts
  73. +2 −0 packages/ts-morph/src/compiler/ast/kindToNodeMappings.ts
  74. +4 −4 packages/ts-morph/src/compiler/ast/module/ExportDeclaration.ts
  75. +6 −2 packages/ts-morph/src/compiler/ast/module/ExportSpecifier.ts
  76. +2 −2 packages/ts-morph/src/compiler/ast/module/ExternalModuleReference.ts
  77. +6 −6 packages/ts-morph/src/compiler/ast/module/ImportClause.ts
  78. +8 −8 packages/ts-morph/src/compiler/ast/module/ImportDeclaration.ts
  79. +5 −4 packages/ts-morph/src/compiler/ast/module/ImportEqualsDeclaration.ts
  80. +4 −0 packages/ts-morph/src/compiler/ast/module/ImportSpecifier.ts
  81. +3 −3 packages/ts-morph/src/compiler/ast/module/ModuleChildableNode.ts
  82. +2 −2 packages/ts-morph/src/compiler/ast/statement/BreakStatement.ts
  83. +2 −2 packages/ts-morph/src/compiler/ast/statement/CatchClause.ts
  84. +2 −2 packages/ts-morph/src/compiler/ast/statement/ContinueStatement.ts
  85. +6 −6 packages/ts-morph/src/compiler/ast/statement/ForStatement.ts
  86. +14 −6 packages/ts-morph/src/compiler/ast/statement/StatementedNode.ts
  87. +4 −4 packages/ts-morph/src/compiler/ast/statement/TryStatement.ts
  88. +5 −4 packages/ts-morph/src/compiler/ast/type/ImportTypeNode.ts
  89. +8 −8 packages/ts-morph/src/compiler/ast/type/MappedTypeNode.ts
  90. +4 −4 packages/ts-morph/src/compiler/ast/type/TypeParameterDeclaration.ts
  91. +4 −4 packages/ts-morph/src/compiler/ast/type/TypePredicateNode.ts
  92. +2 −2 packages/ts-morph/src/compiler/ast/variable/VariableDeclaration.ts
  93. +15 −12 packages/ts-morph/src/compiler/symbols/Symbol.ts
  94. +2 −2 packages/ts-morph/src/compiler/tools/TypeChecker.ts
  95. +17 −17 packages/ts-morph/src/compiler/types/Type.ts
  96. +4 −4 packages/ts-morph/src/compiler/types/TypeParameter.ts
  97. +1 −0 packages/ts-morph/src/factories/kindToWrapperMappings.ts
  98. +2 −2 packages/ts-morph/src/fileSystem/Directory.ts
  99. +1 −1 packages/ts-morph/src/manipulation/textManipulators/UnwrapTextManipulator.ts
  100. +5 −1 packages/ts-morph/src/structurePrinters/base/ModifierableNodeStructurePrinter.ts
  101. +2 −0 packages/ts-morph/src/structurePrinters/module/NamedImportExportSpecifierStructurePrinter.ts
  102. +1 −0 packages/ts-morph/src/structures/class/PropertyDeclarationStructure.ts
  103. +1 −0 packages/ts-morph/src/structures/module/ExportSpecifierStructure.ts
  104. +1 −0 packages/ts-morph/src/structures/module/ImportSpecifierStructure.ts
  105. +6 −2 packages/ts-morph/src/tests/compiler/ast/base/moduledNodeTests.ts
  106. +2 −1 packages/ts-morph/src/tests/compiler/ast/class/base/classLikeDeclarationBaseTests.ts
  107. +32 −2 packages/ts-morph/src/tests/compiler/ast/class/propertyDeclarationTests.ts
  108. +4 −6 packages/ts-morph/src/tests/compiler/ast/common/nodeTests.ts
  109. +9 −1 packages/ts-morph/src/tests/compiler/ast/function/overloadableNodeTests.ts
  110. +1 −1 packages/ts-morph/src/tests/compiler/ast/module/exportDeclarationTests.ts
  111. +20 −0 packages/ts-morph/src/tests/compiler/ast/module/exportSpecifierTests.ts
  112. +2 −0 packages/ts-morph/src/tests/compiler/ast/module/importDeclarationTests.ts
  113. +25 −0 packages/ts-morph/src/tests/compiler/ast/module/importEqualsDeclarationTests.ts
  114. +19 −0 packages/ts-morph/src/tests/compiler/ast/module/importSpecifierTests.ts
  115. +3 −1 packages/ts-morph/src/tests/compiler/testHelpers/fillStructureWithDefaults.ts
  116. +62 −0 packages/ts-morph/src/tests/compiler/tools/errors.ts
  117. +2 −1 packages/ts-morph/src/tests/structurePrinters/class/propertyDeclarationStructurePrinterTests.ts
  118. +4 −0 ...es/ts-morph/src/tests/structurePrinters/module/namedImportExportSpecifierStructurePrinterTests.ts
  119. +50 −7 packages/ts-morph/wrapped-nodes.md
2 changes: 1 addition & 1 deletion .editorconfig
Original file line number Diff line number Diff line change
@@ -6,5 +6,5 @@ insert_final_newline = true

[*.ts]
indent_style = space
indent_size = 4
indent_size = 2
trim_trailing_whitespace = true
10 changes: 5 additions & 5 deletions deno/bootstrap/ts_morph_bootstrap.js
Original file line number Diff line number Diff line change
@@ -239,14 +239,14 @@ class Project {
return sourceFiles;
}
addSourceFilesFromTsConfig(tsConfigFilePath) {
const resolver = this._getTsConfigResolover(tsConfigFilePath);
const resolver = this._getTsConfigResolver(tsConfigFilePath);
return this._addSourceFilesForTsConfigResolver(resolver, resolver.getCompilerOptions());
}
addSourceFilesFromTsConfigSync(tsConfigFilePath) {
const resolver = this._getTsConfigResolover(tsConfigFilePath);
const resolver = this._getTsConfigResolver(tsConfigFilePath);
return this._addSourceFilesForTsConfigResolverSync(resolver, resolver.getCompilerOptions());
}
_getTsConfigResolover(tsConfigFilePath) {
_getTsConfigResolver(tsConfigFilePath) {
const standardizedFilePath = this._fileSystemWrapper.getStandardizedAbsolutePath(tsConfigFilePath);
return new TsConfigResolver(this._fileSystemWrapper, standardizedFilePath, this.compilerOptions.getEncoding());
}
@@ -327,9 +327,9 @@ class Project {
if (isStandardizedFilePath(filePathOrSearchFunction)) {
return this._sourceFileCache.getSourceFileFromCacheFromFilePath(filePathOrSearchFunction);
}
const allSoureFilesIterable = this.getSourceFiles();
const allSourceFilesIterable = this.getSourceFiles();
return selectSmallestDirPathResult(function* () {
for (const sourceFile of allSoureFilesIterable) {
for (const sourceFile of allSourceFilesIterable) {
if (filePathOrSearchFunction(sourceFile))
yield sourceFile;
}
29 changes: 19 additions & 10 deletions deno/common/ts_morph_common.d.ts
Original file line number Diff line number Diff line change
@@ -347,26 +347,35 @@ export declare function Memoize(target: any, propertyName: string, descriptor: T

/** Collection of helper functions that can be used to throw errors. */
export declare namespace errors {
/**
* Minimal attributes to show a error message with the node source.
*/
interface Node {
getSourceFile(): {
getFilePath(): StandardizedFilePath;
getFullText(): string;
};
getStart(): number;
}
/** Base error class. */
abstract class BaseError extends Error {
readonly message: string;
protected constructor();
}
/** Thrown when there is a problem with a provided argument. */
class ArgumentError extends BaseError {
constructor(argName: string, message: string);
constructor(argName: string, message: string, node?: Node);
}
/** Thrown when an argument is null or whitespace. */
class ArgumentNullOrWhitespaceError extends ArgumentError {
constructor(argName: string);
constructor(argName: string, node?: Node);
}
/** Thrown when an argument is out of range. */
class ArgumentOutOfRangeError extends ArgumentError {
constructor(argName: string, value: number, range: [number, number]);
constructor(argName: string, value: number, range: [number, number], node?: Node);
}
/** Thrown when an argument does not match an expected type. */
class ArgumentTypeError extends ArgumentError {
constructor(argName: string, expectedType: string, actualType: string);
constructor(argName: string, expectedType: string, actualType: string, node?: Node);
}
/** Thrown when a file or directory path was not found. */
class PathNotFoundError extends BaseError {
@@ -384,11 +393,11 @@ export declare namespace errors {
}
/** Thrown when an action was taken that is not allowed. */
class InvalidOperationError extends BaseError {
constructor(message: string);
constructor(message: string, node?: Node);
}
/** Thrown when a certain behaviour or feature has not been implemented. */
class NotImplementedError extends BaseError {
constructor(message?: string);
constructor(message?: string, node?: Node);
}
/** Thrown when an operation is not supported. */
class NotSupportedError extends BaseError {
@@ -433,7 +442,7 @@ export declare namespace errors {
* Gets an error saying that a feature is not implemented for a certain syntax kind.
* @param kind - Syntax kind that isn't implemented.
*/
function throwNotImplementedForSyntaxKindError(kind: ts.SyntaxKind): never;
function throwNotImplementedForSyntaxKindError(kind: ts.SyntaxKind, node?: Node): never;
/**
* Throws an Argument
* @param value
@@ -445,12 +454,12 @@ export declare namespace errors {
* @param value - Value to check.
* @param errorMessage - Error message to throw when not defined.
*/
function throwIfNullOrUndefined<T>(value: T | undefined, errorMessage: string | (() => string)): T;
function throwIfNullOrUndefined<T>(value: T | undefined, errorMessage: string | (() => string), node?: Node): T;
/**
* Throw if the value should have been the never type.
* @param value - Value to check.
*/
function throwNotImplementedForNeverValueError(value: never): never;
function throwNotImplementedForNeverValueError(value: never, sourceNode?: Node): never;
/**
* Throws an error if the actual value does not equal the expected value.
* @param actual - Actual value.
104 changes: 72 additions & 32 deletions deno/common/ts_morph_common.js

Large diffs are not rendered by default.

Loading