@angular/compiler-cli 16.0.0-rc.1 → 16.0.0-rc.3

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 (45) hide show
  1. package/bundles/{chunk-C4B5W2XC.js → chunk-2G3UVWBI.js} +8 -8
  2. package/bundles/{chunk-B6WD2R2T.js → chunk-7RPZKH3B.js} +21 -21
  3. package/bundles/{chunk-GVISPKNE.js → chunk-BC53B7EF.js} +5 -5
  4. package/bundles/{chunk-LYJKWJUC.js → chunk-CF2CT7RQ.js} +3 -3
  5. package/bundles/{chunk-TBUSSXUA.js → chunk-K2U2VZ7S.js} +7 -7
  6. package/bundles/{chunk-YGYAPJAN.js → chunk-N7X4GSO5.js} +110 -98
  7. package/bundles/chunk-N7X4GSO5.js.map +6 -0
  8. package/bundles/{chunk-SIHBKSBW.js → chunk-OKYKHPES.js} +31 -31
  9. package/bundles/{chunk-EKTJ7622.js → chunk-OULZQUKT.js} +7 -7
  10. package/bundles/{chunk-4MSEL6HO.js → chunk-QJ5WULBE.js} +180 -93
  11. package/bundles/chunk-QJ5WULBE.js.map +6 -0
  12. package/bundles/{chunk-FJTRGXZM.js → chunk-SQZL4JZ2.js} +5 -5
  13. package/bundles/{chunk-4UQC5DMJ.js → chunk-TCPBYER2.js} +6 -6
  14. package/bundles/{chunk-7PCPPTTO.js → chunk-URH5LEAG.js} +5 -5
  15. package/bundles/index.js +13 -13
  16. package/bundles/linker/babel/index.js +13 -13
  17. package/bundles/linker/index.js +5 -5
  18. package/bundles/private/bazel.js +1 -1
  19. package/bundles/private/localize.js +3 -3
  20. package/bundles/private/migrations.js +6 -6
  21. package/bundles/private/tooling.js +4 -4
  22. package/bundles/src/bin/ng_xi18n.js +11 -11
  23. package/bundles/src/bin/ngc.js +9 -9
  24. package/bundles_metadata.json +1 -1
  25. package/package.json +2 -2
  26. package/src/ngtsc/annotations/ng_module/src/handler.d.ts +19 -4
  27. package/src/ngtsc/core/api/src/public_options.d.ts +4 -1
  28. package/src/ngtsc/core/src/compiler.d.ts +0 -7
  29. package/src/ngtsc/incremental/src/strategy.d.ts +6 -6
  30. package/src/ngtsc/metadata/index.d.ts +1 -0
  31. package/src/ngtsc/metadata/src/api.d.ts +11 -0
  32. package/src/ngtsc/metadata/src/providers.d.ts +43 -0
  33. package/src/ngtsc/transform/src/api.d.ts +6 -1
  34. package/bundles/chunk-4MSEL6HO.js.map +0 -6
  35. package/bundles/chunk-YGYAPJAN.js.map +0 -6
  36. /package/bundles/{chunk-C4B5W2XC.js.map → chunk-2G3UVWBI.js.map} +0 -0
  37. /package/bundles/{chunk-B6WD2R2T.js.map → chunk-7RPZKH3B.js.map} +0 -0
  38. /package/bundles/{chunk-GVISPKNE.js.map → chunk-BC53B7EF.js.map} +0 -0
  39. /package/bundles/{chunk-LYJKWJUC.js.map → chunk-CF2CT7RQ.js.map} +0 -0
  40. /package/bundles/{chunk-TBUSSXUA.js.map → chunk-K2U2VZ7S.js.map} +0 -0
  41. /package/bundles/{chunk-SIHBKSBW.js.map → chunk-OKYKHPES.js.map} +0 -0
  42. /package/bundles/{chunk-EKTJ7622.js.map → chunk-OULZQUKT.js.map} +0 -0
  43. /package/bundles/{chunk-FJTRGXZM.js.map → chunk-SQZL4JZ2.js.map} +0 -0
  44. /package/bundles/{chunk-4UQC5DMJ.js.map → chunk-TCPBYER2.js.map} +0 -0
  45. /package/bundles/{chunk-7PCPPTTO.js.map → chunk-URH5LEAG.js.map} +0 -0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/compiler-cli",
3
- "version": "16.0.0-rc.1",
3
+ "version": "16.0.0-rc.3",
4
4
  "description": "Angular - the compiler CLI for Node.js",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -52,7 +52,7 @@
