@angular/compiler 14.0.0-next.8 → 14.0.0-rc.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (148) hide show
  1. package/esm2020/src/compiler.mjs +3 -2
  2. package/esm2020/src/compiler_facade_interface.mjs +7 -1
  3. package/esm2020/src/core.mjs +6 -6
  4. package/esm2020/src/expression_parser/parser.mjs +12 -12
  5. package/esm2020/src/i18n/i18n_parser.mjs +3 -3
  6. package/esm2020/src/jit_compiler_facade.mjs +74 -42
  7. package/esm2020/src/ml_parser/html_whitespaces.mjs +2 -2
  8. package/esm2020/src/ml_parser/lexer.mjs +36 -36
  9. package/esm2020/src/ml_parser/parser.mjs +41 -41
  10. package/esm2020/src/render3/partial/api.mjs +1 -1
  11. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  12. package/esm2020/src/render3/partial/component.mjs +28 -37
  13. package/esm2020/src/render3/partial/directive.mjs +6 -3
  14. package/esm2020/src/render3/partial/factory.mjs +1 -1
  15. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  16. package/esm2020/src/render3/partial/injector.mjs +1 -1
  17. package/esm2020/src/render3/partial/ng_module.mjs +3 -3
  18. package/esm2020/src/render3/partial/pipe.mjs +6 -3
  19. package/esm2020/src/render3/r3_ast.mjs +3 -3
  20. package/esm2020/src/render3/r3_factory.mjs +6 -6
  21. package/esm2020/src/render3/r3_identifiers.mjs +2 -1
  22. package/esm2020/src/render3/r3_pipe_compiler.mjs +5 -1
  23. package/esm2020/src/render3/util.mjs +4 -4
  24. package/esm2020/src/render3/view/api.mjs +7 -2
  25. package/esm2020/src/render3/view/compiler.mjs +45 -35
  26. package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +58 -5
  27. package/esm2020/src/render3/view/i18n/meta.mjs +4 -4
  28. package/esm2020/src/render3/view/i18n/util.mjs +2 -2
  29. package/esm2020/src/render3/view/style_parser.mjs +19 -19
  30. package/esm2020/src/render3/view/styling_builder.mjs +6 -6
  31. package/esm2020/src/render3/view/template.mjs +25 -25
  32. package/esm2020/src/render3/view/util.mjs +14 -5
  33. package/esm2020/src/selector.mjs +8 -8
  34. package/esm2020/src/template_parser/binding_parser.mjs +8 -8
  35. package/esm2020/src/util.mjs +8 -8
  36. package/esm2020/src/version.mjs +1 -1
  37. package/fesm2015/compiler.mjs +416 -301
  38. package/fesm2015/compiler.mjs.map +1 -1
  39. package/fesm2015/testing.mjs +1 -1
  40. package/fesm2020/compiler.mjs +424 -314
  41. package/fesm2020/compiler.mjs.map +1 -1
  42. package/fesm2020/testing.mjs +1 -1
  43. package/index.d.ts +4964 -5
  44. package/package.json +3 -3
  45. package/testing/index.d.ts +22 -5
  46. package/compiler.d.ts +0 -8
  47. package/public_api.d.ts +0 -13
  48. package/src/assertions.d.ts +0 -8
  49. package/src/chars.d.ts +0 -75
  50. package/src/compiler.d.ts +0 -77
  51. package/src/compiler_facade_interface.d.ts +0 -284
  52. package/src/compiler_util/expression_converter.d.ts +0 -71
  53. package/src/config.d.ts +0 -25
  54. package/src/constant_pool.d.ts +0 -37
  55. package/src/core.d.ts +0 -216
  56. package/src/expression_parser/ast.d.ts +0 -440
  57. package/src/expression_parser/lexer.d.ts +0 -47
  58. package/src/expression_parser/parser.d.ts +0 -315
  59. package/src/i18n/big_integer.d.ts +0 -108
  60. package/src/i18n/digest.d.ts +0 -44
  61. package/src/i18n/extractor_merger.d.ts +0 -27
  62. package/src/i18n/i18n_ast.d.ts +0 -148
  63. package/src/i18n/i18n_html_parser.d.ts +0 -19
  64. package/src/i18n/i18n_parser.d.ts +0 -18
  65. package/src/i18n/index.d.ts +0 -15
  66. package/src/i18n/message_bundle.d.ts +0 -28
  67. package/src/i18n/parse_util.d.ts +0 -14
  68. package/src/i18n/serializers/placeholder.d.ts +0 -25
  69. package/src/i18n/serializers/serializer.d.ts +0 -46
  70. package/src/i18n/serializers/xliff.d.ts +0 -19
  71. package/src/i18n/serializers/xliff2.d.ts +0 -19
  72. package/src/i18n/serializers/xmb.d.ts +0 -22
  73. package/src/i18n/serializers/xml_helper.d.ts +0 -52
  74. package/src/i18n/serializers/xtb.d.ts +0 -20
  75. package/src/i18n/translation_bundle.d.ts +0 -27
  76. package/src/injectable_compiler_2.d.ts +0 -24
  77. package/src/jit_compiler_facade.d.ts +0 -46
  78. package/src/ml_parser/ast.d.ts +0 -89
  79. package/src/ml_parser/entities.d.ts +0 -9
  80. package/src/ml_parser/html_parser.d.ts +0 -13
  81. package/src/ml_parser/html_tags.d.ts +0 -33
  82. package/src/ml_parser/html_whitespaces.d.ts +0 -45
  83. package/src/ml_parser/icu_ast_expander.d.ts +0 -42
  84. package/src/ml_parser/interpolation_config.d.ts +0 -14
  85. package/src/ml_parser/lexer.d.ts +0 -114
  86. package/src/ml_parser/parser.d.ts +0 -26
  87. package/src/ml_parser/tags.d.ts +0 -29
  88. package/src/ml_parser/tokens.d.ts +0 -141
  89. package/src/ml_parser/xml_parser.d.ts +0 -13
  90. package/src/ml_parser/xml_tags.d.ts +0 -24
  91. package/src/output/abstract_emitter.d.ts +0 -66
  92. package/src/output/abstract_js_emitter.d.ts +0 -19
  93. package/src/output/map_util.d.ts +0 -18
  94. package/src/output/output_ast.d.ts +0 -575
  95. package/src/output/output_jit.d.ts +0 -73
  96. package/src/output/output_jit_trusted_types.d.ts +0 -43
  97. package/src/output/source_map.d.ts +0 -29
  98. package/src/parse_util.d.ts +0 -75
  99. package/src/render3/partial/api.d.ts +0 -441
  100. package/src/render3/partial/class_metadata.d.ts +0 -10
  101. package/src/render3/partial/component.d.ts +0 -39
  102. package/src/render3/partial/directive.d.ts +0 -13
  103. package/src/render3/partial/factory.d.ts +0 -3
  104. package/src/render3/partial/injectable.d.ts +0 -19
  105. package/src/render3/partial/injector.d.ts +0 -3
  106. package/src/render3/partial/ng_module.d.ts +0 -3
  107. package/src/render3/partial/pipe.d.ts +0 -12
  108. package/src/render3/partial/util.d.ts +0 -33
  109. package/src/render3/r3_ast.d.ts +0 -211
  110. package/src/render3/r3_class_metadata_compiler.d.ts +0 -35
  111. package/src/render3/r3_factory.d.ts +0 -94
  112. package/src/render3/r3_identifiers.d.ts +0 -182
  113. package/src/render3/r3_injector_compiler.d.ts +0 -18
  114. package/src/render3/r3_jit.d.ts +0 -22
  115. package/src/render3/r3_module_compiler.d.ts +0 -103
  116. package/src/render3/r3_pipe_compiler.d.ts +0 -50
  117. package/src/render3/r3_template_transform.d.ts +0 -24
  118. package/src/render3/util.d.ts +0 -94
  119. package/src/render3/view/api.d.ts +0 -328
  120. package/src/render3/view/compiler.d.ts +0 -86
  121. package/src/render3/view/i18n/context.d.ts +0 -68
  122. package/src/render3/view/i18n/get_msg_utils.d.ts +0 -13
  123. package/src/render3/view/i18n/icu_serializer.d.ts +0 -9
  124. package/src/render3/view/i18n/localize_utils.d.ts +0 -24
  125. package/src/render3/view/i18n/meta.d.ts +0 -78
  126. package/src/render3/view/i18n/util.d.ts +0 -78
  127. package/src/render3/view/style_parser.d.ts +0 -18
  128. package/src/render3/view/styling_builder.d.ts +0 -211
  129. package/src/render3/view/t2_api.d.ts +0 -152
  130. package/src/render3/view/t2_binder.d.ts +0 -57
  131. package/src/render3/view/template.d.ts +0 -450
  132. package/src/render3/view/util.d.ts +0 -94
  133. package/src/resource_loader.d.ts +0 -17
  134. package/src/schema/dom_element_schema_registry.d.ts +0 -45
  135. package/src/schema/dom_security_schema.d.ts +0 -11
  136. package/src/schema/element_schema_registry.d.ts +0 -29
  137. package/src/schema/trusted_types_sinks.d.ts +0 -15
  138. package/src/selector.d.ts +0 -105
  139. package/src/shadow_css.d.ts +0 -76
  140. package/src/style_url_resolver.d.ts +0 -8
  141. package/src/template_parser/binding_parser.d.ts +0 -91
  142. package/src/template_parser/template_preparser.d.ts +0 -24
  143. package/src/util.d.ts +0 -42
  144. package/src/version.d.ts +0 -14
  145. package/testing/package.json +0 -9
  146. package/testing/public_api.d.ts +0 -13
  147. package/testing/src/testing.d.ts +0 -23
  148. package/testing/testing.d.ts +0 -4
