@angular/compiler-cli 15.1.1 → 15.2.0-next.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. package/bundles/{chunk-RUBM3IRF.js → chunk-3WT7ICUD.js} +2 -2
  2. package/bundles/{chunk-RUBM3IRF.js.map → chunk-3WT7ICUD.js.map} +0 -0
  3. package/bundles/chunk-NEQOZOZQ.js +2 -2
  4. package/bundles/{chunk-2SEOGDKD.js → chunk-SQCRAYKM.js} +157 -65
  5. package/bundles/chunk-SQCRAYKM.js.map +6 -0
  6. package/bundles/{chunk-P6RV7WPP.js → chunk-TNUB43C4.js} +52 -5
  7. package/bundles/chunk-TNUB43C4.js.map +6 -0
  8. package/bundles/{chunk-SOIGFD6W.js → chunk-UOX4HXHH.js} +3 -3
  9. package/bundles/{chunk-SOIGFD6W.js.map → chunk-UOX4HXHH.js.map} +0 -0
  10. package/bundles/{chunk-ZIYE3XC2.js → chunk-UUYR4OJT.js} +3 -3
  11. package/bundles/{chunk-ZIYE3XC2.js.map → chunk-UUYR4OJT.js.map} +0 -0
  12. package/bundles/index.js +5 -4
  13. package/bundles/index.js.map +1 -1
  14. package/bundles/ngcc/index.js +4 -4
  15. package/bundles/ngcc/main-ngcc.js +4 -4
  16. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +3 -3
  17. package/bundles/private/migrations.js +5 -1
  18. package/bundles/src/bin/ng_xi18n.js +3 -3
  19. package/bundles/src/bin/ngc.js +3 -3
  20. package/bundles_metadata.json +1 -1
  21. package/ngcc/src/packages/build_marker.d.ts +1 -1
  22. package/package.json +2 -2
  23. package/private/migrations.d.ts +1 -0
  24. package/src/ngtsc/metadata/src/api.d.ts +8 -2
  25. package/src/ngtsc/metadata/src/ng_module_index.d.ts +25 -0
  26. package/src/ngtsc/metadata/src/registry.d.ts +1 -1
  27. package/src/ngtsc/typecheck/api/api.d.ts +1 -0
  28. package/src/ngtsc/typecheck/api/checker.d.ts +21 -2
  29. package/src/ngtsc/typecheck/api/scope.d.ts +13 -0
  30. package/src/ngtsc/typecheck/src/checker.d.ts +12 -6
  31. package/bundles/chunk-2SEOGDKD.js.map +0 -6
  32. package/bundles/chunk-P6RV7WPP.js.map +0 -6
@@ -8,7 +8,7 @@
8
8
  import { AbsoluteFsPath } from '../../../src/ngtsc/file_system';
9
9
  import { PackageJsonUpdater } from '../writing/package_json_updater';
10
10
  import { EntryPointPackageJson, PackageJsonFormatProperties } from './entry_point';
11
- export declare const NGCC_VERSION = "15.1.1";
11
+ export declare const NGCC_VERSION = "15.2.0-next.1";
12
12
  /**
13
13
  * Returns true if there is a format in this entry-point that was compiled with an outdated version
14
14
  * of ngcc.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/compiler-cli",
3
- "version": "15.1.1",
3
+ "version": "15.2.0-next.1",
4
4
  "description": "Angular - the compiler CLI for Node.js",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -65,7 +65,7 @@
65
65
  "yargs": "^17.2.1"
66
66
  },
67
67
  "peerDependencies": {
68
- "@angular/compiler": "15.1.1",
68
+ "@angular/compiler": "15.2.0-next.1",
69
69
  "typescript": ">=4.8.2 <5.0"
70
70
  },
71
71
  "repository": {
@@ -13,3 +13,4 @@ export { forwardRefResolver } from '../src/ngtsc/annotations';
13
13
  export { Reference } from '../src/ngtsc/imports';
14
14
  export { DynamicValue, PartialEvaluator, ResolvedValue, ResolvedValueMap, StaticInterpreter } from '../src/ngtsc/partial_evaluator';
15
15
  export { reflectObjectLiteral, TypeScriptReflectionHost } from '../src/ngtsc/reflection';
16
+ export { PotentialImport, PotentialImportKind, PotentialImportMode, TemplateTypeChecker } from '../src/ngtsc/typecheck/api';
@@ -215,10 +215,16 @@ export interface MetadataReader {
215
215
  getPipeMetadata(node: Reference<ClassDeclaration>): PipeMeta | null;
216
216
  }
217
217
  /**
218
- * A MetadataReader which also allows access to the set of all known directive classes.
218
+ * A MetadataReader which also allows access to the set of all known trait classes.
219
219
  */
