@angular/compiler-cli 17.2.0-next.0 → 17.2.0-rc.0

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 (78) hide show
  1. package/bundles/{chunk-WCD6LVCP.js → chunk-2WQIUGOU.js} +7 -7
  2. package/bundles/{chunk-6RVHVK7X.js → chunk-63UQIYTZ.js} +37 -33
  3. package/bundles/chunk-63UQIYTZ.js.map +6 -0
  4. package/bundles/{chunk-R4KQI5XI.js → chunk-64JBPJBS.js} +5 -5
  5. package/bundles/{chunk-Q5Y7HH3O.js → chunk-6VEEN3ZS.js} +5 -5
  6. package/bundles/{chunk-U6M6KQUQ.js → chunk-CVK4HV4K.js} +261 -194
  7. package/bundles/chunk-CVK4HV4K.js.map +6 -0
  8. package/bundles/{chunk-VYUC5NTT.js → chunk-JIFH6OZK.js} +273 -179
  9. package/bundles/chunk-JIFH6OZK.js.map +6 -0
  10. package/bundles/{chunk-455YOO3E.js → chunk-KYE5EYIK.js} +181 -59
  11. package/bundles/chunk-KYE5EYIK.js.map +6 -0
  12. package/bundles/{chunk-SBDNBITT.js → chunk-LYJKWJUC.js} +3 -3
  13. package/bundles/{chunk-YJ2WTOVI.js → chunk-PQBKKYRL.js} +2761 -2545
  14. package/bundles/chunk-PQBKKYRL.js.map +6 -0
  15. package/bundles/{chunk-QPMYDNZG.js → chunk-UM6JO3VZ.js} +9 -9
  16. package/bundles/{chunk-QPMYDNZG.js.map → chunk-UM6JO3VZ.js.map} +1 -1
  17. package/bundles/{chunk-SIMT2UHI.js → chunk-VVX2ZXGV.js} +5 -5
  18. package/bundles/index.js +17 -13
  19. package/bundles/index.js.map +1 -1
  20. package/bundles/linker/babel/index.js +12 -12
  21. package/bundles/linker/index.js +4 -4
  22. package/bundles/ngcc/index.js +1 -1
  23. package/bundles/private/bazel.js +1 -1
  24. package/bundles/private/localize.js +3 -3
  25. package/bundles/private/migrations.js +5 -5
  26. package/bundles/private/tooling.js +5 -7
  27. package/bundles/src/bin/ng_xi18n.js +10 -10
  28. package/bundles/src/bin/ngc.js +8 -8
  29. package/bundles_metadata.json +1 -1
  30. package/index.d.ts +1 -0
  31. package/linker/src/file_linker/partial_linkers/util.d.ts +2 -1
  32. package/package.json +3 -3
  33. package/private/tooling.d.ts +4 -21
  34. package/src/ngtsc/annotations/common/src/diagnostics.d.ts +11 -0
  35. package/src/ngtsc/annotations/component/src/handler.d.ts +4 -2
  36. package/src/ngtsc/annotations/component/src/metadata.d.ts +4 -1
  37. package/src/ngtsc/annotations/directive/index.d.ts +3 -0
  38. package/src/ngtsc/annotations/directive/src/handler.d.ts +3 -1
  39. package/src/ngtsc/annotations/directive/src/initializer_functions.d.ts +1 -1
  40. package/src/ngtsc/annotations/directive/src/input_output_parse_options.d.ts +18 -0
  41. package/src/ngtsc/annotations/directive/src/model_function.d.ts +13 -0
  42. package/src/ngtsc/annotations/directive/src/output_function.d.ts +18 -0
  43. package/src/ngtsc/annotations/directive/src/query_functions.d.ts +1 -2
  44. package/src/ngtsc/annotations/directive/src/shared.d.ts +5 -2
  45. package/src/ngtsc/annotations/index.d.ts +2 -2
  46. package/src/ngtsc/annotations/ng_module/src/handler.d.ts +3 -2
  47. package/src/ngtsc/annotations/src/pipe.d.ts +2 -1
  48. package/src/ngtsc/core/api/src/public_options.d.ts +10 -0
  49. package/src/ngtsc/diagnostics/src/error.d.ts +4 -3
  50. package/src/ngtsc/diagnostics/src/error_code.d.ts +9 -11
  51. package/src/ngtsc/docs/src/entities.d.ts +1 -0
  52. package/src/ngtsc/docs/src/function_extractor.d.ts +3 -2
  53. package/src/ngtsc/imports/index.d.ts +1 -0
  54. package/src/ngtsc/imports/src/local_compilation_extra_imports_tracker.d.ts +56 -0
  55. package/src/ngtsc/metadata/src/api.d.ts +9 -0
  56. package/src/ngtsc/reflection/src/typescript.d.ts +1 -2
  57. package/src/ngtsc/transform/src/transform.d.ts +2 -2
  58. package/src/ngtsc/translator/index.d.ts +1 -1
  59. package/src/ngtsc/translator/src/import_manager.d.ts +19 -2
  60. package/src/ngtsc/typecheck/src/comments.d.ts +2 -1
  61. package/src/ngtsc/typecheck/src/ts_util.d.ts +2 -0
  62. package/src/transformers/jit_transforms/index.d.ts +21 -1
  63. package/src/transformers/jit_transforms/{signal_inputs_metadata_transform.d.ts → initializer_api_transforms/input_function.d.ts} +5 -6
  64. package/src/transformers/jit_transforms/initializer_api_transforms/model_function.d.ts +13 -0
  65. package/src/transformers/jit_transforms/initializer_api_transforms/output_function.d.ts +19 -0
  66. package/src/transformers/jit_transforms/initializer_api_transforms/query_functions.d.ts +20 -0
  67. package/src/transformers/jit_transforms/initializer_api_transforms/transform.d.ts +17 -0
  68. package/src/transformers/jit_transforms/initializer_api_transforms/transform_api.d.ts +23 -0
  69. package/bundles/chunk-455YOO3E.js.map +0 -6
  70. package/bundles/chunk-6RVHVK7X.js.map +0 -6
  71. package/bundles/chunk-U6M6KQUQ.js.map +0 -6
  72. package/bundles/chunk-VYUC5NTT.js.map +0 -6
  73. package/bundles/chunk-YJ2WTOVI.js.map +0 -6
  74. /package/bundles/{chunk-WCD6LVCP.js.map → chunk-2WQIUGOU.js.map} +0 -0
  75. /package/bundles/{chunk-R4KQI5XI.js.map → chunk-64JBPJBS.js.map} +0 -0
  76. /package/bundles/{chunk-Q5Y7HH3O.js.map → chunk-6VEEN3ZS.js.map} +0 -0
  77. /package/bundles/{chunk-SBDNBITT.js.map → chunk-LYJKWJUC.js.map} +0 -0
  78. /package/bundles/{chunk-SIMT2UHI.js.map → chunk-VVX2ZXGV.js.map} +0 -0
