@angular/compiler-cli 14.0.0-next.9 → 14.0.0-rc.2

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 (102) hide show
  1. package/bundles/{chunk-LX5Q27EF.js → chunk-7J66ZDC5.js} +3 -3
  2. package/bundles/{chunk-LX5Q27EF.js.map → chunk-7J66ZDC5.js.map} +0 -0
  3. package/bundles/{chunk-W6KM7BUM.js → chunk-AKU7LV22.js} +6 -6
  4. package/bundles/{chunk-W6KM7BUM.js.map → chunk-AKU7LV22.js.map} +0 -0
  5. package/bundles/{chunk-WGBFSDVQ.js → chunk-BFPVXDJN.js} +7 -7
  6. package/bundles/{chunk-WGBFSDVQ.js.map → chunk-BFPVXDJN.js.map} +0 -0
  7. package/bundles/{chunk-SNAJD4VP.js → chunk-GGBQTGO6.js} +52 -41
  8. package/bundles/chunk-GGBQTGO6.js.map +6 -0
  9. package/bundles/{chunk-R3C7RFJ4.js → chunk-HMWNYAAE.js} +2 -2
  10. package/bundles/{chunk-R3C7RFJ4.js.map → chunk-HMWNYAAE.js.map} +0 -0
  11. package/bundles/{chunk-T7MYRXIE.js → chunk-MURZUYM7.js} +7 -7
  12. package/bundles/{chunk-T7MYRXIE.js.map → chunk-MURZUYM7.js.map} +0 -0
  13. package/bundles/{chunk-R4NY3TJC.js → chunk-QK4SXRQA.js} +5 -5
  14. package/bundles/{chunk-R4NY3TJC.js.map → chunk-QK4SXRQA.js.map} +0 -0
  15. package/bundles/{chunk-34QUU6SJ.js → chunk-RV5PLZZB.js} +130 -85
  16. package/bundles/chunk-RV5PLZZB.js.map +6 -0
  17. package/bundles/{chunk-UMDDHI5B.js → chunk-SFACRVMZ.js} +27 -26
  18. package/bundles/chunk-SFACRVMZ.js.map +6 -0
  19. package/bundles/{chunk-AGDZS4UG.js → chunk-SYV2KBTF.js} +5 -5
  20. package/bundles/{chunk-AGDZS4UG.js.map → chunk-SYV2KBTF.js.map} +0 -0
  21. package/bundles/{chunk-OLGEBPBY.js → chunk-U2VFXNL7.js} +4 -4
  22. package/bundles/{chunk-OLGEBPBY.js.map → chunk-U2VFXNL7.js.map} +0 -0
  23. package/bundles/{chunk-FJDIFR5C.js → chunk-VEAB5CR7.js} +97 -61
  24. package/bundles/chunk-VEAB5CR7.js.map +6 -0
  25. package/bundles/{chunk-M3IOYIU5.js → chunk-VLER5B3O.js} +1051 -982
  26. package/bundles/chunk-VLER5B3O.js.map +6 -0
  27. package/bundles/{chunk-GYVY4Y2L.js → chunk-VSZPIAX6.js} +1173 -881
  28. package/bundles/chunk-VSZPIAX6.js.map +6 -0
  29. package/bundles/{chunk-2IMT6JFI.js → chunk-ZJCM37WF.js} +6 -6
  30. package/bundles/{chunk-2IMT6JFI.js.map → chunk-ZJCM37WF.js.map} +0 -0
  31. package/bundles/index.js +13 -14
  32. package/bundles/index.js.map +1 -1
  33. package/bundles/linker/babel/index.js +16 -16
  34. package/bundles/linker/babel/index.js.map +1 -1
  35. package/bundles/linker/index.js +4 -4
  36. package/bundles/ngcc/index.js +12 -12
  37. package/bundles/ngcc/main-ngcc.js +13 -13
  38. package/bundles/ngcc/src/execution/cluster/ngcc_cluster_worker.js +13 -13
  39. package/bundles/ngcc/src/locking/lock_file_with_child_process/ngcc_lock_unlocker.js +4 -4
  40. package/bundles/private/bazel.js +1 -1
  41. package/bundles/private/localize.js +3 -3
  42. package/bundles/private/migrations.js +5 -5
  43. package/bundles/private/tooling.js +2 -2
  44. package/bundles/src/bin/ng_xi18n.js +10 -10
  45. package/bundles/src/bin/ngc.js +8 -8
  46. package/bundles_metadata.json +1 -1
  47. package/ngcc/src/dependencies/module_resolver.d.ts +5 -2
  48. package/ngcc/src/execution/cluster/api.d.ts +1 -1
  49. package/ngcc/src/execution/cluster/package_json_updater.d.ts +1 -1
  50. package/ngcc/src/execution/tasks/api.d.ts +2 -2
  51. package/ngcc/src/packages/build_marker.d.ts +1 -1
  52. package/ngcc/src/packages/entry_point.d.ts +1 -7
  53. package/ngcc/src/utils.d.ts +26 -0
  54. package/ngcc/src/writing/package_json_updater.d.ts +2 -1
  55. package/package.json +4 -4
  56. package/src/ngtsc/annotations/common/index.d.ts +1 -0
  57. package/src/ngtsc/annotations/common/src/schema.d.ts +12 -0
  58. package/src/ngtsc/annotations/common/src/util.d.ts +7 -1
  59. package/src/ngtsc/annotations/component/src/handler.d.ts +1 -1
  60. package/src/ngtsc/annotations/component/src/metadata.d.ts +7 -8
  61. package/src/ngtsc/annotations/component/src/resources.d.ts +1 -1
  62. package/src/ngtsc/annotations/ng_module/index.d.ts +1 -0
  63. package/src/ngtsc/annotations/ng_module/src/handler.d.ts +10 -26
  64. package/src/ngtsc/annotations/ng_module/src/module_with_providers.d.ts +26 -0
  65. package/src/ngtsc/core/api/src/adapter.d.ts +12 -1
  66. package/src/ngtsc/core/src/host.d.ts +9 -2
  67. package/src/ngtsc/diagnostics/src/error_code.d.ts +4 -0
  68. package/src/ngtsc/metadata/src/api.d.ts +32 -5
  69. package/src/ngtsc/metadata/src/util.d.ts +1 -0
  70. package/src/ngtsc/partial_evaluator/index.d.ts +1 -0
  71. package/src/ngtsc/partial_evaluator/src/dynamic.d.ts +9 -1
  72. package/src/ngtsc/partial_evaluator/src/interface.d.ts +2 -1
  73. package/src/ngtsc/partial_evaluator/src/result.d.ts +2 -1
  74. package/src/ngtsc/partial_evaluator/src/synthetic.d.ts +19 -0
  75. package/src/ngtsc/program_driver/src/ts_create_program_driver.d.ts +2 -2
  76. package/src/ngtsc/scope/index.d.ts +4 -3
  77. package/src/ngtsc/scope/src/api.d.ts +36 -14
  78. package/src/ngtsc/scope/src/component_scope.d.ts +2 -16
  79. package/src/ngtsc/scope/src/local.d.ts +4 -11
  80. package/src/ngtsc/scope/src/standalone.d.ts +26 -0
  81. package/src/ngtsc/scope/src/typecheck.d.ts +1 -1
  82. package/src/ngtsc/scope/src/util.d.ts +15 -0
  83. package/src/ngtsc/transform/src/compilation.d.ts +3 -1
  84. package/src/ngtsc/typecheck/api/api.d.ts +1 -0
  85. package/src/ngtsc/typecheck/api/checker.d.ts +6 -6
  86. package/src/ngtsc/typecheck/api/completion.d.ts +3 -3
  87. package/src/ngtsc/typecheck/api/context.d.ts +2 -1
  88. package/src/ngtsc/typecheck/api/symbols.d.ts +23 -16
  89. package/src/ngtsc/typecheck/src/checker.d.ts +5 -4
  90. package/src/ngtsc/typecheck/src/completion.d.ts +6 -5
  91. package/src/ngtsc/typecheck/src/context.d.ts +1 -1
  92. package/src/ngtsc/typecheck/src/dom.d.ts +4 -2
  93. package/src/ngtsc/typecheck/src/template_symbol_builder.d.ts +4 -3
  94. package/src/ngtsc/typecheck/src/ts_util.d.ts +7 -0
  95. package/src/ngtsc/typecheck/src/type_check_block.d.ts +2 -1
  96. package/bundles/chunk-34QUU6SJ.js.map +0 -6
  97. package/bundles/chunk-FJDIFR5C.js.map +0 -6
  98. package/bundles/chunk-GYVY4Y2L.js.map +0 -6
  99. package/bundles/chunk-M3IOYIU5.js.map +0 -6
  100. package/bundles/chunk-SNAJD4VP.js.map +0 -6
  101. package/bundles/chunk-UMDDHI5B.js.map +0 -6
  102. package/src/ngtsc/annotations/component/src/scope.d.ts +0 -20
