Skip to content

refactor(cdk/schematics): import AST utilities #24968

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Merged
merged 1 commit into from
May 25, 2022
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
6 changes: 3 additions & 3 deletions src/cdk/schematics/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@ export * from './utils';
export * from './ng-update/public-api';
export * from './update-tool/public-api';

// Re-exported so that Angular Material schematic code can consume the
// vendored "@schematics/angular" AST utils.
export * from './utils/vendored-ast-utils';
// Re-exported so that Angular Material schematic code can consume the same AST utils as the CDK.
export * from '@schematics/angular/utility/ast-utils';
export * from '@schematics/angular/utility/ng-ast-utils';

// Re-export parse5 from the CDK. Material schematics code cannot simply import
// "parse5" because it could result in a different version. As long as we import
Expand Down
3 changes: 2 additions & 1 deletion src/cdk/schematics/utils/ast.ts
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,11 @@ import {Schema as ComponentOptions} from '@schematics/angular/component/schema';
import {InsertChange} from '@schematics/angular/utility/change';
import {getWorkspace} from '@schematics/angular/utility/workspace';
import {findModuleFromOptions as internalFindModule} from '@schematics/angular/utility/find-module';
import {addImportToModule} from '@schematics/angular/utility/ast-utils';
import {getAppModulePath} from '@schematics/angular/utility/ng-ast-utils';
import {ProjectDefinition} from '@angular-devkit/core/src/workspace';
import * as ts from 'typescript';
import {getProjectMainFile} from './project-main-file';
import {addImportToModule, getAppModulePath} from './vendored-ast-utils';

/** Reads file given path and returns TypeScript source file. */
export function parseSourceFile(host: Tree, path: string): ts.SourceFile {
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/schematics/utils/ast/standalone.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
import {SchematicsException, Tree} from '@angular-devkit/schematics';
import {InsertChange} from '@schematics/angular/utility/change';
import * as ts from 'typescript';
import {insertImport} from '../vendored-ast-utils';
import {insertImport} from '@schematics/angular/utility/ast-utils';

/**
* Checks whether the providers from a module are being imported in a `bootstrapApplication` call.
Expand Down
2 changes: 1 addition & 1 deletion src/cdk/schematics/utils/build-component.ts
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ import {buildRelativePath, findModuleFromOptions} from '@schematics/angular/util
import {parseName} from '@schematics/angular/utility/parse-name';
import {validateHtmlSelector} from '@schematics/angular/utility/validation';
import {ProjectType} from '@schematics/angular/utility/workspace-models';
import {addDeclarationToModule, addExportToModule} from '@schematics/angular/utility/ast-utils';
import {readFileSync, statSync} from 'fs';
import {dirname, join, resolve} from 'path';
import * as ts from 'typescript';
import {addDeclarationToModule, addExportToModule} from '../utils/vendored-ast-utils';
import {getProjectFromWorkspace} from './get-project';
import {getDefaultComponentOptions} from './schematic-options';
import {ProjectDefinition} from '@angular-devkit/core/src/workspace';
Expand Down
Loading