package/index.d.ts CHANGED
@@ -1,4 +1,5 @@
1
1
  export { VERSION } from './src/version';
2
+ export * from './src/transformers/jit_transforms';
2
3
  export * from './src/transformers/api';
3
4
  export * from './src/transformers/entry_points';
4
5
  export * from './src/perform_compile';
@@ -7,7 +7,8 @@
7
7
  */
8
8
  import { MaybeForwardRefExpression, outputAst as o, R3DeclareDependencyMetadata, R3DependencyMetadata, R3Reference } from '@angular/compiler';
9
9
  import { AstObject, AstValue } from '../../ast/ast_value';
10
- export declare const PLACEHOLDER_VERSION = "17.2.0-next.0";
10
+ export declare const PLACEHOLDER_VERSION = "17.2.0-rc.0";
11
+ export declare const SHOULD_USE_TEMPLATE_PIPELINE_FOR_LINKER = false;
11
12
  export declare function wrapReference<TExpression>(wrapped: o.WrappedNodeExpr<TExpression>): R3Reference;
12
13
  /**
13
14
  * Parses the value of an enum from the AST value's symbol name.
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/compiler-cli",
3
- "version": "17.2.0-next.0",
3
+ "version": "17.2.0-rc.0",
4
4
  "description": "Angular - the compiler CLI for Node.js",
5
5
  "typings": "index.d.ts",
6
6
  "bin": {
@@ -43,7 +43,7 @@
43
43
  }
44
44
  },
45
45
  "dependencies": {
46
- "@babel/core": "7.23.2",
46
+ "@babel/core": "7.23.9",
47
47
  "@jridgewell/sourcemap-codec": "^1.4.14",
48
48
  "reflect-metadata": "^0.2.0",
49
49
  "chokidar": "^3.0.0",
@@ -53,7 +53,7 @@
53
53
  "yargs": "^17.2.1"
54
54
  },
55
55
  "peerDependencies": {
56
- "@angular/compiler": "17.2.0-next.0",
56
+ "@angular/compiler": "17.2.0-rc.0",
57
57
  "typescript": ">=5.2 <5.4"
58
58
  },
59
59
  "repository": {
@@ -26,26 +26,9 @@ export declare const GLOBAL_DEFS_FOR_TERSER_WITH_AOT: {
26
26
  ngI18nClosureMode: boolean;
27
27
  };
28
28
  /**
29
- * JIT transform for Angular applications. Used by the Angular CLI for unit tests and
30
- * explicit JIT applications.
29
+ * JIT transform used by the Angular CLI.
31
30
  *
32
- * The transforms include:
33
- *
34
- * - A transform for downleveling Angular decorators and Angular-decorated class constructor
35
- * parameters for dependency injection. This transform can be used by the CLI for JIT-mode
36
- * compilation where constructor parameters and associated Angular decorators should be
37
- * downleveled so that apps are not exposed to the ES2015 temporal dead zone limitation
38
- * in TypeScript. See https://github.com/angular/angular-cli/pull/14473 for more details.
39
- *
40
- * - A transform for adding `@Input` to signal inputs. Signal inputs cannot be recognized
41
- * at runtime using reflection. That is because the class would need to be instantiated-
42
- * but is not possible before creation. To fix this for JIT, a decorator is automatically
43
- * added that will declare the input as a signal input while also capturing the necessary
44
- * metadata
45
- */
46
- export declare function angularJitApplicationTransform(program: ts.Program, isCore?: boolean): ts.TransformerFactory<ts.SourceFile>;
47
- /**
48
- * Re-export for backwards compatibility.
49
- * The Angular CLI relies on this name for the transform.
31
+ * NOTE: Signature is explicitly captured here to highlight the
32
+ * contract various Angular CLI versions are relying on.
50
33
  */
51
- export declare const constructorParametersDownlevelTransform: typeof angularJitApplicationTransform;
34
+ export declare const constructorParametersDownlevelTransform: (program: ts.Program, isCore?: boolean) => ts.TransformerFactory<ts.SourceFile>;
@@ -13,6 +13,7 @@ import { PartialEvaluator, ResolvedValue } from '../../../partial_evaluator';
13
13
  import { ClassDeclaration, ReflectionHost } from '../../../reflection';
14
14
  import { DeclarationData, LocalModuleScopeRegistry } from '../../../scope';
15
15
  import { InjectableClassRegistry } from './injectable_registry';