@@ -32,12 +32,12 @@ export declare class DelegatingCompilerHost implements Omit<RequiredDelegations<
32
32
  getEnvironmentVariable: ((name: string) => string | undefined) | undefined;
33
33
  getNewLine: () => string;
34
34
  getParsedCommandLine: ((fileName: string) => ts.ParsedCommandLine | undefined) | undefined;
35
- getSourceFileByPath: ((fileName: string, path: ts.Path, languageVersion: ts.ScriptTarget, onError?: ((message: string) => void) | undefined, shouldCreateNewSourceFile?: boolean | undefined) => ts.SourceFile | undefined) | undefined;
35
+ getSourceFileByPath: ((fileName: string, path: ts.Path, languageVersionOrOptions: ts.ScriptTarget | ts.CreateSourceFileOptions, onError?: ((message: string) => void) | undefined, shouldCreateNewSourceFile?: boolean | undefined) => ts.SourceFile | undefined) | undefined;
36
36
  readDirectory: ((rootDir: string, extensions: readonly string[], excludes: readonly string[] | undefined, includes: readonly string[], depth?: number | undefined) => string[]) | undefined;
37
37
  readFile: (fileName: string) => string | undefined;
38
38
  realpath: ((path: string) => string) | undefined;
39
39
  resolveModuleNames: ((moduleNames: string[], containingFile: string, reusedNames: string[] | undefined, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions, containingSourceFile?: ts.SourceFile | undefined) => (ts.ResolvedModule | undefined)[]) | undefined;
40
- resolveTypeReferenceDirectives: ((typeReferenceDirectiveNames: string[], containingFile: string, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions) => (ts.ResolvedTypeReferenceDirective | undefined)[]) | undefined;
40
+ resolveTypeReferenceDirectives: ((typeReferenceDirectiveNames: string[] | readonly ts.FileReference[], containingFile: string, redirectedReference: ts.ResolvedProjectReference | undefined, options: ts.CompilerOptions, containingFileMode?: ts.ModuleKind.CommonJS | ts.ModuleKind.ESNext | undefined) => (ts.ResolvedTypeReferenceDirective | undefined)[]) | undefined;
41
41
  trace: ((s: string) => void) | undefined;
42
42
  useCaseSensitiveFileNames: () => boolean;
43
43
  getModuleResolutionCache: (() => ts.ModuleResolutionCache | undefined) | undefined;
@@ -6,8 +6,9 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  /// <amd-module name="@angular/compiler-cli/src/ngtsc/scope" />
9
- export { ExportScope, ScopeData } from './src/api';
10
- export { ComponentScopeReader, CompoundComponentScopeReader } from './src/component_scope';
9
+ export { ComponentScopeKind, ComponentScopeReader, ExportScope, LocalModuleScope, ScopeData, StandaloneScope } from './src/api';
10
+ export { CompoundComponentScopeReader } from './src/component_scope';
11
11
  export { DtsModuleScopeResolver, MetadataDtsModuleScopeResolver } from './src/dependency';