220
220
  export interface MetadataReaderWithIndex extends MetadataReader {
221
- getKnown(kind: MetaKind): Iterable<ClassDeclaration>;
221
+ getKnown(kind: MetaKind): Array<ClassDeclaration>;
222
+ }
223
+ /**
224
+ * An NgModuleIndex allows access to information about traits exported by NgModules.
225
+ */
226
+ export interface NgModuleIndex {
227
+ getNgModulesExporting(directiveOrPipe: ClassDeclaration): Array<Reference<ClassDeclaration>>;
222
228
  }
223
229
  /**
224
230
  * Registers new metadata for directives, pipes, and modules.
@@ -0,0 +1,25 @@
1
+ /**
2
+ * @license
3
+ * Copyright Google LLC All Rights Reserved.
4
+ *
5
+ * Use of this source code is governed by an MIT-style license that can be
6
+ * found in the LICENSE file at https://angular.io/license
7
+ */
8
+ import { Reference } from '../../imports';
9
+ import { ClassDeclaration } from '../../reflection';
10
+ import { MetadataReader, MetadataReaderWithIndex, NgModuleIndex } from './api';
11
+ /**
12
+ * An index of all NgModules that export or re-export a given trait.
13
+ */
14
+ export declare class NgModuleIndexImpl implements NgModuleIndex {
15
+ private metaReader;
16
+ private localReader;
17
+ constructor(metaReader: MetadataReader, localReader: MetadataReaderWithIndex);
18
+ private ngModuleAuthoritativeReference;
19
+ private typeToExportingModules;
20
+ private indexed;
21
+ private updateWith;
22
+ private index;
23
+ private indexTrait;
24
+ getNgModulesExporting(directiveOrPipe: ClassDeclaration): Array<Reference<ClassDeclaration>>;
25
+ }
@@ -22,7 +22,7 @@ export declare class LocalMetadataRegistry implements MetadataRegistry, Metadata
22
22
  registerDirectiveMetadata(meta: DirectiveMeta): void;
23
23
  registerNgModuleMetadata(meta: NgModuleMeta): void;
24
24
  registerPipeMetadata(meta: PipeMeta): void;
25
- getKnown(kind: MetaKind): Iterable<ClassDeclaration>;
25
+ getKnown(kind: MetaKind): Array<ClassDeclaration>;
26
26
  }
27
27
  /**
28
28
  * A `MetadataRegistry` which registers metadata with multiple delegate `MetadataRegistry`
@@ -22,6 +22,7 @@ export interface TypeCheckableDirectiveMeta extends DirectiveMeta, DirectiveType
22
22
  outputs: ClassPropertyMapping;
23
23
  isStandalone: boolean;
24
24
  hostDirectives: HostDirectiveMeta[] | null;
25
+ decorator: ts.Decorator | null;
25
26
  }
26
27
  export type TemplateId = string & {
27
28
  __brand: 'TemplateId';
@@ -9,9 +9,12 @@ import { AST, LiteralPrimitive, ParseSourceSpan, PropertyRead, SafePropertyRead,
9
9
  import ts from 'typescript';
10
10
  import { AbsoluteFsPath } from '../../../../src/ngtsc/file_system';
11
11
  import { ErrorCode } from '../../diagnostics';
12
+ import { Reference } from '../../imports';
13
+ import { NgModuleMeta, PipeMeta } from '../../metadata';
14
+ import { ClassDeclaration } from '../../reflection';
12
15
  import { FullTemplateMapping, NgTemplateDiagnostic, TypeCheckableDirectiveMeta } from './api';
13
16
  import { GlobalCompletion } from './completion';
14
- import { PotentialDirective, PotentialImport, PotentialPipe } from './scope';
17
+ import { PotentialDirective, PotentialImport, PotentialImportMode, PotentialPipe } from './scope';
15
18
  import { ElementSymbol, Symbol, TcbLocation, TemplateSymbol } from './symbols';
16
19
  /**
17
20
  * Interface to the Angular Template Type Checker to extract diagnostics and intelligence from the
@@ -125,7 +128,7 @@ export interface TemplateTypeChecker {
125
128
  /**
126
129
  * In the context of an Angular trait, generate potential imports for a directive.
127
130
  */
