@angular/core 20.1.0-rc.0 → 20.2.0-next.0

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 (57) hide show
  1. package/api.d.d.ts +1 -1
  2. package/chrome_dev_tools_performance.d.d.ts +1 -1
  3. package/discovery.d.d.ts +1 -1
  4. package/event_dispatcher.d.d.ts +1 -1
  5. package/fesm2022/attribute.mjs +1 -1
  6. package/fesm2022/core.mjs +3 -3
  7. package/fesm2022/core.mjs.map +1 -1
  8. package/fesm2022/debug_node.mjs +7 -5
  9. package/fesm2022/debug_node.mjs.map +1 -1
  10. package/fesm2022/not_found.mjs +1 -1
  11. package/fesm2022/primitives/di.mjs +1 -1
  12. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  13. package/fesm2022/primitives/signals.mjs +1 -1
  14. package/fesm2022/resource.mjs +1 -1
  15. package/fesm2022/root_effect_scheduler.mjs +1 -1
  16. package/fesm2022/rxjs-interop.mjs +1 -1
  17. package/fesm2022/signal.mjs +1 -1
  18. package/fesm2022/testing.mjs +1 -1
  19. package/fesm2022/untracked.mjs +1 -1
  20. package/fesm2022/weak_ref.mjs +1 -1
  21. package/graph.d.d.ts +1 -1
  22. package/index.d.ts +2 -2
  23. package/package.json +2 -2
  24. package/primitives/di/index.d.ts +1 -1
  25. package/primitives/event-dispatch/index.d.ts +1 -1
  26. package/primitives/signals/index.d.ts +1 -1
  27. package/rxjs-interop/index.d.ts +1 -1
  28. package/schematics/bundles/{apply_import_manager-DEMoyu96.cjs → apply_import_manager-B0fYYMpr.cjs} +3 -3
  29. package/schematics/bundles/{checker-CwuJOWZI.cjs → checker-DLInMAS3.cjs} +382 -1109
  30. package/schematics/bundles/cleanup-unused-imports.cjs +6 -5
  31. package/schematics/bundles/{compiler_host-B1N_OYoF.cjs → compiler_host-Doj9KVJf.cjs} +2 -2
  32. package/schematics/bundles/control-flow-migration.cjs +3 -3
  33. package/schematics/bundles/document-core.cjs +6 -5
  34. package/schematics/bundles/imports-CIX-JgAN.cjs +1 -1
  35. package/schematics/bundles/{index-CmuNlSML.cjs → index-BmuUS1AB.cjs} +930 -54
  36. package/schematics/bundles/{index-DPxKO2pR.cjs → index-Bp8sCiq1.cjs} +5 -4
  37. package/schematics/bundles/inject-flags.cjs +6 -5
  38. package/schematics/bundles/inject-migration.cjs +3 -3
  39. package/schematics/bundles/leading_space-D9nQ8UQC.cjs +1 -1
  40. package/schematics/bundles/{migrate_ts_type_references-Da3yLjVM.cjs → migrate_ts_type_references-CmZ0155c.cjs} +6 -5
  41. package/schematics/bundles/ng_decorators-B5HCqr20.cjs +1 -1
  42. package/schematics/bundles/nodes-B16H9JUd.cjs +1 -1
  43. package/schematics/bundles/output-migration.cjs +7 -6
  44. package/schematics/bundles/{project_paths-86Qe1BQQ.cjs → project_paths-D2SJWT7x.cjs} +39 -3
  45. package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.cjs +1 -1
  46. package/schematics/bundles/property_name-BBwFuqMe.cjs +1 -1
  47. package/schematics/bundles/route-lazy-loading.cjs +3 -3
  48. package/schematics/bundles/self-closing-tags-migration.cjs +5 -4
  49. package/schematics/bundles/signal-input-migration.cjs +8 -7
  50. package/schematics/bundles/signal-queries-migration.cjs +8 -7
  51. package/schematics/bundles/signals.cjs +8 -7
  52. package/schematics/bundles/standalone-migration.cjs +4 -4
  53. package/schematics/bundles/symbol-VPWguRxr.cjs +1 -1
  54. package/schematics/bundles/test-bed-get.cjs +5 -4
  55. package/signal.d.d.ts +1 -1
  56. package/testing/index.d.ts +1 -1
  57. package/weak_ref.d.d.ts +1 -1
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.1.0-rc.0
3
+ * @license Angular v20.2.0-next.0
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -32,6 +32,7 @@ function _interopNamespaceDefault(e) {
32
32
  }
33
33
 
34
34
  var p__namespace = /*#__PURE__*/_interopNamespaceDefault(p);
35
+ var url__namespace = /*#__PURE__*/_interopNamespaceDefault(url);
35
36
 