12
- export { DeclarationData, LocalModuleScope, LocalModuleScopeRegistry, LocalNgModuleData } from './src/local';
12
+ export { DeclarationData, LocalModuleScopeRegistry, LocalNgModuleData } from './src/local';
13
13
  export { TypeCheckScope, TypeCheckScopeRegistry } from './src/typecheck';
14
+ export { makeNotStandaloneDiagnostic, makeUnknownComponentImportDiagnostic } from './src/util';
@@ -6,25 +6,15 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  /// <amd-module name="@angular/compiler-cli/src/ngtsc/scope/src/api" />
9
- import { Reference } from '../../imports';
10
- import { DirectiveMeta, PipeMeta } from '../../metadata';
9
+ import { SchemaMetadata } from '@angular/compiler';
10
+ import { Reexport, Reference } from '../../imports';
11
+ import { DirectiveMeta, NgModuleMeta, PipeMeta } from '../../metadata';
11
12
  import { ClassDeclaration } from '../../reflection';
12
13
  /**
13
14
  * Data for one of a given NgModule's scopes (either compilation scope or export scopes).
14
15
  */
15
16
  export interface ScopeData {
16
- /**
17
- * Directives in the exported scope of the module.
18
- */
19
- directives: DirectiveMeta[];
20
- /**
21
- * Pipes in the exported scope of the module.
22
- */
23
- pipes: PipeMeta[];
24
- /**
25
- * NgModules which contributed to the scope of the module.
26
- */
27
- ngModules: ClassDeclaration[];
17
+ dependencies: Array<DirectiveMeta | PipeMeta>;
28
18
  /**
29
19
  * Whether some module or component in this scope contains errors and is thus semantically
30
20
  * unreliable.
@@ -55,3 +45,35 @@ export interface RemoteScope {
55
45
  */
56
46
  pipes: Reference[];
57
47
  }
48
+ export declare enum ComponentScopeKind {
49
+ NgModule = 0,
50
+ Standalone = 1
51
+ }
52
+ export interface LocalModuleScope extends ExportScope {
53
+ kind: ComponentScopeKind.NgModule;
54
+ ngModule: ClassDeclaration;
55
+ compilation: ScopeData;
56
+ reexports: Reexport[] | null;
57
+ schemas: SchemaMetadata[];
58
+ }
59
+ export interface StandaloneScope {
60
+ kind: ComponentScopeKind.Standalone;
61
+ dependencies: Array<DirectiveMeta | PipeMeta | NgModuleMeta>;
62
+ component: ClassDeclaration;
63
+ schemas: SchemaMetadata[];
64
+ isPoisoned: boolean;
65
+ }
66
+ export declare type ComponentScope = LocalModuleScope | StandaloneScope;
67
+ /**
68
+ * Read information about the compilation scope of components.
69
+ */
70
+ export interface ComponentScopeReader {
71
+ getScopeForComponent(clazz: ClassDeclaration): ComponentScope | null;
72
+ /**
73
+ * Get the `RemoteScope` required for this component, if any.
74
+ *
75
+ * If the component requires remote scoping, then retrieve the directives/pipes registered for
76
+ * that component. If remote scoping is not required (the common case), returns `null`.
77
+ */
78
+ getRemoteScope(clazz: ClassDeclaration): RemoteScope | null;
79
+ }
@@ -7,21 +7,7 @@
7
7
  * found in the LICENSE file at https://angular.io/license
8
8
  */
9
9
  import { ClassDeclaration } from '../../reflection';
10
- import { RemoteScope } from './api';
11
- import { LocalModuleScope } from './local';
12
- /**
13
- * Read information about the compilation scope of components.
14
- */
15
- export interface ComponentScopeReader {
16
- getScopeForComponent(clazz: ClassDeclaration): LocalModuleScope | null;
17
- /**
18
- * Get the `RemoteScope` required for this component, if any.
19
- *
20
- * If the component requires remote scoping, then retrieve the directives/pipes registered for
21
- * that component. If remote scoping is not required (the common case), returns `null`.
22
- */
23
- getRemoteScope(clazz: ClassDeclaration): RemoteScope | null;
24
- }
10
+ import { ComponentScope, ComponentScopeReader, RemoteScope } from './api';
25
11
  /**
26
12
  * A `ComponentScopeReader` that reads from an ordered set of child readers until it obtains the
27
13
  * requested scope.
@@ -32,6 +18,6 @@ export interface ComponentScopeReader {
32
18
  export declare class CompoundComponentScopeReader implements ComponentScopeReader {
33
19
  private readers;
34
20
  constructor(readers: ComponentScopeReader[]);
35
- getScopeForComponent(clazz: ClassDeclaration): LocalModuleScope | null;
21
+ getScopeForComponent(clazz: ClassDeclaration): ComponentScope | null;
36
22
  getRemoteScope(clazz: ClassDeclaration): RemoteScope | null;
37
23
  }
@@ -6,25 +6,17 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  /// <amd-module name="@angular/compiler-cli/src/ngtsc/scope/src/local" />
9
- import { SchemaMetadata } from '@angular/compiler';
10
9
  import ts from 'typescript';
11
- import { AliasingHost, Reexport, Reference, ReferenceEmitter } from '../../imports';
10
+ import { AliasingHost, Reference, ReferenceEmitter } from '../../imports';
12
11
  import { DirectiveMeta, MetadataReader, MetadataRegistry, NgModuleMeta, PipeMeta } from '../../metadata';
13
12
  import { ClassDeclaration } from '../../reflection';
14
- import { ExportScope, RemoteScope, ScopeData } from './api';
15
- import { ComponentScopeReader } from './component_scope';
13
+ import { ComponentScopeReader, LocalModuleScope, RemoteScope } from './api';
16
14
  import { DtsModuleScopeResolver } from './dependency';
17
15
  export interface LocalNgModuleData {
18
16
  declarations: Reference<ClassDeclaration>[];
19
17
  imports: Reference<ClassDeclaration>[];
20
18
  exports: Reference<ClassDeclaration>[];
21
19
  }
22
- export interface LocalModuleScope extends ExportScope {
23
- ngModule: ClassDeclaration;
24
- compilation: ScopeData;
25
- reexports: Reexport[] | null;
26
- schemas: SchemaMetadata[];
27
- }
28
20
  /**
29
21
  * A registry which collects information about NgModules, Directives, Components, and Pipes which
30
22
  * are local (declared in the ts.Program being compiled), and can produce `LocalModuleScope`s
@@ -46,6 +38,7 @@ export interface LocalModuleScope extends ExportScope {
46
38
  */