128
- getPotentialImportsFor(directive: PotentialDirective, inComponent: ts.ClassDeclaration): ReadonlyArray<PotentialImport>;
131
+ getPotentialImportsFor(toImport: Reference<ClassDeclaration>, inComponent: ts.ClassDeclaration, importMode: PotentialImportMode): ReadonlyArray<PotentialImport>;
129
132
  /**
130
133
  * Get the primary decorator for an Angular class (such as @Component). This does not work for
131
134
  * `@Injectable`.
@@ -155,6 +158,22 @@ export interface TemplateTypeChecker {
155
158
  * Retrieve the type checking engine's metadata for the given directive class, if available.
156
159
  */
157
160
  getDirectiveMetadata(dir: ts.ClassDeclaration): TypeCheckableDirectiveMeta | null;
161
+ /**
162
+ * Retrieve the type checking engine's metadata for the given NgModule class, if available.
163
+ */
164
+ getNgModuleMetadata(module: ts.ClassDeclaration): NgModuleMeta | null;
165
+ /**
166
+ * Retrieve the type checking engine's metadata for the given pipe class, if available.
167
+ */
168
+ getPipeMetadata(pipe: ts.ClassDeclaration): PipeMeta | null;
169
+ /**
170
+ * Gets the directives that have been used in a component's template.
171
+ */
172
+ getUsedDirectives(component: ts.ClassDeclaration): TypeCheckableDirectiveMeta[] | null;
173
+ /**
174
+ * Gets the pipes that have been used in a component's template.
175
+ */
176
+ getUsedPipes(component: ts.ClassDeclaration): string[] | null;
158
177
  /**
159
178
  * Reset the `TemplateTypeChecker`'s state for the given class, so that it will be recomputed on
160
179
  * the next request.
@@ -73,3 +73,16 @@ export interface PotentialPipe {
73
73
  */
74
74
  isInScope: boolean;
75
75
  }