16
+ import { CompilationMode } from '../../../transform';
16
17
  /**
17
18
  * Create a `ts.Diagnostic` which indicates the given class is part of the declarations of two or
18
19
  * more NgModules.
@@ -49,4 +50,14 @@ interface ClassWithCtor {
49
50
  isDecorated: boolean;
50
51
  }
51
52
  export declare function findInheritedCtor(node: ClassDeclaration, injectableRegistry: InjectableClassRegistry, reflector: ReflectionHost, evaluator: PartialEvaluator): ClassWithCtor | null;
53
+ /**
54
+ * Throws `FatalDiagnosticError` with error code `LOCAL_COMPILATION_UNRESOLVED_CONST`
55
+ * if the compilation mode is local and the value is not resolved due to being imported
56
+ * from external files. This is a common scenario for errors in local compilation mode,
57
+ * and so this helper can be used to quickly generate the relevant errors.
58
+ *
59
+ * @param nodeToHighlight Node to be highlighted in teh error message.
60
+ * Will default to value.node if not provided.
61
+ */
62
+ export declare function assertLocalCompilationUnresolvedConst(compilationMode: CompilationMode, value: ResolvedValue, nodeToHighlight: ts.Node | null, errorMessage: string): void;
52
63
  export {};
@@ -8,7 +8,7 @@
8
8
  import { ConstantPool } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
10
  import { CycleAnalyzer, CycleHandlingStrategy } from '../../../cycles';
11
- import { DeferredSymbolTracker, ModuleResolver, ReferenceEmitter } from '../../../imports';
11
+ import { DeferredSymbolTracker, LocalCompilationExtraImportsTracker, ModuleResolver, ReferenceEmitter } from '../../../imports';
12
12
  import { DependencyTracker } from '../../../incremental/api';
13
13
  import { SemanticDepGraphUpdater } from '../../../incremental/semantic_graph';
14
14
  import { IndexingContext } from '../../../indexer';
@@ -62,7 +62,9 @@ export declare class ComponentDecoratorHandler implements DecoratorHandler<Decor
62
62
  private readonly deferredSymbolTracker;
63
63
  private readonly forbidOrphanRendering;
64
64
  private readonly enableBlockSyntax;
65
- constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaRegistry: MetadataRegistry, metaReader: MetadataReader, scopeReader: ComponentScopeReader, dtsScopeReader: DtsModuleScopeResolver, scopeRegistry: LocalModuleScopeRegistry, typeCheckScopeRegistry: TypeCheckScopeRegistry, resourceRegistry: ResourceRegistry, isCore: boolean, strictCtorDeps: boolean, resourceLoader: ResourceLoader, rootDirs: ReadonlyArray<string>, defaultPreserveWhitespaces: boolean, i18nUseExternalIds: boolean, enableI18nLegacyMessageIdFormat: boolean, usePoisonedData: boolean, i18nNormalizeLineEndingsInICUs: boolean, moduleResolver: ModuleResolver, cycleAnalyzer: CycleAnalyzer, cycleHandlingStrategy: CycleHandlingStrategy, refEmitter: ReferenceEmitter, referencesRegistry: ReferencesRegistry, depTracker: DependencyTracker | null, injectableRegistry: InjectableClassRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, annotateForClosureCompiler: boolean, perf: PerfRecorder, hostDirectivesResolver: HostDirectivesResolver, includeClassMetadata: boolean, compilationMode: CompilationMode, deferredSymbolTracker: DeferredSymbolTracker, forbidOrphanRendering: boolean, enableBlockSyntax: boolean);
65
+ private readonly useTemplatePipeline;
66
+ private readonly localCompilationExtraImportsTracker;
67
+ constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaRegistry: MetadataRegistry, metaReader: MetadataReader, scopeReader: ComponentScopeReader, dtsScopeReader: DtsModuleScopeResolver, scopeRegistry: LocalModuleScopeRegistry, typeCheckScopeRegistry: TypeCheckScopeRegistry, resourceRegistry: ResourceRegistry, isCore: boolean, strictCtorDeps: boolean, resourceLoader: ResourceLoader, rootDirs: ReadonlyArray<string>, defaultPreserveWhitespaces: boolean, i18nUseExternalIds: boolean, enableI18nLegacyMessageIdFormat: boolean, usePoisonedData: boolean, i18nNormalizeLineEndingsInICUs: boolean, moduleResolver: ModuleResolver, cycleAnalyzer: CycleAnalyzer, cycleHandlingStrategy: CycleHandlingStrategy, refEmitter: ReferenceEmitter, referencesRegistry: ReferencesRegistry, depTracker: DependencyTracker | null, injectableRegistry: InjectableClassRegistry, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, annotateForClosureCompiler: boolean, perf: PerfRecorder, hostDirectivesResolver: HostDirectivesResolver, includeClassMetadata: boolean, compilationMode: CompilationMode, deferredSymbolTracker: DeferredSymbolTracker, forbidOrphanRendering: boolean, enableBlockSyntax: boolean, useTemplatePipeline: boolean, localCompilationExtraImportsTracker: LocalCompilationExtraImportsTracker | null);
66
68
  private literalCache;
67
69
  private elementSchemaRegistry;
68
70
  /**
@@ -60,7 +60,10 @@ export interface ComponentAnalysisData {
60
60
  /**
61
61
  * Map of symbol name -> import path for types from `@Component.deferredImports` field.
62
62
  */
63
- explicitlyDeferredTypes: Map<string, string> | null;
63
+ explicitlyDeferredTypes: Map<string, {
64
+ importPath: string;
65
+ isDefaultImport: boolean;
66
+ }> | null;
64
67
  schemas: SchemaMetadata[] | null;
65
68
  decorator: ts.Decorator | null;
66
69
  /** Additional directives applied to the component host. */
@@ -9,3 +9,6 @@ export { DirectiveDecoratorHandler } from './src/handler';
9
9
  export { DirectiveSymbol } from './src/symbol';