47
39
  export declare class LocalModuleScopeRegistry implements MetadataRegistry, ComponentScopeReader {
48
40
  private localReader;
41
+ private fullReader;
49
42
  private dependencyScopeReader;
50
43
  private refEmitter;
51
44
  private aliasingHost;
@@ -91,7 +84,7 @@ export declare class LocalModuleScopeRegistry implements MetadataRegistry, Compo
91
84
  * Tracks which NgModules have directives/pipes that are declared in more than one module.
92
85
  */
93
86
  private modulesWithStructuralErrors;
94
- constructor(localReader: MetadataReader, dependencyScopeReader: DtsModuleScopeResolver, refEmitter: ReferenceEmitter, aliasingHost: AliasingHost | null);
87
+ constructor(localReader: MetadataReader, fullReader: MetadataReader, dependencyScopeReader: DtsModuleScopeResolver, refEmitter: ReferenceEmitter, aliasingHost: AliasingHost | null);
95
88
  /**
96
89
  * Add an NgModule's data to the registry.
97
90
  */
@@ -0,0 +1,26 @@
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
+ /// <amd-module name="@angular/compiler-cli/src/ngtsc/scope/src/standalone" />
9
+ import { MetadataReader } from '../../metadata';
10
+ import { ClassDeclaration } from '../../reflection';
11
+ import { ComponentScopeReader, StandaloneScope } from './api';
12
+ import { DtsModuleScopeResolver } from './dependency';
13
+ import { LocalModuleScopeRegistry } from './local';
14
+ /**
15
+ * Computes scopes for standalone components based on their `imports`, expanding imported NgModule
16
+ * scopes where necessary.
17
+ */
18
+ export declare class StandaloneComponentScopeReader implements ComponentScopeReader {
19
+ private metaReader;
20
+ private localModuleReader;
21
+ private dtsModuleReader;
22
+ private cache;
23
+ constructor(metaReader: MetadataReader, localModuleReader: LocalModuleScopeRegistry, dtsModuleReader: DtsModuleScopeResolver);
24
+ getScopeForComponent(clazz: ClassDeclaration): StandaloneScope | null;
25
+ getRemoteScope(): null;
26
+ }
@@ -11,7 +11,7 @@ import ts from 'typescript';
11
11
  import { Reference } from '../../imports';
12
12
  import { DirectiveMeta, MetadataReader } from '../../metadata';
13
13
  import { ClassDeclaration } from '../../reflection';
14
- import { ComponentScopeReader } from './component_scope';
14
+ import { ComponentScopeReader } from './api';
15
15
  /**
16
16
  * The scope that is used for type-check code generation of a component template.
17
17
  */
@@ -0,0 +1,15 @@
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
+ /// <amd-module name="@angular/compiler-cli/src/ngtsc/scope/src/util" />
9
+ import ts from 'typescript';
10
+ import { Reference } from '../../imports';
11
+ import { ClassDeclaration } from '../../reflection';
12
+ import { ComponentScopeReader } from './api';
13
+ export declare function getDiagnosticNode(ref: Reference<ClassDeclaration>, rawExpr: ts.Expression | null): ts.Expression;
14
+ export declare function makeNotStandaloneDiagnostic(scopeReader: ComponentScopeReader, ref: Reference<ClassDeclaration>, rawExpr: ts.Expression | null, kind: 'component' | 'directive' | 'pipe'): ts.Diagnostic;
15
+ export declare function makeUnknownComponentImportDiagnostic(ref: Reference<ClassDeclaration>, rawExpr: ts.Expression): ts.DiagnosticWithLocation;
@@ -8,6 +8,7 @@
8
8
  /// <amd-module name="@angular/compiler-cli/src/ngtsc/transform/src/compilation" />
9
9
  import { ConstantPool } from '@angular/compiler';
10
10
  import ts from 'typescript';
11
+ import { SourceFileTypeIdentifier } from '../../core/api';
11
12
  import { IncrementalBuild } from '../../incremental/api';
12
13
  import { SemanticDepGraphUpdater, SemanticSymbol } from '../../incremental/semantic_graph';
13
14
  import { IndexingContext } from '../../indexer';
@@ -65,6 +66,7 @@ export declare class TraitCompiler implements ProgramTypeCheckAdapter {
65
66
  private compilationMode;
66
67
  private dtsTransforms;
67
68
  private semanticDepGraphUpdater;
69
+ private sourceFileTypeIdentifier;
68
70
  /**
69
71
  * Maps class declarations to their `ClassRecord`, which tracks the Ivy traits being applied to
70
72
  * those classes.
@@ -82,7 +84,7 @@ export declare class TraitCompiler implements ProgramTypeCheckAdapter {
82
84
  protected filesWithoutTraits: Set<ts.SourceFile>;
83
85
  private reexportMap;
84
86
  private handlersByName;
85
- constructor(handlers: DecoratorHandler<unknown, unknown, SemanticSymbol | null, unknown>[], reflector: ReflectionHost, perf: PerfRecorder, incrementalBuild: IncrementalBuild<ClassRecord, unknown>, compileNonExportedClasses: boolean, compilationMode: CompilationMode, dtsTransforms: DtsTransformRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null);
87
+ constructor(handlers: DecoratorHandler<unknown, unknown, SemanticSymbol | null, unknown>[], reflector: ReflectionHost, perf: PerfRecorder, incrementalBuild: IncrementalBuild<ClassRecord, unknown>, compileNonExportedClasses: boolean, compilationMode: CompilationMode, dtsTransforms: DtsTransformRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, sourceFileTypeIdentifier: SourceFileTypeIdentifier);
86
88
  analyzeSync(sf: ts.SourceFile): void;
87
89
  analyzeAsync(sf: ts.SourceFile): Promise<void> | undefined;
88
90
  private analyze;
@@ -65,6 +65,7 @@ export interface TypeCheckBlockMetadata {
65
65
  * Schemas that apply to this template.
66
66
  */
67
67
  schemas: SchemaMetadata[];
68
+ isStandalone: boolean;
68
69
  }
69
70
  export interface TypeCtorMetadata {
70
71
  /**
@@ -13,7 +13,7 @@ import { ErrorCode } from '../../diagnostics';
13
13
  import { FullTemplateMapping, NgTemplateDiagnostic, TypeCheckableDirectiveMeta } from './api';
14
14
  import { GlobalCompletion } from './completion';
15
15
  import { DirectiveInScope, PipeInScope } from './scope';
16
- import { ElementSymbol, ShimLocation, Symbol, TemplateSymbol } from './symbols';
16
+ import { ElementSymbol, Symbol, TcbLocation, TemplateSymbol } from './symbols';
17
17
  /**
18
18
  * Interface to the Angular Template Type Checker to extract diagnostics and intelligence from the
19
19
  * compiler's understanding of component templates.
@@ -51,7 +51,7 @@ export interface TemplateTypeChecker {
51
51
  * Given a `shim` and position within the file, returns information for mapping back to a template
52
52
  * location.
53
53
  */
54
- getTemplateMappingAtShimLocation(shimLocation: ShimLocation): FullTemplateMapping | null;
54
+ getTemplateMappingAtTcbLocation(tcbLocation: TcbLocation): FullTemplateMapping | null;
55
55
  /**
56
56
  * Get all `ts.Diagnostic`s currently available that pertain to the given component.
57
57
  *
@@ -98,16 +98,16 @@ export interface TemplateTypeChecker {
98
98
  */
99
99
  getGlobalCompletions(context: TmplAstTemplate | null, component: ts.ClassDeclaration, node: AST | TmplAstNode): GlobalCompletion | null;
100
100
  /**
101
- * For the given expression node, retrieve a `ShimLocation` that can be used to perform
101
+ * For the given expression node, retrieve a `TcbLocation` that can be used to perform
102
102
  * autocompletion at that point in the expression, if such a location exists.
103
103
  */
104
- getExpressionCompletionLocation(expr: PropertyRead | SafePropertyRead, component: ts.ClassDeclaration): ShimLocation | null;
104
+ getExpressionCompletionLocation(expr: PropertyRead | SafePropertyRead, component: ts.ClassDeclaration): TcbLocation | null;
105
105
  /**
106
106
  * For the given node represents a `LiteralPrimitive`(the `TextAttribute` represents a string
107
- * literal), retrieve a `ShimLocation` that can be used to perform autocompletion at that point in
107
+ * literal), retrieve a `TcbLocation` that can be used to perform autocompletion at that point in
108
108
  * the node, if such a location exists.
109
109
  */
110
- getLiteralCompletionLocation(strNode: LiteralPrimitive | TmplAstTextAttribute, component: ts.ClassDeclaration): ShimLocation | null;
110
+ getLiteralCompletionLocation(strNode: LiteralPrimitive | TmplAstTextAttribute, component: ts.ClassDeclaration): TcbLocation | null;
111
111
  /**
112
112
  * Get basic metadata on the directives which are in scope for the given component.
113
113
  */
@@ -7,7 +7,7 @@
7
7
  */
8
8
  /// <amd-module name="@angular/compiler-cli/src/ngtsc/typecheck/api/completion" />
9
9
  import { TmplAstReference, TmplAstVariable } from '@angular/compiler';
10
- import { ShimLocation } from './symbols';
10
+ import { TcbLocation } from './symbols';
11
11
  /**
12
12
  * An autocompletion source of any kind.
13
13
  */
@@ -51,7 +51,7 @@ export interface GlobalCompletion {
51
51
  * A location within the type-checking shim where TypeScript's completion APIs can be used to
52
52
  * access completions for the template's component context (component class members).
53
53
  */
54
- componentContext: ShimLocation;
54
+ componentContext: TcbLocation;
55
55
  /**
56
56
  * `Map` of local references and variables that are visible at the requested level of the
57
57
  * template.
@@ -65,5 +65,5 @@ export interface GlobalCompletion {
65
65
  * A location within the type-checking shim where TypeScript's completion APIs can be used to
66
66
  * access completions for the AST node of the cursor position (primitive constants).
67
67
  */
68
- nodeContext: ShimLocation | null;
68
+ nodeContext: TcbLocation | null;
69
69
  }
@@ -33,8 +33,9 @@ export interface TypeCheckContext {
33
33
  * template text described by the AST.
34
34
  * @param file the `ParseSourceFile` associated with the template.
35
35
  * @param parseErrors the `ParseError`'s associated with the template.
36
+ * @param isStandalone a boolean indicating whether the component is standalone.
36
37
  */
37
- addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], sourceMapping: TemplateSourceMapping, file: ParseSourceFile, parseErrors: ParseError[] | null): void;
38
+ addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], sourceMapping: TemplateSourceMapping, file: ParseSourceFile, parseErrors: ParseError[] | null, isStandalone: boolean): void;
38
39
  }