76
+ /**
77
+ * Possible modes in which to look up a potential import.
78
+ */
79
+ export declare enum PotentialImportMode {
80
+ /** Whether an import is standalone is inferred based on its metadata. */
81
+ Normal = 0,
82
+ /**
83
+ * An import is assumed to be standalone and is imported directly. This is useful for migrations
84
+ * where a declaration wasn't standalone when the program was created, but will become standalone
85
+ * as a part of the migration.
86
+ */
87
+ ForceDirect = 1
88
+ }
@@ -9,14 +9,14 @@ import { AST, LiteralPrimitive, ParseSourceSpan, PropertyRead, SafePropertyRead,
9
9
  import ts from 'typescript';
10
10
  import { ErrorCode } from '../../diagnostics';
11
11
  import { AbsoluteFsPath } from '../../file_system';
12
- import { ReferenceEmitter } from '../../imports';
12
+ import { Reference, ReferenceEmitter } from '../../imports';
13
13
  import { IncrementalBuild } from '../../incremental/api';
14
- import { MetadataReader, MetadataReaderWithIndex } from '../../metadata';
14
+ import { MetadataReader, MetadataReaderWithIndex, NgModuleIndex, NgModuleMeta, PipeMeta } from '../../metadata';
15
15
  import { PerfRecorder } from '../../perf';
16
16
  import { ProgramDriver } from '../../program_driver';
17
- import { ReflectionHost } from '../../reflection';
17
+ import { ClassDeclaration, ReflectionHost } from '../../reflection';
18
18
  import { ComponentScopeReader, TypeCheckScopeRegistry } from '../../scope';
19
- import { ElementSymbol, FullTemplateMapping, GlobalCompletion, NgTemplateDiagnostic, OptimizeFor, PotentialDirective, PotentialImport, PotentialPipe, ProgramTypeCheckAdapter, TcbLocation, TemplateSymbol, TemplateTypeChecker, TypeCheckableDirectiveMeta, TypeCheckingConfig } from '../api';
19
+ import { ElementSymbol, FullTemplateMapping, GlobalCompletion, NgTemplateDiagnostic, OptimizeFor, PotentialDirective, PotentialImport, PotentialImportMode, PotentialPipe, ProgramTypeCheckAdapter, TcbLocation, TemplateSymbol, TemplateTypeChecker, TypeCheckableDirectiveMeta, TypeCheckingConfig } from '../api';
20
20
  import { ShimTypeCheckingData } from './context';
21
21
  import { TemplateSourceManager } from './source';
22
22
  /**
@@ -35,6 +35,7 @@ export declare class TemplateTypeCheckerImpl implements TemplateTypeChecker {
35
35
  private priorBuild;
36
36
  private readonly metaReader;
37
37
  private readonly localMetaReader;
38
+ private readonly ngModuleIndex;
38
39
  private readonly componentScopeReader;
39
40
  private readonly typeCheckScopeRegistry;
40
41
  private readonly perf;
@@ -73,8 +74,10 @@ export declare class TemplateTypeCheckerImpl implements TemplateTypeChecker {
73
74
  */
74
75
  private elementTagCache;
75
76
  private isComplete;
76
- constructor(originalProgram: ts.Program, programDriver: ProgramDriver, typeCheckAdapter: ProgramTypeCheckAdapter, config: TypeCheckingConfig, refEmitter: ReferenceEmitter, reflector: ReflectionHost, compilerHost: Pick<ts.CompilerHost, 'getCanonicalFileName'>, priorBuild: IncrementalBuild<unknown, FileTypeCheckingData>, metaReader: MetadataReader, localMetaReader: MetadataReaderWithIndex, componentScopeReader: ComponentScopeReader, typeCheckScopeRegistry: TypeCheckScopeRegistry, perf: PerfRecorder);
77
+ constructor(originalProgram: ts.Program, programDriver: ProgramDriver, typeCheckAdapter: ProgramTypeCheckAdapter, config: TypeCheckingConfig, refEmitter: ReferenceEmitter, reflector: ReflectionHost, compilerHost: Pick<ts.CompilerHost, 'getCanonicalFileName'>, priorBuild: IncrementalBuild<unknown, FileTypeCheckingData>, metaReader: MetadataReader, localMetaReader: MetadataReaderWithIndex, ngModuleIndex: NgModuleIndex, componentScopeReader: ComponentScopeReader, typeCheckScopeRegistry: TypeCheckScopeRegistry, perf: PerfRecorder);
77
78
  getTemplate(component: ts.ClassDeclaration): TmplAstNode[] | null;
79
+ getUsedDirectives(component: ts.ClassDeclaration): TypeCheckableDirectiveMeta[] | null;
80
+ getUsedPipes(component: ts.ClassDeclaration): string[] | null;
78
81
  private getLatestComponentState;
79
82
  isTrackedTypeCheckFile(filePath: AbsoluteFsPath): boolean;
80
83
  private getFileRecordForTcbLocation;
@@ -119,6 +122,8 @@ export declare class TemplateTypeCheckerImpl implements TemplateTypeChecker {
119
122
  getPotentialTemplateDirectives(component: ts.ClassDeclaration): PotentialDirective[];
120
123
  getPotentialPipes(component: ts.ClassDeclaration): PotentialPipe[];
121
124
  getDirectiveMetadata(dir: ts.ClassDeclaration): TypeCheckableDirectiveMeta | null;
125
+ getNgModuleMetadata(module: ts.ClassDeclaration): NgModuleMeta | null;
126
+ getPipeMetadata(pipe: ts.ClassDeclaration): PipeMeta | null;
122
127
  getPotentialElementTags(component: ts.ClassDeclaration): Map<string, PotentialDirective | null>;
123
128
  getPotentialDomBindings(tagName: string): {
124
129
  attribute: string;
@@ -127,7 +132,8 @@ export declare class TemplateTypeCheckerImpl implements TemplateTypeChecker {
127
132
  getPotentialDomEvents(tagName: string): string[];
128
133
  getPrimaryAngularDecorator(target: ts.ClassDeclaration): ts.Decorator | null;
129
134
  getOwningNgModule(component: ts.ClassDeclaration): ts.ClassDeclaration | null;
130
- getPotentialImportsFor(toImport: PotentialDirective, inContext: ts.ClassDeclaration): ReadonlyArray<PotentialImport>;
135
+ private emit;
136
+ getPotentialImportsFor(toImport: Reference<ClassDeclaration>, inContext: ts.ClassDeclaration, importMode: PotentialImportMode): ReadonlyArray<PotentialImport>;
131
137
  private getScopeData;
132
138
  private scopeDataOfDirectiveMeta;
133
139
  private scopeDataOfPipeMeta;