@angular/compiler 18.1.0-rc.0 → 18.1.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 v18.1.0-rc.0
2
+ * @license Angular v18.1.1
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -7252,8 +7252,8 @@ class ShadowCss {
7252
7252
  * animation declaration (with possibly multiple animation definitions)
7253
7253
  *
7254
7254
  * The regular expression can be divided in three parts
7255
- * - (^|\s+)
7256
- * simply captures how many (if any) leading whitespaces are present
7255
+ * - (^|\s+|,)
7256
+ * captures how many (if any) leading whitespaces are present or a comma
7257
7257
  * - (?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))
7258
7258
  * captures two different possible keyframes, ones which are quoted or ones which are valid css
7259
7259
  * idents (custom properties excluded)
@@ -7261,7 +7261,7 @@ class ShadowCss {
7261
7261
  * simply matches the end of the possible keyframe, valid endings are: a comma, a space, a
7262
7262
  * semicolon or the end of the string
7263
7263
  */
7264
- this._animationDeclarationKeyframesRe = /(^|\s+)(?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))(?=[,\s]|$)/g;
7264
+ this._animationDeclarationKeyframesRe = /(^|\s+|,)(?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))(?=[,\s]|$)/g;
7265
7265
  }
7266
7266
  /*
7267
7267
  * Shim some cssText with the given selector. Returns cssText that can be included in the document
@@ -7418,7 +7418,7 @@ class ShadowCss {
7418
7418
  * @returns the updated css rule.
7419
7419
  **/