52
52
  "yargs": "^17.2.1"
53
53
  },
54
54
  "peerDependencies": {
55
- "@angular/compiler": "16.0.0-rc.1",
55
+ "@angular/compiler": "16.0.0-rc.3",
56
56
  "typescript": ">=4.9.3 <5.1"
57
57
  },
58
58
  "repository": {
@@ -8,8 +8,8 @@
8
8
  import { Expression, R3ClassMetadata, R3FactoryMetadata, R3InjectorMetadata, R3NgModuleMetadata, SchemaMetadata } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
10
  import { Reference, ReferenceEmitter } from '../../../imports';
11
- import { SemanticReference, SemanticSymbol } from '../../../incremental/semantic_graph';
12
- import { MetadataReader, MetadataRegistry } from '../../../metadata';
11
+ import { SemanticDepGraphUpdater, SemanticReference, SemanticSymbol } from '../../../incremental/semantic_graph';
12
+ import { ExportedProviderStatusResolver, MetadataReader, MetadataRegistry } from '../../../metadata';
13
13
  import { PartialEvaluator } from '../../../partial_evaluator';
14
14
  import { PerfRecorder } from '../../../perf';
15
15
  import { ClassDeclaration, Decorator, ReflectionHost } from '../../../reflection';
@@ -43,11 +43,24 @@ export interface NgModuleResolution {
43
43
  * Represents an Angular NgModule.
44
44
  */
45
45
  export declare class NgModuleSymbol extends SemanticSymbol {
46
+ readonly hasProviders: boolean;
46
47
  private remotelyScopedComponents;
48
+ /**
49
+ * `SemanticSymbol`s of the transitive imports of this NgModule which came from imported
50
+ * standalone components.
51
+ *
52
+ * Standalone components are excluded/included in the `InjectorDef` emit output of the NgModule
53
+ * based on whether the compiler can prove that their transitive imports may contain exported
54
+ * providers, so a change in this set of symbols may affect the compilation output of this
55
+ * NgModule.
56
+ */
57
+ private transitiveImportsFromStandaloneComponents;
58
+ constructor(decl: ClassDeclaration, hasProviders: boolean);
47
59
  isPublicApiAffected(previousSymbol: SemanticSymbol): boolean;
48
60
  isEmitAffected(previousSymbol: SemanticSymbol): boolean;
49
61
  isTypeCheckApiAffected(previousSymbol: SemanticSymbol): boolean;
50
62
  addRemotelyScopedComponent(component: SemanticSymbol, usedDirectives: SemanticReference[], usedPipes: SemanticReference[]): void;
63
+ addTransitiveImportFromStandaloneComponent(importedSymbol: SemanticSymbol): void;
51
64
  }
52
65
  /**
53
66
  * Compiles @NgModule annotations to ngModuleDef fields.
@@ -59,18 +72,20 @@ export declare class NgModuleDecoratorHandler implements DecoratorHandler<Decora
59
72
  private metaRegistry;
60
73
  private scopeRegistry;
61
74
  private referencesRegistry;
75
+ private exportedProviderStatusResolver;
76
+ private semanticDepGraphUpdater;
62
77
  private isCore;
63
78
  private refEmitter;
64
79
  private annotateForClosureCompiler;
65
80
  private onlyPublishPublicTypings;
66
81
  private injectableRegistry;
67
82
  private perf;
68
- constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaReader: MetadataReader, metaRegistry: MetadataRegistry, scopeRegistry: LocalModuleScopeRegistry, referencesRegistry: ReferencesRegistry, isCore: boolean, refEmitter: ReferenceEmitter, annotateForClosureCompiler: boolean, onlyPublishPublicTypings: boolean, injectableRegistry: InjectableClassRegistry, perf: PerfRecorder);
83
+ constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaReader: MetadataReader, metaRegistry: MetadataRegistry, scopeRegistry: LocalModuleScopeRegistry, referencesRegistry: ReferencesRegistry, exportedProviderStatusResolver: ExportedProviderStatusResolver, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, isCore: boolean, refEmitter: ReferenceEmitter, annotateForClosureCompiler: boolean, onlyPublishPublicTypings: boolean, injectableRegistry: InjectableClassRegistry, perf: PerfRecorder);
69
84
  readonly precedence = HandlerPrecedence.PRIMARY;
70
85
  readonly name: string;
71
86
  detect(node: ClassDeclaration, decorators: Decorator[] | null): DetectResult<Decorator> | undefined;
72
87
  analyze(node: ClassDeclaration, decorator: Readonly<Decorator>): AnalysisOutput<NgModuleAnalysis>;
73
- symbol(node: ClassDeclaration): NgModuleSymbol;
88
+ symbol(node: ClassDeclaration, analysis: NgModuleAnalysis): NgModuleSymbol;
74
89
  register(node: ClassDeclaration, analysis: NgModuleAnalysis): void;
75
90
  resolve(node: ClassDeclaration, analysis: Readonly<NgModuleAnalysis>): ResolveResult<NgModuleResolution>;
76
91
  compileFull(node: ClassDeclaration, { inj, mod, fac, classMetadata, declarations, remoteScopesMayRequireCycleProtection }: Readonly<NgModuleAnalysis>, { injectorImports }: Readonly<NgModuleResolution>): CompileResult[];
@@ -349,10 +349,13 @@ export interface TargetOptions {
349
349
  * Specifies the compilation mode to use. The following modes are available:
350
350
  * - 'full': generates fully AOT compiled code using Ivy instructions.
351
351
  * - 'partial': generates code in a stable, but intermediate form suitable for publication to NPM.
352
+ * - 'experimental-local': generates code based on each individual source file without using its
353
+ * dependencies. This mode is suitable only for fast edit/refresh during development. It will be
354
+ * eventually replaced by the value `local` once the feature is ready to be public.
352
355
  *
353
356
  * The default value is 'full'.
354
357
  */
355
- compilationMode?: 'full' | 'partial';
358
+ compilationMode?: 'full' | 'partial' | 'experimental-local';
356
359
  }
357
360
  /**
358
361
  * Miscellaneous options that don't fall into any other category
@@ -147,13 +147,6 @@ export declare class NgCompiler {
147
147
  static fromTicket(ticket: CompilationTicket, adapter: NgCompilerAdapter): NgCompiler;
148
148
  private constructor();
149
149
  get perfRecorder(): ActivePerfRecorder;
150
- /**
151
- * Exposes the `IncrementalCompilation` under an old property name that the CLI uses, avoiding a
152
- * chicken-and-egg problem with the rename to `incrementalCompilation`.
153
- *
154
- * TODO(alxhub): remove when the CLI uses the new name.
155
- */
156
- get incrementalDriver(): IncrementalCompilation;
157
150
  private updateWithChangedResources;
158
151
  /**
159
152
  * Get the resource dependencies of a file.
@@ -8,16 +8,16 @@
8
8
  import ts from 'typescript';
9
9
  import { IncrementalState } from './state';
10
10
  /**
11
- * Strategy used to manage the association between a `ts.Program` and the `IncrementalDriver` which
11
+ * Strategy used to manage the association between a `ts.Program` and the `IncrementalState` which
12
12
  * represents the reusable Angular part of its compilation.
13
13
  */
14
14
  export interface IncrementalBuildStrategy {
15
15
  /**
16
- * Determine the Angular `IncrementalDriver` for the given `ts.Program`, if one is available.
16
+ * Determine the Angular `IncrementalState` for the given `ts.Program`, if one is available.
17
17
  */
18
18
  getIncrementalState(program: ts.Program): IncrementalState | null;
19
19
  /**
20
- * Associate the given `IncrementalDriver` with the given `ts.Program` and make it available to
20
+ * Associate the given `IncrementalState` with the given `ts.Program` and make it available to
21
21
  * future compilations.
22
22
  */
23
23
  setIncrementalState(driver: IncrementalState, program: ts.Program): void;
@@ -37,7 +37,7 @@ export declare class NoopIncrementalBuildStrategy implements IncrementalBuildStr
37
37
  toNextBuildStrategy(): IncrementalBuildStrategy;
38
38
  }
39
39
  /**
40
- * Tracks an `IncrementalDriver` within the strategy itself.
40
+ * Tracks an `IncrementalState` within the strategy itself.
41
41
  */
42
42
  export declare class TrackedIncrementalBuildStrategy implements IncrementalBuildStrategy {
43
43
  private state;
@@ -47,8 +47,8 @@ export declare class TrackedIncrementalBuildStrategy implements IncrementalBuild
47
47
  toNextBuildStrategy(): TrackedIncrementalBuildStrategy;
48
48
  }
49
49
  /**
50
- * Manages the `IncrementalDriver` associated with a `ts.Program` by monkey-patching it onto the
51
- * program under `SYM_INCREMENTAL_DRIVER`.
50
+ * Manages the `IncrementalState` associated with a `ts.Program` by monkey-patching it onto the
51
+ * program under `SYM_INCREMENTAL_STATE`.
52
52
  */
53
53
  export declare class PatchedProgramIncrementalBuildStrategy implements IncrementalBuildStrategy {
54
54
  getIncrementalState(program: ts.Program): IncrementalState | null;
@@ -12,4 +12,5 @@ export { CompoundMetadataRegistry, LocalMetadataRegistry } from './src/registry'
12
12
  export { ResourceRegistry, Resource, ComponentResources, isExternalResource, ExternalResource } from './src/resource_registry';
13
13
  export { extractDirectiveTypeCheckMeta, hasInjectableFields, CompoundMetadataReader } from './src/util';
14
14
  export { BindingPropertyName, ClassPropertyMapping, ClassPropertyName, InputOrOutput } from './src/property_mapping';
15
+ export { ExportedProviderStatusResolver } from './src/providers';
15
16
  export { HostDirectivesResolver } from './src/host_directives_resolver';
@@ -47,6 +47,13 @@ export interface NgModuleMeta {
47
47
  * If this is `null`, no decorator exists, meaning it's probably from a .d.ts file.
48
48
  */
49
49
  decorator: ts.Decorator | null;
50
+ /**
51
+ * Whether this NgModule may declare providers.
52
+ *
53
+ * If the compiler does not know if the NgModule may declare providers, this will be `true` (for
54
+ * example, NgModules declared outside the current compilation are assumed to declare providers).
55
+ */
56
+ mayDeclareProviders: boolean;
50
57
  }
51
58
  /**
52
59
  * Typing metadata collected for a directive within an NgModule's scope.
@@ -165,6 +172,10 @@ export interface DirectiveMeta extends T2DirectiveMeta, DirectiveTypeCheckMeta {
165
172
  decorator: ts.Decorator | null;
166
173
  /** Additional directives applied to the directive host. */
167
174
  hostDirectives: HostDirectiveMeta[] | null;
175
+ /**
176
+ * Whether the directive should be assumed to export providers if imported as a standalone type.
177
+ */
178
+ assumedToExportProviders: boolean;
168
179
  }
169
180
  /** Metadata collected about an additional directive that is being applied to a directive host. */
170
181
  export interface HostDirectiveMeta {
@@ -0,0 +1,43 @@
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 } from './api';
11
+ /**
12
+ * Determines whether types may or may not export providers to NgModules, by transitively walking
13
+ * the NgModule & standalone import graph.
14
+ */
15
+ export declare class ExportedProviderStatusResolver {
16
+ private metaReader;
17
+ /**
18
+ * `ClassDeclaration`s that we are in the process of determining the provider status for.
19
+ *
20
+ * This is used to detect cycles in the import graph and avoid getting stuck in them.
21
+ */
22
+ private calculating;
23
+ constructor(metaReader: MetadataReader);
24
+ /**
25
+ * Determines whether `ref` may or may not export providers to NgModules which import it.
26
+ *
27
+ * NgModules export providers if any are declared, and standalone components export providers from
28
+ * their `imports` array (if any).
29
+ *
30
+ * If `true`, then `ref` should be assumed to export providers. In practice, this could mean
31
+ * either that `ref` is a local type that we _know_ exports providers, or it's imported from a
32
+ * .d.ts library and is declared in a way where the compiler cannot prove that it doesn't.
33
+ *
34
+ * If `false`, then `ref` is guaranteed not to export providers.
35
+ *
36
+ * @param `ref` the class for which the provider status should be determined
37
+ * @param `dependencyCallback` a callback that, if provided, will be called for every type
38
+ * which is used in the determination of provider status for `ref`
39
+ * @returns `true` if `ref` should be assumed to export providers, or `false` if the compiler can
40
+ * prove that it does not
41
+ */
42
+ mayExportProviders(ref: Reference<ClassDeclaration>, dependencyCallback?: (importRef: Reference<ClassDeclaration>) => void): boolean;
43
+ }
@@ -26,7 +26,12 @@ export declare enum CompilationMode {
26
26
  /**
27
27
  * Generates code using a stable, but intermediate format suitable to be published to NPM.
28
28
  */
29
- PARTIAL = 1
29
+ PARTIAL = 1,
30
+ /**
31
+ * Generates code based on each individual source file without using its
32
+ * dependencies (suitable for local dev edit/refresh workflow).
33
+ */
34
+ LOCAL = 2
30
35
  }
31
36
  export declare enum HandlerPrecedence {
32
37
  /**