@@ -1,103 +0,0 @@
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 { R3DeclareNgModuleFacade } from '../compiler_facade_interface';
9
- import * as o from '../output/output_ast';
10
- import { R3CompiledExpression, R3Reference } from './util';
11
- /**
12
- * How the selector scope of an NgModule (its declarations, imports, and exports) should be emitted
13
- * as a part of the NgModule definition.
14
- */
15
- export declare enum R3SelectorScopeMode {
16
- /**
17
- * Emit the declarations inline into the module definition.
18
- *
19
- * This option is useful in certain contexts where it's known that JIT support is required. The
20
- * tradeoff here is that this emit style prevents directives and pipes from being tree-shaken if
21
- * they are unused, but the NgModule is used.
22
- */
23
- Inline = 0,
24
- /**
25
- * Emit the declarations using a side effectful function call, `ɵɵsetNgModuleScope`, that is
26
- * guarded with the `ngJitMode` flag.
27
- *
28
- * This form of emit supports JIT and can be optimized away if the `ngJitMode` flag is set to
29
- * false, which allows unused directives and pipes to be tree-shaken.
30
- */
31
- SideEffect = 1,
32
- /**
33
- * Don't generate selector scopes at all.
34
- *
35
- * This is useful for contexts where JIT support is known to be unnecessary.
36
- */
37
- Omit = 2
38
- }
39
- /**
40
- * Metadata required by the module compiler to generate a module def (`ɵmod`) for a type.
41
- */
42
- export interface R3NgModuleMetadata {
43
- /**
44
- * An expression representing the module type being compiled.
45
- */
46
- type: R3Reference;
47
- /**
48
- * An expression representing the module type being compiled, intended for use within a class
49
- * definition itself.
50
- *
51
- * This can differ from the outer `type` if the class is being compiled by ngcc and is inside
52
- * an IIFE structure that uses a different name internally.
53
- */
54
- internalType: o.Expression;
55
- /**
56
- * An expression intended for use by statements that are adjacent (i.e. tightly coupled) to but
57
- * not internal to a class definition.
58
- *
59
- * This can differ from the outer `type` if the class is being compiled by ngcc and is inside
60
- * an IIFE structure that uses a different name internally.
61
- */
62
- adjacentType: o.Expression;
63
- /**
64
- * An array of expressions representing the bootstrap components specified by the module.
65
- */
66
- bootstrap: R3Reference[];
67
- /**
68
- * An array of expressions representing the directives and pipes declared by the module.
69
- */
70
- declarations: R3Reference[];
71
- /**
72
- * An array of expressions representing the imports of the module.
73
- */
74
- imports: R3Reference[];
75
- /**
76
- * An array of expressions representing the exports of the module.
77
- */
78
- exports: R3Reference[];
79
- /**
80
- * How to emit the selector scope values (declarations, imports, exports).
81
- */
82
- selectorScopeMode: R3SelectorScopeMode;
83
- /**
84
- * Whether to generate closure wrappers for bootstrap, declarations, imports, and exports.
85
- */
86
- containsForwardDecls: boolean;
87
- /**
88
- * The set of schemas that declare elements to be allowed in the NgModule.
89
- */
90
- schemas: R3Reference[] | null;
91
- /** Unique ID or expression representing the unique ID of an NgModule. */
92
- id: o.Expression | null;
93
- }
94
- /**
95
- * Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
96
- */
97
- export declare function compileNgModule(meta: R3NgModuleMetadata): R3CompiledExpression;
98
- /**
99
- * This function is used in JIT mode to generate the call to `ɵɵdefineNgModule()` from a call to
100
- * `ɵɵngDeclareNgModule()`.
101
- */
102
- export declare function compileNgModuleDeclarationExpression(meta: R3DeclareNgModuleFacade): o.Expression;
103
- export declare function createNgModuleType({ type: moduleType, declarations, imports, exports }: R3NgModuleMetadata): o.ExpressionType;
@@ -1,50 +0,0 @@
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 * as o from '../output/output_ast';
9
- import { R3DependencyMetadata } from './r3_factory';
10
- import { R3CompiledExpression, R3Reference } from './util';
11
- export interface R3PipeMetadata {
12
- /**
13
- * Name of the pipe type.
14
- */
15
- name: string;
16
- /**
17
- * An expression representing a reference to the pipe itself.
18
- */
19
- type: R3Reference;
20
- /**
21
- * An expression representing the pipe being compiled, intended for use within a class definition
22
- * itself.
23
- *
24
- * This can differ from the outer `type` if the class is being compiled by ngcc and is inside an
25
- * IIFE structure that uses a different name internally.
26
- */
27
- internalType: o.Expression;
28
- /**
29
- * Number of generic type parameters of the type itself.
30
- */
31
- typeArgumentCount: number;
32
- /**
33
- * Name of the pipe.
34
- */
35
- pipeName: string;
36
- /**
37
- * Dependencies of the pipe's constructor.
38
- */
39
- deps: R3DependencyMetadata[] | null;
40
- /**
41
- * Whether the pipe is marked as pure.
42
- */
43
- pure: boolean;
44
- /**
45
- * Whether the pipe is standalone.
46
- */
47
- isStandalone: boolean;
48
- }
49
- export declare function compilePipeFromMetadata(metadata: R3PipeMetadata): R3CompiledExpression;
50
- export declare function createPipeType(metadata: R3PipeMetadata): o.Type;
@@ -1,24 +0,0 @@
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 * as html from '../ml_parser/ast';
9
- import { ParseError } from '../parse_util';
10
- import { BindingParser } from '../template_parser/binding_parser';
11
- import * as t from './r3_ast';
12
- export interface Render3ParseResult {
13
- nodes: t.Node[];
14
- errors: ParseError[];
15
- styles: string[];
16
- styleUrls: string[];
17
- ngContentSelectors: string[];
18
- commentNodes?: t.Comment[];
19
- }
20
- interface Render3ParseOptions {
21
- collectCommentNodes: boolean;
22
- }
23
- export declare function htmlAstToRender3Ast(htmlNodes: html.Node[], bindingParser: BindingParser, options: Render3ParseOptions): Render3ParseResult;
24
- export {};
@@ -1,94 +0,0 @@
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 * as o from '../output/output_ast';
9
- export declare function typeWithParameters(type: o.Expression, numParams: number): o.ExpressionType;
10
- export interface R3Reference {
11
- value: o.Expression;
12
- type: o.Expression;
13
- }
14
- /**
15
- * Result of compilation of a render3 code unit, e.g. component, directive, pipe, etc.
16
- */
17
- export interface R3CompiledExpression {
18
- expression: o.Expression;
19
- type: o.Type;
20
- statements: o.Statement[];
21
- }
22
- export declare function prepareSyntheticPropertyName(name: string): string;
23
- export declare function prepareSyntheticListenerName(name: string, phase: string): string;
24
- export declare function getSafePropertyAccessString(accessor: string, name: string): string;
25
- export declare function prepareSyntheticListenerFunctionName(name: string, phase: string): string;
26
- export declare function jitOnlyGuardedExpression(expr: o.Expression): o.Expression;
27
- export declare function devOnlyGuardedExpression(expr: o.Expression): o.Expression;
28
- export declare function guardedExpression(guard: string, expr: o.Expression): o.Expression;
29
- export declare function wrapReference(value: any): R3Reference;
30
- export declare function refsToArray(refs: R3Reference[], shouldForwardDeclare: boolean): o.Expression;
31
- /**
32
- * Describes an expression that may have been wrapped in a `forwardRef()` guard.
33
- *
34
- * This is used when describing expressions that can refer to types that may eagerly reference types
35
- * that have not yet been defined.
36
- */
37
- export interface MaybeForwardRefExpression<T extends o.Expression = o.Expression> {
38
- /**
39
- * The unwrapped expression.
40
- */
41
- expression: T;
42
- /**
43
- * Specified whether the `expression` contains a reference to something that has not yet been
44
- * defined, and whether the expression is still wrapped in a `forwardRef()` call.
45
- *
46
- * If this value is `ForwardRefHandling.None` then the `expression` is safe to use as-is.
47
- *
48
- * Otherwise the `expression` was wrapped in a call to `forwardRef()` and must not be eagerly
49
- * evaluated. Instead it must be wrapped in a function closure that will be evaluated lazily to
50
- * allow the definition of the expression to be evaluated first.
51
- *
52
- * In full AOT compilation it can be safe to unwrap the `forwardRef()` call up front if the
53
- * expression will actually be evaluated lazily inside a function call after the value of
54
- * `expression` has been defined.
55
- *
56
- * But in other cases, such as partial AOT compilation or JIT compilation the expression will be
57
- * evaluated eagerly in top level code so will need to continue to be wrapped in a `forwardRef()`
58
- * call.
59
- *
60
- */
61
- forwardRef: ForwardRefHandling;
62
- }
63
- export declare function createMayBeForwardRefExpression<T extends o.Expression>(expression: T, forwardRef: ForwardRefHandling): MaybeForwardRefExpression<T>;
64
- /**
65
- * Convert a `MaybeForwardRefExpression` to an `Expression`, possibly wrapping its expression in a
66
- * `forwardRef()` call.
67
- *
68
- * If `MaybeForwardRefExpression.forwardRef` is `ForwardRefHandling.Unwrapped` then the expression
69
- * was originally wrapped in a `forwardRef()` call to prevent the value from being eagerly evaluated
70
- * in the code.
71
- *
72
- * See `packages/compiler-cli/src/ngtsc/annotations/src/injectable.ts` and
73
- * `packages/compiler/src/jit_compiler_facade.ts` for more information.
74
- */
75
- export declare function convertFromMaybeForwardRefExpression({ expression, forwardRef }: MaybeForwardRefExpression): o.Expression;
76
- /**
77
- * Generate an expression that has the given `expr` wrapped in the following form:
78
- *
79
- * ```
80
- * forwardRef(() => expr)
81
- * ```
82
- */
83
- export declare function generateForwardRef(expr: o.Expression): o.Expression;
84
- /**
85
- * Specifies how a forward ref has been handled in a MaybeForwardRefExpression
86
- */
87
- export declare const enum ForwardRefHandling {
88
- /** The expression was not wrapped in a `forwardRef()` call in the first place. */
89
- None = 0,
90
- /** The expression is still wrapped in a `forwardRef()` call. */
91
- Wrapped = 1,
92
- /** The expression was wrapped in a `forwardRef()` call but has since been unwrapped. */
93
- Unwrapped = 2
94
- }
@@ -1,328 +0,0 @@
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 { ChangeDetectionStrategy, ViewEncapsulation } from '../../core';
9
- import { InterpolationConfig } from '../../ml_parser/interpolation_config';
10
- import * as o from '../../output/output_ast';
11
- import { ParseSourceSpan } from '../../parse_util';
12
- import * as t from '../r3_ast';
13
- import { R3DependencyMetadata } from '../r3_factory';
14
- import { MaybeForwardRefExpression, R3Reference } from '../util';
15
- /**
16
- * Information needed to compile a directive for the render3 runtime.
17
- */
18
- export interface R3DirectiveMetadata {
19
- /**
20
- * Name of the directive type.
21
- */
22
- name: string;
23
- /**
24
- * An expression representing a reference to the directive itself.
25
- */
26
- type: R3Reference;
27
- /**
28
- * An expression representing a reference to the directive being compiled, intended for use within
29
- * a class definition itself.
30
- *
31
- * This can differ from the outer `type` if the class is being compiled by ngcc and is inside
32
- * an IIFE structure that uses a different name internally.
33
- */
34
- internalType: o.Expression;
35
- /**
36
- * Number of generic type parameters of the type itself.
37
- */
38
- typeArgumentCount: number;
39
- /**
40
- * A source span for the directive type.
41
- */
42
- typeSourceSpan: ParseSourceSpan;
43
- /**
44
- * Dependencies of the directive's constructor.
45
- */
46
- deps: R3DependencyMetadata[] | 'invalid' | null;
47
- /**
48
- * Unparsed selector of the directive, or `null` if there was no selector.
49
- */
50
- selector: string | null;
51
- /**
52
- * Information about the content queries made by the directive.
53
- */
54
- queries: R3QueryMetadata[];
55
- /**
56
- * Information about the view queries made by the directive.
57
- */
58
- viewQueries: R3QueryMetadata[];
59
- /**
60
- * Mappings indicating how the directive interacts with its host element (host bindings,
61
- * listeners, etc).
62
- */
63
- host: R3HostMetadata;
64
- /**
65
- * Information about usage of specific lifecycle events which require special treatment in the
66
- * code generator.
67
- */
68
- lifecycle: {
69
- /**
70
- * Whether the directive uses NgOnChanges.
71
- */
72
- usesOnChanges: boolean;
73
- };
74
- /**
75
- * A mapping of inputs from class property names to binding property names, or to a tuple of
76
- * binding property name and class property name if the names are different.
77
- */
78
- inputs: {
79
- [field: string]: string | [string, string];
80
- };
81
- /**
82
- * A mapping of outputs from class property names to binding property names, or to a tuple of
83
- * binding property name and class property name if the names are different.
84
- */
85
- outputs: {
86
- [field: string]: string;
87
- };
88
- /**
89
- * Whether or not the component or directive inherits from another class
90
- */
91
- usesInheritance: boolean;
92
- /**
93
- * Whether or not the component or directive inherits its entire decorator from its base class.
94
- */
95
- fullInheritance: boolean;
96
- /**
97
- * Reference name under which to export the directive's type in a template,
98
- * if any.
99
- */
100
- exportAs: string[] | null;
101
- /**
102
- * The list of providers defined in the directive.
103
- */
104
- providers: o.Expression | null;
105
- /**
106
- * Whether or not the component or directive is standalone.
107
- */
108
- isStandalone: boolean;
109
- }
110
- /**
111
- * Specifies how a list of declaration type references should be emitted into the generated code.
112
- */
113
- export declare const enum DeclarationListEmitMode {
114
- /**
115
- * The list of declarations is emitted into the generated code as is.
116
- *
117
- * ```
118
- * directives: [MyDir],
119
- * ```
120
- */
121
- Direct = 0,
122
- /**
123
- * The list of declarations is emitted into the generated code wrapped inside a closure, which
124
- * is needed when at least one declaration is a forward reference.
125
- *
126
- * ```
127
- * directives: function () { return [MyDir, ForwardDir]; },
128
- * ```
129
- */
130
- Closure = 1,
131
- /**
132
- * Similar to `Closure`, with the addition that the list of declarations can contain individual
133
- * items that are themselves forward references. This is relevant for JIT compilations, as
134
- * unwrapping the forwardRef cannot be done statically so must be deferred. This mode emits
135
- * the declaration list using a mapping transform through `resolveForwardRef` to ensure that
136
- * any forward references within the list are resolved when the outer closure is invoked.
137
- *
138
- * Consider the case where the runtime has captured two declarations in two distinct values:
139
- * ```
140
- * const dirA = MyDir;
141
- * const dirB = forwardRef(function() { return ForwardRef; });
142
- * ```
143
- *
144
- * This mode would emit the declarations captured in `dirA` and `dirB` as follows:
145
- * ```
146
- * directives: function () { return [dirA, dirB].map(ng.resolveForwardRef); },
147
- * ```
148
- */
149
- ClosureResolved = 2
150
- }
151
- /**
152
- * Information needed to compile a component for the render3 runtime.
153
- */
154
- export interface R3ComponentMetadata extends R3DirectiveMetadata {
155
- /**
156
- * Information about the component's template.
157
- */
158
- template: {
159
- /**
160
- * Parsed nodes of the template.
161
- */
162
- nodes: t.Node[];
163
- /**
164
- * Any ng-content selectors extracted from the template. Contains `*` when an ng-content
165
- * element without selector is present.
166
- */
167
- ngContentSelectors: string[];
168
- };
169
- /**
170
- * A map of pipe names to an expression referencing the pipe type which are in the scope of the
171
- * compilation.
172
- */
173
- pipes: Map<string, o.Expression>;
174
- /**
175
- * A list of directive selectors and an expression referencing the directive type which are in the
176
- * scope of the compilation.
177
- */
178
- directives: R3UsedDirectiveMetadata[];
179
- /**
180
- * Specifies how the 'directives' and/or `pipes` array, if generated, need to be emitted.
181
- */
182
- declarationListEmitMode: DeclarationListEmitMode;
183
- /**
184
- * A collection of styling data that will be applied and scoped to the component.
185
- */
186
- styles: string[];
187
- /**
188
- * An encapsulation policy for the component's styling.
189
- * Possible values:
190
- * - `ViewEncapsulation.Emulated`: Apply modified component styles in order to emulate
191
- * a native Shadow DOM CSS encapsulation behavior.
192
- * - `ViewEncapsulation.None`: Apply component styles globally without any sort of encapsulation.
193
- * - `ViewEncapsulation.ShadowDom`: Use the browser's native Shadow DOM API to encapsulate styles.
194
- */
195
- encapsulation: ViewEncapsulation;
196
- /**
197
- * A collection of animation triggers that will be used in the component template.
198
- */
199
- animations: o.Expression | null;
200
- /**
201
- * The list of view providers defined in the component.
202
- */
203
- viewProviders: o.Expression | null;
204
- /**
205
- * Path to the .ts file in which this template's generated code will be included, relative to
206
- * the compilation root. This will be used to generate identifiers that need to be globally
207
- * unique in certain contexts (such as g3).
208
- */
209
- relativeContextFilePath: string;
210
- /**
211
- * Whether translation variable name should contain external message id
212
- * (used by Closure Compiler's output of `goog.getMsg` for transition period).
213
- */
214
- i18nUseExternalIds: boolean;
215
- /**
216
- * Overrides the default interpolation start and end delimiters ({{ and }}).
217
- */
218
- interpolation: InterpolationConfig;
219
- /**
220
- * Strategy used for detecting changes in the component.
221
- */
222
- changeDetection?: ChangeDetectionStrategy;
223
- }
224
- /**
225
- * Information about a directive that is used in a component template. Only the stable, public
226
- * facing information of the directive is stored here.
227
- */
228
- export interface R3UsedDirectiveMetadata {
229
- /**
230
- * The type of the directive as an expression.
231
- */
232
- type: o.Expression;
233
- /**
234
- * The selector of the directive.
235
- */
236
- selector: string;
237
- /**
238
- * The binding property names of the inputs of the directive.
239
- */
240
- inputs: string[];
241
- /**
242
- * The binding property names of the outputs of the directive.
243
- */
244
- outputs: string[];
245
- /**
246
- * Name under which the directive is exported, if any (exportAs in Angular). Null otherwise.
247
- */
248
- exportAs: string[] | null;
249
- /**
250
- * If true then this directive is actually a component; otherwise it is not.
251
- */
252
- isComponent?: boolean;
253
- }
254
- /**
255
- * Information needed to compile a query (view or content).
256
- */
257
- export interface R3QueryMetadata {
258
- /**
259
- * Name of the property on the class to update with query results.
260
- */
261
- propertyName: string;
262
- /**
263
- * Whether to read only the first matching result, or an array of results.
264
- */
265
- first: boolean;
266
- /**
267
- * Either an expression representing a type or `InjectionToken` for the query
268
- * predicate, or a set of string selectors.
269
- */
270
- predicate: MaybeForwardRefExpression | string[];
271
- /**
272
- * Whether to include only direct children or all descendants.
273
- */
274
- descendants: boolean;
275
- /**
276
- * If the `QueryList` should fire change event only if actual change to query was computed (vs old
277
- * behavior where the change was fired whenever the query was recomputed, even if the recomputed
278
- * query resulted in the same list.)
279
- */
280
- emitDistinctChangesOnly: boolean;
281
- /**
282
- * An expression representing a type to read from each matched node, or null if the default value
283
- * for a given node is to be returned.
284
- */
285
- read: o.Expression | null;
286
- /**
287
- * Whether or not this query should collect only static results.
288
- *
289
- * If static is true, the query's results will be set on the component after nodes are created,
290
- * but before change detection runs. This means that any results that relied upon change detection
291
- * to run (e.g. results inside *ngIf or *ngFor views) will not be collected. Query results are
292
- * available in the ngOnInit hook.
293
- *
294
- * If static is false, the query's results will be set on the component after change detection
295
- * runs. This means that the query results can contain nodes inside *ngIf or *ngFor views, but
296
- * the results will not be available in the ngOnInit hook (only in the ngAfterContentInit for
297
- * content hooks and ngAfterViewInit for view hooks).
298
- */
299
- static: boolean;
300
- }
301
- /**
302
- * Mappings indicating how the class interacts with its
303
- * host element (host bindings, listeners, etc).
304
- */
305
- export interface R3HostMetadata {
306
- /**
307
- * A mapping of attribute binding keys to `o.Expression`s.
308
- */
309
- attributes: {
310
- [key: string]: o.Expression;
311
- };
312
- /**
313
- * A mapping of event binding keys to unparsed expressions.
314
- */
315
- listeners: {
316
- [key: string]: string;
317
- };
318
- /**
319
- * A mapping of property binding keys to unparsed expressions.
320
- */
321
- properties: {
322
- [key: string]: string;
323
- };
324
- specialAttributes: {
325
- styleAttr?: string;
326
- classAttr?: string;
327
- };
328
- }
@@ -1,86 +0,0 @@
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 { ConstantPool } from '../../constant_pool';
9
- import * as o from '../../output/output_ast';
10
- import { ParseError, ParseSourceSpan } from '../../parse_util';
11
- import { BindingParser } from '../../template_parser/binding_parser';
12
- import { R3CompiledExpression } from '../util';
13
- import { R3ComponentMetadata, R3DirectiveMetadata } from './api';
14
- /**
15
- * Compile a directive for the render3 runtime as defined by the `R3DirectiveMetadata`.
16
- */
17
- export declare function compileDirectiveFromMetadata(meta: R3DirectiveMetadata, constantPool: ConstantPool, bindingParser: BindingParser): R3CompiledExpression;
18
- /**
19
- * Compile a component for the render3 runtime as defined by the `R3ComponentMetadata`.
20
- */
21
- export declare function compileComponentFromMetadata(meta: R3ComponentMetadata, constantPool: ConstantPool, bindingParser: BindingParser): R3CompiledExpression;
22
- /**
23
- * Creates the type specification from the component meta. This type is inserted into .d.ts files
24
- * to be consumed by upstream compilations.
25
- */
26
- export declare function createComponentType(meta: R3ComponentMetadata): o.Type;
27
- /**
28
- * A set of flags to be used with Queries.
29
- *
30
- * NOTE: Ensure changes here are in sync with `packages/core/src/render3/interfaces/query.ts`
31
- */
32
- export declare const enum QueryFlags {
33
- /**
34
- * No flags
35
- */
36
- none = 0,
37
- /**
38
- * Whether or not the query should descend into children.
39
- */
40
- descendants = 1,
41
- /**
42
- * The query can be computed statically and hence can be assigned eagerly.
43
- *
44
- * NOTE: Backwards compatibility with ViewEngine.
45
- */
46
- isStatic = 2,
47
- /**
48
- * If the `QueryList` should fire change event only if actual change to query was computed (vs old
49
- * behavior where the change was fired whenever the query was recomputed, even if the recomputed
50
- * query resulted in the same list.)
51
- */
52
- emitDistinctChangesOnly = 4
53
- }
54
- export declare function createDirectiveTypeParams(meta: R3DirectiveMetadata): o.Type[];
55
- /**
56
- * Creates the type specification from the directive meta. This type is inserted into .d.ts files
57
- * to be consumed by upstream compilations.
58
- */
59
- export declare function createDirectiveType(meta: R3DirectiveMetadata): o.Type;
60
- export interface ParsedHostBindings {
61
- attributes: {
62
- [key: string]: o.Expression;
63
- };
64
- listeners: {
65
- [key: string]: string;
66
- };
67
- properties: {
68
- [key: string]: string;
69
- };
70
- specialAttributes: {
71
- styleAttr?: string;
72
- classAttr?: string;
73
- };
74
- }
75
- export declare function parseHostBindings(host: {
76
- [key: string]: string | o.Expression;
77
- }): ParsedHostBindings;
78
- /**
79
- * Verifies host bindings and returns the list of errors (if any). Empty array indicates that a
80
- * given set of host bindings has no errors.
81
- *
82
- * @param bindings set of host bindings to verify.
83
- * @param sourceSpan source span where host bindings were defined.
84
- * @returns array of errors associated with a given set of host bindings.
85
- */
86
- export declare function verifyHostBindings(bindings: ParsedHostBindings, sourceSpan: ParseSourceSpan): ParseError[];