diff --git a/package-lock.json b/package-lock.json index a1783f7c28d4..9e65b893bcf6 100644 --- a/package-lock.json +++ b/package-lock.json @@ -8786,17 +8786,72 @@ } }, "node_modules/@ts-morph/common": { - "version": "0.9.2", - "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.9.2.tgz", - "integrity": "sha512-IPyg+c3Am0EBoa63W0f/AKeLrJhvzMzQ4BIvD1baxLopmiHOj1HFTXYxC6e8iTZ+UYtN+/WFM9UyGRnoA20b8g==", + "version": "0.20.0", + "resolved": "https://registry.npmjs.org/@ts-morph/common/-/common-0.20.0.tgz", + "integrity": "sha512-7uKjByfbPpwuzkstL3L5MQyuXPSKdoNG93Fmi2JoDcTf3pEP731JdRFAduRVkOs8oqxPsXKA+ScrWkdQ8t/I+Q==", "optional": true, "dependencies": { - "fast-glob": "^3.2.5", - "minimatch": "^3.0.4", - "mkdirp": "^1.0.4", + "fast-glob": "^3.2.12", + "minimatch": "^7.4.3", + "mkdirp": "^2.1.6", "path-browserify": "^1.0.1" } }, + "node_modules/@ts-morph/common/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "optional": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/@ts-morph/common/node_modules/fast-glob": { + "version": "3.3.1", + "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.3.1.tgz", + "integrity": "sha512-kNFPyjhh5cKjrUltxs+wFx+ZkbRaxxmZ+X0ZU31SOsxCEtP9VPgtq2teZw1DebupL5GmDaNQ6yKMMVcM41iqDg==", + "optional": true, + "dependencies": { + "@nodelib/fs.stat": "^2.0.2", + "@nodelib/fs.walk": "^1.2.3", + "glob-parent": "^5.1.2", + "merge2": "^1.3.0", + "micromatch": "^4.0.4" + }, + "engines": { + "node": ">=8.6.0" + } + }, + "node_modules/@ts-morph/common/node_modules/minimatch": { + "version": "7.4.6", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-7.4.6.tgz", + "integrity": "sha512-sBz8G/YjVniEz6lKPNpKxXwazJe4c19fEfV2GDMX6AjFz+MX9uDWIZW8XreVhkFW3fkIdTv/gxWr/Kks5FFAVw==", + "optional": true, + "dependencies": { + "brace-expansion": "^2.0.1" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, + "node_modules/@ts-morph/common/node_modules/mkdirp": { + "version": "2.1.6", + "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-2.1.6.tgz", + "integrity": "sha512-+hEnITedc8LAtIP9u3HJDFIdcLV2vXP33sqLLIzkv1Db1zO/1OxbvYf0Y1OC/S/Qo5dxHXepofhmxL02PsKe+A==", + "optional": true, + "bin": { + "mkdirp": "dist/cjs/src/bin.js" + }, + "engines": { + "node": ">=10" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" + } + }, "node_modules/@tsconfig/node10": { "version": "1.0.9", "resolved": "https://registry.npmjs.org/@tsconfig/node10/-/node10-1.0.9.tgz", @@ -13046,9 +13101,9 @@ } }, "node_modules/code-block-writer": { - "version": "10.1.1", - "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-10.1.1.tgz", - "integrity": "sha512-67ueh2IRGst/51p0n6FvPrnRjAGHY5F8xdjkgrYE7DDzpJe6qA07RYQ9VcoUeo5ATOjSOiWpSL3SWBRRbempMw==", + "version": "12.0.0", + "resolved": "https://registry.npmjs.org/code-block-writer/-/code-block-writer-12.0.0.tgz", + "integrity": "sha512-q4dMFMlXtKR3XNBHyMHt/3pwYNA69EDk00lloMOaaUMKPUXBw6lpXtbu3MMVG6/uOihGnRDOlkyqsONEUj60+w==", "optional": true }, "node_modules/code-point-at": { @@ -20407,7 +20462,7 @@ "version": "3.2.7", "resolved": "https://registry.npmjs.org/fast-glob/-/fast-glob-3.2.7.tgz", "integrity": "sha512-rYGMRwip6lUMvYD3BTScMwT1HtAs2d71SMv66Vrxs0IekGZEjhM0pcMfjQPnknBt2zeCwQMEupiN02ZP4DiT1Q==", - "devOptional": true, + "dev": true, "dependencies": { "@nodelib/fs.stat": "^2.0.2", "@nodelib/fs.walk": "^1.2.3", @@ -26794,7 +26849,7 @@ "version": "3.0.0", "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.0.0.tgz", "integrity": "sha512-fQzRfAbIBnR0IQvftw9FJveWiHp72Fg20giDrHz6TdfB12UH/uue0D3hm57UB5KgAVuniLMCaS8P1IMj9NR7cA==", - "devOptional": true + "dev": true }, "node_modules/jsonfile": { "version": "6.1.0", @@ -28817,7 +28872,7 @@ "version": "1.0.4", "resolved": "https://registry.npmjs.org/mkdirp/-/mkdirp-1.0.4.tgz", "integrity": "sha512-vVqVZQyf3WLx2Shd0qJ9xuvqgAyKPLAiqITEtqW0oIUjzo3PePDd6fW9iFz30ef7Ysp/oiWqbhszeGWW2T6Gzw==", - "devOptional": true, + "dev": true, "bin": { "mkdirp": "bin/cmd.js" }, @@ -29063,33 +29118,86 @@ "dev": true }, "node_modules/ng-morph": { - "version": "2.2.5", - "resolved": "https://registry.npmjs.org/ng-morph/-/ng-morph-2.2.5.tgz", - "integrity": "sha512-plxrHfcz7aNRcTCxS9tUxI1F5Vfx5CZAAw8NAnJCyCb41Js6S+EyPDvn2v7H2QyfZzXU1H0BAqtiRQv/rE2zTA==", + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/ng-morph/-/ng-morph-4.0.0.tgz", + "integrity": "sha512-+opfMF/33fMQRt38oSPT+fnexZm8c635LaTDKOlAnkaDGRWcOM4EllqLf73m+5+D8gurwYXOkimIzj6Jmpx1cA==", "optional": true, "dependencies": { - "jsonc-parser": "3.0.0", - "minimatch": "3.0.5", + "jsonc-parser": "3.2.0", + "minimatch": "9.0.1", "multimatch": "5.0.0", - "ts-morph": "10.0.2" + "semver": "7.4.0", + "ts-morph": "19.0.0" }, "peerDependencies": { "@angular-devkit/core": ">=11.0.0", - "@angular-devkit/schematics": ">=11.0.0" + "@angular-devkit/schematics": ">=11.0.0", + "tslib": "2.5.3" + } + }, + "node_modules/ng-morph/node_modules/brace-expansion": { + "version": "2.0.1", + "resolved": "https://registry.npmjs.org/brace-expansion/-/brace-expansion-2.0.1.tgz", + "integrity": "sha512-XnAIvQ8eM+kC6aULx6wuQiwVsnzsi9d3WxzV3FpWTGA19F621kwdbsAcFKXgKUHZWsy+mY6iL1sHTxWEFCytDA==", + "optional": true, + "dependencies": { + "balanced-match": "^1.0.0" + } + }, + "node_modules/ng-morph/node_modules/jsonc-parser": { + "version": "3.2.0", + "resolved": "https://registry.npmjs.org/jsonc-parser/-/jsonc-parser-3.2.0.tgz", + "integrity": "sha512-gfFQZrcTc8CnKXp6Y4/CBT3fTc0OVuDofpre4aEeEpSBPV5X5v4+Vmx+8snU7RLPrNHPKSgLxGo9YuQzz20o+w==", + "optional": true + }, + "node_modules/ng-morph/node_modules/lru-cache": { + "version": "6.0.0", + "resolved": "https://registry.npmjs.org/lru-cache/-/lru-cache-6.0.0.tgz", + "integrity": "sha512-Jo6dJ04CmSjuznwJSS3pUeWmd/H0ffTlkXXgwZi+eq1UCmqQwCh+eLsYOYCwY991i2Fah4h1BEMCx4qThGbsiA==", + "optional": true, + "dependencies": { + "yallist": "^4.0.0" + }, + "engines": { + "node": ">=10" } }, "node_modules/ng-morph/node_modules/minimatch": { - "version": "3.0.5", - "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-3.0.5.tgz", - "integrity": "sha512-tUpxzX0VAzJHjLu0xUfFv1gwVp9ba3IOuRAVH2EGuRW8a5emA2FlACLqiT/lDVtS1W+TGNwqz3sWaNyLgDJWuw==", + "version": "9.0.1", + "resolved": "https://registry.npmjs.org/minimatch/-/minimatch-9.0.1.tgz", + "integrity": "sha512-0jWhJpD/MdhPXwPuiRkCbfYfSKp2qnn2eOc279qI7f+osl/l+prKSrvhg157zSYvx/1nmgn2NqdT6k2Z7zSH9w==", "optional": true, "dependencies": { - "brace-expansion": "^1.1.7" + "brace-expansion": "^2.0.1" }, "engines": { - "node": "*" + "node": ">=16 || 14 >=14.17" + }, + "funding": { + "url": "https://github.com/sponsors/isaacs" } }, + "node_modules/ng-morph/node_modules/semver": { + "version": "7.4.0", + "resolved": "https://registry.npmjs.org/semver/-/semver-7.4.0.tgz", + "integrity": "sha512-RgOxM8Mw+7Zus0+zcLEUn8+JfoLpj/huFTItQy2hsM4khuC1HYRDp0cU482Ewn/Fcy6bCjufD8vAj7voC66KQw==", + "optional": true, + "dependencies": { + "lru-cache": "^6.0.0" + }, + "bin": { + "semver": "bin/semver.js" + }, + "engines": { + "node": ">=10" + } + }, + "node_modules/ng-morph/node_modules/yallist": { + "version": "4.0.0", + "resolved": "https://registry.npmjs.org/yallist/-/yallist-4.0.0.tgz", + "integrity": "sha512-3wdGidZyq5PB084XLES5TpOSRA3wjXAlIWMhum2kRcv/41Sn2emQ0dycQW4uZXLejwKvg6EsvbdlVL+FYEct7A==", + "optional": true + }, "node_modules/ng-packagr": { "version": "12.2.7", "resolved": "https://registry.npmjs.org/ng-packagr/-/ng-packagr-12.2.7.tgz", @@ -38833,13 +38941,13 @@ } }, "node_modules/ts-morph": { - "version": "10.0.2", - "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-10.0.2.tgz", - "integrity": "sha512-TVuIfEqtr9dW25K3Jajqpqx7t/zLRFxKu2rXQZSDjTm4MO4lfmuj1hn8WEryjeDDBFcNOCi+yOmYUYR4HucrAg==", + "version": "19.0.0", + "resolved": "https://registry.npmjs.org/ts-morph/-/ts-morph-19.0.0.tgz", + "integrity": "sha512-D6qcpiJdn46tUqV45vr5UGM2dnIEuTGNxVhg0sk5NX11orcouwj6i1bMqZIz2mZTZB1Hcgy7C3oEVhAT+f6mbQ==", "optional": true, "dependencies": { - "@ts-morph/common": "~0.9.0", - "code-block-writer": "^10.1.1" + "@ts-morph/common": "~0.20.0", + "code-block-writer": "^12.0.0" } }, "node_modules/ts-node": { @@ -41378,7 +41486,7 @@ "tslib": "2.6.2" }, "optionalDependencies": { - "ng-morph": "2.2.5", + "ng-morph": "4.0.0", "parse5": "6.0.1" }, "peerDependencies": { diff --git a/projects/cdk/package.json b/projects/cdk/package.json index c13b92f48b65..2fd0235b04ed 100644 --- a/projects/cdk/package.json +++ b/projects/cdk/package.json @@ -30,7 +30,7 @@ "rxjs": ">=6.0.0" }, "optionalDependencies": { - "ng-morph": "2.2.5", + "ng-morph": "4.0.0", "parse5": "6.0.1" }, "ng-update": { diff --git a/projects/cdk/schematics/ng-add/tests/schematic-ng-add-standalone.spec.ts b/projects/cdk/schematics/ng-add/tests/schematic-ng-add-standalone.spec.ts index f9efaba09b52..a54e15c1ce51 100644 --- a/projects/cdk/schematics/ng-add/tests/schematic-ng-add-standalone.spec.ts +++ b/projects/cdk/schematics/ng-add/tests/schematic-ng-add-standalone.spec.ts @@ -285,8 +285,8 @@ import { RouterModule } from '@angular/router'; selector: 'standalone-test-root', templateUrl: './app.template.html', styleUrls: ['./app.component.less'], - providers: [{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}] - }) + providers: [{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}] +}) export class AppComponent { title = 'standalone-test'; }`, diff --git a/projects/cdk/schematics/ng-add/tests/schematic-ng-add.spec.ts b/projects/cdk/schematics/ng-add/tests/schematic-ng-add.spec.ts index aea4de27ab4e..db6d7dfdaa3e 100644 --- a/projects/cdk/schematics/ng-add/tests/schematic-ng-add.spec.ts +++ b/projects/cdk/schematics/ng-add/tests/schematic-ng-add.spec.ts @@ -281,9 +281,9 @@ import {NgModule} from '@angular/core'; import {AppComponent} from './app.component'; @NgModule({declarations: [AppComponent], - imports: [BrowserAnimationsModule, TuiRootModule, TuiDialogModule, TuiAlertModule], - providers: [{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}] - }) + imports: [BrowserAnimationsModule, TuiRootModule, TuiDialogModule, TuiAlertModule], + providers: [{provide: TUI_SANITIZER, useClass: NgDompurifySanitizer}] +}) export class AppModule {} `, ); diff --git a/projects/cdk/schematics/ng-update/steps/rename-types.ts b/projects/cdk/schematics/ng-update/steps/rename-types.ts index 402e0b223378..52bce9352cd6 100644 --- a/projects/cdk/schematics/ng-update/steps/rename-types.ts +++ b/projects/cdk/schematics/ng-update/steps/rename-types.ts @@ -42,7 +42,7 @@ function renameType( if (Node.isImportSpecifier(parent)) { processImport(parent, from, to); - } else if (Node.isTypeReferenceNode(parent)) { + } else if (Node.isTypeReference(parent)) { const targetType = preserveGenerics && to ? addGeneric(to, parent.getTypeArguments()) : to; diff --git a/projects/cdk/schematics/ng-update/steps/replace-enums.ts b/projects/cdk/schematics/ng-update/steps/replace-enums.ts index 1007f22f3dda..1d1ca4f66028 100644 --- a/projects/cdk/schematics/ng-update/steps/replace-enums.ts +++ b/projects/cdk/schematics/ng-update/steps/replace-enums.ts @@ -43,7 +43,7 @@ function replaceEnumWithString( continue; } - if (Node.isTypeReferenceNode(parent) && !keepAsType) { + if (Node.isTypeReference(parent) && !keepAsType) { const declaration = parent.getParent() as VariableDeclaration; declaration.removeType?.(); @@ -66,5 +66,5 @@ function containTypeRef(node: ImportSpecifier): boolean { return node .getNameNode() .findReferencesAsNodes() - .some(ref => Node.isTypeReferenceNode(ref.getParent())); + .some(ref => Node.isTypeReference(ref.getParent())); } diff --git a/projects/cdk/schematics/ng-update/steps/replace-services.ts b/projects/cdk/schematics/ng-update/steps/replace-services.ts index ec7459fd7dd4..23fdb9827604 100644 --- a/projects/cdk/schematics/ng-update/steps/replace-services.ts +++ b/projects/cdk/schematics/ng-update/steps/replace-services.ts @@ -57,7 +57,7 @@ function replaceService( return; } - if (Node.isTypeReferenceNode(parent) && replaceMethods?.length) { + if (Node.isTypeReference(parent) && replaceMethods?.length) { replaceProperties(parent, replaceMethods); } diff --git a/projects/cdk/schematics/ng-update/v3/steps/miscellaneous.ts b/projects/cdk/schematics/ng-update/v3/steps/miscellaneous.ts index 81c554d2ff4f..152c77e099c8 100644 --- a/projects/cdk/schematics/ng-update/v3/steps/miscellaneous.ts +++ b/projects/cdk/schematics/ng-update/v3/steps/miscellaneous.ts @@ -56,7 +56,7 @@ function addWarningToMethod(className: string, method: string, message: string): references.forEach(ref => { const parent = ref.getParent(); - if (Node.isTypeReferenceNode(parent)) { + if (Node.isTypeReference(parent)) { checkMethod(parent, method, message); } }); diff --git a/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-html.spec.ts b/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-html.spec.ts index 5ab9169703d0..c3098369539c 100644 --- a/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-html.spec.ts +++ b/projects/cdk/schematics/ng-update/v3/tests/schematic-replace-html.spec.ts @@ -28,11 +28,11 @@ export class TestComponent {} const COMPONENT_WITH_TEMPLATE_URL_AFTER = `import { TUI_EDITOR_EXTENSIONS, defaultEditorExtensions } from "@taiga-ui/addon-editor"; @Component({templateUrl: './test.template.html', - providers: [{ - provide: TUI_EDITOR_EXTENSIONS, - useValue: defaultEditorExtensions - }] - }) + providers: [{ + provide: TUI_EDITOR_EXTENSIONS, + useValue: defaultEditorExtensions + }] +}) export class TestComponent {} `; diff --git a/projects/cdk/schematics/utils/add-import-to-component.ts b/projects/cdk/schematics/utils/add-import-to-component.ts index d4953e7d7e96..07c2f476dd02 100644 --- a/projects/cdk/schematics/utils/add-import-to-component.ts +++ b/projects/cdk/schematics/utils/add-import-to-component.ts @@ -1,5 +1,4 @@ -import {ClassDeclaration} from 'ng-morph'; -import {pushToArrayProperty} from 'ng-morph/ng/helpers/push-to-array-property'; +import {ClassDeclaration, pushToDecoratorArrayProperty} from 'ng-morph'; // TODO: delete after adding to ng-morph export function addImportToComponent( @@ -7,7 +6,7 @@ export function addImportToComponent( moduleName: string, {unique = true}: {unique?: boolean} = {}, ): void { - pushToArrayProperty(classDeclaration, `Component`, `imports`, moduleName, { + pushToDecoratorArrayProperty(classDeclaration, `Component`, `imports`, moduleName, { unique, forceToArray: true, });