10
10
  export * from './src/shared';
11
11
  export * from './src/input_function';
12
+ export * from './src/output_function';
13
+ export * from './src/query_functions';
14
+ export * from './src/model_function';
@@ -47,7 +47,9 @@ export declare class DirectiveDecoratorHandler implements DecoratorHandler<Decor
47
47
  private perf;
48
48
  private includeClassMetadata;
49
49
  private readonly compilationMode;
50
- constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaRegistry: MetadataRegistry, scopeRegistry: LocalModuleScopeRegistry, metaReader: MetadataReader, injectableRegistry: InjectableClassRegistry, refEmitter: ReferenceEmitter, referencesRegistry: ReferencesRegistry, isCore: boolean, strictCtorDeps: boolean, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, annotateForClosureCompiler: boolean, perf: PerfRecorder, includeClassMetadata: boolean, compilationMode: CompilationMode);
50
+ private readonly useTemplatePipeline;
51
+ private readonly generateExtraImportsInLocalMode;
52
+ constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaRegistry: MetadataRegistry, scopeRegistry: LocalModuleScopeRegistry, metaReader: MetadataReader, injectableRegistry: InjectableClassRegistry, refEmitter: ReferenceEmitter, referencesRegistry: ReferencesRegistry, isCore: boolean, strictCtorDeps: boolean, semanticDepGraphUpdater: SemanticDepGraphUpdater | null, annotateForClosureCompiler: boolean, perf: PerfRecorder, includeClassMetadata: boolean, compilationMode: CompilationMode, useTemplatePipeline: boolean, generateExtraImportsInLocalMode: boolean);
51
53
  readonly precedence = HandlerPrecedence.PRIMARY;
52
54
  readonly name = "DirectiveDecoratorHandler";
53
55
  detect(node: ClassDeclaration, decorators: Decorator[] | null): DetectResult<Decorator | null> | undefined;
@@ -18,7 +18,7 @@ import { ClassMember, ReflectionHost } from '../../../reflection';
18
18
  * Similarly, signal-based queries follow the same pattern and are also
19
19
  * declared through initializer APIs.
20
20
  */
21
- export type InitializerApiFunction = 'input' | 'viewChild' | 'viewChildren' | 'contentChild' | 'contentChildren';
21
+ export type InitializerApiFunction = 'input' | 'model' | 'ɵoutput' | 'output' | 'viewChild' | 'viewChildren' | 'contentChild' | 'contentChildren';
22
22
  /**
23
23
  * Metadata describing an Angular class member that was recognized through
24
24
  * a function initializer. Like `input`, `input.required` or `viewChild`.
@@ -0,0 +1,18 @@
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 ts from 'typescript';
9
+ /**
10
+ * Parses and validates input and output initializer function options.
11
+ *
12
+ * This currently only parses the `alias` option and returns it. The other
13
+ * options for signal inputs are runtime constructs that aren't relevant at
14
+ * compile time.
15
+ */
16
+ export declare function parseAndValidateInputAndOutputOptions(optionsNode: ts.Expression): {
17
+ alias: string | undefined;
18
+ };
@@ -0,0 +1,13 @@
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 { ModelMapping } from '../../../metadata';
9
+ import { ClassMember, ReflectionHost } from '../../../reflection';
10
+ /**
11
+ * Attempts to parse a model class member. Returns the parsed model mapping if possible.
12
+ */
13
+ export declare function tryParseSignalModelMapping(member: Pick<ClassMember, 'name' | 'value'>, reflector: ReflectionHost, isCore: boolean): ModelMapping | null;
@@ -0,0 +1,18 @@
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 ts from 'typescript';
9
+ import { InputOrOutput } from '../../../metadata';
10
+ import { ClassMember, ReflectionHost } from '../../../reflection';
11
+ /**
12
+ * Attempts to parse a signal output class member. Returns the parsed
13
+ * input mapping if possible.
14
+ */
15
+ export declare function tryParseInitializerBasedOutput(member: Pick<ClassMember, 'name' | 'value'>, reflector: ReflectionHost, isCore: boolean): {
16
+ call: ts.CallExpression;
17
+ metadata: InputOrOutput;
18
+ } | null;
@@ -9,7 +9,7 @@ import { R3QueryMetadata } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
10
  import { ClassMember, ReflectionHost } from '../../../reflection';
11
11
  /** Possible query initializer API functions. */
12
- type QueryFunctionName = 'viewChild' | 'contentChild' | 'viewChildren' | 'contentChildren';
12
+ export type QueryFunctionName = 'viewChild' | 'contentChild' | 'viewChildren' | 'contentChildren';
13
13
  /**
14
14
  * Attempts to detect a possible query definition for the given class member.
15
15
  *
@@ -23,4 +23,3 @@ export declare function tryParseSignalQueryFromInitializer(member: Pick<ClassMem
23
23
  metadata: R3QueryMetadata;
24
24
  call: ts.CallExpression;
25
25
  } | null;
26
- export {};
@@ -13,13 +13,15 @@ import { DynamicValue, PartialEvaluator } from '../../../partial_evaluator';
13
13
  import { ClassDeclaration, ClassMember, Decorator, ReflectionHost } from '../../../reflection';
14
14
  import { CompilationMode } from '../../../transform';
15
15
  import { ReferencesRegistry } from '../../common';
16
+ type QueryDecoratorName = 'ViewChild' | 'ViewChildren' | 'ContentChild' | 'ContentChildren';
17
+ export declare const queryDecoratorNames: QueryDecoratorName[];
16
18
  /**
17
19
  * Helper function to extract metadata from a `Directive` or `Component`. `Directive`s without a
18
20
  * selector are allowed to be used for abstract base classes. These abstract directives should not
19
21
  * appear in the declarations of an `NgModule` and additional verification is done when processing
20
22
  * the module.
21
23
  */
