@angular/compiler 14.0.0-next.9 → 14.0.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.
- package/esm2020/src/compiler.mjs +3 -2
- package/esm2020/src/compiler_facade_interface.mjs +7 -1
- package/esm2020/src/core.mjs +6 -6
- package/esm2020/src/expression_parser/parser.mjs +12 -12
- package/esm2020/src/i18n/i18n_parser.mjs +3 -3
- package/esm2020/src/jit_compiler_facade.mjs +74 -42
- package/esm2020/src/ml_parser/html_whitespaces.mjs +2 -2
- package/esm2020/src/ml_parser/lexer.mjs +36 -36
- package/esm2020/src/ml_parser/parser.mjs +41 -41
- package/esm2020/src/render3/partial/api.mjs +1 -1
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/component.mjs +28 -37
- package/esm2020/src/render3/partial/directive.mjs +6 -3
- package/esm2020/src/render3/partial/factory.mjs +1 -1
- package/esm2020/src/render3/partial/injectable.mjs +1 -1
- package/esm2020/src/render3/partial/injector.mjs +1 -1
- package/esm2020/src/render3/partial/ng_module.mjs +3 -3
- package/esm2020/src/render3/partial/pipe.mjs +6 -3
- package/esm2020/src/render3/r3_ast.mjs +3 -3
- package/esm2020/src/render3/r3_factory.mjs +6 -6
- package/esm2020/src/render3/r3_identifiers.mjs +2 -1
- package/esm2020/src/render3/r3_pipe_compiler.mjs +5 -1
- package/esm2020/src/render3/util.mjs +4 -4
- package/esm2020/src/render3/view/api.mjs +7 -2
- package/esm2020/src/render3/view/compiler.mjs +45 -35
- package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +58 -5
- package/esm2020/src/render3/view/i18n/meta.mjs +4 -4
- package/esm2020/src/render3/view/i18n/util.mjs +2 -2
- package/esm2020/src/render3/view/style_parser.mjs +19 -19
- package/esm2020/src/render3/view/styling_builder.mjs +6 -6
- package/esm2020/src/render3/view/template.mjs +25 -25
- package/esm2020/src/render3/view/util.mjs +14 -5
- package/esm2020/src/selector.mjs +8 -8
- package/esm2020/src/template_parser/binding_parser.mjs +8 -8
- package/esm2020/src/util.mjs +8 -8
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +416 -301
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2020/compiler.mjs +424 -314
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/index.d.ts +4964 -5
- package/package.json +3 -3
- package/testing/index.d.ts +22 -5
- package/compiler.d.ts +0 -8
- package/public_api.d.ts +0 -13
- package/src/assertions.d.ts +0 -8
- package/src/chars.d.ts +0 -75
- package/src/compiler.d.ts +0 -77
- package/src/compiler_facade_interface.d.ts +0 -284
- package/src/compiler_util/expression_converter.d.ts +0 -71
- package/src/config.d.ts +0 -25
- package/src/constant_pool.d.ts +0 -37
- package/src/core.d.ts +0 -216
- package/src/expression_parser/ast.d.ts +0 -440
- package/src/expression_parser/lexer.d.ts +0 -47
- package/src/expression_parser/parser.d.ts +0 -315
- package/src/i18n/big_integer.d.ts +0 -108
- package/src/i18n/digest.d.ts +0 -44
- package/src/i18n/extractor_merger.d.ts +0 -27
- package/src/i18n/i18n_ast.d.ts +0 -148
- package/src/i18n/i18n_html_parser.d.ts +0 -19
- package/src/i18n/i18n_parser.d.ts +0 -18
- package/src/i18n/index.d.ts +0 -15
- package/src/i18n/message_bundle.d.ts +0 -28
- package/src/i18n/parse_util.d.ts +0 -14
- package/src/i18n/serializers/placeholder.d.ts +0 -25
- package/src/i18n/serializers/serializer.d.ts +0 -46
- package/src/i18n/serializers/xliff.d.ts +0 -19
- package/src/i18n/serializers/xliff2.d.ts +0 -19
- package/src/i18n/serializers/xmb.d.ts +0 -22
- package/src/i18n/serializers/xml_helper.d.ts +0 -52
- package/src/i18n/serializers/xtb.d.ts +0 -20
- package/src/i18n/translation_bundle.d.ts +0 -27
- package/src/injectable_compiler_2.d.ts +0 -24
- package/src/jit_compiler_facade.d.ts +0 -46
- package/src/ml_parser/ast.d.ts +0 -89
- package/src/ml_parser/entities.d.ts +0 -9
- package/src/ml_parser/html_parser.d.ts +0 -13
- package/src/ml_parser/html_tags.d.ts +0 -33
- package/src/ml_parser/html_whitespaces.d.ts +0 -45
- package/src/ml_parser/icu_ast_expander.d.ts +0 -42
- package/src/ml_parser/interpolation_config.d.ts +0 -14
- package/src/ml_parser/lexer.d.ts +0 -114
- package/src/ml_parser/parser.d.ts +0 -26
- package/src/ml_parser/tags.d.ts +0 -29
- package/src/ml_parser/tokens.d.ts +0 -141
- package/src/ml_parser/xml_parser.d.ts +0 -13
- package/src/ml_parser/xml_tags.d.ts +0 -24
- package/src/output/abstract_emitter.d.ts +0 -66
- package/src/output/abstract_js_emitter.d.ts +0 -19
- package/src/output/map_util.d.ts +0 -18
- package/src/output/output_ast.d.ts +0 -575
- package/src/output/output_jit.d.ts +0 -73
- package/src/output/output_jit_trusted_types.d.ts +0 -43
- package/src/output/source_map.d.ts +0 -29
- package/src/parse_util.d.ts +0 -75
- package/src/render3/partial/api.d.ts +0 -441
- package/src/render3/partial/class_metadata.d.ts +0 -10
- package/src/render3/partial/component.d.ts +0 -39
- package/src/render3/partial/directive.d.ts +0 -13
- package/src/render3/partial/factory.d.ts +0 -3
- package/src/render3/partial/injectable.d.ts +0 -19
- package/src/render3/partial/injector.d.ts +0 -3
- package/src/render3/partial/ng_module.d.ts +0 -3
- package/src/render3/partial/pipe.d.ts +0 -12
- package/src/render3/partial/util.d.ts +0 -33
- package/src/render3/r3_ast.d.ts +0 -211
- package/src/render3/r3_class_metadata_compiler.d.ts +0 -35
- package/src/render3/r3_factory.d.ts +0 -94
- package/src/render3/r3_identifiers.d.ts +0 -182
- package/src/render3/r3_injector_compiler.d.ts +0 -18
- package/src/render3/r3_jit.d.ts +0 -22
- package/src/render3/r3_module_compiler.d.ts +0 -103
- package/src/render3/r3_pipe_compiler.d.ts +0 -50
- package/src/render3/r3_template_transform.d.ts +0 -24
- package/src/render3/util.d.ts +0 -94
- package/src/render3/view/api.d.ts +0 -328
- package/src/render3/view/compiler.d.ts +0 -86
- package/src/render3/view/i18n/context.d.ts +0 -68
- package/src/render3/view/i18n/get_msg_utils.d.ts +0 -13
- package/src/render3/view/i18n/icu_serializer.d.ts +0 -9
- package/src/render3/view/i18n/localize_utils.d.ts +0 -24
- package/src/render3/view/i18n/meta.d.ts +0 -78
- package/src/render3/view/i18n/util.d.ts +0 -78
- package/src/render3/view/style_parser.d.ts +0 -18
- package/src/render3/view/styling_builder.d.ts +0 -211
- package/src/render3/view/t2_api.d.ts +0 -152
- package/src/render3/view/t2_binder.d.ts +0 -57
- package/src/render3/view/template.d.ts +0 -450
- package/src/render3/view/util.d.ts +0 -94
- package/src/resource_loader.d.ts +0 -17
- package/src/schema/dom_element_schema_registry.d.ts +0 -45
- package/src/schema/dom_security_schema.d.ts +0 -11
- package/src/schema/element_schema_registry.d.ts +0 -29
- package/src/schema/trusted_types_sinks.d.ts +0 -15
- package/src/selector.d.ts +0 -105
- package/src/shadow_css.d.ts +0 -76
- package/src/style_url_resolver.d.ts +0 -8
- package/src/template_parser/binding_parser.d.ts +0 -91
- package/src/template_parser/template_preparser.d.ts +0 -24
- package/src/util.d.ts +0 -42
- package/src/version.d.ts +0 -14
- package/testing/package.json +0 -9
- package/testing/public_api.d.ts +0 -13
- package/testing/src/testing.d.ts +0 -23
- package/testing/testing.d.ts +0 -4
package/fesm2020/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-
|
|
2
|
+
* @license Angular v14.0.0-rc.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -211,7 +211,7 @@ class CssSelector {
|
|
|
211
211
|
let inNot = false;
|
|
212
212
|
_SELECTOR_REGEXP.lastIndex = 0;
|
|
213
213
|
while (match = _SELECTOR_REGEXP.exec(selector)) {
|
|
214
|
-
if (match[1 /* NOT */]) {
|
|
214
|
+
if (match[1 /* SelectorRegexp.NOT */]) {
|
|
215
215
|
if (inNot) {
|
|
216
216
|
throw new Error('Nesting :not in a selector is not allowed');
|
|
217
217
|
}
|
|
@@ -219,9 +219,9 @@ class CssSelector {
|
|
|
219
219
|
current = new CssSelector();
|
|
220
220
|
cssSelector.notSelectors.push(current);
|
|
221
221
|
}
|
|
222
|
-
const tag = match[2 /* TAG */];
|
|
222
|
+
const tag = match[2 /* SelectorRegexp.TAG */];
|
|
223
223
|
if (tag) {
|
|
224
|
-
const prefix = match[3 /* PREFIX */];
|
|
224
|
+
const prefix = match[3 /* SelectorRegexp.PREFIX */];
|
|
225
225
|
if (prefix === '#') {
|
|
226
226
|
// #hash
|
|
227
227
|
current.addAttribute('id', tag.slice(1));
|
|
@@ -235,15 +235,15 @@ class CssSelector {
|
|
|
235
235
|
current.setElement(tag);
|
|
236
236
|
}
|
|
237
237
|
}
|
|
238
|
-
const attribute = match[4 /* ATTRIBUTE */];
|
|
238
|
+
const attribute = match[4 /* SelectorRegexp.ATTRIBUTE */];
|
|
239
239
|
if (attribute) {
|
|
240
|
-
current.addAttribute(current.unescapeAttribute(attribute), match[6 /* ATTRIBUTE_VALUE */]);
|
|
240
|
+
current.addAttribute(current.unescapeAttribute(attribute), match[6 /* SelectorRegexp.ATTRIBUTE_VALUE */]);
|
|
241
241
|
}
|
|
242
|
-
if (match[7 /* NOT_END */]) {
|
|
242
|
+
if (match[7 /* SelectorRegexp.NOT_END */]) {
|
|
243
243
|
inNot = false;
|
|
244
244
|
current = cssSelector;
|
|
245
245
|
}
|
|
246
|
-
if (match[8 /* SEPARATOR */]) {
|
|
246
|
+
if (match[8 /* SelectorRegexp.SEPARATOR */]) {
|
|
247
247
|
if (inNot) {
|
|
248
248
|
throw new Error('Multiple selectors in :not are not supported');
|
|
249
249
|
}
|
|
@@ -611,26 +611,26 @@ var MissingTranslationStrategy;
|
|
|
611
611
|
})(MissingTranslationStrategy || (MissingTranslationStrategy = {}));
|
|
612
612
|
function parserSelectorToSimpleSelector(selector) {
|
|
613
613
|
const classes = selector.classNames && selector.classNames.length ?
|
|
614
|
-
[8 /* CLASS */, ...selector.classNames] :
|
|
614
|
+
[8 /* SelectorFlags.CLASS */, ...selector.classNames] :
|
|
615
615
|
[];
|
|
616
616
|
const elementName = selector.element && selector.element !== '*' ? selector.element : '';
|
|
617
617
|
return [elementName, ...selector.attrs, ...classes];
|
|
618
618
|
}
|
|
619
619
|
function parserSelectorToNegativeSelector(selector) {
|
|
620
620
|
const classes = selector.classNames && selector.classNames.length ?
|
|
621
|
-
[8 /* CLASS */, ...selector.classNames] :
|
|
621
|
+
[8 /* SelectorFlags.CLASS */, ...selector.classNames] :
|
|
622
622
|
[];
|
|
623
623
|
if (selector.element) {
|
|
624
624
|
return [
|
|
625
|
-
1 /* NOT */ | 4 /* ELEMENT */, selector.element, ...selector.attrs, ...classes
|
|
625
|
+
1 /* SelectorFlags.NOT */ | 4 /* SelectorFlags.ELEMENT */, selector.element, ...selector.attrs, ...classes
|
|
626
626
|
];
|
|
627
627
|
}
|
|
628
628
|
else if (selector.attrs.length) {
|
|
629
|
-
return [1 /* NOT */ | 2 /* ATTRIBUTE */, ...selector.attrs, ...classes];
|
|
629
|
+
return [1 /* SelectorFlags.NOT */ | 2 /* SelectorFlags.ATTRIBUTE */, ...selector.attrs, ...classes];
|
|
630
630
|
}
|
|
631
631
|
else {
|
|
632
632
|
return selector.classNames && selector.classNames.length ?
|
|
633
|
-
[1 /* NOT */ | 8 /* CLASS */, ...selector.classNames] :
|
|
633
|
+
[1 /* SelectorFlags.NOT */ | 8 /* SelectorFlags.CLASS */, ...selector.classNames] :
|
|
634
634
|
[];
|
|
635
635
|
}
|
|
636
636
|
}
|
|
@@ -756,13 +756,13 @@ class Version {
|
|
|
756
756
|
this.patch = splits.slice(2).join('.');
|
|
757
757
|
}
|
|
758
758
|
}
|
|
759
|
-
|
|
760
|
-
|
|
761
|
-
|
|
762
|
-
|
|
763
|
-
|
|
764
|
-
|
|
765
|
-
|
|
759
|
+
// Check `global` first, because in Node tests both `global` and `window` may be defined and our
|
|
760
|
+
// `_global` variable should point to the NodeJS `global` in that case. Note: Typeof/Instanceof
|
|
761
|
+
// checks are considered side-effects in Terser. We explicitly mark this as side-effect free:
|
|
762
|
+
// https://github.com/terser/terser/issues/250.
|
|
763
|
+
const _global = ( /* @__PURE__ */(() => (typeof global !== 'undefined' && global) || (typeof window !== 'undefined' && window) ||
|
|
764
|
+
(typeof self !== 'undefined' && typeof WorkerGlobalScope !== 'undefined' &&
|
|
765
|
+
self instanceof WorkerGlobalScope && self))());
|
|
766
766
|
function newArray(size, value) {
|
|
767
767
|
const list = [];
|
|
768
768
|
for (let i = 0; i < size; i++) {
|
|
@@ -2920,6 +2920,7 @@ Identifiers.contentQuery = { name: 'ɵɵcontentQuery', moduleName: CORE };
|
|
|
2920
2920
|
Identifiers.NgOnChangesFeature = { name: 'ɵɵNgOnChangesFeature', moduleName: CORE };
|
|
2921
2921
|
Identifiers.InheritDefinitionFeature = { name: 'ɵɵInheritDefinitionFeature', moduleName: CORE };
|
|
2922
2922
|
Identifiers.CopyDefinitionFeature = { name: 'ɵɵCopyDefinitionFeature', moduleName: CORE };
|
|
2923
|
+
Identifiers.StandaloneFeature = { name: 'ɵɵStandaloneFeature', moduleName: CORE };
|
|
2923
2924
|
Identifiers.ProvidersFeature = { name: 'ɵɵProvidersFeature', moduleName: CORE };
|
|
2924
2925
|
Identifiers.listener = { name: 'ɵɵlistener', moduleName: CORE };
|
|
2925
2926
|
Identifiers.getInheritedFactory = {
|
|
@@ -3661,10 +3662,10 @@ function createMayBeForwardRefExpression(expression, forwardRef) {
|
|
|
3661
3662
|
*/
|
|
3662
3663
|
function convertFromMaybeForwardRefExpression({ expression, forwardRef }) {
|
|
3663
3664
|
switch (forwardRef) {
|
|
3664
|
-
case 0 /* None */:
|
|
3665
|
-
case 1 /* Wrapped */:
|
|
3665
|
+
case 0 /* ForwardRefHandling.None */:
|
|
3666
|
+
case 1 /* ForwardRefHandling.Wrapped */:
|
|
3666
3667
|
return expression;
|
|
3667
|
-
case 2 /* Unwrapped */:
|
|
3668
|
+
case 2 /* ForwardRefHandling.Unwrapped */:
|
|
3668
3669
|
return generateForwardRef(expression);
|
|
3669
3670
|
}
|
|
3670
3671
|
}
|
|
@@ -3788,14 +3789,14 @@ function compileInjectDependency(dep, target, index) {
|
|
|
3788
3789
|
}
|
|
3789
3790
|
else if (dep.attributeNameType === null) {
|
|
3790
3791
|
// Build up the injection flags according to the metadata.
|
|
3791
|
-
const flags = 0 /* Default */ | (dep.self ? 2 /* Self */ : 0) |
|
|
3792
|
-
(dep.skipSelf ? 4 /* SkipSelf */ : 0) | (dep.host ? 1 /* Host */ : 0) |
|
|
3793
|
-
(dep.optional ? 8 /* Optional */ : 0) |
|
|
3794
|
-
(target === FactoryTarget$1.Pipe ? 16 /* ForPipe */ : 0);
|
|
3792
|
+
const flags = 0 /* InjectFlags.Default */ | (dep.self ? 2 /* InjectFlags.Self */ : 0) |
|
|
3793
|
+
(dep.skipSelf ? 4 /* InjectFlags.SkipSelf */ : 0) | (dep.host ? 1 /* InjectFlags.Host */ : 0) |
|
|
3794
|
+
(dep.optional ? 8 /* InjectFlags.Optional */ : 0) |
|
|
3795
|
+
(target === FactoryTarget$1.Pipe ? 16 /* InjectFlags.ForPipe */ : 0);
|
|
3795
3796
|
// If this dependency is optional or otherwise has non-default flags, then additional
|
|
3796
3797
|
// parameters describing how to inject the dependency must be passed to the inject function
|
|
3797
3798
|
// that's being used.
|
|
3798
|
-
let flagsParam = (flags !== 0 /* Default */ || dep.optional) ? literal(flags) : null;
|
|
3799
|
+
let flagsParam = (flags !== 0 /* InjectFlags.Default */ || dep.optional) ? literal(flags) : null;
|
|
3799
3800
|
// Build up the arguments to the injectFn call.
|
|
3800
3801
|
const injectArgs = [dep.token];
|
|
3801
3802
|
if (flagsParam) {
|
|
@@ -3966,8 +3967,8 @@ class BoundEvent {
|
|
|
3966
3967
|
this.keySpan = keySpan;
|
|
3967
3968
|
}
|
|
3968
3969
|
static fromParsedEvent(event) {
|
|
3969
|
-
const target = event.type === 0 /* Regular */ ? event.targetOrPhase : null;
|
|
3970
|
-
const phase = event.type === 1 /* Animation */ ? event.targetOrPhase : null;
|
|
3970
|
+
const target = event.type === 0 /* ParsedEventType.Regular */ ? event.targetOrPhase : null;
|
|
3971
|
+
const phase = event.type === 1 /* ParsedEventType.Animation */ ? event.targetOrPhase : null;
|
|
3971
3972
|
if (event.keySpan === undefined) {
|
|
3972
3973
|
throw new Error(`Unexpected state: keySpan must be defined for bound event but was not for ${event.name}: ${event.sourceSpan}`);
|
|
3973
3974
|
}
|
|
@@ -4791,7 +4792,7 @@ function assembleBoundTextPlaceholders(meta, bindingStartIndex = 0, contextId =
|
|
|
4791
4792
|
* @param useCamelCase whether to camelCase the placeholder name when formatting.
|
|
4792
4793
|
* @returns A new map of formatted placeholder names to expressions.
|
|
4793
4794
|
*/
|
|
4794
|
-
function
|
|
4795
|
+
function formatI18nPlaceholderNamesInMap(params = {}, useCamelCase) {
|
|
4795
4796
|
const _params = {};
|
|
4796
4797
|
if (params && Object.keys(params).length) {
|
|
4797
4798
|
Object.keys(params).forEach(key => _params[formatI18nPlaceholderName(key, useCamelCase)] = params[key]);
|
|
@@ -4874,6 +4875,12 @@ const IMPLICIT_REFERENCE = '$implicit';
|
|
|
4874
4875
|
const NON_BINDABLE_ATTR = 'ngNonBindable';
|
|
4875
4876
|
/** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
|
|
4876
4877
|
const RESTORED_VIEW_CONTEXT_NAME = 'restoredCtx';
|
|
4878
|
+
/**
|
|
4879
|
+
* Maximum length of a single instruction chain. Because our output AST uses recursion, we're
|
|
4880
|
+
* limited in how many expressions we can nest before we reach the call stack limit. This
|
|
4881
|
+
* length is set very conservatively in order to reduce the chance of problems.
|
|
4882
|
+
*/
|
|
4883
|
+
const MAX_CHAIN_LENGTH = 500;
|
|
4877
4884
|
/** Instructions that support chaining. */
|
|
4878
4885
|
const CHAINABLE_INSTRUCTIONS = new Set([
|
|
4879
4886
|
Identifiers.element,
|
|
@@ -5019,10 +5026,10 @@ function getQueryPredicate(query, constantPool) {
|
|
|
5019
5026
|
else {
|
|
5020
5027
|
// The original predicate may have been wrapped in a `forwardRef()` call.
|
|
5021
5028
|
switch (query.predicate.forwardRef) {
|
|
5022
|
-
case 0 /* None */:
|
|
5023
|
-
case 2 /* Unwrapped */:
|
|
5029
|
+
case 0 /* ForwardRefHandling.None */:
|
|
5030
|
+
case 2 /* ForwardRefHandling.Unwrapped */:
|
|
5024
5031
|
return query.predicate.expression;
|
|
5025
|
-
case 1 /* Wrapped */:
|
|
5032
|
+
case 1 /* ForwardRefHandling.Wrapped */:
|
|
5026
5033
|
return importExpr(Identifiers.resolveForwardRef).callFn([query.predicate.expression]);
|
|
5027
5034
|
}
|
|
5028
5035
|
}
|
|
@@ -5099,16 +5106,18 @@ function getInstructionStatements(instructions) {
|
|
|
5099
5106
|
const statements = [];
|
|
5100
5107
|
let pendingExpression = null;
|
|
5101
5108
|
let pendingExpressionType = null;
|
|
5109
|
+
let chainLength = 0;
|
|
5102
5110
|
for (const current of instructions) {
|
|
5103
5111
|
const resolvedParams = (typeof current.paramsOrFn === 'function' ? current.paramsOrFn() : current.paramsOrFn) ??
|
|
5104
5112
|
[];
|
|
5105
5113
|
const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];
|
|
5106
5114
|
// If the current instruction is the same as the previous one
|
|
5107
5115
|
// and it can be chained, add another call to the chain.
|
|
5108
|
-
if (pendingExpressionType === current.reference &&
|
|
5116
|
+
if (chainLength < MAX_CHAIN_LENGTH && pendingExpressionType === current.reference &&
|
|
5109
5117
|
CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {
|
|
5110
5118
|
// We'll always have a pending expression when there's a pending expression type.
|
|
5111
5119
|
pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);
|
|
5120
|
+
chainLength++;
|
|
5112
5121
|
}
|
|
5113
5122
|
else {
|
|
5114
5123
|
if (pendingExpression !== null) {
|
|
@@ -5116,6 +5125,7 @@ function getInstructionStatements(instructions) {
|
|
|
5116
5125
|
}
|
|
5117
5126
|
pendingExpression = invokeInstruction(current.span, current.reference, params);
|
|
5118
5127
|
pendingExpressionType = current.reference;
|
|
5128
|
+
chainLength = 0;
|
|
5119
5129
|
}
|
|
5120
5130
|
}
|
|
5121
5131
|
// Since the current instruction adds the previous one to the statements,
|
|
@@ -6153,6 +6163,9 @@ function compilePipeFromMetadata(metadata) {
|
|
|
6153
6163
|
definitionMapValues.push({ key: 'type', value: metadata.type.value, quoted: false });
|
|
6154
6164
|
// e.g. `pure: true`
|
|
6155
6165
|
definitionMapValues.push({ key: 'pure', value: literal(metadata.pure), quoted: false });
|
|
6166
|
+
if (metadata.isStandalone) {
|
|
6167
|
+
definitionMapValues.push({ key: 'standalone', value: literal(true), quoted: false });
|
|
6168
|
+
}
|
|
6156
6169
|
const expression = importExpr(Identifiers.definePipe).callFn([literalMap(definitionMapValues)], undefined, true);
|
|
6157
6170
|
const type = createPipeType(metadata);
|
|
6158
6171
|
return { expression, type, statements: [] };
|
|
@@ -6161,9 +6174,24 @@ function createPipeType(metadata) {
|
|
|
6161
6174
|
return new ExpressionType(importExpr(Identifiers.PipeDeclaration, [
|
|
6162
6175
|
typeWithParameters(metadata.type.type, metadata.typeArgumentCount),
|
|
6163
6176
|
new ExpressionType(new LiteralExpr(metadata.pipeName)),
|
|
6177
|
+
new ExpressionType(new LiteralExpr(metadata.isStandalone)),
|
|
6164
6178
|
]));
|
|
6165
6179
|
}
|
|
6166
6180
|
|
|
6181
|
+
/**
|
|
6182
|
+
* @license
|
|
6183
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6184
|
+
*
|
|
6185
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6186
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6187
|
+
*/
|
|
6188
|
+
var R3TemplateDependencyKind;
|
|
6189
|
+
(function (R3TemplateDependencyKind) {
|
|
6190
|
+
R3TemplateDependencyKind[R3TemplateDependencyKind["Directive"] = 0] = "Directive";
|
|
6191
|
+
R3TemplateDependencyKind[R3TemplateDependencyKind["Pipe"] = 1] = "Pipe";
|
|
6192
|
+
R3TemplateDependencyKind[R3TemplateDependencyKind["NgModule"] = 2] = "NgModule";
|
|
6193
|
+
})(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
|
|
6194
|
+
|
|
6167
6195
|
/**
|
|
6168
6196
|
* @license
|
|
6169
6197
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -8413,7 +8441,7 @@ function parse(value) {
|
|
|
8413
8441
|
const styles = [];
|
|
8414
8442
|
let i = 0;
|
|
8415
8443
|
let parenDepth = 0;
|
|
8416
|
-
let quote = 0 /* QuoteNone */;
|
|
8444
|
+
let quote = 0 /* Char.QuoteNone */;
|
|
8417
8445
|
let valueStart = 0;
|
|
8418
8446
|
let propStart = 0;
|
|
8419
8447
|
let currentProp = null;
|
|
@@ -8421,41 +8449,41 @@ function parse(value) {
|
|
|
8421
8449
|
while (i < value.length) {
|
|
8422
8450
|
const token = value.charCodeAt(i++);
|
|
8423
8451
|
switch (token) {
|
|
8424
|
-
case 40 /* OpenParen */:
|
|
8452
|
+
case 40 /* Char.OpenParen */:
|
|
8425
8453
|
parenDepth++;
|
|
8426
8454
|
break;
|
|
8427
|
-
case 41 /* CloseParen */:
|
|
8455
|
+
case 41 /* Char.CloseParen */:
|
|
8428
8456
|
parenDepth--;
|
|
8429
8457
|
break;
|
|
8430
|
-
case 39 /* QuoteSingle */:
|
|
8458
|
+
case 39 /* Char.QuoteSingle */:
|
|
8431
8459
|
// valueStart needs to be there since prop values don't
|
|
8432
8460
|
// have quotes in CSS
|
|
8433
8461
|
valueHasQuotes = valueHasQuotes || valueStart > 0;
|
|
8434
|
-
if (quote === 0 /* QuoteNone */) {
|
|
8435
|
-
quote = 39 /* QuoteSingle */;
|
|
8462
|
+
if (quote === 0 /* Char.QuoteNone */) {
|
|
8463
|
+
quote = 39 /* Char.QuoteSingle */;
|
|
8436
8464
|
}
|
|
8437
|
-
else if (quote === 39 /* QuoteSingle */ && value.charCodeAt(i - 1) !== 92 /* BackSlash */) {
|
|
8438
|
-
quote = 0 /* QuoteNone */;
|
|
8465
|
+
else if (quote === 39 /* Char.QuoteSingle */ && value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */) {
|
|
8466
|
+
quote = 0 /* Char.QuoteNone */;
|
|
8439
8467
|
}
|
|
8440
8468
|
break;
|
|
8441
|
-
case 34 /* QuoteDouble */:
|
|
8469
|
+
case 34 /* Char.QuoteDouble */:
|
|
8442
8470
|
// same logic as above
|
|
8443
8471
|
valueHasQuotes = valueHasQuotes || valueStart > 0;
|
|
8444
|
-
if (quote === 0 /* QuoteNone */) {
|
|
8445
|
-
quote = 34 /* QuoteDouble */;
|
|
8472
|
+
if (quote === 0 /* Char.QuoteNone */) {
|
|
8473
|
+
quote = 34 /* Char.QuoteDouble */;
|
|
8446
8474
|
}
|
|
8447
|
-
else if (quote === 34 /* QuoteDouble */ && value.charCodeAt(i - 1) !== 92 /* BackSlash */) {
|
|
8448
|
-
quote = 0 /* QuoteNone */;
|
|
8475
|
+
else if (quote === 34 /* Char.QuoteDouble */ && value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */) {
|
|
8476
|
+
quote = 0 /* Char.QuoteNone */;
|
|
8449
8477
|
}
|
|
8450
8478
|
break;
|
|
8451
|
-
case 58 /* Colon */:
|
|
8452
|
-
if (!currentProp && parenDepth === 0 && quote === 0 /* QuoteNone */) {
|
|
8479
|
+
case 58 /* Char.Colon */:
|
|
8480
|
+
if (!currentProp && parenDepth === 0 && quote === 0 /* Char.QuoteNone */) {
|
|
8453
8481
|
currentProp = hyphenate(value.substring(propStart, i - 1).trim());
|
|
8454
8482
|
valueStart = i;
|
|
8455
8483
|
}
|
|
8456
8484
|
break;
|
|
8457
|
-
case 59 /* Semicolon */:
|
|
8458
|
-
if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0 /* QuoteNone */) {
|
|
8485
|
+
case 59 /* Char.Semicolon */:
|
|
8486
|
+
if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0 /* Char.QuoteNone */) {
|
|
8459
8487
|
const styleVal = value.substring(valueStart, i - 1).trim();
|
|
8460
8488
|
styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
|
|
8461
8489
|
propStart = i;
|
|
@@ -8475,7 +8503,7 @@ function parse(value) {
|
|
|
8475
8503
|
function stripUnnecessaryQuotes(value) {
|
|
8476
8504
|
const qS = value.charCodeAt(0);
|
|
8477
8505
|
const qE = value.charCodeAt(value.length - 1);
|
|
8478
|
-
if (qS == qE && (qS == 39 /* QuoteSingle */ || qS == 34 /* QuoteDouble */)) {
|
|
8506
|
+
if (qS == qE && (qS == 39 /* Char.QuoteSingle */ || qS == 34 /* Char.QuoteDouble */)) {
|
|
8479
8507
|
const tempValue = value.substring(1, value.length - 1);
|
|
8480
8508
|
// special case to avoid using a multi-quoted string that was just chomped
|
|
8481
8509
|
// (e.g. `font-family: "Verdana", "sans-serif"`)
|
|
@@ -8626,13 +8654,13 @@ class StylingBuilder {
|
|
|
8626
8654
|
let binding = null;
|
|
8627
8655
|
let name = input.name;
|
|
8628
8656
|
switch (input.type) {
|
|
8629
|
-
case 0 /* Property */:
|
|
8657
|
+
case 0 /* BindingType.Property */:
|
|
8630
8658
|
binding = this.registerInputBasedOnName(name, input.value, input.sourceSpan);
|
|
8631
8659
|
break;
|
|
8632
|
-
case 3 /* Style */:
|
|
8660
|
+
case 3 /* BindingType.Style */:
|
|
8633
8661
|
binding = this.registerStyleInput(name, false, input.value, input.sourceSpan, input.unit);
|
|
8634
8662
|
break;
|
|
8635
|
-
case 2 /* Class */:
|
|
8663
|
+
case 2 /* BindingType.Class */:
|
|
8636
8664
|
binding = this.registerClassInput(name, false, input.value, input.sourceSpan);
|
|
8637
8665
|
break;
|
|
8638
8666
|
}
|
|
@@ -8731,14 +8759,14 @@ class StylingBuilder {
|
|
|
8731
8759
|
populateInitialStylingAttrs(attrs) {
|
|
8732
8760
|
// [CLASS_MARKER, 'foo', 'bar', 'baz' ...]
|
|
8733
8761
|
if (this._initialClassValues.length) {
|
|
8734
|
-
attrs.push(literal(1 /* Classes */));
|
|
8762
|
+
attrs.push(literal(1 /* AttributeMarker.Classes */));
|
|
8735
8763
|
for (let i = 0; i < this._initialClassValues.length; i++) {
|
|
8736
8764
|
attrs.push(literal(this._initialClassValues[i]));
|
|
8737
8765
|
}
|
|
8738
8766
|
}
|
|
8739
8767
|
// [STYLE_MARKER, 'width', '200px', 'height', '100px', ...]
|
|
8740
8768
|
if (this._initialStyleValues.length) {
|
|
8741
|
-
attrs.push(literal(2 /* Styles */));
|
|
8769
|
+
attrs.push(literal(2 /* AttributeMarker.Styles */));
|
|
8742
8770
|
for (let i = 0; i < this._initialStyleValues.length; i += 2) {
|
|
8743
8771
|
attrs.push(literal(this._initialStyleValues[i]), literal(this._initialStyleValues[i + 1]));
|
|
8744
8772
|
}
|
|
@@ -9470,9 +9498,9 @@ class Parser$1 {
|
|
|
9470
9498
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9471
9499
|
const sourceToLex = this._stripComments(input);
|
|
9472
9500
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9473
|
-
let flags = 1 /* Action */;
|
|
9501
|
+
let flags = 1 /* ParseFlags.Action */;
|
|
9474
9502
|
if (isAssignmentEvent) {
|
|
9475
|
-
flags |= 2 /* AssignmentEvent */;
|
|
9503
|
+
flags |= 2 /* ParseFlags.AssignmentEvent */;
|
|
9476
9504
|
}
|
|
9477
9505
|
const ast = new _ParseAST(input, location, absoluteOffset, tokens, flags, this.errors, 0).parseChain();
|
|
9478
9506
|
return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);
|
|
@@ -9501,7 +9529,7 @@ class Parser$1 {
|
|
|
9501
9529
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9502
9530
|
const sourceToLex = this._stripComments(input);
|
|
9503
9531
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9504
|
-
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9532
|
+
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0)
|
|
9505
9533
|
.parseChain();
|
|
9506
9534
|
}
|
|
9507
9535
|
/**
|
|
@@ -9532,7 +9560,7 @@ class Parser$1 {
|
|
|
9532
9560
|
*/
|
|
9533
9561
|
parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
|
|
9534
9562
|
const tokens = this._lexer.tokenize(templateValue);
|
|
9535
|
-
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* None */, this.errors, 0 /* relative offset */);
|
|
9563
|
+
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0 /* relative offset */);
|
|
9536
9564
|
return parser.parseTemplateBindings({
|
|
9537
9565
|
source: templateKey,
|
|
9538
9566
|
span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
|
|
@@ -9547,7 +9575,7 @@ class Parser$1 {
|
|
|
9547
9575
|
const expressionText = expressions[i].text;
|
|
9548
9576
|
const sourceToLex = this._stripComments(expressionText);
|
|
9549
9577
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9550
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, offsets[i])
|
|
9578
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, offsets[i])
|
|
9551
9579
|
.parseChain();
|
|
9552
9580
|
expressionNodes.push(ast);
|
|
9553
9581
|
}
|
|
@@ -9561,7 +9589,7 @@ class Parser$1 {
|
|
|
9561
9589
|
parseInterpolationExpression(expression, location, absoluteOffset) {
|
|
9562
9590
|
const sourceToLex = this._stripComments(expression);
|
|
9563
9591
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9564
|
-
const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9592
|
+
const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0)
|
|
9565
9593
|
.parseChain();
|
|
9566
9594
|
const strings = ['', '']; // The prefix and suffix strings are both empty
|
|
9567
9595
|
return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset);
|
|
@@ -9917,7 +9945,7 @@ class _ParseAST {
|
|
|
9917
9945
|
const expr = this.parsePipe();
|
|
9918
9946
|
exprs.push(expr);
|
|
9919
9947
|
if (this.consumeOptionalCharacter($SEMICOLON)) {
|
|
9920
|
-
if (!(this.parseFlags & 1 /* Action */)) {
|
|
9948
|
+
if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
|
|
9921
9949
|
this.error('Binding expression cannot contain chained expression');
|
|
9922
9950
|
}
|
|
9923
9951
|
while (this.consumeOptionalCharacter($SEMICOLON)) {
|
|
@@ -9941,7 +9969,7 @@ class _ParseAST {
|
|
|
9941
9969
|
const start = this.inputIndex;
|
|
9942
9970
|
let result = this.parseExpression();
|
|
9943
9971
|
if (this.consumeOptionalOperator('|')) {
|
|
9944
|
-
if (this.parseFlags & 1 /* Action */) {
|
|
9972
|
+
if (this.parseFlags & 1 /* ParseFlags.Action */) {
|
|
9945
9973
|
this.error('Cannot have a pipe in an action expression');
|
|
9946
9974
|
}
|
|
9947
9975
|
do {
|
|
@@ -10293,7 +10321,7 @@ class _ParseAST {
|
|
|
10293
10321
|
}
|
|
10294
10322
|
else {
|
|
10295
10323
|
if (this.consumeOptionalAssignment()) {
|
|
10296
|
-
if (!(this.parseFlags & 1 /* Action */)) {
|
|
10324
|
+
if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
|
|
10297
10325
|
this.error('Bindings cannot contain assignments');
|
|
10298
10326
|
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10299
10327
|
}
|
|
@@ -10325,7 +10353,7 @@ class _ParseAST {
|
|
|
10325
10353
|
// primary expression is substituted as LHS of the assignment operator to achieve
|
|
10326
10354
|
// two-way-binding, such that the LHS could be the non-null operator. The grammar doesn't
|
|
10327
10355
|
// naturally allow for this syntax, so assignment events are parsed specially.
|
|
10328
|
-
if ((this.parseFlags & 2 /* AssignmentEvent */) && this.next.isOperator('!') &&
|
|
10356
|
+
if ((this.parseFlags & 2 /* ParseFlags.AssignmentEvent */) && this.next.isOperator('!') &&
|
|
10329
10357
|
this.peek(1).isOperator('=')) {
|
|
10330
10358
|
// First skip over the ! operator.
|
|
10331
10359
|
this.advance();
|
|
@@ -10647,7 +10675,7 @@ function getIndexMapForOriginalTemplate(interpolatedTokens) {
|
|
|
10647
10675
|
let tokenIndex = 0;
|
|
10648
10676
|
while (tokenIndex < interpolatedTokens.length) {
|
|
10649
10677
|
const currentToken = interpolatedTokens[tokenIndex];
|
|
10650
|
-
if (currentToken.type === 9 /* ENCODED_ENTITY */) {
|
|
10678
|
+
if (currentToken.type === 9 /* MlParserTokenType.ENCODED_ENTITY */) {
|
|
10651
10679
|
const [decoded, encoded] = currentToken.parts;
|
|
10652
10680
|
consumedInOriginalTemplate += encoded.length;
|
|
10653
10681
|
consumedInInput += decoded.length;
|
|
@@ -13045,14 +13073,14 @@ class _Tokenizer {
|
|
|
13045
13073
|
else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
|
|
13046
13074
|
// In (possibly interpolated) text the end of the text is given by `isTextEnd()`, while
|
|
13047
13075
|
// the premature end of an interpolation is given by the start of a new HTML element.
|
|
13048
|
-
this._consumeWithInterpolation(5 /* TEXT */, 8 /* INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());
|
|
13076
|
+
this._consumeWithInterpolation(5 /* TokenType.TEXT */, 8 /* TokenType.INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());
|
|
13049
13077
|
}
|
|
13050
13078
|
}
|
|
13051
13079
|
catch (e) {
|
|
13052
13080
|
this.handleError(e);
|
|
13053
13081
|
}
|
|
13054
13082
|
}
|
|
13055
|
-
this._beginToken(24 /* EOF */);
|
|
13083
|
+
this._beginToken(24 /* TokenType.EOF */);
|
|
13056
13084
|
this._endToken([]);
|
|
13057
13085
|
}
|
|
13058
13086
|
/**
|
|
@@ -13196,7 +13224,7 @@ class _Tokenizer {
|
|
|
13196
13224
|
return char;
|
|
13197
13225
|
}
|
|
13198
13226
|
_consumeEntity(textTokenType) {
|
|
13199
|
-
this._beginToken(9 /* ENCODED_ENTITY */);
|
|
13227
|
+
this._beginToken(9 /* TokenType.ENCODED_ENTITY */);
|
|
13200
13228
|
const start = this._cursor.clone();
|
|
13201
13229
|
this._cursor.advance();
|
|
13202
13230
|
if (this._attemptCharCode($HASH)) {
|
|
@@ -13242,7 +13270,7 @@ class _Tokenizer {
|
|
|
13242
13270
|
}
|
|
13243
13271
|
}
|
|
13244
13272
|
_consumeRawText(consumeEntities, endMarkerPredicate) {
|
|
13245
|
-
this._beginToken(consumeEntities ? 6 /* ESCAPABLE_RAW_TEXT */ : 7 /* RAW_TEXT */);
|
|
13273
|
+
this._beginToken(consumeEntities ? 6 /* TokenType.ESCAPABLE_RAW_TEXT */ : 7 /* TokenType.RAW_TEXT */);
|
|
13246
13274
|
const parts = [];
|
|
13247
13275
|
while (true) {
|
|
13248
13276
|
const tagCloseStart = this._cursor.clone();
|
|
@@ -13254,8 +13282,8 @@ class _Tokenizer {
|
|
|
13254
13282
|
if (consumeEntities && this._cursor.peek() === $AMPERSAND) {
|
|
13255
13283
|
this._endToken([this._processCarriageReturns(parts.join(''))]);
|
|
13256
13284
|
parts.length = 0;
|
|
13257
|
-
this._consumeEntity(6 /* ESCAPABLE_RAW_TEXT */);
|
|
13258
|
-
this._beginToken(6 /* ESCAPABLE_RAW_TEXT */);
|
|
13285
|
+
this._consumeEntity(6 /* TokenType.ESCAPABLE_RAW_TEXT */);
|
|
13286
|
+
this._beginToken(6 /* TokenType.ESCAPABLE_RAW_TEXT */);
|
|
13259
13287
|
}
|
|
13260
13288
|
else {
|
|
13261
13289
|
parts.push(this._readChar());
|
|
@@ -13264,25 +13292,25 @@ class _Tokenizer {
|
|
|
13264
13292
|
this._endToken([this._processCarriageReturns(parts.join(''))]);
|
|
13265
13293
|
}
|
|
13266
13294
|
_consumeComment(start) {
|
|
13267
|
-
this._beginToken(10 /* COMMENT_START */, start);
|
|
13295
|
+
this._beginToken(10 /* TokenType.COMMENT_START */, start);
|
|
13268
13296
|
this._requireCharCode($MINUS);
|
|
13269
13297
|
this._endToken([]);
|
|
13270
13298
|
this._consumeRawText(false, () => this._attemptStr('-->'));
|
|
13271
|
-
this._beginToken(11 /* COMMENT_END */);
|
|
13299
|
+
this._beginToken(11 /* TokenType.COMMENT_END */);
|
|
13272
13300
|
this._requireStr('-->');
|
|
13273
13301
|
this._endToken([]);
|
|
13274
13302
|
}
|
|
13275
13303
|
_consumeCdata(start) {
|
|
13276
|
-
this._beginToken(12 /* CDATA_START */, start);
|
|
13304
|
+
this._beginToken(12 /* TokenType.CDATA_START */, start);
|
|
13277
13305
|
this._requireStr('CDATA[');
|
|
13278
13306
|
this._endToken([]);
|
|
13279
13307
|
this._consumeRawText(false, () => this._attemptStr(']]>'));
|
|
13280
|
-
this._beginToken(13 /* CDATA_END */);
|
|
13308
|
+
this._beginToken(13 /* TokenType.CDATA_END */);
|
|
13281
13309
|
this._requireStr(']]>');
|
|
13282
13310
|
this._endToken([]);
|
|
13283
13311
|
}
|
|
13284
13312
|
_consumeDocType(start) {
|
|
13285
|
-
this._beginToken(18 /* DOC_TYPE */, start);
|
|
13313
|
+
this._beginToken(18 /* TokenType.DOC_TYPE */, start);
|
|
13286
13314
|
const contentStart = this._cursor.clone();
|
|
13287
13315
|
this._attemptUntilChar($GT);
|
|
13288
13316
|
const content = this._cursor.getChars(contentStart);
|
|
@@ -13336,12 +13364,12 @@ class _Tokenizer {
|
|
|
13336
13364
|
if (e instanceof _ControlFlowError) {
|
|
13337
13365
|
if (openTagToken) {
|
|
13338
13366
|
// We errored before we could close the opening tag, so it is incomplete.
|
|
13339
|
-
openTagToken.type = 4 /* INCOMPLETE_TAG_OPEN */;
|
|
13367
|
+
openTagToken.type = 4 /* TokenType.INCOMPLETE_TAG_OPEN */;
|
|
13340
13368
|
}
|
|
13341
13369
|
else {
|
|
13342
13370
|
// When the start tag is invalid, assume we want a "<" as text.
|
|
13343
13371
|
// Back to back text tokens are merged at the end.
|
|
13344
|
-
this._beginToken(5 /* TEXT */, start);
|
|
13372
|
+
this._beginToken(5 /* TokenType.TEXT */, start);
|
|
13345
13373
|
this._endToken(['<']);
|
|
13346
13374
|
}
|
|
13347
13375
|
return;
|
|
@@ -13368,13 +13396,13 @@ class _Tokenizer {
|
|
|
13368
13396
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13369
13397
|
return this._attemptCharCode($GT);
|
|
13370
13398
|
});
|
|
13371
|
-
this._beginToken(3 /* TAG_CLOSE */);
|
|
13399
|
+
this._beginToken(3 /* TokenType.TAG_CLOSE */);
|
|
13372
13400
|
this._requireCharCodeUntilFn(code => code === $GT, 3);
|
|
13373
13401
|
this._cursor.advance(); // Consume the `>`
|
|
13374
13402
|
this._endToken([prefix, tagName]);
|
|
13375
13403
|
}
|
|
13376
13404
|
_consumeTagOpenStart(start) {
|
|
13377
|
-
this._beginToken(0 /* TAG_OPEN_START */, start);
|
|
13405
|
+
this._beginToken(0 /* TokenType.TAG_OPEN_START */, start);
|
|
13378
13406
|
const parts = this._consumePrefixAndName();
|
|
13379
13407
|
return this._endToken(parts);
|
|
13380
13408
|
}
|
|
@@ -13383,7 +13411,7 @@ class _Tokenizer {
|
|
|
13383
13411
|
if (attrNameStart === $SQ || attrNameStart === $DQ) {
|
|
13384
13412
|
throw this._createError(_unexpectedCharacterErrorMsg(attrNameStart), this._cursor.getSpan());
|
|
13385
13413
|
}
|
|
13386
|
-
this._beginToken(14 /* ATTR_NAME */);
|
|
13414
|
+
this._beginToken(14 /* TokenType.ATTR_NAME */);
|
|
13387
13415
|
const prefixAndName = this._consumePrefixAndName();
|
|
13388
13416
|
this._endToken(prefixAndName);
|
|
13389
13417
|
}
|
|
@@ -13395,27 +13423,27 @@ class _Tokenizer {
|
|
|
13395
13423
|
// In an attribute then end of the attribute value and the premature end to an interpolation
|
|
13396
13424
|
// are both triggered by the `quoteChar`.
|
|
13397
13425
|
const endPredicate = () => this._cursor.peek() === quoteChar;
|
|
13398
|
-
this._consumeWithInterpolation(16 /* ATTR_VALUE_TEXT */, 17 /* ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13426
|
+
this._consumeWithInterpolation(16 /* TokenType.ATTR_VALUE_TEXT */, 17 /* TokenType.ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13399
13427
|
this._consumeQuote(quoteChar);
|
|
13400
13428
|
}
|
|
13401
13429
|
else {
|
|
13402
13430
|
const endPredicate = () => isNameEnd(this._cursor.peek());
|
|
13403
|
-
this._consumeWithInterpolation(16 /* ATTR_VALUE_TEXT */, 17 /* ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13431
|
+
this._consumeWithInterpolation(16 /* TokenType.ATTR_VALUE_TEXT */, 17 /* TokenType.ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13404
13432
|
}
|
|
13405
13433
|
}
|
|
13406
13434
|
_consumeQuote(quoteChar) {
|
|
13407
|
-
this._beginToken(15 /* ATTR_QUOTE */);
|
|
13435
|
+
this._beginToken(15 /* TokenType.ATTR_QUOTE */);
|
|
13408
13436
|
this._requireCharCode(quoteChar);
|
|
13409
13437
|
this._endToken([String.fromCodePoint(quoteChar)]);
|
|
13410
13438
|
}
|
|
13411
13439
|
_consumeTagOpenEnd() {
|
|
13412
|
-
const tokenType = this._attemptCharCode($SLASH) ? 2 /* TAG_OPEN_END_VOID */ : 1 /* TAG_OPEN_END */;
|
|
13440
|
+
const tokenType = this._attemptCharCode($SLASH) ? 2 /* TokenType.TAG_OPEN_END_VOID */ : 1 /* TokenType.TAG_OPEN_END */;
|
|
13413
13441
|
this._beginToken(tokenType);
|
|
13414
13442
|
this._requireCharCode($GT);
|
|
13415
13443
|
this._endToken([]);
|
|
13416
13444
|
}
|
|
13417
13445
|
_consumeTagClose(start) {
|
|
13418
|
-
this._beginToken(3 /* TAG_CLOSE */, start);
|
|
13446
|
+
this._beginToken(3 /* TokenType.TAG_CLOSE */, start);
|
|
13419
13447
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13420
13448
|
const prefixAndName = this._consumePrefixAndName();
|
|
13421
13449
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
@@ -13423,11 +13451,11 @@ class _Tokenizer {
|
|
|
13423
13451
|
this._endToken(prefixAndName);
|
|
13424
13452
|
}
|
|
13425
13453
|
_consumeExpansionFormStart() {
|
|
13426
|
-
this._beginToken(19 /* EXPANSION_FORM_START */);
|
|
13454
|
+
this._beginToken(19 /* TokenType.EXPANSION_FORM_START */);
|
|
13427
13455
|
this._requireCharCode($LBRACE);
|
|
13428
13456
|
this._endToken([]);
|
|
13429
|
-
this._expansionCaseStack.push(19 /* EXPANSION_FORM_START */);
|
|
13430
|
-
this._beginToken(7 /* RAW_TEXT */);
|
|
13457
|
+
this._expansionCaseStack.push(19 /* TokenType.EXPANSION_FORM_START */);
|
|
13458
|
+
this._beginToken(7 /* TokenType.RAW_TEXT */);
|
|
13431
13459
|
const condition = this._readUntil($COMMA);
|
|
13432
13460
|
const normalizedCondition = this._processCarriageReturns(condition);
|
|
13433
13461
|
if (this._i18nNormalizeLineEndingsInICUs) {
|
|
@@ -13443,32 +13471,32 @@ class _Tokenizer {
|
|
|
13443
13471
|
}
|
|
13444
13472
|
this._requireCharCode($COMMA);
|
|
13445
13473
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13446
|
-
this._beginToken(7 /* RAW_TEXT */);
|
|
13474
|
+
this._beginToken(7 /* TokenType.RAW_TEXT */);
|
|
13447
13475
|
const type = this._readUntil($COMMA);
|
|
13448
13476
|
this._endToken([type]);
|
|
13449
13477
|
this._requireCharCode($COMMA);
|
|
13450
13478
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13451
13479
|
}
|
|
13452
13480
|
_consumeExpansionCaseStart() {
|
|
13453
|
-
this._beginToken(20 /* EXPANSION_CASE_VALUE */);
|
|
13481
|
+
this._beginToken(20 /* TokenType.EXPANSION_CASE_VALUE */);
|
|
13454
13482
|
const value = this._readUntil($LBRACE).trim();
|
|
13455
13483
|
this._endToken([value]);
|
|
13456
13484
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13457
|
-
this._beginToken(21 /* EXPANSION_CASE_EXP_START */);
|
|
13485
|
+
this._beginToken(21 /* TokenType.EXPANSION_CASE_EXP_START */);
|
|
13458
13486
|
this._requireCharCode($LBRACE);
|
|
13459
13487
|
this._endToken([]);
|
|
13460
13488
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13461
|
-
this._expansionCaseStack.push(21 /* EXPANSION_CASE_EXP_START */);
|
|
13489
|
+
this._expansionCaseStack.push(21 /* TokenType.EXPANSION_CASE_EXP_START */);
|
|
13462
13490
|
}
|
|
13463
13491
|
_consumeExpansionCaseEnd() {
|
|
13464
|
-
this._beginToken(22 /* EXPANSION_CASE_EXP_END */);
|
|
13492
|
+
this._beginToken(22 /* TokenType.EXPANSION_CASE_EXP_END */);
|
|
13465
13493
|
this._requireCharCode($RBRACE);
|
|
13466
13494
|
this._endToken([]);
|
|
13467
13495
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13468
13496
|
this._expansionCaseStack.pop();
|
|
13469
13497
|
}
|
|
13470
13498
|
_consumeExpansionFormEnd() {
|
|
13471
|
-
this._beginToken(23 /* EXPANSION_FORM_END */);
|
|
13499
|
+
this._beginToken(23 /* TokenType.EXPANSION_FORM_END */);
|
|
13472
13500
|
this._requireCharCode($RBRACE);
|
|
13473
13501
|
this._endToken([]);
|
|
13474
13502
|
this._expansionCaseStack.pop();
|
|
@@ -13618,12 +13646,12 @@ class _Tokenizer {
|
|
|
13618
13646
|
_isInExpansionCase() {
|
|
13619
13647
|
return this._expansionCaseStack.length > 0 &&
|
|
13620
13648
|
this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
|
|
13621
|
-
21 /* EXPANSION_CASE_EXP_START */;
|
|
13649
|
+
21 /* TokenType.EXPANSION_CASE_EXP_START */;
|
|
13622
13650
|
}
|
|
13623
13651
|
_isInExpansionForm() {
|
|
13624
13652
|
return this._expansionCaseStack.length > 0 &&
|
|
13625
13653
|
this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
|
|
13626
|
-
19 /* EXPANSION_FORM_START */;
|
|
13654
|
+
19 /* TokenType.EXPANSION_FORM_START */;
|
|
13627
13655
|
}
|
|
13628
13656
|
isExpansionFormStart() {
|
|
13629
13657
|
if (this._cursor.peek() !== $LBRACE) {
|
|
@@ -13670,9 +13698,9 @@ function mergeTextTokens(srcTokens) {
|
|
|
13670
13698
|
let lastDstToken = undefined;
|
|
13671
13699
|
for (let i = 0; i < srcTokens.length; i++) {
|
|
13672
13700
|
const token = srcTokens[i];
|
|
13673
|
-
if ((lastDstToken && lastDstToken.type === 5 /* TEXT */ && token.type === 5 /* TEXT */) ||
|
|
13674
|
-
(lastDstToken && lastDstToken.type === 16 /* ATTR_VALUE_TEXT */ &&
|
|
13675
|
-
token.type === 16 /* ATTR_VALUE_TEXT */)) {
|
|
13701
|
+
if ((lastDstToken && lastDstToken.type === 5 /* TokenType.TEXT */ && token.type === 5 /* TokenType.TEXT */) ||
|
|
13702
|
+
(lastDstToken && lastDstToken.type === 16 /* TokenType.ATTR_VALUE_TEXT */ &&
|
|
13703
|
+
token.type === 16 /* TokenType.ATTR_VALUE_TEXT */)) {
|
|
13676
13704
|
lastDstToken.parts[0] += token.parts[0];
|
|
13677
13705
|
lastDstToken.sourceSpan.end = token.sourceSpan.end;
|
|
13678
13706
|
}
|
|
@@ -13965,28 +13993,28 @@ class _TreeBuilder {
|
|
|
13965
13993
|
this._advance();
|
|
13966
13994
|
}
|
|
13967
13995
|
build() {
|
|
13968
|
-
while (this._peek.type !== 24 /* EOF */) {
|
|
13969
|
-
if (this._peek.type === 0 /* TAG_OPEN_START */ ||
|
|
13970
|
-
this._peek.type === 4 /* INCOMPLETE_TAG_OPEN */) {
|
|
13996
|
+
while (this._peek.type !== 24 /* TokenType.EOF */) {
|
|
13997
|
+
if (this._peek.type === 0 /* TokenType.TAG_OPEN_START */ ||
|
|
13998
|
+
this._peek.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {
|
|
13971
13999
|
this._consumeStartTag(this._advance());
|
|
13972
14000
|
}
|
|
13973
|
-
else if (this._peek.type === 3 /* TAG_CLOSE */) {
|
|
14001
|
+
else if (this._peek.type === 3 /* TokenType.TAG_CLOSE */) {
|
|
13974
14002
|
this._consumeEndTag(this._advance());
|
|
13975
14003
|
}
|
|
13976
|
-
else if (this._peek.type === 12 /* CDATA_START */) {
|
|
14004
|
+
else if (this._peek.type === 12 /* TokenType.CDATA_START */) {
|
|
13977
14005
|
this._closeVoidElement();
|
|
13978
14006
|
this._consumeCdata(this._advance());
|
|
13979
14007
|
}
|
|
13980
|
-
else if (this._peek.type === 10 /* COMMENT_START */) {
|
|
14008
|
+
else if (this._peek.type === 10 /* TokenType.COMMENT_START */) {
|
|
13981
14009
|
this._closeVoidElement();
|
|
13982
14010
|
this._consumeComment(this._advance());
|
|
13983
14011
|
}
|
|
13984
|
-
else if (this._peek.type === 5 /* TEXT */ || this._peek.type === 7 /* RAW_TEXT */ ||
|
|
13985
|
-
this._peek.type === 6 /* ESCAPABLE_RAW_TEXT */) {
|
|
14012
|
+
else if (this._peek.type === 5 /* TokenType.TEXT */ || this._peek.type === 7 /* TokenType.RAW_TEXT */ ||
|
|
14013
|
+
this._peek.type === 6 /* TokenType.ESCAPABLE_RAW_TEXT */) {
|
|
13986
14014
|
this._closeVoidElement();
|
|
13987
14015
|
this._consumeText(this._advance());
|
|
13988
14016
|
}
|
|
13989
|
-
else if (this._peek.type === 19 /* EXPANSION_FORM_START */) {
|
|
14017
|
+
else if (this._peek.type === 19 /* TokenType.EXPANSION_FORM_START */) {
|
|
13990
14018
|
this._consumeExpansion(this._advance());
|
|
13991
14019
|
}
|
|
13992
14020
|
else {
|
|
@@ -14012,11 +14040,11 @@ class _TreeBuilder {
|
|
|
14012
14040
|
}
|
|
14013
14041
|
_consumeCdata(_startToken) {
|
|
14014
14042
|
this._consumeText(this._advance());
|
|
14015
|
-
this._advanceIf(13 /* CDATA_END */);
|
|
14043
|
+
this._advanceIf(13 /* TokenType.CDATA_END */);
|
|
14016
14044
|
}
|
|
14017
14045
|
_consumeComment(token) {
|
|
14018
|
-
const text = this._advanceIf(7 /* RAW_TEXT */);
|
|
14019
|
-
this._advanceIf(11 /* COMMENT_END */);
|
|
14046
|
+
const text = this._advanceIf(7 /* TokenType.RAW_TEXT */);
|
|
14047
|
+
this._advanceIf(11 /* TokenType.COMMENT_END */);
|
|
14020
14048
|
const value = text != null ? text.parts[0].trim() : null;
|
|
14021
14049
|
this._addToParent(new Comment(value, token.sourceSpan));
|
|
14022
14050
|
}
|
|
@@ -14025,14 +14053,14 @@ class _TreeBuilder {
|
|
|
14025
14053
|
const type = this._advance();
|
|
14026
14054
|
const cases = [];
|
|
14027
14055
|
// read =
|
|
14028
|
-
while (this._peek.type === 20 /* EXPANSION_CASE_VALUE */) {
|
|
14056
|
+
while (this._peek.type === 20 /* TokenType.EXPANSION_CASE_VALUE */) {
|
|
14029
14057
|
const expCase = this._parseExpansionCase();
|
|
14030
14058
|
if (!expCase)
|
|
14031
14059
|
return; // error
|
|
14032
14060
|
cases.push(expCase);
|
|
14033
14061
|
}
|
|
14034
14062
|
// read the final }
|
|
14035
|
-
if (this._peek.type !== 23 /* EXPANSION_FORM_END */) {
|
|
14063
|
+
if (this._peek.type !== 23 /* TokenType.EXPANSION_FORM_END */) {
|
|
14036
14064
|
this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '}'.`));
|
|
14037
14065
|
return;
|
|
14038
14066
|
}
|
|
@@ -14043,7 +14071,7 @@ class _TreeBuilder {
|
|
|
14043
14071
|
_parseExpansionCase() {
|
|
14044
14072
|
const value = this._advance();
|
|
14045
14073
|
// read {
|
|
14046
|
-
if (this._peek.type !== 21 /* EXPANSION_CASE_EXP_START */) {
|
|
14074
|
+
if (this._peek.type !== 21 /* TokenType.EXPANSION_CASE_EXP_START */) {
|
|
14047
14075
|
this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '{'.`));
|
|
14048
14076
|
return null;
|
|
14049
14077
|
}
|
|
@@ -14053,7 +14081,7 @@ class _TreeBuilder {
|
|
|
14053
14081
|
if (!exp)
|
|
14054
14082
|
return null;
|
|
14055
14083
|
const end = this._advance();
|
|
14056
|
-
exp.push({ type: 24 /* EOF */, parts: [], sourceSpan: end.sourceSpan });
|
|
14084
|
+
exp.push({ type: 24 /* TokenType.EOF */, parts: [], sourceSpan: end.sourceSpan });
|
|
14057
14085
|
// parse everything in between { and }
|
|
14058
14086
|
const expansionCaseParser = new _TreeBuilder(exp, this.getTagDefinition);
|
|
14059
14087
|
expansionCaseParser.build();
|
|
@@ -14067,14 +14095,14 @@ class _TreeBuilder {
|
|
|
14067
14095
|
}
|
|
14068
14096
|
_collectExpansionExpTokens(start) {
|
|
14069
14097
|
const exp = [];
|
|
14070
|
-
const expansionFormStack = [21 /* EXPANSION_CASE_EXP_START */];
|
|
14098
|
+
const expansionFormStack = [21 /* TokenType.EXPANSION_CASE_EXP_START */];
|
|
14071
14099
|
while (true) {
|
|
14072
|
-
if (this._peek.type === 19 /* EXPANSION_FORM_START */ ||
|
|
14073
|
-
this._peek.type === 21 /* EXPANSION_CASE_EXP_START */) {
|
|
14100
|
+
if (this._peek.type === 19 /* TokenType.EXPANSION_FORM_START */ ||
|
|
14101
|
+
this._peek.type === 21 /* TokenType.EXPANSION_CASE_EXP_START */) {
|
|
14074
14102
|
expansionFormStack.push(this._peek.type);
|
|
14075
14103
|
}
|
|
14076
|
-
if (this._peek.type === 22 /* EXPANSION_CASE_EXP_END */) {
|
|
14077
|
-
if (lastOnStack(expansionFormStack, 21 /* EXPANSION_CASE_EXP_START */)) {
|
|
14104
|
+
if (this._peek.type === 22 /* TokenType.EXPANSION_CASE_EXP_END */) {
|
|
14105
|
+
if (lastOnStack(expansionFormStack, 21 /* TokenType.EXPANSION_CASE_EXP_START */)) {
|
|
14078
14106
|
expansionFormStack.pop();
|
|
14079
14107
|
if (expansionFormStack.length === 0)
|
|
14080
14108
|
return exp;
|
|
@@ -14084,8 +14112,8 @@ class _TreeBuilder {
|
|
|
14084
14112
|
return null;
|
|
14085
14113
|
}
|
|
14086
14114
|
}
|
|
14087
|
-
if (this._peek.type === 23 /* EXPANSION_FORM_END */) {
|
|
14088
|
-
if (lastOnStack(expansionFormStack, 19 /* EXPANSION_FORM_START */)) {
|
|
14115
|
+
if (this._peek.type === 23 /* TokenType.EXPANSION_FORM_END */) {
|
|
14116
|
+
if (lastOnStack(expansionFormStack, 19 /* TokenType.EXPANSION_FORM_START */)) {
|
|
14089
14117
|
expansionFormStack.pop();
|
|
14090
14118
|
}
|
|
14091
14119
|
else {
|
|
@@ -14093,7 +14121,7 @@ class _TreeBuilder {
|
|
|
14093
14121
|
return null;
|
|
14094
14122
|
}
|
|
14095
14123
|
}
|
|
14096
|
-
if (this._peek.type === 24 /* EOF */) {
|
|
14124
|
+
if (this._peek.type === 24 /* TokenType.EOF */) {
|
|
14097
14125
|
this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
|
|
14098
14126
|
return null;
|
|
14099
14127
|
}
|
|
@@ -14112,18 +14140,18 @@ class _TreeBuilder {
|
|
|
14112
14140
|
tokens[0] = { type: token.type, sourceSpan: token.sourceSpan, parts: [text] };
|
|
14113
14141
|
}
|
|
14114
14142
|
}
|
|
14115
|
-
while (this._peek.type === 8 /* INTERPOLATION */ || this._peek.type === 5 /* TEXT */ ||
|
|
14116
|
-
this._peek.type === 9 /* ENCODED_ENTITY */) {
|
|
14143
|
+
while (this._peek.type === 8 /* TokenType.INTERPOLATION */ || this._peek.type === 5 /* TokenType.TEXT */ ||
|
|
14144
|
+
this._peek.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14117
14145
|
token = this._advance();
|
|
14118
14146
|
tokens.push(token);
|
|
14119
|
-
if (token.type === 8 /* INTERPOLATION */) {
|
|
14147
|
+
if (token.type === 8 /* TokenType.INTERPOLATION */) {
|
|
14120
14148
|
// For backward compatibility we decode HTML entities that appear in interpolation
|
|
14121
14149
|
// expressions. This is arguably a bug, but it could be a considerable breaking change to
|
|
14122
14150
|
// fix it. It should be addressed in a larger project to refactor the entire parser/lexer
|
|
14123
14151
|
// chain after View Engine has been removed.
|
|
14124
14152
|
text += token.parts.join('').replace(/&([^;]+);/g, decodeEntity);
|
|
14125
14153
|
}
|
|
14126
|
-
else if (token.type === 9 /* ENCODED_ENTITY */) {
|
|
14154
|
+
else if (token.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14127
14155
|
text += token.parts[0];
|
|
14128
14156
|
}
|
|
14129
14157
|
else {
|
|
@@ -14144,14 +14172,14 @@ class _TreeBuilder {
|
|
|
14144
14172
|
_consumeStartTag(startTagToken) {
|
|
14145
14173
|
const [prefix, name] = startTagToken.parts;
|
|
14146
14174
|
const attrs = [];
|
|
14147
|
-
while (this._peek.type === 14 /* ATTR_NAME */) {
|
|
14175
|
+
while (this._peek.type === 14 /* TokenType.ATTR_NAME */) {
|
|
14148
14176
|
attrs.push(this._consumeAttr(this._advance()));
|
|
14149
14177
|
}
|
|
14150
14178
|
const fullName = this._getElementFullName(prefix, name, this._getParentElement());
|
|
14151
14179
|
let selfClosing = false;
|
|
14152
14180
|
// Note: There could have been a tokenizer error
|
|
14153
14181
|
// so that we don't get a token for the end tag...
|
|
14154
|
-
if (this._peek.type === 2 /* TAG_OPEN_END_VOID */) {
|
|
14182
|
+
if (this._peek.type === 2 /* TokenType.TAG_OPEN_END_VOID */) {
|
|
14155
14183
|
this._advance();
|
|
14156
14184
|
selfClosing = true;
|
|
14157
14185
|
const tagDef = this.getTagDefinition(fullName);
|
|
@@ -14159,7 +14187,7 @@ class _TreeBuilder {
|
|
|
14159
14187
|
this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void and foreign elements can be self closed "${startTagToken.parts[1]}"`));
|
|
14160
14188
|
}
|
|
14161
14189
|
}
|
|
14162
|
-
else if (this._peek.type === 1 /* TAG_OPEN_END */) {
|
|
14190
|
+
else if (this._peek.type === 1 /* TokenType.TAG_OPEN_END */) {
|
|
14163
14191
|
this._advance();
|
|
14164
14192
|
selfClosing = false;
|
|
14165
14193
|
}
|
|
@@ -14174,7 +14202,7 @@ class _TreeBuilder {
|
|
|
14174
14202
|
// element start tag also represents the end tag.
|
|
14175
14203
|
this._popElement(fullName, span);
|
|
14176
14204
|
}
|
|
14177
|
-
else if (startTagToken.type === 4 /* INCOMPLETE_TAG_OPEN */) {
|
|
14205
|
+
else if (startTagToken.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {
|
|
14178
14206
|
// We already know the opening tag is not complete, so it is unlikely it has a corresponding
|
|
14179
14207
|
// close tag. Let's optimistically parse it as a full element and emit an error.
|
|
14180
14208
|
this._popElement(fullName, null);
|
|
@@ -14231,7 +14259,7 @@ class _TreeBuilder {
|
|
|
14231
14259
|
const fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);
|
|
14232
14260
|
let attrEnd = attrName.sourceSpan.end;
|
|
14233
14261
|
// Consume any quote
|
|
14234
|
-
if (this._peek.type === 15 /* ATTR_QUOTE */) {
|
|
14262
|
+
if (this._peek.type === 15 /* TokenType.ATTR_QUOTE */) {
|
|
14235
14263
|
this._advance();
|
|
14236
14264
|
}
|
|
14237
14265
|
// Consume the attribute value
|
|
@@ -14244,22 +14272,22 @@ class _TreeBuilder {
|
|
|
14244
14272
|
// being able to consider `ATTR_VALUE_INTERPOLATION` as an option. This is because TS is not
|
|
14245
14273
|
// able to see that `_advance()` will actually mutate `_peek`.
|
|
14246
14274
|
const nextTokenType = this._peek.type;
|
|
14247
|
-
if (nextTokenType === 16 /* ATTR_VALUE_TEXT */) {
|
|
14275
|
+
if (nextTokenType === 16 /* TokenType.ATTR_VALUE_TEXT */) {
|
|
14248
14276
|
valueStartSpan = this._peek.sourceSpan;
|
|
14249
14277
|
valueEnd = this._peek.sourceSpan.end;
|
|
14250
|
-
while (this._peek.type === 16 /* ATTR_VALUE_TEXT */ ||
|
|
14251
|
-
this._peek.type === 17 /* ATTR_VALUE_INTERPOLATION */ ||
|
|
14252
|
-
this._peek.type === 9 /* ENCODED_ENTITY */) {
|
|
14278
|
+
while (this._peek.type === 16 /* TokenType.ATTR_VALUE_TEXT */ ||
|
|
14279
|
+
this._peek.type === 17 /* TokenType.ATTR_VALUE_INTERPOLATION */ ||
|
|
14280
|
+
this._peek.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14253
14281
|
const valueToken = this._advance();
|
|
14254
14282
|
valueTokens.push(valueToken);
|
|
14255
|
-
if (valueToken.type === 17 /* ATTR_VALUE_INTERPOLATION */) {
|
|
14283
|
+
if (valueToken.type === 17 /* TokenType.ATTR_VALUE_INTERPOLATION */) {
|
|
14256
14284
|
// For backward compatibility we decode HTML entities that appear in interpolation
|
|
14257
14285
|
// expressions. This is arguably a bug, but it could be a considerable breaking change to
|
|
14258
14286
|
// fix it. It should be addressed in a larger project to refactor the entire parser/lexer
|
|
14259
14287
|
// chain after View Engine has been removed.
|
|
14260
14288
|
value += valueToken.parts.join('').replace(/&([^;]+);/g, decodeEntity);
|
|
14261
14289
|
}
|
|
14262
|
-
else if (valueToken.type === 9 /* ENCODED_ENTITY */) {
|
|
14290
|
+
else if (valueToken.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14263
14291
|
value += valueToken.parts[0];
|
|
14264
14292
|
}
|
|
14265
14293
|
else {
|
|
@@ -14269,7 +14297,7 @@ class _TreeBuilder {
|
|
|
14269
14297
|
}
|
|
14270
14298
|
}
|
|
14271
14299
|
// Consume any quote
|
|
14272
|
-
if (this._peek.type === 15 /* ATTR_QUOTE */) {
|
|
14300
|
+
if (this._peek.type === 15 /* TokenType.ATTR_QUOTE */) {
|
|
14273
14301
|
const quoteToken = this._advance();
|
|
14274
14302
|
attrEnd = quoteToken.sourceSpan.end;
|
|
14275
14303
|
}
|
|
@@ -14399,7 +14427,7 @@ class WhitespaceVisitor {
|
|
|
14399
14427
|
(context.prev instanceof Expansion || context.next instanceof Expansion);
|
|
14400
14428
|
if (isNotBlank || hasExpansionSibling) {
|
|
14401
14429
|
// Process the whitespace in the tokens of this Text node
|
|
14402
|
-
const tokens = text.tokens.map(token => token.type === 5 /* TEXT */ ? createWhitespaceProcessedTextToken(token) : token);
|
|
14430
|
+
const tokens = text.tokens.map(token => token.type === 5 /* TokenType.TEXT */ ? createWhitespaceProcessedTextToken(token) : token);
|
|
14403
14431
|
// Process the whitespace of the value of this Text node
|
|
14404
14432
|
const value = processWhitespace(text.value);
|
|
14405
14433
|
return new Text(value, text.sourceSpan, tokens, text.i18n);
|
|
@@ -15248,7 +15276,7 @@ class BindingParser {
|
|
|
15248
15276
|
}
|
|
15249
15277
|
createBoundElementProperty(elementSelector, boundProp, skipValidation = false, mapPropertyName = true) {
|
|
15250
15278
|
if (boundProp.isAnimation) {
|
|
15251
|
-
return new BoundElementProperty(boundProp.name, 4 /* Animation */, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
15279
|
+
return new BoundElementProperty(boundProp.name, 4 /* BindingType.Animation */, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
15252
15280
|
}
|
|
15253
15281
|
let unit = null;
|
|
15254
15282
|
let bindingType = undefined;
|
|
@@ -15269,17 +15297,17 @@ class BindingParser {
|
|
|
15269
15297
|
const name = boundPropertyName.substring(nsSeparatorIdx + 1);
|
|
15270
15298
|
boundPropertyName = mergeNsAndName(ns, name);
|
|
15271
15299
|
}
|
|
15272
|
-
bindingType = 1 /* Attribute */;
|
|
15300
|
+
bindingType = 1 /* BindingType.Attribute */;
|
|
15273
15301
|
}
|
|
15274
15302
|
else if (parts[0] == CLASS_PREFIX) {
|
|
15275
15303
|
boundPropertyName = parts[1];
|
|
15276
|
-
bindingType = 2 /* Class */;
|
|
15304
|
+
bindingType = 2 /* BindingType.Class */;
|
|
15277
15305
|
securityContexts = [SecurityContext.NONE];
|
|
15278
15306
|
}
|
|
15279
15307
|
else if (parts[0] == STYLE_PREFIX) {
|
|
15280
15308
|
unit = parts.length > 2 ? parts[2] : null;
|
|
15281
15309
|
boundPropertyName = parts[1];
|
|
15282
|
-
bindingType = 3 /* Style */;
|
|
15310
|
+
bindingType = 3 /* BindingType.Style */;
|
|
15283
15311
|
securityContexts = [SecurityContext.STYLE];
|
|
15284
15312
|
}
|
|
15285
15313
|
}
|
|
@@ -15288,7 +15316,7 @@ class BindingParser {
|
|
|
15288
15316
|
const mappedPropName = this._schemaRegistry.getMappedPropName(boundProp.name);
|
|
15289
15317
|
boundPropertyName = mapPropertyName ? mappedPropName : boundProp.name;
|
|
15290
15318
|
securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, mappedPropName, false);
|
|
15291
|
-
bindingType = 0 /* Property */;
|
|
15319
|
+
bindingType = 0 /* BindingType.Property */;
|
|
15292
15320
|
if (!skipValidation) {
|
|
15293
15321
|
this._validatePropertyOrAttributeName(mappedPropName, boundProp.sourceSpan, false);
|
|
15294
15322
|
}
|
|
@@ -15320,7 +15348,7 @@ class BindingParser {
|
|
|
15320
15348
|
const eventName = matches[0];
|
|
15321
15349
|
const phase = matches[1].toLowerCase();
|
|
15322
15350
|
const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
|
|
15323
|
-
targetEvents.push(new ParsedEvent(eventName, phase, 1 /* Animation */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15351
|
+
targetEvents.push(new ParsedEvent(eventName, phase, 1 /* ParsedEventType.Animation */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15324
15352
|
if (eventName.length === 0) {
|
|
15325
15353
|
this._reportError(`Animation event name is missing in binding`, sourceSpan);
|
|
15326
15354
|
}
|
|
@@ -15338,7 +15366,7 @@ class BindingParser {
|
|
|
15338
15366
|
const [target, eventName] = splitAtColon(name, [null, name]);
|
|
15339
15367
|
const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
|
|
15340
15368
|
targetMatchableAttrs.push([name, ast.source]);
|
|
15341
|
-
targetEvents.push(new ParsedEvent(eventName, target, 0 /* Regular */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15369
|
+
targetEvents.push(new ParsedEvent(eventName, target, 0 /* ParsedEventType.Regular */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15342
15370
|
// Don't detect directives for event names for now,
|
|
15343
15371
|
// so don't add the event name to the matchableAttrs
|
|
15344
15372
|
}
|
|
@@ -16419,8 +16447,8 @@ class _I18nVisitor {
|
|
|
16419
16447
|
let hasInterpolation = false;
|
|
16420
16448
|
for (const token of tokens) {
|
|
16421
16449
|
switch (token.type) {
|
|
16422
|
-
case 8 /* INTERPOLATION */:
|
|
16423
|
-
case 17 /* ATTR_VALUE_INTERPOLATION */:
|
|
16450
|
+
case 8 /* TokenType.INTERPOLATION */:
|
|
16451
|
+
case 17 /* TokenType.ATTR_VALUE_INTERPOLATION */:
|
|
16424
16452
|
hasInterpolation = true;
|
|
16425
16453
|
const expression = token.parts[1];
|
|
16426
16454
|
const baseName = extractPlaceholderName(expression) || 'INTERPOLATION';
|
|
@@ -16749,25 +16777,78 @@ function parseI18nMeta(meta = '') {
|
|
|
16749
16777
|
function i18nMetaToJSDoc(meta) {
|
|
16750
16778
|
const tags = [];
|
|
16751
16779
|
if (meta.description) {
|
|
16752
|
-
tags.push({ tagName: "desc" /* Desc */, text: meta.description });
|
|
16780
|
+
tags.push({ tagName: "desc" /* o.JSDocTagName.Desc */, text: meta.description });
|
|
16753
16781
|
}
|
|
16754
16782
|
else {
|
|
16755
16783
|
// Suppress the JSCompiler warning that a `@desc` was not given for this message.
|
|
16756
|
-
tags.push({ tagName: "suppress" /* Suppress */, text: '{msgDescriptions}' });
|
|
16784
|
+
tags.push({ tagName: "suppress" /* o.JSDocTagName.Suppress */, text: '{msgDescriptions}' });
|
|
16757
16785
|
}
|
|
16758
16786
|
if (meta.meaning) {
|
|
16759
|
-
tags.push({ tagName: "meaning" /* Meaning */, text: meta.meaning });
|
|
16787
|
+
tags.push({ tagName: "meaning" /* o.JSDocTagName.Meaning */, text: meta.meaning });
|
|
16760
16788
|
}
|
|
16761
16789
|
return jsDocComment(tags);
|
|
16762
16790
|
}
|
|
16763
16791
|
|
|
16764
16792
|
/** Closure uses `goog.getMsg(message)` to lookup translations */
|
|
16765
16793
|
const GOOG_GET_MSG = 'goog.getMsg';
|
|
16766
|
-
|
|
16794
|
+
/**
|
|
16795
|
+
* Generates a `goog.getMsg()` statement and reassignment. The template:
|
|
16796
|
+
*
|
|
16797
|
+
* ```html
|
|
16798
|
+
* <div i18n>Sent from {{ sender }} to <span class="receiver">{{ receiver }}</span></div>
|
|
16799
|
+
* ```
|
|
16800
|
+
*
|
|
16801
|
+
* Generates:
|
|
16802
|
+
*
|
|
16803
|
+
* ```typescript
|
|
16804
|
+
* const MSG_FOO = goog.getMsg(
|
|
16805
|
+
* // Message template.
|
|
16806
|
+
* 'Sent from {$interpolation} to {$startTagSpan}{$interpolation_1}{$closeTagSpan}.',
|
|
16807
|
+
* // Placeholder values, set to magic strings which get replaced by the Angular runtime.
|
|
16808
|
+
* {
|
|
16809
|
+
* 'interpolation': '\uFFFD0\uFFFD',
|
|
16810
|
+
* 'startTagSpan': '\uFFFD1\uFFFD',
|
|
16811
|
+
* 'interpolation_1': '\uFFFD2\uFFFD',
|
|
16812
|
+
* 'closeTagSpan': '\uFFFD3\uFFFD',
|
|
16813
|
+
* },
|
|
16814
|
+
* // Options bag.
|
|
16815
|
+
* {
|
|
16816
|
+
* // Maps each placeholder to the original Angular source code which generates it's value.
|
|
16817
|
+
* original_code: {
|
|
16818
|
+
* 'interpolation': '{{ sender }}',
|
|
16819
|
+
* 'startTagSpan': '<span class="receiver">',
|
|
16820
|
+
* 'interploation_1': '{{ receiver }}',
|
|
16821
|
+
* 'closeTagSpan': '</span>',
|
|
16822
|
+
* },
|
|
16823
|
+
* },
|
|
16824
|
+
* );
|
|
16825
|
+
* const I18N_0 = MSG_FOO;
|
|
16826
|
+
* ```
|
|
16827
|
+
*/
|
|
16828
|
+
function createGoogleGetMsgStatements(variable$1, message, closureVar, placeholderValues) {
|
|
16767
16829
|
const messageString = serializeI18nMessageForGetMsg(message);
|
|
16768
16830
|
const args = [literal(messageString)];
|
|
16769
|
-
if (Object.keys(
|
|
16770
|
-
|
|
16831
|
+
if (Object.keys(placeholderValues).length) {
|
|
16832
|
+
// Message template parameters containing the magic strings replaced by the Angular runtime with
|
|
16833
|
+
// real data, e.g. `{'interpolation': '\uFFFD0\uFFFD'}`.
|
|
16834
|
+
args.push(mapLiteral(formatI18nPlaceholderNamesInMap(placeholderValues, true /* useCamelCase */), true /* quoted */));
|
|
16835
|
+
// Message options object, which contains original source code for placeholders (as they are
|
|
16836
|
+
// present in a template, e.g.
|
|
16837
|
+
// `{original_code: {'interpolation': '{{ name }}', 'startTagSpan': '<span>'}}`.
|
|
16838
|
+
args.push(mapLiteral({
|
|
16839
|
+
original_code: literalMap(Object.keys(placeholderValues)
|
|
16840
|
+
.map((param) => ({
|
|
16841
|
+
key: formatI18nPlaceholderName(param),
|
|
16842
|
+
quoted: true,
|
|
16843
|
+
value: message.placeholders[param] ?
|
|
16844
|
+
// Get source span for typical placeholder if it exists.
|
|
16845
|
+
literal(message.placeholders[param].sourceSpan.toString()) :
|
|
16846
|
+
// Otherwise must be an ICU expression, get it's source span.
|
|
16847
|
+
literal(message.placeholderToMessage[param]
|
|
16848
|
+
.nodes.map((node) => node.sourceSpan.toString())
|
|
16849
|
+
.join('')),
|
|
16850
|
+
}))),
|
|
16851
|
+
}));
|
|
16771
16852
|
}
|
|
16772
16853
|
// /**
|
|
16773
16854
|
// * @desc description of message
|
|
@@ -16977,7 +17058,7 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
|
|
|
16977
17058
|
statements.push(new ExpressionStatement(invokeInstruction(null, Identifiers.resetView, [])));
|
|
16978
17059
|
}
|
|
16979
17060
|
}
|
|
16980
|
-
const eventName = type === 1 /* Animation */ ? prepareSyntheticListenerName(name, phase) : name;
|
|
17061
|
+
const eventName = type === 1 /* ParsedEventType.Animation */ ? prepareSyntheticListenerName(name, phase) : name;
|
|
16981
17062
|
const fnName = handlerName && sanitizeIdentifier(handlerName);
|
|
16982
17063
|
const fnArgs = [];
|
|
16983
17064
|
if (implicitReceiverAccesses.has(eventArgumentName)) {
|
|
@@ -17129,10 +17210,10 @@ class TemplateDefinitionBuilder {
|
|
|
17129
17210
|
const creationVariables = this._bindingScope.viewSnapshotStatements();
|
|
17130
17211
|
const updateVariables = this._bindingScope.variableDeclarations().concat(this._tempVariables);
|
|
17131
17212
|
const creationBlock = creationStatements.length > 0 ?
|
|
17132
|
-
[renderFlagCheckIfStmt(1 /* Create */, creationVariables.concat(creationStatements))] :
|
|
17213
|
+
[renderFlagCheckIfStmt(1 /* core.RenderFlags.Create */, creationVariables.concat(creationStatements))] :
|
|
17133
17214
|
[];
|
|
17134
17215
|
const updateBlock = updateStatements.length > 0 ?
|
|
17135
|
-
[renderFlagCheckIfStmt(2 /* Update */, updateVariables.concat(updateStatements))] :
|
|
17216
|
+
[renderFlagCheckIfStmt(2 /* core.RenderFlags.Update */, updateVariables.concat(updateStatements))] :
|
|
17136
17217
|
[];
|
|
17137
17218
|
return fn(
|
|
17138
17219
|
// i.e. (rf: RenderFlags, ctx: any)
|
|
@@ -17170,7 +17251,7 @@ class TemplateDefinitionBuilder {
|
|
|
17170
17251
|
const scopedName = this._bindingScope.freshReferenceName();
|
|
17171
17252
|
const retrievalLevel = this.level;
|
|
17172
17253
|
const lhs = variable(variable$1.name + scopedName);
|
|
17173
|
-
this._bindingScope.set(retrievalLevel, variable$1.name, lhs, 1 /* CONTEXT */, (scope, relativeLevel) => {
|
|
17254
|
+
this._bindingScope.set(retrievalLevel, variable$1.name, lhs, 1 /* DeclarationPriority.CONTEXT */, (scope, relativeLevel) => {
|
|
17174
17255
|
let rhs;
|
|
17175
17256
|
if (scope.bindingLevel === retrievalLevel) {
|
|
17176
17257
|
if (scope.isListenerScope() && scope.hasRestoreViewVariable()) {
|
|
@@ -17423,7 +17504,7 @@ class TemplateDefinitionBuilder {
|
|
|
17423
17504
|
element.inputs.forEach(input => {
|
|
17424
17505
|
const stylingInputWasSet = stylingBuilder.registerBoundInput(input);
|
|
17425
17506
|
if (!stylingInputWasSet) {
|
|
17426
|
-
if (input.type === 0 /* Property */ && input.i18n) {
|
|
17507
|
+
if (input.type === 0 /* BindingType.Property */ && input.i18n) {
|
|
17427
17508
|
boundI18nAttrs.push(input);
|
|
17428
17509
|
}
|
|
17429
17510
|
else {
|
|
@@ -17496,7 +17577,7 @@ class TemplateDefinitionBuilder {
|
|
|
17496
17577
|
// Generate element input bindings
|
|
17497
17578
|
allOtherInputs.forEach(input => {
|
|
17498
17579
|
const inputType = input.type;
|
|
17499
|
-
if (inputType === 4 /* Animation */) {
|
|
17580
|
+
if (inputType === 4 /* BindingType.Animation */) {
|
|
17500
17581
|
const value = input.value.visit(this._valueConverter);
|
|
17501
17582
|
// animation bindings can be presented in the following formats:
|
|
17502
17583
|
// 1. [@binding]="fooExp"
|
|
@@ -17523,7 +17604,7 @@ class TemplateDefinitionBuilder {
|
|
|
17523
17604
|
if (value !== undefined) {
|
|
17524
17605
|
const params = [];
|
|
17525
17606
|
const [attrNamespace, attrName] = splitNsName(input.name);
|
|
17526
|
-
const isAttributeBinding = inputType === 1 /* Attribute */;
|
|
17607
|
+
const isAttributeBinding = inputType === 1 /* BindingType.Attribute */;
|
|
17527
17608
|
const sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding);
|
|
17528
17609
|
if (sanitizationRef)
|
|
17529
17610
|
params.push(sanitizationRef);
|
|
@@ -17539,7 +17620,7 @@ class TemplateDefinitionBuilder {
|
|
|
17539
17620
|
}
|
|
17540
17621
|
}
|
|
17541
17622
|
this.allocateBindingSlots(value);
|
|
17542
|
-
if (inputType === 0 /* Property */) {
|
|
17623
|
+
if (inputType === 0 /* BindingType.Property */) {
|
|
17543
17624
|
if (value instanceof Interpolation) {
|
|
17544
17625
|
// prop="{{value}}" and friends
|
|
17545
17626
|
this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), elementIndex, attrName, input, value, params);
|
|
@@ -17553,7 +17634,7 @@ class TemplateDefinitionBuilder {
|
|
|
17553
17634
|
});
|
|
17554
17635
|
}
|
|
17555
17636
|
}
|
|
17556
|
-
else if (inputType === 1 /* Attribute */) {
|
|
17637
|
+
else if (inputType === 1 /* BindingType.Attribute */) {
|
|
17557
17638
|
if (value instanceof Interpolation && getInterpolationArgsLength(value) > 1) {
|
|
17558
17639
|
// attr.name="text{{value}}" and friends
|
|
17559
17640
|
this.interpolatedUpdateInstruction(getAttributeInterpolationExpression(value), elementIndex, attrName, input, value, params);
|
|
@@ -17718,7 +17799,7 @@ class TemplateDefinitionBuilder {
|
|
|
17718
17799
|
// - all ICU vars (such as `VAR_SELECT` or `VAR_PLURAL`) are replaced with correct values
|
|
17719
17800
|
const transformFn = (raw) => {
|
|
17720
17801
|
const params = { ...vars, ...placeholders };
|
|
17721
|
-
const formatted =
|
|
17802
|
+
const formatted = formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false);
|
|
17722
17803
|
return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
|
|
17723
17804
|
};
|
|
17724
17805
|
// in case the whole i18n message is a single ICU - we do not need to
|
|
@@ -17949,13 +18030,13 @@ class TemplateDefinitionBuilder {
|
|
|
17949
18030
|
const input = inputs[i];
|
|
17950
18031
|
// We don't want the animation and attribute bindings in the
|
|
17951
18032
|
// attributes array since they aren't used for directive matching.
|
|
17952
|
-
if (input.type !== 4 /* Animation */ && input.type !== 1 /* Attribute */) {
|
|
18033
|
+
if (input.type !== 4 /* BindingType.Animation */ && input.type !== 1 /* BindingType.Attribute */) {
|
|
17953
18034
|
addAttrExpr(input.name);
|
|
17954
18035
|
}
|
|
17955
18036
|
}
|
|
17956
18037
|
for (let i = 0; i < outputs.length; i++) {
|
|
17957
18038
|
const output = outputs[i];
|
|
17958
|
-
if (output.type !== 1 /* Animation */) {
|
|
18039
|
+
if (output.type !== 1 /* ParsedEventType.Animation */) {
|
|
17959
18040
|
addAttrExpr(output.name);
|
|
17960
18041
|
}
|
|
17961
18042
|
}
|
|
@@ -17964,15 +18045,15 @@ class TemplateDefinitionBuilder {
|
|
|
17964
18045
|
// to the expressions. The marker is important because it tells the runtime
|
|
17965
18046
|
// code that this is where attributes without values start...
|
|
17966
18047
|
if (attrExprs.length !== attrsLengthBeforeInputs) {
|
|
17967
|
-
attrExprs.splice(attrsLengthBeforeInputs, 0, literal(3 /* Bindings */));
|
|
18048
|
+
attrExprs.splice(attrsLengthBeforeInputs, 0, literal(3 /* core.AttributeMarker.Bindings */));
|
|
17968
18049
|
}
|
|
17969
18050
|
}
|
|
17970
18051
|
if (templateAttrs.length) {
|
|
17971
|
-
attrExprs.push(literal(4 /* Template */));
|
|
18052
|
+
attrExprs.push(literal(4 /* core.AttributeMarker.Template */));
|
|
17972
18053
|
templateAttrs.forEach(attr => addAttrExpr(attr.name));
|
|
17973
18054
|
}
|
|
17974
18055
|
if (boundI18nAttrs.length) {
|
|
17975
|
-
attrExprs.push(literal(6 /* I18n */));
|
|
18056
|
+
attrExprs.push(literal(6 /* core.AttributeMarker.I18n */));
|
|
17976
18057
|
boundI18nAttrs.forEach(attr => addAttrExpr(attr.name));
|
|
17977
18058
|
}
|
|
17978
18059
|
return attrExprs;
|
|
@@ -18003,7 +18084,7 @@ class TemplateDefinitionBuilder {
|
|
|
18003
18084
|
const variableName = this._bindingScope.freshReferenceName();
|
|
18004
18085
|
const retrievalLevel = this.level;
|
|
18005
18086
|
const lhs = variable(variableName);
|
|
18006
|
-
this._bindingScope.set(retrievalLevel, reference.name, lhs, 0 /* DEFAULT */, (scope, relativeLevel) => {
|
|
18087
|
+
this._bindingScope.set(retrievalLevel, reference.name, lhs, 0 /* DeclarationPriority.DEFAULT */, (scope, relativeLevel) => {
|
|
18007
18088
|
// e.g. nextContext(2);
|
|
18008
18089
|
const nextContextStmt = relativeLevel > 0 ? [generateNextContextExpr(relativeLevel).toStmt()] : [];
|
|
18009
18090
|
// e.g. const $foo$ = reference(1);
|
|
@@ -18017,7 +18098,7 @@ class TemplateDefinitionBuilder {
|
|
|
18017
18098
|
prepareListenerParameter(tagName, outputAst, index) {
|
|
18018
18099
|
return () => {
|
|
18019
18100
|
const eventName = outputAst.name;
|
|
18020
|
-
const bindingFnName = outputAst.type === 1 /* Animation */ ?
|
|
18101
|
+
const bindingFnName = outputAst.type === 1 /* ParsedEventType.Animation */ ?
|
|
18021
18102
|
// synthetic @listener.foo values are treated the exact same as are standard listeners
|
|
18022
18103
|
prepareSyntheticListenerFunctionName(eventName, outputAst.phase) :
|
|
18023
18104
|
sanitizeIdentifier(eventName);
|
|
@@ -18137,7 +18218,7 @@ function getAttributeNameLiterals(name) {
|
|
|
18137
18218
|
const nameLiteral = literal(attributeName);
|
|
18138
18219
|
if (attributeNamespace) {
|
|
18139
18220
|
return [
|
|
18140
|
-
literal(0 /* NamespaceURI */), literal(attributeNamespace), nameLiteral
|
|
18221
|
+
literal(0 /* core.AttributeMarker.NamespaceURI */), literal(attributeNamespace), nameLiteral
|
|
18141
18222
|
];
|
|
18142
18223
|
}
|
|
18143
18224
|
return [nameLiteral];
|
|
@@ -18206,7 +18287,7 @@ class BindingScope {
|
|
|
18206
18287
|
* @param declareLocalCallback The callback to invoke when declaring this local var
|
|
18207
18288
|
* @param localRef Whether or not this is a local ref
|
|
18208
18289
|
*/
|
|
18209
|
-
set(retrievalLevel, name, lhs, priority = 0 /* DEFAULT */, declareLocalCallback, localRef) {
|
|
18290
|
+
set(retrievalLevel, name, lhs, priority = 0 /* DeclarationPriority.DEFAULT */, declareLocalCallback, localRef) {
|
|
18210
18291
|
if (this.map.has(name)) {
|
|
18211
18292
|
if (localRef) {
|
|
18212
18293
|
// Do not throw an error if it's a local ref and do not update existing value,
|
|
@@ -18262,7 +18343,7 @@ class BindingScope {
|
|
|
18262
18343
|
return sharedCtxObj && sharedCtxObj.declare ? sharedCtxObj.lhs : null;
|
|
18263
18344
|
}
|
|
18264
18345
|
maybeGenerateSharedContextVar(value) {
|
|
18265
|
-
if (value.priority === 1 /* CONTEXT */ &&
|
|
18346
|
+
if (value.priority === 1 /* DeclarationPriority.CONTEXT */ &&
|
|
18266
18347
|
value.retrievalLevel < this.bindingLevel) {
|
|
18267
18348
|
const sharedCtxObj = this.map.get(SHARED_CONTEXT_KEY + value.retrievalLevel);
|
|
18268
18349
|
if (sharedCtxObj) {
|
|
@@ -18283,7 +18364,7 @@ class BindingScope {
|
|
|
18283
18364
|
return [lhs.set(generateNextContextExpr(relativeLevel)).toConstDecl()];
|
|
18284
18365
|
},
|
|
18285
18366
|
declare: false,
|
|
18286
|
-
priority: 2 /* SHARED_CONTEXT */,
|
|
18367
|
+
priority: 2 /* DeclarationPriority.SHARED_CONTEXT */,
|
|
18287
18368
|
});
|
|
18288
18369
|
}
|
|
18289
18370
|
getComponentProperty(name) {
|
|
@@ -18380,7 +18461,7 @@ function getNgProjectAsLiteral(attribute) {
|
|
|
18380
18461
|
// Parse the attribute value into a CssSelectorList. Note that we only take the
|
|
18381
18462
|
// first selector, because we don't support multiple selectors in ngProjectAs.
|
|
18382
18463
|
const parsedR3Selector = parseSelectorToR3Selector(attribute.value)[0];
|
|
18383
|
-
return [literal(5 /* ProjectAs */), asLiteral(parsedR3Selector)];
|
|
18464
|
+
return [literal(5 /* core.AttributeMarker.ProjectAs */), asLiteral(parsedR3Selector)];
|
|
18384
18465
|
}
|
|
18385
18466
|
/**
|
|
18386
18467
|
* Gets the instruction to generate for an interpolated property
|
|
@@ -18639,7 +18720,7 @@ const NG_I18N_CLOSURE_MODE = 'ngI18nClosureMode';
|
|
|
18639
18720
|
function getTranslationDeclStmts(message, variable, closureVar, params = {}, transformFn) {
|
|
18640
18721
|
const statements = [
|
|
18641
18722
|
declareI18nVariable(variable),
|
|
18642
|
-
ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable, message, closureVar,
|
|
18723
|
+
ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable, message, closureVar, params), createLocalizeStatements(variable, message, formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false))),
|
|
18643
18724
|
];
|
|
18644
18725
|
if (transformFn) {
|
|
18645
18726
|
statements.push(new ExpressionStatement(variable.set(transformFn(variable))));
|
|
@@ -18704,6 +18785,9 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
18704
18785
|
if (meta.exportAs !== null) {
|
|
18705
18786
|
definitionMap.set('exportAs', literalArr(meta.exportAs.map(e => literal(e))));
|
|
18706
18787
|
}
|
|
18788
|
+
if (meta.isStandalone) {
|
|
18789
|
+
definitionMap.set('standalone', literal(true));
|
|
18790
|
+
}
|
|
18707
18791
|
return definitionMap;
|
|
18708
18792
|
}
|
|
18709
18793
|
/**
|
|
@@ -18730,6 +18814,10 @@ function addFeatures(definitionMap, meta) {
|
|
|
18730
18814
|
if (meta.lifecycle.usesOnChanges) {
|
|
18731
18815
|
features.push(importExpr(Identifiers.NgOnChangesFeature));
|
|
18732
18816
|
}
|
|
18817
|
+
// TODO: better way of differentiating component vs directive metadata.
|
|
18818
|
+
if (meta.hasOwnProperty('template') && meta.isStandalone) {
|
|
18819
|
+
features.push(importExpr(Identifiers.StandaloneFeature));
|
|
18820
|
+
}
|
|
18733
18821
|
if (features.length) {
|
|
18734
18822
|
definitionMap.set('features', literalArr(features));
|
|
18735
18823
|
}
|
|
@@ -18793,17 +18881,8 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18793
18881
|
definitionMap.set('consts', constsExpr);
|
|
18794
18882
|
}
|
|
18795
18883
|
definitionMap.set('template', templateFunctionExpression);
|
|
18796
|
-
|
|
18797
|
-
|
|
18798
|
-
const directivesList = literalArr(meta.directives.map(dir => dir.type));
|
|
18799
|
-
const directivesExpr = compileDeclarationList(directivesList, meta.declarationListEmitMode);
|
|
18800
|
-
definitionMap.set('directives', directivesExpr);
|
|
18801
|
-
}
|
|
18802
|
-
// e.g. `pipes: [MyPipe]`
|
|
18803
|
-
if (meta.pipes.size > 0) {
|
|
18804
|
-
const pipesList = literalArr(Array.from(meta.pipes.values()));
|
|
18805
|
-
const pipesExpr = compileDeclarationList(pipesList, meta.declarationListEmitMode);
|
|
18806
|
-
definitionMap.set('pipes', pipesExpr);
|
|
18884
|
+
if (meta.declarations.length > 0) {
|
|
18885
|
+
definitionMap.set('dependencies', compileDeclarationList(literalArr(meta.declarations.map(decl => decl.type)), meta.declarationListEmitMode));
|
|
18807
18886
|
}
|
|
18808
18887
|
if (meta.encapsulation === null) {
|
|
18809
18888
|
meta.encapsulation = ViewEncapsulation.Emulated;
|
|
@@ -18813,8 +18892,15 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18813
18892
|
const styleValues = meta.encapsulation == ViewEncapsulation.Emulated ?
|
|
18814
18893
|
compileStyles(meta.styles, CONTENT_ATTR, HOST_ATTR) :
|
|
18815
18894
|
meta.styles;
|
|
18816
|
-
const
|
|
18817
|
-
|
|
18895
|
+
const styleNodes = styleValues.reduce((result, style) => {
|
|
18896
|
+
if (style.trim().length > 0) {
|
|
18897
|
+
result.push(constantPool.getConstLiteral(literal(style)));
|
|
18898
|
+
}
|
|
18899
|
+
return result;
|
|
18900
|
+
}, []);
|
|
18901
|
+
if (styleNodes.length > 0) {
|
|
18902
|
+
definitionMap.set('styles', literalArr(styleNodes));
|
|
18903
|
+
}
|
|
18818
18904
|
}
|
|
18819
18905
|
else if (meta.encapsulation === ViewEncapsulation.Emulated) {
|
|
18820
18906
|
// If there is no style, don't generate css selectors on elements
|
|
@@ -18841,8 +18927,9 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18841
18927
|
* to be consumed by upstream compilations.
|
|
18842
18928
|
*/
|
|
18843
18929
|
function createComponentType(meta) {
|
|
18844
|
-
const typeParams =
|
|
18930
|
+
const typeParams = createBaseDirectiveTypeParams(meta);
|
|
18845
18931
|
typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
|
|
18932
|
+
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
18846
18933
|
return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
|
|
18847
18934
|
}
|
|
18848
18935
|
/**
|
|
@@ -18851,13 +18938,13 @@ function createComponentType(meta) {
|
|
|
18851
18938
|
*/
|
|
18852
18939
|
function compileDeclarationList(list, mode) {
|
|
18853
18940
|
switch (mode) {
|
|
18854
|
-
case 0 /* Direct */:
|
|
18941
|
+
case 0 /* DeclarationListEmitMode.Direct */:
|
|
18855
18942
|
// directives: [MyDir],
|
|
18856
18943
|
return list;
|
|
18857
|
-
case 1 /* Closure */:
|
|
18944
|
+
case 1 /* DeclarationListEmitMode.Closure */:
|
|
18858
18945
|
// directives: function () { return [MyDir]; }
|
|
18859
18946
|
return fn([], [new ReturnStatement(list)]);
|
|
18860
|
-
case 2 /* ClosureResolved */:
|
|
18947
|
+
case 2 /* DeclarationListEmitMode.ClosureResolved */:
|
|
18861
18948
|
// directives: function () { return [MyDir].map(ng.resolveForwardRef); }
|
|
18862
18949
|
const resolvedList = list.prop('map').callFn([importExpr(Identifiers.resolveForwardRef)]);
|
|
18863
18950
|
return fn([], [new ReturnStatement(resolvedList)]);
|
|
@@ -18875,9 +18962,9 @@ function prepareQueryParams(query, constantPool) {
|
|
|
18875
18962
|
* @param query
|
|
18876
18963
|
*/
|
|
18877
18964
|
function toQueryFlags(query) {
|
|
18878
|
-
return (query.descendants ? 1 /* descendants */ : 0 /* none */) |
|
|
18879
|
-
(query.static ? 2 /* isStatic */ : 0 /* none */) |
|
|
18880
|
-
(query.emitDistinctChangesOnly ? 4 /* emitDistinctChangesOnly */ : 0 /* none */);
|
|
18965
|
+
return (query.descendants ? 1 /* QueryFlags.descendants */ : 0 /* QueryFlags.none */) |
|
|
18966
|
+
(query.static ? 2 /* QueryFlags.isStatic */ : 0 /* QueryFlags.none */) |
|
|
18967
|
+
(query.emitDistinctChangesOnly ? 4 /* QueryFlags.emitDistinctChangesOnly */ : 0 /* QueryFlags.none */);
|
|
18881
18968
|
}
|
|
18882
18969
|
function convertAttributesToExpressions(attributes) {
|
|
18883
18970
|
const values = [];
|
|
@@ -18911,8 +18998,8 @@ function createContentQueriesFunction(queries, constantPool, name) {
|
|
|
18911
18998
|
new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null),
|
|
18912
18999
|
new FnParam('dirIndex', null)
|
|
18913
19000
|
], [
|
|
18914
|
-
renderFlagCheckIfStmt(1 /* Create */, createStatements),
|
|
18915
|
-
renderFlagCheckIfStmt(2 /* Update */, updateStatements)
|
|
19001
|
+
renderFlagCheckIfStmt(1 /* core.RenderFlags.Create */, createStatements),
|
|
19002
|
+
renderFlagCheckIfStmt(2 /* core.RenderFlags.Update */, updateStatements)
|
|
18916
19003
|
], INFERRED_TYPE, null, contentQueriesFnName);
|
|
18917
19004
|
}
|
|
18918
19005
|
function stringAsType(str) {
|
|
@@ -18933,7 +19020,7 @@ function stringArrayAsType(arr) {
|
|
|
18933
19020
|
return arr.length > 0 ? expressionType(literalArr(arr.map(value => literal(value)))) :
|
|
18934
19021
|
NONE_TYPE;
|
|
18935
19022
|
}
|
|
18936
|
-
function
|
|
19023
|
+
function createBaseDirectiveTypeParams(meta) {
|
|
18937
19024
|
// On the type side, remove newlines from the selector as it will need to fit into a TypeScript
|
|
18938
19025
|
// string literal, which must be on one line.
|
|
18939
19026
|
const selectorForType = meta.selector !== null ? meta.selector.replace(/\n/g, '') : null;
|
|
@@ -18951,7 +19038,11 @@ function createDirectiveTypeParams(meta) {
|
|
|
18951
19038
|
* to be consumed by upstream compilations.
|
|
18952
19039
|
*/
|
|
18953
19040
|
function createDirectiveType(meta) {
|
|
18954
|
-
const typeParams =
|
|
19041
|
+
const typeParams = createBaseDirectiveTypeParams(meta);
|
|
19042
|
+
// Directives have no NgContentSelectors slot, but instead express a `never` type
|
|
19043
|
+
// so that future fields align.
|
|
19044
|
+
typeParams.push(NONE_TYPE);
|
|
19045
|
+
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
18955
19046
|
return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
|
|
18956
19047
|
}
|
|
18957
19048
|
// Define and update any view queries
|
|
@@ -18974,8 +19065,8 @@ function createViewQueriesFunction(viewQueries, constantPool, name) {
|
|
|
18974
19065
|
});
|
|
18975
19066
|
const viewQueryFnName = name ? `${name}_Query` : null;
|
|
18976
19067
|
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], [
|
|
18977
|
-
renderFlagCheckIfStmt(1 /* Create */, createStatements),
|
|
18978
|
-
renderFlagCheckIfStmt(2 /* Update */, updateStatements)
|
|
19068
|
+
renderFlagCheckIfStmt(1 /* core.RenderFlags.Create */, createStatements),
|
|
19069
|
+
renderFlagCheckIfStmt(2 /* core.RenderFlags.Update */, updateStatements)
|
|
18979
19070
|
], INFERRED_TYPE, null, viewQueryFnName);
|
|
18980
19071
|
}
|
|
18981
19072
|
// Return a host binding function or null if one is not necessary.
|
|
@@ -19115,10 +19206,10 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
|
|
|
19115
19206
|
const hostBindingsFnName = name ? `${name}_HostBindings` : null;
|
|
19116
19207
|
const statements = [];
|
|
19117
19208
|
if (createInstructions.length > 0) {
|
|
19118
|
-
statements.push(renderFlagCheckIfStmt(1 /* Create */, getInstructionStatements(createInstructions)));
|
|
19209
|
+
statements.push(renderFlagCheckIfStmt(1 /* core.RenderFlags.Create */, getInstructionStatements(createInstructions)));
|
|
19119
19210
|
}
|
|
19120
19211
|
if (updateInstructions.length > 0) {
|
|
19121
|
-
statements.push(renderFlagCheckIfStmt(2 /* Update */, updateVariables.concat(getInstructionStatements(updateInstructions))));
|
|
19212
|
+
statements.push(renderFlagCheckIfStmt(2 /* core.RenderFlags.Update */, updateVariables.concat(getInstructionStatements(updateInstructions))));
|
|
19122
19213
|
}
|
|
19123
19214
|
return fn([new FnParam(RENDER_FLAGS, NUMBER_TYPE), new FnParam(CONTEXT_NAME, null)], statements, INFERRED_TYPE, null, hostBindingsFnName);
|
|
19124
19215
|
}
|
|
@@ -19159,12 +19250,12 @@ function createHostListeners(eventBindings, name) {
|
|
|
19159
19250
|
const instructions = [];
|
|
19160
19251
|
for (const binding of eventBindings) {
|
|
19161
19252
|
let bindingName = binding.name && sanitizeIdentifier(binding.name);
|
|
19162
|
-
const bindingFnName = binding.type === 1 /* Animation */ ?
|
|
19253
|
+
const bindingFnName = binding.type === 1 /* ParsedEventType.Animation */ ?
|
|
19163
19254
|
prepareSyntheticListenerFunctionName(bindingName, binding.targetOrPhase) :
|
|
19164
19255
|
bindingName;
|
|
19165
19256
|
const handlerName = name && bindingName ? `${name}_${bindingFnName}_HostBindingHandler` : null;
|
|
19166
19257
|
const params = prepareEventListenerParameters(BoundEvent.fromParsedEvent(binding), handlerName);
|
|
19167
|
-
if (binding.type == 1 /* Animation */) {
|
|
19258
|
+
if (binding.type == 1 /* ParsedEventType.Animation */) {
|
|
19168
19259
|
syntheticListenerParams.push(params);
|
|
19169
19260
|
}
|
|
19170
19261
|
else {
|
|
@@ -19213,7 +19304,7 @@ function parseHostBindings(host) {
|
|
|
19213
19304
|
}
|
|
19214
19305
|
}
|
|
19215
19306
|
}
|
|
19216
|
-
else if (matches[1 /* Binding */] != null) {
|
|
19307
|
+
else if (matches[1 /* HostBindingGroup.Binding */] != null) {
|
|
19217
19308
|
if (typeof value !== 'string') {
|
|
19218
19309
|
// TODO(alxhub): make this a diagnostic.
|
|
19219
19310
|
throw new Error(`Property binding must be string`);
|
|
@@ -19221,14 +19312,14 @@ function parseHostBindings(host) {
|
|
|
19221
19312
|
// synthetic properties (the ones that have a `@` as a prefix)
|
|
19222
19313
|
// are still treated the same as regular properties. Therefore
|
|
19223
19314
|
// there is no point in storing them in a separate map.
|
|
19224
|
-
properties[matches[1 /* Binding */]] = value;
|
|
19315
|
+
properties[matches[1 /* HostBindingGroup.Binding */]] = value;
|
|
19225
19316
|
}
|
|
19226
|
-
else if (matches[2 /* Event */] != null) {
|
|
19317
|
+
else if (matches[2 /* HostBindingGroup.Event */] != null) {
|
|
19227
19318
|
if (typeof value !== 'string') {
|
|
19228
19319
|
// TODO(alxhub): make this a diagnostic.
|
|
19229
19320
|
throw new Error(`Event binding must be string`);
|
|
19230
19321
|
}
|
|
19231
|
-
listeners[matches[2 /* Event */]] = value;
|
|
19322
|
+
listeners[matches[2 /* HostBindingGroup.Event */]] = value;
|
|
19232
19323
|
}
|
|
19233
19324
|
}
|
|
19234
19325
|
return { attributes, listeners, properties, specialAttributes };
|
|
@@ -19313,10 +19404,10 @@ class CompilerFacadeImpl {
|
|
|
19313
19404
|
internalType: new WrappedNodeExpr(facade.type),
|
|
19314
19405
|
typeArgumentCount: facade.typeArgumentCount,
|
|
19315
19406
|
providedIn: computeProvidedIn(facade.providedIn),
|
|
19316
|
-
useClass: convertToProviderExpression(facade,
|
|
19317
|
-
useFactory: wrapExpression(facade,
|
|
19318
|
-
useValue: convertToProviderExpression(facade,
|
|
19319
|
-
useExisting: convertToProviderExpression(facade,
|
|
19407
|
+
useClass: convertToProviderExpression(facade, 'useClass'),
|
|
19408
|
+
useFactory: wrapExpression(facade, 'useFactory'),
|
|
19409
|
+
useValue: convertToProviderExpression(facade, 'useValue'),
|
|
19410
|
+
useExisting: convertToProviderExpression(facade, 'useExisting'),
|
|
19320
19411
|
deps: facade.deps?.map(convertR3DependencyMetadata),
|
|
19321
19412
|
},
|
|
19322
19413
|
/* resolveForwardRefs */ true);
|
|
@@ -19329,10 +19420,10 @@ class CompilerFacadeImpl {
|
|
|
19329
19420
|
internalType: new WrappedNodeExpr(facade.type),
|
|
19330
19421
|
typeArgumentCount: 0,
|
|
19331
19422
|
providedIn: computeProvidedIn(facade.providedIn),
|
|
19332
|
-
useClass: convertToProviderExpression(facade,
|
|
19333
|
-
useFactory: wrapExpression(facade,
|
|
19334
|
-
useValue: convertToProviderExpression(facade,
|
|
19335
|
-
useExisting: convertToProviderExpression(facade,
|
|
19423
|
+
useClass: convertToProviderExpression(facade, 'useClass'),
|
|
19424
|
+
useFactory: wrapExpression(facade, 'useFactory'),
|
|
19425
|
+
useValue: convertToProviderExpression(facade, 'useValue'),
|
|
19426
|
+
useExisting: convertToProviderExpression(facade, 'useExisting'),
|
|
19336
19427
|
deps: facade.deps?.map(convertR3DeclareDependencyMetadata),
|
|
19337
19428
|
},
|
|
19338
19429
|
/* resolveForwardRefs */ true);
|
|
@@ -19399,7 +19490,8 @@ class CompilerFacadeImpl {
|
|
|
19399
19490
|
...convertDirectiveFacadeToMetadata(facade),
|
|
19400
19491
|
selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(),
|
|
19401
19492
|
template,
|
|
19402
|
-
|
|
19493
|
+
declarations: facade.declarations.map(convertDeclarationFacadeToMetadata),
|
|
19494
|
+
declarationListEmitMode: 0 /* DeclarationListEmitMode.Direct */,
|
|
19403
19495
|
styles: [...facade.styles, ...template.styles],
|
|
19404
19496
|
encapsulation: facade.encapsulation,
|
|
19405
19497
|
interpolation,
|
|
@@ -19471,10 +19563,6 @@ class CompilerFacadeImpl {
|
|
|
19471
19563
|
return res['$def'];
|
|
19472
19564
|
}
|
|
19473
19565
|
}
|
|
19474
|
-
const USE_CLASS = Object.keys({ useClass: null })[0];
|
|
19475
|
-
const USE_FACTORY = Object.keys({ useFactory: null })[0];
|
|
19476
|
-
const USE_VALUE = Object.keys({ useValue: null })[0];
|
|
19477
|
-
const USE_EXISTING = Object.keys({ useExisting: null })[0];
|
|
19478
19566
|
function convertToR3QueryMetadata(facade) {
|
|
19479
19567
|
return {
|
|
19480
19568
|
...facade,
|
|
@@ -19500,7 +19588,7 @@ function convertQueryPredicate(predicate) {
|
|
|
19500
19588
|
// The predicate is an array of strings so pass it through.
|
|
19501
19589
|
predicate :
|
|
19502
19590
|
// The predicate is a type - assume that we will need to unwrap any `forwardRef()` calls.
|
|
19503
|
-
createMayBeForwardRefExpression(new WrappedNodeExpr(predicate), 1 /* Wrapped */);
|
|
19591
|
+
createMayBeForwardRefExpression(new WrappedNodeExpr(predicate), 1 /* ForwardRefHandling.Wrapped */);
|
|
19504
19592
|
}
|
|
19505
19593
|
function convertDirectiveFacadeToMetadata(facade) {
|
|
19506
19594
|
const inputsFromMetadata = parseInputOutputs(facade.inputs || []);
|
|
@@ -19578,31 +19666,57 @@ function convertOpaqueValuesToExpressions(obj) {
|
|
|
19578
19666
|
}
|
|
19579
19667
|
return result;
|
|
19580
19668
|
}
|
|
19581
|
-
function convertDeclareComponentFacadeToMetadata(
|
|
19582
|
-
const { template, interpolation } = parseJitTemplate(
|
|
19669
|
+
function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
|
|
19670
|
+
const { template, interpolation } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, decl.preserveWhitespaces ?? false, decl.interpolation);
|
|
19671
|
+
const declarations = [];
|
|
19672
|
+
if (decl.dependencies) {
|
|
19673
|
+
for (const innerDep of decl.dependencies) {
|
|
19674
|
+
switch (innerDep.kind) {
|
|
19675
|
+
case 'directive':
|
|
19676
|
+
case 'component':
|
|
19677
|
+
declarations.push(convertDirectiveDeclarationToMetadata(innerDep));
|
|
19678
|
+
break;
|
|
19679
|
+
case 'pipe':
|
|
19680
|
+
declarations.push(convertPipeDeclarationToMetadata(innerDep));
|
|
19681
|
+
break;
|
|
19682
|
+
}
|
|
19683
|
+
}
|
|
19684
|
+
}
|
|
19685
|
+
else if (decl.components || decl.directives || decl.pipes) {
|
|
19686
|
+
// Existing declarations on NPM may not be using the new `dependencies` merged field, and may
|
|
19687
|
+
// have separate fields for dependencies instead. Unify them for JIT compilation.
|
|
19688
|
+
decl.components &&
|
|
19689
|
+
declarations.push(...decl.components.map(dir => convertDirectiveDeclarationToMetadata(dir, /* isComponent */ true)));
|
|
19690
|
+
decl.directives &&
|
|
19691
|
+
declarations.push(...decl.directives.map(dir => convertDirectiveDeclarationToMetadata(dir)));
|
|
19692
|
+
decl.pipes && declarations.push(...convertPipeMapToMetadata(decl.pipes));
|
|
19693
|
+
}
|
|
19583
19694
|
return {
|
|
19584
|
-
...convertDeclareDirectiveFacadeToMetadata(
|
|
19695
|
+
...convertDeclareDirectiveFacadeToMetadata(decl, typeSourceSpan),
|
|
19585
19696
|
template,
|
|
19586
|
-
styles:
|
|
19587
|
-
|
|
19588
|
-
|
|
19589
|
-
.map(convertUsedDirectiveDeclarationToMetadata),
|
|
19590
|
-
pipes: convertUsedPipesToMetadata(declaration.pipes),
|
|
19591
|
-
viewProviders: declaration.viewProviders !== undefined ?
|
|
19592
|
-
new WrappedNodeExpr(declaration.viewProviders) :
|
|
19593
|
-
null,
|
|
19594
|
-
animations: declaration.animations !== undefined ? new WrappedNodeExpr(declaration.animations) :
|
|
19697
|
+
styles: decl.styles ?? [],
|
|
19698
|
+
declarations,
|
|
19699
|
+
viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) :
|
|
19595
19700
|
null,
|
|
19596
|
-
|
|
19597
|
-
|
|
19701
|
+
animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null,
|
|
19702
|
+
changeDetection: decl.changeDetection ?? ChangeDetectionStrategy.Default,
|
|
19703
|
+
encapsulation: decl.encapsulation ?? ViewEncapsulation.Emulated,
|
|
19598
19704
|
interpolation,
|
|
19599
|
-
declarationListEmitMode: 2 /* ClosureResolved */,
|
|
19705
|
+
declarationListEmitMode: 2 /* DeclarationListEmitMode.ClosureResolved */,
|
|
19600
19706
|
relativeContextFilePath: '',
|
|
19601
19707
|
i18nUseExternalIds: true,
|
|
19602
19708
|
};
|
|
19603
19709
|
}
|
|
19604
|
-
function
|
|
19710
|
+
function convertDeclarationFacadeToMetadata(declaration) {
|
|
19605
19711
|
return {
|
|
19712
|
+
...declaration,
|
|
19713
|
+
type: new WrappedNodeExpr(declaration.type),
|
|
19714
|
+
};
|
|
19715
|
+
}
|
|
19716
|
+
function convertDirectiveDeclarationToMetadata(declaration, isComponent = null) {
|
|
19717
|
+
return {
|
|
19718
|
+
kind: R3TemplateDependencyKind.Directive,
|
|
19719
|
+
isComponent: isComponent || declaration.kind === 'component',
|
|
19606
19720
|
selector: declaration.selector,
|
|
19607
19721
|
type: new WrappedNodeExpr(declaration.type),
|
|
19608
19722
|
inputs: declaration.inputs ?? [],
|
|
@@ -19610,16 +19724,24 @@ function convertUsedDirectiveDeclarationToMetadata(declaration) {
|
|
|
19610
19724
|
exportAs: declaration.exportAs ?? null,
|
|
19611
19725
|
};
|
|
19612
19726
|
}
|
|
19613
|
-
function
|
|
19614
|
-
|
|
19615
|
-
|
|
19616
|
-
return pipes;
|
|
19617
|
-
}
|
|
19618
|
-
for (const pipeName of Object.keys(declaredPipes)) {
|
|
19619
|
-
const pipeType = declaredPipes[pipeName];
|
|
19620
|
-
pipes.set(pipeName, new WrappedNodeExpr(pipeType));
|
|
19727
|
+
function convertPipeMapToMetadata(pipes) {
|
|
19728
|
+
if (!pipes) {
|
|
19729
|
+
return [];
|
|
19621
19730
|
}
|
|
19622
|
-
return pipes
|
|
19731
|
+
return Object.keys(pipes).map(name => {
|
|
19732
|
+
return {
|
|
19733
|
+
kind: R3TemplateDependencyKind.Pipe,
|
|
19734
|
+
name,
|
|
19735
|
+
type: new WrappedNodeExpr(pipes[name]),
|
|
19736
|
+
};
|
|
19737
|
+
});
|
|
19738
|
+
}
|
|
19739
|
+
function convertPipeDeclarationToMetadata(pipe) {
|
|
19740
|
+
return {
|
|
19741
|
+
kind: R3TemplateDependencyKind.Pipe,
|
|
19742
|
+
name: pipe.name,
|
|
19743
|
+
type: new WrappedNodeExpr(pipe.type),
|
|
19744
|
+
};
|
|
19623
19745
|
}
|
|
19624
19746
|
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
|
|
19625
19747
|
const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
|
|
@@ -19641,7 +19763,7 @@ function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces,
|
|
|
19641
19763
|
*/
|
|
19642
19764
|
function convertToProviderExpression(obj, property) {
|
|
19643
19765
|
if (obj.hasOwnProperty(property)) {
|
|
19644
|
-
return createMayBeForwardRefExpression(new WrappedNodeExpr(obj[property]), 0 /* None */);
|
|
19766
|
+
return createMayBeForwardRefExpression(new WrappedNodeExpr(obj[property]), 0 /* ForwardRefHandling.None */);
|
|
19645
19767
|
}
|
|
19646
19768
|
else {
|
|
19647
19769
|
return undefined;
|
|
@@ -19659,7 +19781,7 @@ function computeProvidedIn(providedIn) {
|
|
|
19659
19781
|
const expression = typeof providedIn === 'function' ? new WrappedNodeExpr(providedIn) :
|
|
19660
19782
|
new LiteralExpr(providedIn ?? null);
|
|
19661
19783
|
// See `convertToProviderExpression()` for why this uses `ForwardRefHandling.None`.
|
|
19662
|
-
return createMayBeForwardRefExpression(expression, 0 /* None */);
|
|
19784
|
+
return createMayBeForwardRefExpression(expression, 0 /* ForwardRefHandling.None */);
|
|
19663
19785
|
}
|
|
19664
19786
|
function convertR3DependencyMetadataArray(facades) {
|
|
19665
19787
|
return facades == null ? null : facades.map(convertR3DependencyMetadata);
|
|
@@ -19766,7 +19888,7 @@ function publishFacade(global) {
|
|
|
19766
19888
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19767
19889
|
* found in the LICENSE file at https://angular.io/license
|
|
19768
19890
|
*/
|
|
19769
|
-
const VERSION = new Version('14.0.0-
|
|
19891
|
+
const VERSION = new Version('14.0.0-rc.0');
|
|
19770
19892
|
|
|
19771
19893
|
/**
|
|
19772
19894
|
* @license
|
|
@@ -21263,14 +21385,6 @@ var FactoryTarget;
|
|
|
21263
21385
|
* found in the LICENSE file at https://angular.io/license
|
|
21264
21386
|
*/
|
|
21265
21387
|
|
|
21266
|
-
/**
|
|
21267
|
-
* @license
|
|
21268
|
-
* Copyright Google LLC All Rights Reserved.
|
|
21269
|
-
*
|
|
21270
|
-
* Use of this source code is governed by an MIT-style license that can be
|
|
21271
|
-
* found in the LICENSE file at https://angular.io/license
|
|
21272
|
-
*/
|
|
21273
|
-
|
|
21274
21388
|
/**
|
|
21275
21389
|
* @license
|
|
21276
21390
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -21807,7 +21921,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21807
21921
|
function compileDeclareClassMetadata(metadata) {
|
|
21808
21922
|
const definitionMap = new DefinitionMap();
|
|
21809
21923
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21810
|
-
definitionMap.set('version', literal('14.0.0-
|
|
21924
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
21811
21925
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21812
21926
|
definitionMap.set('type', metadata.type);
|
|
21813
21927
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -21907,7 +22021,7 @@ function compileDependency(dep) {
|
|
|
21907
22021
|
*
|
|
21908
22022
|
* Do not include any prerelease in these versions as they are ignored.
|
|
21909
22023
|
*/
|
|
21910
|
-
const MINIMUM_PARTIAL_LINKER_VERSION$5 = '
|
|
22024
|
+
const MINIMUM_PARTIAL_LINKER_VERSION$5 = '14.0.0';
|
|
21911
22025
|
/**
|
|
21912
22026
|
* Compile a directive declaration defined by the `R3DirectiveMetadata`.
|
|
21913
22027
|
*/
|
|
@@ -21924,9 +22038,12 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
21924
22038
|
function createDirectiveDefinitionMap(meta) {
|
|
21925
22039
|
const definitionMap = new DefinitionMap();
|
|
21926
22040
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
21927
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22041
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
21928
22042
|
// e.g. `type: MyDirective`
|
|
21929
22043
|
definitionMap.set('type', meta.internalType);
|
|
22044
|
+
if (meta.isStandalone) {
|
|
22045
|
+
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
22046
|
+
}
|
|
21930
22047
|
// e.g. `selector: 'some-dir'`
|
|
21931
22048
|
if (meta.selector !== null) {
|
|
21932
22049
|
definitionMap.set('selector', literal(meta.selector));
|
|
@@ -22031,9 +22148,7 @@ function createComponentDefinitionMap(meta, template, templateInfo) {
|
|
|
22031
22148
|
definitionMap.set('isInline', literal(true));
|
|
22032
22149
|
}
|
|
22033
22150
|
definitionMap.set('styles', toOptionalLiteralArray(meta.styles, literal));
|
|
22034
|
-
definitionMap.set('
|
|
22035
|
-
definitionMap.set('directives', compileUsedDirectiveMetadata(meta, directive => directive.isComponent !== true));
|
|
22036
|
-
definitionMap.set('pipes', compileUsedPipeMetadata(meta));
|
|
22151
|
+
definitionMap.set('dependencies', compileUsedDependenciesMetadata(meta));
|
|
22037
22152
|
definitionMap.set('viewProviders', meta.viewProviders);
|
|
22038
22153
|
definitionMap.set('animations', meta.animations);
|
|
22039
22154
|
if (meta.changeDetection !== undefined) {
|
|
@@ -22089,43 +22204,35 @@ function computeEndLocation(file, contents) {
|
|
|
22089
22204
|
} while (lineStart !== -1);
|
|
22090
22205
|
return new ParseLocation(file, length, line, length - lastLineStart);
|
|
22091
22206
|
}
|
|
22092
|
-
|
|
22093
|
-
|
|
22094
|
-
* individual directives. If the component does not use any directives, then null is returned.
|
|
22095
|
-
*/
|
|
22096
|
-
function compileUsedDirectiveMetadata(meta, predicate) {
|
|
22097
|
-
const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
|
22207
|
+
function compileUsedDependenciesMetadata(meta) {
|
|
22208
|
+
const wrapType = meta.declarationListEmitMode !== 0 /* DeclarationListEmitMode.Direct */ ?
|
|
22098
22209
|
generateForwardRef :
|
|
22099
22210
|
(expr) => expr;
|
|
22100
|
-
|
|
22101
|
-
|
|
22102
|
-
|
|
22103
|
-
|
|
22104
|
-
|
|
22105
|
-
|
|
22106
|
-
|
|
22107
|
-
|
|
22108
|
-
|
|
22211
|
+
return toOptionalLiteralArray(meta.declarations, decl => {
|
|
22212
|
+
switch (decl.kind) {
|
|
22213
|
+
case R3TemplateDependencyKind.Directive:
|
|
22214
|
+
const dirMeta = new DefinitionMap();
|
|
22215
|
+
dirMeta.set('kind', literal(decl.isComponent ? 'component' : 'directive'));
|
|
22216
|
+
dirMeta.set('type', wrapType(decl.type));
|
|
22217
|
+
dirMeta.set('selector', literal(decl.selector));
|
|
22218
|
+
dirMeta.set('inputs', toOptionalLiteralArray(decl.inputs, literal));
|
|
22219
|
+
dirMeta.set('outputs', toOptionalLiteralArray(decl.outputs, literal));
|
|
22220
|
+
dirMeta.set('exportAs', toOptionalLiteralArray(decl.exportAs, literal));
|
|
22221
|
+
return dirMeta.toLiteralMap();
|
|
22222
|
+
case R3TemplateDependencyKind.Pipe:
|
|
22223
|
+
const pipeMeta = new DefinitionMap();
|
|
22224
|
+
pipeMeta.set('kind', literal('pipe'));
|
|
22225
|
+
pipeMeta.set('type', wrapType(decl.type));
|
|
22226
|
+
pipeMeta.set('name', literal(decl.name));
|
|
22227
|
+
return pipeMeta.toLiteralMap();
|
|
22228
|
+
case R3TemplateDependencyKind.NgModule:
|
|
22229
|
+
const ngModuleMeta = new DefinitionMap();
|
|
22230
|
+
ngModuleMeta.set('kind', literal('ngmodule'));
|
|
22231
|
+
ngModuleMeta.set('type', wrapType(decl.type));
|
|
22232
|
+
return ngModuleMeta.toLiteralMap();
|
|
22233
|
+
}
|
|
22109
22234
|
});
|
|
22110
22235
|
}
|
|
22111
|
-
/**
|
|
22112
|
-
* Compiles the pipes as registered in the component metadata into an object literal, where the
|
|
22113
|
-
* pipe's name is used as key and a reference to its type as value. If the component does not use
|
|
22114
|
-
* any pipes, then null is returned.
|
|
22115
|
-
*/
|
|
22116
|
-
function compileUsedPipeMetadata(meta) {
|
|
22117
|
-
if (meta.pipes.size === 0) {
|
|
22118
|
-
return null;
|
|
22119
|
-
}
|
|
22120
|
-
const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
|
22121
|
-
generateForwardRef :
|
|
22122
|
-
(expr) => expr;
|
|
22123
|
-
const entries = [];
|
|
22124
|
-
for (const [name, pipe] of meta.pipes) {
|
|
22125
|
-
entries.push({ key: name, value: wrapType(pipe), quoted: true });
|
|
22126
|
-
}
|
|
22127
|
-
return literalMap(entries);
|
|
22128
|
-
}
|
|
22129
22236
|
|
|
22130
22237
|
/**
|
|
22131
22238
|
* @license
|
|
@@ -22145,7 +22252,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22145
22252
|
function compileDeclareFactoryFunction(meta) {
|
|
22146
22253
|
const definitionMap = new DefinitionMap();
|
|
22147
22254
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22148
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22255
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
22149
22256
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22150
22257
|
definitionMap.set('type', meta.internalType);
|
|
22151
22258
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22187,7 +22294,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22187
22294
|
function createInjectableDefinitionMap(meta) {
|
|
22188
22295
|
const definitionMap = new DefinitionMap();
|
|
22189
22296
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22190
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22297
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
22191
22298
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22192
22299
|
definitionMap.set('type', meta.internalType);
|
|
22193
22300
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22245,7 +22352,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22245
22352
|
function createInjectorDefinitionMap(meta) {
|
|
22246
22353
|
const definitionMap = new DefinitionMap();
|
|
22247
22354
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22248
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22355
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
22249
22356
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22250
22357
|
definitionMap.set('type', meta.internalType);
|
|
22251
22358
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22269,7 +22376,7 @@ function createInjectorDefinitionMap(meta) {
|
|
|
22269
22376
|
*
|
|
22270
22377
|
* Do not include any prerelease in these versions as they are ignored.
|
|
22271
22378
|
*/
|
|
22272
|
-
const MINIMUM_PARTIAL_LINKER_VERSION$1 = '
|
|
22379
|
+
const MINIMUM_PARTIAL_LINKER_VERSION$1 = '14.0.0';
|
|
22273
22380
|
function compileDeclareNgModuleFromMetadata(meta) {
|
|
22274
22381
|
const definitionMap = createNgModuleDefinitionMap(meta);
|
|
22275
22382
|
const expression = importExpr(Identifiers.declareNgModule).callFn([definitionMap.toLiteralMap()]);
|
|
@@ -22282,7 +22389,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22282
22389
|
function createNgModuleDefinitionMap(meta) {
|
|
22283
22390
|
const definitionMap = new DefinitionMap();
|
|
22284
22391
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22285
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22392
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
22286
22393
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22287
22394
|
definitionMap.set('type', meta.internalType);
|
|
22288
22395
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22324,7 +22431,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
22324
22431
|
*
|
|
22325
22432
|
* Do not include any prerelease in these versions as they are ignored.
|
|
22326
22433
|
*/
|
|
22327
|
-
const MINIMUM_PARTIAL_LINKER_VERSION = '
|
|
22434
|
+
const MINIMUM_PARTIAL_LINKER_VERSION = '14.0.0';
|
|
22328
22435
|
/**
|
|
22329
22436
|
* Compile a Pipe declaration defined by the `R3PipeMetadata`.
|
|
22330
22437
|
*/
|
|
@@ -22340,10 +22447,13 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22340
22447
|
function createPipeDefinitionMap(meta) {
|
|
22341
22448
|
const definitionMap = new DefinitionMap();
|
|
22342
22449
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22343
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22450
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
22344
22451
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22345
22452
|
// e.g. `type: MyPipe`
|
|
22346
22453
|
definitionMap.set('type', meta.internalType);
|
|
22454
|
+
if (meta.isStandalone) {
|
|
22455
|
+
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
22456
|
+
}
|
|
22347
22457
|
// e.g. `name: "myPipe"`
|
|
22348
22458
|
definitionMap.set('name', literal(meta.pipeName));
|
|
22349
22459
|
if (meta.pure === false) {
|
|
@@ -22390,5 +22500,5 @@ publishFacade(_global);
|
|
|
22390
22500
|
* found in the LICENSE file at https://angular.io/license
|
|
22391
22501
|
*/
|
|
22392
22502
|
|
|
22393
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3SelectorScopeMode, R3TargetBinder, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BoundAttribute as TmplAstBoundAttribute, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, Element$1 as TmplAstElement, Icu$1 as TmplAstIcu, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, Variable as TmplAstVariable, Token, TokenType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
|
|
22503
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BoundAttribute as TmplAstBoundAttribute, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, Element$1 as TmplAstElement, Icu$1 as TmplAstIcu, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, Variable as TmplAstVariable, Token, TokenType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
|
|
22394
22504
|
//# sourceMappingURL=compiler.mjs.map
|