From 9ab9eed6d028f1d29d62734f9a01f63895be0927 Mon Sep 17 00:00:00 2001 From: David Sherret Date: Sat, 2 Dec 2023 16:35:24 -0500 Subject: [PATCH] fix: missing code generation for v21 release --- deno/ts_morph.d.ts | 10 +- deno/ts_morph.js | 11 +- dprint.json | 1 - package-lock.json | 140 +++++++++--------- package.json | 2 +- packages/scripts/deps.ts | 4 +- packages/ts-morph/lib/ts-morph.d.ts | 10 +- packages/ts-morph/package.json | 2 +- .../createStructurePrinterFactory.ts | 1 + .../ts-morph/src/compiler/ast/common/Node.ts | 7 +- .../src/structures/Structure.generated.ts | 4 +- .../structures/utils/forEachStructureChild.ts | 4 +- packages/ts-morph/wrapped-nodes.md | 31 ++-- 13 files changed, 123 insertions(+), 104 deletions(-) diff --git a/deno/ts_morph.d.ts b/deno/ts_morph.d.ts index e46e277f7..6ad3121e6 100644 --- a/deno/ts_morph.d.ts +++ b/deno/ts_morph.d.ts @@ -3184,6 +3184,8 @@ export declare class Node { static readonly isIdentifier: (node: Node | undefined) => node is Identifier; /** Gets if the node is a IfStatement. */ static readonly isIfStatement: (node: Node | undefined) => node is IfStatement; + /** Gets if the node is a ImportAttribute. */ + static readonly isImportAttribute: (node: Node | undefined) => node is ImportAttribute; /** Gets if the node is a ImportAttributes. */ static readonly isImportAttributes: (node: Node | undefined) => node is ImportAttributes; /** Gets if the node is a ImportClause. */ @@ -4119,8 +4121,8 @@ export declare class Node { static isHeritageClauseable(node: T | undefined): node is HeritageClauseableNode & HeritageClauseableNodeExtensionType & T; /** Gets if the node is a ImplementsClauseableNode. */ static isImplementsClauseable(node: T | undefined): node is ImplementsClauseableNode & ImplementsClauseableNodeExtensionType & T; - /** Gets if the node is a ImportAttribute. */ - static isImportAttribute(node: Node | undefined): node is ImportAttribute; + /** Gets if the node is a ImportAttributeNamedNode. */ + static isImportAttributeNamed(node: T | undefined): node is ImportAttributeNamedNode & ImportAttributeNamedNodeExtensionType & T; /** Gets if the node is a ImportExpression. */ static isImportExpression(node: Node | undefined): node is ImportExpression; /** Gets if the node is a ImportTypeNode. */ @@ -10733,8 +10735,8 @@ export declare const Structure: { readonly isStaticable: (structure: T_21) => structure is T_21 & StaticableNodeStructure; /** Gets if the provided structure is a ImportAttributeStructure. */ readonly isImportAttribute: (structure: unknown) => structure is ImportAttributeStructure; - /** Gets if the provided structure is a ImportAttributeKeyNamedNodeStructure. */ - readonly isImportAttributeKeyNamed: (structure: T_22) => structure is T_22 & ImportAttributeNamedNodeStructure; + /** Gets if the provided structure is a ImportAttributeNamedNodeStructure. */ + readonly isImportAttributeNamed: (structure: T_22) => structure is T_22 & ImportAttributeNamedNodeStructure; /** Gets if the provided structure is a ImportDeclarationStructure. */ readonly isImportDeclaration: (structure: unknown) => structure is ImportDeclarationStructure; /** Gets if the provided structure is a ImportSpecifierStructure. */ diff --git a/deno/ts_morph.js b/deno/ts_morph.js index 3e05bc9c2..17498ac51 100644 --- a/deno/ts_morph.js +++ b/deno/ts_morph.js @@ -4547,7 +4547,8 @@ class Node { return false; } } - static isImportAttribute(node) { + static isImportAttribute = Node.is(SyntaxKind.ImportAttribute); + static isImportAttributeNamed(node) { return node?.getKind() === SyntaxKind.ImportAttribute; } static isImportAttributes = Node.is(SyntaxKind.ImportAttributes); @@ -5176,6 +5177,7 @@ class Node { case SyntaxKind.FunctionExpression: case SyntaxKind.GetAccessor: case SyntaxKind.Identifier: + case SyntaxKind.ImportAttribute: case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.MetaProperty: @@ -5211,6 +5213,7 @@ class Node { case SyntaxKind.FunctionExpression: case SyntaxKind.GetAccessor: case SyntaxKind.Identifier: + case SyntaxKind.ImportAttribute: case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.MetaProperty: @@ -6965,7 +6968,7 @@ const Structure = { isImportAttribute(structure) { return structure?.kind === StructureKind.ImportAttribute; }, - isImportAttributeKeyNamed(structure) { + isImportAttributeNamed(structure) { return structure?.kind === StructureKind.ImportAttribute; }, isImportDeclaration(structure) { @@ -7310,9 +7313,11 @@ function forInterfaceDeclaration(structure, callback) { function forTypeElementMemberedNode(structure, callback) { return forAll(structure.callSignatures, callback, StructureKind.CallSignature) || forAll(structure.constructSignatures, callback, StructureKind.ConstructSignature) + || forAll(structure.getAccessors, callback, StructureKind.GetAccessor) || forAll(structure.indexSignatures, callback, StructureKind.IndexSignature) || forAll(structure.methods, callback, StructureKind.MethodSignature) - || forAll(structure.properties, callback, StructureKind.PropertySignature); + || forAll(structure.properties, callback, StructureKind.PropertySignature) + || forAll(structure.setAccessors, callback, StructureKind.SetAccessor); } function forJSDoc(structure, callback) { return forAll(structure.tags, callback, StructureKind.JSDocTag); diff --git a/dprint.json b/dprint.json index 87c278e3b..cfed43fb7 100644 --- a/dprint.json +++ b/dprint.json @@ -10,7 +10,6 @@ "packages/*/dist/", "packages/*/lib/*.ts", "**/CHANGELOG.md", - "**/wrapped-nodes.md", "packages/ts-morph/src/compiler/ast/common/Node.ts", "./deno", "dist-deno" diff --git a/package-lock.json b/package-lock.json index a172291b0..822aed56b 100644 --- a/package-lock.json +++ b/package-lock.json @@ -14,7 +14,7 @@ "packages/ts-morph" ], "devDependencies": { - "dprint": "^0.43.1" + "dprint": "^0.43.2" } }, "node_modules/@cspotcode/source-map-support": { @@ -29,9 +29,9 @@ } }, "node_modules/@dprint/darwin-arm64": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.43.1.tgz", - "integrity": "sha512-QK7/Eitb4RzrsvM1Y+7qzK6K49BTowr+u8+gwbczAVPiIDyygbJ/0N3wwBskiA86vA4SxDXaTOg4YbAHSZ1toA==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.43.2.tgz", + "integrity": "sha512-EPBM3my8L2Wq+UPjfRepKLsZZe30mipvgT6HdpsT8FXqrvVaHcE5BxQdyu0TH/V7GogmeMXOaiAgH9f5IBkdTg==", "cpu": [ "arm64" ], @@ -42,9 +42,9 @@ ] }, "node_modules/@dprint/darwin-x64": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.43.1.tgz", - "integrity": "sha512-oO7UuxPzQmFtIfHV6RgakD40DaibDVq73ewcFrWSFRNHWkl1MdkgbFIxOIltJUuRVf+yjW9bHGflmImdtl7qsQ==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.43.2.tgz", + "integrity": "sha512-zXabg6PF8g3d0Zc7KS3gj6/w38jO6GqIwHG0fvJh+E1UiSs36xLjLAsyZh7/6wrDu7LfD/g5WOUz1QAfrnO3zQ==", "cpu": [ "x64" ], @@ -55,9 +55,9 @@ ] }, "node_modules/@dprint/linux-arm64-glibc": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.43.1.tgz", - "integrity": "sha512-6hb7p3cp9eW9lpDTY/4WQE1RgG9VuizOXtQCCw2jvML8xnAdO6fAXEs9OtgGvdt5tpwxmLWLUzOBDGdcJE6Q6Q==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.43.2.tgz", + "integrity": "sha512-XV6pXgyT8iKHf/VOB9JVZlU73mTX6vjJ+fLY0c+r9j7Zgjp6kb4JX6mTfeEwTZYBsZUzOmxKj+kno1mfw6dUHg==", "cpu": [ "arm64" ], @@ -68,9 +68,9 @@ ] }, "node_modules/@dprint/linux-arm64-musl": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.43.1.tgz", - "integrity": "sha512-EBs7r04KpB9eBMAtGLa6MXy8m7T6AkoOVcih7qZnFPmDc1d2jbIwf6ctnDlYRWYlof9BMHSiXhJiD863TRx5hA==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.43.2.tgz", + "integrity": "sha512-aaWBIOMncDb0YrRmmNKCs7tf6H26VB0izX2bPIbMiOc50hPuCI28lz1lY+zdwdFKG+1aRkKHkLJtpOjgvmEqCw==", "cpu": [ "arm64" ], @@ -81,9 +81,9 @@ ] }, "node_modules/@dprint/linux-x64-glibc": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.43.1.tgz", - "integrity": "sha512-GDno20hSZBEByu3JVBMzU3ArsFuYj+lBhEFjubSZRDZFadkaLohtEHw/I5Lpd0Pe4+dynMdKyLjA92J6yWy//w==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.43.2.tgz", + "integrity": "sha512-OBJlQCvPCQOgSZvQhTVJbF6mD9Bpz3hhecTZNnU/n83bHX1L3cwu/laws0mQPXOxJvBKpYVgN5ceZelIO0ZKWA==", "cpu": [ "x64" ], @@ -94,9 +94,9 @@ ] }, "node_modules/@dprint/linux-x64-musl": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.43.1.tgz", - "integrity": "sha512-Nrkc+AaM90yMl7VSGLy3xUmIeFflE77PFth/rQaFqUb2D2rS8o6OydAxLDCD+WoYs5m2zlSb0l2M112s1Rxyqw==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.43.2.tgz", + "integrity": "sha512-WVnivencONHhRVfgbKPf95P3ES8DYowBCk80tROg41BBRdP/WJoPWc5Ocm6mhEGEeIpcHol+xvwKkqZkkMxJcg==", "cpu": [ "x64" ], @@ -107,9 +107,9 @@ ] }, "node_modules/@dprint/win32-x64": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.43.1.tgz", - "integrity": "sha512-A5OhpGwNcmUtf7dyZrdrhQLRZEfV5yye7e2I7l4eR48inFEVrsuMDXgLqlR5Xa8fl977z8owvOGOOFYIE5wWzQ==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.43.2.tgz", + "integrity": "sha512-ZboeX4lGZ+MtFyWV/Z9wxV3Re2zb/t6u79V38aKgCWDuy1SzGdxZcCPjEEY17lxwGpzgD5T0VBVdiBQLIy08CQ==", "cpu": [ "x64" ], @@ -841,22 +841,22 @@ } }, "node_modules/dprint": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.43.1.tgz", - "integrity": "sha512-wdxiQehZNCu99g41qZlGP1W+ypGgK20v8MY75qf58SbejOqACJgO2g+xhHes3x1Gn5fNyDxU8gsm2xrTyDby8w==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.43.2.tgz", + "integrity": "sha512-9p/dmiFSkTl3hEvCfNbc/jwVwZp4JE5Bgm0z148QEXU7v+FA2dv0xQooAagWEnCPAQgxYcQhecTxrLanOsyNoA==", "dev": true, "hasInstallScript": true, "bin": { "dprint": "bin.js" }, "optionalDependencies": { - "@dprint/darwin-arm64": "0.43.1", - "@dprint/darwin-x64": "0.43.1", - "@dprint/linux-arm64-glibc": "0.43.1", - "@dprint/linux-arm64-musl": "0.43.1", - "@dprint/linux-x64-glibc": "0.43.1", - "@dprint/linux-x64-musl": "0.43.1", - "@dprint/win32-x64": "0.43.1" + "@dprint/darwin-arm64": "0.43.2", + "@dprint/darwin-x64": "0.43.2", + "@dprint/linux-arm64-glibc": "0.43.2", + "@dprint/linux-arm64-musl": "0.43.2", + "@dprint/linux-x64-glibc": "0.43.2", + "@dprint/linux-x64-musl": "0.43.2", + "@dprint/win32-x64": "0.43.2" } }, "node_modules/eastasianwidth": { @@ -2067,10 +2067,10 @@ }, "packages/bootstrap": { "name": "@ts-morph/bootstrap", - "version": "0.21.0", + "version": "0.22.0", "license": "MIT", "dependencies": { - "@ts-morph/common": "~0.21.0" + "@ts-morph/common": "~0.22.0" }, "devDependencies": { "@rollup/plugin-typescript": "^11.1.5", @@ -2117,7 +2117,7 @@ }, "packages/common": { "name": "@ts-morph/common", - "version": "0.21.0", + "version": "0.22.0", "license": "MIT", "dependencies": { "fast-glob": "^3.3.2", @@ -2169,10 +2169,10 @@ } }, "packages/ts-morph": { - "version": "20.0.0", + "version": "21.0.0", "license": "MIT", "dependencies": { - "@ts-morph/common": "~0.21.0", + "@ts-morph/common": "~0.22.0", "code-block-writer": "^12.0.0" }, "devDependencies": { @@ -2230,51 +2230,51 @@ } }, "@dprint/darwin-arm64": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.43.1.tgz", - "integrity": "sha512-QK7/Eitb4RzrsvM1Y+7qzK6K49BTowr+u8+gwbczAVPiIDyygbJ/0N3wwBskiA86vA4SxDXaTOg4YbAHSZ1toA==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/darwin-arm64/-/darwin-arm64-0.43.2.tgz", + "integrity": "sha512-EPBM3my8L2Wq+UPjfRepKLsZZe30mipvgT6HdpsT8FXqrvVaHcE5BxQdyu0TH/V7GogmeMXOaiAgH9f5IBkdTg==", "dev": true, "optional": true }, "@dprint/darwin-x64": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.43.1.tgz", - "integrity": "sha512-oO7UuxPzQmFtIfHV6RgakD40DaibDVq73ewcFrWSFRNHWkl1MdkgbFIxOIltJUuRVf+yjW9bHGflmImdtl7qsQ==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/darwin-x64/-/darwin-x64-0.43.2.tgz", + "integrity": "sha512-zXabg6PF8g3d0Zc7KS3gj6/w38jO6GqIwHG0fvJh+E1UiSs36xLjLAsyZh7/6wrDu7LfD/g5WOUz1QAfrnO3zQ==", "dev": true, "optional": true }, "@dprint/linux-arm64-glibc": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.43.1.tgz", - "integrity": "sha512-6hb7p3cp9eW9lpDTY/4WQE1RgG9VuizOXtQCCw2jvML8xnAdO6fAXEs9OtgGvdt5tpwxmLWLUzOBDGdcJE6Q6Q==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-glibc/-/linux-arm64-glibc-0.43.2.tgz", + "integrity": "sha512-XV6pXgyT8iKHf/VOB9JVZlU73mTX6vjJ+fLY0c+r9j7Zgjp6kb4JX6mTfeEwTZYBsZUzOmxKj+kno1mfw6dUHg==", "dev": true, "optional": true }, "@dprint/linux-arm64-musl": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.43.1.tgz", - "integrity": "sha512-EBs7r04KpB9eBMAtGLa6MXy8m7T6AkoOVcih7qZnFPmDc1d2jbIwf6ctnDlYRWYlof9BMHSiXhJiD863TRx5hA==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-arm64-musl/-/linux-arm64-musl-0.43.2.tgz", + "integrity": "sha512-aaWBIOMncDb0YrRmmNKCs7tf6H26VB0izX2bPIbMiOc50hPuCI28lz1lY+zdwdFKG+1aRkKHkLJtpOjgvmEqCw==", "dev": true, "optional": true }, "@dprint/linux-x64-glibc": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.43.1.tgz", - "integrity": "sha512-GDno20hSZBEByu3JVBMzU3ArsFuYj+lBhEFjubSZRDZFadkaLohtEHw/I5Lpd0Pe4+dynMdKyLjA92J6yWy//w==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-glibc/-/linux-x64-glibc-0.43.2.tgz", + "integrity": "sha512-OBJlQCvPCQOgSZvQhTVJbF6mD9Bpz3hhecTZNnU/n83bHX1L3cwu/laws0mQPXOxJvBKpYVgN5ceZelIO0ZKWA==", "dev": true, "optional": true }, "@dprint/linux-x64-musl": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.43.1.tgz", - "integrity": "sha512-Nrkc+AaM90yMl7VSGLy3xUmIeFflE77PFth/rQaFqUb2D2rS8o6OydAxLDCD+WoYs5m2zlSb0l2M112s1Rxyqw==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/linux-x64-musl/-/linux-x64-musl-0.43.2.tgz", + "integrity": "sha512-WVnivencONHhRVfgbKPf95P3ES8DYowBCk80tROg41BBRdP/WJoPWc5Ocm6mhEGEeIpcHol+xvwKkqZkkMxJcg==", "dev": true, "optional": true }, "@dprint/win32-x64": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.43.1.tgz", - "integrity": "sha512-A5OhpGwNcmUtf7dyZrdrhQLRZEfV5yye7e2I7l4eR48inFEVrsuMDXgLqlR5Xa8fl977z8owvOGOOFYIE5wWzQ==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/@dprint/win32-x64/-/win32-x64-0.43.2.tgz", + "integrity": "sha512-ZboeX4lGZ+MtFyWV/Z9wxV3Re2zb/t6u79V38aKgCWDuy1SzGdxZcCPjEEY17lxwGpzgD5T0VBVdiBQLIy08CQ==", "dev": true, "optional": true }, @@ -2494,7 +2494,7 @@ "version": "file:packages/bootstrap", "requires": { "@rollup/plugin-typescript": "^11.1.5", - "@ts-morph/common": "~0.21.0", + "@ts-morph/common": "~0.22.0", "@types/chai": "^4.3.11", "@types/mocha": "^10.0.6", "@types/node": "^20.10.0", @@ -2814,18 +2814,18 @@ "dev": true }, "dprint": { - "version": "0.43.1", - "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.43.1.tgz", - "integrity": "sha512-wdxiQehZNCu99g41qZlGP1W+ypGgK20v8MY75qf58SbejOqACJgO2g+xhHes3x1Gn5fNyDxU8gsm2xrTyDby8w==", + "version": "0.43.2", + "resolved": "https://registry.npmjs.org/dprint/-/dprint-0.43.2.tgz", + "integrity": "sha512-9p/dmiFSkTl3hEvCfNbc/jwVwZp4JE5Bgm0z148QEXU7v+FA2dv0xQooAagWEnCPAQgxYcQhecTxrLanOsyNoA==", "dev": true, "requires": { - "@dprint/darwin-arm64": "0.43.1", - "@dprint/darwin-x64": "0.43.1", - "@dprint/linux-arm64-glibc": "0.43.1", - "@dprint/linux-arm64-musl": "0.43.1", - "@dprint/linux-x64-glibc": "0.43.1", - "@dprint/linux-x64-musl": "0.43.1", - "@dprint/win32-x64": "0.43.1" + "@dprint/darwin-arm64": "0.43.2", + "@dprint/darwin-x64": "0.43.2", + "@dprint/linux-arm64-glibc": "0.43.2", + "@dprint/linux-arm64-musl": "0.43.2", + "@dprint/linux-x64-glibc": "0.43.2", + "@dprint/linux-x64-musl": "0.43.2", + "@dprint/win32-x64": "0.43.2" } }, "eastasianwidth": { @@ -3403,7 +3403,7 @@ "version": "file:packages/ts-morph", "requires": { "@rollup/plugin-typescript": "^11.1.5", - "@ts-morph/common": "~0.21.0", + "@ts-morph/common": "~0.22.0", "@types/chai": "^4.3.11", "@types/diff": "^5.0.8", "@types/mocha": "^10.0.6", diff --git a/package.json b/package.json index baff1d392..2dea0bc96 100644 --- a/package.json +++ b/package.json @@ -25,6 +25,6 @@ "packages/ts-morph" ], "devDependencies": { - "dprint": "^0.43.1" + "dprint": "^0.43.2" } } diff --git a/packages/scripts/deps.ts b/packages/scripts/deps.ts index e71376354..505de8af4 100644 --- a/packages/scripts/deps.ts +++ b/packages/scripts/deps.ts @@ -1,2 +1,2 @@ -export * as path from "https://deno.land/std@0.191.0/path/mod.ts"; -export * as tsMorph from "https://deno.land/x/ts_morph@20.0.0/mod.ts"; +export * as path from "https://deno.land/std@0.208.0/path/mod.ts"; +export * as tsMorph from "https://deno.land/x/ts_morph@21.0.0/mod.ts"; diff --git a/packages/ts-morph/lib/ts-morph.d.ts b/packages/ts-morph/lib/ts-morph.d.ts index d0bc4c6ca..50a283822 100644 --- a/packages/ts-morph/lib/ts-morph.d.ts +++ b/packages/ts-morph/lib/ts-morph.d.ts @@ -3184,6 +3184,8 @@ export declare class Node { static readonly isIdentifier: (node: Node | undefined) => node is Identifier; /** Gets if the node is a IfStatement. */ static readonly isIfStatement: (node: Node | undefined) => node is IfStatement; + /** Gets if the node is a ImportAttribute. */ + static readonly isImportAttribute: (node: Node | undefined) => node is ImportAttribute; /** Gets if the node is a ImportAttributes. */ static readonly isImportAttributes: (node: Node | undefined) => node is ImportAttributes; /** Gets if the node is a ImportClause. */ @@ -4119,8 +4121,8 @@ export declare class Node { static isHeritageClauseable(node: T | undefined): node is HeritageClauseableNode & HeritageClauseableNodeExtensionType & T; /** Gets if the node is a ImplementsClauseableNode. */ static isImplementsClauseable(node: T | undefined): node is ImplementsClauseableNode & ImplementsClauseableNodeExtensionType & T; - /** Gets if the node is a ImportAttribute. */ - static isImportAttribute(node: Node | undefined): node is ImportAttribute; + /** Gets if the node is a ImportAttributeNamedNode. */ + static isImportAttributeNamed(node: T | undefined): node is ImportAttributeNamedNode & ImportAttributeNamedNodeExtensionType & T; /** Gets if the node is a ImportExpression. */ static isImportExpression(node: Node | undefined): node is ImportExpression; /** Gets if the node is a ImportTypeNode. */ @@ -10733,8 +10735,8 @@ export declare const Structure: { readonly isStaticable: (structure: T_21) => structure is T_21 & StaticableNodeStructure; /** Gets if the provided structure is a ImportAttributeStructure. */ readonly isImportAttribute: (structure: unknown) => structure is ImportAttributeStructure; - /** Gets if the provided structure is a ImportAttributeKeyNamedNodeStructure. */ - readonly isImportAttributeKeyNamed: (structure: T_22) => structure is T_22 & ImportAttributeNamedNodeStructure; + /** Gets if the provided structure is a ImportAttributeNamedNodeStructure. */ + readonly isImportAttributeNamed: (structure: T_22) => structure is T_22 & ImportAttributeNamedNodeStructure; /** Gets if the provided structure is a ImportDeclarationStructure. */ readonly isImportDeclaration: (structure: unknown) => structure is ImportDeclarationStructure; /** Gets if the provided structure is a ImportSpecifierStructure. */ diff --git a/packages/ts-morph/package.json b/packages/ts-morph/package.json index a1420cad8..660402fc7 100644 --- a/packages/ts-morph/package.json +++ b/packages/ts-morph/package.json @@ -5,7 +5,7 @@ "main": "dist/ts-morph.js", "typings": "lib/ts-morph.d.ts", "scripts": { - "dopublish": "npm run type-check-docs && npm run package && npm run publish-code-verification && echo \"Run: npm publish\"", + "dopublish": "npm run type-check-docs && npm run code-generate && npm run package && npm run publish-code-verification && echo \"Run: npm publish\"", "build": "npm run build:declarations && npm run build:deno && npm run build:node", "build:node": "rimraf dist && rollup -c ", "build:deno": "rimraf dist-deno && rollup -c --environment BUILD:deno && deno run -A scripts/buildDeno.ts", diff --git a/packages/ts-morph/scripts/generation/createStructurePrinterFactory.ts b/packages/ts-morph/scripts/generation/createStructurePrinterFactory.ts index 375b35b2e..3d02c840a 100644 --- a/packages/ts-morph/scripts/generation/createStructurePrinterFactory.ts +++ b/packages/ts-morph/scripts/generation/createStructurePrinterFactory.ts @@ -101,6 +101,7 @@ export function createStructurePrinterFactory(inspector: TsMorphInspector) { case "CommaSeparatedStructuresPrinter": case "CommaNewLineSeparatedStructuresPrinter": case "StringStructurePrinter": + case "GetAndSetAccessorStructurePrinter": return false; } return true; diff --git a/packages/ts-morph/src/compiler/ast/common/Node.ts b/packages/ts-morph/src/compiler/ast/common/Node.ts index 343cdf076..0d6879281 100644 --- a/packages/ts-morph/src/compiler/ast/common/Node.ts +++ b/packages/ts-morph/src/compiler/ast/common/Node.ts @@ -2831,7 +2831,10 @@ export class Node { } /** Gets if the node is a ImportAttribute. */ - static isImportAttribute(node: compiler.Node | undefined): node is compiler.ImportAttribute { + static readonly isImportAttribute: (node: compiler.Node | undefined) => node is compiler.ImportAttribute = Node.is(SyntaxKind.ImportAttribute); + + /** Gets if the node is a ImportAttributeNamedNode. */ + static isImportAttributeNamed(node: T | undefined): node is compiler.ImportAttributeNamedNode & compiler.ImportAttributeNamedNodeExtensionType & T { return node?.getKind() === SyntaxKind.ImportAttribute; } @@ -3665,6 +3668,7 @@ export class Node { case SyntaxKind.FunctionExpression: case SyntaxKind.GetAccessor: case SyntaxKind.Identifier: + case SyntaxKind.ImportAttribute: case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.MetaProperty: @@ -3704,6 +3708,7 @@ export class Node { case SyntaxKind.FunctionExpression: case SyntaxKind.GetAccessor: case SyntaxKind.Identifier: + case SyntaxKind.ImportAttribute: case SyntaxKind.ImportEqualsDeclaration: case SyntaxKind.InterfaceDeclaration: case SyntaxKind.MetaProperty: diff --git a/packages/ts-morph/src/structures/Structure.generated.ts b/packages/ts-morph/src/structures/Structure.generated.ts index adad76c15..5110867b8 100644 --- a/packages/ts-morph/src/structures/Structure.generated.ts +++ b/packages/ts-morph/src/structures/Structure.generated.ts @@ -424,8 +424,8 @@ export const Structure = { isImportAttribute(structure: unknown): structure is ImportAttributeStructure { return (structure as any)?.kind === StructureKind.ImportAttribute; }, - /** Gets if the provided structure is a ImportAttributeKeyNamedNodeStructure. */ - isImportAttributeKeyNamed(structure: T): structure is T & ImportAttributeNamedNodeStructure { + /** Gets if the provided structure is a ImportAttributeNamedNodeStructure. */ + isImportAttributeNamed(structure: T): structure is T & ImportAttributeNamedNodeStructure { return (structure as any)?.kind === StructureKind.ImportAttribute; }, /** Gets if the provided structure is a ImportDeclarationStructure. */ diff --git a/packages/ts-morph/src/structures/utils/forEachStructureChild.ts b/packages/ts-morph/src/structures/utils/forEachStructureChild.ts index 0fb9bf7dc..99f1902e5 100644 --- a/packages/ts-morph/src/structures/utils/forEachStructureChild.ts +++ b/packages/ts-morph/src/structures/utils/forEachStructureChild.ts @@ -258,9 +258,11 @@ function forInterfaceDeclaration(structure: InterfaceDeclarationStru function forTypeElementMemberedNode(structure: TypeElementMemberedNodeStructure, callback: (structure: Structures) => TStructure | void): TStructure | undefined { return forAll(structure.callSignatures, callback, StructureKind.CallSignature) || forAll(structure.constructSignatures, callback, StructureKind.ConstructSignature) + || forAll(structure.getAccessors, callback, StructureKind.GetAccessor) || forAll(structure.indexSignatures, callback, StructureKind.IndexSignature) || forAll(structure.methods, callback, StructureKind.MethodSignature) - || forAll(structure.properties, callback, StructureKind.PropertySignature); + || forAll(structure.properties, callback, StructureKind.PropertySignature) + || forAll(structure.setAccessors, callback, StructureKind.SetAccessor); } /** @generated */ diff --git a/packages/ts-morph/wrapped-nodes.md b/packages/ts-morph/wrapped-nodes.md index bf1d22e31..18abed15b 100644 --- a/packages/ts-morph/wrapped-nodes.md +++ b/packages/ts-morph/wrapped-nodes.md @@ -6,7 +6,7 @@ The disadvantage to a node not being wrapped is that it won't have helper method ## Exist -**Total:** 225 +**Total:** 224 - [ArrayBindingPattern](src/compiler/ast/binding/ArrayBindingPattern.ts) - :heavy_check_mark: elements @@ -24,12 +24,6 @@ The disadvantage to a node not being wrapped is that it won't have helper method - [AsExpression](src/compiler/ast/expression/AsExpression.ts) - :heavy_check_mark: expression - :heavy_check_mark: type -- [AssertClause](src/compiler/ast/module/AssertClause.ts) - - :heavy_check_mark: elements - - :x: multiLine -- [AssertEntry](src/compiler/ast/module/AssertEntry.ts) - - :heavy_check_mark: name - - :heavy_check_mark: value - [AssignmentExpression](src/compiler/ast/expression/AssignmentExpression.ts) - :heavy_check_mark: left - :heavy_check_mark: operatorToken @@ -125,7 +119,8 @@ The disadvantage to a node not being wrapped is that it won't have helper method - :heavy_check_mark: isTypeOnly - :heavy_check_mark: exportClause - :heavy_check_mark: moduleSpecifier - - :heavy_check_mark: assertClause + - :x: assertClause + - :heavy_check_mark: attributes - [ExportSpecifier](src/compiler/ast/module/ExportSpecifier.ts) - :heavy_check_mark: isTypeOnly - :heavy_check_mark: propertyName @@ -177,6 +172,13 @@ The disadvantage to a node not being wrapped is that it won't have helper method - :heavy_check_mark: expression - :heavy_check_mark: thenStatement - :heavy_check_mark: elseStatement +- [ImportAttribute](src/compiler/ast/module/ImportAttribute.ts) + - :heavy_check_mark: name + - :heavy_check_mark: value +- [ImportAttributes](src/compiler/ast/module/ImportAttributes.ts) + - :x: token + - :heavy_check_mark: elements + - :x: multiLine - [ImportClause](src/compiler/ast/module/ImportClause.ts) - :heavy_check_mark: isTypeOnly - :heavy_check_mark: name @@ -185,7 +187,8 @@ The disadvantage to a node not being wrapped is that it won't have helper method - :x: modifiers - :heavy_check_mark: importClause - :heavy_check_mark: moduleSpecifier - - :heavy_check_mark: assertClause + - :x: assertClause + - :heavy_check_mark: attributes - [ImportEqualsDeclaration](src/compiler/ast/module/ImportEqualsDeclaration.ts) - :heavy_check_mark: modifiers - :heavy_check_mark: name @@ -196,13 +199,11 @@ The disadvantage to a node not being wrapped is that it won't have helper method - :heavy_check_mark: propertyName - :heavy_check_mark: name - :heavy_check_mark: isTypeOnly -- [ImportTypeAssertionContainer](src/compiler/ast/type/ImportTypeAssertionContainer.ts) - - :heavy_check_mark: assertClause - - :heavy_check_mark: multiLine - [ImportTypeNode](src/compiler/ast/type/ImportTypeNode.ts) - :x: isTypeOf - :heavy_check_mark: argument - - :heavy_check_mark: assertions + - :x: assertions + - :heavy_check_mark: attributes - :heavy_check_mark: qualifier - [IndexedAccessTypeNode](src/compiler/ast/type/IndexedAccessTypeNode.ts) - :heavy_check_mark: objectType @@ -588,10 +589,12 @@ The disadvantage to a node not being wrapped is that it won't have helper method ## Not Exist -**Total:** 24 +**Total:** 26 - AutoAccessorPropertyDeclaration - FlowContainer +- ImportTypeAssertionContainer +- InstanceofExpression - JSDocContainer - JsxAttributes - JsxTagNamePropertyAccess