22
- export declare function extractDirectiveMetadata(clazz: ClassDeclaration, decorator: Readonly<Decorator>, reflector: ReflectionHost, evaluator: PartialEvaluator, refEmitter: ReferenceEmitter, referencesRegistry: ReferencesRegistry, isCore: boolean, annotateForClosureCompiler: boolean, compilationMode: CompilationMode, defaultSelector?: string | null): {
24
+ export declare function extractDirectiveMetadata(clazz: ClassDeclaration, decorator: Readonly<Decorator>, reflector: ReflectionHost, evaluator: PartialEvaluator, refEmitter: ReferenceEmitter, referencesRegistry: ReferencesRegistry, isCore: boolean, annotateForClosureCompiler: boolean, compilationMode: CompilationMode, defaultSelector: string | null, useTemplatePipeline: boolean): {
23
25
  decorator: Map<string, ts.Expression>;
24
26
  metadata: R3DirectiveMetadata;
25
27
  inputs: ClassPropertyMapping<InputMapping>;
@@ -29,7 +31,7 @@ export declare function extractDirectiveMetadata(clazz: ClassDeclaration, decora
29
31
  rawHostDirectives: ts.Expression | null;
30
32
  } | undefined;
31
33
  export declare function extractDecoratorQueryMetadata(exprNode: ts.Node, name: string, args: ReadonlyArray<ts.Expression>, propertyName: string, reflector: ReflectionHost, evaluator: PartialEvaluator): R3QueryMetadata;
32
- export declare function extractHostBindings(members: ClassMember[], evaluator: PartialEvaluator, coreModule: string | undefined, metadata?: Map<string, ts.Expression>): ParsedHostBindings;
34
+ export declare function extractHostBindings(members: ClassMember[], evaluator: PartialEvaluator, coreModule: string | undefined, compilationMode: CompilationMode, metadata?: Map<string, ts.Expression>): ParsedHostBindings;
33
35
  export declare function parseDirectiveStyles(directive: Map<string, ts.Expression>, evaluator: PartialEvaluator, compilationMode: CompilationMode): null | string[];
34
36
  export declare function parseFieldStringArrayValue(directive: Map<string, ts.Expression>, field: string, evaluator: PartialEvaluator): null | string[];
35
37
  /**
@@ -44,3 +46,4 @@ export declare function parseFieldStringArrayValue(directive: Map<string, ts.Exp
44
46
  *
45
47
  */
46
48
  export declare function parseDecoratorInputTransformFunction(clazz: ClassDeclaration, classPropertyName: string, value: DynamicValue | Reference, reflector: ReflectionHost, refEmitter: ReferenceEmitter, compilationMode: CompilationMode): DecoratorInputTransform;
49
+ export {};
@@ -5,9 +5,9 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
- export { forwardRefResolver, isAngularDecorator, NoopReferencesRegistry, ReferencesRegistry, ResourceLoader, ResourceLoaderContext } from './common';
8
+ export { forwardRefResolver, getAngularDecorators, isAngularDecorator, NoopReferencesRegistry, ReferencesRegistry, ResourceLoader, ResourceLoaderContext } from './common';
9
9
  export { ComponentDecoratorHandler } from './component';
10
- export { DirectiveDecoratorHandler, tryParseSignalInputMapping } from './directive';
10
+ export { DirectiveDecoratorHandler, queryDecoratorNames, QueryFunctionName, tryParseInitializerBasedOutput, tryParseSignalInputMapping, tryParseSignalModelMapping, tryParseSignalQueryFromInitializer } from './directive';
11
11
  export { NgModuleDecoratorHandler } from './ng_module';
12
12
  export { InjectableDecoratorHandler } from './src/injectable';
13
13
  export { PipeDecoratorHandler } from './src/pipe';
@@ -7,7 +7,7 @@
7
7
  */
8
8
  import { Expression, R3ClassMetadata, R3FactoryMetadata, R3InjectorMetadata, R3NgModuleMetadata, SchemaMetadata } from '@angular/compiler';
9
9
  import ts from 'typescript';
10
- import { Reference, ReferenceEmitter } from '../../../imports';
10
+ import { LocalCompilationExtraImportsTracker, Reference, ReferenceEmitter } from '../../../imports';
11
11
  import { SemanticDepGraphUpdater, SemanticReference, SemanticSymbol } from '../../../incremental/semantic_graph';
12
12
  import { ExportedProviderStatusResolver, MetadataReader, MetadataRegistry } from '../../../metadata';
13
13
  import { PartialEvaluator } from '../../../partial_evaluator';
@@ -83,7 +83,8 @@ export declare class NgModuleDecoratorHandler implements DecoratorHandler<Decora
83
83
  private includeClassMetadata;
84
84
  private includeSelectorScope;
85
85
  private readonly compilationMode;
86
- 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, includeClassMetadata: boolean, includeSelectorScope: boolean, compilationMode: CompilationMode);
86
+ private readonly localCompilationExtraImportsTracker;
87
+ 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, includeClassMetadata: boolean, includeSelectorScope: boolean, compilationMode: CompilationMode, localCompilationExtraImportsTracker: LocalCompilationExtraImportsTracker | null);
87
88
  readonly precedence = HandlerPrecedence.PRIMARY;
88
89
  readonly name = "NgModuleDecoratorHandler";
89
90
  detect(node: ClassDeclaration, decorators: Decorator[] | null): DetectResult<Decorator> | undefined;
@@ -40,7 +40,8 @@ export declare class PipeDecoratorHandler implements DecoratorHandler<Decorator,
40
40
  private perf;
41
41
  private includeClassMetadata;
42
42
  private readonly compilationMode;
