@angular/compiler 14.2.0-next.1 → 14.2.1

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v14.2.0-next.1
2
+ * @license Angular v14.2.1
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.2.0-next.1
2
+ * @license Angular v14.2.1
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -9955,10 +9955,18 @@ class _ParseAST {
9955
9955
  } // read all semicolons
9956
9956
  }
9957
9957
  else if (this.index < this.tokens.length) {
9958
+ const errorIndex = this.index;
9958
9959
  this.error(`Unexpected token '${this.next}'`);
9960
+ // The `error` call above will skip ahead to the next recovery point in an attempt to
9961
+ // recover part of the expression, but that might be the token we started from which will
9962
+ // lead to an infinite loop. If that's the case, break the loop assuming that we can't
9963
+ // parse further.
9964
+ if (this.index === errorIndex) {
9965
+ break;
9966
+ }
9959
9967
  }
9960
9968
  }
9961
- if (exprs.length == 0) {
9969
+ if (exprs.length === 0) {
9962
9970
  // We have no expressions so create an empty expression that spans the entire input length
9963
9971
  const artificialStart = this.offset;
9964
9972
  const artificialEnd = this.offset + this.input.length;
@@ -14776,42 +14784,42 @@ const SCHEMA = [
14776
14784
  'time^[HTMLElement]|dateTime',
14777
14785
  ':svg:cursor^:svg:|',
14778
14786
  ];
14779
- const _ATTR_TO_PROP = {
14787
+ const _ATTR_TO_PROP = new Map(Object.entries({
14780
14788
  'class': 'className',
14781
14789
  'for': 'htmlFor',
14782
14790
  'formaction': 'formAction',
14783
14791
  'innerHtml': 'innerHTML',
14784
14792
  'readonly': 'readOnly',
14785
14793
  'tabindex': 'tabIndex',
14786
- };
14794
+ }));
14787
14795
  // Invert _ATTR_TO_PROP.
14788
- const _PROP_TO_ATTR = Object.keys(_ATTR_TO_PROP).reduce((inverted, attr) => {
14789
- inverted[_ATTR_TO_PROP[attr]] = attr;
14796
+ const _PROP_TO_ATTR = Array.from(_ATTR_TO_PROP).reduce((inverted, [propertyName, attributeName]) => {
14797
+ inverted.set(propertyName, attributeName);
14790
14798
  return inverted;
14791
- }, {});
14799
+ }, new Map());
14792
14800
  class DomElementSchemaRegistry extends ElementSchemaRegistry {
14793
14801
  constructor() {
14794
14802
  super();
14795
- this._schema = {};
14803
+ this._schema = new Map();
14796
14804
  // We don't allow binding to events for security reasons. Allowing event bindings would almost
14797
14805
  // certainly introduce bad XSS vulnerabilities. Instead, we store events in a separate schema.
14798
- this._eventSchema = {};
14806
+ this._eventSchema = new Map;
14799
14807
  SCHEMA.forEach(encodedType => {
14800
- const type = {};
14808
+ const type = new Map();
14801
14809
  const events = new Set();
14802
14810
  const [strType, strProperties] = encodedType.split('|');
14803
14811
  const properties = strProperties.split(',');
14804
14812
  const [typeNames, superName] = strType.split('^');
14805
14813
  typeNames.split(',').forEach(tag => {
14806
- this._schema[tag.toLowerCase()] = type;
14807
- this._eventSchema[tag.toLowerCase()] = events;
14814
+ this._schema.set(tag.toLowerCase(), type);
14815
+ this._eventSchema.set(tag.toLowerCase(), events);
14808
14816
  });
14809
- const superType = superName && this._schema[superName.toLowerCase()];
14817
+ const superType = superName && this._schema.get(superName.toLowerCase());
14810
14818
  if (superType) {
14811
- Object.keys(superType).forEach((prop) => {
14812
- type[prop] = superType[prop];
14813
- });
14814
- for (const superEvent of this._eventSchema[superName.toLowerCase()]) {
14819
+ for (const [prop, value] of superType) {
14820
+ type.set(prop, value);
14821
+ }
14822
+ for (const superEvent of this._eventSchema.get(superName.toLowerCase())) {
14815
14823
  events.add(superEvent);
14816
14824
  }
14817
14825
  }
@@ -14822,16 +14830,16 @@ class DomElementSchemaRegistry extends ElementSchemaRegistry {
14822
14830
  events.add(property.substring(1));
14823
14831
  break;
14824
14832
  case '!':
14825
- type[property.substring(1)] = BOOLEAN;
14833
+ type.set(property.substring(1), BOOLEAN);
14826
14834
  break;
14827
14835
  case '#':
14828
- type[property.substring(1)] = NUMBER;
14836
+ type.set(property.substring(1), NUMBER);
14829
14837
  break;
14830
14838
  case '%':
14831
- type[property.substring(1)] = OBJECT;
14839
+ type.set(property.substring(1), OBJECT);
14832
14840
  break;
14833
14841
  default:
14834
- type[property] = STRING;
14842
+ type.set(property, STRING);
14835
14843
  }
14836
14844
  }
14837
14845
  });
@@ -14851,8 +14859,8 @@ class DomElementSchemaRegistry extends ElementSchemaRegistry {
14851
14859
  return true;
14852
14860
  }
14853
14861
  }
14854
- const elementProperties = this._schema[tagName.toLowerCase()] || this._schema['unknown'];
14855
- return !!elementProperties[propName];
14862
+ const elementProperties = this._schema.get(tagName.toLowerCase()) || this._schema.get('unknown');
14863
+ return elementProperties.has(propName);
14856
14864
  }
14857
14865
  hasElement(tagName, schemaMetas) {
14858
14866
  if (schemaMetas.some((schema) => schema.name === NO_ERRORS_SCHEMA.name)) {
@@ -14867,7 +14875,7 @@ class DomElementSchemaRegistry extends ElementSchemaRegistry {
14867
14875
  return true;
14868
14876
  }
14869
14877
  }
14870
- return !!this._schema[tagName.toLowerCase()];
14878
+ return this._schema.has(tagName.toLowerCase());
14871
14879
  }
14872
14880
  /**
14873
14881
  * securityContext returns the security context for the given property on the given DOM tag.
@@ -14896,7 +14904,7 @@ class DomElementSchemaRegistry extends ElementSchemaRegistry {
14896
14904
  return ctx ? ctx : SecurityContext.NONE;
14897
14905
  }
14898
14906
  getMappedPropName(propName) {
14899
- return _ATTR_TO_PROP[propName] || propName;
14907
+ return _ATTR_TO_PROP.get(propName) ?? propName;
14900
14908
  }
14901
14909
  getDefaultComponentElementName() {
14902
14910
  return 'ng-component';
@@ -14924,15 +14932,15 @@ class DomElementSchemaRegistry extends ElementSchemaRegistry {
14924
14932
  }
14925
14933
  }
14926
14934
  allKnownElementNames() {
14927
- return Object.keys(this._schema);
14935
+ return Array.from(this._schema.keys());
14928
14936
  }
14929
14937
  allKnownAttributesOfElement(tagName) {
14930
- const elementProperties = this._schema[tagName.toLowerCase()] || this._schema['unknown'];
14938
+ const elementProperties = this._schema.get(tagName.toLowerCase()) || this._schema.get('unknown');
14931
14939
  // Convert properties to attributes.
14932
- return Object.keys(elementProperties).map(prop => _PROP_TO_ATTR[prop] ?? prop);
14940
+ return Array.from(elementProperties.keys()).map(prop => _PROP_TO_ATTR.get(prop) ?? prop);
14933
14941
  }
14934
14942
  allKnownEventsOfElement(tagName) {
14935
- return Array.from(this._eventSchema[tagName.toLowerCase()] ?? []);
14943
+ return Array.from(this._eventSchema.get(tagName.toLowerCase()) ?? []);
14936
14944
  }
14937
14945
  normalizeAnimationStyleProperty(propName) {
14938
14946
  return dashCaseToCamelCase(propName);
@@ -19896,7 +19904,7 @@ function publishFacade(global) {
19896
19904
  * Use of this source code is governed by an MIT-style license that can be
19897
19905
  * found in the LICENSE file at https://angular.io/license
19898
19906
  */
19899
- const VERSION = new Version('14.2.0-next.1');
19907
+ const VERSION = new Version('14.2.1');
19900
19908
 
19901
19909
  /**
19902
19910
  * @license
@@ -21929,7 +21937,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21929
21937
  function compileDeclareClassMetadata(metadata) {
21930
21938
  const definitionMap = new DefinitionMap();
21931
21939
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21932
- definitionMap.set('version', literal('14.2.0-next.1'));
21940
+ definitionMap.set('version', literal('14.2.1'));
21933
21941
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21934
21942
  definitionMap.set('type', metadata.type);
21935
21943
  definitionMap.set('decorators', metadata.decorators);
@@ -22046,7 +22054,7 @@ function compileDeclareDirectiveFromMetadata(meta) {
22046
22054
  function createDirectiveDefinitionMap(meta) {
22047
22055
  const definitionMap = new DefinitionMap();
22048
22056
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
22049
- definitionMap.set('version', literal('14.2.0-next.1'));
22057
+ definitionMap.set('version', literal('14.2.1'));
22050
22058
  // e.g. `type: MyDirective`
22051
22059
  definitionMap.set('type', meta.internalType);
22052
22060
  if (meta.isStandalone) {
@@ -22260,7 +22268,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22260
22268
  function compileDeclareFactoryFunction(meta) {
22261
22269
  const definitionMap = new DefinitionMap();
22262
22270
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22263
- definitionMap.set('version', literal('14.2.0-next.1'));
22271
+ definitionMap.set('version', literal('14.2.1'));
22264
22272
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22265
22273
  definitionMap.set('type', meta.internalType);
22266
22274
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22302,7 +22310,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22302
22310
  function createInjectableDefinitionMap(meta) {
22303
22311
  const definitionMap = new DefinitionMap();
22304
22312
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22305
- definitionMap.set('version', literal('14.2.0-next.1'));
22313
+ definitionMap.set('version', literal('14.2.1'));
22306
22314
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22307
22315
  definitionMap.set('type', meta.internalType);
22308
22316
  // Only generate providedIn property if it has a non-null value
@@ -22360,7 +22368,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22360
22368
  function createInjectorDefinitionMap(meta) {
22361
22369
  const definitionMap = new DefinitionMap();
22362
22370
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22363
- definitionMap.set('version', literal('14.2.0-next.1'));
22371
+ definitionMap.set('version', literal('14.2.1'));
22364
22372
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22365
22373
  definitionMap.set('type', meta.internalType);
22366
22374
  definitionMap.set('providers', meta.providers);
@@ -22397,7 +22405,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22397
22405
  function createNgModuleDefinitionMap(meta) {
22398
22406
  const definitionMap = new DefinitionMap();
22399
22407
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22400
- definitionMap.set('version', literal('14.2.0-next.1'));
22408
+ definitionMap.set('version', literal('14.2.1'));
22401
22409
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22402
22410
  definitionMap.set('type', meta.internalType);
22403
22411
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22455,7 +22463,7 @@ function compileDeclarePipeFromMetadata(meta) {
22455
22463
  function createPipeDefinitionMap(meta) {
22456
22464
  const definitionMap = new DefinitionMap();
22457
22465
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22458
- definitionMap.set('version', literal('14.2.0-next.1'));
22466
+ definitionMap.set('version', literal('14.2.1'));
22459
22467
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22460
22468
  // e.g. `type: MyPipe`
22461
22469
  definitionMap.set('type', meta.internalType);