39
40
  /**
40
41
  * Interface to trigger generation of type-checking code for a program given a new
@@ -32,15 +32,22 @@ export declare type Symbol = InputBindingSymbol | OutputBindingSymbol | ElementS
32
32
  * A `Symbol` which declares a new named entity in the template scope.
33
33
  */
34
34
  export declare type TemplateDeclarationSymbol = ReferenceSymbol | VariableSymbol;
35
- /** Information about where a `ts.Node` can be found in the type check block shim file. */
36
- export interface ShimLocation {
35
+ /**
36
+ * Information about where a `ts.Node` can be found in the type check file. This can either be
37
+ * a type-checking shim file, or an original source file for inline type check blocks.
38
+ */
39
+ export interface TcbLocation {
37
40
  /**
38
41
  * The fully qualified path of the file which contains the generated TypeScript type check
39
42
  * code for the component's template.
40
43
  */
41
- shimPath: AbsoluteFsPath;
42
- /** The location in the shim file where node appears. */
43
- positionInShimFile: number;
44
+ tcbPath: AbsoluteFsPath;
45
+ /**
46
+ * Whether the type check block exists in a type-checking shim file or is inline.
47
+ */
48
+ isShimFile: boolean;
49
+ /** The location in the file where node appears. */
50
+ positionInFile: number;
44
51
  }
45
52
  /**
46
53
  * A generic representation of some node in a template.
@@ -51,7 +58,7 @@ export interface TsNodeSymbolInfo {
51
58
  /** The `ts.Symbol` for the template node */
52
59
  tsSymbol: ts.Symbol | null;
53
60
  /** The position of the most relevant part of the template node. */
54
- shimLocation: ShimLocation;
61
+ tcbLocation: TcbLocation;
55
62
  }
