@angular-eslint/bundled-angular-compiler 15.2.1-alpha.18 → 15.2.1-alpha.5

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 +57 -32
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.1.4
2
+ * @license Angular v15.1.0-rc.0
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -7052,7 +7052,7 @@ class _AstToIrVisitor {
7052
7052
  return null;
7053
7053
  },
7054
7054
  visitNonNullAssert(ast) {
7055
- return visit(this, ast.expression);
7055
+ return null;
7056
7056
  },
7057
7057
  visitPropertyRead(ast) {
7058
7058
  return visit(this, ast.receiver);
@@ -7329,8 +7329,9 @@ const animationKeywords = new Set([
7329
7329
  'end', 'jump-both', 'jump-end', 'jump-none', 'jump-start', 'start'
7330
7330
  ]);
7331
7331
  /**
7332
- * The following class has its origin from a port of shadowCSS from webcomponents.js to TypeScript.
7333
- * It has since diverge in many ways to tailor Angular's needs.
7332
+ * The following class is a port of shadowCSS from webcomponents.js to TypeScript.
7333
+ *
7334
+ * Please make sure to keep to edits in sync with the source file.
7334
7335
  *
7335
7336
  * Source:
7336
7337
  * https://github.com/webcomponents/webcomponentsjs/blob/4efecd7e0e/src/ShadowCSS/ShadowCSS.js
@@ -7370,8 +7371,28 @@ const animationKeywords = new Set([
7370
7371
  }
7371
7372
 
7372
7373
  * encapsulation: Styles defined within ShadowDOM, apply only to
7373
- dom inside the ShadowDOM.
7374
- The selectors are scoped by adding an attribute selector suffix to each
7374
+ dom inside the ShadowDOM. Polymer uses one of two techniques to implement
7375
+ this feature.
7376
+
7377
+ By default, rules are prefixed with the host element tag name
7378
+ as a descendant selector. This ensures styling does not leak out of the 'top'
7379
+ of the element's ShadowDOM. For example,
7380
+
7381
+ div {
7382
+ font-weight: bold;
7383
+ }
7384
+
7385
+ becomes:
7386
+
7387
+ x-foo div {
7388
+ font-weight: bold;
7389
+ }
7390
+
7391
+ becomes:
7392
+
7393
+
7394
+ Alternatively, if WebComponents.ShadowCSS.strictStyling is set to true then
7395
+ selectors are scoped by adding an attribute selector suffix to each
7375
7396
  simple selector that contains the host element tag name. Each element
7376
7397
  in the element's ShadowDOM template is also given the scope attribute.
7377
7398
  Thus, these rules match only elements that have the scope attribute.
@@ -7433,6 +7454,7 @@ const animationKeywords = new Set([
7433
7454
  */
7434
7455
  class ShadowCss {
7435
7456
  constructor() {
7457
+ this.strictStyling = true;
7436
7458
  /**
7437
7459
  * Regular expression used to extrapolate the possible keyframes from an
7438
7460
  * animation declaration (with possibly multiple animation definitions)
@@ -7450,10 +7472,12 @@ class ShadowCss {
7450
7472
  this._animationDeclarationKeyframesRe = /(^|\s+)(?:(?:(['"])((?:\\\\|\\\2|(?!\2).)+)\2)|(-?[A-Za-z][\w\-]*))(?=[,\s]|$)/g;
7451
7473
  }
7452
7474
  /*
7453
- * Shim some cssText with the given selector. Returns cssText that can be included in the document
7475
+ * Shim some cssText with the given selector. Returns cssText that can
7476
+ * be included in the document via WebComponents.ShadowCSS.addCssToDocument(css).
7454
7477
  *
7455
- * The selector is the attribute added to all elements inside the host,
7456
- * The hostSelector is the attribute added to the host itself.
7478
+ * When strictStyling is true:
7479
+ * - selector is the attribute added to all elements inside the host,
7480
+ * - hostSelector is the attribute added to the host itself.
7457
7481
  */
7458
7482
  shimCssText(cssText, selector, hostSelector = '') {
7459
7483
  const commentsWithHash = extractCommentsWithHash(cssText);
@@ -7615,6 +7639,7 @@ class ShadowCss {
7615
7639
  *
7616
7640
  **/
7617
7641
  _insertPolyfillDirectivesInCssText(cssText) {
7642
+ // Difference with webcomponents.js: does not handle comments
7618
7643
  return cssText.replace(_cssContentNextSelectorRe, function (...m) {
7619
7644
  return m[2] + '{';
7620
7645
  });
@@ -7635,6 +7660,7 @@ class ShadowCss {
7635
7660
  *
7636
7661
  **/
7637
7662
  _insertPolyfillRulesInCssText(cssText) {
7663
+ // Difference with webcomponents.js: does not handle comments
7638
7664
  return cssText.replace(_cssContentRuleRe, (...m) => {
7639
7665
  const rule = m[0].replace(m[1], '').replace(m[2], '');
7640
7666
  return m[4] + rule;
@@ -7678,6 +7704,7 @@ class ShadowCss {
7678
7704
  *
7679
7705
  **/
7680
7706
  _extractUnscopedRulesFromCssText(cssText) {
7707
+ // Difference with webcomponents.js: does not handle comments
7681
7708
  let r = '';
7682
7709
  let m;
7683
7710
  _cssContentUnscopedRuleRe.lastIndex = 0;
@@ -7794,7 +7821,8 @@ class ShadowCss {
7794
7821
  let selector = rule.selector;
7795
7822
  let content = rule.content;
7796
7823
  if (rule.selector[0] !== '@') {
7797
- selector = this._scopeSelector(rule.selector, scopeSelector, hostSelector);
7824
+ selector =
7825
+ this._scopeSelector(rule.selector, scopeSelector, hostSelector, this.strictStyling);
7798
7826
  }
7799
7827
  else if (rule.selector.startsWith('@media') || rule.selector.startsWith('@supports') ||
7800
7828
  rule.selector.startsWith('@document') || rule.selector.startsWith('@layer') ||
@@ -7835,14 +7863,16 @@ class ShadowCss {
7835
7863
  return new CssRule(selector, rule.content);
7836
7864
  });
7837
7865
  }
7838
- _scopeSelector(selector, scopeSelector, hostSelector) {
7866
+ _scopeSelector(selector, scopeSelector, hostSelector, strict) {
7839
7867
  return selector.split(',')
7840
7868
  .map(part => part.trim().split(_shadowDeepSelectors))
7841
7869
  .map((deepParts) => {
7842
7870
  const [shallowPart, ...otherParts] = deepParts;
7843
7871
  const applyScope = (shallowPart) => {
7844
7872
  if (this._selectorNeedsScoping(shallowPart, scopeSelector)) {
7845
- return this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
7873
+ return strict ?
7874
+ this._applyStrictSelectorScope(shallowPart, scopeSelector, hostSelector) :
7875
+ this._applySelectorScope(shallowPart, scopeSelector, hostSelector);
7846
7876
  }
7847
7877
  else {
7848
7878
  return shallowPart;
@@ -7862,12 +7892,16 @@ class ShadowCss {
7862
7892
  scopeSelector = scopeSelector.replace(lre, '\\[').replace(rre, '\\]');
7863
7893
  return new RegExp('^(' + scopeSelector + ')' + _selectorReSuffix, 'm');
7864
7894
  }
7895
+ _applySelectorScope(selector, scopeSelector, hostSelector) {
7896
+ // Difference from webcomponents.js: scopeSelector could not be an array
7897
+ return this._applySimpleSelectorScope(selector, scopeSelector, hostSelector);
7898
+ }
7865
7899
  // scope via name and [is=name]
7866
7900
  _applySimpleSelectorScope(selector, scopeSelector, hostSelector) {
7867
7901
  // In Android browser, the lastIndex is not reset when the regex is used in String.replace()
7868
7902
  _polyfillHostRe.lastIndex = 0;
7869
7903
  if (_polyfillHostRe.test(selector)) {
7870
- const replaceBy = `[${hostSelector}]`;
7904
+ const replaceBy = this.strictStyling ? `[${hostSelector}]` : scopeSelector;
7871
7905
  return selector
7872
7906
  .replace(_polyfillHostNoCombinatorRe, (hnc, selector) => {
7873
7907
  return selector.replace(/([^:]*)(:*)(.*)/, (_, before, colon, after) => {
@@ -7880,8 +7914,7 @@ class ShadowCss {
7880
7914
  }
7881
7915
  // return a selector with [name] suffix on each simple selector
7882
7916
  // e.g. .foo.bar > .zot becomes .foo[name].bar[name] > .zot[name] /** @internal */
7883
- _applySelectorScope(selector, scopeSelector, hostSelector) {
7884
- var _a;
7917
+ _applyStrictSelectorScope(selector, scopeSelector, hostSelector) {
7885
7918
  const isRe = /\[is=([^\]]*)\]/g;
7886
7919
  scopeSelector = scopeSelector.replace(isRe, (_, ...parts) => parts[0]);
7887
7920
  const attrName = '[' + scopeSelector + ']';
@@ -7928,13 +7961,6 @@ class ShadowCss {
7928
7961
  while ((res = sep.exec(selector)) !== null) {
7929
7962
  const separator = res[1];
7930
7963
  const part = selector.slice(startIndex, res.index).trim();
7931
- // A space following an escaped hex value and followed by another hex character
7932
- // (ie: ".\fc ber" for ".über") is not a separator between 2 selectors
7933
- // also keep in mind that backslashes are replaced by a placeholder by SafeSelector
7934
- // These escaped selectors happen for example when esbuild runs with optimization.minify.
7935
- if (part.match(_placeholderRe) && ((_a = selector[res.index + 1]) === null || _a === void 0 ? void 0 : _a.match(/[a-fA-F\d]/))) {
7936
- continue;
7937
- }
7938
7964
  shouldScope = shouldScope || part.indexOf(_polyfillHostNoCombinator) > -1;
7939
7965
  const scopedPart = shouldScope ? _scopeSelectorPart(part) : part;
7940
7966
  scopedSelector += `${scopedPart} ${separator} `;
@@ -7974,7 +8000,7 @@ class SafeSelector {
7974
8000
  });
7975
8001
  }
7976
8002
  restore(content) {
7977
- return content.replace(_placeholderRe, (_ph, index) => this.placeholders[+index]);
8003
+ return content.replace(/__ph-(\d+)__/g, (_ph, index) => this.placeholders[+index]);
7978
8004
  }
7979
8005
  content() {
7980
8006
  return this._content;
@@ -8022,7 +8048,6 @@ const _polyfillHostRe = /-shadowcsshost/gim;
8022
8048
  const _colonHostRe = /:host/gim;
8023
8049
  const _colonHostContextRe = /:host-context/gim;
8024
8050
  const _commentRe = /\/\*[\s\S]*?\*\//g;
8025
- const _placeholderRe = /__ph-(\d+)__/g;
8026
8051
  function stripComments(input) {
8027
8052
  return input.replace(_commentRe, '');
8028
8053
  }
@@ -19725,7 +19750,7 @@ function publishFacade(global) {
19725
19750
  * @description
19726
19751
  * Entry point for all public APIs of the compiler package.
19727
19752
  */
19728
- const VERSION = new Version('15.1.4');
19753
+ const VERSION = new Version('15.1.0');
19729
19754
 
19730
19755
  class CompilerConfig {
19731
19756
  constructor({ defaultEncapsulation = exports.ViewEncapsulation.Emulated, useJit = true, missingTranslation = null, preserveWhitespaces, strictInjectionParameters } = {}) {
@@ -21652,7 +21677,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
21652
21677
  function compileDeclareClassMetadata(metadata) {
21653
21678
  const definitionMap = new DefinitionMap();
21654
21679
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
21655
- definitionMap.set('version', literal('15.1.4'));
21680
+ definitionMap.set('version', literal('15.1.0'));
21656
21681
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21657
21682
  definitionMap.set('type', metadata.type);
21658
21683
  definitionMap.set('decorators', metadata.decorators);
@@ -21756,7 +21781,7 @@ function createDirectiveDefinitionMap(meta) {
21756
21781
  var _a;
21757
21782
  const definitionMap = new DefinitionMap();
21758
21783
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
21759
- definitionMap.set('version', literal('15.1.4'));
21784
+ definitionMap.set('version', literal('15.1.0'));
21760
21785
  // e.g. `type: MyDirective`
21761
21786
  definitionMap.set('type', meta.internalType);
21762
21787
  if (meta.isStandalone) {
@@ -21978,7 +22003,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
21978
22003
  function compileDeclareFactoryFunction(meta) {
21979
22004
  const definitionMap = new DefinitionMap();
21980
22005
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
21981
- definitionMap.set('version', literal('15.1.4'));
22006
+ definitionMap.set('version', literal('15.1.0'));
21982
22007
  definitionMap.set('ngImport', importExpr(Identifiers.core));
21983
22008
  definitionMap.set('type', meta.internalType);
21984
22009
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22013,7 +22038,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22013
22038
  function createInjectableDefinitionMap(meta) {
22014
22039
  const definitionMap = new DefinitionMap();
22015
22040
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22016
- definitionMap.set('version', literal('15.1.4'));
22041
+ definitionMap.set('version', literal('15.1.0'));
22017
22042
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22018
22043
  definitionMap.set('type', meta.internalType);
22019
22044
  // Only generate providedIn property if it has a non-null value
@@ -22064,7 +22089,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22064
22089
  function createInjectorDefinitionMap(meta) {
22065
22090
  const definitionMap = new DefinitionMap();
22066
22091
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22067
- definitionMap.set('version', literal('15.1.4'));
22092
+ definitionMap.set('version', literal('15.1.0'));
22068
22093
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22069
22094
  definitionMap.set('type', meta.internalType);
22070
22095
  definitionMap.set('providers', meta.providers);
@@ -22094,7 +22119,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22094
22119
  function createNgModuleDefinitionMap(meta) {
22095
22120
  const definitionMap = new DefinitionMap();
22096
22121
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22097
- definitionMap.set('version', literal('15.1.4'));
22122
+ definitionMap.set('version', literal('15.1.0'));
22098
22123
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22099
22124
  definitionMap.set('type', meta.internalType);
22100
22125
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22145,7 +22170,7 @@ function compileDeclarePipeFromMetadata(meta) {
22145
22170
  function createPipeDefinitionMap(meta) {
22146
22171
  const definitionMap = new DefinitionMap();
22147
22172
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22148
- definitionMap.set('version', literal('15.1.4'));
22173
+ definitionMap.set('version', literal('15.1.0'));
22149
22174
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22150
22175
  // e.g. `type: MyPipe`
22151
22176
  definitionMap.set('type', meta.internalType);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular-eslint/bundled-angular-compiler",
3
- "version": "15.2.1-alpha.18+9754a43",
3
+ "version": "15.2.1-alpha.5+7e97976",
4
4
  "description": "A CJS bundled version of @angular/compiler",
5
5
  "license": "MIT",
6
6
  "main": "dist/index.js",
@@ -15,5 +15,5 @@
15
15
  "package.json",
16
16
  "README.md"
17
17
  ],
18
- "gitHead": "9754a43c72e95e19b3dd4bfd6a9b8a420f3c21c5"
18
+ "gitHead": "7e9797699f64c413f17d2d1cd08df60e01b2186a"
19
19
  }