@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/fesm2015/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++) {
|
|
@@ -2924,6 +2924,7 @@ Identifiers.contentQuery = { name: 'ɵɵcontentQuery', moduleName: CORE };
|
|
|
2924
2924
|
Identifiers.NgOnChangesFeature = { name: 'ɵɵNgOnChangesFeature', moduleName: CORE };
|
|
2925
2925
|
Identifiers.InheritDefinitionFeature = { name: 'ɵɵInheritDefinitionFeature', moduleName: CORE };
|
|
2926
2926
|
Identifiers.CopyDefinitionFeature = { name: 'ɵɵCopyDefinitionFeature', moduleName: CORE };
|
|
2927
|
+
Identifiers.StandaloneFeature = { name: 'ɵɵStandaloneFeature', moduleName: CORE };
|
|
2927
2928
|
Identifiers.ProvidersFeature = { name: 'ɵɵProvidersFeature', moduleName: CORE };
|
|
2928
2929
|
Identifiers.listener = { name: 'ɵɵlistener', moduleName: CORE };
|
|
2929
2930
|
Identifiers.getInheritedFactory = {
|
|
@@ -3665,10 +3666,10 @@ function createMayBeForwardRefExpression(expression, forwardRef) {
|
|
|
3665
3666
|
*/
|
|
3666
3667
|
function convertFromMaybeForwardRefExpression({ expression, forwardRef }) {
|
|
3667
3668
|
switch (forwardRef) {
|
|
3668
|
-
case 0 /* None */:
|
|
3669
|
-
case 1 /* Wrapped */:
|
|
3669
|
+
case 0 /* ForwardRefHandling.None */:
|
|
3670
|
+
case 1 /* ForwardRefHandling.Wrapped */:
|
|
3670
3671
|
return expression;
|
|
3671
|
-
case 2 /* Unwrapped */:
|
|
3672
|
+
case 2 /* ForwardRefHandling.Unwrapped */:
|
|
3672
3673
|
return generateForwardRef(expression);
|
|
3673
3674
|
}
|
|
3674
3675
|
}
|
|
@@ -3792,14 +3793,14 @@ function compileInjectDependency(dep, target, index) {
|
|
|
3792
3793
|
}
|
|
3793
3794
|
else if (dep.attributeNameType === null) {
|
|
3794
3795
|
// Build up the injection flags according to the metadata.
|
|
3795
|
-
const flags = 0 /* Default */ | (dep.self ? 2 /* Self */ : 0) |
|
|
3796
|
-
(dep.skipSelf ? 4 /* SkipSelf */ : 0) | (dep.host ? 1 /* Host */ : 0) |
|
|
3797
|
-
(dep.optional ? 8 /* Optional */ : 0) |
|
|
3798
|
-
(target === FactoryTarget$1.Pipe ? 16 /* ForPipe */ : 0);
|
|
3796
|
+
const flags = 0 /* InjectFlags.Default */ | (dep.self ? 2 /* InjectFlags.Self */ : 0) |
|
|
3797
|
+
(dep.skipSelf ? 4 /* InjectFlags.SkipSelf */ : 0) | (dep.host ? 1 /* InjectFlags.Host */ : 0) |
|
|
3798
|
+
(dep.optional ? 8 /* InjectFlags.Optional */ : 0) |
|
|
3799
|
+
(target === FactoryTarget$1.Pipe ? 16 /* InjectFlags.ForPipe */ : 0);
|
|
3799
3800
|
// If this dependency is optional or otherwise has non-default flags, then additional
|
|
3800
3801
|
// parameters describing how to inject the dependency must be passed to the inject function
|
|
3801
3802
|
// that's being used.
|
|
3802
|
-
let flagsParam = (flags !== 0 /* Default */ || dep.optional) ? literal(flags) : null;
|
|
3803
|
+
let flagsParam = (flags !== 0 /* InjectFlags.Default */ || dep.optional) ? literal(flags) : null;
|
|
3803
3804
|
// Build up the arguments to the injectFn call.
|
|
3804
3805
|
const injectArgs = [dep.token];
|
|
3805
3806
|
if (flagsParam) {
|
|
@@ -3970,8 +3971,8 @@ class BoundEvent {
|
|
|
3970
3971
|
this.keySpan = keySpan;
|
|
3971
3972
|
}
|
|
3972
3973
|
static fromParsedEvent(event) {
|
|
3973
|
-
const target = event.type === 0 /* Regular */ ? event.targetOrPhase : null;
|
|
3974
|
-
const phase = event.type === 1 /* Animation */ ? event.targetOrPhase : null;
|
|
3974
|
+
const target = event.type === 0 /* ParsedEventType.Regular */ ? event.targetOrPhase : null;
|
|
3975
|
+
const phase = event.type === 1 /* ParsedEventType.Animation */ ? event.targetOrPhase : null;
|
|
3975
3976
|
if (event.keySpan === undefined) {
|
|
3976
3977
|
throw new Error(`Unexpected state: keySpan must be defined for bound event but was not for ${event.name}: ${event.sourceSpan}`);
|
|
3977
3978
|
}
|
|
@@ -4795,7 +4796,7 @@ function assembleBoundTextPlaceholders(meta, bindingStartIndex = 0, contextId =
|
|
|
4795
4796
|
* @param useCamelCase whether to camelCase the placeholder name when formatting.
|
|
4796
4797
|
* @returns A new map of formatted placeholder names to expressions.
|
|
4797
4798
|
*/
|
|
4798
|
-
function
|
|
4799
|
+
function formatI18nPlaceholderNamesInMap(params = {}, useCamelCase) {
|
|
4799
4800
|
const _params = {};
|
|
4800
4801
|
if (params && Object.keys(params).length) {
|
|
4801
4802
|
Object.keys(params).forEach(key => _params[formatI18nPlaceholderName(key, useCamelCase)] = params[key]);
|
|
@@ -4878,6 +4879,12 @@ const IMPLICIT_REFERENCE = '$implicit';
|
|
|
4878
4879
|
const NON_BINDABLE_ATTR = 'ngNonBindable';
|
|
4879
4880
|
/** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
|
|
4880
4881
|
const RESTORED_VIEW_CONTEXT_NAME = 'restoredCtx';
|
|
4882
|
+
/**
|
|
4883
|
+
* Maximum length of a single instruction chain. Because our output AST uses recursion, we're
|
|
4884
|
+
* limited in how many expressions we can nest before we reach the call stack limit. This
|
|
4885
|
+
* length is set very conservatively in order to reduce the chance of problems.
|
|
4886
|
+
*/
|
|
4887
|
+
const MAX_CHAIN_LENGTH = 500;
|
|
4881
4888
|
/** Instructions that support chaining. */
|
|
4882
4889
|
const CHAINABLE_INSTRUCTIONS = new Set([
|
|
4883
4890
|
Identifiers.element,
|
|
@@ -5023,10 +5030,10 @@ function getQueryPredicate(query, constantPool) {
|
|
|
5023
5030
|
else {
|
|
5024
5031
|
// The original predicate may have been wrapped in a `forwardRef()` call.
|
|
5025
5032
|
switch (query.predicate.forwardRef) {
|
|
5026
|
-
case 0 /* None */:
|
|
5027
|
-
case 2 /* Unwrapped */:
|
|
5033
|
+
case 0 /* ForwardRefHandling.None */:
|
|
5034
|
+
case 2 /* ForwardRefHandling.Unwrapped */:
|
|
5028
5035
|
return query.predicate.expression;
|
|
5029
|
-
case 1 /* Wrapped */:
|
|
5036
|
+
case 1 /* ForwardRefHandling.Wrapped */:
|
|
5030
5037
|
return importExpr(Identifiers.resolveForwardRef).callFn([query.predicate.expression]);
|
|
5031
5038
|
}
|
|
5032
5039
|
}
|
|
@@ -5104,15 +5111,17 @@ function getInstructionStatements(instructions) {
|
|
|
5104
5111
|
const statements = [];
|
|
5105
5112
|
let pendingExpression = null;
|
|
5106
5113
|
let pendingExpressionType = null;
|
|
5114
|
+
let chainLength = 0;
|
|
5107
5115
|
for (const current of instructions) {
|
|
5108
5116
|
const resolvedParams = (_a = (typeof current.paramsOrFn === 'function' ? current.paramsOrFn() : current.paramsOrFn)) !== null && _a !== void 0 ? _a : [];
|
|
5109
5117
|
const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];
|
|
5110
5118
|
// If the current instruction is the same as the previous one
|
|
5111
5119
|
// and it can be chained, add another call to the chain.
|
|
5112
|
-
if (pendingExpressionType === current.reference &&
|
|
5120
|
+
if (chainLength < MAX_CHAIN_LENGTH && pendingExpressionType === current.reference &&
|
|
5113
5121
|
CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {
|
|
5114
5122
|
// We'll always have a pending expression when there's a pending expression type.
|
|
5115
5123
|
pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);
|
|
5124
|
+
chainLength++;
|
|
5116
5125
|
}
|
|
5117
5126
|
else {
|
|
5118
5127
|
if (pendingExpression !== null) {
|
|
@@ -5120,6 +5129,7 @@ function getInstructionStatements(instructions) {
|
|
|
5120
5129
|
}
|
|
5121
5130
|
pendingExpression = invokeInstruction(current.span, current.reference, params);
|
|
5122
5131
|
pendingExpressionType = current.reference;
|
|
5132
|
+
chainLength = 0;
|
|
5123
5133
|
}
|
|
5124
5134
|
}
|
|
5125
5135
|
// Since the current instruction adds the previous one to the statements,
|
|
@@ -6142,6 +6152,9 @@ function compilePipeFromMetadata(metadata) {
|
|
|
6142
6152
|
definitionMapValues.push({ key: 'type', value: metadata.type.value, quoted: false });
|
|
6143
6153
|
// e.g. `pure: true`
|
|
6144
6154
|
definitionMapValues.push({ key: 'pure', value: literal(metadata.pure), quoted: false });
|
|
6155
|
+
if (metadata.isStandalone) {
|
|
6156
|
+
definitionMapValues.push({ key: 'standalone', value: literal(true), quoted: false });
|
|
6157
|
+
}
|
|
6145
6158
|
const expression = importExpr(Identifiers.definePipe).callFn([literalMap(definitionMapValues)], undefined, true);
|
|
6146
6159
|
const type = createPipeType(metadata);
|
|
6147
6160
|
return { expression, type, statements: [] };
|
|
@@ -6150,9 +6163,24 @@ function createPipeType(metadata) {
|
|
|
6150
6163
|
return new ExpressionType(importExpr(Identifiers.PipeDeclaration, [
|
|
6151
6164
|
typeWithParameters(metadata.type.type, metadata.typeArgumentCount),
|
|
6152
6165
|
new ExpressionType(new LiteralExpr(metadata.pipeName)),
|
|
6166
|
+
new ExpressionType(new LiteralExpr(metadata.isStandalone)),
|
|
6153
6167
|
]));
|
|
6154
6168
|
}
|
|
6155
6169
|
|
|
6170
|
+
/**
|
|
6171
|
+
* @license
|
|
6172
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6173
|
+
*
|
|
6174
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6175
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6176
|
+
*/
|
|
6177
|
+
var R3TemplateDependencyKind;
|
|
6178
|
+
(function (R3TemplateDependencyKind) {
|
|
6179
|
+
R3TemplateDependencyKind[R3TemplateDependencyKind["Directive"] = 0] = "Directive";
|
|
6180
|
+
R3TemplateDependencyKind[R3TemplateDependencyKind["Pipe"] = 1] = "Pipe";
|
|
6181
|
+
R3TemplateDependencyKind[R3TemplateDependencyKind["NgModule"] = 2] = "NgModule";
|
|
6182
|
+
})(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
|
|
6183
|
+
|
|
6156
6184
|
/**
|
|
6157
6185
|
* @license
|
|
6158
6186
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -8405,7 +8433,7 @@ function parse(value) {
|
|
|
8405
8433
|
const styles = [];
|
|
8406
8434
|
let i = 0;
|
|
8407
8435
|
let parenDepth = 0;
|
|
8408
|
-
let quote = 0 /* QuoteNone */;
|
|
8436
|
+
let quote = 0 /* Char.QuoteNone */;
|
|
8409
8437
|
let valueStart = 0;
|
|
8410
8438
|
let propStart = 0;
|
|
8411
8439
|
let currentProp = null;
|
|
@@ -8413,41 +8441,41 @@ function parse(value) {
|
|
|
8413
8441
|
while (i < value.length) {
|
|
8414
8442
|
const token = value.charCodeAt(i++);
|
|
8415
8443
|
switch (token) {
|
|
8416
|
-
case 40 /* OpenParen */:
|
|
8444
|
+
case 40 /* Char.OpenParen */:
|
|
8417
8445
|
parenDepth++;
|
|
8418
8446
|
break;
|
|
8419
|
-
case 41 /* CloseParen */:
|
|
8447
|
+
case 41 /* Char.CloseParen */:
|
|
8420
8448
|
parenDepth--;
|
|
8421
8449
|
break;
|
|
8422
|
-
case 39 /* QuoteSingle */:
|
|
8450
|
+
case 39 /* Char.QuoteSingle */:
|
|
8423
8451
|
// valueStart needs to be there since prop values don't
|
|
8424
8452
|
// have quotes in CSS
|
|
8425
8453
|
valueHasQuotes = valueHasQuotes || valueStart > 0;
|
|
8426
|
-
if (quote === 0 /* QuoteNone */) {
|
|
8427
|
-
quote = 39 /* QuoteSingle */;
|
|
8454
|
+
if (quote === 0 /* Char.QuoteNone */) {
|
|
8455
|
+
quote = 39 /* Char.QuoteSingle */;
|
|
8428
8456
|
}
|
|
8429
|
-
else if (quote === 39 /* QuoteSingle */ && value.charCodeAt(i - 1) !== 92 /* BackSlash */) {
|
|
8430
|
-
quote = 0 /* QuoteNone */;
|
|
8457
|
+
else if (quote === 39 /* Char.QuoteSingle */ && value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */) {
|
|
8458
|
+
quote = 0 /* Char.QuoteNone */;
|
|
8431
8459
|
}
|
|
8432
8460
|
break;
|
|
8433
|
-
case 34 /* QuoteDouble */:
|
|
8461
|
+
case 34 /* Char.QuoteDouble */:
|
|
8434
8462
|
// same logic as above
|
|
8435
8463
|
valueHasQuotes = valueHasQuotes || valueStart > 0;
|
|
8436
|
-
if (quote === 0 /* QuoteNone */) {
|
|
8437
|
-
quote = 34 /* QuoteDouble */;
|
|
8464
|
+
if (quote === 0 /* Char.QuoteNone */) {
|
|
8465
|
+
quote = 34 /* Char.QuoteDouble */;
|
|
8438
8466
|
}
|
|
8439
|
-
else if (quote === 34 /* QuoteDouble */ && value.charCodeAt(i - 1) !== 92 /* BackSlash */) {
|
|
8440
|
-
quote = 0 /* QuoteNone */;
|
|
8467
|
+
else if (quote === 34 /* Char.QuoteDouble */ && value.charCodeAt(i - 1) !== 92 /* Char.BackSlash */) {
|
|
8468
|
+
quote = 0 /* Char.QuoteNone */;
|
|
8441
8469
|
}
|
|
8442
8470
|
break;
|
|
8443
|
-
case 58 /* Colon */:
|
|
8444
|
-
if (!currentProp && parenDepth === 0 && quote === 0 /* QuoteNone */) {
|
|
8471
|
+
case 58 /* Char.Colon */:
|
|
8472
|
+
if (!currentProp && parenDepth === 0 && quote === 0 /* Char.QuoteNone */) {
|
|
8445
8473
|
currentProp = hyphenate(value.substring(propStart, i - 1).trim());
|
|
8446
8474
|
valueStart = i;
|
|
8447
8475
|
}
|
|
8448
8476
|
break;
|
|
8449
|
-
case 59 /* Semicolon */:
|
|
8450
|
-
if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0 /* QuoteNone */) {
|
|
8477
|
+
case 59 /* Char.Semicolon */:
|
|
8478
|
+
if (currentProp && valueStart > 0 && parenDepth === 0 && quote === 0 /* Char.QuoteNone */) {
|
|
8451
8479
|
const styleVal = value.substring(valueStart, i - 1).trim();
|
|
8452
8480
|
styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
|
|
8453
8481
|
propStart = i;
|
|
@@ -8467,7 +8495,7 @@ function parse(value) {
|
|
|
8467
8495
|
function stripUnnecessaryQuotes(value) {
|
|
8468
8496
|
const qS = value.charCodeAt(0);
|
|
8469
8497
|
const qE = value.charCodeAt(value.length - 1);
|
|
8470
|
-
if (qS == qE && (qS == 39 /* QuoteSingle */ || qS == 34 /* QuoteDouble */)) {
|
|
8498
|
+
if (qS == qE && (qS == 39 /* Char.QuoteSingle */ || qS == 34 /* Char.QuoteDouble */)) {
|
|
8471
8499
|
const tempValue = value.substring(1, value.length - 1);
|
|
8472
8500
|
// special case to avoid using a multi-quoted string that was just chomped
|
|
8473
8501
|
// (e.g. `font-family: "Verdana", "sans-serif"`)
|
|
@@ -8618,13 +8646,13 @@ class StylingBuilder {
|
|
|
8618
8646
|
let binding = null;
|
|
8619
8647
|
let name = input.name;
|
|
8620
8648
|
switch (input.type) {
|
|
8621
|
-
case 0 /* Property */:
|
|
8649
|
+
case 0 /* BindingType.Property */:
|
|
8622
8650
|
binding = this.registerInputBasedOnName(name, input.value, input.sourceSpan);
|
|
8623
8651
|
break;
|
|
8624
|
-
case 3 /* Style */:
|
|
8652
|
+
case 3 /* BindingType.Style */:
|
|
8625
8653
|
binding = this.registerStyleInput(name, false, input.value, input.sourceSpan, input.unit);
|
|
8626
8654
|
break;
|
|
8627
|
-
case 2 /* Class */:
|
|
8655
|
+
case 2 /* BindingType.Class */:
|
|
8628
8656
|
binding = this.registerClassInput(name, false, input.value, input.sourceSpan);
|
|
8629
8657
|
break;
|
|
8630
8658
|
}
|
|
@@ -8723,14 +8751,14 @@ class StylingBuilder {
|
|
|
8723
8751
|
populateInitialStylingAttrs(attrs) {
|
|
8724
8752
|
// [CLASS_MARKER, 'foo', 'bar', 'baz' ...]
|
|
8725
8753
|
if (this._initialClassValues.length) {
|
|
8726
|
-
attrs.push(literal(1 /* Classes */));
|
|
8754
|
+
attrs.push(literal(1 /* AttributeMarker.Classes */));
|
|
8727
8755
|
for (let i = 0; i < this._initialClassValues.length; i++) {
|
|
8728
8756
|
attrs.push(literal(this._initialClassValues[i]));
|
|
8729
8757
|
}
|
|
8730
8758
|
}
|
|
8731
8759
|
// [STYLE_MARKER, 'width', '200px', 'height', '100px', ...]
|
|
8732
8760
|
if (this._initialStyleValues.length) {
|
|
8733
|
-
attrs.push(literal(2 /* Styles */));
|
|
8761
|
+
attrs.push(literal(2 /* AttributeMarker.Styles */));
|
|
8734
8762
|
for (let i = 0; i < this._initialStyleValues.length; i += 2) {
|
|
8735
8763
|
attrs.push(literal(this._initialStyleValues[i]), literal(this._initialStyleValues[i + 1]));
|
|
8736
8764
|
}
|
|
@@ -9462,9 +9490,9 @@ class Parser$1 {
|
|
|
9462
9490
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9463
9491
|
const sourceToLex = this._stripComments(input);
|
|
9464
9492
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9465
|
-
let flags = 1 /* Action */;
|
|
9493
|
+
let flags = 1 /* ParseFlags.Action */;
|
|
9466
9494
|
if (isAssignmentEvent) {
|
|
9467
|
-
flags |= 2 /* AssignmentEvent */;
|
|
9495
|
+
flags |= 2 /* ParseFlags.AssignmentEvent */;
|
|
9468
9496
|
}
|
|
9469
9497
|
const ast = new _ParseAST(input, location, absoluteOffset, tokens, flags, this.errors, 0).parseChain();
|
|
9470
9498
|
return new ASTWithSource(ast, input, location, absoluteOffset, this.errors);
|
|
@@ -9493,7 +9521,7 @@ class Parser$1 {
|
|
|
9493
9521
|
this._checkNoInterpolation(input, location, interpolationConfig);
|
|
9494
9522
|
const sourceToLex = this._stripComments(input);
|
|
9495
9523
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9496
|
-
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9524
|
+
return new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0)
|
|
9497
9525
|
.parseChain();
|
|
9498
9526
|
}
|
|
9499
9527
|
/**
|
|
@@ -9524,7 +9552,7 @@ class Parser$1 {
|
|
|
9524
9552
|
*/
|
|
9525
9553
|
parseTemplateBindings(templateKey, templateValue, templateUrl, absoluteKeyOffset, absoluteValueOffset) {
|
|
9526
9554
|
const tokens = this._lexer.tokenize(templateValue);
|
|
9527
|
-
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* None */, this.errors, 0 /* relative offset */);
|
|
9555
|
+
const parser = new _ParseAST(templateValue, templateUrl, absoluteValueOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0 /* relative offset */);
|
|
9528
9556
|
return parser.parseTemplateBindings({
|
|
9529
9557
|
source: templateKey,
|
|
9530
9558
|
span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
|
|
@@ -9539,7 +9567,7 @@ class Parser$1 {
|
|
|
9539
9567
|
const expressionText = expressions[i].text;
|
|
9540
9568
|
const sourceToLex = this._stripComments(expressionText);
|
|
9541
9569
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9542
|
-
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* None */, this.errors, offsets[i])
|
|
9570
|
+
const ast = new _ParseAST(input, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, offsets[i])
|
|
9543
9571
|
.parseChain();
|
|
9544
9572
|
expressionNodes.push(ast);
|
|
9545
9573
|
}
|
|
@@ -9553,7 +9581,7 @@ class Parser$1 {
|
|
|
9553
9581
|
parseInterpolationExpression(expression, location, absoluteOffset) {
|
|
9554
9582
|
const sourceToLex = this._stripComments(expression);
|
|
9555
9583
|
const tokens = this._lexer.tokenize(sourceToLex);
|
|
9556
|
-
const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* None */, this.errors, 0)
|
|
9584
|
+
const ast = new _ParseAST(expression, location, absoluteOffset, tokens, 0 /* ParseFlags.None */, this.errors, 0)
|
|
9557
9585
|
.parseChain();
|
|
9558
9586
|
const strings = ['', '']; // The prefix and suffix strings are both empty
|
|
9559
9587
|
return this.createInterpolationAst(strings, [ast], expression, location, absoluteOffset);
|
|
@@ -9910,7 +9938,7 @@ class _ParseAST {
|
|
|
9910
9938
|
const expr = this.parsePipe();
|
|
9911
9939
|
exprs.push(expr);
|
|
9912
9940
|
if (this.consumeOptionalCharacter($SEMICOLON)) {
|
|
9913
|
-
if (!(this.parseFlags & 1 /* Action */)) {
|
|
9941
|
+
if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
|
|
9914
9942
|
this.error('Binding expression cannot contain chained expression');
|
|
9915
9943
|
}
|
|
9916
9944
|
while (this.consumeOptionalCharacter($SEMICOLON)) {
|
|
@@ -9934,7 +9962,7 @@ class _ParseAST {
|
|
|
9934
9962
|
const start = this.inputIndex;
|
|
9935
9963
|
let result = this.parseExpression();
|
|
9936
9964
|
if (this.consumeOptionalOperator('|')) {
|
|
9937
|
-
if (this.parseFlags & 1 /* Action */) {
|
|
9965
|
+
if (this.parseFlags & 1 /* ParseFlags.Action */) {
|
|
9938
9966
|
this.error('Cannot have a pipe in an action expression');
|
|
9939
9967
|
}
|
|
9940
9968
|
do {
|
|
@@ -10287,7 +10315,7 @@ class _ParseAST {
|
|
|
10287
10315
|
}
|
|
10288
10316
|
else {
|
|
10289
10317
|
if (this.consumeOptionalAssignment()) {
|
|
10290
|
-
if (!(this.parseFlags & 1 /* Action */)) {
|
|
10318
|
+
if (!(this.parseFlags & 1 /* ParseFlags.Action */)) {
|
|
10291
10319
|
this.error('Bindings cannot contain assignments');
|
|
10292
10320
|
return new EmptyExpr(this.span(start), this.sourceSpan(start));
|
|
10293
10321
|
}
|
|
@@ -10319,7 +10347,7 @@ class _ParseAST {
|
|
|
10319
10347
|
// primary expression is substituted as LHS of the assignment operator to achieve
|
|
10320
10348
|
// two-way-binding, such that the LHS could be the non-null operator. The grammar doesn't
|
|
10321
10349
|
// naturally allow for this syntax, so assignment events are parsed specially.
|
|
10322
|
-
if ((this.parseFlags & 2 /* AssignmentEvent */) && this.next.isOperator('!') &&
|
|
10350
|
+
if ((this.parseFlags & 2 /* ParseFlags.AssignmentEvent */) && this.next.isOperator('!') &&
|
|
10323
10351
|
this.peek(1).isOperator('=')) {
|
|
10324
10352
|
// First skip over the ! operator.
|
|
10325
10353
|
this.advance();
|
|
@@ -10641,7 +10669,7 @@ function getIndexMapForOriginalTemplate(interpolatedTokens) {
|
|
|
10641
10669
|
let tokenIndex = 0;
|
|
10642
10670
|
while (tokenIndex < interpolatedTokens.length) {
|
|
10643
10671
|
const currentToken = interpolatedTokens[tokenIndex];
|
|
10644
|
-
if (currentToken.type === 9 /* ENCODED_ENTITY */) {
|
|
10672
|
+
if (currentToken.type === 9 /* MlParserTokenType.ENCODED_ENTITY */) {
|
|
10645
10673
|
const [decoded, encoded] = currentToken.parts;
|
|
10646
10674
|
consumedInOriginalTemplate += encoded.length;
|
|
10647
10675
|
consumedInInput += decoded.length;
|
|
@@ -13039,14 +13067,14 @@ class _Tokenizer {
|
|
|
13039
13067
|
else if (!(this._tokenizeIcu && this._tokenizeExpansionForm())) {
|
|
13040
13068
|
// In (possibly interpolated) text the end of the text is given by `isTextEnd()`, while
|
|
13041
13069
|
// the premature end of an interpolation is given by the start of a new HTML element.
|
|
13042
|
-
this._consumeWithInterpolation(5 /* TEXT */, 8 /* INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());
|
|
13070
|
+
this._consumeWithInterpolation(5 /* TokenType.TEXT */, 8 /* TokenType.INTERPOLATION */, () => this._isTextEnd(), () => this._isTagStart());
|
|
13043
13071
|
}
|
|
13044
13072
|
}
|
|
13045
13073
|
catch (e) {
|
|
13046
13074
|
this.handleError(e);
|
|
13047
13075
|
}
|
|
13048
13076
|
}
|
|
13049
|
-
this._beginToken(24 /* EOF */);
|
|
13077
|
+
this._beginToken(24 /* TokenType.EOF */);
|
|
13050
13078
|
this._endToken([]);
|
|
13051
13079
|
}
|
|
13052
13080
|
/**
|
|
@@ -13190,7 +13218,7 @@ class _Tokenizer {
|
|
|
13190
13218
|
return char;
|
|
13191
13219
|
}
|
|
13192
13220
|
_consumeEntity(textTokenType) {
|
|
13193
|
-
this._beginToken(9 /* ENCODED_ENTITY */);
|
|
13221
|
+
this._beginToken(9 /* TokenType.ENCODED_ENTITY */);
|
|
13194
13222
|
const start = this._cursor.clone();
|
|
13195
13223
|
this._cursor.advance();
|
|
13196
13224
|
if (this._attemptCharCode($HASH)) {
|
|
@@ -13236,7 +13264,7 @@ class _Tokenizer {
|
|
|
13236
13264
|
}
|
|
13237
13265
|
}
|
|
13238
13266
|
_consumeRawText(consumeEntities, endMarkerPredicate) {
|
|
13239
|
-
this._beginToken(consumeEntities ? 6 /* ESCAPABLE_RAW_TEXT */ : 7 /* RAW_TEXT */);
|
|
13267
|
+
this._beginToken(consumeEntities ? 6 /* TokenType.ESCAPABLE_RAW_TEXT */ : 7 /* TokenType.RAW_TEXT */);
|
|
13240
13268
|
const parts = [];
|
|
13241
13269
|
while (true) {
|
|
13242
13270
|
const tagCloseStart = this._cursor.clone();
|
|
@@ -13248,8 +13276,8 @@ class _Tokenizer {
|
|
|
13248
13276
|
if (consumeEntities && this._cursor.peek() === $AMPERSAND) {
|
|
13249
13277
|
this._endToken([this._processCarriageReturns(parts.join(''))]);
|
|
13250
13278
|
parts.length = 0;
|
|
13251
|
-
this._consumeEntity(6 /* ESCAPABLE_RAW_TEXT */);
|
|
13252
|
-
this._beginToken(6 /* ESCAPABLE_RAW_TEXT */);
|
|
13279
|
+
this._consumeEntity(6 /* TokenType.ESCAPABLE_RAW_TEXT */);
|
|
13280
|
+
this._beginToken(6 /* TokenType.ESCAPABLE_RAW_TEXT */);
|
|
13253
13281
|
}
|
|
13254
13282
|
else {
|
|
13255
13283
|
parts.push(this._readChar());
|
|
@@ -13258,25 +13286,25 @@ class _Tokenizer {
|
|
|
13258
13286
|
this._endToken([this._processCarriageReturns(parts.join(''))]);
|
|
13259
13287
|
}
|
|
13260
13288
|
_consumeComment(start) {
|
|
13261
|
-
this._beginToken(10 /* COMMENT_START */, start);
|
|
13289
|
+
this._beginToken(10 /* TokenType.COMMENT_START */, start);
|
|
13262
13290
|
this._requireCharCode($MINUS);
|
|
13263
13291
|
this._endToken([]);
|
|
13264
13292
|
this._consumeRawText(false, () => this._attemptStr('-->'));
|
|
13265
|
-
this._beginToken(11 /* COMMENT_END */);
|
|
13293
|
+
this._beginToken(11 /* TokenType.COMMENT_END */);
|
|
13266
13294
|
this._requireStr('-->');
|
|
13267
13295
|
this._endToken([]);
|
|
13268
13296
|
}
|
|
13269
13297
|
_consumeCdata(start) {
|
|
13270
|
-
this._beginToken(12 /* CDATA_START */, start);
|
|
13298
|
+
this._beginToken(12 /* TokenType.CDATA_START */, start);
|
|
13271
13299
|
this._requireStr('CDATA[');
|
|
13272
13300
|
this._endToken([]);
|
|
13273
13301
|
this._consumeRawText(false, () => this._attemptStr(']]>'));
|
|
13274
|
-
this._beginToken(13 /* CDATA_END */);
|
|
13302
|
+
this._beginToken(13 /* TokenType.CDATA_END */);
|
|
13275
13303
|
this._requireStr(']]>');
|
|
13276
13304
|
this._endToken([]);
|
|
13277
13305
|
}
|
|
13278
13306
|
_consumeDocType(start) {
|
|
13279
|
-
this._beginToken(18 /* DOC_TYPE */, start);
|
|
13307
|
+
this._beginToken(18 /* TokenType.DOC_TYPE */, start);
|
|
13280
13308
|
const contentStart = this._cursor.clone();
|
|
13281
13309
|
this._attemptUntilChar($GT);
|
|
13282
13310
|
const content = this._cursor.getChars(contentStart);
|
|
@@ -13330,12 +13358,12 @@ class _Tokenizer {
|
|
|
13330
13358
|
if (e instanceof _ControlFlowError) {
|
|
13331
13359
|
if (openTagToken) {
|
|
13332
13360
|
// We errored before we could close the opening tag, so it is incomplete.
|
|
13333
|
-
openTagToken.type = 4 /* INCOMPLETE_TAG_OPEN */;
|
|
13361
|
+
openTagToken.type = 4 /* TokenType.INCOMPLETE_TAG_OPEN */;
|
|
13334
13362
|
}
|
|
13335
13363
|
else {
|
|
13336
13364
|
// When the start tag is invalid, assume we want a "<" as text.
|
|
13337
13365
|
// Back to back text tokens are merged at the end.
|
|
13338
|
-
this._beginToken(5 /* TEXT */, start);
|
|
13366
|
+
this._beginToken(5 /* TokenType.TEXT */, start);
|
|
13339
13367
|
this._endToken(['<']);
|
|
13340
13368
|
}
|
|
13341
13369
|
return;
|
|
@@ -13362,13 +13390,13 @@ class _Tokenizer {
|
|
|
13362
13390
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13363
13391
|
return this._attemptCharCode($GT);
|
|
13364
13392
|
});
|
|
13365
|
-
this._beginToken(3 /* TAG_CLOSE */);
|
|
13393
|
+
this._beginToken(3 /* TokenType.TAG_CLOSE */);
|
|
13366
13394
|
this._requireCharCodeUntilFn(code => code === $GT, 3);
|
|
13367
13395
|
this._cursor.advance(); // Consume the `>`
|
|
13368
13396
|
this._endToken([prefix, tagName]);
|
|
13369
13397
|
}
|
|
13370
13398
|
_consumeTagOpenStart(start) {
|
|
13371
|
-
this._beginToken(0 /* TAG_OPEN_START */, start);
|
|
13399
|
+
this._beginToken(0 /* TokenType.TAG_OPEN_START */, start);
|
|
13372
13400
|
const parts = this._consumePrefixAndName();
|
|
13373
13401
|
return this._endToken(parts);
|
|
13374
13402
|
}
|
|
@@ -13377,7 +13405,7 @@ class _Tokenizer {
|
|
|
13377
13405
|
if (attrNameStart === $SQ || attrNameStart === $DQ) {
|
|
13378
13406
|
throw this._createError(_unexpectedCharacterErrorMsg(attrNameStart), this._cursor.getSpan());
|
|
13379
13407
|
}
|
|
13380
|
-
this._beginToken(14 /* ATTR_NAME */);
|
|
13408
|
+
this._beginToken(14 /* TokenType.ATTR_NAME */);
|
|
13381
13409
|
const prefixAndName = this._consumePrefixAndName();
|
|
13382
13410
|
this._endToken(prefixAndName);
|
|
13383
13411
|
}
|
|
@@ -13389,27 +13417,27 @@ class _Tokenizer {
|
|
|
13389
13417
|
// In an attribute then end of the attribute value and the premature end to an interpolation
|
|
13390
13418
|
// are both triggered by the `quoteChar`.
|
|
13391
13419
|
const endPredicate = () => this._cursor.peek() === quoteChar;
|
|
13392
|
-
this._consumeWithInterpolation(16 /* ATTR_VALUE_TEXT */, 17 /* ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13420
|
+
this._consumeWithInterpolation(16 /* TokenType.ATTR_VALUE_TEXT */, 17 /* TokenType.ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13393
13421
|
this._consumeQuote(quoteChar);
|
|
13394
13422
|
}
|
|
13395
13423
|
else {
|
|
13396
13424
|
const endPredicate = () => isNameEnd(this._cursor.peek());
|
|
13397
|
-
this._consumeWithInterpolation(16 /* ATTR_VALUE_TEXT */, 17 /* ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13425
|
+
this._consumeWithInterpolation(16 /* TokenType.ATTR_VALUE_TEXT */, 17 /* TokenType.ATTR_VALUE_INTERPOLATION */, endPredicate, endPredicate);
|
|
13398
13426
|
}
|
|
13399
13427
|
}
|
|
13400
13428
|
_consumeQuote(quoteChar) {
|
|
13401
|
-
this._beginToken(15 /* ATTR_QUOTE */);
|
|
13429
|
+
this._beginToken(15 /* TokenType.ATTR_QUOTE */);
|
|
13402
13430
|
this._requireCharCode(quoteChar);
|
|
13403
13431
|
this._endToken([String.fromCodePoint(quoteChar)]);
|
|
13404
13432
|
}
|
|
13405
13433
|
_consumeTagOpenEnd() {
|
|
13406
|
-
const tokenType = this._attemptCharCode($SLASH) ? 2 /* TAG_OPEN_END_VOID */ : 1 /* TAG_OPEN_END */;
|
|
13434
|
+
const tokenType = this._attemptCharCode($SLASH) ? 2 /* TokenType.TAG_OPEN_END_VOID */ : 1 /* TokenType.TAG_OPEN_END */;
|
|
13407
13435
|
this._beginToken(tokenType);
|
|
13408
13436
|
this._requireCharCode($GT);
|
|
13409
13437
|
this._endToken([]);
|
|
13410
13438
|
}
|
|
13411
13439
|
_consumeTagClose(start) {
|
|
13412
|
-
this._beginToken(3 /* TAG_CLOSE */, start);
|
|
13440
|
+
this._beginToken(3 /* TokenType.TAG_CLOSE */, start);
|
|
13413
13441
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13414
13442
|
const prefixAndName = this._consumePrefixAndName();
|
|
13415
13443
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
@@ -13417,11 +13445,11 @@ class _Tokenizer {
|
|
|
13417
13445
|
this._endToken(prefixAndName);
|
|
13418
13446
|
}
|
|
13419
13447
|
_consumeExpansionFormStart() {
|
|
13420
|
-
this._beginToken(19 /* EXPANSION_FORM_START */);
|
|
13448
|
+
this._beginToken(19 /* TokenType.EXPANSION_FORM_START */);
|
|
13421
13449
|
this._requireCharCode($LBRACE);
|
|
13422
13450
|
this._endToken([]);
|
|
13423
|
-
this._expansionCaseStack.push(19 /* EXPANSION_FORM_START */);
|
|
13424
|
-
this._beginToken(7 /* RAW_TEXT */);
|
|
13451
|
+
this._expansionCaseStack.push(19 /* TokenType.EXPANSION_FORM_START */);
|
|
13452
|
+
this._beginToken(7 /* TokenType.RAW_TEXT */);
|
|
13425
13453
|
const condition = this._readUntil($COMMA);
|
|
13426
13454
|
const normalizedCondition = this._processCarriageReturns(condition);
|
|
13427
13455
|
if (this._i18nNormalizeLineEndingsInICUs) {
|
|
@@ -13437,32 +13465,32 @@ class _Tokenizer {
|
|
|
13437
13465
|
}
|
|
13438
13466
|
this._requireCharCode($COMMA);
|
|
13439
13467
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13440
|
-
this._beginToken(7 /* RAW_TEXT */);
|
|
13468
|
+
this._beginToken(7 /* TokenType.RAW_TEXT */);
|
|
13441
13469
|
const type = this._readUntil($COMMA);
|
|
13442
13470
|
this._endToken([type]);
|
|
13443
13471
|
this._requireCharCode($COMMA);
|
|
13444
13472
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13445
13473
|
}
|
|
13446
13474
|
_consumeExpansionCaseStart() {
|
|
13447
|
-
this._beginToken(20 /* EXPANSION_CASE_VALUE */);
|
|
13475
|
+
this._beginToken(20 /* TokenType.EXPANSION_CASE_VALUE */);
|
|
13448
13476
|
const value = this._readUntil($LBRACE).trim();
|
|
13449
13477
|
this._endToken([value]);
|
|
13450
13478
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13451
|
-
this._beginToken(21 /* EXPANSION_CASE_EXP_START */);
|
|
13479
|
+
this._beginToken(21 /* TokenType.EXPANSION_CASE_EXP_START */);
|
|
13452
13480
|
this._requireCharCode($LBRACE);
|
|
13453
13481
|
this._endToken([]);
|
|
13454
13482
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13455
|
-
this._expansionCaseStack.push(21 /* EXPANSION_CASE_EXP_START */);
|
|
13483
|
+
this._expansionCaseStack.push(21 /* TokenType.EXPANSION_CASE_EXP_START */);
|
|
13456
13484
|
}
|
|
13457
13485
|
_consumeExpansionCaseEnd() {
|
|
13458
|
-
this._beginToken(22 /* EXPANSION_CASE_EXP_END */);
|
|
13486
|
+
this._beginToken(22 /* TokenType.EXPANSION_CASE_EXP_END */);
|
|
13459
13487
|
this._requireCharCode($RBRACE);
|
|
13460
13488
|
this._endToken([]);
|
|
13461
13489
|
this._attemptCharCodeUntilFn(isNotWhitespace);
|
|
13462
13490
|
this._expansionCaseStack.pop();
|
|
13463
13491
|
}
|
|
13464
13492
|
_consumeExpansionFormEnd() {
|
|
13465
|
-
this._beginToken(23 /* EXPANSION_FORM_END */);
|
|
13493
|
+
this._beginToken(23 /* TokenType.EXPANSION_FORM_END */);
|
|
13466
13494
|
this._requireCharCode($RBRACE);
|
|
13467
13495
|
this._endToken([]);
|
|
13468
13496
|
this._expansionCaseStack.pop();
|
|
@@ -13612,12 +13640,12 @@ class _Tokenizer {
|
|
|
13612
13640
|
_isInExpansionCase() {
|
|
13613
13641
|
return this._expansionCaseStack.length > 0 &&
|
|
13614
13642
|
this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
|
|
13615
|
-
21 /* EXPANSION_CASE_EXP_START */;
|
|
13643
|
+
21 /* TokenType.EXPANSION_CASE_EXP_START */;
|
|
13616
13644
|
}
|
|
13617
13645
|
_isInExpansionForm() {
|
|
13618
13646
|
return this._expansionCaseStack.length > 0 &&
|
|
13619
13647
|
this._expansionCaseStack[this._expansionCaseStack.length - 1] ===
|
|
13620
|
-
19 /* EXPANSION_FORM_START */;
|
|
13648
|
+
19 /* TokenType.EXPANSION_FORM_START */;
|
|
13621
13649
|
}
|
|
13622
13650
|
isExpansionFormStart() {
|
|
13623
13651
|
if (this._cursor.peek() !== $LBRACE) {
|
|
@@ -13664,9 +13692,9 @@ function mergeTextTokens(srcTokens) {
|
|
|
13664
13692
|
let lastDstToken = undefined;
|
|
13665
13693
|
for (let i = 0; i < srcTokens.length; i++) {
|
|
13666
13694
|
const token = srcTokens[i];
|
|
13667
|
-
if ((lastDstToken && lastDstToken.type === 5 /* TEXT */ && token.type === 5 /* TEXT */) ||
|
|
13668
|
-
(lastDstToken && lastDstToken.type === 16 /* ATTR_VALUE_TEXT */ &&
|
|
13669
|
-
token.type === 16 /* ATTR_VALUE_TEXT */)) {
|
|
13695
|
+
if ((lastDstToken && lastDstToken.type === 5 /* TokenType.TEXT */ && token.type === 5 /* TokenType.TEXT */) ||
|
|
13696
|
+
(lastDstToken && lastDstToken.type === 16 /* TokenType.ATTR_VALUE_TEXT */ &&
|
|
13697
|
+
token.type === 16 /* TokenType.ATTR_VALUE_TEXT */)) {
|
|
13670
13698
|
lastDstToken.parts[0] += token.parts[0];
|
|
13671
13699
|
lastDstToken.sourceSpan.end = token.sourceSpan.end;
|
|
13672
13700
|
}
|
|
@@ -13959,28 +13987,28 @@ class _TreeBuilder {
|
|
|
13959
13987
|
this._advance();
|
|
13960
13988
|
}
|
|
13961
13989
|
build() {
|
|
13962
|
-
while (this._peek.type !== 24 /* EOF */) {
|
|
13963
|
-
if (this._peek.type === 0 /* TAG_OPEN_START */ ||
|
|
13964
|
-
this._peek.type === 4 /* INCOMPLETE_TAG_OPEN */) {
|
|
13990
|
+
while (this._peek.type !== 24 /* TokenType.EOF */) {
|
|
13991
|
+
if (this._peek.type === 0 /* TokenType.TAG_OPEN_START */ ||
|
|
13992
|
+
this._peek.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {
|
|
13965
13993
|
this._consumeStartTag(this._advance());
|
|
13966
13994
|
}
|
|
13967
|
-
else if (this._peek.type === 3 /* TAG_CLOSE */) {
|
|
13995
|
+
else if (this._peek.type === 3 /* TokenType.TAG_CLOSE */) {
|
|
13968
13996
|
this._consumeEndTag(this._advance());
|
|
13969
13997
|
}
|
|
13970
|
-
else if (this._peek.type === 12 /* CDATA_START */) {
|
|
13998
|
+
else if (this._peek.type === 12 /* TokenType.CDATA_START */) {
|
|
13971
13999
|
this._closeVoidElement();
|
|
13972
14000
|
this._consumeCdata(this._advance());
|
|
13973
14001
|
}
|
|
13974
|
-
else if (this._peek.type === 10 /* COMMENT_START */) {
|
|
14002
|
+
else if (this._peek.type === 10 /* TokenType.COMMENT_START */) {
|
|
13975
14003
|
this._closeVoidElement();
|
|
13976
14004
|
this._consumeComment(this._advance());
|
|
13977
14005
|
}
|
|
13978
|
-
else if (this._peek.type === 5 /* TEXT */ || this._peek.type === 7 /* RAW_TEXT */ ||
|
|
13979
|
-
this._peek.type === 6 /* ESCAPABLE_RAW_TEXT */) {
|
|
14006
|
+
else if (this._peek.type === 5 /* TokenType.TEXT */ || this._peek.type === 7 /* TokenType.RAW_TEXT */ ||
|
|
14007
|
+
this._peek.type === 6 /* TokenType.ESCAPABLE_RAW_TEXT */) {
|
|
13980
14008
|
this._closeVoidElement();
|
|
13981
14009
|
this._consumeText(this._advance());
|
|
13982
14010
|
}
|
|
13983
|
-
else if (this._peek.type === 19 /* EXPANSION_FORM_START */) {
|
|
14011
|
+
else if (this._peek.type === 19 /* TokenType.EXPANSION_FORM_START */) {
|
|
13984
14012
|
this._consumeExpansion(this._advance());
|
|
13985
14013
|
}
|
|
13986
14014
|
else {
|
|
@@ -14006,11 +14034,11 @@ class _TreeBuilder {
|
|
|
14006
14034
|
}
|
|
14007
14035
|
_consumeCdata(_startToken) {
|
|
14008
14036
|
this._consumeText(this._advance());
|
|
14009
|
-
this._advanceIf(13 /* CDATA_END */);
|
|
14037
|
+
this._advanceIf(13 /* TokenType.CDATA_END */);
|
|
14010
14038
|
}
|
|
14011
14039
|
_consumeComment(token) {
|
|
14012
|
-
const text = this._advanceIf(7 /* RAW_TEXT */);
|
|
14013
|
-
this._advanceIf(11 /* COMMENT_END */);
|
|
14040
|
+
const text = this._advanceIf(7 /* TokenType.RAW_TEXT */);
|
|
14041
|
+
this._advanceIf(11 /* TokenType.COMMENT_END */);
|
|
14014
14042
|
const value = text != null ? text.parts[0].trim() : null;
|
|
14015
14043
|
this._addToParent(new Comment(value, token.sourceSpan));
|
|
14016
14044
|
}
|
|
@@ -14019,14 +14047,14 @@ class _TreeBuilder {
|
|
|
14019
14047
|
const type = this._advance();
|
|
14020
14048
|
const cases = [];
|
|
14021
14049
|
// read =
|
|
14022
|
-
while (this._peek.type === 20 /* EXPANSION_CASE_VALUE */) {
|
|
14050
|
+
while (this._peek.type === 20 /* TokenType.EXPANSION_CASE_VALUE */) {
|
|
14023
14051
|
const expCase = this._parseExpansionCase();
|
|
14024
14052
|
if (!expCase)
|
|
14025
14053
|
return; // error
|
|
14026
14054
|
cases.push(expCase);
|
|
14027
14055
|
}
|
|
14028
14056
|
// read the final }
|
|
14029
|
-
if (this._peek.type !== 23 /* EXPANSION_FORM_END */) {
|
|
14057
|
+
if (this._peek.type !== 23 /* TokenType.EXPANSION_FORM_END */) {
|
|
14030
14058
|
this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '}'.`));
|
|
14031
14059
|
return;
|
|
14032
14060
|
}
|
|
@@ -14037,7 +14065,7 @@ class _TreeBuilder {
|
|
|
14037
14065
|
_parseExpansionCase() {
|
|
14038
14066
|
const value = this._advance();
|
|
14039
14067
|
// read {
|
|
14040
|
-
if (this._peek.type !== 21 /* EXPANSION_CASE_EXP_START */) {
|
|
14068
|
+
if (this._peek.type !== 21 /* TokenType.EXPANSION_CASE_EXP_START */) {
|
|
14041
14069
|
this.errors.push(TreeError.create(null, this._peek.sourceSpan, `Invalid ICU message. Missing '{'.`));
|
|
14042
14070
|
return null;
|
|
14043
14071
|
}
|
|
@@ -14047,7 +14075,7 @@ class _TreeBuilder {
|
|
|
14047
14075
|
if (!exp)
|
|
14048
14076
|
return null;
|
|
14049
14077
|
const end = this._advance();
|
|
14050
|
-
exp.push({ type: 24 /* EOF */, parts: [], sourceSpan: end.sourceSpan });
|
|
14078
|
+
exp.push({ type: 24 /* TokenType.EOF */, parts: [], sourceSpan: end.sourceSpan });
|
|
14051
14079
|
// parse everything in between { and }
|
|
14052
14080
|
const expansionCaseParser = new _TreeBuilder(exp, this.getTagDefinition);
|
|
14053
14081
|
expansionCaseParser.build();
|
|
@@ -14061,14 +14089,14 @@ class _TreeBuilder {
|
|
|
14061
14089
|
}
|
|
14062
14090
|
_collectExpansionExpTokens(start) {
|
|
14063
14091
|
const exp = [];
|
|
14064
|
-
const expansionFormStack = [21 /* EXPANSION_CASE_EXP_START */];
|
|
14092
|
+
const expansionFormStack = [21 /* TokenType.EXPANSION_CASE_EXP_START */];
|
|
14065
14093
|
while (true) {
|
|
14066
|
-
if (this._peek.type === 19 /* EXPANSION_FORM_START */ ||
|
|
14067
|
-
this._peek.type === 21 /* EXPANSION_CASE_EXP_START */) {
|
|
14094
|
+
if (this._peek.type === 19 /* TokenType.EXPANSION_FORM_START */ ||
|
|
14095
|
+
this._peek.type === 21 /* TokenType.EXPANSION_CASE_EXP_START */) {
|
|
14068
14096
|
expansionFormStack.push(this._peek.type);
|
|
14069
14097
|
}
|
|
14070
|
-
if (this._peek.type === 22 /* EXPANSION_CASE_EXP_END */) {
|
|
14071
|
-
if (lastOnStack(expansionFormStack, 21 /* EXPANSION_CASE_EXP_START */)) {
|
|
14098
|
+
if (this._peek.type === 22 /* TokenType.EXPANSION_CASE_EXP_END */) {
|
|
14099
|
+
if (lastOnStack(expansionFormStack, 21 /* TokenType.EXPANSION_CASE_EXP_START */)) {
|
|
14072
14100
|
expansionFormStack.pop();
|
|
14073
14101
|
if (expansionFormStack.length === 0)
|
|
14074
14102
|
return exp;
|
|
@@ -14078,8 +14106,8 @@ class _TreeBuilder {
|
|
|
14078
14106
|
return null;
|
|
14079
14107
|
}
|
|
14080
14108
|
}
|
|
14081
|
-
if (this._peek.type === 23 /* EXPANSION_FORM_END */) {
|
|
14082
|
-
if (lastOnStack(expansionFormStack, 19 /* EXPANSION_FORM_START */)) {
|
|
14109
|
+
if (this._peek.type === 23 /* TokenType.EXPANSION_FORM_END */) {
|
|
14110
|
+
if (lastOnStack(expansionFormStack, 19 /* TokenType.EXPANSION_FORM_START */)) {
|
|
14083
14111
|
expansionFormStack.pop();
|
|
14084
14112
|
}
|
|
14085
14113
|
else {
|
|
@@ -14087,7 +14115,7 @@ class _TreeBuilder {
|
|
|
14087
14115
|
return null;
|
|
14088
14116
|
}
|
|
14089
14117
|
}
|
|
14090
|
-
if (this._peek.type === 24 /* EOF */) {
|
|
14118
|
+
if (this._peek.type === 24 /* TokenType.EOF */) {
|
|
14091
14119
|
this.errors.push(TreeError.create(null, start.sourceSpan, `Invalid ICU message. Missing '}'.`));
|
|
14092
14120
|
return null;
|
|
14093
14121
|
}
|
|
@@ -14106,18 +14134,18 @@ class _TreeBuilder {
|
|
|
14106
14134
|
tokens[0] = { type: token.type, sourceSpan: token.sourceSpan, parts: [text] };
|
|
14107
14135
|
}
|
|
14108
14136
|
}
|
|
14109
|
-
while (this._peek.type === 8 /* INTERPOLATION */ || this._peek.type === 5 /* TEXT */ ||
|
|
14110
|
-
this._peek.type === 9 /* ENCODED_ENTITY */) {
|
|
14137
|
+
while (this._peek.type === 8 /* TokenType.INTERPOLATION */ || this._peek.type === 5 /* TokenType.TEXT */ ||
|
|
14138
|
+
this._peek.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14111
14139
|
token = this._advance();
|
|
14112
14140
|
tokens.push(token);
|
|
14113
|
-
if (token.type === 8 /* INTERPOLATION */) {
|
|
14141
|
+
if (token.type === 8 /* TokenType.INTERPOLATION */) {
|
|
14114
14142
|
// For backward compatibility we decode HTML entities that appear in interpolation
|
|
14115
14143
|
// expressions. This is arguably a bug, but it could be a considerable breaking change to
|
|
14116
14144
|
// fix it. It should be addressed in a larger project to refactor the entire parser/lexer
|
|
14117
14145
|
// chain after View Engine has been removed.
|
|
14118
14146
|
text += token.parts.join('').replace(/&([^;]+);/g, decodeEntity);
|
|
14119
14147
|
}
|
|
14120
|
-
else if (token.type === 9 /* ENCODED_ENTITY */) {
|
|
14148
|
+
else if (token.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14121
14149
|
text += token.parts[0];
|
|
14122
14150
|
}
|
|
14123
14151
|
else {
|
|
@@ -14138,14 +14166,14 @@ class _TreeBuilder {
|
|
|
14138
14166
|
_consumeStartTag(startTagToken) {
|
|
14139
14167
|
const [prefix, name] = startTagToken.parts;
|
|
14140
14168
|
const attrs = [];
|
|
14141
|
-
while (this._peek.type === 14 /* ATTR_NAME */) {
|
|
14169
|
+
while (this._peek.type === 14 /* TokenType.ATTR_NAME */) {
|
|
14142
14170
|
attrs.push(this._consumeAttr(this._advance()));
|
|
14143
14171
|
}
|
|
14144
14172
|
const fullName = this._getElementFullName(prefix, name, this._getParentElement());
|
|
14145
14173
|
let selfClosing = false;
|
|
14146
14174
|
// Note: There could have been a tokenizer error
|
|
14147
14175
|
// so that we don't get a token for the end tag...
|
|
14148
|
-
if (this._peek.type === 2 /* TAG_OPEN_END_VOID */) {
|
|
14176
|
+
if (this._peek.type === 2 /* TokenType.TAG_OPEN_END_VOID */) {
|
|
14149
14177
|
this._advance();
|
|
14150
14178
|
selfClosing = true;
|
|
14151
14179
|
const tagDef = this.getTagDefinition(fullName);
|
|
@@ -14153,7 +14181,7 @@ class _TreeBuilder {
|
|
|
14153
14181
|
this.errors.push(TreeError.create(fullName, startTagToken.sourceSpan, `Only void and foreign elements can be self closed "${startTagToken.parts[1]}"`));
|
|
14154
14182
|
}
|
|
14155
14183
|
}
|
|
14156
|
-
else if (this._peek.type === 1 /* TAG_OPEN_END */) {
|
|
14184
|
+
else if (this._peek.type === 1 /* TokenType.TAG_OPEN_END */) {
|
|
14157
14185
|
this._advance();
|
|
14158
14186
|
selfClosing = false;
|
|
14159
14187
|
}
|
|
@@ -14168,7 +14196,7 @@ class _TreeBuilder {
|
|
|
14168
14196
|
// element start tag also represents the end tag.
|
|
14169
14197
|
this._popElement(fullName, span);
|
|
14170
14198
|
}
|
|
14171
|
-
else if (startTagToken.type === 4 /* INCOMPLETE_TAG_OPEN */) {
|
|
14199
|
+
else if (startTagToken.type === 4 /* TokenType.INCOMPLETE_TAG_OPEN */) {
|
|
14172
14200
|
// We already know the opening tag is not complete, so it is unlikely it has a corresponding
|
|
14173
14201
|
// close tag. Let's optimistically parse it as a full element and emit an error.
|
|
14174
14202
|
this._popElement(fullName, null);
|
|
@@ -14225,7 +14253,7 @@ class _TreeBuilder {
|
|
|
14225
14253
|
const fullName = mergeNsAndName(attrName.parts[0], attrName.parts[1]);
|
|
14226
14254
|
let attrEnd = attrName.sourceSpan.end;
|
|
14227
14255
|
// Consume any quote
|
|
14228
|
-
if (this._peek.type === 15 /* ATTR_QUOTE */) {
|
|
14256
|
+
if (this._peek.type === 15 /* TokenType.ATTR_QUOTE */) {
|
|
14229
14257
|
this._advance();
|
|
14230
14258
|
}
|
|
14231
14259
|
// Consume the attribute value
|
|
@@ -14238,22 +14266,22 @@ class _TreeBuilder {
|
|
|
14238
14266
|
// being able to consider `ATTR_VALUE_INTERPOLATION` as an option. This is because TS is not
|
|
14239
14267
|
// able to see that `_advance()` will actually mutate `_peek`.
|
|
14240
14268
|
const nextTokenType = this._peek.type;
|
|
14241
|
-
if (nextTokenType === 16 /* ATTR_VALUE_TEXT */) {
|
|
14269
|
+
if (nextTokenType === 16 /* TokenType.ATTR_VALUE_TEXT */) {
|
|
14242
14270
|
valueStartSpan = this._peek.sourceSpan;
|
|
14243
14271
|
valueEnd = this._peek.sourceSpan.end;
|
|
14244
|
-
while (this._peek.type === 16 /* ATTR_VALUE_TEXT */ ||
|
|
14245
|
-
this._peek.type === 17 /* ATTR_VALUE_INTERPOLATION */ ||
|
|
14246
|
-
this._peek.type === 9 /* ENCODED_ENTITY */) {
|
|
14272
|
+
while (this._peek.type === 16 /* TokenType.ATTR_VALUE_TEXT */ ||
|
|
14273
|
+
this._peek.type === 17 /* TokenType.ATTR_VALUE_INTERPOLATION */ ||
|
|
14274
|
+
this._peek.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14247
14275
|
const valueToken = this._advance();
|
|
14248
14276
|
valueTokens.push(valueToken);
|
|
14249
|
-
if (valueToken.type === 17 /* ATTR_VALUE_INTERPOLATION */) {
|
|
14277
|
+
if (valueToken.type === 17 /* TokenType.ATTR_VALUE_INTERPOLATION */) {
|
|
14250
14278
|
// For backward compatibility we decode HTML entities that appear in interpolation
|
|
14251
14279
|
// expressions. This is arguably a bug, but it could be a considerable breaking change to
|
|
14252
14280
|
// fix it. It should be addressed in a larger project to refactor the entire parser/lexer
|
|
14253
14281
|
// chain after View Engine has been removed.
|
|
14254
14282
|
value += valueToken.parts.join('').replace(/&([^;]+);/g, decodeEntity);
|
|
14255
14283
|
}
|
|
14256
|
-
else if (valueToken.type === 9 /* ENCODED_ENTITY */) {
|
|
14284
|
+
else if (valueToken.type === 9 /* TokenType.ENCODED_ENTITY */) {
|
|
14257
14285
|
value += valueToken.parts[0];
|
|
14258
14286
|
}
|
|
14259
14287
|
else {
|
|
@@ -14263,7 +14291,7 @@ class _TreeBuilder {
|
|
|
14263
14291
|
}
|
|
14264
14292
|
}
|
|
14265
14293
|
// Consume any quote
|
|
14266
|
-
if (this._peek.type === 15 /* ATTR_QUOTE */) {
|
|
14294
|
+
if (this._peek.type === 15 /* TokenType.ATTR_QUOTE */) {
|
|
14267
14295
|
const quoteToken = this._advance();
|
|
14268
14296
|
attrEnd = quoteToken.sourceSpan.end;
|
|
14269
14297
|
}
|
|
@@ -14393,7 +14421,7 @@ class WhitespaceVisitor {
|
|
|
14393
14421
|
(context.prev instanceof Expansion || context.next instanceof Expansion);
|
|
14394
14422
|
if (isNotBlank || hasExpansionSibling) {
|
|
14395
14423
|
// Process the whitespace in the tokens of this Text node
|
|
14396
|
-
const tokens = text.tokens.map(token => token.type === 5 /* TEXT */ ? createWhitespaceProcessedTextToken(token) : token);
|
|
14424
|
+
const tokens = text.tokens.map(token => token.type === 5 /* TokenType.TEXT */ ? createWhitespaceProcessedTextToken(token) : token);
|
|
14397
14425
|
// Process the whitespace of the value of this Text node
|
|
14398
14426
|
const value = processWhitespace(text.value);
|
|
14399
14427
|
return new Text(value, text.sourceSpan, tokens, text.i18n);
|
|
@@ -15243,7 +15271,7 @@ class BindingParser {
|
|
|
15243
15271
|
}
|
|
15244
15272
|
createBoundElementProperty(elementSelector, boundProp, skipValidation = false, mapPropertyName = true) {
|
|
15245
15273
|
if (boundProp.isAnimation) {
|
|
15246
|
-
return new BoundElementProperty(boundProp.name, 4 /* Animation */, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
15274
|
+
return new BoundElementProperty(boundProp.name, 4 /* BindingType.Animation */, SecurityContext.NONE, boundProp.expression, null, boundProp.sourceSpan, boundProp.keySpan, boundProp.valueSpan);
|
|
15247
15275
|
}
|
|
15248
15276
|
let unit = null;
|
|
15249
15277
|
let bindingType = undefined;
|
|
@@ -15264,17 +15292,17 @@ class BindingParser {
|
|
|
15264
15292
|
const name = boundPropertyName.substring(nsSeparatorIdx + 1);
|
|
15265
15293
|
boundPropertyName = mergeNsAndName(ns, name);
|
|
15266
15294
|
}
|
|
15267
|
-
bindingType = 1 /* Attribute */;
|
|
15295
|
+
bindingType = 1 /* BindingType.Attribute */;
|
|
15268
15296
|
}
|
|
15269
15297
|
else if (parts[0] == CLASS_PREFIX) {
|
|
15270
15298
|
boundPropertyName = parts[1];
|
|
15271
|
-
bindingType = 2 /* Class */;
|
|
15299
|
+
bindingType = 2 /* BindingType.Class */;
|
|
15272
15300
|
securityContexts = [SecurityContext.NONE];
|
|
15273
15301
|
}
|
|
15274
15302
|
else if (parts[0] == STYLE_PREFIX) {
|
|
15275
15303
|
unit = parts.length > 2 ? parts[2] : null;
|
|
15276
15304
|
boundPropertyName = parts[1];
|
|
15277
|
-
bindingType = 3 /* Style */;
|
|
15305
|
+
bindingType = 3 /* BindingType.Style */;
|
|
15278
15306
|
securityContexts = [SecurityContext.STYLE];
|
|
15279
15307
|
}
|
|
15280
15308
|
}
|
|
@@ -15283,7 +15311,7 @@ class BindingParser {
|
|
|
15283
15311
|
const mappedPropName = this._schemaRegistry.getMappedPropName(boundProp.name);
|
|
15284
15312
|
boundPropertyName = mapPropertyName ? mappedPropName : boundProp.name;
|
|
15285
15313
|
securityContexts = calcPossibleSecurityContexts(this._schemaRegistry, elementSelector, mappedPropName, false);
|
|
15286
|
-
bindingType = 0 /* Property */;
|
|
15314
|
+
bindingType = 0 /* BindingType.Property */;
|
|
15287
15315
|
if (!skipValidation) {
|
|
15288
15316
|
this._validatePropertyOrAttributeName(mappedPropName, boundProp.sourceSpan, false);
|
|
15289
15317
|
}
|
|
@@ -15315,7 +15343,7 @@ class BindingParser {
|
|
|
15315
15343
|
const eventName = matches[0];
|
|
15316
15344
|
const phase = matches[1].toLowerCase();
|
|
15317
15345
|
const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
|
|
15318
|
-
targetEvents.push(new ParsedEvent(eventName, phase, 1 /* Animation */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15346
|
+
targetEvents.push(new ParsedEvent(eventName, phase, 1 /* ParsedEventType.Animation */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15319
15347
|
if (eventName.length === 0) {
|
|
15320
15348
|
this._reportError(`Animation event name is missing in binding`, sourceSpan);
|
|
15321
15349
|
}
|
|
@@ -15333,7 +15361,7 @@ class BindingParser {
|
|
|
15333
15361
|
const [target, eventName] = splitAtColon(name, [null, name]);
|
|
15334
15362
|
const ast = this._parseAction(expression, isAssignmentEvent, handlerSpan);
|
|
15335
15363
|
targetMatchableAttrs.push([name, ast.source]);
|
|
15336
|
-
targetEvents.push(new ParsedEvent(eventName, target, 0 /* Regular */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15364
|
+
targetEvents.push(new ParsedEvent(eventName, target, 0 /* ParsedEventType.Regular */, ast, sourceSpan, handlerSpan, keySpan));
|
|
15337
15365
|
// Don't detect directives for event names for now,
|
|
15338
15366
|
// so don't add the event name to the matchableAttrs
|
|
15339
15367
|
}
|
|
@@ -16416,8 +16444,8 @@ class _I18nVisitor {
|
|
|
16416
16444
|
let hasInterpolation = false;
|
|
16417
16445
|
for (const token of tokens) {
|
|
16418
16446
|
switch (token.type) {
|
|
16419
|
-
case 8 /* INTERPOLATION */:
|
|
16420
|
-
case 17 /* ATTR_VALUE_INTERPOLATION */:
|
|
16447
|
+
case 8 /* TokenType.INTERPOLATION */:
|
|
16448
|
+
case 17 /* TokenType.ATTR_VALUE_INTERPOLATION */:
|
|
16421
16449
|
hasInterpolation = true;
|
|
16422
16450
|
const expression = token.parts[1];
|
|
16423
16451
|
const baseName = extractPlaceholderName(expression) || 'INTERPOLATION';
|
|
@@ -16746,25 +16774,78 @@ function parseI18nMeta(meta = '') {
|
|
|
16746
16774
|
function i18nMetaToJSDoc(meta) {
|
|
16747
16775
|
const tags = [];
|
|
16748
16776
|
if (meta.description) {
|
|
16749
|
-
tags.push({ tagName: "desc" /* Desc */, text: meta.description });
|
|
16777
|
+
tags.push({ tagName: "desc" /* o.JSDocTagName.Desc */, text: meta.description });
|
|
16750
16778
|
}
|
|
16751
16779
|
else {
|
|
16752
16780
|
// Suppress the JSCompiler warning that a `@desc` was not given for this message.
|
|
16753
|
-
tags.push({ tagName: "suppress" /* Suppress */, text: '{msgDescriptions}' });
|
|
16781
|
+
tags.push({ tagName: "suppress" /* o.JSDocTagName.Suppress */, text: '{msgDescriptions}' });
|
|
16754
16782
|
}
|
|
16755
16783
|
if (meta.meaning) {
|
|
16756
|
-
tags.push({ tagName: "meaning" /* Meaning */, text: meta.meaning });
|
|
16784
|
+
tags.push({ tagName: "meaning" /* o.JSDocTagName.Meaning */, text: meta.meaning });
|
|
16757
16785
|
}
|
|
16758
16786
|
return jsDocComment(tags);
|
|
16759
16787
|
}
|
|
16760
16788
|
|
|
16761
16789
|
/** Closure uses `goog.getMsg(message)` to lookup translations */
|
|
16762
16790
|
const GOOG_GET_MSG = 'goog.getMsg';
|
|
16763
|
-
|
|
16791
|
+
/**
|
|
16792
|
+
* Generates a `goog.getMsg()` statement and reassignment. The template:
|
|
16793
|
+
*
|
|
16794
|
+
* ```html
|
|
16795
|
+
* <div i18n>Sent from {{ sender }} to <span class="receiver">{{ receiver }}</span></div>
|
|
16796
|
+
* ```
|
|
16797
|
+
*
|
|
16798
|
+
* Generates:
|
|
16799
|
+
*
|
|
16800
|
+
* ```typescript
|
|
16801
|
+
* const MSG_FOO = goog.getMsg(
|
|
16802
|
+
* // Message template.
|
|
16803
|
+
* 'Sent from {$interpolation} to {$startTagSpan}{$interpolation_1}{$closeTagSpan}.',
|
|
16804
|
+
* // Placeholder values, set to magic strings which get replaced by the Angular runtime.
|
|
16805
|
+
* {
|
|
16806
|
+
* 'interpolation': '\uFFFD0\uFFFD',
|
|
16807
|
+
* 'startTagSpan': '\uFFFD1\uFFFD',
|
|
16808
|
+
* 'interpolation_1': '\uFFFD2\uFFFD',
|
|
16809
|
+
* 'closeTagSpan': '\uFFFD3\uFFFD',
|
|
16810
|
+
* },
|
|
16811
|
+
* // Options bag.
|
|
16812
|
+
* {
|
|
16813
|
+
* // Maps each placeholder to the original Angular source code which generates it's value.
|
|
16814
|
+
* original_code: {
|
|
16815
|
+
* 'interpolation': '{{ sender }}',
|
|
16816
|
+
* 'startTagSpan': '<span class="receiver">',
|
|
16817
|
+
* 'interploation_1': '{{ receiver }}',
|
|
16818
|
+
* 'closeTagSpan': '</span>',
|
|
16819
|
+
* },
|
|
16820
|
+
* },
|
|
16821
|
+
* );
|
|
16822
|
+
* const I18N_0 = MSG_FOO;
|
|
16823
|
+
* ```
|
|
16824
|
+
*/
|
|
16825
|
+
function createGoogleGetMsgStatements(variable$1, message, closureVar, placeholderValues) {
|
|
16764
16826
|
const messageString = serializeI18nMessageForGetMsg(message);
|
|
16765
16827
|
const args = [literal(messageString)];
|
|
16766
|
-
if (Object.keys(
|
|
16767
|
-
|
|
16828
|
+
if (Object.keys(placeholderValues).length) {
|
|
16829
|
+
// Message template parameters containing the magic strings replaced by the Angular runtime with
|
|
16830
|
+
// real data, e.g. `{'interpolation': '\uFFFD0\uFFFD'}`.
|
|
16831
|
+
args.push(mapLiteral(formatI18nPlaceholderNamesInMap(placeholderValues, true /* useCamelCase */), true /* quoted */));
|
|
16832
|
+
// Message options object, which contains original source code for placeholders (as they are
|
|
16833
|
+
// present in a template, e.g.
|
|
16834
|
+
// `{original_code: {'interpolation': '{{ name }}', 'startTagSpan': '<span>'}}`.
|
|
16835
|
+
args.push(mapLiteral({
|
|
16836
|
+
original_code: literalMap(Object.keys(placeholderValues)
|
|
16837
|
+
.map((param) => ({
|
|
16838
|
+
key: formatI18nPlaceholderName(param),
|
|
16839
|
+
quoted: true,
|
|
16840
|
+
value: message.placeholders[param] ?
|
|
16841
|
+
// Get source span for typical placeholder if it exists.
|
|
16842
|
+
literal(message.placeholders[param].sourceSpan.toString()) :
|
|
16843
|
+
// Otherwise must be an ICU expression, get it's source span.
|
|
16844
|
+
literal(message.placeholderToMessage[param]
|
|
16845
|
+
.nodes.map((node) => node.sourceSpan.toString())
|
|
16846
|
+
.join('')),
|
|
16847
|
+
}))),
|
|
16848
|
+
}));
|
|
16768
16849
|
}
|
|
16769
16850
|
// /**
|
|
16770
16851
|
// * @desc description of message
|
|
@@ -16975,7 +17056,7 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
|
|
|
16975
17056
|
statements.push(new ExpressionStatement(invokeInstruction(null, Identifiers.resetView, [])));
|
|
16976
17057
|
}
|
|
16977
17058
|
}
|
|
16978
|
-
const eventName = type === 1 /* Animation */ ? prepareSyntheticListenerName(name, phase) : name;
|
|
17059
|
+
const eventName = type === 1 /* ParsedEventType.Animation */ ? prepareSyntheticListenerName(name, phase) : name;
|
|
16979
17060
|
const fnName = handlerName && sanitizeIdentifier(handlerName);
|
|
16980
17061
|
const fnArgs = [];
|
|
16981
17062
|
if (implicitReceiverAccesses.has(eventArgumentName)) {
|
|
@@ -17127,10 +17208,10 @@ class TemplateDefinitionBuilder {
|
|
|
17127
17208
|
const creationVariables = this._bindingScope.viewSnapshotStatements();
|
|
17128
17209
|
const updateVariables = this._bindingScope.variableDeclarations().concat(this._tempVariables);
|
|
17129
17210
|
const creationBlock = creationStatements.length > 0 ?
|
|
17130
|
-
[renderFlagCheckIfStmt(1 /* Create */, creationVariables.concat(creationStatements))] :
|
|
17211
|
+
[renderFlagCheckIfStmt(1 /* core.RenderFlags.Create */, creationVariables.concat(creationStatements))] :
|
|
17131
17212
|
[];
|
|
17132
17213
|
const updateBlock = updateStatements.length > 0 ?
|
|
17133
|
-
[renderFlagCheckIfStmt(2 /* Update */, updateVariables.concat(updateStatements))] :
|
|
17214
|
+
[renderFlagCheckIfStmt(2 /* core.RenderFlags.Update */, updateVariables.concat(updateStatements))] :
|
|
17134
17215
|
[];
|
|
17135
17216
|
return fn(
|
|
17136
17217
|
// i.e. (rf: RenderFlags, ctx: any)
|
|
@@ -17168,7 +17249,7 @@ class TemplateDefinitionBuilder {
|
|
|
17168
17249
|
const scopedName = this._bindingScope.freshReferenceName();
|
|
17169
17250
|
const retrievalLevel = this.level;
|
|
17170
17251
|
const lhs = variable(variable$1.name + scopedName);
|
|
17171
|
-
this._bindingScope.set(retrievalLevel, variable$1.name, lhs, 1 /* CONTEXT */, (scope, relativeLevel) => {
|
|
17252
|
+
this._bindingScope.set(retrievalLevel, variable$1.name, lhs, 1 /* DeclarationPriority.CONTEXT */, (scope, relativeLevel) => {
|
|
17172
17253
|
let rhs;
|
|
17173
17254
|
if (scope.bindingLevel === retrievalLevel) {
|
|
17174
17255
|
if (scope.isListenerScope() && scope.hasRestoreViewVariable()) {
|
|
@@ -17422,7 +17503,7 @@ class TemplateDefinitionBuilder {
|
|
|
17422
17503
|
element.inputs.forEach(input => {
|
|
17423
17504
|
const stylingInputWasSet = stylingBuilder.registerBoundInput(input);
|
|
17424
17505
|
if (!stylingInputWasSet) {
|
|
17425
|
-
if (input.type === 0 /* Property */ && input.i18n) {
|
|
17506
|
+
if (input.type === 0 /* BindingType.Property */ && input.i18n) {
|
|
17426
17507
|
boundI18nAttrs.push(input);
|
|
17427
17508
|
}
|
|
17428
17509
|
else {
|
|
@@ -17495,7 +17576,7 @@ class TemplateDefinitionBuilder {
|
|
|
17495
17576
|
// Generate element input bindings
|
|
17496
17577
|
allOtherInputs.forEach(input => {
|
|
17497
17578
|
const inputType = input.type;
|
|
17498
|
-
if (inputType === 4 /* Animation */) {
|
|
17579
|
+
if (inputType === 4 /* BindingType.Animation */) {
|
|
17499
17580
|
const value = input.value.visit(this._valueConverter);
|
|
17500
17581
|
// animation bindings can be presented in the following formats:
|
|
17501
17582
|
// 1. [@binding]="fooExp"
|
|
@@ -17522,7 +17603,7 @@ class TemplateDefinitionBuilder {
|
|
|
17522
17603
|
if (value !== undefined) {
|
|
17523
17604
|
const params = [];
|
|
17524
17605
|
const [attrNamespace, attrName] = splitNsName(input.name);
|
|
17525
|
-
const isAttributeBinding = inputType === 1 /* Attribute */;
|
|
17606
|
+
const isAttributeBinding = inputType === 1 /* BindingType.Attribute */;
|
|
17526
17607
|
const sanitizationRef = resolveSanitizationFn(input.securityContext, isAttributeBinding);
|
|
17527
17608
|
if (sanitizationRef)
|
|
17528
17609
|
params.push(sanitizationRef);
|
|
@@ -17538,7 +17619,7 @@ class TemplateDefinitionBuilder {
|
|
|
17538
17619
|
}
|
|
17539
17620
|
}
|
|
17540
17621
|
this.allocateBindingSlots(value);
|
|
17541
|
-
if (inputType === 0 /* Property */) {
|
|
17622
|
+
if (inputType === 0 /* BindingType.Property */) {
|
|
17542
17623
|
if (value instanceof Interpolation) {
|
|
17543
17624
|
// prop="{{value}}" and friends
|
|
17544
17625
|
this.interpolatedUpdateInstruction(getPropertyInterpolationExpression(value), elementIndex, attrName, input, value, params);
|
|
@@ -17552,7 +17633,7 @@ class TemplateDefinitionBuilder {
|
|
|
17552
17633
|
});
|
|
17553
17634
|
}
|
|
17554
17635
|
}
|
|
17555
|
-
else if (inputType === 1 /* Attribute */) {
|
|
17636
|
+
else if (inputType === 1 /* BindingType.Attribute */) {
|
|
17556
17637
|
if (value instanceof Interpolation && getInterpolationArgsLength(value) > 1) {
|
|
17557
17638
|
// attr.name="text{{value}}" and friends
|
|
17558
17639
|
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 = Object.assign(Object.assign({}, 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 };
|
|
@@ -19314,10 +19405,10 @@ class CompilerFacadeImpl {
|
|
|
19314
19405
|
internalType: new WrappedNodeExpr(facade.type),
|
|
19315
19406
|
typeArgumentCount: facade.typeArgumentCount,
|
|
19316
19407
|
providedIn: computeProvidedIn(facade.providedIn),
|
|
19317
|
-
useClass: convertToProviderExpression(facade,
|
|
19318
|
-
useFactory: wrapExpression(facade,
|
|
19319
|
-
useValue: convertToProviderExpression(facade,
|
|
19320
|
-
useExisting: convertToProviderExpression(facade,
|
|
19408
|
+
useClass: convertToProviderExpression(facade, 'useClass'),
|
|
19409
|
+
useFactory: wrapExpression(facade, 'useFactory'),
|
|
19410
|
+
useValue: convertToProviderExpression(facade, 'useValue'),
|
|
19411
|
+
useExisting: convertToProviderExpression(facade, 'useExisting'),
|
|
19321
19412
|
deps: (_a = facade.deps) === null || _a === void 0 ? void 0 : _a.map(convertR3DependencyMetadata),
|
|
19322
19413
|
},
|
|
19323
19414
|
/* resolveForwardRefs */ true);
|
|
@@ -19331,10 +19422,10 @@ class CompilerFacadeImpl {
|
|
|
19331
19422
|
internalType: new WrappedNodeExpr(facade.type),
|
|
19332
19423
|
typeArgumentCount: 0,
|
|
19333
19424
|
providedIn: computeProvidedIn(facade.providedIn),
|
|
19334
|
-
useClass: convertToProviderExpression(facade,
|
|
19335
|
-
useFactory: wrapExpression(facade,
|
|
19336
|
-
useValue: convertToProviderExpression(facade,
|
|
19337
|
-
useExisting: convertToProviderExpression(facade,
|
|
19425
|
+
useClass: convertToProviderExpression(facade, 'useClass'),
|
|
19426
|
+
useFactory: wrapExpression(facade, 'useFactory'),
|
|
19427
|
+
useValue: convertToProviderExpression(facade, 'useValue'),
|
|
19428
|
+
useExisting: convertToProviderExpression(facade, 'useExisting'),
|
|
19338
19429
|
deps: (_a = facade.deps) === null || _a === void 0 ? void 0 : _a.map(convertR3DeclareDependencyMetadata),
|
|
19339
19430
|
},
|
|
19340
19431
|
/* resolveForwardRefs */ true);
|
|
@@ -19396,7 +19487,7 @@ class CompilerFacadeImpl {
|
|
|
19396
19487
|
// Parse the template and check for errors.
|
|
19397
19488
|
const { template, interpolation } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation);
|
|
19398
19489
|
// Compile the component metadata, including template, into an expression.
|
|
19399
|
-
const meta = Object.assign(Object.assign(Object.assign({}, facade), convertDirectiveFacadeToMetadata(facade)), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template, declarationListEmitMode: 0 /* Direct */, styles: [...facade.styles, ...template.styles], encapsulation: facade.encapsulation, interpolation, changeDetection: facade.changeDetection, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) :
|
|
19490
|
+
const meta = Object.assign(Object.assign(Object.assign({}, facade), convertDirectiveFacadeToMetadata(facade)), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template, declarations: facade.declarations.map(convertDeclarationFacadeToMetadata), declarationListEmitMode: 0 /* DeclarationListEmitMode.Direct */, styles: [...facade.styles, ...template.styles], encapsulation: facade.encapsulation, interpolation, changeDetection: facade.changeDetection, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) :
|
|
19400
19491
|
null, relativeContextFilePath: '', i18nUseExternalIds: true });
|
|
19401
19492
|
const jitExpressionSourceMap = `ng:///${facade.name}.js`;
|
|
19402
19493
|
return this.compileComponentFromMeta(angularCoreEnv, jitExpressionSourceMap, meta);
|
|
@@ -19459,10 +19550,6 @@ class CompilerFacadeImpl {
|
|
|
19459
19550
|
return res['$def'];
|
|
19460
19551
|
}
|
|
19461
19552
|
}
|
|
19462
|
-
const USE_CLASS = Object.keys({ useClass: null })[0];
|
|
19463
|
-
const USE_FACTORY = Object.keys({ useFactory: null })[0];
|
|
19464
|
-
const USE_VALUE = Object.keys({ useValue: null })[0];
|
|
19465
|
-
const USE_EXISTING = Object.keys({ useExisting: null })[0];
|
|
19466
19553
|
function convertToR3QueryMetadata(facade) {
|
|
19467
19554
|
return Object.assign(Object.assign({}, facade), { predicate: convertQueryPredicate(facade.predicate), read: facade.read ? new WrappedNodeExpr(facade.read) : null, static: facade.static, emitDistinctChangesOnly: facade.emitDistinctChangesOnly });
|
|
19468
19555
|
}
|
|
@@ -19483,7 +19570,7 @@ function convertQueryPredicate(predicate) {
|
|
|
19483
19570
|
// The predicate is an array of strings so pass it through.
|
|
19484
19571
|
predicate :
|
|
19485
19572
|
// The predicate is a type - assume that we will need to unwrap any `forwardRef()` calls.
|
|
19486
|
-
createMayBeForwardRefExpression(new WrappedNodeExpr(predicate), 1 /* Wrapped */);
|
|
19573
|
+
createMayBeForwardRefExpression(new WrappedNodeExpr(predicate), 1 /* ForwardRefHandling.Wrapped */);
|
|
19487
19574
|
}
|
|
19488
19575
|
function convertDirectiveFacadeToMetadata(facade) {
|
|
19489
19576
|
const inputsFromMetadata = parseInputOutputs(facade.inputs || []);
|
|
@@ -19549,19 +19636,43 @@ function convertOpaqueValuesToExpressions(obj) {
|
|
|
19549
19636
|
}
|
|
19550
19637
|
return result;
|
|
19551
19638
|
}
|
|
19552
|
-
function convertDeclareComponentFacadeToMetadata(
|
|
19553
|
-
var _a, _b, _c, _d
|
|
19554
|
-
const { template, interpolation } = parseJitTemplate(
|
|
19555
|
-
|
|
19556
|
-
|
|
19557
|
-
|
|
19558
|
-
|
|
19559
|
-
|
|
19560
|
-
|
|
19561
|
-
|
|
19562
|
-
|
|
19639
|
+
function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
|
|
19640
|
+
var _a, _b, _c, _d;
|
|
19641
|
+
const { template, interpolation } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, (_a = decl.preserveWhitespaces) !== null && _a !== void 0 ? _a : false, decl.interpolation);
|
|
19642
|
+
const declarations = [];
|
|
19643
|
+
if (decl.dependencies) {
|
|
19644
|
+
for (const innerDep of decl.dependencies) {
|
|
19645
|
+
switch (innerDep.kind) {
|
|
19646
|
+
case 'directive':
|
|
19647
|
+
case 'component':
|
|
19648
|
+
declarations.push(convertDirectiveDeclarationToMetadata(innerDep));
|
|
19649
|
+
break;
|
|
19650
|
+
case 'pipe':
|
|
19651
|
+
declarations.push(convertPipeDeclarationToMetadata(innerDep));
|
|
19652
|
+
break;
|
|
19653
|
+
}
|
|
19654
|
+
}
|
|
19655
|
+
}
|
|
19656
|
+
else if (decl.components || decl.directives || decl.pipes) {
|
|
19657
|
+
// Existing declarations on NPM may not be using the new `dependencies` merged field, and may
|
|
19658
|
+
// have separate fields for dependencies instead. Unify them for JIT compilation.
|
|
19659
|
+
decl.components &&
|
|
19660
|
+
declarations.push(...decl.components.map(dir => convertDirectiveDeclarationToMetadata(dir, /* isComponent */ true)));
|
|
19661
|
+
decl.directives &&
|
|
19662
|
+
declarations.push(...decl.directives.map(dir => convertDirectiveDeclarationToMetadata(dir)));
|
|
19663
|
+
decl.pipes && declarations.push(...convertPipeMapToMetadata(decl.pipes));
|
|
19664
|
+
}
|
|
19665
|
+
return Object.assign(Object.assign({}, convertDeclareDirectiveFacadeToMetadata(decl, typeSourceSpan)), { template, styles: (_b = decl.styles) !== null && _b !== void 0 ? _b : [], declarations, viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) :
|
|
19666
|
+
null, animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null, changeDetection: (_c = decl.changeDetection) !== null && _c !== void 0 ? _c : ChangeDetectionStrategy.Default, encapsulation: (_d = decl.encapsulation) !== null && _d !== void 0 ? _d : ViewEncapsulation.Emulated, interpolation, declarationListEmitMode: 2 /* DeclarationListEmitMode.ClosureResolved */, relativeContextFilePath: '', i18nUseExternalIds: true });
|
|
19667
|
+
}
|
|
19668
|
+
function convertDeclarationFacadeToMetadata(declaration) {
|
|
19669
|
+
return Object.assign(Object.assign({}, declaration), { type: new WrappedNodeExpr(declaration.type) });
|
|
19670
|
+
}
|
|
19671
|
+
function convertDirectiveDeclarationToMetadata(declaration, isComponent = null) {
|
|
19563
19672
|
var _a, _b, _c;
|
|
19564
19673
|
return {
|
|
19674
|
+
kind: R3TemplateDependencyKind.Directive,
|
|
19675
|
+
isComponent: isComponent || declaration.kind === 'component',
|
|
19565
19676
|
selector: declaration.selector,
|
|
19566
19677
|
type: new WrappedNodeExpr(declaration.type),
|
|
19567
19678
|
inputs: (_a = declaration.inputs) !== null && _a !== void 0 ? _a : [],
|
|
@@ -19569,16 +19680,24 @@ function convertUsedDirectiveDeclarationToMetadata(declaration) {
|
|
|
19569
19680
|
exportAs: (_c = declaration.exportAs) !== null && _c !== void 0 ? _c : null,
|
|
19570
19681
|
};
|
|
19571
19682
|
}
|
|
19572
|
-
function
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
return pipes;
|
|
19576
|
-
}
|
|
19577
|
-
for (const pipeName of Object.keys(declaredPipes)) {
|
|
19578
|
-
const pipeType = declaredPipes[pipeName];
|
|
19579
|
-
pipes.set(pipeName, new WrappedNodeExpr(pipeType));
|
|
19683
|
+
function convertPipeMapToMetadata(pipes) {
|
|
19684
|
+
if (!pipes) {
|
|
19685
|
+
return [];
|
|
19580
19686
|
}
|
|
19581
|
-
return pipes
|
|
19687
|
+
return Object.keys(pipes).map(name => {
|
|
19688
|
+
return {
|
|
19689
|
+
kind: R3TemplateDependencyKind.Pipe,
|
|
19690
|
+
name,
|
|
19691
|
+
type: new WrappedNodeExpr(pipes[name]),
|
|
19692
|
+
};
|
|
19693
|
+
});
|
|
19694
|
+
}
|
|
19695
|
+
function convertPipeDeclarationToMetadata(pipe) {
|
|
19696
|
+
return {
|
|
19697
|
+
kind: R3TemplateDependencyKind.Pipe,
|
|
19698
|
+
name: pipe.name,
|
|
19699
|
+
type: new WrappedNodeExpr(pipe.type),
|
|
19700
|
+
};
|
|
19582
19701
|
}
|
|
19583
19702
|
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
|
|
19584
19703
|
const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
|
|
@@ -19600,7 +19719,7 @@ function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces,
|
|
|
19600
19719
|
*/
|
|
19601
19720
|
function convertToProviderExpression(obj, property) {
|
|
19602
19721
|
if (obj.hasOwnProperty(property)) {
|
|
19603
|
-
return createMayBeForwardRefExpression(new WrappedNodeExpr(obj[property]), 0 /* None */);
|
|
19722
|
+
return createMayBeForwardRefExpression(new WrappedNodeExpr(obj[property]), 0 /* ForwardRefHandling.None */);
|
|
19604
19723
|
}
|
|
19605
19724
|
else {
|
|
19606
19725
|
return undefined;
|
|
@@ -19618,7 +19737,7 @@ function computeProvidedIn(providedIn) {
|
|
|
19618
19737
|
const expression = typeof providedIn === 'function' ? new WrappedNodeExpr(providedIn) :
|
|
19619
19738
|
new LiteralExpr(providedIn !== null && providedIn !== void 0 ? providedIn : null);
|
|
19620
19739
|
// See `convertToProviderExpression()` for why this uses `ForwardRefHandling.None`.
|
|
19621
|
-
return createMayBeForwardRefExpression(expression, 0 /* None */);
|
|
19740
|
+
return createMayBeForwardRefExpression(expression, 0 /* ForwardRefHandling.None */);
|
|
19622
19741
|
}
|
|
19623
19742
|
function convertR3DependencyMetadataArray(facades) {
|
|
19624
19743
|
return facades == null ? null : facades.map(convertR3DependencyMetadata);
|
|
@@ -19727,7 +19846,7 @@ function publishFacade(global) {
|
|
|
19727
19846
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19728
19847
|
* found in the LICENSE file at https://angular.io/license
|
|
19729
19848
|
*/
|
|
19730
|
-
const VERSION = new Version('14.0.0-
|
|
19849
|
+
const VERSION = new Version('14.0.0-rc.0');
|
|
19731
19850
|
|
|
19732
19851
|
/**
|
|
19733
19852
|
* @license
|
|
@@ -21754,7 +21873,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21754
21873
|
function compileDeclareClassMetadata(metadata) {
|
|
21755
21874
|
const definitionMap = new DefinitionMap();
|
|
21756
21875
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21757
|
-
definitionMap.set('version', literal('14.0.0-
|
|
21876
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
21758
21877
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21759
21878
|
definitionMap.set('type', metadata.type);
|
|
21760
21879
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -21854,7 +21973,7 @@ function compileDependency(dep) {
|
|
|
21854
21973
|
*
|
|
21855
21974
|
* Do not include any prerelease in these versions as they are ignored.
|
|
21856
21975
|
*/
|
|
21857
|
-
const MINIMUM_PARTIAL_LINKER_VERSION$5 = '
|
|
21976
|
+
const MINIMUM_PARTIAL_LINKER_VERSION$5 = '14.0.0';
|
|
21858
21977
|
/**
|
|
21859
21978
|
* Compile a directive declaration defined by the `R3DirectiveMetadata`.
|
|
21860
21979
|
*/
|
|
@@ -21871,9 +21990,12 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
21871
21990
|
function createDirectiveDefinitionMap(meta) {
|
|
21872
21991
|
const definitionMap = new DefinitionMap();
|
|
21873
21992
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
21874
|
-
definitionMap.set('version', literal('14.0.0-
|
|
21993
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
21875
21994
|
// e.g. `type: MyDirective`
|
|
21876
21995
|
definitionMap.set('type', meta.internalType);
|
|
21996
|
+
if (meta.isStandalone) {
|
|
21997
|
+
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
21998
|
+
}
|
|
21877
21999
|
// e.g. `selector: 'some-dir'`
|
|
21878
22000
|
if (meta.selector !== null) {
|
|
21879
22001
|
definitionMap.set('selector', literal(meta.selector));
|
|
@@ -21978,9 +22100,7 @@ function createComponentDefinitionMap(meta, template, templateInfo) {
|
|
|
21978
22100
|
definitionMap.set('isInline', literal(true));
|
|
21979
22101
|
}
|
|
21980
22102
|
definitionMap.set('styles', toOptionalLiteralArray(meta.styles, literal));
|
|
21981
|
-
definitionMap.set('
|
|
21982
|
-
definitionMap.set('directives', compileUsedDirectiveMetadata(meta, directive => directive.isComponent !== true));
|
|
21983
|
-
definitionMap.set('pipes', compileUsedPipeMetadata(meta));
|
|
22103
|
+
definitionMap.set('dependencies', compileUsedDependenciesMetadata(meta));
|
|
21984
22104
|
definitionMap.set('viewProviders', meta.viewProviders);
|
|
21985
22105
|
definitionMap.set('animations', meta.animations);
|
|
21986
22106
|
if (meta.changeDetection !== undefined) {
|
|
@@ -22036,43 +22156,35 @@ function computeEndLocation(file, contents) {
|
|
|
22036
22156
|
} while (lineStart !== -1);
|
|
22037
22157
|
return new ParseLocation(file, length, line, length - lastLineStart);
|
|
22038
22158
|
}
|
|
22039
|
-
|
|
22040
|
-
|
|
22041
|
-
* individual directives. If the component does not use any directives, then null is returned.
|
|
22042
|
-
*/
|
|
22043
|
-
function compileUsedDirectiveMetadata(meta, predicate) {
|
|
22044
|
-
const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
|
22159
|
+
function compileUsedDependenciesMetadata(meta) {
|
|
22160
|
+
const wrapType = meta.declarationListEmitMode !== 0 /* DeclarationListEmitMode.Direct */ ?
|
|
22045
22161
|
generateForwardRef :
|
|
22046
22162
|
(expr) => expr;
|
|
22047
|
-
|
|
22048
|
-
|
|
22049
|
-
|
|
22050
|
-
|
|
22051
|
-
|
|
22052
|
-
|
|
22053
|
-
|
|
22054
|
-
|
|
22055
|
-
|
|
22163
|
+
return toOptionalLiteralArray(meta.declarations, decl => {
|
|
22164
|
+
switch (decl.kind) {
|
|
22165
|
+
case R3TemplateDependencyKind.Directive:
|
|
22166
|
+
const dirMeta = new DefinitionMap();
|
|
22167
|
+
dirMeta.set('kind', literal(decl.isComponent ? 'component' : 'directive'));
|
|
22168
|
+
dirMeta.set('type', wrapType(decl.type));
|
|
22169
|
+
dirMeta.set('selector', literal(decl.selector));
|
|
22170
|
+
dirMeta.set('inputs', toOptionalLiteralArray(decl.inputs, literal));
|
|
22171
|
+
dirMeta.set('outputs', toOptionalLiteralArray(decl.outputs, literal));
|
|
22172
|
+
dirMeta.set('exportAs', toOptionalLiteralArray(decl.exportAs, literal));
|
|
22173
|
+
return dirMeta.toLiteralMap();
|
|
22174
|
+
case R3TemplateDependencyKind.Pipe:
|
|
22175
|
+
const pipeMeta = new DefinitionMap();
|
|
22176
|
+
pipeMeta.set('kind', literal('pipe'));
|
|
22177
|
+
pipeMeta.set('type', wrapType(decl.type));
|
|
22178
|
+
pipeMeta.set('name', literal(decl.name));
|
|
22179
|
+
return pipeMeta.toLiteralMap();
|
|
22180
|
+
case R3TemplateDependencyKind.NgModule:
|
|
22181
|
+
const ngModuleMeta = new DefinitionMap();
|
|
22182
|
+
ngModuleMeta.set('kind', literal('ngmodule'));
|
|
22183
|
+
ngModuleMeta.set('type', wrapType(decl.type));
|
|
22184
|
+
return ngModuleMeta.toLiteralMap();
|
|
22185
|
+
}
|
|
22056
22186
|
});
|
|
22057
22187
|
}
|
|
22058
|
-
/**
|
|
22059
|
-
* Compiles the pipes as registered in the component metadata into an object literal, where the
|
|
22060
|
-
* pipe's name is used as key and a reference to its type as value. If the component does not use
|
|
22061
|
-
* any pipes, then null is returned.
|
|
22062
|
-
*/
|
|
22063
|
-
function compileUsedPipeMetadata(meta) {
|
|
22064
|
-
if (meta.pipes.size === 0) {
|
|
22065
|
-
return null;
|
|
22066
|
-
}
|
|
22067
|
-
const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
|
22068
|
-
generateForwardRef :
|
|
22069
|
-
(expr) => expr;
|
|
22070
|
-
const entries = [];
|
|
22071
|
-
for (const [name, pipe] of meta.pipes) {
|
|
22072
|
-
entries.push({ key: name, value: wrapType(pipe), quoted: true });
|
|
22073
|
-
}
|
|
22074
|
-
return literalMap(entries);
|
|
22075
|
-
}
|
|
22076
22188
|
|
|
22077
22189
|
/**
|
|
22078
22190
|
* @license
|
|
@@ -22092,7 +22204,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22092
22204
|
function compileDeclareFactoryFunction(meta) {
|
|
22093
22205
|
const definitionMap = new DefinitionMap();
|
|
22094
22206
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22095
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22207
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
22096
22208
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22097
22209
|
definitionMap.set('type', meta.internalType);
|
|
22098
22210
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22134,7 +22246,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22134
22246
|
function createInjectableDefinitionMap(meta) {
|
|
22135
22247
|
const definitionMap = new DefinitionMap();
|
|
22136
22248
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22137
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22249
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
22138
22250
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22139
22251
|
definitionMap.set('type', meta.internalType);
|
|
22140
22252
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22192,7 +22304,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22192
22304
|
function createInjectorDefinitionMap(meta) {
|
|
22193
22305
|
const definitionMap = new DefinitionMap();
|
|
22194
22306
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22195
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22307
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
22196
22308
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22197
22309
|
definitionMap.set('type', meta.internalType);
|
|
22198
22310
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22216,7 +22328,7 @@ function createInjectorDefinitionMap(meta) {
|
|
|
22216
22328
|
*
|
|
22217
22329
|
* Do not include any prerelease in these versions as they are ignored.
|
|
22218
22330
|
*/
|
|
22219
|
-
const MINIMUM_PARTIAL_LINKER_VERSION$1 = '
|
|
22331
|
+
const MINIMUM_PARTIAL_LINKER_VERSION$1 = '14.0.0';
|
|
22220
22332
|
function compileDeclareNgModuleFromMetadata(meta) {
|
|
22221
22333
|
const definitionMap = createNgModuleDefinitionMap(meta);
|
|
22222
22334
|
const expression = importExpr(Identifiers.declareNgModule).callFn([definitionMap.toLiteralMap()]);
|
|
@@ -22229,7 +22341,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22229
22341
|
function createNgModuleDefinitionMap(meta) {
|
|
22230
22342
|
const definitionMap = new DefinitionMap();
|
|
22231
22343
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22232
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22344
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
22233
22345
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22234
22346
|
definitionMap.set('type', meta.internalType);
|
|
22235
22347
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22271,7 +22383,7 @@ function createNgModuleDefinitionMap(meta) {
|
|
|
22271
22383
|
*
|
|
22272
22384
|
* Do not include any prerelease in these versions as they are ignored.
|
|
22273
22385
|
*/
|
|
22274
|
-
const MINIMUM_PARTIAL_LINKER_VERSION = '
|
|
22386
|
+
const MINIMUM_PARTIAL_LINKER_VERSION = '14.0.0';
|
|
22275
22387
|
/**
|
|
22276
22388
|
* Compile a Pipe declaration defined by the `R3PipeMetadata`.
|
|
22277
22389
|
*/
|
|
@@ -22287,10 +22399,13 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22287
22399
|
function createPipeDefinitionMap(meta) {
|
|
22288
22400
|
const definitionMap = new DefinitionMap();
|
|
22289
22401
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22290
|
-
definitionMap.set('version', literal('14.0.0-
|
|
22402
|
+
definitionMap.set('version', literal('14.0.0-rc.0'));
|
|
22291
22403
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22292
22404
|
// e.g. `type: MyPipe`
|
|
22293
22405
|
definitionMap.set('type', meta.internalType);
|
|
22406
|
+
if (meta.isStandalone) {
|
|
22407
|
+
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
22408
|
+
}
|
|
22294
22409
|
// e.g. `name: "myPipe"`
|
|
22295
22410
|
definitionMap.set('name', literal(meta.pipeName));
|
|
22296
22411
|
if (meta.pure === false) {
|
|
@@ -22337,5 +22452,5 @@ publishFacade(_global);
|
|
|
22337
22452
|
* found in the LICENSE file at https://angular.io/license
|
|
22338
22453
|
*/
|
|
22339
22454
|
|
|
22340
|
-
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 };
|
|
22455
|
+
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 };
|
|
22341
22456
|
//# sourceMappingURL=compiler.mjs.map
|