56
63
  /**
57
64
  * A representation of an expression in a component template.
@@ -66,7 +73,7 @@ export interface ExpressionSymbol {
66
73
  */
67
74
  tsSymbol: ts.Symbol | null;
68
75
  /** The position of the most relevant part of the expression. */
69
- shimLocation: ShimLocation;
76
+ tcbLocation: TcbLocation;
70
77
  }
71
78
  /** Represents either an input or output binding in a template. */
72
79
  export interface BindingSymbol {
@@ -81,7 +88,7 @@ export interface BindingSymbol {
81
88
  */
82
89
  target: DirectiveSymbol | ElementSymbol | TemplateSymbol;
83
90
  /** The location in the shim file where the field access for the binding appears. */
84
- shimLocation: ShimLocation;
91
+ tcbLocation: TcbLocation;
85
92
  }
86
93
  /**
87
94
  * A representation of an input binding in a component template.
@@ -141,14 +148,14 @@ export interface ReferenceSymbol {
141
148
  * ```
142
149
  * This `targetLocation` is `[_t1 variable declaration].getStart()`.
143
150
  */
144
- targetLocation: ShimLocation;
151
+ targetLocation: TcbLocation;
145
152
  /**
146
153
  * The location in the TCB for the identifier node in the reference variable declaration.
147
154
  * For example, given a variable declaration statement for a template reference:
148
155
  * `var _t2 = _t1`, this location is `[_t2 node].getStart()`. This location can
149
156
  * be used to find references to the variable within the template.
150
157
  */
151
- referenceVarLocation: ShimLocation;
158
+ referenceVarLocation: TcbLocation;
152
159
  }
153
160
  /**
154
161
  * A representation of a context variable in a component template.
@@ -175,12 +182,12 @@ export interface VariableSymbol {
175
182
  /**
176
183
  * The location in the shim file for the identifier that was declared for the template variable.
177
184
  */
178
- localVarLocation: ShimLocation;
185
+ localVarLocation: TcbLocation;
179
186
  /**
180
187
  * The location in the shim file for the initializer node of the variable that represents the
181
188
  * template variable.
182
189
  */
183
- initializerLocation: ShimLocation;
190
+ initializerLocation: TcbLocation;
184
191
  }
185
192
  /**
186
193
  * A representation of an element in a component template.
@@ -194,7 +201,7 @@ export interface ElementSymbol {
194
201
  /** A list of directives applied to the element. */
195
202
  directives: DirectiveSymbol[];
196
203
  /** The location in the shim file for the variable that holds the type of the element. */
197
- shimLocation: ShimLocation;
204
+ tcbLocation: TcbLocation;
198
205
  templateNode: TmplAstElement;
199
206
  }
200
207
  export interface TemplateSymbol {
@@ -212,7 +219,7 @@ export interface DirectiveSymbol extends DirectiveInScope {
212
219
  /** The `ts.Type` for the class declaration. */
213
220
  tsType: ts.Type;
214
221
  /** The location in the shim file for the variable that holds the type of the directive. */
215
- shimLocation: ShimLocation;
222
+ tcbLocation: TcbLocation;
216
223
  }
217
224
  /**
218
225
  * A representation of an attribute on an element or template. These bindings aren't currently
@@ -237,7 +244,7 @@ export interface PipeSymbol {
237
244
  */
238
245
  tsSymbol: ts.Symbol | null;
239
246
  /** The position of the transform call in the template. */
240
- shimLocation: ShimLocation;
247
+ tcbLocation: TcbLocation;
241
248
  /** The symbol for the pipe class as an instance that appears in the TCB. */
242
249
  classSymbol: ClassSymbol;
243
250
  }
@@ -248,5 +255,5 @@ export interface ClassSymbol {
248
255
  /** The `ts.Symbol` for class. */
249
256
  tsSymbol: SymbolWithValueDeclaration;
250
257
  /** The position for the variable declaration for the class instance. */
251
- shimLocation: ShimLocation;
258
+ tcbLocation: TcbLocation;
252
259
  }
@@ -16,7 +16,7 @@ import { PerfRecorder } from '../../perf';
16
16
  import { ProgramDriver } from '../../program_driver';
17
17
  import { ReflectionHost } from '../../reflection';