36
37
  const _SELECTOR_REGEXP = new RegExp('(\\:not\\()|' + // 1: ":not("
37
38
  '(([\\.\\#]?)[-\\w]+)|' + // 2: "tag"; 3: "."/"#";
@@ -2166,7 +2167,7 @@ function ifStmt(condition, thenClause, elseClause, sourceSpan, leadingComments)
2166
2167
  function taggedTemplate(tag, template, type, sourceSpan) {
2167
2168
  return new TaggedTemplateLiteralExpr(tag, template, type, sourceSpan);
2168
2169
  }
2169
- function literal$1(value, type, sourceSpan) {
2170
+ function literal(value, type, sourceSpan) {
2170
2171
  return new LiteralExpr(value, type, sourceSpan);
2171
2172
  }
2172
2173
  function localizedString(metaBlock, messageParts, placeholderNames, expressions, sourceSpan) {
@@ -3122,7 +3123,7 @@ class _EmittedLine {
3122
3123
  this.indent = indent;
3123
3124
  }
3124
3125
  }
3125
- const BINARY_OPERATORS$4 = new Map([
3126
+ const BINARY_OPERATORS$2 = new Map([
3126
3127
  [BinaryOperator.And, '&&'],
3127
3128
  [BinaryOperator.Bigger, '>'],
3128
3129
  [BinaryOperator.BiggerEquals, '>='],
@@ -3476,7 +3477,7 @@ class AbstractEmitterVisitor {
3476
3477
  return null;
3477
3478
  }
3478
3479
  visitBinaryOperatorExpr(ast, ctx) {
3479
- const operator = BINARY_OPERATORS$4.get(ast.operator);
3480
+ const operator = BINARY_OPERATORS$2.get(ast.operator);
3480
3481
  if (!operator) {
3481
3482
  throw new Error(`Unknown operator ${ast.operator}`);
3482
3483
  }
@@ -3613,7 +3614,7 @@ function devOnlyGuardedExpression(expr) {
3613
3614
  }
3614
3615
  function guardedExpression(guard, expr) {
3615
3616
  const guardExpr = new ExternalExpr({ name: guard, moduleName: null });
3616
- const guardNotDefined = new BinaryOperatorExpr(BinaryOperator.Identical, new TypeofExpr(guardExpr), literal$1('undefined'));
3617
+ const guardNotDefined = new BinaryOperatorExpr(BinaryOperator.Identical, new TypeofExpr(guardExpr), literal('undefined'));
3617
3618
  const guardUndefinedOrTrue = new BinaryOperatorExpr(BinaryOperator.Or, guardNotDefined, guardExpr,
3618
3619
  /* type */ undefined,
3619
3620
  /* sourceSpan */ undefined);
@@ -3759,7 +3760,7 @@ function injectDependencies(deps, target) {
3759
3760
  function compileInjectDependency(dep, target, index) {
3760
3761
  // Interpret the dependency according to its resolved type.
3761
3762
  if (dep.token === null) {
3762
- return importExpr(Identifiers.invalidFactoryDep).callFn([literal$1(index)]);
3763
+ return importExpr(Identifiers.invalidFactoryDep).callFn([literal(index)]);
3763
3764
  }
3764
3765
  else if (dep.attributeNameType === null) {
3765
3766
  // Build up the injection flags according to the metadata.
@@ -3772,7 +3773,7 @@ function compileInjectDependency(dep, target, index) {
3772
3773
  // If this dependency is optional or otherwise has non-default flags, then additional
3773
3774
  // parameters describing how to inject the dependency must be passed to the inject function
3774
3775
  // that's being used.
3775
- let flagsParam = flags !== 0 /* InjectFlags.Default */ || dep.optional ? literal$1(flags) : null;
3776
+ let flagsParam = flags !== 0 /* InjectFlags.Default */ || dep.optional ? literal(flags) : null;
3776
3777
  // Build up the arguments to the injectFn call.
3777
3778
  const injectArgs = [dep.token];
3778
3779
  if (flagsParam) {
@@ -3801,7 +3802,7 @@ function createCtorDepsType(deps) {
3801
3802
  return type;
3802
3803
  }
3803
3804
  else {
3804
- return literal$1(null);
3805
+ return literal(null);
3805
3806
  }
3806
3807
  });
3807
3808
  if (hasTypes) {
@@ -3817,16 +3818,16 @@ function createCtorDepType(dep) {
3817
3818
  entries.push({ key: 'attribute', value: dep.attributeNameType, quoted: false });
3818
3819
  }
3819
3820
  if (dep.optional) {
3820
- entries.push({ key: 'optional', value: literal$1(true), quoted: false });
3821
+ entries.push({ key: 'optional', value: literal(true), quoted: false });
3821
3822
  }
3822
3823
  if (dep.host) {
3823
- entries.push({ key: 'host', value: literal$1(true), quoted: false });
3824
+ entries.push({ key: 'host', value: literal(true), quoted: false });
3824
3825
  }
3825
3826
  if (dep.self) {
3826
- entries.push({ key: 'self', value: literal$1(true), quoted: false });
3827
+ entries.push({ key: 'self', value: literal(true), quoted: false });
3827
3828
  }
3828
3829
  if (dep.skipSelf) {
3829
- entries.push({ key: 'skipSelf', value: literal$1(true), quoted: false });
3830
+ entries.push({ key: 'skipSelf', value: literal(true), quoted: false });
3830
3831
  }
3831
3832
  return entries.length > 0 ? literalMap(entries) : null;
3832
3833
  }
@@ -5971,7 +5972,7 @@ function asLiteral(value) {
5971
5972
  if (Array.isArray(value)) {
5972
5973
  return literalArr(value.map(asLiteral));
5973
5974
  }
5974
- return literal$1(value, INFERRED_TYPE);
5975
+ return literal(value, INFERRED_TYPE);
5975
5976
  }
5976
5977
  /**
5977
5978
  * Serializes inputs and outputs for `defineDirective` and `defineComponent`.
@@ -6015,7 +6016,7 @@ function conditionallyCreateDirectiveBindingLiteral(map, forInputs) {
6015
6016
  // decorator input transform functions, or store flag information if there is any.
6016
6017
  if (forInputs &&
6017
6018
  (differentDeclaringName || hasDecoratorInputTransform || flags !== InputFlags.None)) {
6018
- const result = [literal$1(flags), asLiteral(publicName)];
6019
+ const result = [literal(flags), asLiteral(publicName)];
6019
6020
  if (differentDeclaringName || hasDecoratorInputTransform) {
6020
6021
  result.push(asLiteral(declaredName));
6021
6022
  if (hasDecoratorInputTransform) {
@@ -6498,7 +6499,7 @@ var ParseErrorLevel;
6498
6499
  ParseErrorLevel[ParseErrorLevel["WARNING"] = 0] = "WARNING";
6499
6500
  ParseErrorLevel[ParseErrorLevel["ERROR"] = 1] = "ERROR";
6500
6501
  })(ParseErrorLevel || (ParseErrorLevel = {}));
6501
- class ParseError {
6502
+ class ParseError extends Error {
6502
6503
  span;
6503
6504
  msg;
6504
6505
  level;
@@ -6515,10 +6516,15 @@ class ParseError {
6515
6516
  * couldn't be parsed. Not guaranteed to be defined, but can be used to provide more context.
6516
6517
  */
6517
6518
  relatedError) {
6519
+ super(msg);
6518
6520
  this.span = span;
6519
6521
  this.msg = msg;
6520
6522
  this.level = level;
6521
6523
  this.relatedError = relatedError;
6524
+ // Extending `Error` ends up breaking some internal tests. This appears to be a known issue
6525
+ // when extending errors in TS and the workaround is to explicitly set the prototype.
6526
+ // https://stackoverflow.com/questions/41102060/typescript-extending-error-class
6527
+ Object.setPrototypeOf(this, new.target.prototype);
6522
6528
  }
6523
6529
  contextualMessage() {
6524
6530
  const ctx = this.span.start.getContext(100, 3);
@@ -6821,7 +6827,7 @@ class JitEvaluator {
6821
6827
  const ctx = EmitterVisitorContext.createRoot();
6822
6828
  // Ensure generated code is in strict mode
6823
6829
  if (statements.length > 0 && !isUseStrictStatement(statements[0])) {
6824
- statements = [literal$1('use strict').toStmt(), ...statements];
6830
+ statements = [literal('use strict').toStmt(), ...statements];
6825
6831
  }
6826
6832
  converter.visitAllStatements(statements, ctx);
6827
6833
  converter.createReturnStmt(ctx);
@@ -6927,7 +6933,7 @@ class JitEmitterVisitor extends AbstractJsEmitterVisitor {
6927
6933
  }
6928
6934
  }
6929
6935
  function isUseStrictStatement(statement) {
6930
- return statement.isEquivalent(literal$1('use strict').toStmt());
6936
+ return statement.isEquivalent(literal('use strict').toStmt());
6931
6937
  }
6932
6938
 
6933
6939
  function compileInjector(meta) {
@@ -7172,15 +7178,15 @@ function compilePipeFromMetadata(metadata) {
7172
7178
  // e.g. `name: 'myPipe'`
7173
7179
  definitionMapValues.push({
7174
7180
  key: 'name',
7175
- value: literal$1(metadata.pipeName ?? metadata.name),
7181
+ value: literal(metadata.pipeName ?? metadata.name),
7176
7182
  quoted: false,
7177
7183
  });
7178
7184
  // e.g. `type: MyPipe`
7179
7185
  definitionMapValues.push({ key: 'type', value: metadata.type.value, quoted: false });
7180
7186
  // e.g. `pure: true`
7181
- definitionMapValues.push({ key: 'pure', value: literal$1(metadata.pure), quoted: false });
7187
+ definitionMapValues.push({ key: 'pure', value: literal(metadata.pure), quoted: false });
7182
7188
  if (metadata.isStandalone === false) {
7183
- definitionMapValues.push({ key: 'standalone', value: literal$1(false), quoted: false });
7189
+ definitionMapValues.push({ key: 'standalone', value: literal(false), quoted: false });
7184
7190
  }
7185
7191
  const expression = importExpr(Identifiers.definePipe)
7186
7192
  .callFn([literalMap(definitionMapValues)], undefined, true);
@@ -10444,7 +10450,7 @@ class OpList {
10444
10450
  oldOp.next = null;
10445
10451
  let prev = oldPrev;
10446
10452
  for (const newOp of newOps) {
10447
- this.assertIsUnowned(newOp);
10453
+ OpList.assertIsUnowned(newOp);
10448
10454
  newOp.debugListId = listId;
10449
10455
  prev.next = newOp;
10450
10456
  newOp.prev = prev;
@@ -10485,7 +10491,7 @@ class OpList {
10485
10491
  static insertBefore(op, target) {
10486
10492
  if (Array.isArray(op)) {
10487
10493
  for (const o of op) {
10488
- this.insertBefore(o, target);
10494
+ OpList.insertBefore(o, target);
10489
10495
  }
10490
10496
  return;
10491
10497
  }
@@ -11781,7 +11787,7 @@ function generateConditionalExpressions(job) {
11781
11787
  }
11782
11788
  else {
11783
11789
  // By default, a switch evaluates to `-1`, causing no template to be displayed.
11784
- test = literal$1(-1);
11790
+ test = literal(-1);
11785
11791
  }
11786
11792
  // Switch expressions assign their main test to a temporary, to avoid re-executing it.
11787
11793
  let tmp = op.test == null ? null : new AssignTemporaryExpr(op.test, job.allocateXrefId());
@@ -11812,7 +11818,7 @@ function generateConditionalExpressions(job) {
11812
11818
  }
11813
11819
  }
11814
11820
 
11815
- const BINARY_OPERATORS$3 = new Map([
11821
+ const BINARY_OPERATORS$1 = new Map([
11816
11822
  ['&&', BinaryOperator.And],
11817
11823
  ['>', BinaryOperator.Bigger],
11818
11824
  ['>=', BinaryOperator.BiggerEquals],
@@ -11876,7 +11882,7 @@ function literalOrArrayLiteral(value) {
11876
11882
  if (Array.isArray(value)) {
11877
11883
  return literalArr(value.map(literalOrArrayLiteral));
11878
11884
  }
11879
- return literal$1(value);
11885
+ return literal(value);
11880
11886
  }
11881
11887
 
11882
11888
  /**
@@ -12047,9 +12053,9 @@ class ElementAttributes {
12047
12053
  * Gets an array of literal expressions representing the attribute's namespaced name.
12048
12054
  */
12049
12055
  function getAttributeNameLiterals(namespace, name) {
12050
- const nameLiteral = literal$1(name);
12056
+ const nameLiteral = literal(name);
12051
12057
  if (namespace) {
12052
- return [literal$1(0 /* core.AttributeMarker.NamespaceURI */), literal$1(namespace), nameLiteral];
12058
+ return [literal(0 /* core.AttributeMarker.NamespaceURI */), literal(namespace), nameLiteral];
12053
12059
  }
12054
12060
  return [nameLiteral];
12055
12061
  }
@@ -12062,22 +12068,22 @@ function serializeAttributes({ attributes, bindings, classes, i18n, projectAs, s
12062
12068
  // Parse the attribute value into a CssSelectorList. Note that we only take the
12063
12069
  // first selector, because we don't support multiple selectors in ngProjectAs.
12064
12070
  const parsedR3Selector = parseSelectorToR3Selector(projectAs)[0];
12065
- attrArray.push(literal$1(5 /* core.AttributeMarker.ProjectAs */), literalOrArrayLiteral(parsedR3Selector));
12071
+ attrArray.push(literal(5 /* core.AttributeMarker.ProjectAs */), literalOrArrayLiteral(parsedR3Selector));
12066
12072
  }
12067
12073
  if (classes.length > 0) {
12068
- attrArray.push(literal$1(1 /* core.AttributeMarker.Classes */), ...classes);
12074
+ attrArray.push(literal(1 /* core.AttributeMarker.Classes */), ...classes);
12069
12075
  }
12070
12076
  if (styles.length > 0) {
12071
- attrArray.push(literal$1(2 /* core.AttributeMarker.Styles */), ...styles);
12077
+ attrArray.push(literal(2 /* core.AttributeMarker.Styles */), ...styles);
12072
12078
  }
12073
12079
  if (bindings.length > 0) {
12074
- attrArray.push(literal$1(3 /* core.AttributeMarker.Bindings */), ...bindings);
12080
+ attrArray.push(literal(3 /* core.AttributeMarker.Bindings */), ...bindings);
12075
12081
  }
12076
12082
  if (template.length > 0) {
12077
- attrArray.push(literal$1(4 /* core.AttributeMarker.Template */), ...template);
12083
+ attrArray.push(literal(4 /* core.AttributeMarker.Template */), ...template);
12078
12084
  }
12079
12085
  if (i18n.length > 0) {
12080
- attrArray.push(literal$1(6 /* core.AttributeMarker.I18n */), ...i18n);
12086
+ attrArray.push(literal(6 /* core.AttributeMarker.I18n */), ...i18n);
12081
12087
  }
12082
12088
  return literalArr(attrArray);
12083
12089
  }
@@ -12699,7 +12705,7 @@ function extractI18nMessages(job) {
12699
12705
  throw Error('AssertionError: Unexpected ICU placeholder outside of i18n context');
12700
12706
  }
12701
12707
  const msg = i18nMessagesByContext.get(currentIcu.context);
12702
- msg.postprocessingParams.set(op.name, literal$1(formatIcuPlaceholder(op)));
12708
+ msg.postprocessingParams.set(op.name, literal(formatIcuPlaceholder(op)));
12703
12709
  OpList.remove(op);
12704
12710
  break;
12705
12711
  }
@@ -12733,7 +12739,7 @@ function formatParams(params) {
12733
12739
  for (const [placeholder, placeholderValues] of params) {
12734
12740
  const serializedValues = formatParamValues(placeholderValues);
12735
12741
  if (serializedValues !== null) {
12736
- formattedParams.set(placeholder, literal$1(serializedValues));
12742
+ formattedParams.set(placeholder, literal(serializedValues));
12737
12743
  }
12738
12744
  }
12739
12745
  return formattedParams;
@@ -13110,7 +13116,7 @@ function collectConstExpressions(job) {
13110
13116
  if (!(expr instanceof ConstCollectedExpr)) {
13111
13117
  return expr;
13112
13118
  }
13113
- return literal$1(job.addConst(expr.expr));
13119
+ return literal(job.addConst(expr.expr));
13114
13120
  }, VisitorContextFlag.None);
13115
13121
  }
13116
13122
  }
@@ -16984,12 +16990,16 @@ class EscapedCharacterCursor extends PlainCharacterCursor {
16984
16990
  }
16985
16991
  }
16986
16992
  }
16987
- class CursorError {
16993
+ class CursorError extends Error {
16988
16994
  msg;
16989
16995
  cursor;
16990
16996
  constructor(msg, cursor) {
16997
+ super(msg);
16991
16998
  this.msg = msg;
16992
16999
  this.cursor = cursor;
17000
+ // Extending `Error` does not always work when code is transpiled. See:
17001
+ // https://stackoverflow.com/questions/41102060/typescript-extending-error-class
17002
+ Object.setPrototypeOf(this, new.target.prototype);
16993
17003
  }
16994
17004
  }
16995
17005
 
@@ -17976,9 +17986,11 @@ class Token {
17976
17986
  return this.type === TokenType.Number ? this.numValue : -1;
17977
17987
  }
17978
17988
  isTemplateLiteralPart() {
17989
+ // Note: Explicit type is needed for Closure.
17979
17990
  return this.isString() && this.kind === StringTokenKind.TemplateLiteralPart;
17980
17991
  }
17981
17992
  isTemplateLiteralEnd() {
17993
+ // Note: Explicit type is needed for Closure.
17982
17994
  return this.isString() && this.kind === StringTokenKind.TemplateLiteralEnd;
17983
17995
  }
17984
17996
  isTemplateLiteralInterpolationStart() {
@@ -21428,7 +21440,7 @@ const GOOG_GET_MSG = 'goog.getMsg';
21428
21440
  */
21429
21441
  function createGoogleGetMsgStatements(variable$1, message, closureVar, placeholderValues) {
21430
21442
  const messageString = serializeI18nMessageForGetMsg(message);
21431
- const args = [literal$1(messageString)];
21443
+ const args = [literal(messageString)];
21432
21444
  if (Object.keys(placeholderValues).length) {
21433
21445
  // Message template parameters containing the magic strings replaced by the Angular runtime with
21434
21446
  // real data, e.g. `{'interpolation': '\uFFFD0\uFFFD'}`.
@@ -21442,9 +21454,9 @@ function createGoogleGetMsgStatements(variable$1, message, closureVar, placehold
21442
21454
  quoted: true,
21443
21455
  value: message.placeholders[param]
21444
21456
  ? // Get source span for typical placeholder if it exists.
21445
- literal$1(message.placeholders[param].sourceSpan.toString())
21457
+ literal(message.placeholders[param].sourceSpan.toString())
21446
21458
  : // Otherwise must be an ICU expression, get it's source span.
21447
- literal$1(message.placeholderToMessage[param].nodes
21459
+ literal(message.placeholderToMessage[param].nodes
21448
21460
  .map((node) => node.sourceSpan.toString())
21449
21461
  .join('')),
21450
21462
  }))),
@@ -21759,7 +21771,7 @@ function collectI18nConsts(job) {
21759
21771
  if (i18nExprValue === undefined) {
21760
21772
  throw new Error("AssertionError: Could not find i18n expression's value");
21761
21773
  }
21762
- return [literal$1(i18nExpr.name), i18nExprValue];
21774
+ return [literal(i18nExpr.name), i18nExprValue];
21763
21775
  });
21764
21776
  i18nAttributes.i18nAttributesConfig = job.addConst(new LiteralArrayExpr(i18nAttributeConfig));
21765
21777
  }
@@ -21837,7 +21849,7 @@ function addSubMessageParams(messageOp, subMessagePlaceholders) {
21837
21849
  messageOp.params.set(placeholder, subMessages[0]);
21838
21850
  }
21839
21851
  else {
21840
- messageOp.params.set(placeholder, literal$1(`${ESCAPE}${I18N_ICU_MAPPING_PREFIX}${placeholder}${ESCAPE}`));
21852
+ messageOp.params.set(placeholder, literal(`${ESCAPE}${I18N_ICU_MAPPING_PREFIX}${placeholder}${ESCAPE}`));
21841
21853
  messageOp.postprocessingParams.set(placeholder, literalArr(subMessages));
21842
21854
  }
21843
21855
  }
@@ -21890,7 +21902,7 @@ function getTranslationDeclStmts(message, variable, closureVar, params, transfor
21890
21902
  */
21891
21903
  function createClosureModeGuard() {
21892
21904
  return typeofExpr(variable(NG_I18N_CLOSURE_MODE))
21893
- .notIdentical(literal$1('undefined', STRING_TYPE))
21905
+ .notIdentical(literal('undefined', STRING_TYPE))
21894
21906
  .and(variable(NG_I18N_CLOSURE_MODE));
21895
21907
  }
21896
21908
  /**
@@ -22031,7 +22043,7 @@ function liftLocalRefs(job) {
22031
22043
  function serializeLocalRefs(refs) {
22032
22044
  const constRefs = [];
22033
22045
  for (const ref of refs) {
22034
- constRefs.push(literal$1(ref.name), literal$1(ref.target));
22046
+ constRefs.push(literal(ref.name), literal(ref.target));
22035
22047
  }
22036
22048
  return literalArr(constRefs);
22037
22049
  }
@@ -22167,7 +22179,7 @@ function parseExtractedStyles(job) {
22167
22179
  if (op.name === 'style') {
22168
22180
  const parsedStyles = parse(op.expression.value);
22169
22181
  for (let i = 0; i < parsedStyles.length - 1; i += 2) {
22170
- OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, null, parsedStyles[i], literal$1(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
22182
+ OpList.insertBefore(createExtractedAttributeOp(op.target, BindingKind.StyleProperty, null, parsedStyles[i], literal(parsedStyles[i + 1]), null, null, SecurityContext.STYLE), op);
22171
22183
  }
22172
22184
  OpList.remove(op);
22173
22185
  }
@@ -22910,30 +22922,30 @@ function elementStart(slot, tag, constIndex, localRefIndex, sourceSpan) {
22910
22922
  return elementOrContainerBase(Identifiers.elementStart, slot, tag, constIndex, localRefIndex, sourceSpan);
22911
22923
  }
22912
22924
  function elementOrContainerBase(instruction, slot, tag, constIndex, localRefIndex, sourceSpan) {
22913
- const args = [literal$1(slot)];
22925
+ const args = [literal(slot)];
22914
22926
  if (tag !== null) {
22915
- args.push(literal$1(tag));
22927
+ args.push(literal(tag));
22916
22928
  }
22917
22929
  if (localRefIndex !== null) {
22918
- args.push(literal$1(constIndex), // might be null, but that's okay.
22919
- literal$1(localRefIndex));
22930
+ args.push(literal(constIndex), // might be null, but that's okay.
22931
+ literal(localRefIndex));
22920
22932
  }
22921
22933
  else if (constIndex !== null) {
22922
- args.push(literal$1(constIndex));
22934
+ args.push(literal(constIndex));
22923
22935
  }
22924
22936
  return call(instruction, args, sourceSpan);
22925
22937
  }
22926
22938
  function templateBase(instruction, slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
22927
22939
  const args = [
22928
- literal$1(slot),
22940
+ literal(slot),
22929
22941
  templateFnRef,
22930
- literal$1(decls),
22931
- literal$1(vars),
22932
- literal$1(tag),
22933
- literal$1(constIndex),
22942
+ literal(decls),
22943
+ literal(vars),
22944
+ literal(tag),
22945
+ literal(constIndex),
22934
22946
  ];
22935
22947
  if (localRefs !== null) {
22936
- args.push(literal$1(localRefs));
22948
+ args.push(literal(localRefs));
22937
22949
  args.push(importExpr(Identifiers.templateRefExtractor));
22938
22950
  }
22939
22951
  while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
@@ -22942,7 +22954,7 @@ function templateBase(instruction, slot, templateFnRef, decls, vars, tag, constI
22942
22954
  return call(instruction, args, sourceSpan);
22943
22955
  }
22944
22956
  function propertyBase(instruction, name, expression, sanitizer, sourceSpan) {
22945
- const args = [literal$1(name)];
22957
+ const args = [literal(name)];
22946
22958
  if (expression instanceof Interpolation) {
22947
22959
  args.push(interpolationToExpression(expression, sourceSpan));
22948
22960
  }
@@ -22978,7 +22990,7 @@ function enableBindings() {
22978
22990
  return call(Identifiers.enableBindings, [], null);
22979
22991
  }
22980
22992
  function listener(name, handlerFn, eventTargetResolver, syntheticHost, sourceSpan) {
22981
- const args = [literal$1(name), handlerFn];
22993
+ const args = [literal(name), handlerFn];
22982
22994
  if (eventTargetResolver !== null) {
22983
22995
  args.push(importExpr(eventTargetResolver));
22984
22996
  }
@@ -22988,10 +23000,10 @@ function twoWayBindingSet(target, value) {
22988
23000
  return importExpr(Identifiers.twoWayBindingSet).callFn([target, value]);
22989
23001
  }
22990
23002
  function twoWayListener(name, handlerFn, sourceSpan) {
22991
- return call(Identifiers.twoWayListener, [literal$1(name), handlerFn], sourceSpan);
23003
+ return call(Identifiers.twoWayListener, [literal(name), handlerFn], sourceSpan);
22992
23004
  }
22993
23005
  function pipe(slot, name) {
22994
- return call(Identifiers.pipe, [literal$1(slot), literal$1(name)], null);
23006
+ return call(Identifiers.pipe, [literal(slot), literal(name)], null);
22995
23007
  }
22996
23008
  function namespaceHTML() {
22997
23009
  return call(Identifiers.namespaceHTML, [], null);
@@ -23003,13 +23015,13 @@ function namespaceMath() {
23003
23015
  return call(Identifiers.namespaceMathML, [], null);
23004
23016
  }
23005
23017
  function advance(delta, sourceSpan) {
23006
- return call(Identifiers.advance, delta > 1 ? [literal$1(delta)] : [], sourceSpan);
23018
+ return call(Identifiers.advance, delta > 1 ? [literal(delta)] : [], sourceSpan);
23007
23019
  }
23008
23020
  function reference(slot) {
23009
- return importExpr(Identifiers.reference).callFn([literal$1(slot)]);
23021
+ return importExpr(Identifiers.reference).callFn([literal(slot)]);
23010
23022
  }
23011
23023
  function nextContext(steps) {
23012
- return importExpr(Identifiers.nextContext).callFn(steps === 1 ? [] : [literal$1(steps)]);
23024
+ return importExpr(Identifiers.nextContext).callFn(steps === 1 ? [] : [literal(steps)]);
23013
23025
  }
23014
23026
  function getCurrentView() {
23015
23027
  return importExpr(Identifiers.getCurrentView).callFn([]);
@@ -23021,24 +23033,24 @@ function resetView(returnValue) {
23021
23033
  return importExpr(Identifiers.resetView).callFn([returnValue]);
23022
23034
  }
23023
23035
  function text(slot, initialValue, sourceSpan) {
23024
- const args = [literal$1(slot, null)];
23036
+ const args = [literal(slot, null)];
23025
23037
  if (initialValue !== '') {
23026
- args.push(literal$1(initialValue));
23038
+ args.push(literal(initialValue));
23027
23039
  }
23028
23040
  return call(Identifiers.text, args, sourceSpan);
23029
23041
  }
23030
23042
  function defer(selfSlot, primarySlot, dependencyResolverFn, loadingSlot, placeholderSlot, errorSlot, loadingConfig, placeholderConfig, enableTimerScheduling, sourceSpan, flags) {
23031
23043
  const args = [
23032
- literal$1(selfSlot),
23033
- literal$1(primarySlot),
23034
- dependencyResolverFn ?? literal$1(null),
23035
- literal$1(loadingSlot),
23036
- literal$1(placeholderSlot),
23037
- literal$1(errorSlot),
23038
- loadingConfig ?? literal$1(null),
23039
- placeholderConfig ?? literal$1(null),
23040
- enableTimerScheduling ? importExpr(Identifiers.deferEnableTimerScheduling) : literal$1(null),
23041
- literal$1(flags),
23044
+ literal(selfSlot),
23045
+ literal(primarySlot),
23046
+ dependencyResolverFn ?? literal(null),
23047
+ literal(loadingSlot),
23048
+ literal(placeholderSlot),
23049
+ literal(errorSlot),
23050
+ loadingConfig ?? literal(null),
23051
+ placeholderConfig ?? literal(null),
23052
+ enableTimerScheduling ? importExpr(Identifiers.deferEnableTimerScheduling) : literal(null),
23053
+ literal(flags),
23042
23054
  ];
23043
23055
  let expr;
23044
23056
  while ((expr = args[args.length - 1]) !== null &&
@@ -23111,45 +23123,45 @@ function deferOn(trigger, args, modifier, sourceSpan) {
23111
23123
  if (instructionToCall === undefined) {
23112
23124
  throw new Error(`Unable to determine instruction for trigger ${trigger}`);
23113
23125
  }
23114
- return call(instructionToCall, args.map((a) => literal$1(a)), sourceSpan);
23126
+ return call(instructionToCall, args.map((a) => literal(a)), sourceSpan);
23115
23127
  }
23116
23128
  function projectionDef(def) {
23117
23129
  return call(Identifiers.projectionDef, def ? [def] : [], null);
23118
23130
  }
23119
23131
  function projection(slot, projectionSlotIndex, attributes, fallbackFnName, fallbackDecls, fallbackVars, sourceSpan) {
23120
- const args = [literal$1(slot)];
23132
+ const args = [literal(slot)];
23121
23133
  if (projectionSlotIndex !== 0 || attributes !== null || fallbackFnName !== null) {
23122
- args.push(literal$1(projectionSlotIndex));
23134
+ args.push(literal(projectionSlotIndex));
23123
23135
  if (attributes !== null) {
23124
23136
  args.push(attributes);
23125
23137
  }
23126
23138
  if (fallbackFnName !== null) {
23127
23139
  if (attributes === null) {
23128
- args.push(literal$1(null));
23140
+ args.push(literal(null));
23129
23141
  }
23130
- args.push(variable(fallbackFnName), literal$1(fallbackDecls), literal$1(fallbackVars));
23142
+ args.push(variable(fallbackFnName), literal(fallbackDecls), literal(fallbackVars));
23131
23143
  }
23132
23144
  }
23133
23145
  return call(Identifiers.projection, args, sourceSpan);
23134
23146
  }
23135
23147
  function i18nStart(slot, constIndex, subTemplateIndex, sourceSpan) {
23136
- const args = [literal$1(slot), literal$1(constIndex)];
23148
+ const args = [literal(slot), literal(constIndex)];
23137
23149
  if (subTemplateIndex !== null) {
23138
- args.push(literal$1(subTemplateIndex));
23150
+ args.push(literal(subTemplateIndex));
23139
23151
  }
23140
23152
  return call(Identifiers.i18nStart, args, sourceSpan);
23141
23153
  }
23142
23154
  function conditionalCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
23143
23155
  const args = [
23144
- literal$1(slot),
23156
+ literal(slot),
23145
23157
  templateFnRef,
23146
- literal$1(decls),
23147
- literal$1(vars),
23148
- literal$1(tag),
23149
- literal$1(constIndex),
23158
+ literal(decls),
23159
+ literal(vars),
23160
+ literal(tag),
23161
+ literal(constIndex),
23150
23162
  ];
23151
23163
  if (localRefs !== null) {
23152
- args.push(literal$1(localRefs));
23164
+ args.push(literal(localRefs));
23153
23165
  args.push(importExpr(Identifiers.templateRefExtractor));
23154
23166
  }
23155
23167
  while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
@@ -23159,15 +23171,15 @@ function conditionalCreate(slot, templateFnRef, decls, vars, tag, constIndex, lo
23159
23171
  }
23160
23172
  function conditionalBranchCreate(slot, templateFnRef, decls, vars, tag, constIndex, localRefs, sourceSpan) {
23161
23173
  const args = [
23162
- literal$1(slot),
23174
+ literal(slot),
23163
23175
  templateFnRef,
23164
- literal$1(decls),
23165
- literal$1(vars),
23166
- literal$1(tag),
23167
- literal$1(constIndex),
23176
+ literal(decls),
23177
+ literal(vars),
23178
+ literal(tag),
23179
+ literal(constIndex),
23168
23180
  ];
23169
23181
  if (localRefs !== null) {
23170
- args.push(literal$1(localRefs));
23182
+ args.push(literal(localRefs));
23171
23183
  args.push(importExpr(Identifiers.templateRefExtractor));
23172
23184
  }
23173
23185
  while (args[args.length - 1].isEquivalent(NULL_EXPR)) {
@@ -23177,23 +23189,23 @@ function conditionalBranchCreate(slot, templateFnRef, decls, vars, tag, constInd
23177
23189
  }
23178
23190
  function repeaterCreate(slot, viewFnName, decls, vars, tag, constIndex, trackByFn, trackByUsesComponentInstance, emptyViewFnName, emptyDecls, emptyVars, emptyTag, emptyConstIndex, sourceSpan) {
23179
23191
  const args = [
23180
- literal$1(slot),
23192
+ literal(slot),
23181
23193
  variable(viewFnName),
23182
- literal$1(decls),
23183
- literal$1(vars),
23184
- literal$1(tag),
23185
- literal$1(constIndex),
23194
+ literal(decls),
23195
+ literal(vars),
23196
+ literal(tag),
23197
+ literal(constIndex),
23186
23198
  trackByFn,
23187
23199
  ];
23188
23200
  if (trackByUsesComponentInstance || emptyViewFnName !== null) {
23189
- args.push(literal$1(trackByUsesComponentInstance));
23201
+ args.push(literal(trackByUsesComponentInstance));
23190
23202
  if (emptyViewFnName !== null) {
23191
- args.push(variable(emptyViewFnName), literal$1(emptyDecls), literal$1(emptyVars));
23203
+ args.push(variable(emptyViewFnName), literal(emptyDecls), literal(emptyVars));
23192
23204
  if (emptyTag !== null || emptyConstIndex !== null) {
23193
- args.push(literal$1(emptyTag));
23205
+ args.push(literal(emptyTag));
23194
23206
  }
23195
23207
  if (emptyConstIndex !== null) {
23196
- args.push(literal$1(emptyConstIndex));
23208
+ args.push(literal(emptyConstIndex));
23197
23209
  }
23198
23210
  }
23199
23211
  }
@@ -23212,18 +23224,18 @@ function deferWhen(modifier, expr, sourceSpan) {
23212
23224
  return call(Identifiers.deferWhen, [expr], sourceSpan);
23213
23225
  }
23214
23226
  function declareLet(slot, sourceSpan) {
23215
- return call(Identifiers.declareLet, [literal$1(slot)], sourceSpan);
23227
+ return call(Identifiers.declareLet, [literal(slot)], sourceSpan);
23216
23228
  }
23217
23229
  function storeLet(value, sourceSpan) {
23218
23230
  return importExpr(Identifiers.storeLet).callFn([value], sourceSpan);
23219
23231
  }
23220
23232
  function readContextLet(slot) {
23221
- return importExpr(Identifiers.readContextLet).callFn([literal$1(slot)]);
23233
+ return importExpr(Identifiers.readContextLet).callFn([literal(slot)]);
23222
23234
  }
23223
23235
  function i18n(slot, constIndex, subTemplateIndex, sourceSpan) {
23224
- const args = [literal$1(slot), literal$1(constIndex)];
23236
+ const args = [literal(slot), literal(constIndex)];
23225
23237
  if (subTemplateIndex) {
23226
- args.push(literal$1(subTemplateIndex));
23238
+ args.push(literal(subTemplateIndex));
23227
23239
  }
23228
23240
  return call(Identifiers.i18n, args, sourceSpan);
23229
23241
  }
@@ -23231,21 +23243,21 @@ function i18nEnd(endSourceSpan) {
23231
23243
  return call(Identifiers.i18nEnd, [], endSourceSpan);
23232
23244
  }
23233
23245
  function i18nAttributes(slot, i18nAttributesConfig) {
23234
- const args = [literal$1(slot), literal$1(i18nAttributesConfig)];
23246
+ const args = [literal(slot), literal(i18nAttributesConfig)];
23235
23247
  return call(Identifiers.i18nAttributes, args, null);
23236
23248
  }
23237
23249
  function property(name, expression, sanitizer, sourceSpan) {
23238
23250
  return propertyBase(Identifiers.property, name, expression, sanitizer, sourceSpan);
23239
23251
  }
23240
23252
  function twoWayProperty(name, expression, sanitizer, sourceSpan) {
23241
- const args = [literal$1(name), expression];
23253
+ const args = [literal(name), expression];
23242
23254
  if (sanitizer !== null) {
23243
23255
  args.push(sanitizer);
23244
23256
  }
23245
23257
  return call(Identifiers.twoWayProperty, args, sourceSpan);
23246
23258
  }
23247
23259
  function attribute(name, expression, sanitizer, namespace, sourceSpan) {
23248
- const args = [literal$1(name)];
23260
+ const args = [literal(name)];
23249
23261
  if (expression instanceof Interpolation) {
23250
23262
  args.push(interpolationToExpression(expression, sourceSpan));
23251
23263
  }
@@ -23253,15 +23265,15 @@ function attribute(name, expression, sanitizer, namespace, sourceSpan) {
23253
23265
  args.push(expression);
23254
23266
  }
23255
23267
  if (sanitizer !== null || namespace !== null) {
23256
- args.push(sanitizer ?? literal$1(null));
23268
+ args.push(sanitizer ?? literal(null));
23257
23269
  }
23258
23270
  if (namespace !== null) {
23259
- args.push(literal$1(namespace));
23271
+ args.push(literal(namespace));
23260
23272
  }
23261
23273
  return call(Identifiers.attribute, args, null);
23262
23274
  }
23263
23275
  function styleProp(name, expression, unit, sourceSpan) {
23264
- const args = [literal$1(name)];
23276
+ const args = [literal(name)];
23265
23277
  if (expression instanceof Interpolation) {
23266
23278
  args.push(interpolationToExpression(expression, sourceSpan));
23267
23279
  }
@@ -23269,12 +23281,12 @@ function styleProp(name, expression, unit, sourceSpan) {
23269
23281
  args.push(expression);
23270
23282
  }
23271
23283
  if (unit !== null) {
23272
- args.push(literal$1(unit));
23284
+ args.push(literal(unit));
23273
23285
  }
23274
23286
  return call(Identifiers.styleProp, args, sourceSpan);
23275
23287
  }
23276
23288
  function classProp(name, expression, sourceSpan) {
23277
- return call(Identifiers.classProp, [literal$1(name), expression], sourceSpan);
23289
+ return call(Identifiers.classProp, [literal(name), expression], sourceSpan);
23278
23290
  }
23279
23291
  function styleMap(expression, sourceSpan) {
23280
23292
  const value = expression instanceof Interpolation
@@ -23309,7 +23321,7 @@ function domElementContainerEnd() {
23309
23321
  return call(Identifiers.domElementContainerEnd, [], null);
23310
23322
  }
23311
23323
  function domListener(name, handlerFn, eventTargetResolver, sourceSpan) {
23312
- const args = [literal$1(name), handlerFn];
23324
+ const args = [literal(name), handlerFn];
23313
23325
  if (eventTargetResolver !== null) {
23314
23326
  args.push(importExpr(eventTargetResolver));
23315
23327
  }
@@ -23329,10 +23341,10 @@ function pipeBind(slot, varOffset, args) {
23329
23341
  throw new Error(`pipeBind() argument count out of bounds`);
23330
23342
  }
23331
23343
  const instruction = PIPE_BINDINGS[args.length - 1];
23332
- return importExpr(instruction).callFn([literal$1(slot), literal$1(varOffset), ...args]);
23344
+ return importExpr(instruction).callFn([literal(slot), literal(varOffset), ...args]);
23333
23345
  }
23334
23346
  function pipeBindV(slot, varOffset, args) {
23335
- return importExpr(Identifiers.pipeBindV).callFn([literal$1(slot), literal$1(varOffset), args]);
23347
+ return importExpr(Identifiers.pipeBindV).callFn([literal(slot), literal(varOffset), args]);
23336
23348
  }
23337
23349
  function textInterpolate(strings, expressions, sourceSpan) {
23338
23350
  const interpolationArgs = collateInterpolationArgs(strings, expressions);
@@ -23342,19 +23354,19 @@ function i18nExp(expr, sourceSpan) {
23342
23354
  return call(Identifiers.i18nExp, [expr], sourceSpan);
23343
23355
  }
23344
23356
  function i18nApply(slot, sourceSpan) {
23345
- return call(Identifiers.i18nApply, [literal$1(slot)], sourceSpan);
23357
+ return call(Identifiers.i18nApply, [literal(slot)], sourceSpan);
23346
23358
  }
23347
23359
  function domProperty(name, expression, sanitizer, sourceSpan) {
23348
23360
  return propertyBase(Identifiers.domProperty, name, expression, sanitizer, sourceSpan);
23349
23361
  }
23350
23362
  function syntheticHostProperty(name, expression, sourceSpan) {
23351
- return call(Identifiers.syntheticHostProperty, [literal$1(name), expression], sourceSpan);
23363
+ return call(Identifiers.syntheticHostProperty, [literal(name), expression], sourceSpan);
23352
23364
  }
23353
23365
  function pureFunction(varOffset, fn, args) {
23354
- return callVariadicInstructionExpr(PURE_FUNCTION_CONFIG, [literal$1(varOffset), fn], args, [], null);
23366
+ return callVariadicInstructionExpr(PURE_FUNCTION_CONFIG, [literal(varOffset), fn], args, [], null);
23355
23367
  }
23356
23368
  function attachSourceLocation(templatePath, locations) {
23357
- return call(Identifiers.attachSourceLocations, [literal$1(templatePath), locations], null);
23369
+ return call(Identifiers.attachSourceLocations, [literal(templatePath), locations], null);
23358
23370
  }
23359
23371
  /**
23360
23372
  * Collates the string an expression arguments for an interpolation instruction.
@@ -23370,10 +23382,10 @@ function collateInterpolationArgs(strings, expressions) {
23370
23382
  else {
23371
23383
  let idx;
23372
23384
  for (idx = 0; idx < expressions.length; idx++) {
23373
- interpolationArgs.push(literal$1(strings[idx]), expressions[idx]);
23385
+ interpolationArgs.push(literal(strings[idx]), expressions[idx]);
23374
23386
  }
23375
23387
  // idx points at the last string.
23376
- interpolationArgs.push(literal$1(strings[idx]));
23388
+ interpolationArgs.push(literal(strings[idx]));
23377
23389
  }
23378
23390
  return interpolationArgs;
23379
23391
  }
@@ -23488,6 +23500,18 @@ const GLOBAL_TARGET_RESOLVERS = new Map([
23488
23500
  ['document', Identifiers.resolveDocument],
23489
23501
  ['body', Identifiers.resolveBody],
23490
23502
  ]);
23503
+ /**
23504
+ * DOM properties that need to be remapped on the compiler side.
23505
+ * Note: this mapping has to be kept in sync with the equally named mapping in the runtime.
23506
+ */
23507
+ const DOM_PROPERTY_REMAPPING = new Map([
23508
+ ['class', 'className'],
23509
+ ['for', 'htmlFor'],
23510
+ ['formaction', 'formAction'],
23511
+ ['innerHtml', 'innerHTML'],
23512
+ ['readonly', 'readOnly'],
23513
+ ['tabindex', 'tabIndex'],
23514
+ ]);
23491
23515
  /**
23492
23516
  * Compiles semantic operations across all views and generates output `o.Statement`s with actual
23493
23517
  * runtime calls in their place.
@@ -23735,10 +23759,10 @@ function reifyCreateOperations(unit, ops) {
23735
23759
  throw new Error('No slot was assigned for source location');
23736
23760
  }
23737
23761
  return literalArr([
23738
- literal$1(targetSlot.slot),
23739
- literal$1(offset),
23740
- literal$1(line),
23741
- literal$1(column),
23762
+ literal(targetSlot.slot),
23763
+ literal(offset),
23764
+ literal(line),
23765
+ literal(column),
23742
23766
  ]);
23743
23767
  }));
23744
23768
  OpList.replace(op, attachSourceLocation(op.templatePath, locationsLiteral));
@@ -23760,7 +23784,7 @@ function reifyUpdateOperations(unit, ops) {
23760
23784
  break;
23761
23785
  case OpKind.Property:
23762
23786
  OpList.replace(op, unit.job.mode === TemplateCompilationMode.DomOnly && !op.isLegacyAnimationTrigger
23763
- ? domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan)
23787
+ ? domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan)
23764
23788
  : property(op.name, op.expression, op.sanitizer, op.sourceSpan));
23765
23789
  break;
23766
23790
  case OpKind.TwoWayProperty:
@@ -23799,7 +23823,7 @@ function reifyUpdateOperations(unit, ops) {
23799
23823
  OpList.replace(op, syntheticHostProperty(op.name, op.expression, op.sourceSpan));
23800
23824
  }
23801
23825
  else {
23802
- OpList.replace(op, domProperty(op.name, op.expression, op.sanitizer, op.sourceSpan));
23826
+ OpList.replace(op, domProperty(DOM_PROPERTY_REMAPPING.get(op.name) ?? op.name, op.expression, op.sanitizer, op.sourceSpan));
23803
23827
  }
23804
23828
  }
23805
23829
  break;
@@ -23880,7 +23904,7 @@ function reifyIrExpression(expr) {
23880
23904
  case ExpressionKind.PipeBindingVariadic:
23881
23905
  return pipeBindV(expr.targetSlot.slot, expr.varOffset, expr.args);
23882
23906
  case ExpressionKind.SlotLiteralExpr:
23883
- return literal$1(expr.slot.slot);
23907
+ return literal(expr.slot.slot);
23884
23908
  case ExpressionKind.ContextLetReference:
23885
23909
  return readContextLet(expr.targetSlot.slot);
23886
23910
  case ExpressionKind.StoreLet:
@@ -24014,7 +24038,7 @@ function removeIllegalLetReferences(job) {
24014
24038
  const name = op.variable.identifier;
24015
24039
  let current = op;
24016
24040
  while (current && current.kind !== OpKind.ListEnd) {
24017
- transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal$1(undefined) : expr, VisitorContextFlag.None);
24041
+ transformExpressionsInOp(current, (expr) => expr instanceof LexicalReadExpr && expr.name === name ? literal(undefined) : expr, VisitorContextFlag.None);
24018
24042
  current = current.prev;
24019
24043
  }
24020
24044
  }
@@ -25952,7 +25976,7 @@ function maybeGenerateRfBlock(flag, statements) {
25952
25976
  return [];
25953
25977
  }
25954
25978
  return [
25955
- ifStmt(new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, variable('rf'), literal$1(flag)), statements),
25979
+ ifStmt(new BinaryOperatorExpr(BinaryOperator.BitwiseAnd, variable('rf'), literal(flag)), statements),
25956
25980
  ];
25957
25981
  }
25958
25982
  function emitHostBindingFunction(job) {
@@ -26200,7 +26224,7 @@ function ingestContent(unit, content) {
26200
26224
  const op = createProjectionOp(id, content.selector, content.i18n, fallbackView?.xref ?? null, content.sourceSpan);
26201
26225
  for (const attr of content.attributes) {
26202
26226
  const securityContext = domSchema.securityContext(content.name, attr.name, true);
26203
- unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal$1(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
26227
+ unit.update.push(createBindingOp(op.xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
26204
26228
  }
26205
26229
  unit.create.push(op);
26206
26230
  }
@@ -26526,13 +26550,13 @@ function getComputedForLoopVariableExpression(variable, indexName, countName) {
26526
26550
  case '$count':
26527
26551
  return new LexicalReadExpr(countName);
26528
26552
  case '$first':
26529
- return new LexicalReadExpr(indexName).identical(literal$1(0));
26553
+ return new LexicalReadExpr(indexName).identical(literal(0));
26530
26554
  case '$last':
26531
- return new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal$1(1)));
26555
+ return new LexicalReadExpr(indexName).identical(new LexicalReadExpr(countName).minus(literal(1)));
26532
26556
  case '$even':
26533
- return new LexicalReadExpr(indexName).modulo(literal$1(2)).identical(literal$1(0));
26557
+ return new LexicalReadExpr(indexName).modulo(literal(2)).identical(literal(0));
26534
26558
  case '$odd':
26535
- return new LexicalReadExpr(indexName).modulo(literal$1(2)).notIdentical(literal$1(0));
26559
+ return new LexicalReadExpr(indexName).modulo(literal(2)).notIdentical(literal(0));
26536
26560
  default:
26537
26561
  throw new Error(`AssertionError: unknown @for loop variable ${variable.value}`);
26538
26562
  }
@@ -26568,7 +26592,7 @@ function convertAst(ast, job, baseSourceSpan) {
26568
26592
  }
26569
26593
  }
26570
26594
  else if (ast instanceof LiteralPrimitive) {
26571
- return literal$1(ast.value, undefined, convertSourceSpan(ast.span, baseSourceSpan));
26595
+ return literal(ast.value, undefined, convertSourceSpan(ast.span, baseSourceSpan));
26572
26596
  }
26573
26597
  else if (ast instanceof Unary) {
26574
26598
  switch (ast.operator) {
@@ -26581,7 +26605,7 @@ function convertAst(ast, job, baseSourceSpan) {
26581
26605
  }
26582
26606
  }
26583
26607
  else if (ast instanceof Binary) {
26584
- const operator = BINARY_OPERATORS$3.get(ast.operation);
26608
+ const operator = BINARY_OPERATORS$1.get(ast.operation);
26585
26609
  if (operator === undefined) {
26586
26610
  throw new Error(`AssertionError: unknown binary operator ${ast.operation}`);
26587
26611
  }
@@ -26674,7 +26698,7 @@ function convertAstWithInterpolation(job, value, i18nMeta, sourceSpan) {
26674
26698
  expression = convertAst(value, job, null);
26675
26699
  }
26676
26700
  else {
26677
- expression = literal$1(value);
26701
+ expression = literal(value);
26678
26702
  }
26679
26703
  return expression;
26680
26704
  }
@@ -27017,7 +27041,7 @@ function ingestControlFlowInsertionPoint(unit, xref, node) {
27017
27041
  // Collect the static attributes for content projection purposes.
27018
27042
  for (const attr of root.attributes) {
27019
27043
  const securityContext = domSchema.securityContext(NG_TEMPLATE_TAG_NAME, attr.name, true);
27020
- unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal$1(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
27044
+ unit.update.push(createBindingOp(xref, BindingKind.Attribute, attr.name, literal(attr.value), null, securityContext, true, false, null, asMessage(attr.i18n), attr.sourceSpan));
27021
27045
  }
27022
27046
  // Also collect the inputs since they participate in content projection as well.
27023
27047
  // Note that TDB used to collect the outputs as well, but it wasn't passing them into
@@ -27057,7 +27081,7 @@ function getTemplateSourceLocationsEnabled() {
27057
27081
 
27058
27082
  // if (rf & flags) { .. }
27059
27083
  function renderFlagCheckIfStmt(flags, statements) {
27060
- return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal$1(flags), null), statements);
27084
+ return ifStmt(variable(RENDER_FLAGS).bitwiseAnd(literal(flags), null), statements);
27061
27085
  }
27062
27086
  /**
27063
27087
  * Translates query flags into `TQueryFlags` type in
@@ -27076,7 +27100,7 @@ function getQueryPredicate(query, constantPool) {
27076
27100
  // Each item in predicates array may contain strings with comma-separated refs
27077
27101
  // (for ex. 'ref, ref1, ..., refN'), thus we extract individual refs and store them
27078
27102
  // as separate array entities
27079
- const selectors = selector.split(',').map((token) => literal$1(token.trim()));
27103
+ const selectors = selector.split(',').map((token) => literal(token.trim()));
27080
27104
  predicate.push(...selectors);
27081
27105
  });
27082
27106
  return constantPool.getConstLiteral(literalArr(predicate), true);
@@ -27100,7 +27124,7 @@ function createQueryCreateCall(query, constantPool, queryTypeFns, prependParams)
27100
27124
  if (query.isSignal) {
27101
27125
  parameters.push(new ReadPropExpr(variable(CONTEXT_NAME), query.propertyName));
27102
27126
  }
27103
- parameters.push(getQueryPredicate(query, constantPool), literal$1(toQueryFlags(query)));
27127
+ parameters.push(getQueryPredicate(query, constantPool), literal(toQueryFlags(query)));
27104
27128
  if (query.read) {
27105
27129
  parameters.push(query.read);
27106
27130
  }
@@ -27137,7 +27161,7 @@ function collapseAdvanceStatements(statements) {
27137
27161
  const flushAdvanceCount = () => {
27138
27162
  if (advanceCollapseCount > 0) {
27139
27163
  result.unshift(importExpr(Identifiers.queryAdvance)
27140
- .callFn(advanceCollapseCount === 1 ? [] : [literal$1(advanceCollapseCount)])
27164
+ .callFn(advanceCollapseCount === 1 ? [] : [literal(advanceCollapseCount)])
27141
27165
  .toStmt());
27142
27166
  advanceCollapseCount = 0;
27143
27167
  }
@@ -29558,13 +29582,13 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
29558
29582
  // e.g 'outputs: {a: 'a'}`
29559
29583
  definitionMap.set('outputs', conditionallyCreateDirectiveBindingLiteral(meta.outputs));
29560
29584
  if (meta.exportAs !== null) {
29561
- definitionMap.set('exportAs', literalArr(meta.exportAs.map((e) => literal$1(e))));
29585
+ definitionMap.set('exportAs', literalArr(meta.exportAs.map((e) => literal(e))));
29562
29586
  }
29563
29587
  if (meta.isStandalone === false) {
29564
- definitionMap.set('standalone', literal$1(false));
29588
+ definitionMap.set('standalone', literal(false));
29565
29589
  }
29566
29590
  if (meta.isSignal) {
29567
- definitionMap.set('signals', literal$1(true));
29591
+ definitionMap.set('signals', literal(true));
29568
29592
  }
29569
29593
  return definitionMap;
29570
29594
  }
@@ -29599,7 +29623,7 @@ function addFeatures(definitionMap, meta) {
29599
29623
  features.push(importExpr(Identifiers.NgOnChangesFeature));
29600
29624
  }
29601
29625
  if ('externalStyles' in meta && meta.externalStyles?.length) {
29602
- const externalStyleNodes = meta.externalStyles.map((externalStyle) => literal$1(externalStyle));
29626
+ const externalStyleNodes = meta.externalStyles.map((externalStyle) => literal(externalStyle));
29603
29627
  features.push(importExpr(Identifiers.ExternalStylesFeature).callFn([literalArr(externalStyleNodes)]));
29604
29628
  }
29605
29629
  if (features.length) {
@@ -29630,7 +29654,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
29630
29654
  if (firstSelector) {
29631
29655
  const selectorAttributes = firstSelector.getAttrs();
29632
29656
  if (selectorAttributes.length) {
29633
- definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map((value) => value != null ? literal$1(value) : literal$1(undefined))),
29657
+ definitionMap.set('attrs', constantPool.getConstLiteral(literalArr(selectorAttributes.map((value) => value != null ? literal(value) : literal(undefined))),
29634
29658
  /* forceShared */ true));
29635
29659
  }
29636
29660
  }
@@ -29655,8 +29679,8 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
29655
29679
  if (tpl.contentSelectors !== null) {
29656
29680
  definitionMap.set('ngContentSelectors', tpl.contentSelectors);
29657
29681
  }
29658
- definitionMap.set('decls', literal$1(tpl.root.decls));
29659
- definitionMap.set('vars', literal$1(tpl.root.vars));
29682
+ definitionMap.set('decls', literal(tpl.root.decls));
29683
+ definitionMap.set('vars', literal(tpl.root.vars));
29660
29684
  if (tpl.consts.length > 0) {
29661
29685
  if (tpl.constsInitializers.length > 0) {
29662
29686
  definitionMap.set('consts', arrowFn([], [...tpl.constsInitializers, new ReturnStatement(literalArr(tpl.consts))]));
@@ -29688,7 +29712,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
29688
29712
  : meta.styles;
29689
29713
  const styleNodes = styleValues.reduce((result, style) => {
29690
29714
  if (style.trim().length > 0) {
29691
- result.push(constantPool.getConstLiteral(literal$1(style)));
29715
+ result.push(constantPool.getConstLiteral(literal(style)));
29692
29716
  }
29693
29717
  return result;
29694
29718
  }, []);
@@ -29703,7 +29727,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
29703
29727
  }
29704
29728
  // Only set view encapsulation if it's not the default value
29705
29729
  if (meta.encapsulation !== exports.ViewEncapsulation.Emulated) {
29706
- definitionMap.set('encapsulation', literal$1(meta.encapsulation));
29730
+ definitionMap.set('encapsulation', literal(meta.encapsulation));
29707
29731
  }
29708
29732
  // e.g. `animation: [trigger('123', [])]`
29709
29733
  if (meta.animations !== null) {
@@ -29714,7 +29738,7 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
29714
29738
  if (typeof meta.changeDetection === 'number' &&
29715
29739
  meta.changeDetection !== exports.ChangeDetectionStrategy.Default) {
29716
29740
  // changeDetection is resolved during analysis. Only set it if not the default.
29717
- definitionMap.set('changeDetection', literal$1(meta.changeDetection));
29741
+ definitionMap.set('changeDetection', literal(meta.changeDetection));
29718
29742
  }
29719
29743
  else if (typeof meta.changeDetection === 'object') {
29720
29744
  // changeDetection is not resolved during analysis (e.g., we are in local compilation mode).
@@ -29734,13 +29758,13 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
29734
29758
  function createComponentType(meta) {
29735
29759
  const typeParams = createBaseDirectiveTypeParams(meta);
29736
29760
  typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
29737
- typeParams.push(expressionType(literal$1(meta.isStandalone)));
29761
+ typeParams.push(expressionType(literal(meta.isStandalone)));
29738
29762
  typeParams.push(createHostDirectivesType(meta));
29739
29763
  // TODO(signals): Always include this metadata starting with v17. Right
29740
29764
  // now Angular v16.0.x does not support this field and library distributions
29741
29765
  // would then be incompatible with v16.0.x framework users.
29742
29766
  if (meta.isSignal) {
29743
- typeParams.push(expressionType(literal$1(meta.isSignal)));
29767
+ typeParams.push(expressionType(literal(meta.isSignal)));
29744
29768
  }
29745
29769
  return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
29746
29770
  }
@@ -29765,14 +29789,14 @@ function compileDeclarationList(list, mode) {
29765
29789
  }
29766
29790
  }
29767
29791
  function stringAsType(str) {
29768
- return expressionType(literal$1(str));
29792
+ return expressionType(literal(str));
29769
29793
  }
29770
29794
  function stringMapAsLiteralExpression(map) {
29771
29795
  const mapValues = Object.keys(map).map((key) => {
29772
29796
  const value = Array.isArray(map[key]) ? map[key][0] : map[key];
29773
29797
  return {
29774
29798
  key,
29775
- value: literal$1(value),
29799
+ value: literal(value),
29776
29800
  quoted: true,
29777
29801
  };
29778
29802
  });
@@ -29780,7 +29804,7 @@ function stringMapAsLiteralExpression(map) {
29780
29804
  }
29781
29805
  function stringArrayAsType(arr) {
29782
29806
  return arr.length > 0
29783
- ? expressionType(literalArr(arr.map((value) => literal$1(value))))
29807
+ ? expressionType(literalArr(arr.map((value) => literal(value))))
29784
29808
  : NONE_TYPE;
29785
29809
  }
29786
29810
  function createBaseDirectiveTypeParams(meta) {
@@ -29800,13 +29824,13 @@ function getInputsTypeExpression(meta) {
29800
29824
  return literalMap(Object.keys(meta.inputs).map((key) => {
29801
29825
  const value = meta.inputs[key];
29802
29826
  const values = [
29803
- { key: 'alias', value: literal$1(value.bindingPropertyName), quoted: true },
29804
- { key: 'required', value: literal$1(value.required), quoted: true },
29827
+ { key: 'alias', value: literal(value.bindingPropertyName), quoted: true },
29828
+ { key: 'required', value: literal(value.required), quoted: true },
29805
29829
  ];
29806
29830
  // TODO(legacy-partial-output-inputs): Consider always emitting this information,
29807
29831
  // or leaving it as is.
29808
29832
  if (value.isSignal) {
29809
- values.push({ key: 'isSignal', value: literal$1(value.isSignal), quoted: true });
29833
+ values.push({ key: 'isSignal', value: literal(value.isSignal), quoted: true });
29810
29834
  }
29811
29835
  return { key, value: literalMap(values), quoted: true };
29812
29836
  }));
@@ -29820,13 +29844,13 @@ function createDirectiveType(meta) {
29820
29844
  // Directives have no NgContentSelectors slot, but instead express a `never` type
29821
29845
  // so that future fields align.
29822
29846
  typeParams.push(NONE_TYPE);
29823
- typeParams.push(expressionType(literal$1(meta.isStandalone)));
29847
+ typeParams.push(expressionType(literal(meta.isStandalone)));
29824
29848
  typeParams.push(createHostDirectivesType(meta));
29825
29849
  // TODO(signals): Always include this metadata starting with v17. Right
29826
29850
  // now Angular v16.0.x does not support this field and library distributions
29827
29851
  // would then be incompatible with v16.0.x framework users.
29828
29852
  if (meta.isSignal) {
29829
- typeParams.push(expressionType(literal$1(meta.isSignal)));
29853
+ typeParams.push(expressionType(literal(meta.isSignal)));
29830
29854
  }
29831
29855
  return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
29832
29856
  }
@@ -29840,10 +29864,10 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
29840
29864
  // actually already handle these special attributes internally. Therefore, we just drop them
29841
29865
  // into the attributes map.
29842
29866
  if (hostBindingsMetadata.specialAttributes.styleAttr) {
29843
- hostBindingsMetadata.attributes['style'] = literal$1(hostBindingsMetadata.specialAttributes.styleAttr);
29867
+ hostBindingsMetadata.attributes['style'] = literal(hostBindingsMetadata.specialAttributes.styleAttr);
29844
29868
  }
29845
29869
  if (hostBindingsMetadata.specialAttributes.classAttr) {
29846
- hostBindingsMetadata.attributes['class'] = literal$1(hostBindingsMetadata.specialAttributes.classAttr);
29870
+ hostBindingsMetadata.attributes['class'] = literal(hostBindingsMetadata.specialAttributes.classAttr);
29847
29871
  }
29848
29872
  const hostJob = ingestHostBinding({
29849
29873
  componentName: name,
@@ -29856,7 +29880,7 @@ function createHostBindingsFunction(hostBindingsMetadata, typeSourceSpan, bindin
29856
29880
  definitionMap.set('hostAttrs', hostJob.root.attributes);
29857
29881
  const varCount = hostJob.root.vars;
29858
29882
  if (varCount !== null && varCount > 0) {
29859
- definitionMap.set('hostVars', literal$1(varCount));
29883
+ definitionMap.set('hostVars', literal(varCount));
29860
29884
  }
29861
29885
  return emitHostBindingFunction(hostJob);
29862
29886
  }
@@ -29887,7 +29911,7 @@ function parseHostBindings(host) {
29887
29911
  break;
29888
29912
  default:
29889
29913
  if (typeof value === 'string') {
29890
- attributes[key] = literal$1(value);
29914
+ attributes[key] = literal(value);
29891
29915
  }
29892
29916
  else {
29893
29917
  attributes[key] = value;
@@ -30001,7 +30025,7 @@ function createHostDirectivesMappingArray(mapping) {
30001
30025
  const elements = [];
30002
30026
  for (const publicName in mapping) {
30003
30027
  if (mapping.hasOwnProperty(publicName)) {
30004
- elements.push(literal$1(publicName), literal$1(mapping[publicName]));
30028
+ elements.push(literal(publicName), literal(mapping[publicName]));
30005
30029
  }
30006
30030
  }
30007
30031
  return elements.length > 0 ? literalArr(elements) : null;
@@ -31554,7 +31578,7 @@ function createR3DependencyMetadata(token, isAttributeDep, host, optional, self,
31554
31578
  // If the dep is an `@Attribute()` the `attributeNameType` ought to be the `unknown` type.
31555
31579
  // But types are not available at runtime so we just use a literal `"<unknown>"` string as a dummy
31556
31580
  // marker.
31557
- const attributeNameType = isAttributeDep ? literal$1('unknown') : null;
31581
+ const attributeNameType = isAttributeDep ? literal('unknown') : null;
31558
31582
  return { token, attributeNameType, host, optional, self, skipSelf };
31559
31583
  }
31560
31584
  function createR3ComponentDeferMetadata(boundTarget, deferBlockDependencies) {
@@ -32204,7 +32228,7 @@ function isAttrNode(ast) {
32204
32228
  * @description
32205
32229
  * Entry point for all public APIs of the compiler package.
32206
32230
  */
32207
- new Version('20.1.0-rc.0');
32231
+ new Version('20.2.0-next.0');
32208
32232
 
32209
32233
  //////////////////////////////////////
32210
32234
  // THIS FILE HAS GLOBAL SIDE EFFECT //
@@ -33224,8 +33248,11 @@ class NodeJSPathManipulation {
33224
33248
  // G3-ESM-MARKER: G3 uses CommonJS, but externally everything in ESM.
33225
33249
  // CommonJS/ESM interop for determining the current file name and containing dir.
33226
33250
  const isCommonJS = typeof __filename !== 'undefined';
33227
- const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('checker-CwuJOWZI.cjs', document.baseURI).href));
33228
- const currentFileName = isCommonJS ? __filename : url.fileURLToPath(currentFileUrl);
33251
+ const currentFileUrl = isCommonJS ? null : (typeof document === 'undefined' ? require('u' + 'rl').pathToFileURL(__filename).href : (_documentCurrentScript && _documentCurrentScript.tagName.toUpperCase() === 'SCRIPT' && _documentCurrentScript.src || new URL('checker-DLInMAS3.cjs', document.baseURI).href));
33252
+ // Note, when this code loads in the browser, `url` may be an empty `{}` due to the Closure shims.
33253
+ const currentFileName = isCommonJS
33254
+ ? __filename
33255
+ : (url__namespace.fileURLToPath?.(currentFileUrl) ?? null);
33229
33256
  /**
33230
33257
  * A wrapper around the Node.js file-system that supports readonly operations and path manipulation.
33231
33258
  */
@@ -33235,7 +33262,10 @@ class NodeJSReadonlyFileSystem extends NodeJSPathManipulation {
33235
33262
  if (this._caseSensitive === undefined) {
33236
33263
  // Note the use of the real file-system is intentional:
33237
33264
  // `this.exists()` relies upon `isCaseSensitive()` so that would cause an infinite recursion.
33238
- this._caseSensitive = !fs$1.existsSync(this.normalize(toggleCase(currentFileName)));
33265
+ this._caseSensitive =
33266
+ currentFileName !== null
33267
+ ? !fs$1.existsSync(this.normalize(toggleCase(currentFileName)))
33268
+ : true;
33239
33269
  }
33240
33270
  return this._caseSensitive;
33241
33271
  }
@@ -36518,790 +36548,6 @@ function getContainerNode(node) {
36518
36548
  return node.getSourceFile();
36519
36549
  }
36520
36550
 
36521
- class ArraySliceBuiltinFn extends KnownFn {
36522
- lhs;
36523
- constructor(lhs) {
36524
- super();
36525
- this.lhs = lhs;
36526
- }
36527
- evaluate(node, args) {
36528
- if (args.length === 0) {
36529
- return this.lhs;
36530
- }
36531
- else {
36532
- return DynamicValue.fromUnknown(node);
36533
- }
36534
- }
36535
- }
36536
- class ArrayConcatBuiltinFn extends KnownFn {
36537
- lhs;
36538
- constructor(lhs) {
36539
- super();
36540
- this.lhs = lhs;
36541
- }
36542
- evaluate(node, args) {
36543
- const result = [...this.lhs];
36544
- for (const arg of args) {
36545
- if (arg instanceof DynamicValue) {
36546
- result.push(DynamicValue.fromDynamicInput(node, arg));
36547
- }
36548
- else if (Array.isArray(arg)) {
36549
- result.push(...arg);
36550
- }
36551
- else {
36552
- result.push(arg);
36553
- }
36554
- }
36555
- return result;
36556
- }
36557
- }
36558
- class StringConcatBuiltinFn extends KnownFn {
36559
- lhs;
36560
- constructor(lhs) {
36561
- super();
36562
- this.lhs = lhs;
36563
- }
36564
- evaluate(node, args) {
36565
- let result = this.lhs;
36566
- for (const arg of args) {
36567
- const resolved = arg instanceof EnumValue ? arg.resolved : arg;
36568
- if (typeof resolved === 'string' ||
36569
- typeof resolved === 'number' ||
36570
- typeof resolved === 'boolean' ||
36571
- resolved == null) {
36572
- // Cast to `any`, because `concat` will convert
36573
- // anything to a string, but TS only allows strings.
36574
- result = result.concat(resolved);
36575
- }
36576
- else {
36577
- return DynamicValue.fromUnknown(node);
36578
- }
36579
- }
36580
- return result;
36581
- }
36582
- }
36583
-
36584
- /**
36585
- * A value produced which originated in a `ForeignFunctionResolver` and doesn't come from the
36586
- * template itself.
36587
- *
36588
- * Synthetic values cannot be further evaluated, and attempts to do so produce `DynamicValue`s
36589
- * instead.
36590
- */
36591
- class SyntheticValue {
36592
- value;
36593
- constructor(value) {
36594
- this.value = value;
36595
- }
36596
- }
36597
-
36598
- function literalBinaryOp(op) {
36599
- return { op, literal: true };
36600
- }
36601
- function referenceBinaryOp(op) {
36602
- return { op, literal: false };
36603
- }
36604
- const BINARY_OPERATORS$2 = new Map([
36605
- [ts.SyntaxKind.PlusToken, literalBinaryOp((a, b) => a + b)],
36606
- [ts.SyntaxKind.MinusToken, literalBinaryOp((a, b) => a - b)],
36607
- [ts.SyntaxKind.AsteriskToken, literalBinaryOp((a, b) => a * b)],
36608
- [ts.SyntaxKind.SlashToken, literalBinaryOp((a, b) => a / b)],
36609
- [ts.SyntaxKind.PercentToken, literalBinaryOp((a, b) => a % b)],
36610
- [ts.SyntaxKind.AmpersandToken, literalBinaryOp((a, b) => a & b)],
36611
- [ts.SyntaxKind.BarToken, literalBinaryOp((a, b) => a | b)],
36612
- [ts.SyntaxKind.CaretToken, literalBinaryOp((a, b) => a ^ b)],
36613
- [ts.SyntaxKind.LessThanToken, literalBinaryOp((a, b) => a < b)],
36614
- [ts.SyntaxKind.LessThanEqualsToken, literalBinaryOp((a, b) => a <= b)],
36615
- [ts.SyntaxKind.GreaterThanToken, literalBinaryOp((a, b) => a > b)],
36616
- [ts.SyntaxKind.GreaterThanEqualsToken, literalBinaryOp((a, b) => a >= b)],
36617
- [ts.SyntaxKind.EqualsEqualsToken, literalBinaryOp((a, b) => a == b)],
36618
- [ts.SyntaxKind.EqualsEqualsEqualsToken, literalBinaryOp((a, b) => a === b)],
36619
- [ts.SyntaxKind.ExclamationEqualsToken, literalBinaryOp((a, b) => a != b)],
36620
- [ts.SyntaxKind.ExclamationEqualsEqualsToken, literalBinaryOp((a, b) => a !== b)],
36621
- [ts.SyntaxKind.LessThanLessThanToken, literalBinaryOp((a, b) => a << b)],
36622
- [ts.SyntaxKind.GreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >> b)],
36623
- [ts.SyntaxKind.GreaterThanGreaterThanGreaterThanToken, literalBinaryOp((a, b) => a >>> b)],
36624
- [ts.SyntaxKind.AsteriskAsteriskToken, literalBinaryOp((a, b) => Math.pow(a, b))],
36625
- [ts.SyntaxKind.AmpersandAmpersandToken, referenceBinaryOp((a, b) => a && b)],
36626
- [ts.SyntaxKind.BarBarToken, referenceBinaryOp((a, b) => a || b)],
36627
- ]);
36628
- const UNARY_OPERATORS$2 = new Map([
36629
- [ts.SyntaxKind.TildeToken, (a) => ~a],
36630
- [ts.SyntaxKind.MinusToken, (a) => -a],
36631
- [ts.SyntaxKind.PlusToken, (a) => +a],
36632
- [ts.SyntaxKind.ExclamationToken, (a) => !a],
36633
- ]);
36634
- class StaticInterpreter {
36635
- host;
36636
- checker;
36637
- dependencyTracker;
36638
- constructor(host, checker, dependencyTracker) {
36639
- this.host = host;
36640
- this.checker = checker;
36641
- this.dependencyTracker = dependencyTracker;
36642
- }
36643
- visit(node, context) {
36644
- return this.visitExpression(node, context);
36645
- }
36646
- visitExpression(node, context) {
36647
- let result;
36648
- if (node.kind === ts.SyntaxKind.TrueKeyword) {
36649
- return true;
36650
- }
36651
- else if (node.kind === ts.SyntaxKind.FalseKeyword) {
36652
- return false;
36653
- }
36654
- else if (node.kind === ts.SyntaxKind.NullKeyword) {
36655
- return null;
36656
- }
36657
- else if (ts.isStringLiteral(node)) {
36658
- return node.text;
36659
- }
36660
- else if (ts.isNoSubstitutionTemplateLiteral(node)) {
36661
- return node.text;
36662
- }
36663
- else if (ts.isTemplateExpression(node)) {
36664
- result = this.visitTemplateExpression(node, context);
36665
- }
36666
- else if (ts.isNumericLiteral(node)) {
36667
- return parseFloat(node.text);
36668
- }
36669
- else if (ts.isObjectLiteralExpression(node)) {
36670
- result = this.visitObjectLiteralExpression(node, context);
36671
- }
36672
- else if (ts.isIdentifier(node)) {
36673
- result = this.visitIdentifier(node, context);
36674
- }
36675
- else if (ts.isPropertyAccessExpression(node)) {
36676
- result = this.visitPropertyAccessExpression(node, context);
36677
- }
36678
- else if (ts.isCallExpression(node)) {
36679
- result = this.visitCallExpression(node, context);
36680
- }
36681
- else if (ts.isConditionalExpression(node)) {
36682
- result = this.visitConditionalExpression(node, context);
36683
- }
36684
- else if (ts.isPrefixUnaryExpression(node)) {
36685
- result = this.visitPrefixUnaryExpression(node, context);
36686
- }
36687
- else if (ts.isBinaryExpression(node)) {
36688
- result = this.visitBinaryExpression(node, context);
36689
- }
36690
- else if (ts.isArrayLiteralExpression(node)) {
36691
- result = this.visitArrayLiteralExpression(node, context);
36692
- }
36693
- else if (ts.isParenthesizedExpression(node)) {
36694
- result = this.visitParenthesizedExpression(node, context);
36695
- }
36696
- else if (ts.isElementAccessExpression(node)) {
36697
- result = this.visitElementAccessExpression(node, context);
36698
- }
36699
- else if (ts.isAsExpression(node)) {
36700
- result = this.visitExpression(node.expression, context);
36701
- }
36702
- else if (ts.isNonNullExpression(node)) {
36703
- result = this.visitExpression(node.expression, context);
36704
- }
36705
- else if (this.host.isClass(node)) {
36706
- result = this.visitDeclaration(node, context);
36707
- }
36708
- else {
36709
- return DynamicValue.fromUnsupportedSyntax(node);
36710
- }
36711
- if (result instanceof DynamicValue && result.node !== node) {
36712
- return DynamicValue.fromDynamicInput(node, result);
36713
- }
36714
- return result;
36715
- }
36716
- visitArrayLiteralExpression(node, context) {
36717
- const array = [];
36718
- for (let i = 0; i < node.elements.length; i++) {
36719
- const element = node.elements[i];
36720
- if (ts.isSpreadElement(element)) {
36721
- array.push(...this.visitSpreadElement(element, context));
36722
- }
36723
- else {
36724
- array.push(this.visitExpression(element, context));
36725
- }
36726
- }
36727
- return array;
36728
- }
36729
- visitObjectLiteralExpression(node, context) {
36730
- const map = new Map();
36731
- for (let i = 0; i < node.properties.length; i++) {
36732
- const property = node.properties[i];
36733
- if (ts.isPropertyAssignment(property)) {
36734
- const name = this.stringNameFromPropertyName(property.name, context);
36735
- // Check whether the name can be determined statically.
36736
- if (name === undefined) {
36737
- return DynamicValue.fromDynamicInput(node, DynamicValue.fromDynamicString(property.name));
36738
- }
36739
- map.set(name, this.visitExpression(property.initializer, context));
36740
- }
36741
- else if (ts.isShorthandPropertyAssignment(property)) {
36742
- const symbol = this.checker.getShorthandAssignmentValueSymbol(property);
36743
- if (symbol === undefined || symbol.valueDeclaration === undefined) {
36744
- map.set(property.name.text, DynamicValue.fromUnknown(property));
36745
- }
36746
- else {
36747
- map.set(property.name.text, this.visitDeclaration(symbol.valueDeclaration, context));
36748
- }
36749
- }
36750
- else if (ts.isSpreadAssignment(property)) {
36751
- const spread = this.visitExpression(property.expression, context);
36752
- if (spread instanceof DynamicValue) {
36753
- return DynamicValue.fromDynamicInput(node, spread);
36754
- }
36755
- else if (spread instanceof Map) {
36756
- spread.forEach((value, key) => map.set(key, value));
36757
- }
36758
- else if (spread instanceof ResolvedModule) {
36759
- spread.getExports().forEach((value, key) => map.set(key, value));
36760
- }
36761
- else {
36762
- return DynamicValue.fromDynamicInput(node, DynamicValue.fromInvalidExpressionType(property, spread));
36763
- }
36764
- }
36765
- else {
36766
- return DynamicValue.fromUnknown(node);
36767
- }
36768
- }
36769
- return map;
36770
- }
36771
- visitTemplateExpression(node, context) {
36772
- const pieces = [node.head.text];
36773
- for (let i = 0; i < node.templateSpans.length; i++) {
36774
- const span = node.templateSpans[i];
36775
- const value = literal(this.visit(span.expression, context), () => DynamicValue.fromDynamicString(span.expression));
36776
- if (value instanceof DynamicValue) {
36777
- return DynamicValue.fromDynamicInput(node, value);
36778
- }
36779
- pieces.push(`${value}`, span.literal.text);
36780
- }
36781
- return pieces.join('');
36782
- }
36783
- visitIdentifier(node, context) {
36784
- const decl = this.host.getDeclarationOfIdentifier(node);
36785
- if (decl === null) {
36786
- if (ts.identifierToKeywordKind(node) === ts.SyntaxKind.UndefinedKeyword) {
36787
- return undefined;
36788
- }
36789
- else {
36790
- // Check if the symbol here is imported.
36791
- if (this.dependencyTracker !== null && this.host.getImportOfIdentifier(node) !== null) {
36792
- // It was, but no declaration for the node could be found. This means that the dependency
36793
- // graph for the current file cannot be properly updated to account for this (broken)
36794
- // import. Instead, the originating file is reported as failing dependency analysis,
36795
- // ensuring that future compilations will always attempt to re-resolve the previously
36796
- // broken identifier.
36797
- this.dependencyTracker.recordDependencyAnalysisFailure(context.originatingFile);
36798
- }
36799
- return DynamicValue.fromUnknownIdentifier(node);
36800
- }
36801
- }
36802
- const declContext = { ...context, ...joinModuleContext(context, node, decl) };
36803
- const result = this.visitDeclaration(decl.node, declContext);
36804
- if (result instanceof Reference) {
36805
- // Only record identifiers to non-synthetic references. Synthetic references may not have the
36806
- // same value at runtime as they do at compile time, so it's not legal to refer to them by the
36807
- // identifier here.
36808
- if (!result.synthetic) {
36809
- result.addIdentifier(node);
36810
- }
36811
- }
36812
- else if (result instanceof DynamicValue) {
36813
- return DynamicValue.fromDynamicInput(node, result);
36814
- }
36815
- return result;
36816
- }
36817
- visitDeclaration(node, context) {
36818
- if (this.dependencyTracker !== null) {
36819
- this.dependencyTracker.addDependency(context.originatingFile, node.getSourceFile());
36820
- }
36821
- if (this.host.isClass(node)) {
36822
- return this.getReference(node, context);
36823
- }
36824
- else if (ts.isVariableDeclaration(node)) {
36825
- return this.visitVariableDeclaration(node, context);
36826
- }
36827
- else if (ts.isParameter(node) && context.scope.has(node)) {
36828
- return context.scope.get(node);
36829
- }
36830
- else if (ts.isExportAssignment(node)) {
36831
- return this.visitExpression(node.expression, context);
36832
- }
36833
- else if (ts.isEnumDeclaration(node)) {
36834
- return this.visitEnumDeclaration(node, context);
36835
- }
36836
- else if (ts.isSourceFile(node)) {
36837
- return this.visitSourceFile(node, context);
36838
- }
36839
- else if (ts.isBindingElement(node)) {
36840
- return this.visitBindingElement(node, context);
36841
- }
36842
- else {
36843
- return this.getReference(node, context);
36844
- }
36845
- }
36846
- visitVariableDeclaration(node, context) {
36847
- const value = this.host.getVariableValue(node);
36848
- if (value !== null) {
36849
- return this.visitExpression(value, context);
36850
- }
36851
- else if (isVariableDeclarationDeclared(node)) {
36852
- // If the declaration has a literal type that can be statically reduced to a value, resolve to
36853
- // that value. If not, the historical behavior for variable declarations is to return a
36854
- // `Reference` to the variable, as the consumer could use it in a context where knowing its
36855
- // static value is not necessary.
36856
- //
36857
- // Arguably, since the value cannot be statically determined, we should return a
36858
- // `DynamicValue`. This returns a `Reference` because it's the same behavior as before
36859
- // `visitType` was introduced.
36860
- //
36861
- // TODO(zarend): investigate switching to a `DynamicValue` and verify this won't break any
36862
- // use cases, especially in ngcc
36863
- if (node.type !== undefined) {
36864
- const evaluatedType = this.visitType(node.type, context);
36865
- if (!(evaluatedType instanceof DynamicValue)) {
36866
- return evaluatedType;
36867
- }
36868
- }
36869
- return this.getReference(node, context);
36870
- }
36871
- else {
36872
- return undefined;
36873
- }
36874
- }
36875
- visitEnumDeclaration(node, context) {
36876
- const enumRef = this.getReference(node, context);
36877
- const map = new Map();
36878
- node.members.forEach((member, index) => {
36879
- const name = this.stringNameFromPropertyName(member.name, context);
36880
- if (name !== undefined) {
36881
- const resolved = member.initializer ? this.visit(member.initializer, context) : index;
36882
- map.set(name, new EnumValue(enumRef, name, resolved));
36883
- }
36884
- });
36885
- return map;
36886
- }
36887
- visitElementAccessExpression(node, context) {
36888
- const lhs = this.visitExpression(node.expression, context);
36889
- if (lhs instanceof DynamicValue) {
36890
- return DynamicValue.fromDynamicInput(node, lhs);
36891
- }
36892
- const rhs = this.visitExpression(node.argumentExpression, context);
36893
- if (rhs instanceof DynamicValue) {
36894
- return DynamicValue.fromDynamicInput(node, rhs);
36895
- }
36896
- if (typeof rhs !== 'string' && typeof rhs !== 'number') {
36897
- return DynamicValue.fromInvalidExpressionType(node, rhs);
36898
- }
36899
- return this.accessHelper(node, lhs, rhs, context);
36900
- }
36901
- visitPropertyAccessExpression(node, context) {
36902
- const lhs = this.visitExpression(node.expression, context);
36903
- const rhs = node.name.text;
36904
- // TODO: handle reference to class declaration.
36905
- if (lhs instanceof DynamicValue) {
36906
- return DynamicValue.fromDynamicInput(node, lhs);
36907
- }
36908
- return this.accessHelper(node, lhs, rhs, context);
36909
- }
36910
- visitSourceFile(node, context) {
36911
- const declarations = this.host.getExportsOfModule(node);
36912
- if (declarations === null) {
36913
- return DynamicValue.fromUnknown(node);
36914
- }
36915
- return new ResolvedModule(declarations, (decl) => {
36916
- const declContext = {
36917
- ...context,
36918
- ...joinModuleContext(context, node, decl),
36919
- };
36920
- // Visit both concrete and inline declarations.
36921
- return this.visitDeclaration(decl.node, declContext);
36922
- });
36923
- }
36924
- accessHelper(node, lhs, rhs, context) {
36925
- const strIndex = `${rhs}`;
36926
- if (lhs instanceof Map) {
36927
- if (lhs.has(strIndex)) {
36928
- return lhs.get(strIndex);
36929
- }
36930
- else {
36931
- return undefined;
36932
- }
36933
- }
36934
- else if (lhs instanceof ResolvedModule) {
36935
- return lhs.getExport(strIndex);
36936
- }
36937
- else if (Array.isArray(lhs)) {
36938
- if (rhs === 'length') {
36939
- return lhs.length;
36940
- }
36941
- else if (rhs === 'slice') {
36942
- return new ArraySliceBuiltinFn(lhs);
36943
- }
36944
- else if (rhs === 'concat') {
36945
- return new ArrayConcatBuiltinFn(lhs);
36946
- }
36947
- if (typeof rhs !== 'number' || !Number.isInteger(rhs)) {
36948
- return DynamicValue.fromInvalidExpressionType(node, rhs);
36949
- }
36950
- return lhs[rhs];
36951
- }
36952
- else if (typeof lhs === 'string' && rhs === 'concat') {
36953
- return new StringConcatBuiltinFn(lhs);
36954
- }
36955
- else if (lhs instanceof Reference) {
36956
- const ref = lhs.node;
36957
- if (this.host.isClass(ref)) {
36958
- const module = owningModule(context, lhs.bestGuessOwningModule);
36959
- let value = undefined;
36960
- const member = this.host
36961
- .getMembersOfClass(ref)
36962
- .find((member) => member.isStatic && member.name === strIndex);
36963
- if (member !== undefined) {
36964
- if (member.value !== null) {
36965
- value = this.visitExpression(member.value, context);
36966
- }
36967
- else if (member.implementation !== null) {
36968
- value = new Reference(member.implementation, module);
36969
- }
36970
- else if (member.node) {
36971
- value = new Reference(member.node, module);
36972
- }
36973
- }
36974
- return value;
36975
- }
36976
- else if (isDeclaration(ref)) {
36977
- return DynamicValue.fromDynamicInput(node, DynamicValue.fromExternalReference(ref, lhs));
36978
- }
36979
- }
36980
- else if (lhs instanceof DynamicValue) {
36981
- return DynamicValue.fromDynamicInput(node, lhs);
36982
- }
36983
- else if (lhs instanceof SyntheticValue) {
36984
- return DynamicValue.fromSyntheticInput(node, lhs);
36985
- }
36986
- return DynamicValue.fromUnknown(node);
36987
- }
36988
- visitCallExpression(node, context) {
36989
- const lhs = this.visitExpression(node.expression, context);
36990
- if (lhs instanceof DynamicValue) {
36991
- return DynamicValue.fromDynamicInput(node, lhs);
36992
- }
36993
- // If the call refers to a builtin function, attempt to evaluate the function.
36994
- if (lhs instanceof KnownFn) {
36995
- return lhs.evaluate(node, this.evaluateFunctionArguments(node, context));
36996
- }
36997
- if (!(lhs instanceof Reference)) {
36998
- return DynamicValue.fromInvalidExpressionType(node.expression, lhs);
36999
- }
37000
- const fn = this.host.getDefinitionOfFunction(lhs.node);
37001
- if (fn === null) {
37002
- return DynamicValue.fromInvalidExpressionType(node.expression, lhs);
37003
- }
37004
- if (!isFunctionOrMethodReference(lhs)) {
37005
- return DynamicValue.fromInvalidExpressionType(node.expression, lhs);
37006
- }
37007
- const resolveFfrExpr = (expr) => {
37008
- let contextExtension = {};
37009
- // TODO(alxhub): the condition `fn.body === null` here is vestigial - we probably _do_ want to
37010
- // change the context like this even for non-null function bodies. But, this is being
37011
- // redesigned as a refactoring with no behavior changes so that should be done as a follow-up.
37012
- if (fn.body === null &&
37013
- expr.getSourceFile() !== node.expression.getSourceFile() &&
37014
- lhs.bestGuessOwningModule !== null) {
37015
- contextExtension = {
37016
- absoluteModuleName: lhs.bestGuessOwningModule.specifier,
37017
- resolutionContext: lhs.bestGuessOwningModule.resolutionContext,
37018
- };
37019
- }
37020
- return this.visitFfrExpression(expr, { ...context, ...contextExtension });
37021
- };
37022
- // If the function is foreign (declared through a d.ts file), attempt to resolve it with the
37023
- // foreignFunctionResolver, if one is specified.
37024
- if (fn.body === null && context.foreignFunctionResolver !== undefined) {
37025
- const unresolvable = DynamicValue.fromDynamicInput(node, DynamicValue.fromExternalReference(node.expression, lhs));
37026
- return context.foreignFunctionResolver(lhs, node, resolveFfrExpr, unresolvable);
37027
- }
37028
- const res = this.visitFunctionBody(node, fn, context);
37029
- // If the result of attempting to resolve the function body was a DynamicValue, attempt to use
37030
- // the foreignFunctionResolver if one is present. This could still potentially yield a usable
37031
- // value.
37032
- if (res instanceof DynamicValue && context.foreignFunctionResolver !== undefined) {
37033
- const unresolvable = DynamicValue.fromComplexFunctionCall(node, fn);
37034
- return context.foreignFunctionResolver(lhs, node, resolveFfrExpr, unresolvable);
37035
- }
37036
- return res;
37037
- }
37038
- /**
37039
- * Visit an expression which was extracted from a foreign-function resolver.
37040
- *
37041
- * This will process the result and ensure it's correct for FFR-resolved values, including marking
37042
- * `Reference`s as synthetic.
37043
- */
37044
- visitFfrExpression(expr, context) {
37045
- const res = this.visitExpression(expr, context);
37046
- if (res instanceof Reference) {
37047
- // This Reference was created synthetically, via a foreign function resolver. The real
37048
- // runtime value of the function expression may be different than the foreign function
37049
- // resolved value, so mark the Reference as synthetic to avoid it being misinterpreted.
37050
- res.synthetic = true;
37051
- }
37052
- return res;
37053
- }
37054
- visitFunctionBody(node, fn, context) {
37055
- if (fn.body === null) {
37056
- return DynamicValue.fromUnknown(node);
37057
- }
37058
- else if (fn.body.length !== 1 || !ts.isReturnStatement(fn.body[0])) {
37059
- return DynamicValue.fromComplexFunctionCall(node, fn);
37060
- }
37061
- const ret = fn.body[0];
37062
- const args = this.evaluateFunctionArguments(node, context);
37063
- const newScope = new Map();
37064
- const calleeContext = { ...context, scope: newScope };
37065
- fn.parameters.forEach((param, index) => {
37066
- let arg = args[index];
37067
- if (param.node.dotDotDotToken !== undefined) {
37068
- arg = args.slice(index);
37069
- }
37070
- if (arg === undefined && param.initializer !== null) {
37071
- arg = this.visitExpression(param.initializer, calleeContext);
37072
- }
37073
- newScope.set(param.node, arg);
37074
- });
37075
- return ret.expression !== undefined
37076
- ? this.visitExpression(ret.expression, calleeContext)
37077
- : undefined;
37078
- }
37079
- visitConditionalExpression(node, context) {
37080
- const condition = this.visitExpression(node.condition, context);
37081
- if (condition instanceof DynamicValue) {
37082
- return DynamicValue.fromDynamicInput(node, condition);
37083
- }
37084
- if (condition) {
37085
- return this.visitExpression(node.whenTrue, context);
37086
- }
37087
- else {
37088
- return this.visitExpression(node.whenFalse, context);
37089
- }
37090
- }
37091
- visitPrefixUnaryExpression(node, context) {
37092
- const operatorKind = node.operator;
37093
- if (!UNARY_OPERATORS$2.has(operatorKind)) {
37094
- return DynamicValue.fromUnsupportedSyntax(node);
37095
- }
37096
- const op = UNARY_OPERATORS$2.get(operatorKind);
37097
- const value = this.visitExpression(node.operand, context);
37098
- if (value instanceof DynamicValue) {
37099
- return DynamicValue.fromDynamicInput(node, value);
37100
- }
37101
- else {
37102
- return op(value);
37103
- }
37104
- }
37105
- visitBinaryExpression(node, context) {
37106
- const tokenKind = node.operatorToken.kind;
37107
- if (!BINARY_OPERATORS$2.has(tokenKind)) {
37108
- return DynamicValue.fromUnsupportedSyntax(node);
37109
- }
37110
- const opRecord = BINARY_OPERATORS$2.get(tokenKind);
37111
- let lhs, rhs;
37112
- if (opRecord.literal) {
37113
- lhs = literal(this.visitExpression(node.left, context), (value) => DynamicValue.fromInvalidExpressionType(node.left, value));
37114
- rhs = literal(this.visitExpression(node.right, context), (value) => DynamicValue.fromInvalidExpressionType(node.right, value));
37115
- }
37116
- else {
37117
- lhs = this.visitExpression(node.left, context);
37118
- rhs = this.visitExpression(node.right, context);
37119
- }
37120
- if (lhs instanceof DynamicValue) {
37121
- return DynamicValue.fromDynamicInput(node, lhs);
37122
- }
37123
- else if (rhs instanceof DynamicValue) {
37124
- return DynamicValue.fromDynamicInput(node, rhs);
37125
- }
37126
- else {
37127
- return opRecord.op(lhs, rhs);
37128
- }
37129
- }
37130
- visitParenthesizedExpression(node, context) {
37131
- return this.visitExpression(node.expression, context);
37132
- }
37133
- evaluateFunctionArguments(node, context) {
37134
- const args = [];
37135
- for (const arg of node.arguments) {
37136
- if (ts.isSpreadElement(arg)) {
37137
- args.push(...this.visitSpreadElement(arg, context));
37138
- }
37139
- else {
37140
- args.push(this.visitExpression(arg, context));
37141
- }
37142
- }
37143
- return args;
37144
- }
37145
- visitSpreadElement(node, context) {
37146
- const spread = this.visitExpression(node.expression, context);
37147
- if (spread instanceof DynamicValue) {
37148
- return [DynamicValue.fromDynamicInput(node, spread)];
37149
- }
37150
- else if (!Array.isArray(spread)) {
37151
- return [DynamicValue.fromInvalidExpressionType(node, spread)];
37152
- }
37153
- else {
37154
- return spread;
37155
- }
37156
- }
37157
- visitBindingElement(node, context) {
37158
- const path = [];
37159
- let closestDeclaration = node;
37160
- while (ts.isBindingElement(closestDeclaration) ||
37161
- ts.isArrayBindingPattern(closestDeclaration) ||
37162
- ts.isObjectBindingPattern(closestDeclaration)) {
37163
- if (ts.isBindingElement(closestDeclaration)) {
37164
- path.unshift(closestDeclaration);
37165
- }
37166
- closestDeclaration = closestDeclaration.parent;
37167
- }
37168
- if (!ts.isVariableDeclaration(closestDeclaration) ||
37169
- closestDeclaration.initializer === undefined) {
37170
- return DynamicValue.fromUnknown(node);
37171
- }
37172
- let value = this.visit(closestDeclaration.initializer, context);
37173
- for (const element of path) {
37174
- let key;
37175
- if (ts.isArrayBindingPattern(element.parent)) {
37176
- key = element.parent.elements.indexOf(element);
37177
- }
37178
- else {
37179
- const name = element.propertyName || element.name;
37180
- if (ts.isIdentifier(name)) {
37181
- key = name.text;
37182
- }
37183
- else {
37184
- return DynamicValue.fromUnknown(element);
37185
- }
37186
- }
37187
- value = this.accessHelper(element, value, key, context);
37188
- if (value instanceof DynamicValue) {
37189
- return value;
37190
- }
37191
- }
37192
- return value;
37193
- }
37194
- stringNameFromPropertyName(node, context) {
37195
- if (ts.isIdentifier(node) || ts.isStringLiteral(node) || ts.isNumericLiteral(node)) {
37196
- return node.text;
37197
- }
37198
- else if (ts.isComputedPropertyName(node)) {
37199
- const literal = this.visitExpression(node.expression, context);
37200
- return typeof literal === 'string' ? literal : undefined;
37201
- }
37202
- else {
37203
- return undefined;
37204
- }
37205
- }
37206
- getReference(node, context) {
37207
- return new Reference(node, owningModule(context));
37208
- }
37209
- visitType(node, context) {
37210
- if (ts.isLiteralTypeNode(node)) {
37211
- return this.visitExpression(node.literal, context);
37212
- }
37213
- else if (ts.isTupleTypeNode(node)) {
37214
- return this.visitTupleType(node, context);
37215
- }
37216
- else if (ts.isNamedTupleMember(node)) {
37217
- return this.visitType(node.type, context);
37218
- }
37219
- else if (ts.isTypeOperatorNode(node) && node.operator === ts.SyntaxKind.ReadonlyKeyword) {
37220
- return this.visitType(node.type, context);
37221
- }
37222
- else if (ts.isTypeQueryNode(node)) {
37223
- return this.visitTypeQuery(node, context);
37224
- }
37225
- return DynamicValue.fromDynamicType(node);
37226
- }
37227
- visitTupleType(node, context) {
37228
- const res = [];
37229
- for (const elem of node.elements) {
37230
- res.push(this.visitType(elem, context));
37231
- }
37232
- return res;
37233
- }
37234
- visitTypeQuery(node, context) {
37235
- if (!ts.isIdentifier(node.exprName)) {
37236
- return DynamicValue.fromUnknown(node);
37237
- }
37238
- const decl = this.host.getDeclarationOfIdentifier(node.exprName);
37239
- if (decl === null) {
37240
- return DynamicValue.fromUnknownIdentifier(node.exprName);
37241
- }
37242
- const declContext = { ...context, ...joinModuleContext(context, node, decl) };
37243
- return this.visitDeclaration(decl.node, declContext);
37244
- }
37245
- }
37246
- function isFunctionOrMethodReference(ref) {
37247
- return (ts.isFunctionDeclaration(ref.node) ||
37248
- ts.isMethodDeclaration(ref.node) ||
37249
- ts.isFunctionExpression(ref.node));
37250
- }
37251
- function literal(value, reject) {
37252
- if (value instanceof EnumValue) {
37253
- value = value.resolved;
37254
- }
37255
- if (value instanceof DynamicValue ||
37256
- value === null ||
37257
- value === undefined ||
37258
- typeof value === 'string' ||
37259
- typeof value === 'number' ||
37260
- typeof value === 'boolean') {
37261
- return value;
37262
- }
37263
- return reject(value);
37264
- }
37265
- function isVariableDeclarationDeclared(node) {
37266
- if (node.parent === undefined || !ts.isVariableDeclarationList(node.parent)) {
37267
- return false;
37268
- }
37269
- const declList = node.parent;
37270
- if (declList.parent === undefined || !ts.isVariableStatement(declList.parent)) {
37271
- return false;
37272
- }
37273
- const varStmt = declList.parent;
37274
- const modifiers = ts.getModifiers(varStmt);
37275
- return (modifiers !== undefined && modifiers.some((mod) => mod.kind === ts.SyntaxKind.DeclareKeyword));
37276
- }
37277
- const EMPTY = {};
37278
- function joinModuleContext(existing, node, decl) {
37279
- if (typeof decl.viaModule === 'string' && decl.viaModule !== existing.absoluteModuleName) {
37280
- return {
37281
- absoluteModuleName: decl.viaModule,
37282
- resolutionContext: node.getSourceFile().fileName,
37283
- };
37284
- }
37285
- else {
37286
- return EMPTY;
37287
- }
37288
- }
37289
- function owningModule(context, override = null) {
37290
- let specifier = context.absoluteModuleName;
37291
- if (override !== null) {
37292
- specifier = override.specifier;
37293
- }
37294
- if (specifier !== null) {
37295
- return {
37296
- specifier,
37297
- resolutionContext: context.resolutionContext,
37298
- };
37299
- }
37300
- else {
37301
- return null;
37302
- }
37303
- }
37304
-
37305
36551
  /**
37306
36552
  * Specifies the compilation mode that is used for the compilation.
37307
36553
  */
@@ -37758,10 +37004,14 @@ function createGenerateUniqueIdentifierHelper() {
37758
37004
  const markIdentifierAsGenerated = (sf, identifierName) => generatedIdentifiers.add(`${sf.fileName}@@${identifierName}`);
37759
37005
  return (sourceFile, symbolName) => {
37760
37006
  const sf = sourceFile;
37761
- if (sf.identifiers === undefined) {
37007
+ // NOTE: Typically accesses to TS fields are not renamed because the 1P externs
37008
+ // produced from TypeScript are ensuring public fields are considered "external".
37009
+ // See: https://developers.google.com/closure/compiler/docs/externs-and-exports.
37010
+ // This property is internal, so not part of the externs— so we need be cautious
37011
+ if (sf['identifiers'] === undefined) {
37762
37012
  throw new Error('Source file unexpectedly lacks map of parsed `identifiers`.');
37763
37013
  }
37764
- const isUniqueIdentifier = (name) => !sf.identifiers.has(name) && !isGeneratedIdentifier(sf, name);
37014
+ const isUniqueIdentifier = (name) => !sf['identifiers'].has(name) && !isGeneratedIdentifier(sf, name);
37765
37015
  if (isUniqueIdentifier(symbolName)) {
37766
37016
  markIdentifierAsGenerated(sf, symbolName);
37767
37017
  return null;
@@ -38297,11 +37547,11 @@ function createImportReference(asTypeReference, ref) {
38297
37547
  }
38298
37548
  }
38299
37549
 
38300
- const UNARY_OPERATORS$1 = /* @__PURE__ */ new Map([
37550
+ const UNARY_OPERATORS = /* @__PURE__ */ new Map([
38301
37551
  [UnaryOperator.Minus, '-'],
38302
37552
  [UnaryOperator.Plus, '+'],
38303
37553
  ]);
38304
- const BINARY_OPERATORS$1 = /* @__PURE__ */ new Map([
37554
+ const BINARY_OPERATORS = /* @__PURE__ */ new Map([
38305
37555
  [BinaryOperator.And, '&&'],
38306
37556
  [BinaryOperator.Bigger, '>'],
38307
37557
  [BinaryOperator.BiggerEquals, '>='],
@@ -38495,10 +37745,10 @@ class ExpressionTranslatorVisitor {
38495
37745
  : ast.body.visitExpression(this, context));
38496
37746
  }
38497
37747
  visitBinaryOperatorExpr(ast, context) {
38498
- if (!BINARY_OPERATORS$1.has(ast.operator)) {
37748
+ if (!BINARY_OPERATORS.has(ast.operator)) {
38499
37749
  throw new Error(`Unknown binary operator: ${BinaryOperator[ast.operator]}`);
38500
37750
  }
38501
- const operator = BINARY_OPERATORS$1.get(ast.operator);
37751
+ const operator = BINARY_OPERATORS.get(ast.operator);
38502
37752
  if (ast.isAssignment()) {
38503
37753
  return this.factory.createAssignment(ast.lhs.visitExpression(this, context), operator, ast.rhs.visitExpression(this, context));
38504
37754
  }
@@ -38540,10 +37790,10 @@ class ExpressionTranslatorVisitor {
38540
37790
  return this.factory.createVoidExpression(ast.expr.visitExpression(this, context));
38541
37791
  }
38542
37792
  visitUnaryOperatorExpr(ast, context) {
38543
- if (!UNARY_OPERATORS$1.has(ast.operator)) {
37793
+ if (!UNARY_OPERATORS.has(ast.operator)) {
38544
37794
  throw new Error(`Unknown unary operator: ${UnaryOperator[ast.operator]}`);
38545
37795
  }
38546
- return this.factory.createUnaryExpression(UNARY_OPERATORS$1.get(ast.operator), ast.expr.visitExpression(this, context));
37796
+ return this.factory.createUnaryExpression(UNARY_OPERATORS.get(ast.operator), ast.expr.visitExpression(this, context));
38547
37797
  }
38548
37798
  visitParenthesizedExpr(ast, context) {
38549
37799
  const result = ast.expr.visitExpression(this, context);
@@ -39008,64 +38258,67 @@ var PureAnnotation;
39008
38258
  PureAnnotation["CLOSURE"] = "* @pureOrBreakMyCode ";
39009
38259
  PureAnnotation["TERSER"] = "@__PURE__";
39010
38260
  })(PureAnnotation || (PureAnnotation = {}));
39011
- const UNARY_OPERATORS = /* @__PURE__ */ (() => ({
39012
- '+': ts.SyntaxKind.PlusToken,
39013
- '-': ts.SyntaxKind.MinusToken,
39014
- '!': ts.SyntaxKind.ExclamationToken,
39015
- }))();
39016
- const BINARY_OPERATORS = /* @__PURE__ */ (() => ({
39017
- '&&': ts.SyntaxKind.AmpersandAmpersandToken,
39018
- '>': ts.SyntaxKind.GreaterThanToken,
39019
- '>=': ts.SyntaxKind.GreaterThanEqualsToken,
39020
- '&': ts.SyntaxKind.AmpersandToken,
39021
- '|': ts.SyntaxKind.BarToken,
39022
- '/': ts.SyntaxKind.SlashToken,
39023
- '==': ts.SyntaxKind.EqualsEqualsToken,
39024
- '===': ts.SyntaxKind.EqualsEqualsEqualsToken,
39025
- '<': ts.SyntaxKind.LessThanToken,
39026
- '<=': ts.SyntaxKind.LessThanEqualsToken,
39027
- '-': ts.SyntaxKind.MinusToken,
39028
- '%': ts.SyntaxKind.PercentToken,
39029
- '*': ts.SyntaxKind.AsteriskToken,
39030
- '**': ts.SyntaxKind.AsteriskAsteriskToken,
39031
- '!=': ts.SyntaxKind.ExclamationEqualsToken,
39032
- '!==': ts.SyntaxKind.ExclamationEqualsEqualsToken,
39033
- '||': ts.SyntaxKind.BarBarToken,
39034
- '+': ts.SyntaxKind.PlusToken,
39035
- '??': ts.SyntaxKind.QuestionQuestionToken,
39036
- 'in': ts.SyntaxKind.InKeyword,
39037
- '=': ts.SyntaxKind.EqualsToken,
39038
- '+=': ts.SyntaxKind.PlusEqualsToken,
39039
- '-=': ts.SyntaxKind.MinusEqualsToken,
39040
- '*=': ts.SyntaxKind.AsteriskEqualsToken,
39041
- '/=': ts.SyntaxKind.SlashEqualsToken,
39042
- '%=': ts.SyntaxKind.PercentEqualsToken,
39043
- '**=': ts.SyntaxKind.AsteriskAsteriskEqualsToken,
39044
- '&&=': ts.SyntaxKind.AmpersandAmpersandEqualsToken,
39045
- '||=': ts.SyntaxKind.BarBarEqualsToken,
39046
- '??=': ts.SyntaxKind.QuestionQuestionEqualsToken,
39047
- }))();
39048
- const VAR_TYPES = /* @__PURE__ */ (() => ({
39049
- 'const': ts.NodeFlags.Const,
39050
- 'let': ts.NodeFlags.Let,
39051
- 'var': ts.NodeFlags.None,
39052
- }))();
39053
38261
  /**
39054
38262
  * A TypeScript flavoured implementation of the AstFactory.
39055
38263
  */
39056
38264
  class TypeScriptAstFactory {
39057
38265
  annotateForClosureCompiler;
39058
38266
  externalSourceFiles = new Map();
38267
+ UNARY_OPERATORS =
38268
+ /* @__PURE__ */ (() => ({
38269
+ '+': ts.SyntaxKind.PlusToken,
38270
+ '-': ts.SyntaxKind.MinusToken,
38271
+ '!': ts.SyntaxKind.ExclamationToken,
38272
+ }))();
38273
+ BINARY_OPERATORS =
38274
+ /* @__PURE__ */ (() => ({
38275
+ '&&': ts.SyntaxKind.AmpersandAmpersandToken,
38276
+ '>': ts.SyntaxKind.GreaterThanToken,
38277
+ '>=': ts.SyntaxKind.GreaterThanEqualsToken,
38278
+ '&': ts.SyntaxKind.AmpersandToken,
38279
+ '|': ts.SyntaxKind.BarToken,
38280
+ '/': ts.SyntaxKind.SlashToken,
38281
+ '==': ts.SyntaxKind.EqualsEqualsToken,
38282
+ '===': ts.SyntaxKind.EqualsEqualsEqualsToken,
38283
+ '<': ts.SyntaxKind.LessThanToken,
38284
+ '<=': ts.SyntaxKind.LessThanEqualsToken,
38285
+ '-': ts.SyntaxKind.MinusToken,
38286
+ '%': ts.SyntaxKind.PercentToken,
38287
+ '*': ts.SyntaxKind.AsteriskToken,
38288
+ '**': ts.SyntaxKind.AsteriskAsteriskToken,
38289
+ '!=': ts.SyntaxKind.ExclamationEqualsToken,
38290
+ '!==': ts.SyntaxKind.ExclamationEqualsEqualsToken,
38291
+ '||': ts.SyntaxKind.BarBarToken,
38292
+ '+': ts.SyntaxKind.PlusToken,
38293
+ '??': ts.SyntaxKind.QuestionQuestionToken,
38294
+ 'in': ts.SyntaxKind.InKeyword,
38295
+ '=': ts.SyntaxKind.EqualsToken,
38296
+ '+=': ts.SyntaxKind.PlusEqualsToken,
38297
+ '-=': ts.SyntaxKind.MinusEqualsToken,
38298
+ '*=': ts.SyntaxKind.AsteriskEqualsToken,
38299
+ '/=': ts.SyntaxKind.SlashEqualsToken,
38300
+ '%=': ts.SyntaxKind.PercentEqualsToken,
38301
+ '**=': ts.SyntaxKind.AsteriskAsteriskEqualsToken,
38302
+ '&&=': ts.SyntaxKind.AmpersandAmpersandEqualsToken,
38303
+ '||=': ts.SyntaxKind.BarBarEqualsToken,
38304
+ '??=': ts.SyntaxKind.QuestionQuestionEqualsToken,
38305
+ }))();
38306
+ VAR_TYPES =
38307
+ /* @__PURE__ */ (() => ({
38308
+ 'const': ts.NodeFlags.Const,
38309
+ 'let': ts.NodeFlags.Let,
38310
+ 'var': ts.NodeFlags.None,
38311
+ }))();
39059
38312
  constructor(annotateForClosureCompiler) {
39060
38313
  this.annotateForClosureCompiler = annotateForClosureCompiler;
39061
38314
  }
39062
38315
  attachComments = attachComments;
39063
38316
  createArrayLiteral = ts.factory.createArrayLiteralExpression;
39064
38317
  createAssignment(target, operator, value) {
39065
- return ts.factory.createBinaryExpression(target, BINARY_OPERATORS[operator], value);
38318
+ return ts.factory.createBinaryExpression(target, this.BINARY_OPERATORS[operator], value);
39066
38319
  }
39067
38320
  createBinaryExpression(leftOperand, operator, rightOperand) {
39068
- return ts.factory.createBinaryExpression(leftOperand, BINARY_OPERATORS[operator], rightOperand);
38321
+ return ts.factory.createBinaryExpression(leftOperand, this.BINARY_OPERATORS[operator], rightOperand);
39069
38322
  }
39070
38323
  createBlock(body) {
39071
38324
  return ts.factory.createBlock(body);
@@ -39180,12 +38433,12 @@ class TypeScriptAstFactory {
39180
38433
  createTypeOfExpression = ts.factory.createTypeOfExpression;
39181
38434
  createVoidExpression = ts.factory.createVoidExpression;
39182
38435
  createUnaryExpression(operator, operand) {
39183
- return ts.factory.createPrefixUnaryExpression(UNARY_OPERATORS[operator], operand);
38436
+ return ts.factory.createPrefixUnaryExpression(this.UNARY_OPERATORS[operator], operand);
39184
38437
  }
39185
38438
  createVariableDeclaration(variableName, initializer, type) {
39186
38439
  return ts.factory.createVariableStatement(undefined, ts.factory.createVariableDeclarationList([
39187
38440
  ts.factory.createVariableDeclaration(variableName, undefined, undefined, initializer ?? undefined),
39188
- ], VAR_TYPES[type]));
38441
+ ], this.VAR_TYPES[type]));
39189
38442
  }
39190
38443
  setSourceMapRange(node, sourceMapRange) {
39191
38444
  if (sourceMapRange === null) {
@@ -41287,6 +40540,19 @@ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText,
41287
40540
  relatedInformation,
41288
40541
  };
41289
40542
  }
40543
+ let typeForMessage;
40544
+ if (category === ts.DiagnosticCategory.Warning) {
40545
+ typeForMessage = 'Warning';
40546
+ }
40547
+ else if (category === ts.DiagnosticCategory.Suggestion) {
40548
+ typeForMessage = 'Suggestion';
40549
+ }
40550
+ else if (category === ts.DiagnosticCategory.Message) {
40551
+ typeForMessage = 'Message';
40552
+ }
40553
+ else {
40554
+ typeForMessage = 'Error';
40555
+ }
41290
40556
  relatedInformation.push({
41291
40557
  category: ts.DiagnosticCategory.Message,
41292
40558
  code: 0,
@@ -41295,7 +40561,7 @@ function makeTemplateDiagnostic(id, mapping, span, category, code, messageText,
41295
40561
  // and getEnd() are used because they don't include surrounding whitespace.
41296
40562
  start: mapping.node.getStart(),
41297
40563
  length: mapping.node.getEnd() - mapping.node.getStart(),
41298
- messageText: `Error occurs in the template of component ${componentName}.`,
40564
+ messageText: `${typeForMessage} occurs in the template of component ${componentName}.`,
41299
40565
  });
41300
40566
  return {
41301
40567
  source: 'ngtsc',
@@ -43218,26 +42484,29 @@ class ReferenceEmitEnvironment {
43218
42484
  * `ts.BinaryExpression`s need to be wrapped in parentheses before casting.
43219
42485
  */
43220
42486
  //
43221
- const SAFE_TO_CAST_WITHOUT_PARENS = new Set([
43222
- // Expressions which are already parenthesized can be cast without further wrapping.
43223
- ts.SyntaxKind.ParenthesizedExpression,
43224
- // Expressions which form a single lexical unit leave no room for precedence issues with the cast.
43225
- ts.SyntaxKind.Identifier,
43226
- ts.SyntaxKind.CallExpression,
43227
- ts.SyntaxKind.NonNullExpression,
43228
- ts.SyntaxKind.ElementAccessExpression,
43229
- ts.SyntaxKind.PropertyAccessExpression,
43230
- ts.SyntaxKind.ArrayLiteralExpression,
43231
- ts.SyntaxKind.ObjectLiteralExpression,
43232
- // The same goes for various literals.
43233
- ts.SyntaxKind.StringLiteral,
43234
- ts.SyntaxKind.NumericLiteral,
43235
- ts.SyntaxKind.TrueKeyword,
43236
- ts.SyntaxKind.FalseKeyword,
43237
- ts.SyntaxKind.NullKeyword,
43238
- ts.SyntaxKind.UndefinedKeyword,
43239
- ]);
42487
+ let SAFE_TO_CAST_WITHOUT_PARENS = null;
43240
42488
  function tsCastToAny(expr) {
42489
+ if (SAFE_TO_CAST_WITHOUT_PARENS === null) {
42490
+ SAFE_TO_CAST_WITHOUT_PARENS = new Set([
42491
+ // Expressions which are already parenthesized can be cast without further wrapping.
42492
+ ts.SyntaxKind.ParenthesizedExpression,
42493
+ // Expressions which form a single lexical unit leave no room for precedence issues with the cast.
42494
+ ts.SyntaxKind.Identifier,
42495
+ ts.SyntaxKind.CallExpression,
42496
+ ts.SyntaxKind.NonNullExpression,
42497
+ ts.SyntaxKind.ElementAccessExpression,
42498
+ ts.SyntaxKind.PropertyAccessExpression,
42499
+ ts.SyntaxKind.ArrayLiteralExpression,
42500
+ ts.SyntaxKind.ObjectLiteralExpression,
42501
+ // The same goes for various literals.
42502
+ ts.SyntaxKind.StringLiteral,
42503
+ ts.SyntaxKind.NumericLiteral,
42504
+ ts.SyntaxKind.TrueKeyword,
42505
+ ts.SyntaxKind.FalseKeyword,
42506
+ ts.SyntaxKind.NullKeyword,
42507
+ ts.SyntaxKind.UndefinedKeyword,
42508
+ ]);
42509
+ }
43241
42510
  // Wrap `expr` in parentheses if needed (see `SAFE_TO_CAST_WITHOUT_PARENS` above).
43242
42511
  if (!SAFE_TO_CAST_WITHOUT_PARENS.has(expr.kind)) {
43243
42512
  expr = ts.factory.createParenthesizedExpression(expr);
@@ -44728,7 +43997,7 @@ function translateDiagnostic(diagnostic, resolver) {
44728
43997
  }
44729
43998
 
44730
43999
  /**
44731
- * Expression that is cast to any. Currently represented as `0 as any`.
44000
+ * Gets an expression that is cast to any. Currently represented as `0 as any`.
44732
44001
  *
44733
44002
  * Historically this expression was using `null as any`, but a newly-added check in TypeScript 5.6
44734
44003
  * (https://devblogs.microsoft.com/typescript/announcing-typescript-5-6-beta/#disallowed-nullish-and-truthy-checks)
@@ -44738,45 +44007,9 @@ function translateDiagnostic(diagnostic, resolver) {
44738
44007
  * - Some flavor of function call, like `isNan(0) as any` - requires even more characters than the
44739
44008
  * NaN option and has the same issue with `noLib`.
44740
44009
  */
44741
- const ANY_EXPRESSION = ts.factory.createAsExpression(ts.factory.createNumericLiteral('0'), ts.factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword));
44742
- const UNDEFINED = ts.factory.createIdentifier('undefined');
44743
- const UNARY_OPS = new Map([
44744
- ['+', ts.SyntaxKind.PlusToken],
44745
- ['-', ts.SyntaxKind.MinusToken],
44746
- ]);
44747
- const BINARY_OPS = new Map([
44748
- ['+', ts.SyntaxKind.PlusToken],
44749
- ['-', ts.SyntaxKind.MinusToken],
44750
- ['<', ts.SyntaxKind.LessThanToken],
44751
- ['>', ts.SyntaxKind.GreaterThanToken],
44752
- ['<=', ts.SyntaxKind.LessThanEqualsToken],
44753
- ['>=', ts.SyntaxKind.GreaterThanEqualsToken],
44754
- ['=', ts.SyntaxKind.EqualsToken],
44755
- ['==', ts.SyntaxKind.EqualsEqualsToken],
44756
- ['===', ts.SyntaxKind.EqualsEqualsEqualsToken],
44757
- ['*', ts.SyntaxKind.AsteriskToken],
44758
- ['**', ts.SyntaxKind.AsteriskAsteriskToken],
44759
- ['/', ts.SyntaxKind.SlashToken],
44760
- ['%', ts.SyntaxKind.PercentToken],
44761
- ['!=', ts.SyntaxKind.ExclamationEqualsToken],
44762
- ['!==', ts.SyntaxKind.ExclamationEqualsEqualsToken],
44763
- ['||', ts.SyntaxKind.BarBarToken],
44764
- ['&&', ts.SyntaxKind.AmpersandAmpersandToken],
44765
- ['&', ts.SyntaxKind.AmpersandToken],
44766
- ['|', ts.SyntaxKind.BarToken],
44767
- ['??', ts.SyntaxKind.QuestionQuestionToken],
44768
- ['in', ts.SyntaxKind.InKeyword],
44769
- ['=', ts.SyntaxKind.EqualsToken],
44770
- ['+=', ts.SyntaxKind.PlusEqualsToken],
44771
- ['-=', ts.SyntaxKind.MinusEqualsToken],
44772
- ['*=', ts.SyntaxKind.AsteriskEqualsToken],
44773
- ['/=', ts.SyntaxKind.SlashEqualsToken],
44774
- ['%=', ts.SyntaxKind.PercentEqualsToken],
44775
- ['**=', ts.SyntaxKind.AsteriskAsteriskEqualsToken],
44776
- ['&&=', ts.SyntaxKind.AmpersandAmpersandEqualsToken],
44777
- ['||=', ts.SyntaxKind.BarBarEqualsToken],
44778
- ['??=', ts.SyntaxKind.QuestionQuestionEqualsToken],
44779
- ]);
44010
+ function getAnyExpression() {
44011
+ return ts.factory.createAsExpression(ts.factory.createNumericLiteral('0'), ts.factory.createKeywordTypeNode(ts.SyntaxKind.AnyKeyword));
44012
+ }
44780
44013
  /**
44781
44014
  * Convert an `AST` to TypeScript code directly, without going through an intermediate `Expression`
44782
44015
  * AST.
@@ -44788,6 +44021,44 @@ function astToTypescript(ast, maybeResolve, config) {
44788
44021
  class AstTranslator {
44789
44022
  maybeResolve;
44790
44023
  config;
44024
+ UNDEFINED = ts.factory.createIdentifier('undefined');
44025
+ UNARY_OPS = new Map([
44026
+ ['+', ts.SyntaxKind.PlusToken],
44027
+ ['-', ts.SyntaxKind.MinusToken],
44028
+ ]);
44029
+ BINARY_OPS = new Map([
44030
+ ['+', ts.SyntaxKind.PlusToken],
44031
+ ['-', ts.SyntaxKind.MinusToken],
44032
+ ['<', ts.SyntaxKind.LessThanToken],
44033
+ ['>', ts.SyntaxKind.GreaterThanToken],
44034
+ ['<=', ts.SyntaxKind.LessThanEqualsToken],
44035
+ ['>=', ts.SyntaxKind.GreaterThanEqualsToken],
44036
+ ['=', ts.SyntaxKind.EqualsToken],
44037
+ ['==', ts.SyntaxKind.EqualsEqualsToken],
44038
+ ['===', ts.SyntaxKind.EqualsEqualsEqualsToken],
44039
+ ['*', ts.SyntaxKind.AsteriskToken],
44040
+ ['**', ts.SyntaxKind.AsteriskAsteriskToken],
44041
+ ['/', ts.SyntaxKind.SlashToken],
44042
+ ['%', ts.SyntaxKind.PercentToken],
44043
+ ['!=', ts.SyntaxKind.ExclamationEqualsToken],
44044
+ ['!==', ts.SyntaxKind.ExclamationEqualsEqualsToken],
44045
+ ['||', ts.SyntaxKind.BarBarToken],
44046
+ ['&&', ts.SyntaxKind.AmpersandAmpersandToken],
44047
+ ['&', ts.SyntaxKind.AmpersandToken],
44048
+ ['|', ts.SyntaxKind.BarToken],
44049
+ ['??', ts.SyntaxKind.QuestionQuestionToken],
44050
+ ['in', ts.SyntaxKind.InKeyword],
44051
+ ['=', ts.SyntaxKind.EqualsToken],
44052
+ ['+=', ts.SyntaxKind.PlusEqualsToken],
44053
+ ['-=', ts.SyntaxKind.MinusEqualsToken],
44054
+ ['*=', ts.SyntaxKind.AsteriskEqualsToken],
44055
+ ['/=', ts.SyntaxKind.SlashEqualsToken],
44056
+ ['%=', ts.SyntaxKind.PercentEqualsToken],
44057
+ ['**=', ts.SyntaxKind.AsteriskAsteriskEqualsToken],
44058
+ ['&&=', ts.SyntaxKind.AmpersandAmpersandEqualsToken],
44059
+ ['||=', ts.SyntaxKind.BarBarEqualsToken],
44060
+ ['??=', ts.SyntaxKind.QuestionQuestionEqualsToken],
44061
+ ]);
44791
44062
  constructor(maybeResolve, config) {
44792
44063
  this.maybeResolve = maybeResolve;
44793
44064
  this.config = config;
@@ -44813,7 +44084,7 @@ class AstTranslator {
44813
44084
  }
44814
44085
  visitUnary(ast) {
44815
44086
  const expr = this.translate(ast.expr);
44816
- const op = UNARY_OPS.get(ast.operator);
44087
+ const op = this.UNARY_OPS.get(ast.operator);
44817
44088
  if (op === undefined) {
44818
44089
  throw new Error(`Unsupported Unary.operator: ${ast.operator}`);
44819
44090
  }
@@ -44824,7 +44095,7 @@ class AstTranslator {
44824
44095
  visitBinary(ast) {
44825
44096
  const lhs = wrapForDiagnostics(this.translate(ast.left));
44826
44097
  const rhs = wrapForDiagnostics(this.translate(ast.right));
44827
- const op = BINARY_OPS.get(ast.operation);
44098
+ const op = this.BINARY_OPS.get(ast.operation);
44828
44099
  if (op === undefined) {
44829
44100
  throw new Error(`Unsupported Binary.operation: ${ast.operation}`);
44830
44101
  }
@@ -44962,7 +44233,7 @@ class AstTranslator {
44962
44233
  // The type of this expression is (typeof a!.b) | undefined, which is exactly as desired.
44963
44234
  const expr = ts.factory.createPropertyAccessExpression(ts.factory.createNonNullExpression(receiver), ast.name);
44964
44235
  addParseSpanInfo(expr, ast.nameSpan);
44965
- node = ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(ANY_EXPRESSION, undefined, expr, undefined, UNDEFINED));
44236
+ node = ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(getAnyExpression(), undefined, expr, undefined, this.UNDEFINED));
44966
44237
  }
44967
44238
  else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
44968
44239
  // Emulate a View Engine bug where 'any' is inferred for the left-hand side of the safe
@@ -44992,7 +44263,7 @@ class AstTranslator {
44992
44263
  // "a?.[...]" becomes (0 as any ? a![...] : undefined)
44993
44264
  const expr = ts.factory.createElementAccessExpression(ts.factory.createNonNullExpression(receiver), key);
44994
44265
  addParseSpanInfo(expr, ast.sourceSpan);
44995
- node = ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(ANY_EXPRESSION, undefined, expr, undefined, UNDEFINED));
44266
+ node = ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(getAnyExpression(), undefined, expr, undefined, this.UNDEFINED));
44996
44267
  }
44997
44268
  else if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
44998
44269
  // "a?.[...]" becomes (a as any)[...]
@@ -45081,7 +44352,7 @@ class AstTranslator {
45081
44352
  if (this.config.strictSafeNavigationTypes) {
45082
44353
  // "a?.method(...)" becomes (0 as any ? a!.method(...) : undefined)
45083
44354
  const call = ts.factory.createCallExpression(ts.factory.createNonNullExpression(expr), undefined, args);
45084
- return ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(ANY_EXPRESSION, undefined, call, undefined, UNDEFINED));
44355
+ return ts.factory.createParenthesizedExpression(ts.factory.createConditionalExpression(getAnyExpression(), undefined, call, undefined, this.UNDEFINED));
45085
44356
  }
45086
44357
  if (VeSafeLhsInferenceBugDetector.veWillInferAnyFor(ast)) {
45087
44358
  // "a?.method(...)" becomes (a as any).method(...)
@@ -45324,7 +44595,13 @@ class TcbOp {
45324
44595
  * circular references.
45325
44596
  */
45326
44597
  circularFallback() {
45327
- return INFER_TYPE_FOR_CIRCULAR_OP_EXPR;
44598
+ // Value used to break a circular reference between `TcbOp`s.
44599
+ //
44600
+ // This value is returned whenever `TcbOp`s have a circular dependency. The
44601
+ // expression is a non-null assertion of the null value (in TypeScript, the
44602
+ // expression `null!`). This construction will infer the least narrow type
44603
+ // for whatever it's assigned to.
44604
+ return ts.factory.createNonNullExpression(ts.factory.createNull());
45328
44605
  }
45329
44606
  }
45330
44607
  /**
@@ -45777,7 +45054,7 @@ class TcbInvalidReferenceOp extends TcbOp {
45777
45054
  optional = true;
45778
45055
  execute() {
45779
45056
  const id = this.tcb.allocateId();
45780
- this.scope.addStatement(tsCreateVariable(id, ANY_EXPRESSION));
45057
+ this.scope.addStatement(tsCreateVariable(id, getAnyExpression()));
45781
45058
  return id;
45782
45059
  }
45783
45060
  }
@@ -46759,14 +46036,6 @@ class TcbForOfOp extends TcbOp {
46759
46036
  return null;
46760
46037
  }
46761
46038
  }
46762
- /**
46763
- * Value used to break a circular reference between `TcbOp`s.
46764
- *
46765
- * This value is returned whenever `TcbOp`s have a circular dependency. The expression is a non-null
46766
- * assertion of the null value (in TypeScript, the expression `null!`). This construction will infer
46767
- * the least narrow type for whatever it's assigned to.
46768
- */
46769
- const INFER_TYPE_FOR_CIRCULAR_OP_EXPR = ts.factory.createNonNullExpression(ts.factory.createNull());
46770
46039
  /**
46771
46040
  * Overall generation context for the type check block.
46772
46041
  *
@@ -46888,16 +46157,18 @@ class Scope {
46888
46157
  */
46889
46158
  statements = [];
46890
46159
  /**
46891
- * Names of the for loop context variables and their types.
46160
+ * Gets names of the for loop context variables and their types.
46892
46161
  */
46893
- static forLoopContextVariableTypes = new Map([
46894
- ['$first', ts.SyntaxKind.BooleanKeyword],
46895
- ['$last', ts.SyntaxKind.BooleanKeyword],
46896
- ['$even', ts.SyntaxKind.BooleanKeyword],
46897
- ['$odd', ts.SyntaxKind.BooleanKeyword],
46898
- ['$index', ts.SyntaxKind.NumberKeyword],
46899
- ['$count', ts.SyntaxKind.NumberKeyword],
46900
- ]);
46162
+ static getForLoopContextVariableTypes() {
46163
+ return new Map([
46164
+ ['$first', ts.SyntaxKind.BooleanKeyword],
46165
+ ['$last', ts.SyntaxKind.BooleanKeyword],
46166
+ ['$even', ts.SyntaxKind.BooleanKeyword],
46167
+ ['$odd', ts.SyntaxKind.BooleanKeyword],
46168
+ ['$index', ts.SyntaxKind.NumberKeyword],
46169
+ ['$count', ts.SyntaxKind.NumberKeyword],
46170
+ ]);
46171
+ }
46901
46172
  constructor(tcb, parent = null, guard = null) {
46902
46173
  this.tcb = tcb;
46903
46174
  this.parent = parent;
@@ -46934,13 +46205,13 @@ class Scope {
46934
46205
  const firstDecl = varMap.get(v.name);
46935
46206
  tcb.oobRecorder.duplicateTemplateVar(tcb.id, v, firstDecl);
46936
46207
  }
46937
- this.registerVariable(scope, v, new TcbTemplateVariableOp(tcb, scope, scopedNode, v));
46208
+ Scope.registerVariable(scope, v, new TcbTemplateVariableOp(tcb, scope, scopedNode, v));
46938
46209
  }
46939
46210
  }
46940
46211
  else if (scopedNode instanceof IfBlockBranch) {
46941
46212
  const { expression, expressionAlias } = scopedNode;
46942
46213
  if (expression !== null && expressionAlias !== null) {
46943
- this.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
46214
+ Scope.registerVariable(scope, expressionAlias, new TcbBlockVariableOp(tcb, scope, tcbExpression(expression, tcb, scope), expressionAlias));
46944
46215
  }
46945
46216
  }
46946
46217
  else if (scopedNode instanceof ForLoopBlock) {
@@ -46949,12 +46220,13 @@ class Scope {
46949
46220
  const loopInitializer = tcb.allocateId();
46950
46221
  addParseSpanInfo(loopInitializer, scopedNode.item.sourceSpan);
46951
46222
  scope.varMap.set(scopedNode.item, loopInitializer);
46223
+ const forLoopContextVariableTypes = Scope.getForLoopContextVariableTypes();
46952
46224
  for (const variable of scopedNode.contextVariables) {
46953
- if (!this.forLoopContextVariableTypes.has(variable.value)) {
46225
+ if (!forLoopContextVariableTypes.has(variable.value)) {
46954
46226
  throw new Error(`Unrecognized for loop context variable ${variable.name}`);
46955
46227
  }
46956
- const type = ts.factory.createKeywordTypeNode(this.forLoopContextVariableTypes.get(variable.value));
46957
- this.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
46228
+ const type = ts.factory.createKeywordTypeNode(forLoopContextVariableTypes.get(variable.value));
46229
+ Scope.registerVariable(scope, variable, new TcbBlockImplicitVariableOp(tcb, scope, type, variable));
46958
46230
  }
46959
46231
  }
46960
46232
  else if (scopedNode instanceof HostElement) {
@@ -47695,7 +46967,7 @@ class TcbExpressionTranslator {
47695
46967
  // No pipe by that name exists in scope. Record this as an error.
47696
46968
  this.tcb.oobRecorder.missingPipe(this.tcb.id, ast, this.tcb.hostIsStandalone);
47697
46969
  // Use an 'any' value to at least allow the rest of the expression to be checked.
47698
- pipe = ANY_EXPRESSION;
46970
+ pipe = getAnyExpression();
47699
46971
  }
47700
46972
  else if (pipeMeta.isExplicitlyDeferred &&
47701
46973
  this.tcb.boundTarget.getEagerlyUsedPipes().includes(ast.name)) {
@@ -47703,7 +46975,7 @@ class TcbExpressionTranslator {
47703
46975
  // but was used outside of a `@defer` block, which is the error.
47704
46976
  this.tcb.oobRecorder.deferredPipeUsedEagerly(this.tcb.id, ast);
47705
46977
  // Use an 'any' value to at least allow the rest of the expression to be checked.
47706
- pipe = ANY_EXPRESSION;
46978
+ pipe = getAnyExpression();
47707
46979
  }
47708
46980
  else {
47709
46981
  // Use a variable declared as the pipe's type.
@@ -47794,7 +47066,7 @@ function tcbCallTypeCtor(dir, tcb, inputs) {
47794
47066
  else {
47795
47067
  // A type constructor is required to be called with all input properties, so any unset
47796
47068
  // inputs are simply assigned a value of type `any` to ignore them.
47797
- return ts.factory.createPropertyAssignment(propertyName, ANY_EXPRESSION);
47069
+ return ts.factory.createPropertyAssignment(propertyName, getAnyExpression());
47798
47070
  }
47799
47071
  });
47800
47072
  // Call the `ngTypeCtor` method on the directive class, with an object literal argument created
@@ -50521,6 +49793,7 @@ exports.ImportManager = ImportManager;
50521
49793
  exports.Interpolation = Interpolation$1;
50522
49794
  exports.InterpolationConfig = InterpolationConfig;
50523
49795
  exports.InvokeFunctionExpr = InvokeFunctionExpr;
49796
+ exports.KnownFn = KnownFn;
50524
49797
  exports.LetDeclaration = LetDeclaration$1;
50525
49798
  exports.LiteralArrayExpr = LiteralArrayExpr;
50526
49799
  exports.LiteralExpr = LiteralExpr;
@@ -50553,6 +49826,7 @@ exports.Reference = Reference;
50553
49826
  exports.Reference$1 = Reference$1;
50554
49827
  exports.ReferenceEmitter = ReferenceEmitter;
50555
49828
  exports.RelativePathStrategy = RelativePathStrategy;
49829
+ exports.ResolvedModule = ResolvedModule;
50556
49830
  exports.ReturnStatement = ReturnStatement;
50557
49831
  exports.SafeCall = SafeCall;
50558
49832
  exports.SafeKeyedRead = SafeKeyedRead;
@@ -50560,8 +49834,6 @@ exports.SafePropertyRead = SafePropertyRead;
50560
49834
  exports.SelectorMatcher = SelectorMatcher;
50561
49835
  exports.SelectorlessMatcher = SelectorlessMatcher;
50562
49836
  exports.Serializer = Serializer;
50563
- exports.StaticInterpreter = StaticInterpreter;
50564
- exports.SyntheticValue = SyntheticValue;
50565
49837
  exports.Tag = Tag;
50566
49838
  exports.TagPlaceholder = TagPlaceholder;
50567
49839
  exports.Template = Template;
@@ -50650,6 +49922,7 @@ exports.isAliasImportDeclaration = isAliasImportDeclaration;
50650
49922
  exports.isAngularCore = isAngularCore;
50651
49923
  exports.isAngularCoreReferenceWithPotentialAliasing = isAngularCoreReferenceWithPotentialAliasing;
50652
49924
  exports.isAngularDecorator = isAngularDecorator;
49925
+ exports.isDeclaration = isDeclaration;
50653
49926
  exports.isDtsPath = isDtsPath;
50654
49927
  exports.isExpressionForwardReference = isExpressionForwardReference;
50655
49928
  exports.isFatalDiagnosticError = isFatalDiagnosticError;
@@ -50660,7 +49933,7 @@ exports.isNamedClassDeclaration = isNamedClassDeclaration;
50660
49933
  exports.isNonDeclarationTsPath = isNonDeclarationTsPath;
50661
49934
  exports.isShim = isShim;
50662
49935
  exports.join = join;
50663
- exports.literal = literal$1;
49936
+ exports.literal = literal;
50664
49937
  exports.literalArr = literalArr;
50665
49938
  exports.literalMap = literalMap;
50666
49939
  exports.loadIsReferencedAliasDeclarationPatch = loadIsReferencedAliasDeclarationPatch;