7420
7420
  _scopeAnimationRule(rule, scopeSelector, unscopedKeyframesSet) {
7421
- let content = rule.content.replace(/((?:^|\s+|;)(?:-webkit-)?animation(?:\s*):(?:\s*))([^;]+)/g, (_, start, animationDeclarations) => start +
7421
+ let content = rule.content.replace(/((?:^|\s+|;)(?:-webkit-)?animation\s*:\s*),*([^;]+)/g, (_, start, animationDeclarations) => start +
7422
7422
  animationDeclarations.replace(this._animationDeclarationKeyframesRe, (original, leadingSpaces, quote = '', quotedName, nonQuotedName) => {
7423
7423
  if (quotedName) {
7424
7424
  return `${leadingSpaces}${this._scopeAnimationKeyframe(`${quote}${quotedName}${quote}`, scopeSelector, unscopedKeyframesSet)}`;
@@ -18012,7 +18012,7 @@ class _Tokenizer {
18012
18012
  let allowDigit = false;
18013
18013
  this._attemptCharCodeUntilFn((code) => {
18014
18014
  if (isAsciiLetter(code) ||
18015
- code == $$ ||
18015
+ code === $$ ||
18016
18016
  code === $_ ||
18017
18017
  // `@let` names can't start with a digit, but digits are valid anywhere else in the name.
18018
18018
  (allowDigit && isDigit(code))) {
@@ -29128,6 +29128,25 @@ function convertDirectiveFacadeToMetadata(facade) {
29128
29128
  });
29129
29129
  }
29130
29130
  }
29131
+ const hostDirectives = facade.hostDirectives?.length
29132
+ ? facade.hostDirectives.map((hostDirective) => {
29133
+ return typeof hostDirective === 'function'
29134
+ ? {
29135
+ directive: wrapReference(hostDirective),
29136
+ inputs: null,
29137
+ outputs: null,
29138
+ isForwardReference: false,
29139
+ }
29140
+ : {
29141
+ directive: wrapReference(hostDirective.directive),
29142
+ isForwardReference: false,
29143
+ inputs: hostDirective.inputs ? parseMappingStringArray(hostDirective.inputs) : null,
29144
+ outputs: hostDirective.outputs
29145
+ ? parseMappingStringArray(hostDirective.outputs)
29146
+ : null,
29147
+ };
29148
+ })
29149
+ : null;
29131
29150
  return {
29132
29151
  ...facade,
29133
29152
  typeArgumentCount: 0,
@@ -29143,10 +29162,18 @@ function convertDirectiveFacadeToMetadata(facade) {
29143
29162
  providers: facade.providers != null ? new WrappedNodeExpr(facade.providers) : null,
29144
29163
  viewQueries: facade.viewQueries.map(convertToR3QueryMetadata),
29145
29164
  fullInheritance: false,
29146
- hostDirectives: convertHostDirectivesToMetadata(facade),
29165
+ hostDirectives,
29147
29166
  };
29148
29167
  }
29149
29168
  function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
29169
+ const hostDirectives = declaration.hostDirectives?.length
29170
+ ? declaration.hostDirectives.map((dir) => ({
29171
+ directive: wrapReference(dir.directive),
29172
+ isForwardReference: false,
29173
+ inputs: dir.inputs ? getHostDirectiveBindingMapping(dir.inputs) : null,
29174
+ outputs: dir.outputs ? getHostDirectiveBindingMapping(dir.outputs) : null,
29175
+ }))
29176
+ : null;
29150
29177
  return {
29151
29178
  name: declaration.type.name,
29152
29179
  type: wrapReference(declaration.type),
@@ -29166,7 +29193,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
29166
29193
  fullInheritance: false,
29167
29194
  isStandalone: declaration.isStandalone ?? false,
29168
29195
  isSignal: declaration.isSignal ?? false,
29169
- hostDirectives: convertHostDirectivesToMetadata(declaration),
29196
+ hostDirectives,
29170
29197
  };
29171
29198
  }
29172
29199
  function convertHostDeclarationToMetadata(host = {}) {
@@ -29180,25 +29207,17 @@ function convertHostDeclarationToMetadata(host = {}) {
29180
29207
  },
29181
29208
  };
29182
29209
  }
29183
- function convertHostDirectivesToMetadata(metadata) {
29184
- if (metadata.hostDirectives?.length) {
29185
- return metadata.hostDirectives.map((hostDirective) => {
29186
- return typeof hostDirective === 'function'
29187
- ? {
29188
- directive: wrapReference(hostDirective),
29189
- inputs: null,
29190
- outputs: null,
29191
- isForwardReference: false,
29192
- }
29193
- : {
29194
- directive: wrapReference(hostDirective.directive),
29195
- isForwardReference: false,
29196
- inputs: hostDirective.inputs ? parseMappingStringArray(hostDirective.inputs) : null,
29197
- outputs: hostDirective.outputs ? parseMappingStringArray(hostDirective.outputs) : null,
29198
- };
29199
- });
29210
+ /**
29211
+ * Parses a host directive mapping where each odd array key is the name of an input/output
29212
+ * and each even key is its public name, e.g. `['one', 'oneAlias', 'two', 'two']`.
29213
+ */
29214
+ function getHostDirectiveBindingMapping(array) {
29215
+ let result = null;
29216
+ for (let i = 1; i < array.length; i += 2) {
29217
+ result = result || {};
29218
+ result[array[i - 1]] = array[i];
29200
29219
  }
29201
- return null;
29220
+ return result;
29202
29221
  }
29203
29222
  function convertOpaqueValuesToExpressions(obj) {
29204
29223
  const result = {};
@@ -29521,7 +29540,7 @@ function publishFacade(global) {
29521
29540
  * @description
29522
29541
  * Entry point for all public APIs of the compiler package.
29523
29542
  */
29524
- const VERSION = new Version('18.1.0-rc.0');
29543
+ const VERSION = new Version('18.1.1');
29525
29544
 
29526
29545
  class CompilerConfig {
29527
29546
  constructor({ defaultEncapsulation = ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters, } = {}) {
@@ -31159,7 +31178,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
31159
31178
  function compileDeclareClassMetadata(metadata) {
31160
31179
  const definitionMap = new DefinitionMap();
31161
31180
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
31162
- definitionMap.set('version', literal('18.1.0-rc.0'));
31181
+ definitionMap.set('version', literal('18.1.1'));
31163
31182
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31164
31183
  definitionMap.set('type', metadata.type);
31165
31184
  definitionMap.set('decorators', metadata.decorators);
@@ -31177,7 +31196,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
31177
31196
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
31178
31197
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
31179
31198
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
31180
- definitionMap.set('version', literal('18.1.0-rc.0'));
31199
+ definitionMap.set('version', literal('18.1.1'));
31181
31200
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31182
31201
  definitionMap.set('type', metadata.type);
31183
31202
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -31272,7 +31291,7 @@ function createDirectiveDefinitionMap(meta) {
31272
31291
  const definitionMap = new DefinitionMap();
31273
31292
  const minVersion = getMinimumVersionForPartialOutput(meta);
31274
31293
  definitionMap.set('minVersion', literal(minVersion));
31275
- definitionMap.set('version', literal('18.1.0-rc.0'));
31294
+ definitionMap.set('version', literal('18.1.1'));
31276
31295
  // e.g. `type: MyDirective`
31277
31296
  definitionMap.set('type', meta.type.value);
31278
31297
  if (meta.isStandalone) {
@@ -31694,7 +31713,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
31694
31713
  function compileDeclareFactoryFunction(meta) {
31695
31714
  const definitionMap = new DefinitionMap();
31696
31715
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
31697
- definitionMap.set('version', literal('18.1.0-rc.0'));
31716
+ definitionMap.set('version', literal('18.1.1'));
31698
31717
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31699
31718
  definitionMap.set('type', meta.type.value);
31700
31719
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -31729,7 +31748,7 @@ function compileDeclareInjectableFromMetadata(meta) {
31729
31748
  function createInjectableDefinitionMap(meta) {
31730
31749
  const definitionMap = new DefinitionMap();
31731
31750
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
31732
- definitionMap.set('version', literal('18.1.0-rc.0'));
31751
+ definitionMap.set('version', literal('18.1.1'));
31733
31752
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31734
31753
  definitionMap.set('type', meta.type.value);
31735
31754
  // Only generate providedIn property if it has a non-null value
@@ -31780,7 +31799,7 @@ function compileDeclareInjectorFromMetadata(meta) {
31780
31799
  function createInjectorDefinitionMap(meta) {
31781
31800
  const definitionMap = new DefinitionMap();
31782
31801
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
31783
- definitionMap.set('version', literal('18.1.0-rc.0'));
31802
+ definitionMap.set('version', literal('18.1.1'));
31784
31803
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31785
31804
  definitionMap.set('type', meta.type.value);
31786
31805
  definitionMap.set('providers', meta.providers);
@@ -31813,7 +31832,7 @@ function createNgModuleDefinitionMap(meta) {
31813
31832
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
31814
31833
  }
31815
31834
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
31816
- definitionMap.set('version', literal('18.1.0-rc.0'));
31835
+ definitionMap.set('version', literal('18.1.1'));
31817
31836
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31818
31837
  definitionMap.set('type', meta.type.value);
31819
31838
  // We only generate the keys in the metadata if the arrays contain values.
@@ -31864,7 +31883,7 @@ function compileDeclarePipeFromMetadata(meta) {
31864
31883
  function createPipeDefinitionMap(meta) {
31865
31884
  const definitionMap = new DefinitionMap();
31866
31885
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
31867
- definitionMap.set('version', literal('18.1.0-rc.0'));
31886
+ definitionMap.set('version', literal('18.1.1'));
31868
31887
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31869
31888
  // e.g. `type: MyPipe`
31870
31889
  definitionMap.set('type', meta.type.value);