18
18
  import { ComponentScopeReader, TypeCheckScopeRegistry } from '../../scope';
19
- import { DirectiveInScope, ElementSymbol, FullTemplateMapping, GlobalCompletion, NgTemplateDiagnostic, OptimizeFor, PipeInScope, ProgramTypeCheckAdapter, ShimLocation, TemplateSymbol, TemplateTypeChecker, TypeCheckableDirectiveMeta, TypeCheckingConfig } from '../api';
19
+ import { DirectiveInScope, ElementSymbol, FullTemplateMapping, GlobalCompletion, NgTemplateDiagnostic, OptimizeFor, PipeInScope, ProgramTypeCheckAdapter, TcbLocation, TemplateSymbol, TemplateTypeChecker, TypeCheckableDirectiveMeta, TypeCheckingConfig } from '../api';
20
20
  import { ShimTypeCheckingData } from './context';
21
21
  import { TemplateSourceManager } from './source';
22
22
  /**
@@ -75,8 +75,9 @@ export declare class TemplateTypeCheckerImpl implements TemplateTypeChecker {
75
75
  getTemplate(component: ts.ClassDeclaration): TmplAstNode[] | null;
76
76
  private getLatestComponentState;
77
77
  isTrackedTypeCheckFile(filePath: AbsoluteFsPath): boolean;
78
+ private getFileRecordForTcbLocation;
78
79
  private getFileAndShimRecordsForPath;
79
- getTemplateMappingAtShimLocation({ shimPath, positionInShimFile }: ShimLocation): FullTemplateMapping | null;
80
+ getTemplateMappingAtTcbLocation(tcbLocation: TcbLocation): FullTemplateMapping | null;
80
81
  generateAllTypeCheckBlocks(): void;
81
82
  /**
82
83
  * Retrieve type-checking and template parse diagnostics from the given `ts.SourceFile` using the
@@ -86,8 +87,8 @@ export declare class TemplateTypeCheckerImpl implements TemplateTypeChecker {
86
87
  getDiagnosticsForComponent(component: ts.ClassDeclaration): ts.Diagnostic[];
87
88
  getTypeCheckBlock(component: ts.ClassDeclaration): ts.Node | null;
88
89
  getGlobalCompletions(context: TmplAstTemplate | null, component: ts.ClassDeclaration, node: AST | TmplAstNode): GlobalCompletion | null;
89
- getExpressionCompletionLocation(ast: PropertyRead | SafePropertyRead, component: ts.ClassDeclaration): ShimLocation | null;
90
- getLiteralCompletionLocation(node: LiteralPrimitive | TmplAstTextAttribute, component: ts.ClassDeclaration): ShimLocation | null;
90
+ getExpressionCompletionLocation(ast: PropertyRead | SafePropertyRead, component: ts.ClassDeclaration): TcbLocation | null;
91
+ getLiteralCompletionLocation(node: LiteralPrimitive | TmplAstTextAttribute, component: ts.ClassDeclaration): TcbLocation | null;
91
92
  invalidateClass(clazz: ts.ClassDeclaration): void;
92
93
  makeTemplateDiagnostic<T extends ErrorCode>(clazz: ts.ClassDeclaration, sourceSpan: ParseSourceSpan, category: ts.DiagnosticCategory, errorCode: T, message: string, relatedInformation?: {
93
94
  text: string;
@@ -9,7 +9,7 @@
9
9
  import { AST, LiteralPrimitive, PropertyRead, PropertyWrite, SafePropertyRead, TmplAstNode, TmplAstTemplate, TmplAstTextAttribute } from '@angular/compiler';
10
10
  import ts from 'typescript';
11
11
  import { AbsoluteFsPath } from '../../file_system';
12
- import { GlobalCompletion, ShimLocation } from '../api';
12
+ import { GlobalCompletion, TcbLocation } from '../api';
13
13
  import { TemplateData } from './context';
14
14
  /**
15
15
  * Powers autocompletion for a specific component.
@@ -20,7 +20,8 @@ import { TemplateData } from './context';
20
20
  export declare class CompletionEngine {
21
21
  private tcb;
22
22
  private data;
23
- private shimPath;
23
+ private tcbPath;
24
+ private tcbIsShim;
24
25
  private componentContext;
25
26
  /**
26
27
  * Cache of completions for various levels of the template, including the root template (`null`).
@@ -28,7 +29,7 @@ export declare class CompletionEngine {
28
29
  */
29
30
  private templateContextCache;
30
31
  private expressionCompletionCache;
31
- constructor(tcb: ts.Node, data: TemplateData, shimPath: AbsoluteFsPath);
32
+ constructor(tcb: ts.Node, data: TemplateData, tcbPath: AbsoluteFsPath, tcbIsShim: boolean);
32
33
  /**
33
34
  * Get global completions within the given template context and AST node.
34
35
  *
@@ -38,8 +39,8 @@ export declare class CompletionEngine {
38
39
  * @param node the given AST node
39
40
  */
40
41
  getGlobalCompletions(context: TmplAstTemplate | null, node: AST | TmplAstNode): GlobalCompletion | null;
41
- getExpressionCompletionLocation(expr: PropertyRead | PropertyWrite | SafePropertyRead): ShimLocation | null;
42
- getLiteralCompletionLocation(expr: LiteralPrimitive | TmplAstTextAttribute): ShimLocation | null;
42
+ getExpressionCompletionLocation(expr: PropertyRead | PropertyWrite | SafePropertyRead): TcbLocation | null;
43
+ getLiteralCompletionLocation(expr: LiteralPrimitive | TmplAstTextAttribute): TcbLocation | null;
43
44
  /**
44
45
  * Get global completions within the given template context - either a `TmplAstTemplate` embedded
45
46
  * view, or `null` for the root context.
@@ -167,7 +167,7 @@ export declare class TypeCheckContextImpl implements TypeCheckContext {
167
167
  *
168
168
  * Implements `TypeCheckContext.addTemplate`.
169
169
  */