43
- constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaRegistry: MetadataRegistry, scopeRegistry: LocalModuleScopeRegistry, injectableRegistry: InjectableClassRegistry, isCore: boolean, perf: PerfRecorder, includeClassMetadata: boolean, compilationMode: CompilationMode);
43
+ private readonly generateExtraImportsInLocalMode;
44
+ constructor(reflector: ReflectionHost, evaluator: PartialEvaluator, metaRegistry: MetadataRegistry, scopeRegistry: LocalModuleScopeRegistry, injectableRegistry: InjectableClassRegistry, isCore: boolean, perf: PerfRecorder, includeClassMetadata: boolean, compilationMode: CompilationMode, generateExtraImportsInLocalMode: boolean);
44
45
  readonly precedence = HandlerPrecedence.PRIMARY;
45
46
  readonly name = "PipeDecoratorHandler";
46
47
  detect(node: ClassDeclaration, decorators: Decorator[] | null): DetectResult<Decorator> | undefined;
@@ -302,6 +302,12 @@ export interface BazelAndG3Options {
302
302
  * `@defer` blocks.
303
303
  */
304
304
  onlyExplicitDeferDependencyImports?: boolean;
305
+ /**
306
+ * Generates extra imports in local compilation mode which imply the extra imports generated in
307
+ * full mode compilation (e.g., imports for statically resolved component dependencies). These
308
+ * extra imports are needed for bundling purposes in g3.
309
+ */
310
+ generateExtraImportsInLocalMode?: boolean;
305
311
  }
306
312
  /**
307
313
  * Options related to i18n compilation support.
@@ -393,4 +399,8 @@ export interface MiscOptions {
393
399
  * another library without option set will not issue error if rendered in orphan way.
394
400
  */
395
401
  forbidOrphanComponents?: boolean;
402
+ /**
403
+ * Whether to use TemplateDefinitionBuilder as the code generator, or Template Pipeline.
404
+ */
405
+ useTemplatePipeline?: boolean;
396
406
  }
@@ -7,12 +7,13 @@
7
7
  */
8
8
  import ts from 'typescript';
9
9
  import { ErrorCode } from './error_code';
