@angular/compiler 14.0.0-next.12 → 14.0.0-next.13

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.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.12
2
+ * @license Angular v14.0.0-next.13
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.0.0-next.12
2
+ * @license Angular v14.0.0-next.13
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -4874,6 +4874,12 @@ const IMPLICIT_REFERENCE = '$implicit';
4874
4874
  const NON_BINDABLE_ATTR = 'ngNonBindable';
4875
4875
  /** Name for the variable keeping track of the context returned by `ɵɵrestoreView`. */
4876
4876
  const RESTORED_VIEW_CONTEXT_NAME = 'restoredCtx';
4877
+ /**
4878
+ * Maximum length of a single instruction chain. Because our output AST uses recursion, we're
4879
+ * limited in how many expressions we can nest before we reach the call stack limit. This
4880
+ * length is set very conservatively in order to reduce the chance of problems.
4881
+ */
4882
+ const MAX_CHAIN_LENGTH = 500;
4877
4883
  /** Instructions that support chaining. */
4878
4884
  const CHAINABLE_INSTRUCTIONS = new Set([
4879
4885
  Identifiers.element,
@@ -5099,16 +5105,18 @@ function getInstructionStatements(instructions) {
5099
5105
  const statements = [];
5100
5106
  let pendingExpression = null;
5101
5107
  let pendingExpressionType = null;
5108
+ let chainLength = 0;
5102
5109
  for (const current of instructions) {
5103
5110
  const resolvedParams = (typeof current.paramsOrFn === 'function' ? current.paramsOrFn() : current.paramsOrFn) ??
5104
5111
  [];
5105
5112
  const params = Array.isArray(resolvedParams) ? resolvedParams : [resolvedParams];
5106
5113
  // If the current instruction is the same as the previous one
5107
5114
  // and it can be chained, add another call to the chain.
5108
- if (pendingExpressionType === current.reference &&
5115
+ if (chainLength < MAX_CHAIN_LENGTH && pendingExpressionType === current.reference &&
5109
5116
  CHAINABLE_INSTRUCTIONS.has(pendingExpressionType)) {
5110
5117
  // We'll always have a pending expression when there's a pending expression type.
5111
5118
  pendingExpression = pendingExpression.callFn(params, pendingExpression.sourceSpan);
5119
+ chainLength++;
5112
5120
  }
5113
5121
  else {
5114
5122
  if (pendingExpression !== null) {
@@ -5116,6 +5124,7 @@ function getInstructionStatements(instructions) {
5116
5124
  }
5117
5125
  pendingExpression = invokeInstruction(current.span, current.reference, params);
5118
5126
  pendingExpressionType = current.reference;
5127
+ chainLength = 0;
5119
5128
  }
5120
5129
  }
5121
5130
  // Since the current instruction adds the previous one to the statements,
@@ -19772,7 +19781,7 @@ function publishFacade(global) {
19772
19781
  * Use of this source code is governed by an MIT-style license that can be
19773
19782
  * found in the LICENSE file at https://angular.io/license
19774
19783
  */
19775
- const VERSION = new Version('14.0.0-next.12');
19784
+ const VERSION = new Version('14.0.0-next.13');
19776
19785
 
19777
19786
  /**
19778
19787
  * @license
@@ -21813,7 +21822,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21813
21822
  function compileDeclareClassMetadata(metadata) {
21814
21823
  const definitionMap = new DefinitionMap();
21815
21824
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21816
- definitionMap.set('version', literal('14.0.0-next.12'));
21825
+ definitionMap.set('version', literal('14.0.0-next.13'));
21817
21826
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21818
21827
  definitionMap.set('type', metadata.type);
21819
21828
  definitionMap.set('decorators', metadata.decorators);
@@ -21930,7 +21939,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
21930
21939
  function createDirectiveDefinitionMap(meta) {
21931
21940
  const definitionMap = new DefinitionMap();
21932
21941
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21933
- definitionMap.set('version', literal('14.0.0-next.12'));
21942
+ definitionMap.set('version', literal('14.0.0-next.13'));
21934
21943
  // e.g. `type: MyDirective`
21935
21944
  definitionMap.set('type', meta.internalType);
21936
21945
  // e.g. `selector: 'some-dir'`
@@ -22151,7 +22160,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22151
22160
  function compileDeclareFactoryFunction(meta) {
22152
22161
  const definitionMap = new DefinitionMap();
22153
22162
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22154
- definitionMap.set('version', literal('14.0.0-next.12'));
22163
+ definitionMap.set('version', literal('14.0.0-next.13'));
22155
22164
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22156
22165
  definitionMap.set('type', meta.internalType);
22157
22166
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22193,7 +22202,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22193
22202
  function createInjectableDefinitionMap(meta) {
22194
22203
  const definitionMap = new DefinitionMap();
22195
22204
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22196
- definitionMap.set('version', literal('14.0.0-next.12'));
22205
+ definitionMap.set('version', literal('14.0.0-next.13'));
22197
22206
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22198
22207
  definitionMap.set('type', meta.internalType);
22199
22208
  // Only generate providedIn property if it has a non-null value
@@ -22251,7 +22260,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22251
22260
  function createInjectorDefinitionMap(meta) {
22252
22261
  const definitionMap = new DefinitionMap();
22253
22262
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22254
- definitionMap.set('version', literal('14.0.0-next.12'));
22263
+ definitionMap.set('version', literal('14.0.0-next.13'));
22255
22264
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22256
22265
  definitionMap.set('type', meta.internalType);
22257
22266
  definitionMap.set('providers', meta.providers);
@@ -22288,7 +22297,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22288
22297
  function createNgModuleDefinitionMap(meta) {
22289
22298
  const definitionMap = new DefinitionMap();
22290
22299
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22291
- definitionMap.set('version', literal('14.0.0-next.12'));
22300
+ definitionMap.set('version', literal('14.0.0-next.13'));
22292
22301
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22293
22302
  definitionMap.set('type', meta.internalType);
22294
22303
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22346,7 +22355,7 @@ function compileDeclarePipeFromMetadata(meta) {
22346
22355
  function createPipeDefinitionMap(meta) {
22347
22356
  const definitionMap = new DefinitionMap();
22348
22357
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22349
- definitionMap.set('version', literal('14.0.0-next.12'));
22358
+ definitionMap.set('version', literal('14.0.0-next.13'));
22350
22359
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22351
22360
  // e.g. `type: MyPipe`
22352
22361
  definitionMap.set('type', meta.internalType);