@angular/compiler 14.0.0-next.5 → 14.0.0-next.8

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (37) hide show
  1. package/esm2020/src/compiler.mjs +2 -2
  2. package/esm2020/src/expression_parser/parser.mjs +43 -5
  3. package/esm2020/src/jit_compiler_facade.mjs +3 -3
  4. package/esm2020/src/ml_parser/lexer.mjs +2 -2
  5. package/esm2020/src/parse_util.mjs +2 -2
  6. package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
  7. package/esm2020/src/render3/partial/directive.mjs +1 -1
  8. package/esm2020/src/render3/partial/factory.mjs +1 -1
  9. package/esm2020/src/render3/partial/injectable.mjs +1 -1
  10. package/esm2020/src/render3/partial/injector.mjs +1 -1
  11. package/esm2020/src/render3/partial/ng_module.mjs +1 -1
  12. package/esm2020/src/render3/partial/pipe.mjs +1 -1
  13. package/esm2020/src/render3/r3_identifiers.mjs +3 -1
  14. package/esm2020/src/render3/r3_module_compiler.mjs +45 -8
  15. package/esm2020/src/render3/r3_template_transform.mjs +6 -6
  16. package/esm2020/src/render3/view/style_parser.mjs +2 -2
  17. package/esm2020/src/render3/view/styling_builder.mjs +3 -3
  18. package/esm2020/src/render3/view/template.mjs +21 -8
  19. package/esm2020/src/selector.mjs +3 -3
  20. package/esm2020/src/shadow_css.mjs +2 -2
  21. package/esm2020/src/template_parser/binding_parser.mjs +6 -6
  22. package/esm2020/src/version.mjs +1 -1
  23. package/fesm2015/compiler.mjs +139 -47
  24. package/fesm2015/compiler.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +1 -1
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2020/compiler.mjs +137 -47
  28. package/fesm2020/compiler.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +1 -1
  30. package/fesm2020/testing.mjs.map +1 -1
  31. package/package.json +10 -2
  32. package/src/compiler.d.ts +1 -1
  33. package/src/expression_parser/parser.d.ts +3 -2
  34. package/src/render3/r3_identifiers.d.ts +2 -0
  35. package/src/render3/r3_module_compiler.d.ts +30 -4
  36. package/src/render3/view/template.d.ts +1 -1
  37. package/src/template_parser/binding_parser.d.ts +3 -2
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.5
2
+ * @license Angular v14.0.0-next.8
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -224,11 +224,11 @@ class CssSelector {
224
224
  const prefix = match[3 /* PREFIX */];
225
225
  if (prefix === '#') {
226
226
  // #hash
227
- current.addAttribute('id', tag.substr(1));
227
+ current.addAttribute('id', tag.slice(1));
228
228
  }
229
229
  else if (prefix === '.') {
230
230
  // Class
231
- current.addClassName(tag.substr(1));
231
+ current.addClassName(tag.slice(1));
232
232
  }
233
233
  else {
234
234
  // Element
@@ -2800,6 +2800,7 @@ Identifiers.stylePropInterpolate7 = { name: 'ɵɵstylePropInterpolate7', moduleN
2800
2800
  Identifiers.stylePropInterpolate8 = { name: 'ɵɵstylePropInterpolate8', moduleName: CORE };
2801
2801
  Identifiers.stylePropInterpolateV = { name: 'ɵɵstylePropInterpolateV', moduleName: CORE };
2802
2802
  Identifiers.nextContext = { name: 'ɵɵnextContext', moduleName: CORE };
2803
+ Identifiers.resetView = { name: 'ɵɵresetView', moduleName: CORE };
2803
2804
  Identifiers.templateCreate = { name: 'ɵɵtemplate', moduleName: CORE };
2804
2805
  Identifiers.text = { name: 'ɵɵtext', moduleName: CORE };
2805
2806
  Identifiers.enableBindings = { name: 'ɵɵenableBindings', moduleName: CORE };
@@ -2910,6 +2911,7 @@ Identifiers.ModuleWithProviders = {
2910
2911
  Identifiers.defineNgModule = { name: 'ɵɵdefineNgModule', moduleName: CORE };
2911
2912
  Identifiers.declareNgModule = { name: 'ɵɵngDeclareNgModule', moduleName: CORE };
2912
2913
  Identifiers.setNgModuleScope = { name: 'ɵɵsetNgModuleScope', moduleName: CORE };
2914
+ Identifiers.registerNgModuleType = { name: 'ɵɵregisterNgModuleType', moduleName: CORE };
2913
2915
  Identifiers.PipeDeclaration = { name: 'ɵɵPipeDeclaration', moduleName: CORE };
2914
2916
  Identifiers.definePipe = { name: 'ɵɵdefinePipe', moduleName: CORE };
2915
2917
  Identifiers.declarePipe = { name: 'ɵɵngDeclarePipe', moduleName: CORE };
@@ -5416,7 +5418,7 @@ class ParseLocation {
5416
5418
  const ch = source.charCodeAt(offset);
5417
5419
  if (ch == $LF) {
5418
5420
  line--;
5419
- const priorLine = source.substr(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
5421
+ const priorLine = source.substring(0, offset - 1).lastIndexOf(String.fromCharCode($LF));
5420
5422
  col = priorLine > 0 ? offset - priorLine : offset;
5421
5423
  }
5422
5424
  else {
@@ -5971,20 +5973,49 @@ class R3JitReflector {
5971
5973
  * Use of this source code is governed by an MIT-style license that can be
5972
5974
  * found in the LICENSE file at https://angular.io/license
5973
5975
  */
5976
+ /**
5977
+ * How the selector scope of an NgModule (its declarations, imports, and exports) should be emitted
5978
+ * as a part of the NgModule definition.
5979
+ */
5980
+ var R3SelectorScopeMode;
5981
+ (function (R3SelectorScopeMode) {
5982
+ /**
5983
+ * Emit the declarations inline into the module definition.
5984
+ *
5985
+ * This option is useful in certain contexts where it's known that JIT support is required. The
5986
+ * tradeoff here is that this emit style prevents directives and pipes from being tree-shaken if
5987
+ * they are unused, but the NgModule is used.
5988
+ */
5989
+ R3SelectorScopeMode[R3SelectorScopeMode["Inline"] = 0] = "Inline";
5990
+ /**
5991
+ * Emit the declarations using a side effectful function call, `ɵɵsetNgModuleScope`, that is
5992
+ * guarded with the `ngJitMode` flag.
5993
+ *
5994
+ * This form of emit supports JIT and can be optimized away if the `ngJitMode` flag is set to
5995
+ * false, which allows unused directives and pipes to be tree-shaken.
5996
+ */
5997
+ R3SelectorScopeMode[R3SelectorScopeMode["SideEffect"] = 1] = "SideEffect";
5998
+ /**
5999
+ * Don't generate selector scopes at all.
6000
+ *
6001
+ * This is useful for contexts where JIT support is known to be unnecessary.
6002
+ */
6003
+ R3SelectorScopeMode[R3SelectorScopeMode["Omit"] = 2] = "Omit";
6004
+ })(R3SelectorScopeMode || (R3SelectorScopeMode = {}));
5974
6005
  /**
5975
6006
  * Construct an `R3NgModuleDef` for the given `R3NgModuleMetadata`.
5976
6007
  */
5977
6008
  function compileNgModule(meta) {
5978
- const { internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, emitInline, id } = meta;
6009
+ const { adjacentType, internalType, bootstrap, declarations, imports, exports, schemas, containsForwardDecls, selectorScopeMode, id } = meta;
5979
6010
  const statements = [];
5980
6011
  const definitionMap = new DefinitionMap();
5981
6012
  definitionMap.set('type', internalType);
5982
6013
  if (bootstrap.length > 0) {
5983
6014
  definitionMap.set('bootstrap', refsToArray(bootstrap, containsForwardDecls));
5984
6015
  }
5985
- // If requested to emit scope information inline, pass the `declarations`, `imports` and `exports`
5986
- // to the `ɵɵdefineNgModule()` call. The JIT compilation uses this.
5987
- if (emitInline) {
6016
+ if (selectorScopeMode === R3SelectorScopeMode.Inline) {
6017
+ // If requested to emit scope information inline, pass the `declarations`, `imports` and
6018
+ // `exports` to the `ɵɵdefineNgModule()` call directly.
5988
6019
  if (declarations.length > 0) {
5989
6020
  definitionMap.set('declarations', refsToArray(declarations, containsForwardDecls));
5990
6021
  }
@@ -5995,19 +6026,27 @@ function compileNgModule(meta) {
5995
6026
  definitionMap.set('exports', refsToArray(exports, containsForwardDecls));
5996
6027
  }
5997
6028
  }
5998
- // If not emitting inline, the scope information is not passed into `ɵɵdefineNgModule` as it would
5999
- // prevent tree-shaking of the declarations, imports and exports references.
6000
- else {
6029
+ else if (selectorScopeMode === R3SelectorScopeMode.SideEffect) {
6030
+ // In this mode, scope information is not passed into `ɵɵdefineNgModule` as it
6031
+ // would prevent tree-shaking of the declarations, imports and exports references. Instead, it's
6032
+ // patched onto the NgModule definition with a `ɵɵsetNgModuleScope` call that's guarded by the
6033
+ // `ngJitMode` flag.
6001
6034
  const setNgModuleScopeCall = generateSetNgModuleScopeCall(meta);
6002
6035
  if (setNgModuleScopeCall !== null) {
6003
6036
  statements.push(setNgModuleScopeCall);
6004
6037
  }
6005
6038
  }
6039
+ else {
6040
+ // Selector scope emit was not requested, so skip it.
6041
+ }
6006
6042
  if (schemas !== null && schemas.length > 0) {
6007
6043
  definitionMap.set('schemas', literalArr(schemas.map(ref => ref.value)));
6008
6044
  }
6009
6045
  if (id !== null) {
6010
6046
  definitionMap.set('id', id);
6047
+ // Generate a side-effectful call to register this NgModule by its id, as per the semantics of
6048
+ // NgModule ids.
6049
+ statements.push(importExpr(Identifiers.registerNgModuleType).callFn([adjacentType, id]).toStmt());
6011
6050
  }
6012
6051
  const expression = importExpr(Identifiers.defineNgModule).callFn([definitionMap.toLiteralMap()], undefined, true);
6013
6052
  const type = createNgModuleType(meta);
@@ -7957,7 +7996,7 @@ class ShadowCss {
7957
7996
  this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling);
7958
7997
  }
7959
7998
  else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
7960
- rule.selector.startsWith('@document')) {
7999
+ rule.selector.startsWith('@document') || rule.selector.startsWith('@layer')) {
7961
8000
  content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
7962
8001
  }
7963
8002
  else if (rule.selector.startsWith('@font-face') || rule.selector.startsWith('@page')) {
@@ -8420,7 +8459,7 @@ function parse(value) {
8420
8459
  }
8421
8460
  }
8422
8461
  if (currentProp && valueStart) {
8423
- const styleVal = value.substr(valueStart).trim();
8462
+ const styleVal = value.slice(valueStart).trim();
8424
8463
  styles.push(currentProp, valueHasQuotes ? stripUnnecessaryQuotes(styleVal) : styleVal);
8425
8464
  }
8426
8465
  return styles;
@@ -8598,7 +8637,7 @@ class StylingBuilder {
8598
8637
  const isClass = !isStyle && (name === 'class' || prefix === 'class.' || prefix === 'class!');
8599
8638
  if (isStyle || isClass) {
8600
8639
  const isMapBased = name.charAt(5) !== '.'; // style.prop or class.prop makes this a no
8601
- const property = name.substr(isMapBased ? 5 : 6); // the dot explains why there's a +1
8640
+ const property = name.slice(isMapBased ? 5 : 6); // the dot explains why there's a +1
8602
8641
  if (isStyle) {
8603
8642
  binding = this.registerStyleInput(property, isMapBased, expression, sourceSpan);
8604
8643
  }
@@ -8872,7 +8911,7 @@ function parseProperty(name) {
8872
8911
  let property = name;
8873
8912
  const unitIndex = name.lastIndexOf('.');
8874
8913
  if (unitIndex > 0) {
8875
- suffix = name.substr(unitIndex + 1);
8914
+ suffix = name.slice(unitIndex + 1);
8876
8915
  property = name.substring(0, unitIndex);
8877
8916
  }
8878
8917
  return { property, suffix, hasOverrideFlag };
@@ -9491,8 +9530,8 @@ class Parser$1 {
9491
9530
  span: new AbsoluteSourceSpan(absoluteKeyOffset, absoluteKeyOffset + templateKey.length),
9492
9531
  });
9493
9532
  }
9494
- parseInterpolation(input, location, absoluteOffset, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9495
- const { strings, expressions, offsets } = this.splitInterpolation(input, location, interpolationConfig);
9533
+ parseInterpolation(input, location, absoluteOffset, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9534
+ const { strings, expressions, offsets } = this.splitInterpolation(input, location, interpolatedTokens, interpolationConfig);
9496
9535
  if (expressions.length === 0)
9497
9536
  return null;
9498
9537
  const expressionNodes = [];
@@ -9531,10 +9570,12 @@ class Parser$1 {
9531
9570
  * `SplitInterpolation` with splits that look like
9532
9571
  * <raw text> <expression> <raw text> ... <raw text> <expression> <raw text>
9533
9572
  */
9534
- splitInterpolation(input, location, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9573
+ splitInterpolation(input, location, interpolatedTokens, interpolationConfig = DEFAULT_INTERPOLATION_CONFIG) {
9574
+ var _a;
9535
9575
  const strings = [];
9536
9576
  const expressions = [];
9537
9577
  const offsets = [];
9578
+ const inputToTemplateIndexMap = interpolatedTokens ? getIndexMapForOriginalTemplate(interpolatedTokens) : null;
9538
9579
  let i = 0;
9539
9580
  let atInterpolation = false;
9540
9581
  let extendLastString = false;
@@ -9569,7 +9610,9 @@ class Parser$1 {
9569
9610
  this._reportError('Blank expressions are not allowed in interpolated strings', input, `at column ${i} in`, location);
9570
9611
  }
9571
9612
  expressions.push({ text, start: fullStart, end: fullEnd });
9572
- offsets.push(exprStart);
9613
+ const startInOriginalTemplate = (_a = inputToTemplateIndexMap === null || inputToTemplateIndexMap === void 0 ? void 0 : inputToTemplateIndexMap.get(fullStart)) !== null && _a !== void 0 ? _a : fullStart;
9614
+ const offset = startInOriginalTemplate + interpStart.length;
9615
+ offsets.push(offset);
9573
9616
  i = fullEnd;
9574
9617
  atInterpolation = false;
9575
9618
  }
@@ -10578,6 +10621,41 @@ class SimpleExpressionChecker extends RecursiveAstVisitor {
10578
10621
  this.errors.push('pipes');
10579
10622
  }
10580
10623
  }
10624
+ /**
10625
+ * Computes the real offset in the original template for indexes in an interpolation.
10626
+ *
10627
+ * Because templates can have encoded HTML entities and the input passed to the parser at this stage
10628
+ * of the compiler is the _decoded_ value, we need to compute the real offset using the original
10629
+ * encoded values in the interpolated tokens. Note that this is only a special case handling for
10630
+ * `MlParserTokenType.ENCODED_ENTITY` token types. All other interpolated tokens are expected to
10631
+ * have parts which exactly match the input string for parsing the interpolation.
10632
+ *
10633
+ * @param interpolatedTokens The tokens for the interpolated value.
10634
+ *
10635
+ * @returns A map of index locations in the decoded template to indexes in the original template
10636
+ */
10637
+ function getIndexMapForOriginalTemplate(interpolatedTokens) {
10638
+ let offsetMap = new Map();
10639
+ let consumedInOriginalTemplate = 0;
10640
+ let consumedInInput = 0;
10641
+ let tokenIndex = 0;
10642
+ while (tokenIndex < interpolatedTokens.length) {
10643
+ const currentToken = interpolatedTokens[tokenIndex];
10644
+ if (currentToken.type === 9 /* ENCODED_ENTITY */) {
10645
+ const [decoded, encoded] = currentToken.parts;
10646
+ consumedInOriginalTemplate += encoded.length;
10647
+ consumedInInput += decoded.length;
10648
+ }
10649
+ else {
10650
+ const lengthOfParts = currentToken.parts.reduce((sum, current) => sum + current.length, 0);
10651
+ consumedInInput += lengthOfParts;
10652
+ consumedInOriginalTemplate += lengthOfParts;
10653
+ }
10654
+ offsetMap.set(consumedInInput, consumedInOriginalTemplate);
10655
+ tokenIndex++;
10656
+ }
10657
+ return offsetMap;
10658
+ }
10581
10659
 
10582
10660
  /**
10583
10661
  * @license
@@ -13819,7 +13897,7 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
13819
13897
  }
13820
13898
  }
13821
13899
  decodeHexDigits(start, length) {
13822
- const hex = this.input.substr(start.internalState.offset, length);
13900
+ const hex = this.input.slice(start.internalState.offset, start.internalState.offset + length);
13823
13901
  const charCode = parseInt(hex, 16);
13824
13902
  if (!isNaN(charCode)) {
13825
13903
  return charCode;
@@ -14984,11 +15062,11 @@ class BindingParser {
14984
15062
  }
14985
15063
  return targetEvents;
14986
15064
  }
14987
- parseInterpolation(value, sourceSpan) {
15065
+ parseInterpolation(value, sourceSpan, interpolatedTokens) {
14988
15066
  const sourceInfo = sourceSpan.start.toString();
14989
15067
  const absoluteOffset = sourceSpan.fullStart.offset;
14990
15068
  try {
14991
- const ast = this._exprParser.parseInterpolation(value, sourceInfo, absoluteOffset, this._interpolationConfig);
15069
+ const ast = this._exprParser.parseInterpolation(value, sourceInfo, absoluteOffset, interpolatedTokens, this._interpolationConfig);
14992
15070
  if (ast)
14993
15071
  this._reportExpressionParserErrors(ast.errors, sourceSpan);
14994
15072
  return ast;
@@ -15125,8 +15203,8 @@ class BindingParser {
15125
15203
  this._parsePropertyAst(name, this._parseBinding(expression, isHost, valueSpan || sourceSpan, absoluteOffset), sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
15126
15204
  }
15127
15205
  }
15128
- parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan) {
15129
- const expr = this.parseInterpolation(value, valueSpan || sourceSpan);
15206
+ parsePropertyInterpolation(name, value, sourceSpan, valueSpan, targetMatchableAttrs, targetProps, keySpan, interpolatedTokens) {
15207
+ const expr = this.parseInterpolation(value, valueSpan || sourceSpan, interpolatedTokens);
15130
15208
  if (expr) {
15131
15209
  this._parsePropertyAst(name, expr, sourceSpan, keySpan, valueSpan, targetMatchableAttrs, targetProps);
15132
15210
  return true;
@@ -15218,7 +15296,7 @@ class BindingParser {
15218
15296
  this._reportError(`Event name is missing in binding`, sourceSpan);
15219
15297
  }
15220
15298
  if (isAnimationLabel(name)) {
15221
- name = name.substr(1);
15299
+ name = name.slice(1);
15222
15300
  if (keySpan !== undefined) {
15223
15301
  keySpan = moveParseSourceSpan(keySpan, new AbsoluteSourceSpan(keySpan.start.offset + 1, keySpan.end.offset));
15224
15302
  }
@@ -15623,7 +15701,7 @@ class HtmlAstToIvyAst {
15623
15701
  return new TextAttribute(attribute.name, attribute.value, attribute.sourceSpan, attribute.keySpan, attribute.valueSpan, attribute.i18n);
15624
15702
  }
15625
15703
  visitText(text) {
15626
- return this._visitTextWithInterpolation(text.value, text.sourceSpan, text.i18n);
15704
+ return this._visitTextWithInterpolation(text.value, text.sourceSpan, text.tokens, text.i18n);
15627
15705
  }
15628
15706
  visitExpansion(expansion) {
15629
15707
  if (!expansion.i18n) {
@@ -15653,7 +15731,7 @@ class HtmlAstToIvyAst {
15653
15731
  vars[formattedKey] = new BoundText(ast, value.sourceSpan);
15654
15732
  }
15655
15733
  else {
15656
- placeholders[key] = this._visitTextWithInterpolation(value.text, value.sourceSpan);
15734
+ placeholders[key] = this._visitTextWithInterpolation(value.text, value.sourceSpan, null);
15657
15735
  }
15658
15736
  });
15659
15737
  return new Icu$1(vars, placeholders, expansion.sourceSpan, message);
@@ -15687,6 +15765,7 @@ class HtmlAstToIvyAst {
15687
15765
  return { bound, literal };
15688
15766
  }
15689
15767
  parseAttribute(isTemplateElement, attribute, matchableAttributes, parsedProperties, boundEvents, variables, references) {
15768
+ var _a;
15690
15769
  const name = normalizeAttributeName(attribute.name);
15691
15770
  const value = attribute.value;
15692
15771
  const srcSpan = attribute.sourceSpan;
@@ -15776,12 +15855,12 @@ class HtmlAstToIvyAst {
15776
15855
  }
15777
15856
  // No explicit binding found.
15778
15857
  const keySpan = createKeySpan(srcSpan, '' /* prefix */, name);
15779
- const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan);
15858
+ const hasBinding = this.bindingParser.parsePropertyInterpolation(name, value, srcSpan, attribute.valueSpan, matchableAttributes, parsedProperties, keySpan, (_a = attribute.valueTokens) !== null && _a !== void 0 ? _a : null);
15780
15859
  return hasBinding;
15781
15860
  }
15782
- _visitTextWithInterpolation(value, sourceSpan, i18n) {
15861
+ _visitTextWithInterpolation(value, sourceSpan, interpolatedTokens, i18n) {
15783
15862
  const valueNoNgsp = replaceNgsp(value);
15784
- const expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan);
15863
+ const expr = this.bindingParser.parseInterpolation(valueNoNgsp, sourceSpan, interpolatedTokens);
15785
15864
  return expr ? new BoundText(expr, sourceSpan, i18n) : new Text$3(valueNoNgsp, sourceSpan);
15786
15865
  }
15787
15866
  parseVariable(identifier, value, sourceSpan, keySpan, valueSpan, variables) {
@@ -16875,13 +16954,27 @@ function prepareEventListenerParameters(eventAst, handlerName = null, scope = nu
16875
16954
  scope.getOrCreateSharedContextVar(0);
16876
16955
  const bindingStatements = convertActionBinding(scope, implicitReceiverExpr, handler, 'b', eventAst.handlerSpan, implicitReceiverAccesses, EVENT_BINDING_SCOPE_GLOBALS);
16877
16956
  const statements = [];
16878
- if (scope) {
16957
+ const variableDeclarations = scope === null || scope === void 0 ? void 0 : scope.variableDeclarations();
16958
+ const restoreViewStatement = scope === null || scope === void 0 ? void 0 : scope.restoreViewStatement();
16959
+ if (variableDeclarations) {
16879
16960
  // `variableDeclarations` needs to run first, because
16880
16961
  // `restoreViewStatement` depends on the result.
16881
- statements.push(...scope.variableDeclarations());
16882
- statements.unshift(...scope.restoreViewStatement());
16962
+ statements.push(...variableDeclarations);
16883
16963
  }
16884
16964
  statements.push(...bindingStatements);
16965
+ if (restoreViewStatement) {
16966
+ statements.unshift(restoreViewStatement);
16967
+ // If there's a `restoreView` call, we need to reset the view at the end of the listener
16968
+ // in order to avoid a leak. If there's a `return` statement already, we wrap it in the
16969
+ // call, e.g. `return resetView(ctx.foo())`. Otherwise we add the call as the last statement.
16970
+ const lastStatement = statements[statements.length - 1];
16971
+ if (lastStatement instanceof ReturnStatement) {
16972
+ statements[statements.length - 1] = new ReturnStatement(invokeInstruction(lastStatement.value.sourceSpan, Identifiers.resetView, [lastStatement.value]));
16973
+ }
16974
+ else {
16975
+ statements.push(new ExpressionStatement(invokeInstruction(null, Identifiers.resetView, [])));
16976
+ }
16977
+ }
16885
16978
  const eventName = type === 1 /* Animation */ ? prepareSyntheticListenerName(name, phase) : name;
16886
16979
  const fnName = handlerName && sanitizeIdentifier(handlerName);
16887
16980
  const fnArgs = [];
@@ -18213,16 +18306,15 @@ class BindingScope {
18213
18306
  }
18214
18307
  }
18215
18308
  restoreViewStatement() {
18216
- const statements = [];
18217
18309
  if (this.restoreViewVariable) {
18218
18310
  const restoreCall = invokeInstruction(null, Identifiers.restoreView, [this.restoreViewVariable]);
18219
18311
  // Either `const restoredCtx = restoreView($state$);` or `restoreView($state$);`
18220
18312
  // depending on whether it is being used.
18221
- statements.push(this.usesRestoredViewContext ?
18313
+ return this.usesRestoredViewContext ?
18222
18314
  variable(RESTORED_VIEW_CONTEXT_NAME).set(restoreCall).toConstDecl() :
18223
- restoreCall.toStmt());
18315
+ restoreCall.toStmt();
18224
18316
  }
18225
- return statements;
18317
+ return null;
18226
18318
  }
18227
18319
  viewSnapshotStatements() {
18228
18320
  // const $state$ = getCurrentView();
@@ -19273,7 +19365,7 @@ class CompilerFacadeImpl {
19273
19365
  declarations: facade.declarations.map(wrapReference),
19274
19366
  imports: facade.imports.map(wrapReference),
19275
19367
  exports: facade.exports.map(wrapReference),
19276
- emitInline: true,
19368
+ selectorScopeMode: R3SelectorScopeMode.Inline,
19277
19369
  containsForwardDecls: false,
19278
19370
  schemas: facade.schemas ? facade.schemas.map(wrapReference) : null,
19279
19371
  id: facade.id ? new WrappedNodeExpr(facade.id) : null,
@@ -19635,7 +19727,7 @@ function publishFacade(global) {
19635
19727
  * Use of this source code is governed by an MIT-style license that can be
19636
19728
  * found in the LICENSE file at https://angular.io/license
19637
19729
  */
19638
- const VERSION = new Version('14.0.0-next.5');
19730
+ const VERSION = new Version('14.0.0-next.8');
19639
19731
 
19640
19732
  /**
19641
19733
  * @license
@@ -21662,7 +21754,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21662
21754
  function compileDeclareClassMetadata(metadata) {
21663
21755
  const definitionMap = new DefinitionMap();
21664
21756
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21665
- definitionMap.set('version', literal('14.0.0-next.5'));
21757
+ definitionMap.set('version', literal('14.0.0-next.8'));
21666
21758
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21667
21759
  definitionMap.set('type', metadata.type);
21668
21760
  definitionMap.set('decorators', metadata.decorators);
@@ -21779,7 +21871,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
21779
21871
  function createDirectiveDefinitionMap(meta) {
21780
21872
  const definitionMap = new DefinitionMap();
21781
21873
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21782
- definitionMap.set('version', literal('14.0.0-next.5'));
21874
+ definitionMap.set('version', literal('14.0.0-next.8'));
21783
21875
  // e.g. `type: MyDirective`
21784
21876
  definitionMap.set('type', meta.internalType);
21785
21877
  // e.g. `selector: 'some-dir'`
@@ -22000,7 +22092,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22000
22092
  function compileDeclareFactoryFunction(meta) {
22001
22093
  const definitionMap = new DefinitionMap();
22002
22094
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22003
- definitionMap.set('version', literal('14.0.0-next.5'));
22095
+ definitionMap.set('version', literal('14.0.0-next.8'));
22004
22096
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22005
22097
  definitionMap.set('type', meta.internalType);
22006
22098
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22042,7 +22134,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22042
22134
  function createInjectableDefinitionMap(meta) {
22043
22135
  const definitionMap = new DefinitionMap();
22044
22136
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22045
- definitionMap.set('version', literal('14.0.0-next.5'));
22137
+ definitionMap.set('version', literal('14.0.0-next.8'));
22046
22138
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22047
22139
  definitionMap.set('type', meta.internalType);
22048
22140
  // Only generate providedIn property if it has a non-null value
@@ -22100,7 +22192,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22100
22192
  function createInjectorDefinitionMap(meta) {
22101
22193
  const definitionMap = new DefinitionMap();
22102
22194
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22103
- definitionMap.set('version', literal('14.0.0-next.5'));
22195
+ definitionMap.set('version', literal('14.0.0-next.8'));
22104
22196
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22105
22197
  definitionMap.set('type', meta.internalType);
22106
22198
  definitionMap.set('providers', meta.providers);
@@ -22137,7 +22229,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22137
22229
  function createNgModuleDefinitionMap(meta) {
22138
22230
  const definitionMap = new DefinitionMap();
22139
22231
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22140
- definitionMap.set('version', literal('14.0.0-next.5'));
22232
+ definitionMap.set('version', literal('14.0.0-next.8'));
22141
22233
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22142
22234
  definitionMap.set('type', meta.internalType);
22143
22235
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22195,7 +22287,7 @@ function compileDeclarePipeFromMetadata(meta) {
22195
22287
  function createPipeDefinitionMap(meta) {
22196
22288
  const definitionMap = new DefinitionMap();
22197
22289
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22198
- definitionMap.set('version', literal('14.0.0-next.5'));
22290
+ definitionMap.set('version', literal('14.0.0-next.8'));
22199
22291
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22200
22292
  // e.g. `type: MyPipe`
22201
22293
  definitionMap.set('type', meta.internalType);
@@ -22245,5 +22337,5 @@ publishFacade(_global);
22245
22337
  * found in the LICENSE file at https://angular.io/license
22246
22338
  */
22247
22339
 
22248
- 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, 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 };
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 };
22249
22341
  //# sourceMappingURL=compiler.mjs.map