10
- export declare class FatalDiagnosticError {
10
+ export declare class FatalDiagnosticError extends Error {
11
11
  readonly code: ErrorCode;
12
12
  readonly node: ts.Node;
13
- readonly message: string | ts.DiagnosticMessageChain;
13
+ readonly diagnosticMessage: string | ts.DiagnosticMessageChain;
14
14
  readonly relatedInformation?: ts.DiagnosticRelatedInformation[] | undefined;
15
- constructor(code: ErrorCode, node: ts.Node, message: string | ts.DiagnosticMessageChain, relatedInformation?: ts.DiagnosticRelatedInformation[] | undefined);
15
+ constructor(code: ErrorCode, node: ts.Node, diagnosticMessage: string | ts.DiagnosticMessageChain, relatedInformation?: ts.DiagnosticRelatedInformation[] | undefined);
16
+ message: never;
16
17
  toDiagnostic(): ts.DiagnosticWithLocation;
17
18
  }
18
19
  export declare function makeDiagnostic(code: ErrorCode, node: ts.Node, messageText: string | ts.DiagnosticMessageChain, relatedInformation?: ts.DiagnosticRelatedInformation[]): ts.DiagnosticWithLocation;
@@ -32,6 +32,11 @@ export declare enum ErrorCode {
32
32
  * e.g. a signal input is also declared in the `@Directive` `inputs` array.
33
33
  */
34
34
  INITIALIZER_API_DECORATOR_METADATA_COLLISION = 1051,
35
+ /**
36
+ * Raised whenever an initializer API does not support the `.required`
37
+ * function, but is still detected unexpectedly.
38
+ */
39
+ INITIALIZER_API_NO_REQUIRED_FUNCTION = 1052,
35
40
  /**
36
41
  * An Angular feature, like inputs, outputs or queries is incorrectly
37
42
  * declared on a static member.
@@ -408,18 +413,11 @@ export declare enum ErrorCode {
408
413
  */
409
414
  SUGGEST_SUBOPTIMAL_TYPE_INFERENCE = 10002,
410
415
  /**
411
- * A string is imported from another file to be used as template string for a component in local
412
- * compilation mode.
413
- */
414
- LOCAL_COMPILATION_IMPORTED_TEMPLATE_STRING = 11001,
415
- /**
416
- * A string is imported from another file to be used as styles string for a component in local
417
- * compilation mode.
416
+ * In local compilation mode a const is required to be resolved statically but cannot be so since it is imported from a file outside of the compilation unit. This usually happens with const being used as Angular decorators parameters such as `@Component.template`, `@HostListener.eventName`, etc.
418
417
  */
419
- LOCAL_COMPILATION_IMPORTED_STYLES_STRING = 11002,
418
+ LOCAL_COMPILATION_UNRESOLVED_CONST = 11001,
420
419
  /**
421
- * Raised when the compiler wasn't able to resolve the metadata of a host directive in local
422
- * compilation mode.
420
+ * In local compilation mode some element in the hostDirective array is an expression (e.g., a forward ref function). This is not supported in local compilation mode as it is not a very common use case.
423
421
  */
424
- LOCAL_COMPILATION_HOST_DIRECTIVE_INVALID = 11003
422
+ LOCAL_COMPILATION_EXPRESSION_FOR_HOST_DIRECTIVE = 11003
425
423
  }
@@ -101,6 +101,7 @@ export interface FunctionEntry extends DocEntry {
101
101
  params: ParameterEntry[];
102
102
  returnType: string;
103
103
  generics: GenericEntry[];
104
+ isNewType: boolean;
104
105
  }
105
106
  /** Sub-entry for a single class or enum member. */
106
107
  export interface MemberEntry {
@@ -7,11 +7,12 @@
7
7
  */
8
8
  import ts from 'typescript';
9
9
  import { FunctionEntry } from './entities';
10
- export type FunctionLike = ts.FunctionDeclaration | ts.MethodDeclaration | ts.MethodSignature;
10
+ export type FunctionLike = ts.FunctionDeclaration | ts.MethodDeclaration | ts.MethodSignature | ts.CallSignatureDeclaration | ts.ConstructSignatureDeclaration;
11
11
  export declare class FunctionExtractor {
12
+ private name;
12
13
  private declaration;
13
14
  private typeChecker;
14
- constructor(declaration: FunctionLike, typeChecker: ts.TypeChecker);
15
+ constructor(name: string, declaration: FunctionLike, typeChecker: ts.TypeChecker);
15
16
  extract(): FunctionEntry;
16
17
  private extractAllParams;
17
18
  /** Gets all overloads for the function (excluding this extractor's FunctionDeclaration). */
@@ -10,6 +10,7 @@ export { ImportRewriter, NoopImportRewriter, R3SymbolsImportRewriter, validateAn
10
10
  export { DefaultImportTracker } from './src/default';
11
11
  export { DeferredSymbolTracker } from './src/deferred_symbol_tracker';
12
12
  export { AbsoluteModuleStrategy, assertSuccessfulReferenceEmit, EmittedReference, FailedEmitResult, ImportedFile, ImportFlags, LocalIdentifierStrategy, LogicalProjectStrategy, ReferenceEmitKind, ReferenceEmitResult, ReferenceEmitStrategy, ReferenceEmitter, RelativePathStrategy, UnifiedModulesStrategy } from './src/emitter';
13
+ export { LocalCompilationExtraImportsTracker } from './src/local_compilation_extra_imports_tracker';
13
14
  export { isAliasImportDeclaration, loadIsReferencedAliasDeclarationPatch } from './src/patch_alias_reference_resolution';
14
15
  export { Reexport } from './src/reexport';
15
16
  export { OwningModule, Reference } from './src/references';
@@ -0,0 +1,56 @@
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 ts from 'typescript';
9
+ /**
10
+ * A tool to track extra imports to be added to the generated files in the local compilation mode.
11
+ *
12
+ * This is needed for g3 bundling mechanism which requires dev files (= locally compiled) to have
13
+ * imports resemble those generated for prod files (= full compilation mode). In full compilation
14
+ * mode Angular compiler generates extra imports for statically analyzed component dependencies. We
15
+ * need similar imports in local compilation as well.
16
+ *
17
+ * The tool offers API for adding local imports (to be added to a specific file) and global imports
18
+ * (to be added to all the files in the local compilation). For more details on how these extra
19
+ * imports are determined see this design doc:
20
+ * https://docs.google.com/document/d/1dOWoSDvOY9ozlMmyCnxoFLEzGgHmTFVRAOVdVU-bxlI/edit?tab=t.0#heading=h.5n3k516r57g5
21
+ *
22
+ * An instance of this class will be passed to each annotation handler so that they can register the
23
+ * extra imports that they see fit. Later on, the instance is passed to the Ivy transformer ({@link
24
+ * ivyTransformFactory}) and it is used to add the extra imports registered by the handlers to the
25
+ * import manager ({@link ImportManager}) in order to have these imports generated.
26
+ *
27
+ * The extra imports are all side effect imports, and so they are identified by a single string
28
+ * containing the module name.
29
+ *
30
+ */
31
+ export declare class LocalCompilationExtraImportsTracker {
32
+ private readonly typeChecker;
33
+ private readonly localImportsMap;
34
+ private readonly globalImportsSet;
35
+ constructor(typeChecker: ts.TypeChecker);
36
+ /**
37
+ * Adds an extra import to be added to the generated file of a specific source file.
38
+ */
39
+ addImportForFile(sf: ts.SourceFile, moduleName: string): void;
40
+ /**
41
+ * If the given node is an imported identifier, this method adds the module from which it is
42
+ * imported as an extra import to the generated file of each source file in the compilation unit,
43
+ * otherwise the method is noop.
44
+ *
45
+ * Adding an extra import to all files is not optimal though. There are rooms to optimize and a
46
+ * add the import to a subset of files (e.g., exclude all the non Angular files as they don't need
47
+ * any extra import). However for this first version of this feature we go by this mechanism for
48
+ * simplicity. There will be on-going work to further optimize this method to add the extra import
49
+ * to smallest possible candidate files instead of all files.
50
+ */
51
+ addGlobalImportFromIdentifier(node: ts.Node): void;
52
+ /**
53
+ * Returns the list of all module names that the given file should include as its extra imports.
54
+ */
55
+ getImportsForFile(sf: ts.SourceFile): string[];
56
+ }
@@ -128,6 +128,15 @@ export type InputMapping = InputOrOutput & {
128
128
  */
129
129
  transform: DecoratorInputTransform | null;
130
130
  };
131
+ /** Metadata for a model mapping. */
132
+ export interface ModelMapping {
133
+ /** Node defining the model mapping. */
134
+ call: ts.CallExpression;
135
+ /** Information about the input declared by the model. */
136
+ input: InputMapping;
137
+ /** Information about the output implicitly declared by the model. */
138
+ output: InputOrOutput;
139
+ }
131
140
  /** Metadata for an `@Input()` transform function. */
132
141
  export interface DecoratorInputTransform {
133
142
  /**
@@ -72,7 +72,6 @@ export declare function filterToMembersWithDecorator(members: ClassMember[], nam
72
72
  export declare function findMember(members: ClassMember[], name: string, isStatic?: boolean): ClassMember | null;
73
73
  export declare function reflectObjectLiteral(node: ts.ObjectLiteralExpression): Map<string, ts.Expression>;
74
74
  /**
75
- * Return the ImportDeclaration for the given `node` if it is either an `ImportSpecifier` or a
76
- * `NamespaceImport`. If not return `null`.
75
+ * Gets the closest ancestor `ImportDeclaration` to a node.
77
76
  */
78
77
  export declare function getContainingImportDeclaration(node: ts.Node): ts.ImportDeclaration | null;
@@ -6,8 +6,8 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import ts from 'typescript';
9
- import { DefaultImportTracker, ImportRewriter } from '../../imports';
9
+ import { DefaultImportTracker, ImportRewriter, LocalCompilationExtraImportsTracker } from '../../imports';
10
10
  import { PerfRecorder } from '../../perf';
11
11
  import { ReflectionHost } from '../../reflection';
12
12
  import { TraitCompiler } from './compilation';
13
- export declare function ivyTransformFactory(compilation: TraitCompiler, reflector: ReflectionHost, importRewriter: ImportRewriter, defaultImportTracker: DefaultImportTracker, perf: PerfRecorder, isCore: boolean, isClosureCompilerEnabled: boolean): ts.TransformerFactory<ts.SourceFile>;
13
+ export declare function ivyTransformFactory(compilation: TraitCompiler, reflector: ReflectionHost, importRewriter: ImportRewriter, defaultImportTracker: DefaultImportTracker, localCompilationExtraImportsTracker: LocalCompilationExtraImportsTracker | null, perf: PerfRecorder, isCore: boolean, isClosureCompilerEnabled: boolean): ts.TransformerFactory<ts.SourceFile>;
@@ -8,7 +8,7 @@
8
8
  export { AstFactory, BinaryOperator, LeadingComment, ObjectLiteralProperty, SourceMapLocation, SourceMapRange, TemplateElement, TemplateLiteral, UnaryOperator, VariableDeclarationType } from './src/api/ast_factory';
9
9
  export { ImportGenerator, NamedImport } from './src/api/import_generator';
10
10
  export { Context } from './src/context';
11
- export { Import, ImportManager } from './src/import_manager';
11
+ export { Import, ImportManager, NamespaceImport, SideEffectImport } from './src/import_manager';
12
12
  export { ExpressionTranslatorVisitor, RecordWrappedNodeFn, TranslatorOptions } from './src/translator';
13
13
  export { canEmitType, TypeEmitter, TypeReferenceTranslator } from './src/type_emitter';
14
14
  export { translateType } from './src/type_translator';
@@ -9,14 +9,30 @@ import ts from 'typescript';
9
9
  import { ImportRewriter } from '../../imports';
10
10
  import { ImportGenerator, NamedImport } from './api/import_generator';
11
11
  /**
12
- * Information about an import that has been added to a module.
12
+ * Information about a namespace import that has been added to a module.
13
13
  */
14
- export interface Import {
14
+ export interface NamespaceImport {
15
15
  /** The name of the module that has been imported. */
16
16
  specifier: string;
17
17
  /** The `ts.Identifier` by which the imported module is known. */
18
18
  qualifier: ts.Identifier;
19
19
  }
20
+ /**
21
+ * Information about a side effect import that has been added to a module.
22
+ */
23
+ export interface SideEffectImport {
24
+ /** The name of the module that has been imported. */
25
+ specifier: string;
26
+ /**
27
+ * The qualifier of a side effect import is always non-existent, and that can be used to check
28
+ * whether the import is side effect or not.
29
+ */
30
+ qualifier: null;
31
+ }
32
+ /**
33
+ * Information about an import that has been added to a module.
34
+ */
35
+ export type Import = NamespaceImport | SideEffectImport;
20
36
  export declare class ImportManager implements ImportGenerator<ts.Identifier> {
21
37
  protected rewriter: ImportRewriter;
22
38
  private prefix;
@@ -26,5 +42,6 @@ export declare class ImportManager implements ImportGenerator<ts.Identifier> {
26
42
  constructor(rewriter?: ImportRewriter, prefix?: string, factory?: ts.NodeFactory);
27
43
  generateNamespaceImport(moduleName: string): ts.Identifier;
28
44
  generateNamedImport(moduleName: string, originalSymbol: string): NamedImport<ts.Identifier>;
45
+ generateSideEffectImport(moduleName: string): void;
29
46
  getAllImports(contextPath: string): Import[];
30
47
  }
@@ -23,7 +23,8 @@ export declare enum CommentTriviaType {
23
23
  export declare enum ExpressionIdentifier {
24
24
  DIRECTIVE = "DIR",
25
25
  COMPONENT_COMPLETION = "COMPCOMP",
26
- EVENT_PARAMETER = "EP"
26
+ EVENT_PARAMETER = "EP",
27
+ VARIABLE_AS_EXPRESSION = "VAE"
27
28
  }
28
29
  /** Tags the node with the given expression identifier. */
29
30
  export declare function addExpressionIdentifier(node: ts.Node, identifier: ExpressionIdentifier): void;
@@ -6,6 +6,7 @@
6
6
  * found in the LICENSE file at https://angular.io/license
7
7
  */
8
8
  import ts from 'typescript';
9
+ import { Import } from '../../translator';
9
10
  export declare function tsCastToAny(expr: ts.Expression): ts.Expression;
10
11
  /**
11
12
  * Create an expression which instantiates an element by its HTML tagName.
@@ -48,3 +49,4 @@ export declare function isAccessExpression(node: ts.Node): node is ts.ElementAcc
48
49
  * Creates a TypeScript node representing a numeric value.
49
50
  */
50
51
  export declare function tsNumericExpression(value: number): ts.NumericLiteral | ts.PrefixUnaryExpression;
52
+ export declare function getImportString(imp: Import): string;