@angular-eslint/bundled-angular-compiler 16.0.4-alpha.11 → 16.0.4-alpha.12

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 +283 -107
  2. package/package.json +2 -2
package/dist/index.js CHANGED
@@ -1,7 +1,7 @@
1
1
  'use strict';
2
2
 
3
3
  /**
4
- * @license Angular v16.0.3
4
+ * @license Angular v16.1.2
5
5
  * (c) 2010-2022 Google LLC. https://angular.io/
6
6
  * License: MIT
7
7
  */
@@ -2274,6 +2274,7 @@ class ConstantPool {
2274
2274
  this.statements = [];
2275
2275
  this.literals = new Map();
2276
2276
  this.literalFactories = new Map();
2277
+ this.sharedConstants = new Map();
2277
2278
  this.nextNameIndex = 0;
2278
2279
  }
2279
2280
  getConstLiteral(literal, forceShared) {
@@ -2283,7 +2284,7 @@ class ConstantPool {
2283
2284
  // reference to a constant.
2284
2285
  return literal;
2285
2286
  }
2286
- const key = this.keyOf(literal);
2287
+ const key = GenericKeyFn.INSTANCE.keyOf(literal);
2287
2288
  let fixup = this.literals.get(key);
2288
2289
  let newValue = false;
2289
2290
  if (!fixup) {
@@ -2328,11 +2329,20 @@ class ConstantPool {
2328
2329
  }
2329
2330
  return fixup;
2330
2331
  }
2332
+ getSharedConstant(def, expr) {
2333
+ const key = def.keyOf(expr);
2334
+ if (!this.sharedConstants.has(key)) {
2335
+ const id = this.freshName();
2336
+ this.sharedConstants.set(key, variable(id));
2337
+ this.statements.push(def.toSharedConstantDeclaration(id, expr));
2338
+ }
2339
+ return this.sharedConstants.get(key);
2340
+ }
2331
2341
  getLiteralFactory(literal) {
2332
2342
  // Create a pure function that builds an array of a mix of constant and variable expressions
2333
2343
  if (literal instanceof LiteralArrayExpr) {
2334
2344
  const argumentsForKey = literal.entries.map(e => e.isConstant() ? e : UNKNOWN_VALUE_KEY);
2335
- const key = this.keyOf(literalArr(argumentsForKey));
2345
+ const key = GenericKeyFn.INSTANCE.keyOf(literalArr(argumentsForKey));
2336
2346
  return this._getLiteralFactory(key, literal.entries, entries => literalArr(entries));
2337
2347
  }
2338
2348
  else {
@@ -2341,7 +2351,7 @@ class ConstantPool {
2341
2351
  value: e.value.isConstant() ? e.value : UNKNOWN_VALUE_KEY,
2342
2352
  quoted: e.quoted
2343
2353
  })));
