@angular-eslint/bundled-angular-compiler 18.4.1-alpha.0 → 18.4.1-alpha.2

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 (2) hide show
  1. package/dist/index.js +36 -105
  2. package/package.json +1 -1
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- * @license Angular v18.2.8
4
+ * @license Angular v18.2.12
5
5
  * (c) 2010-2024 Google LLC. https://angular.io/
6
6
  * License: MIT
7
7
  */
@@ -7219,7 +7219,7 @@ class ShadowCss {
7219
7219
  * captures how many (if any) leading whitespaces are present or a comma
7220
7220
  * - (?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))
7221
7221
  * captures two different possible keyframes, ones which are quoted or ones which are valid css
7222
- * indents (custom properties excluded)
7222
+ * idents (custom properties excluded)
7223
7223
  * - (?=[,\s;]|$)
7224
7224
  * simply matches the end of the possible keyframe, valid endings are: a comma, a space, a
7225
7225
  * semicolon or the end of the string
@@ -7448,7 +7448,7 @@ class ShadowCss {
7448
7448
  */
7449
7449
  _scopeCssText(cssText, scopeSelector, hostSelector) {
7450
7450
  const unscopedRules = this._extractUnscopedRulesFromCssText(cssText);
7451
- // replace :host and :host-context with -shadowcsshost and -shadowcsshostcontext respectively
7451
+ // replace :host and :host-context -shadowcsshost and -shadowcsshost respectively
7452
7452
  cssText = this._insertPolyfillHostInCssText(cssText);
7453
7453
  cssText = this._convertColonHost(cssText);
7454
7454
  cssText = this._convertColonHostContext(cssText);
@@ -7526,7 +7526,7 @@ class ShadowCss {
7526
7526
  * .foo<scopeName> .bar { ... }
7527
7527
  */
7528
7528
  _convertColonHostContext(cssText) {
7529
- return cssText.replace(_cssColonHostContextReGlobal, (selectorText, pseudoPrefix) => {
7529
+ return cssText.replace(_cssColonHostContextReGlobal, (selectorText) => {
7530
7530
  // We have captured a selector that contains a `:host-context` rule.
7531
7531
  // For backward compatibility `:host-context` may contain a comma separated list of selectors.
7532
7532
  // Each context selector group will contain a list of host-context selectors that must match
@@ -7575,10 +7575,10 @@ class ShadowCss {
7575
7575
  selectorText = match[2];
7576
7576
  }
7577
7577
  // The context selectors now must be combined with each other to capture all the possible
7578
- // selectors that `:host-context` can match. See `_combineHostContextSelectors()` for more
7578
+ // selectors that `:host-context` can match. See `combineHostContextSelectors()` for more
7579
7579
  // info about how this is done.
7580
7580
  return contextSelectorGroups
7581
- .map((contextSelectors) => _combineHostContextSelectors(contextSelectors, selectorText, pseudoPrefix))
7581
+ .map((contextSelectors) => combineHostContextSelectors(contextSelectors, selectorText))
7582
7582
  .join(', ');
7583
7583
  });
7584
7584
  }
@@ -7595,12 +7595,7 @@ class ShadowCss {
7595
7595
  let selector = rule.selector;
7596
7596
  let content = rule.content;
7597
7597
  if (rule.selector[0] !== '@') {
7598
- selector = this._scopeSelector({
7599
- selector,
7600
- scopeSelector,
7601
- hostSelector,
7602
- isParentSelector: true,
7603
- });
7598
+ selector = this._scopeSelector(rule.selector, scopeSelector, hostSelector);
7604
7599
  }
7605
7600
  else if (scopedAtRuleIdentifiers.some((atRule) => rule.selector.startsWith(atRule))) {
7606
7601
  content = this._scopeSelectors(rule.content, scopeSelector, hostSelector);
@@ -7640,29 +7635,15 @@ class ShadowCss {
7640
7635
  return new CssRule(selector, rule.content);
7641
7636
  });
7642
7637
  }
7643
- // `isParentSelector` is used to distinguish the selectors which are coming from
7644
- // the initial selector string and any nested selectors, parsed recursively,
7645
- // for example `selector = 'a:where(.one)'` could be the parent, while recursive call
7646
- // would have `selector = '.one'`.
7647
- _scopeSelector({ selector, scopeSelector, hostSelector, isParentSelector = false, }) {
7648
- // Split the selector into independent parts by `,` (comma) unless
7649
- // comma is within parenthesis, for example `:is(.one, two)`.
7650
- // Negative lookup after comma allows not splitting inside nested parenthesis,
7651
- // up to three levels (((,))).
7652
- const selectorSplitRe = / ?,(?!(?:[^)(]*(?:\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*\)[^)(]*)*\))) ?/;
7638
+ _scopeSelector(selector, scopeSelector, hostSelector) {
7653
7639
  return selector
7654
- .split(selectorSplitRe)
7640
+ .split(/ ?, ?/)
7655
7641
  .map((part) => part.split(_shadowDeepSelectors))
7656
7642
  .map((deepParts) => {
7657
7643
  const [shallowPart, ...otherParts] = deepParts;
7658
7644
  const applyScope = (shallowPart) => {
7659
7645
  if (this._selectorNeedsScoping(shallowPart, scopeSelector)) {
7660
- return this._applySelectorScope({
7661
- selector: shallowPart,
7662
- scopeSelector,
7663
- hostSelector,
7664
- isParentSelector,
7665
- });
7646
+ return this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
7666
7647
  }
7667
7648
  else {
7668
7649
  return shallowPart;
@@ -7689,8 +7670,8 @@ class ShadowCss {
7689
7670
  if (_polyfillHostRe.test(selector)) {
7690
7671
  const replaceBy = `[${hostSelector}]`;
7691
7672
  return selector
7692
- .replace(_polyfillHostNoCombinatorReGlobal, (_hnc, selector) => {
7693
- return selector.replace(/([^:\)]*)(:*)(.*)/, (_, before, colon, after) => {
7673
+ .replace(_polyfillHostNoCombinatorRe, (hnc, selector) => {
7674
+ return selector.replace(/([^:]*)(:*)(.*)/, (_, before, colon, after) => {
7694
7675
  return before + replaceBy + colon + after;
7695
7676
  });
7696
7677
  })
@@ -7700,7 +7681,7 @@ class ShadowCss {
7700
7681
  }
7701
7682
  // return a selector with [name] suffix on each simple selector
7702
7683
  // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */
7703
- _applySelectorScope({ selector, scopeSelector, hostSelector, isParentSelector, }) {
7684
+ _applySelectorScope(selector, scopeSelector, hostSelector) {
7704
7685
  const isRe = /\[is=([^\]]*)\]/g;
7705
7686
  scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
7706
7687
  const attrName = '[' + scopeSelector + ']';
@@ -7711,10 +7692,6 @@ class ShadowCss {
7711
7692
  }
7712
7693
  if (p.includes(_polyfillHostNoCombinator)) {
7713
7694
  scopedP = this._applySimpleSelectorScope(p, scopeSelector, hostSelector);
7714
- if (_polyfillHostNoCombinatorWithinPseudoFunction.test(p)) {
7715
- const [_, before, colon, after] = scopedP.match(/([^:]*)(:*)(.*)/);
7716
- scopedP = before + attrName + colon + after;
7717
- }
7718
7695
  }
7719
7696
  else {
7720
7697
  // remove :host since it should be unnecessary
@@ -7728,50 +7705,12 @@ class ShadowCss {
7728
7705
  }
7729
7706
  return scopedP;
7730
7707
  };
7731
- // Wraps `_scopeSelectorPart()` to not use it directly on selectors with
7732
- // pseudo selector functions like `:where()`. Selectors within pseudo selector
7733
- // functions are recursively sent to `_scopeSelector()`.
7734
- const _pseudoFunctionAwareScopeSelectorPart = (selectorPart) => {
7735
- let scopedPart = '';
7736
- const cssPrefixWithPseudoSelectorFunctionMatch = selectorPart.match(_cssPrefixWithPseudoSelectorFunction);
7737
- if (cssPrefixWithPseudoSelectorFunctionMatch) {
7738
- const [cssPseudoSelectorFunction] = cssPrefixWithPseudoSelectorFunctionMatch;
7739
- // Unwrap the pseudo selector to scope its contents.
7740
- // For example,
7741
- // - `:where(selectorToScope)` -> `selectorToScope`;
7742
- // - `:is(.foo, .bar)` -> `.foo, .bar`.
7743
- const selectorToScope = selectorPart.slice(cssPseudoSelectorFunction.length, -1);
7744
- if (selectorToScope.includes(_polyfillHostNoCombinator)) {
7745
- this._shouldScopeIndicator = true;
7746
- }
7747
- const scopedInnerPart = this._scopeSelector({
7748
- selector: selectorToScope,
7749
- scopeSelector,
7750
- hostSelector,
7751
- });
7752
- // Put the result back into the pseudo selector function.
7753
- scopedPart = `${cssPseudoSelectorFunction}${scopedInnerPart})`;
7754
- }
7755
- else {
7756
- this._shouldScopeIndicator =
7757
- this._shouldScopeIndicator || selectorPart.includes(_polyfillHostNoCombinator);
7758
- scopedPart = this._shouldScopeIndicator ? _scopeSelectorPart(selectorPart) : selectorPart;
7759
- }
7760
- return scopedPart;
7761
- };
7762
- if (isParentSelector) {
7763
- this._safeSelector = new SafeSelector(selector);
7764
- selector = this._safeSelector.content();
7765
- }
7708
+ const safeContent = new SafeSelector(selector);
7709
+ selector = safeContent.content();
7766
7710
  let scopedSelector = '';
7767
7711
  let startIndex = 0;
7768
7712
  let res;
7769
- // Combinators aren't used as a delimiter if they are within parenthesis,
7770
- // for example `:where(.one .two)` stays intact.
7771
- // Similarly to selector separation by comma initially, negative lookahead
7772
- // is used here to not break selectors within nested parenthesis up to three
7773
- // nested layers.
7774
- const sep = /( |>|\+|~(?!=))(?!([^)(]*(?:\([^)(]*(?:\([^)(]*(?:\([^)(]*\)[^)(]*)*\)[^)(]*)*\)[^)(]*)*\)))\s*/g;
7713
+ const sep = /( |>|\+|~(?!=))\s*/g;
7775
7714
  // If a selector appears before :host it should not be shimmed as it
7776
7715
  // matches on ancestor elements and not on elements in the host's shadow
7777
7716
  // `:host-context(div)` is transformed to
@@ -7784,13 +7723,8 @@ class ShadowCss {
7784
7723
  // - `tag :host` -> `tag [h]` (`tag` is not scoped because it's considered part of a
7785
7724
  // `:host-context(tag)`)
7786
7725
  const hasHost = selector.includes(_polyfillHostNoCombinator);
7787
- // Only scope parts after or on the same level as the first `-shadowcsshost-no-combinator`
7788
- // when it is present. The selector has the same level when it is a part of a pseudo
7789
- // selector, like `:where()`, for example `:where(:host, .foo)` would result in `.foo`
7790
- // being scoped.
7791
- if (isParentSelector || this._shouldScopeIndicator) {
7792
- this._shouldScopeIndicator = !hasHost;
7793
- }
7726
+ // Only scope parts after the first `-shadowcsshost-no-combinator` when it is present
7727
+ let shouldScope = !hasHost;
7794
7728
  while ((res = sep.exec(selector)) !== null) {
7795
7729
  const separator = res[1];
7796
7730
  // Do not trim the selector, as otherwise this will break sourcemaps
@@ -7806,15 +7740,16 @@ class ShadowCss {
7806
7740
  if (part.match(/__esc-ph-(\d+)__/) && selector[res.index + 1]?.match(/[a-fA-F\d]/)) {
7807
7741
  continue;
7808
7742
  }
7809
- const scopedPart = _pseudoFunctionAwareScopeSelectorPart(part);
7743
+ shouldScope = shouldScope || part.includes(_polyfillHostNoCombinator);
7744
+ const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
7810
7745
  scopedSelector += `${scopedPart} ${separator} `;
7811
7746
  startIndex = sep.lastIndex;
7812
7747
  }
7813
7748
  const part = selector.substring(startIndex);
7814
- scopedSelector += _pseudoFunctionAwareScopeSelectorPart(part);
7749
+ shouldScope = shouldScope || part.includes(_polyfillHostNoCombinator);
7750
+ scopedSelector += shouldScope ? _scopeSelectorPart(part) : part;
7815
7751
  // replace the placeholders with their original values
7816
- // using values stored inside the `safeSelector` instance.
7817
- return this._safeSelector.restore(scopedSelector);
7752
+ return safeContent.restore(scopedSelector);
7818
7753
  }
7819
7754
  _insertPolyfillHostInCssText(selector) {
7820
7755
  return selector
@@ -7869,8 +7804,6 @@ class SafeSelector {
7869
7804
  });
7870
7805
  }
7871
7806
  }
7872
- const _cssScopedPseudoFunctionPrefix = '(:(where|is)\\()?';
7873
- const _cssPrefixWithPseudoSelectorFunction = /^:(where|is)\(/i;
7874
7807
  const _cssContentNextSelectorRe = /polyfill-next-selector[^}]*content:[\s]*?(['"])(.*?)\1[;\s]*}([^{]*?){/gim;
7875
7808
  const _cssContentRuleRe = /(polyfill-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
7876
7809
  const _cssContentUnscopedRuleRe = /(polyfill-unscoped-rule)[^}]*(content:[\s]*(['"])(.*?)\3)[;\s]*[^}]*}/gim;
@@ -7879,12 +7812,10 @@ const _polyfillHost = '-shadowcsshost';
7879
7812
  const _polyfillHostContext = '-shadowcsscontext';
7880
7813
  const _parenSuffix = '(?:\\((' + '(?:\\([^)(]*\\)|[^)(]*)+?' + ')\\))?([^,{]*)';
7881
7814
  const _cssColonHostRe = new RegExp(_polyfillHost + _parenSuffix, 'gim');
7882
- const _cssColonHostContextReGlobal = new RegExp(_cssScopedPseudoFunctionPrefix + '(' + _polyfillHostContext + _parenSuffix + ')', 'gim');
7815
+ const _cssColonHostContextReGlobal = new RegExp(_polyfillHostContext + _parenSuffix, 'gim');
7883
7816
  const _cssColonHostContextRe = new RegExp(_polyfillHostContext + _parenSuffix, 'im');
7884
7817
  const _polyfillHostNoCombinator = _polyfillHost + '-no-combinator';
7885
- const _polyfillHostNoCombinatorWithinPseudoFunction = new RegExp(`:.*\\(.*${_polyfillHostNoCombinator}.*\\)`);
7886
7818
  const _polyfillHostNoCombinatorRe = /-shadowcsshost-no-combinator([^\s]*)/;
7887
- const _polyfillHostNoCombinatorReGlobal = new RegExp(_polyfillHostNoCombinatorRe, 'g');
7888
7819
  const _shadowDOMSelectorsRe = [
7889
7820
  /::shadow/g,
7890
7821
  /::content/g,
@@ -8118,7 +8049,7 @@ function unescapeQuotes(str, isQuoted) {
8118
8049
  * @param contextSelectors an array of context selectors that will be combined.
8119
8050
  * @param otherSelectors the rest of the selectors that are not context selectors.
8120
8051
  */
8121
- function _combineHostContextSelectors(contextSelectors, otherSelectors, pseudoPrefix = '') {
8052
+ function combineHostContextSelectors(contextSelectors, otherSelectors) {
8122
8053
  const hostMarker = _polyfillHostNoCombinator;
8123
8054
  _polyfillHostRe.lastIndex = 0; // reset the regex to ensure we get an accurate test
8124
8055
  const otherSelectorsHasHost = _polyfillHostRe.test(otherSelectors);
@@ -8144,8 +8075,8 @@ function _combineHostContextSelectors(contextSelectors, otherSelectors, pseudoPr
8144
8075
  // (A<hostMarker>) or as an ancestor (A <hostMarker>).
8145
8076
  return combined
8146
8077
  .map((s) => otherSelectorsHasHost
8147
- ? `${pseudoPrefix}${s}${otherSelectors}`
8148
- : `${pseudoPrefix}${s}${hostMarker}${otherSelectors}, ${pseudoPrefix}${s} ${hostMarker}${otherSelectors}`)
8078
+ ? `${s}${otherSelectors}`
8079
+ : `${s}${hostMarker}${otherSelectors}, ${s} ${hostMarker}${otherSelectors}`)
8149
8080
  .join(',');
8150
8081
  }
8151
8082
  /**
@@ -29767,7 +29698,7 @@ function publishFacade(global) {
29767
29698
  * @description
29768
29699
  * Entry point for all public APIs of the compiler package.
29769
29700
  */
29770
- const VERSION = new Version('18.2.8');
29701
+ const VERSION = new Version('18.2.12');
29771
29702
 
29772
29703
  class CompilerConfig {
29773
29704
  constructor({ defaultEncapsulation = exports.ViewEncapsulation.Emulated, preserveWhitespaces, strictInjectionParameters, } = {}) {
@@ -31418,7 +31349,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
31418
31349
  function compileDeclareClassMetadata(metadata) {
31419
31350
  const definitionMap = new DefinitionMap();
31420
31351
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
31421
- definitionMap.set('version', literal('18.2.8'));
31352
+ definitionMap.set('version', literal('18.2.12'));
31422
31353
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31423
31354
  definitionMap.set('type', metadata.type);
31424
31355
  definitionMap.set('decorators', metadata.decorators);
@@ -31436,7 +31367,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
31436
31367
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? literal(null));
31437
31368
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? literal(null));
31438
31369
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
31439
- definitionMap.set('version', literal('18.2.8'));
31370
+ definitionMap.set('version', literal('18.2.12'));
31440
31371
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31441
31372
  definitionMap.set('type', metadata.type);
31442
31373
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -31531,7 +31462,7 @@ function createDirectiveDefinitionMap(meta) {
31531
31462
  const definitionMap = new DefinitionMap();
31532
31463
  const minVersion = getMinimumVersionForPartialOutput(meta);
31533
31464
  definitionMap.set('minVersion', literal(minVersion));
31534
- definitionMap.set('version', literal('18.2.8'));
31465
+ definitionMap.set('version', literal('18.2.12'));
31535
31466
  // e.g. `type: MyDirective`
31536
31467
  definitionMap.set('type', meta.type.value);
31537
31468
  if (meta.isStandalone) {
@@ -31950,7 +31881,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
31950
31881
  function compileDeclareFactoryFunction(meta) {
31951
31882
  const definitionMap = new DefinitionMap();
31952
31883
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
31953
- definitionMap.set('version', literal('18.2.8'));
31884
+ definitionMap.set('version', literal('18.2.12'));
31954
31885
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31955
31886
  definitionMap.set('type', meta.type.value);
31956
31887
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -31985,7 +31916,7 @@ function compileDeclareInjectableFromMetadata(meta) {
31985
31916
  function createInjectableDefinitionMap(meta) {
31986
31917
  const definitionMap = new DefinitionMap();
31987
31918
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
31988
- definitionMap.set('version', literal('18.2.8'));
31919
+ definitionMap.set('version', literal('18.2.12'));
31989
31920
  definitionMap.set('ngImport', importExpr(Identifiers.core));
31990
31921
  definitionMap.set('type', meta.type.value);
31991
31922
  // Only generate providedIn property if it has a non-null value
@@ -32036,7 +31967,7 @@ function compileDeclareInjectorFromMetadata(meta) {
32036
31967
  function createInjectorDefinitionMap(meta) {
32037
31968
  const definitionMap = new DefinitionMap();
32038
31969
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
32039
- definitionMap.set('version', literal('18.2.8'));
31970
+ definitionMap.set('version', literal('18.2.12'));
32040
31971
  definitionMap.set('ngImport', importExpr(Identifiers.core));
32041
31972
  definitionMap.set('type', meta.type.value);
32042
31973
  definitionMap.set('providers', meta.providers);
@@ -32069,7 +32000,7 @@ function createNgModuleDefinitionMap(meta) {
32069
32000
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
32070
32001
  }
32071
32002
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
32072
- definitionMap.set('version', literal('18.2.8'));
32003
+ definitionMap.set('version', literal('18.2.12'));
32073
32004
  definitionMap.set('ngImport', importExpr(Identifiers.core));
32074
32005
  definitionMap.set('type', meta.type.value);
32075
32006
  // We only generate the keys in the metadata if the arrays contain values.
@@ -32120,7 +32051,7 @@ function compileDeclarePipeFromMetadata(meta) {
32120
32051
  function createPipeDefinitionMap(meta) {
32121
32052
  const definitionMap = new DefinitionMap();
32122
32053
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
32123
- definitionMap.set('version', literal('18.2.8'));
32054
+ definitionMap.set('version', literal('18.2.12'));
32124
32055
  definitionMap.set('ngImport', importExpr(Identifiers.core));
32125
32056
  // e.g. `type: MyPipe`
32126
32057
  definitionMap.set('type', meta.type.value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/bundled-angular-compiler",
3
- "version": "18.4.1-alpha.0",
3
+ "version": "18.4.1-alpha.2",
4
4
  "description": "A CJS bundled version of @angular/compiler",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",