170
- addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], sourceMapping: TemplateSourceMapping, file: ParseSourceFile, parseErrors: ParseError[] | null): void;
170
+ addTemplate(ref: Reference<ClassDeclaration<ts.ClassDeclaration>>, binder: R3TargetBinder<TypeCheckableDirectiveMeta>, template: TmplAstNode[], pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], sourceMapping: TemplateSourceMapping, file: ParseSourceFile, parseErrors: ParseError[] | null, isStandalone: boolean): void;
171
171
  /**
172
172
  * Record a type constructor for the given `node` with the given `ctorMetadata`.
173
173
  */
@@ -31,8 +31,10 @@ export interface DomSchemaChecker {
31
31
  * @param element the element node in question.
32
32
  * @param schemas any active schemas for the template, which might affect the validity of the
33
33
  * element.
34
+ * @param hostIsStandalone boolean indicating whether the element's host is a standalone
35
+ * component.
34
36
  */
35
- checkElement(id: string, element: TmplAstElement, schemas: SchemaMetadata[]): void;
37
+ checkElement(id: string, element: TmplAstElement, schemas: SchemaMetadata[], hostIsStandalone: boolean): void;
36
38
  /**
37
39
  * Check a property binding on an element and record any diagnostics about it.
38
40
  *
@@ -55,6 +57,6 @@ export declare class RegistryDomSchemaChecker implements DomSchemaChecker {
55
57
  private _diagnostics;
56
58
  get diagnostics(): ReadonlyArray<TemplateDiagnostic>;
57
59
  constructor(resolver: TemplateSourceResolver);
58
- checkElement(id: TemplateId, element: TmplAstElement, schemas: SchemaMetadata[]): void;
60
+ checkElement(id: TemplateId, element: TmplAstElement, schemas: SchemaMetadata[], hostIsStandalone: boolean): void;
59
61
  checkProperty(id: TemplateId, element: TmplAstElement, name: string, span: ParseSourceSpan, schemas: SchemaMetadata[]): void;
60
62
  }
@@ -19,13 +19,14 @@ import { TemplateData } from './context';
19
19
  * replaced if the component's template changes.
20
20
  */
21
21
  export declare class SymbolBuilder {
22
- private readonly shimPath;
22
+ private readonly tcbPath;
23
+ private readonly tcbIsShim;
23
24
  private readonly typeCheckBlock;
24
25
  private readonly templateData;
25
26
  private readonly componentScopeReader;
26
27
  private readonly getTypeChecker;
27
28
  private symbolCache;
28
- constructor(shimPath: AbsoluteFsPath, typeCheckBlock: ts.Node, templateData: TemplateData, componentScopeReader: ComponentScopeReader, getTypeChecker: () => ts.TypeChecker);
29
+ constructor(tcbPath: AbsoluteFsPath, tcbIsShim: boolean, typeCheckBlock: ts.Node, templateData: TemplateData, componentScopeReader: ComponentScopeReader, getTypeChecker: () => ts.TypeChecker);
29
30
  getSymbol(node: TmplAstTemplate | TmplAstElement): TemplateSymbol | ElementSymbol | null;
30
31
  getSymbol(node: TmplAstReference | TmplAstVariable): ReferenceSymbol | VariableSymbol | null;
31
32
  getSymbol(node: AST | TmplAstNode): Symbol | null;
@@ -42,5 +43,5 @@ export declare class SymbolBuilder {
42
43
  private getSymbolOfPipe;
43
44
  private getSymbolOfTemplateExpression;
44
45
  private getSymbolOfTsNode;
45
- private getShimPositionForNode;
46
+ private getTcbPositionForNode;
46
47
  }
@@ -45,6 +45,13 @@ export declare function tsCreateVariable(id: ts.Identifier, initializer: ts.Expr
45
45
  * Construct a `ts.CallExpression` that calls a method on a receiver.
46
46
  */
47
47
  export declare function tsCallMethod(receiver: ts.Expression, methodName: string, args?: ts.Expression[]): ts.CallExpression;
48
+ /**
49
+ * Updates a `ts.TypeParameter` declaration.
50
+ *
51
+ * TODO(crisbeto): this is a backwards-compatibility layer for versions of TypeScript less than 4.7.
52
+ * We should remove it once we have dropped support for the older versions.
53
+ */
54
+ export declare function tsUpdateTypeParameterDeclaration(node: ts.TypeParameterDeclaration, name: ts.Identifier, constraint: ts.TypeNode | undefined, defaultType: ts.TypeNode | undefined): ts.TypeParameterDeclaration;
48
55
  export declare function checkIfClassIsExported(node: ClassDeclaration): boolean;
49
56
  export declare function checkIfGenericTypesAreUnbound(node: ClassDeclaration<ts.ClassDeclaration>): boolean;
50
57
  export declare function isAccessExpression(node: ts.Node): node is ts.ElementAccessExpression | ts.PropertyAccessExpression;
@@ -129,8 +129,9 @@ export declare class Context {
129
129
  readonly boundTarget: BoundTarget<TypeCheckableDirectiveMeta>;
130
130
  private pipes;
131
131
  readonly schemas: SchemaMetadata[];
132
+ readonly hostIsStandalone: boolean;
132
133
  private nextId;
133
- constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TemplateId, boundTarget: BoundTarget<TypeCheckableDirectiveMeta>, pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[]);
134
+ constructor(env: Environment, domSchemaChecker: DomSchemaChecker, oobRecorder: OutOfBandDiagnosticRecorder, id: TemplateId, boundTarget: BoundTarget<TypeCheckableDirectiveMeta>, pipes: Map<string, Reference<ClassDeclaration<ts.ClassDeclaration>>>, schemas: SchemaMetadata[], hostIsStandalone: boolean);
134
135
  /**
135
136
  * Allocate a new variable name for use within the `Context`.
136
137
  *