2344
- const key = this.keyOf(expressionForKey);
2354
+ const key = GenericKeyFn.INSTANCE.keyOf(expressionForKey);
2345
2355
  return this._getLiteralFactory(key, literal.entries.map(e => e.value), entries => literalMap(entries.map((value, index) => ({
2346
2356
  key: literal.entries[index].key,
2347
2357
  value,
@@ -2378,65 +2388,48 @@ class ConstantPool {
2378
2388
  freshName() {
2379
2389
  return this.uniqueName(CONSTANT_PREFIX);
2380
2390
  }
2381
- keyOf(expression) {
2382
- return expression.visitExpression(new KeyVisitor(), KEY_CONTEXT);
2383
- }
2384
2391
  }
2385
- /**
2386
- * Visitor used to determine if 2 expressions are equivalent and can be shared in the
2387
- * `ConstantPool`.
2388
- *
2389
- * When the id (string) generated by the visitor is equal, expressions are considered equivalent.
2390
- */
2391
- class KeyVisitor {
2392
- constructor() {
2393
- this.visitWrappedNodeExpr = invalid$1;
2394
- this.visitWriteVarExpr = invalid$1;
2395
- this.visitWriteKeyExpr = invalid$1;
2396
- this.visitWritePropExpr = invalid$1;
2397
- this.visitInvokeFunctionExpr = invalid$1;
2398
- this.visitTaggedTemplateExpr = invalid$1;
2399
- this.visitInstantiateExpr = invalid$1;
2400
- this.visitConditionalExpr = invalid$1;
2401
- this.visitNotExpr = invalid$1;
2402
- this.visitAssertNotNullExpr = invalid$1;
2403
- this.visitCastExpr = invalid$1;
2404
- this.visitFunctionExpr = invalid$1;
2405
- this.visitUnaryOperatorExpr = invalid$1;
2406
- this.visitBinaryOperatorExpr = invalid$1;
2407
- this.visitReadPropExpr = invalid$1;
2408
- this.visitReadKeyExpr = invalid$1;
2409
- this.visitCommaExpr = invalid$1;
2410
- this.visitLocalizedString = invalid$1;
2411
- }
2412
- visitLiteralExpr(ast) {
2413
- return `${typeof ast.value === 'string' ? '"' + ast.value + '"' : ast.value}`;
2414
- }
2415
- visitLiteralArrayExpr(ast, context) {
2416
- return `[${ast.entries.map(entry => entry.visitExpression(this, context)).join(',')}]`;
2417
- }
2418
- visitLiteralMapExpr(ast, context) {
2419
- const mapKey = (entry) => {
2420
- const quote = entry.quoted ? '"' : '';
2421
- return `${quote}${entry.key}${quote}`;
2422
- };
2423
- const mapEntry = (entry) => `${mapKey(entry)}:${entry.value.visitExpression(this, context)}`;
2424
- return `{${ast.entries.map(mapEntry).join(',')}`;
2425
- }
2426
- visitExternalExpr(ast) {
2427
- return ast.value.moduleName ? `EX:${ast.value.moduleName}:${ast.value.name}` :
2428
- `EX:${ast.value.runtime.name}`;
2429
- }
2430
- visitReadVarExpr(node) {
2431
- return `VAR:${node.name}`;
2432
- }
2433
- visitTypeofExpr(node, context) {
2434
- return `TYPEOF:${node.expr.visitExpression(this, context)}`;
2392
+ class GenericKeyFn {
2393
+ static { this.INSTANCE = new GenericKeyFn(); }
2394
+ keyOf(expr) {
2395
+ if (expr instanceof LiteralExpr && typeof expr.value === 'string') {
2396
+ return `"${expr.value}"`;
2397
+ }
2398
+ else if (expr instanceof LiteralExpr) {
2399
+ return String(expr.value);
2400
+ }
2401
+ else if (expr instanceof LiteralArrayExpr) {
2402
+ const entries = [];
2403
+ for (const entry of expr.entries) {
2404
+ entries.push(this.keyOf(entry));
2405
+ }
2406
+ return `[${entries.join(',')}]`;
2407
+ }
2408
+ else if (expr instanceof LiteralMapExpr) {
2409
+ const entries = [];
2410
+ for (const entry of expr.entries) {
2411
+ let key = entry.key;
2412
+ if (entry.quoted) {
2413
+ key = `"${key}"`;
2414
+ }
2415
+ entries.push(key + ':' + this.keyOf(entry.value));
2416
+ }
2417
+ return `{${entries.join(',')}}`;
2418
+ }
2419
+ else if (expr instanceof ExternalExpr) {
2420
+ return `import("${expr.value.moduleName}", ${expr.value.name})`;
2421
+ }
2422
+ else if (expr instanceof ReadVarExpr) {
2423
+ return `read(${expr.name})`;
2424
+ }
2425
+ else if (expr instanceof TypeofExpr) {
2426
+ return `typeof(${this.keyOf(expr.expr)})`;
2427
+ }
2428
+ else {
2429
+ throw new Error(`${this.constructor.name} does not handle expressions of type ${expr.constructor.name}`);
2430
+ }
2435
2431
  }
2436
2432
  }
2437
- function invalid$1(arg) {
2438
- throw new Error(`Invalid state: Visitor ${this.constructor.name} doesn't handle ${arg.constructor.name}`);
2439
- }
2440
2433
  function isVariable(e) {
2441
2434
  return e instanceof ReadVarExpr;
2442
2435
  }
@@ -2634,6 +2627,7 @@ class Identifiers {
2634
2627
  static { this.StandaloneFeature = { name: 'ɵɵStandaloneFeature', moduleName: CORE }; }
2635
2628
  static { this.ProvidersFeature = { name: 'ɵɵProvidersFeature', moduleName: CORE }; }
2636
2629
  static { this.HostDirectivesFeature = { name: 'ɵɵHostDirectivesFeature', moduleName: CORE }; }
2630
+ static { this.InputTransformsFeatureFeature = { name: 'ɵɵInputTransformsFeature', moduleName: CORE }; }
2637
2631
  static { this.listener = { name: 'ɵɵlistener', moduleName: CORE }; }
2638
2632
  static { this.getInheritedFactory = {
2639
2633
  name: 'ɵɵgetInheritedFactory',
@@ -4646,27 +4640,34 @@ function conditionallyCreateDirectiveBindingLiteral(map, keepDeclared) {
4646
4640
  let declaredName;
4647
4641
  let publicName;
4648
4642
  let minifiedName;
4649
- let needsDeclaredName;
4643
+ let expressionValue;
4650
4644
  if (typeof value === 'string') {
4651
4645
  // canonical syntax: `dirProp: publicProp`
4652
4646
  declaredName = key;
4653
4647
  minifiedName = key;
4654
4648
  publicName = value;
4655
- needsDeclaredName = false;
4649
+ expressionValue = asLiteral(publicName);
4656
4650
  }
4657
4651
  else {
4658
4652
  minifiedName = key;
4659
4653
  declaredName = value.classPropertyName;
4660
4654
  publicName = value.bindingPropertyName;
4661
- needsDeclaredName = publicName !== declaredName;
4655
+ if (keepDeclared && (publicName !== declaredName || value.transformFunction != null)) {
4656
+ const expressionKeys = [asLiteral(publicName), asLiteral(declaredName)];
4657
+ if (value.transformFunction != null) {
4658
+ expressionKeys.push(value.transformFunction);
4659
+ }
4660
+ expressionValue = literalArr(expressionKeys);
4661
+ }
4662
+ else {
4663
+ expressionValue = asLiteral(publicName);
4664
+ }
4662
4665
  }
4663
4666
  return {
4664
4667
  key: minifiedName,
4665
4668
  // put quotes around keys that contain potentially unsafe characters
4666
4669
  quoted: UNSAFE_OBJECT_KEY_NAME_REGEXP.test(minifiedName),
4667
- value: (keepDeclared && needsDeclaredName) ?
4668
- literalArr([asLiteral(publicName), asLiteral(declaredName)]) :
4669
- asLiteral(publicName)
4670
+ value: expressionValue,
4670
4671
  };
4671
4672
  }));
4672
4673
  }
@@ -7447,11 +7448,28 @@ class ShadowCss {
7447
7448
  * The hostSelector is the attribute added to the host itself.
7448
7449
  */
7449
7450
  shimCssText(cssText, selector, hostSelector = '') {
7450
- const commentsWithHash = extractCommentsWithHash(cssText);
7451
- cssText = stripComments(cssText);
7451
+ // **NOTE**: Do not strip comments as this will cause component sourcemaps to break
7452
+ // due to shift in lines.
7453
+ // Collect comments and replace them with a placeholder, this is done to avoid complicating
7454
+ // the rule parsing RegExp and keep it safer.
7455
+ const comments = [];
7456
+ cssText = cssText.replace(_commentRe, (m) => {
7457
+ if (m.match(_commentWithHashRe)) {
7458
+ comments.push(m);
7459
+ }
7460
+ else {
7461
+ // Replace non hash comments with empty lines.
7462
+ // This is done so that we do not leak any senstive data in comments.
7463
+ const newLinesMatches = m.match(_newLinesRe);
7464
+ comments.push((newLinesMatches?.join('') ?? '') + '\n');
7465
+ }
7466
+ return COMMENT_PLACEHOLDER;
7467
+ });
7452
7468
  cssText = this._insertDirectives(cssText);
7453
7469
  const scopedCssText = this._scopeCssText(cssText, selector, hostSelector);
7454
- return [scopedCssText, ...commentsWithHash].join('\n');
7470
+ // Add back comments at the original position.
7471
+ let commentIdx = 0;
7472
+ return scopedCssText.replace(_commentWithHashPlaceHolderRe, () => comments[commentIdx++]);
7455
7473
  }
7456
7474
  _insertDirectives(cssText) {
7457
7475
  cssText = this._insertPolyfillDirectivesInCssText(cssText);
@@ -7692,7 +7710,7 @@ class ShadowCss {
7692
7710
  return cssText.replace(_cssColonHostRe, (_, hostSelectors, otherSelectors) => {
7693
7711
  if (hostSelectors) {
7694
7712
  const convertedSelectors = [];
7695
- const hostSelectorArray = hostSelectors.split(',').map(p => p.trim());
7713
+ const hostSelectorArray = hostSelectors.split(',').map((p) => p.trim());
7696
7714
  for (const hostSelector of hostSelectorArray) {
7697
7715
  if (!hostSelector)
7698
7716
  break;
@@ -7722,7 +7740,7 @@ class ShadowCss {
7722
7740
  * .foo<scopeName> .bar { ... }
7723
7741
  */
7724
7742
  _convertColonHostContext(cssText) {
7725
- return cssText.replace(_cssColonHostContextReGlobal, selectorText => {
7743
+ return cssText.replace(_cssColonHostContextReGlobal, (selectorText) => {
7726
7744
  // We have captured a selector that contains a `:host-context` rule.
7727
7745
  // For backward compatibility `:host-context` may contain a comma separated list of selectors.
7728
7746
  // Each context selector group will contain a list of host-context selectors that must match
@@ -7734,10 +7752,10 @@ class ShadowCss {
7734
7752
  // Execute `_cssColonHostContextRe` over and over until we have extracted all the
7735
7753
  // `:host-context` selectors from this selector.
7736
7754
  let match;
7737
- while (match = _cssColonHostContextRe.exec(selectorText)) {
7755
+ while ((match = _cssColonHostContextRe.exec(selectorText))) {
7738
7756
  // `match` = [':host-context(<selectors>)<rest>', <selectors>, <rest>]
7739
7757
  // The `<selectors>` could actually be a comma separated list: `:host-context(.one, .two)`.
7740
- const newContextSelectors = (match[1] ?? '').trim().split(',').map(m => m.trim()).filter(m => m !== '');
7758
+ const newContextSelectors = (match[1] ?? '').trim().split(',').map((m) => m.trim()).filter((m) => m !== '');
7741
7759
  // We must duplicate the current selector group for each of these new selectors.
7742
7760
  // For example if the current groups are:
7743
7761
  // ```
@@ -7760,7 +7778,7 @@ class ShadowCss {
7760
7778
  repeatGroups(contextSelectorGroups, newContextSelectors.length);
7761
7779
  for (let i = 0; i < newContextSelectors.length; i++) {
7762
7780
  for (let j = 0; j < contextSelectorGroupsLength; j++) {
7763
- contextSelectorGroups[j + (i * contextSelectorGroupsLength)].push(newContextSelectors[i]);
7781
+ contextSelectorGroups[j + i * contextSelectorGroupsLength].push(newContextSelectors[i]);
7764
7782
  }
7765
7783
  }
7766
7784
  // Update the `selectorText` and see repeat to see if there are more `:host-context`s.
@@ -7770,7 +7788,7 @@ class ShadowCss {
7770
7788
  // selectors that `:host-context` can match. See `combineHostContextSelectors()` for more
7771
7789
  // info about how this is done.
7772
7790
  return contextSelectorGroups
7773
- .map(contextSelectors => combineHostContextSelectors(contextSelectors, selectorText))
7791
+ .map((contextSelectors) => combineHostContextSelectors(contextSelectors, selectorText))
7774
7792
  .join(', ');
7775
7793
  });
7776
7794
  }
@@ -7822,7 +7840,7 @@ class ShadowCss {
7822
7840
  * ```
7823
7841
  */
7824
7842
  _stripScopingSelectors(cssText) {
7825
- return processRules(cssText, rule => {
7843
+ return processRules(cssText, (rule) => {
7826
7844
  const selector = rule.selector.replace(_shadowDeepSelectors, ' ')
7827
7845
  .replace(_polyfillHostNoCombinatorRe, ' ');
7828
7846
  return new CssRule(selector, rule.content);
@@ -7830,7 +7848,7 @@ class ShadowCss {
7830
7848
  }
7831
7849
  _scopeSelector(selector, scopeSelector, hostSelector) {
7832
7850
  return selector.split(',')
7833
- .map(part => part.trim().split(_shadowDeepSelectors))
7851
+ .map((part) => part.trim().split(_shadowDeepSelectors))
7834
7852
  .map((deepParts) => {
7835
7853
  const [shallowPart, ...otherParts] = deepParts;
7836
7854
  const applyScope = (shallowPart) => {
@@ -8013,17 +8031,14 @@ const _selectorReSuffix = '([>\\s~+[.,{:][\\s\\S]*)?$';
8013
8031
  const _polyfillHostRe = /-shadowcsshost/gim;
8014
8032
  const _colonHostRe = /:host/gim;
8015
8033
  const _colonHostContextRe = /:host-context/gim;
8034
+ const _newLinesRe = /\r?\n/g;
8016
8035
  const _commentRe = /\/\*[\s\S]*?\*\//g;
8036
+ const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=/g;
8037
+ const COMMENT_PLACEHOLDER = '%COMMENT%';
8038
+ const _commentWithHashPlaceHolderRe = new RegExp(COMMENT_PLACEHOLDER, 'g');
8017
8039
  const _placeholderRe = /__ph-(\d+)__/g;
8018
- function stripComments(input) {
8019
- return input.replace(_commentRe, '');
8020
- }
8021
- const _commentWithHashRe = /\/\*\s*#\s*source(Mapping)?URL=[\s\S]+?\*\//g;
8022
- function extractCommentsWithHash(input) {
8023
- return input.match(_commentWithHashRe) || [];
8024
- }
8025
8040
  const BLOCK_PLACEHOLDER = '%BLOCK%';
8026
- const _ruleRe = /(\s*)([^;\{\}]+?)(\s*)((?:{%BLOCK%}?\s*;?)|(?:\s*;))/g;
8041
+ const _ruleRe = new RegExp(`(\\s*(?:${COMMENT_PLACEHOLDER}\\s*)*)([^;\\{\\}]+?)(\\s*)((?:{%BLOCK%}?\\s*;?)|(?:\\s*;))`, 'g');
8027
8042
  const CONTENT_PAIRS = new Map([['{', '}']]);
8028
8043
  const COMMA_IN_PLACEHOLDER = '%COMMA_IN_PLACEHOLDER%';
8029
8044
  const SEMI_IN_PLACEHOLDER = '%SEMI_IN_PLACEHOLDER%';
@@ -8232,7 +8247,6 @@ function unescapeQuotes(str, isQuoted) {
8232
8247
  *
8233
8248
  * And so on...
8234
8249
  *
8235
- * @param hostMarker the string that selects the host element.
8236
8250
  * @param contextSelectors an array of context selectors that will be combined.
8237
8251
  * @param otherSelectors the rest of the selectors that are not context selectors.
8238
8252
  */
@@ -8388,26 +8402,46 @@ var OpKind;
8388
8402
  * An operation to end rendering of an element previously started with `ElementStart`.
8389
8403
  */
8390
8404
  OpKind[OpKind["ElementEnd"] = 6] = "ElementEnd";
8405
+ /**
8406
+ * An operation to begin an `ng-container`.
8407
+ */
8408
+ OpKind[OpKind["ContainerStart"] = 7] = "ContainerStart";
8409
+ /**
8410
+ * An operation for an `ng-container` with no children.
8411
+ */
8412
+ OpKind[OpKind["Container"] = 8] = "Container";
8413
+ /**
8414
+ * An operation to end an `ng-container`.
8415
+ */
8416
+ OpKind[OpKind["ContainerEnd"] = 9] = "ContainerEnd";
8391
8417
  /**
8392
8418
  * An operation to render a text node.
8393
8419
  */
8394
- OpKind[OpKind["Text"] = 7] = "Text";
8420
+ OpKind[OpKind["Text"] = 10] = "Text";
8395
8421
  /**
8396
8422
  * An operation declaring an event listener for an element.
8397
8423
  */
8398
- OpKind[OpKind["Listener"] = 8] = "Listener";
8424
+ OpKind[OpKind["Listener"] = 11] = "Listener";
8399
8425
  /**
8400
8426
  * An operation to interpolate text into a text node.
8401
8427
  */
8402
- OpKind[OpKind["InterpolateText"] = 9] = "InterpolateText";
8428
+ OpKind[OpKind["InterpolateText"] = 12] = "InterpolateText";
8403
8429
  /**
8404
8430
  * An operation to bind an expression to a property of an element.
8405
8431
  */
8406
- OpKind[OpKind["Property"] = 10] = "Property";
8432
+ OpKind[OpKind["Property"] = 13] = "Property";
8433
+ /**
8434
+ * An operation to interpolate text into a property binding.
8435
+ */
8436
+ OpKind[OpKind["InterpolateProperty"] = 14] = "InterpolateProperty";
8407
8437
  /**
8408
8438
  * An operation to advance the runtime's implicit slot context during the update phase of a view.
8409
8439
  */
8410
- OpKind[OpKind["Advance"] = 11] = "Advance";
8440
+ OpKind[OpKind["Advance"] = 15] = "Advance";
8441
+ /**
8442
+ * An operation to instantiate a pipe.
8443
+ */
8444
+ OpKind[OpKind["Pipe"] = 16] = "Pipe";
8411
8445
  })(OpKind || (OpKind = {}));
8412
8446
  /**
8413
8447
  * Distinguishes different kinds of IR expressions.
@@ -8446,6 +8480,22 @@ var ExpressionKind;
8446
8480
  * Runtime operation to reset the current view context after `RestoreView`.
8447
8481
  */
8448
8482
  ExpressionKind[ExpressionKind["ResetView"] = 7] = "ResetView";
8483
+ /**
8484
+ * Defines and calls a function with change-detected arguments.
8485
+ */
8486
+ ExpressionKind[ExpressionKind["PureFunctionExpr"] = 8] = "PureFunctionExpr";
8487
+ /**
8488
+ * Indicates a positional parameter to a pure function definition.
8489
+ */
8490
+ ExpressionKind[ExpressionKind["PureFunctionParameterExpr"] = 9] = "PureFunctionParameterExpr";
8491
+ /**
8492
+ * Binding to a pipe transformation.
8493
+ */
8494
+ ExpressionKind[ExpressionKind["PipeBinding"] = 10] = "PipeBinding";
8495
+ /**
8496
+ * Binding to a pipe transformation with a variable number of arguments.
8497
+ */
8498
+ ExpressionKind[ExpressionKind["PipeBindingVariadic"] = 11] = "PipeBindingVariadic";
8449
8499
  })(ExpressionKind || (ExpressionKind = {}));
8450
8500
  /**
8451
8501
  * Distinguishes between different kinds of `SemanticVariable`s.
@@ -8652,10 +8702,12 @@ class OpList {
8652
8702
  * Insert `op` before `before`.
8653
8703
  */
8654
8704
  static insertBefore(op, before) {
8655
- OpList.assertIsNotEnd(before);
8705
+ OpList.assertIsOwned(before);
8706
+ if (before.prev === null) {
8707
+ throw new Error(`AssertionError: illegal operation on list start`);
8708
+ }
8656
8709
  OpList.assertIsNotEnd(op);
8657
8710
  OpList.assertIsUnowned(op);
8658
- OpList.assertIsOwned(before);
8659
8711
  op.debugListId = before.debugListId;
8660
8712
  // Just in case.
8661
8713
  op.prev = null;
@@ -8693,6 +8745,17 @@ class OpList {
8693
8745
  }
8694
8746
  }
8695
8747
  }
8748
+
8749
+ new Map([
8750
+ [OpKind.ElementEnd, [OpKind.ElementStart, OpKind.Element]],
8751
+ [OpKind.ContainerEnd, [OpKind.ContainerStart, OpKind.Container]],
8752
+ ]);
8753
+ [
8754
+ Identifiers.pipeBind1,
8755
+ Identifiers.pipeBind2,
8756
+ Identifiers.pipeBind3,
8757
+ Identifiers.pipeBind4,
8758
+ ];
8696
8759
  /**
8697
8760
  * `InterpolationConfig` for the `textInterpolate` instruction.
8698
8761
  */
@@ -8709,6 +8772,50 @@ class OpList {
8709
8772
  Identifiers.textInterpolate8,
8710
8773
  ],
8711
8774
  variable: Identifiers.textInterpolateV,
8775
+ mapping: n => {
8776
+ if (n % 2 === 0) {
8777
+ throw new Error(`Expected odd number of arguments`);
8778
+ }
8779
+ return (n - 1) / 2;
8780
+ },
8781
+ });
8782
+ /**
8783
+ * `InterpolationConfig` for the `propertyInterpolate` instruction.
8784
+ */
8785
+ ({
8786
+ constant: [
8787
+ Identifiers.propertyInterpolate,
8788
+ Identifiers.propertyInterpolate1,
8789
+ Identifiers.propertyInterpolate2,
8790
+ Identifiers.propertyInterpolate3,
8791
+ Identifiers.propertyInterpolate4,
8792
+ Identifiers.propertyInterpolate5,
8793
+ Identifiers.propertyInterpolate6,
8794
+ Identifiers.propertyInterpolate7,
8795
+ Identifiers.propertyInterpolate8,
8796
+ ],
8797
+ variable: Identifiers.propertyInterpolateV,
8798
+ mapping: n => {
8799
+ if (n % 2 === 0) {
8800
+ throw new Error(`Expected odd number of arguments`);
8801
+ }
8802
+ return (n - 1) / 2;
8803
+ },
8804
+ });
8805
+ ({
8806
+ constant: [
8807
+ Identifiers.pureFunction0,
8808
+ Identifiers.pureFunction1,
8809
+ Identifiers.pureFunction2,
8810
+ Identifiers.pureFunction3,
8811
+ Identifiers.pureFunction4,
8812
+ Identifiers.pureFunction5,
8813
+ Identifiers.pureFunction6,
8814
+ Identifiers.pureFunction7,
8815
+ Identifiers.pureFunction8,
8816
+ ],
8817
+ variable: Identifiers.pureFunctionV,
8818
+ mapping: n => n,
8712
8819
  });
8713
8820
  /**
8714
8821
  * A [fence](https://en.wikipedia.org/wiki/Memory_barrier) flag for an expression which indicates
@@ -8748,6 +8855,29 @@ new Set([
8748
8855
  Identifiers.elementStart,
8749
8856
  Identifiers.elementEnd,
8750
8857
  Identifiers.property,
8858
+ Identifiers.elementContainerStart,
8859
+ Identifiers.elementContainerEnd,
8860
+ Identifiers.elementContainer,
8861
+ ]);
8862
+
8863
+ new Map([
8864
+ ['&&', exports.BinaryOperator.And],
8865
+ ['>', exports.BinaryOperator.Bigger],
8866
+ ['>=', exports.BinaryOperator.BiggerEquals],
8867
+ ['&', exports.BinaryOperator.BitwiseAnd],
8868
+ ['/', exports.BinaryOperator.Divide],
8869
+ ['==', exports.BinaryOperator.Equals],
8870
+ ['===', exports.BinaryOperator.Identical],
8871
+ ['<', exports.BinaryOperator.Lower],
8872
+ ['<=', exports.BinaryOperator.LowerEquals],
8873
+ ['-', exports.BinaryOperator.Minus],
8874
+ ['%', exports.BinaryOperator.Modulo],
8875
+ ['*', exports.BinaryOperator.Multiply],
8876
+ ['!=', exports.BinaryOperator.NotEquals],
8877
+ ['!==', exports.BinaryOperator.NotIdentical],
8878
+ ['??', exports.BinaryOperator.NullishCoalesce],
8879
+ ['||', exports.BinaryOperator.Or],
8880
+ ['+', exports.BinaryOperator.Plus],
8751
8881
  ]);
8752
8882
 
8753
8883
  /**
@@ -18968,6 +19098,9 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
18968
19098
  if (meta.isStandalone) {
18969
19099
  definitionMap.set('standalone', literal(true));
18970
19100
  }
19101
+ if (meta.isSignal) {
19102
+ definitionMap.set('signals', literal(true));
19103
+ }
18971
19104
  return definitionMap;
18972
19105
  }
18973
19106
  /**
@@ -18978,6 +19111,7 @@ function addFeatures(definitionMap, meta) {
18978
19111
  const features = [];
18979
19112
  const providers = meta.providers;
18980
19113
  const viewProviders = meta.viewProviders;
19114
+ const inputKeys = Object.keys(meta.inputs);
18981
19115
  if (providers || viewProviders) {
18982
19116
  const args = [providers || new LiteralArrayExpr([])];
18983
19117
  if (viewProviders) {
@@ -18985,6 +19119,12 @@ function addFeatures(definitionMap, meta) {
18985
19119
  }
18986
19120
  features.push(importExpr(Identifiers.ProvidersFeature).callFn(args));
18987
19121
  }
19122
+ for (const key of inputKeys) {
19123
+ if (meta.inputs[key].transformFunction !== null) {
19124
+ features.push(importExpr(Identifiers.InputTransformsFeatureFeature));
19125
+ break;
19126
+ }
19127
+ }
18988
19128
  if (meta.usesInheritance) {
18989
19129
  features.push(importExpr(Identifiers.InheritDefinitionFeature));
18990
19130
  }
@@ -19123,6 +19263,12 @@ function createComponentType(meta) {
19123
19263
  typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
19124
19264
  typeParams.push(expressionType(literal(meta.isStandalone)));
19125
19265
  typeParams.push(createHostDirectivesType(meta));
19266
+ // TODO(signals): Always include this metadata starting with v17. Right
19267
+ // now Angular v16.0.x does not support this field and library distributions
19268
+ // would then be incompatible with v16.0.x framework users.
19269
+ if (meta.isSignal) {
19270
+ typeParams.push(expressionType(literal(meta.isSignal)));
19271
+ }
19126
19272
  return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
19127
19273
  }
19128
19274
  /**
@@ -19250,6 +19396,12 @@ function createDirectiveType(meta) {
19250
19396
  typeParams.push(NONE_TYPE);
19251
19397
  typeParams.push(expressionType(literal(meta.isStandalone)));
19252
19398
  typeParams.push(createHostDirectivesType(meta));
19399
+ // TODO(signals): Always include this metadata starting with v17. Right
19400
+ // now Angular v16.0.x does not support this field and library distributions
19401
+ // would then be incompatible with v16.0.x framework users.
19402
+ if (meta.isSignal) {
19403
+ typeParams.push(expressionType(literal(meta.isSignal)));
19404
+ }
19253
19405
  return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
19254
19406
  }
19255
19407
  // Define and update any view queries
@@ -19868,7 +20020,8 @@ function convertDirectiveFacadeToMetadata(facade) {
19868
20020
  inputsFromType[field] = {
19869
20021
  bindingPropertyName: ann.alias || field,
19870
20022
  classPropertyName: field,
19871
- required: ann.required || false
20023
+ required: ann.required || false,
20024
+ transformFunction: ann.transform != null ? new WrappedNodeExpr(ann.transform) : null,
19872
20025
  };
19873
20026
  }
19874
20027
  else if (isOutput(ann)) {
@@ -19913,6 +20066,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
19913
20066
  typeArgumentCount: 0,
19914
20067
  fullInheritance: false,
19915
20068
  isStandalone: declaration.isStandalone ?? false,
20069
+ isSignal: declaration.isSignal ?? false,
19916
20070
  hostDirectives: convertHostDirectivesToMetadata(declaration),
19917
20071
  };
19918
20072
  }
@@ -20136,9 +20290,22 @@ function isOutput(value) {
20136
20290
  function inputsMappingToInputMetadata(inputs) {
20137
20291
  return Object.keys(inputs).reduce((result, key) => {
20138
20292
  const value = inputs[key];
20139
- result[key] = typeof value === 'string' ?
20140
- { bindingPropertyName: value, classPropertyName: value, required: false } :
20141
- { bindingPropertyName: value[0], classPropertyName: value[1], required: false };
20293
+ if (typeof value === 'string') {
20294
+ result[key] = {
20295
+ bindingPropertyName: value,
20296
+ classPropertyName: value,
20297
+ transformFunction: null,
20298
+ required: false,
20299
+ };
20300
+ }
20301
+ else {
20302
+ result[key] = {
20303
+ bindingPropertyName: value[0],
20304
+ classPropertyName: value[1],
20305
+ transformFunction: value[2] ? new WrappedNodeExpr(value[2]) : null,
20306
+ required: false,
20307
+ };
20308
+ }
20142
20309
  return result;
20143
20310
  }, {});
20144
20311
  }
@@ -20146,13 +20313,19 @@ function parseInputsArray(values) {
20146
20313
  return values.reduce((results, value) => {
20147
20314
  if (typeof value === 'string') {
20148
20315
  const [bindingPropertyName, classPropertyName] = parseMappingString(value);
20149
- results[classPropertyName] = { bindingPropertyName, classPropertyName, required: false };
20316
+ results[classPropertyName] = {
20317
+ bindingPropertyName,
20318
+ classPropertyName,
20319
+ required: false,
20320
+ transformFunction: null,
20321
+ };
20150
20322
  }
20151
20323
  else {
20152
20324
  results[value.name] = {
20153
20325
  bindingPropertyName: value.alias || value.name,
20154
20326
  classPropertyName: value.name,
20155
- required: value.required || false
20327
+ required: value.required || false,
20328
+ transformFunction: value.transform != null ? new WrappedNodeExpr(value.transform) : null,
20156
20329
  };
20157
20330
  }
20158
20331
  return results;
@@ -20204,7 +20377,7 @@ function publishFacade(global) {
20204
20377
  * @description
20205
20378
  * Entry point for all public APIs of the compiler package.
20206
20379
  */
20207
- const VERSION = new Version('16.0.3');
20380
+ const VERSION = new Version('16.1.2');
20208
20381
 
20209
20382
  class CompilerConfig {
20210
20383
  constructor({ defaultEncapsulation = exports.ViewEncapsulation.Emulated, useJit = true, missingTranslation = null, preserveWhitespaces, strictInjectionParameters } = {}) {
@@ -22132,7 +22305,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
22132
22305
  function compileDeclareClassMetadata(metadata) {
22133
22306
  const definitionMap = new DefinitionMap();
22134
22307
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
22135
- definitionMap.set('version', literal('16.0.3'));
22308
+ definitionMap.set('version', literal('16.1.2'));
22136
22309
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22137
22310
  definitionMap.set('type', metadata.type);
22138
22311
  definitionMap.set('decorators', metadata.decorators);
@@ -22235,12 +22408,15 @@ function compileDeclareDirectiveFromMetadata(meta) {
22235
22408
  function createDirectiveDefinitionMap(meta) {
22236
22409
  const definitionMap = new DefinitionMap();
22237
22410
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
22238
- definitionMap.set('version', literal('16.0.3'));
22411
+ definitionMap.set('version', literal('16.1.2'));
22239
22412
  // e.g. `type: MyDirective`
22240
22413
  definitionMap.set('type', meta.type.value);
22241
22414
  if (meta.isStandalone) {
22242
22415
  definitionMap.set('isStandalone', literal(meta.isStandalone));
22243
22416
  }
22417
+ if (meta.isSignal) {
22418
+ definitionMap.set('isSignal', literal(meta.isSignal));
22419
+ }
22244
22420
  // e.g. `selector: 'some-dir'`
22245
22421
  if (meta.selector !== null) {
22246
22422
  definitionMap.set('selector', literal(meta.selector));
@@ -22457,7 +22633,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
22457
22633
  function compileDeclareFactoryFunction(meta) {
22458
22634
  const definitionMap = new DefinitionMap();
22459
22635
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
22460
- definitionMap.set('version', literal('16.0.3'));
22636
+ definitionMap.set('version', literal('16.1.2'));
22461
22637
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22462
22638
  definitionMap.set('type', meta.type.value);
22463
22639
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -22492,7 +22668,7 @@ function compileDeclareInjectableFromMetadata(meta) {
22492
22668
  function createInjectableDefinitionMap(meta) {
22493
22669
  const definitionMap = new DefinitionMap();
22494
22670
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
22495
- definitionMap.set('version', literal('16.0.3'));
22671
+ definitionMap.set('version', literal('16.1.2'));
22496
22672
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22497
22673
  definitionMap.set('type', meta.type.value);
22498
22674
  // Only generate providedIn property if it has a non-null value
@@ -22543,7 +22719,7 @@ function compileDeclareInjectorFromMetadata(meta) {
22543
22719
  function createInjectorDefinitionMap(meta) {
22544
22720
  const definitionMap = new DefinitionMap();
22545
22721
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
22546
- definitionMap.set('version', literal('16.0.3'));
22722
+ definitionMap.set('version', literal('16.1.2'));
22547
22723
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22548
22724
  definitionMap.set('type', meta.type.value);
22549
22725
  definitionMap.set('providers', meta.providers);
@@ -22573,7 +22749,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
22573
22749
  function createNgModuleDefinitionMap(meta) {
22574
22750
  const definitionMap = new DefinitionMap();
22575
22751
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
22576
- definitionMap.set('version', literal('16.0.3'));
22752
+ definitionMap.set('version', literal('16.1.2'));
22577
22753
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22578
22754
  definitionMap.set('type', meta.type.value);
22579
22755
  // We only generate the keys in the metadata if the arrays contain values.
@@ -22624,7 +22800,7 @@ function compileDeclarePipeFromMetadata(meta) {
22624
22800
  function createPipeDefinitionMap(meta) {
22625
22801
  const definitionMap = new DefinitionMap();
22626
22802
  definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
22627
- definitionMap.set('version', literal('16.0.3'));
22803
+ definitionMap.set('version', literal('16.1.2'));
22628
22804
  definitionMap.set('ngImport', importExpr(Identifiers.core));
22629
22805
  // e.g. `type: MyPipe`
22630
22806
  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": "16.0.4-alpha.11+3b8ddfd",
3
+ "version": "16.0.4-alpha.12+cd1622e",
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": "3b8ddfdfbb5d27f2483402e134146dad8809d8b0"
18
+ "gitHead": "cd1622e725b0771584878e5ad18a41e02ea78671"
19
19
  }