@angular/core 20.0.0-next.6 → 20.0.0-next.8

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 (65) hide show
  1. package/{api.d-DQLNOR5l.d.ts → api.d-KjtSQajV.d.ts} +2 -2
  2. package/{ng_i18n_closure_mode.d-C9d2CaSt.d.ts → chrome_dev_tools_performance.d-qv7drdAl.d.ts} +17 -2
  3. package/{discovery.d-CFs2MaLO.d.ts → discovery.d-vJaEafe4.d.ts} +6 -67
  4. package/event_dispatcher.d-DlbccpYq.d.ts +1 -1
  5. package/fesm2022/attribute-BWp59EjE.mjs +1 -1
  6. package/fesm2022/core.mjs +12 -23
  7. package/fesm2022/core.mjs.map +1 -1
  8. package/fesm2022/{debug_node-z_3NG8qT.mjs → debug_node-DEfPCixm.mjs} +211 -92
  9. package/fesm2022/debug_node-DEfPCixm.mjs.map +1 -0
  10. package/fesm2022/primitives/di.mjs +1 -1
  11. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  12. package/fesm2022/primitives/signals.mjs +1 -1
  13. package/fesm2022/{resource-CPPwEcg7.mjs → resource-DhKtse7l.mjs} +3 -3
  14. package/fesm2022/resource-DhKtse7l.mjs.map +1 -0
  15. package/fesm2022/{root_effect_scheduler-VSXfCzDX.mjs → root_effect_scheduler-BZMWiScf.mjs} +118 -61
  16. package/fesm2022/root_effect_scheduler-BZMWiScf.mjs.map +1 -0
  17. package/fesm2022/rxjs-interop.mjs +4 -4
  18. package/fesm2022/rxjs-interop.mjs.map +1 -1
  19. package/fesm2022/signal-B6pMq7KS.mjs +1 -1
  20. package/fesm2022/testing.mjs +17 -4
  21. package/fesm2022/testing.mjs.map +1 -1
  22. package/fesm2022/untracked-Bz5WMeU1.mjs +1 -1
  23. package/fesm2022/weak_ref-BaIq-pgY.mjs +1 -1
  24. package/graph.d-BcIOep_B.d.ts +1 -1
  25. package/index.d.ts +80 -43
  26. package/package.json +2 -2
  27. package/primitives/di/index.d.ts +1 -1
  28. package/primitives/event-dispatch/index.d.ts +1 -1
  29. package/primitives/signals/index.d.ts +1 -1
  30. package/rxjs-interop/index.d.ts +4 -4
  31. package/schematics/bundles/{apply_import_manager-DnMqg1pY.js → apply_import_manager-CaG-_cEq.js} +3 -3
  32. package/schematics/bundles/{change_tracker-UMPkv-eH.js → change_tracker-ISzWfEHN.js} +3 -3
  33. package/schematics/bundles/{checker-BFBQyesT.js → checker-DV96LHWz.js} +6 -3
  34. package/schematics/bundles/cleanup-unused-imports.js +6 -6
  35. package/schematics/bundles/{compiler-BQ7R7w2v.js → compiler-BEZ6sUQS.js} +195 -84
  36. package/schematics/bundles/compiler_host-CAfDJO3W.js +1 -1
  37. package/schematics/bundles/control-flow-migration.js +2 -2
  38. package/schematics/bundles/document-core.js +6 -6
  39. package/schematics/bundles/imports-CIX-JgAN.js +1 -1
  40. package/schematics/bundles/{index-D8tMJPKa.js → index-6wv04ZFQ.js} +5 -5
  41. package/schematics/bundles/{index-Cv4Q415G.js → index-B1R5GL-k.js} +59 -51
  42. package/schematics/bundles/inject-flags.js +6 -6
  43. package/schematics/bundles/inject-migration.js +118 -26
  44. package/schematics/bundles/leading_space-D9nQ8UQC.js +1 -1
  45. package/schematics/bundles/{migrate_ts_type_references-Cq_ZBuT4.js → migrate_ts_type_references-Dh9TZgTr.js} +7 -6
  46. package/schematics/bundles/ng_decorators-DznZ5jMl.js +1 -1
  47. package/schematics/bundles/nodes-B16H9JUd.js +1 -1
  48. package/schematics/bundles/output-migration.js +7 -7
  49. package/schematics/bundles/{project_paths-ql6qcf_c.js → project_paths-B-Nevd-p.js} +4 -4
  50. package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.js +1 -1
  51. package/schematics/bundles/property_name-BBwFuqMe.js +1 -1
  52. package/schematics/bundles/route-lazy-loading.js +4 -4
  53. package/schematics/bundles/self-closing-tags-migration.js +5 -5
  54. package/schematics/bundles/signal-input-migration.js +8 -8
  55. package/schematics/bundles/signal-queries-migration.js +8 -8
  56. package/schematics/bundles/signals.js +8 -8
  57. package/schematics/bundles/standalone-migration.js +5 -5
  58. package/schematics/bundles/symbol-VPWguRxr.js +1 -1
  59. package/schematics/bundles/test-bed-get.js +5 -5
  60. package/signal.d-E0e5nW1p.d.ts +1 -1
  61. package/testing/index.d.ts +10 -4
  62. package/weak_ref.d-eGOEP9S1.d.ts +1 -1
  63. package/fesm2022/debug_node-z_3NG8qT.mjs.map +0 -1
  64. package/fesm2022/resource-CPPwEcg7.mjs.map +0 -1
  65. package/fesm2022/root_effect_scheduler-VSXfCzDX.mjs.map +0 -1
@@ -1,15 +1,15 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.0.0-next.6
3
+ * @license Angular v20.0.0-next.8
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
- var compiler = require('./compiler-BQ7R7w2v.js');
9
+ var compiler = require('./compiler-BEZ6sUQS.js');
10
10
  var ts = require('typescript');
11
11
  var p = require('path');
12
- var checker = require('./checker-BFBQyesT.js');
12
+ var checker = require('./checker-DV96LHWz.js');
13
13
  require('os');
14
14
 
15
15
  function _interopNamespaceDefault(e) {
@@ -892,7 +892,7 @@ const MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION = '18.0.0';
892
892
  function compileDeclareClassMetadata(metadata) {
893
893
  const definitionMap = new compiler.DefinitionMap();
894
894
  definitionMap.set('minVersion', compiler.literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
895
- definitionMap.set('version', compiler.literal('20.0.0-next.6'));
895
+ definitionMap.set('version', compiler.literal('20.0.0-next.8'));
896
896
  definitionMap.set('ngImport', compiler.importExpr(compiler.Identifiers.core));
897
897
  definitionMap.set('type', metadata.type);
898
898
  definitionMap.set('decorators', metadata.decorators);
@@ -910,7 +910,7 @@ function compileComponentDeclareClassMetadata(metadata, dependencies) {
910
910
  callbackReturnDefinitionMap.set('ctorParameters', metadata.ctorParameters ?? compiler.literal(null));
911
911
  callbackReturnDefinitionMap.set('propDecorators', metadata.propDecorators ?? compiler.literal(null));
912
912
  definitionMap.set('minVersion', compiler.literal(MINIMUM_PARTIAL_LINKER_DEFER_SUPPORT_VERSION));
913
- definitionMap.set('version', compiler.literal('20.0.0-next.6'));
913
+ definitionMap.set('version', compiler.literal('20.0.0-next.8'));
914
914
  definitionMap.set('ngImport', compiler.importExpr(compiler.Identifiers.core));
915
915
  definitionMap.set('type', metadata.type);
916
916
  definitionMap.set('resolveDeferredDeps', compileComponentMetadataAsyncResolver(dependencies));
@@ -1005,7 +1005,7 @@ function createDirectiveDefinitionMap(meta) {
1005
1005
  const definitionMap = new compiler.DefinitionMap();
1006
1006
  const minVersion = getMinimumVersionForPartialOutput(meta);
1007
1007
  definitionMap.set('minVersion', compiler.literal(minVersion));
1008
- definitionMap.set('version', compiler.literal('20.0.0-next.6'));
1008
+ definitionMap.set('version', compiler.literal('20.0.0-next.8'));
1009
1009
  // e.g. `type: MyDirective`
1010
1010
  definitionMap.set('type', meta.type.value);
1011
1011
  if (meta.isStandalone !== undefined) {
@@ -1421,7 +1421,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
1421
1421
  function compileDeclareFactoryFunction(meta) {
1422
1422
  const definitionMap = new compiler.DefinitionMap();
1423
1423
  definitionMap.set('minVersion', compiler.literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
1424
- definitionMap.set('version', compiler.literal('20.0.0-next.6'));
1424
+ definitionMap.set('version', compiler.literal('20.0.0-next.8'));
1425
1425
  definitionMap.set('ngImport', compiler.importExpr(compiler.Identifiers.core));
1426
1426
  definitionMap.set('type', meta.type.value);
1427
1427
  definitionMap.set('deps', compileDependencies(meta.deps));
@@ -1456,7 +1456,7 @@ function compileDeclareInjectableFromMetadata(meta) {
1456
1456
  function createInjectableDefinitionMap(meta) {
1457
1457
  const definitionMap = new compiler.DefinitionMap();
1458
1458
  definitionMap.set('minVersion', compiler.literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
1459
- definitionMap.set('version', compiler.literal('20.0.0-next.6'));
1459
+ definitionMap.set('version', compiler.literal('20.0.0-next.8'));
1460
1460
  definitionMap.set('ngImport', compiler.importExpr(compiler.Identifiers.core));
1461
1461
  definitionMap.set('type', meta.type.value);
1462
1462
  // Only generate providedIn property if it has a non-null value
@@ -1507,7 +1507,7 @@ function compileDeclareInjectorFromMetadata(meta) {
1507
1507
  function createInjectorDefinitionMap(meta) {
1508
1508
  const definitionMap = new compiler.DefinitionMap();
1509
1509
  definitionMap.set('minVersion', compiler.literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
1510
- definitionMap.set('version', compiler.literal('20.0.0-next.6'));
1510
+ definitionMap.set('version', compiler.literal('20.0.0-next.8'));
1511
1511
  definitionMap.set('ngImport', compiler.importExpr(compiler.Identifiers.core));
1512
1512
  definitionMap.set('type', meta.type.value);
1513
1513
  definitionMap.set('providers', meta.providers);
@@ -1540,7 +1540,7 @@ function createNgModuleDefinitionMap(meta) {
1540
1540
  throw new Error('Invalid path! Local compilation mode should not get into the partial compilation path');
1541
1541
  }
1542
1542
  definitionMap.set('minVersion', compiler.literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
1543
- definitionMap.set('version', compiler.literal('20.0.0-next.6'));
1543
+ definitionMap.set('version', compiler.literal('20.0.0-next.8'));
1544
1544
  definitionMap.set('ngImport', compiler.importExpr(compiler.Identifiers.core));
1545
1545
  definitionMap.set('type', meta.type.value);
1546
1546
  // We only generate the keys in the metadata if the arrays contain values.
@@ -1591,7 +1591,7 @@ function compileDeclarePipeFromMetadata(meta) {
1591
1591
  function createPipeDefinitionMap(meta) {
1592
1592
  const definitionMap = new compiler.DefinitionMap();
1593
1593
  definitionMap.set('minVersion', compiler.literal(MINIMUM_PARTIAL_LINKER_VERSION));
1594
- definitionMap.set('version', compiler.literal('20.0.0-next.6'));
1594
+ definitionMap.set('version', compiler.literal('20.0.0-next.8'));
1595
1595
  definitionMap.set('ngImport', compiler.importExpr(compiler.Identifiers.core));
1596
1596
  // e.g. `type: MyPipe`
1597
1597
  definitionMap.set('type', meta.type.value);
@@ -2582,6 +2582,7 @@ class DtsMetadataReader {
2582
2582
  name,
2583
2583
  nameExpr: null,
2584
2584
  isStandalone,
2585
+ isPure: null, // The DTS has no idea about that
2585
2586
  decorator: null,
2586
2587
  isExplicitlyDeferred: false,
2587
2588
  };
@@ -9471,6 +9472,7 @@ class ComponentDecoratorHandler {
9471
9472
  }
9472
9473
  }
9473
9474
  }
9475
+ // TODO(crisbeto): implement for selectorless.
9474
9476
  const binder = new compiler.R3TargetBinder(matcher);
9475
9477
  const boundTemplate = binder.bind({ template: analysis.template.diagNodes });
9476
9478
  context.addComponent({
@@ -9493,6 +9495,7 @@ class ComponentDecoratorHandler {
9493
9495
  // Don't type-check components that had errors in their scopes, unless requested.
9494
9496
  return;
9495
9497
  }
9498
+ // TODO(crisbeto): implement for selectorless.
9496
9499
  const binder = new compiler.R3TargetBinder(scope.matcher);
9497
9500
  const templateContext = {
9498
9501
  nodes: meta.template.diagNodes,
@@ -10295,6 +10298,7 @@ function createTargetBinder(dependencies) {
10295
10298
  matcher.addSelectables(compiler.CssSelector.parse(dep.selector), [dep]);
10296
10299
  }
10297
10300
  }
10301
+ // TODO(crisbeto): implement for selectorless.
10298
10302
  return new compiler.R3TargetBinder(matcher);
10299
10303
  }
10300
10304
  /**
@@ -10821,6 +10825,7 @@ class PipeDecoratorHandler {
10821
10825
  isStandalone: analysis.meta.isStandalone,
10822
10826
  decorator: analysis.decorator,
10823
10827
  isExplicitlyDeferred: false,
10828
+ isPure: analysis.meta.pure,
10824
10829
  });
10825
10830
  this.injectableRegistry.registerInjectable(node, {
10826
10831
  ctorDeps: analysis.meta.deps,
@@ -10870,7 +10875,7 @@ class PipeDecoratorHandler {
10870
10875
  * @description
10871
10876
  * Entry point for all public APIs of the compiler-cli package.
10872
10877
  */
10873
- new compiler.Version('20.0.0-next.6');
10878
+ new compiler.Version('20.0.0-next.8');
10874
10879
 
10875
10880
  /**
10876
10881
  * Whether a given decorator should be treated as an Angular decorator.
@@ -12159,11 +12164,7 @@ class FunctionExtractor {
12159
12164
  // TODO: is there any real situation in which the signature would not be available here?
12160
12165
  // Is void a better type?
12161
12166
  const signature = this.typeChecker.getSignatureFromDeclaration(this.exportDeclaration);
12162
- const returnType = signature
12163
- ? this.typeChecker.typeToString(this.typeChecker.getReturnTypeOfSignature(signature), undefined,
12164
- // This ensures that e.g. `T | undefined` is not reduced to `T`.
12165
- ts.TypeFormatFlags.NoTypeReduction | ts.TypeFormatFlags.NoTruncation)
12166
- : 'unknown';
12167
+ const returnType = signature ? extractReturnType(signature, this.typeChecker) : 'unknown';
12167
12168
  const implementation = findImplementationOfFunction(this.exportDeclaration, this.typeChecker) ??
12168
12169
  this.exportDeclaration;
12169
12170
  const type = this.typeChecker.getTypeAtLocation(this.exportDeclaration);
@@ -12247,11 +12248,18 @@ function extractCallSignatures(name, typeChecker, type) {
12247
12248
  jsdocTags: extractJsDocTags(decl),
12248
12249
  params: extractAllParams(decl.parameters, typeChecker),
12249
12250
  rawComment: extractRawJsDoc(decl),
12250
- returnType: typeChecker.typeToString(typeChecker.getReturnTypeOfSignature(signature), undefined,
12251
- // This ensures that e.g. `T | undefined` is not reduced to `T`.
12252
- ts.TypeFormatFlags.NoTypeReduction | ts.TypeFormatFlags.NoTruncation),
12251
+ returnType: extractReturnType(signature, typeChecker),
12253
12252
  }));
12254
12253
  }
12254
+ function extractReturnType(signature, typeChecker) {
12255
+ // Handling Type Predicates
12256
+ if (signature?.declaration?.type && ts.isTypePredicateNode(signature.declaration.type)) {
12257
+ return signature.declaration.type.getText();
12258
+ }
12259
+ return typeChecker.typeToString(typeChecker.getReturnTypeOfSignature(signature), undefined,
12260
+ // This ensures that e.g. `T | undefined` is not reduced to `T`.
12261
+ ts.TypeFormatFlags.NoTypeReduction | ts.TypeFormatFlags.NoTruncation);
12262
+ }
12255
12263
  /** Finds the implementation of the given function declaration overload signature. */
12256
12264
  function findImplementationOfFunction(node, typeChecker) {
12257
12265
  if (node.body !== undefined || node.name === undefined) {
@@ -12331,7 +12339,8 @@ class ClassExtractor {
12331
12339
  else if (ts.isAccessor(memberDeclaration)) {
12332
12340
  return this.extractGetterSetter(memberDeclaration);
12333
12341
  }
12334
- else if (ts.isConstructorDeclaration(memberDeclaration)) {
12342
+ else if (ts.isConstructorDeclaration(memberDeclaration) &&
12343
+ memberDeclaration.parameters.length > 0) {
12335
12344
  return this.extractConstructor(memberDeclaration);
12336
12345
  }
12337
12346
  // We only expect methods, properties, and accessors. If we encounter something else,
@@ -12633,6 +12642,8 @@ class PipeExtractor extends ClassExtractor {
12633
12642
  pipeName: this.metadata.name,
12634
12643
  entryType: EntryType.Pipe,
12635
12644
  isStandalone: this.metadata.isStandalone,
12645
+ usage: extractPipeSyntax(this.metadata, this.declaration),
12646
+ isPure: this.metadata.isPure,
12636
12647
  };
12637
12648
  }
12638
12649
  }
@@ -12678,6 +12689,21 @@ function extractInterface(declaration, typeChecker) {
12678
12689
  const extractor = new ClassExtractor(declaration, typeChecker);
12679
12690
  return extractor.extract();
12680
12691
  }
12692
+ function extractPipeSyntax(metadata, classDeclaration) {
12693
+ const transformParams = classDeclaration.members.find((member) => {
12694
+ return (ts.isMethodDeclaration(member) &&
12695
+ member.name &&
12696
+ ts.isIdentifier(member.name) &&
12697
+ member.name.getText() === 'transform');
12698
+ });
12699
+ let paramNames = transformParams.parameters
12700
+ // value is the first argument, it's already referenced before the pipe
12701
+ .slice(1)
12702
+ .map((param) => {
12703
+ return param.name.getText();
12704
+ });
12705
+ return `{{ value_expression | ${metadata.name}${paramNames.length ? ':' + paramNames.join(':') : ''} }}`;
12706
+ }
12681
12707
 
12682
12708
  /** Name of the tag indicating that an object literal should be shown as an enum in docs. */
12683
12709
  const LITERAL_AS_ENUM_TAG = 'object-literal-as-enum';
@@ -14183,6 +14209,9 @@ let TemplateVisitor$1 = class TemplateVisitor extends compiler.RecursiveVisitor
14183
14209
  }
14184
14210
  /** Creates an identifier for a template element or template node. */
14185
14211
  elementOrTemplateToIdentifier(node) {
14212
+ if (node instanceof compiler.Component || node instanceof compiler.Directive) {
14213
+ throw new Error('TODO');
14214
+ }
14186
14215
  // If this node has already been seen, return the cached result.
14187
14216
  if (this.elementAndTemplateIdentifierCache.has(node)) {
14188
14217
  return this.elementAndTemplateIdentifierCache.get(node);
@@ -14260,7 +14289,10 @@ let TemplateVisitor$1 = class TemplateVisitor extends compiler.RecursiveVisitor
14260
14289
  if (refTarget) {
14261
14290
  let node = null;
14262
14291
  let directive = null;
14263
- if (refTarget instanceof compiler.Element || refTarget instanceof compiler.Template) {
14292
+ if (refTarget instanceof compiler.Element ||
14293
+ refTarget instanceof compiler.Template ||
14294
+ refTarget instanceof compiler.Component ||
14295
+ refTarget instanceof compiler.Directive) {
14264
14296
  node = this.elementOrTemplateToIdentifier(refTarget);
14265
14297
  }
14266
14298
  else {
@@ -16104,28 +16136,6 @@ class SourceFileValidator {
16104
16136
  }
16105
16137
  }
16106
16138
 
16107
- function coreHasSymbol(program, symbol) {
16108
- const checker = program.getTypeChecker();
16109
- for (const sf of program.getSourceFiles().filter(isMaybeCore)) {
16110
- const sym = checker.getSymbolAtLocation(sf);
16111
- if (sym === undefined || sym.exports === undefined) {
16112
- continue;
16113
- }
16114
- if (!sym.exports.has('ɵɵtemplate')) {
16115
- // This is not @angular/core.
16116
- continue;
16117
- }
16118
- return sym.exports.has(symbol.name);
16119
- }
16120
- // No @angular/core file found, so we have no information.
16121
- return null;
16122
- }
16123
- function isMaybeCore(sf) {
16124
- return (sf.isDeclarationFile &&
16125
- sf.fileName.includes('@angular/core') &&
16126
- sf.fileName.endsWith('index.d.ts'));
16127
- }
16128
-
16129
16139
  function getDefaultExportFromCjs (x) {
16130
16140
  return x && x.__esModule && Object.prototype.hasOwnProperty.call(x, 'default') ? x['default'] : x;
16131
16141
  }
@@ -18801,7 +18811,7 @@ var semver = /*@__PURE__*/getDefaultExportFromCjs(semverExports);
18801
18811
  * @param minVersion Minimum required version for the feature.
18802
18812
  */
18803
18813
  function coreVersionSupportsFeature(coreVersion, minVersion) {
18804
- // A version of `20.0.0-next.6` usually means that core is at head so it supports
18814
+ // A version of `20.0.0-next.8` usually means that core is at head so it supports
18805
18815
  // all features. Use string interpolation prevent the placeholder from being replaced
18806
18816
  // with the current version during build time.
18807
18817
  if (coreVersion === `0.0.0-${'PLACEHOLDER'}`) {
@@ -19406,13 +19416,11 @@ class NgCompiler {
19406
19416
  const useInlineTypeConstructors = this.programDriver.supportsInlineOperations;
19407
19417
  const checkTwoWayBoundEvents = this.options['_checkTwoWayBoundEvents'] ?? false;
19408
19418
  // Check whether the loaded version of `@angular/core` in the `ts.Program` supports unwrapping
19409
- // writable signals for type-checking. If this check fails to find a suitable .d.ts file, fall
19410
- // back to version detection. Only Angular versions greater than 17.2 have the necessary symbols
19411
- // to type check signals in two-way bindings. We also allow version 0.0.0 in case somebody is
19419
+ // writable signals for type-checking. Only Angular versions greater than 17.2 have the necessary
19420
+ // symbols to type check signals in two-way bindings. We also allow version 0.0.0 in case somebody is
19412
19421
  // using Angular at head.
19413
- let allowSignalsInTwoWayBindings = coreHasSymbol(this.inputProgram, compiler.Identifiers.unwrapWritableSignal) ??
19414
- (this.angularCoreVersion === null ||
19415
- coreVersionSupportsFeature(this.angularCoreVersion, '>= 17.2.0'));
19422
+ const allowSignalsInTwoWayBindings = this.angularCoreVersion === null ||
19423
+ coreVersionSupportsFeature(this.angularCoreVersion, '>= 17.2.0-0');
19416
19424
  // First select a type-checking configuration, based on whether full template type-checking is
19417
19425
  // requested.
19418
19426
  let typeCheckingConfig;
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.0.0-next.6
3
+ * @license Angular v20.0.0-next.8
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -8,12 +8,12 @@
8
8
 
9
9
  var ts = require('typescript');
10
10
  require('os');
11
- var checker = require('./checker-BFBQyesT.js');
12
- require('./compiler-BQ7R7w2v.js');
13
- require('./index-Cv4Q415G.js');
11
+ var checker = require('./checker-DV96LHWz.js');
12
+ require('./compiler-BEZ6sUQS.js');
13
+ require('./index-B1R5GL-k.js');
14
14
  require('path');
15
- var project_paths = require('./project_paths-ql6qcf_c.js');
16
- var apply_import_manager = require('./apply_import_manager-DnMqg1pY.js');
15
+ var project_paths = require('./project_paths-B-Nevd-p.js');
16
+ var apply_import_manager = require('./apply_import_manager-CaG-_cEq.js');
17
17
  var imports = require('./imports-CIX-JgAN.js');
18
18
  require('@angular-devkit/core');
19
19
  require('node:path/posix');
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.0.0-next.6
3
+ * @license Angular v20.0.0-next.8
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -8,15 +8,15 @@
8
8
 
9
9
  var schematics = require('@angular-devkit/schematics');
10
10
  var p = require('path');
11
- var change_tracker = require('./change_tracker-UMPkv-eH.js');
11
+ var change_tracker = require('./change_tracker-ISzWfEHN.js');
12
12
  var compiler_host = require('./compiler_host-CAfDJO3W.js');
13
13
  var ts = require('typescript');
14
14
  var ng_decorators = require('./ng_decorators-DznZ5jMl.js');
15
15
  var imports = require('./imports-CIX-JgAN.js');
16
16
  var nodes = require('./nodes-B16H9JUd.js');
17
17
  var leading_space = require('./leading_space-D9nQ8UQC.js');
18
- require('./compiler-BQ7R7w2v.js');
19
- require('./checker-BFBQyesT.js');
18
+ require('./compiler-BEZ6sUQS.js');
19
+ require('./checker-DV96LHWz.js');
20
20
  require('os');
21
21
  require('fs');
22
22
  require('module');
@@ -373,7 +373,7 @@ function isInlineFunction(node) {
373
373
  * @param constructor Constructor declaration of the class being migrated.
374
374
  * @param localTypeChecker Type checker scoped to the current file.
375
375
  */
376
- function findUninitializedPropertiesToCombine(node, constructor, localTypeChecker) {
376
+ function findUninitializedPropertiesToCombine(node, constructor, localTypeChecker, options) {
377
377
  let toCombine = null;
378
378
  let toHoist = [];
379
379
  const membersToDeclarations = new Map();
@@ -391,10 +391,13 @@ function findUninitializedPropertiesToCombine(node, constructor, localTypeChecke
391
391
  if (memberInitializers === null) {
392
392
  return null;
393
393
  }
394
+ const inlinableParameters = options._internalReplaceParameterReferencesInInitializers
395
+ ? findInlinableParameterReferences(constructor, localTypeChecker)
396
+ : new Set();
394
397
  for (const [name, decl] of membersToDeclarations.entries()) {
395
398
  if (memberInitializers.has(name)) {
396
399
  const initializer = memberInitializers.get(name);
397
- if (!hasLocalReferences(initializer, constructor, localTypeChecker)) {
400
+ if (!hasLocalReferences(initializer, constructor, inlinableParameters, localTypeChecker)) {
398
401
  toCombine ??= [];
399
402
  toCombine.push({ declaration: membersToDeclarations.get(name), initializer });
400
403
  }
@@ -536,13 +539,70 @@ function getMemberInitializers(constructor) {
536
539
  }
537
540
  return memberInitializers;
538
541
  }
542
+ /**
543
+ * Checks if the node is an identifier that references a property from the given
544
+ * list. Returns the property if it is.
545
+ */
546
+ function getIdentifierReferencingProperty(node, localTypeChecker, propertyNames, properties) {
547
+ if (!ts.isIdentifier(node) || !propertyNames.has(node.text)) {
548
+ return undefined;
549
+ }
550
+ const declarations = localTypeChecker.getSymbolAtLocation(node)?.declarations;
551
+ if (!declarations) {
552
+ return undefined;
553
+ }
554
+ for (const decl of declarations) {
555
+ if (properties.has(decl)) {
556
+ return decl;
557
+ }
558
+ }
559
+ return undefined;
560
+ }
561
+ /**
562
+ * Returns true if the node introduces a new `this` scope (so we can't
563
+ * reference the outer this).
564
+ */
565
+ function introducesNewThisScope(node) {
566
+ return (ts.isFunctionDeclaration(node) ||
567
+ ts.isFunctionExpression(node) ||
568
+ ts.isMethodDeclaration(node) ||
569
+ ts.isClassDeclaration(node) ||
570
+ ts.isClassExpression(node));
571
+ }
572
+ /**
573
+ * Finds constructor parameter references which can be inlined as `this.prop`.
574
+ * - prop must be a readonly property
575
+ * - the reference can't be in a nested function where `this` might refer
576
+ * to something else
577
+ */
578
+ function findInlinableParameterReferences(constructorDeclaration, localTypeChecker) {
579
+ const eligibleProperties = constructorDeclaration.parameters.filter((p) => ts.isIdentifier(p.name) && p.modifiers?.some((s) => s.kind === ts.SyntaxKind.ReadonlyKeyword));
580
+ const eligibleNames = new Set(eligibleProperties.map((p) => p.name.text));
581
+ const eligiblePropertiesSet = new Set(eligibleProperties);
582
+ function walk(node, canReferenceThis) {
583
+ const property = getIdentifierReferencingProperty(node, localTypeChecker, eligibleNames, eligiblePropertiesSet);
584
+ if (property && !canReferenceThis) {
585
+ // The property is referenced in a nested context where
586
+ // we can't use `this`, so we can't inline it.
587
+ eligiblePropertiesSet.delete(property);
588
+ }
589
+ else if (introducesNewThisScope(node)) {
590
+ canReferenceThis = false;
591
+ }
592
+ ts.forEachChild(node, (child) => {
593
+ walk(child, canReferenceThis);
594
+ });
595
+ }
596
+ walk(constructorDeclaration, true);
597
+ return eligiblePropertiesSet;
598
+ }
539
599
  /**
540
600
  * Determines if a node has references to local symbols defined in the constructor.
541
601
  * @param root Expression to check for local references.
542
602
  * @param constructor Constructor within which the expression is used.
543
603
  * @param localTypeChecker Type checker scoped to the current file.
544
604
  */
545
- function hasLocalReferences(root, constructor, localTypeChecker) {
605
+ function hasLocalReferences(root, constructor, allowedParameters, localTypeChecker) {
546
606
  const sourceFile = root.getSourceFile();
547
607
  let hasLocalRefs = false;
548
608
  const walk = (node) => {
@@ -564,7 +624,8 @@ function hasLocalReferences(root, constructor, localTypeChecker) {
564
624
  // The source file check is a bit redundant since the type checker
565
625
  // is local to the file, but it's inexpensive and it can prevent
566
626
  // bugs in the future if we decide to use a full type checker.
567
- decl.getSourceFile() === sourceFile &&
627
+ !allowedParameters.has(decl) &&
628
+ decl.getSourceFile() === sourceFile &&
568
629
  decl.getStart() >= constructor.getStart() &&
569
630
  decl.getEnd() <= constructor.getEnd() &&
570
631
  !isInsideInlineFunction(decl, constructor));
@@ -628,7 +689,7 @@ function migrateFile(sourceFile, options) {
628
689
  const removedStatements = new Set();
629
690
  const removedMembers = new Set();
630
691
  if (options._internalCombineMemberInitializers) {
631
- applyInternalOnlyChanges(node, constructor, localTypeChecker, tracker, printer, removedStatements, removedMembers, prependToClass, afterInjectCalls, memberIndentation);
692
+ applyInternalOnlyChanges(node, constructor, localTypeChecker, tracker, printer, removedStatements, removedMembers, prependToClass, afterInjectCalls, memberIndentation, options);
632
693
  }
633
694
  migrateClass(node, constructor, superCall, options, memberIndentation, prependToClass, afterInjectCalls, removedStatements, removedMembers, localTypeChecker, printer, tracker);
634
695
  });
@@ -833,7 +894,7 @@ function createInjectReplacementCall(param, options, localTypeChecker, printer,
833
894
  const moduleName = '@angular/core';
834
895
  const sourceFile = param.getSourceFile();
835
896
  const decorators = ng_decorators.getAngularDecorators(localTypeChecker, ts.getDecorators(param) || []);
836
- const literalProps = [];
897
+ const literalProps = new Set();
837
898
  const type = param.type;
838
899
  let injectedType = '';
839
900
  let typeArguments = type && hasGenerics(type) ? [type] : undefined;
@@ -872,20 +933,23 @@ function createInjectReplacementCall(param, options, localTypeChecker, printer,
872
933
  const expression = ts.factory.createNewExpression(constructorRef, undefined, [firstArg]);
873
934
  injectedType = printer.printNode(ts.EmitHint.Unspecified, expression, sourceFile);
874
935
  typeArguments = undefined;
936
+ // @Attribute is implicitly optional.
937
+ hasOptionalDecorator = true;
938
+ literalProps.add('optional');
875
939
  }
876
940
  break;
877
941
  case 'Optional':
878
942
  hasOptionalDecorator = true;
879
- literalProps.push(ts.factory.createPropertyAssignment('optional', ts.factory.createTrue()));
943
+ literalProps.add('optional');
880
944
  break;
881
945
  case 'SkipSelf':
882
- literalProps.push(ts.factory.createPropertyAssignment('skipSelf', ts.factory.createTrue()));
946
+ literalProps.add('skipSelf');
883
947
  break;
884
948
  case 'Self':
885
- literalProps.push(ts.factory.createPropertyAssignment('self', ts.factory.createTrue()));
949
+ literalProps.add('self');
886
950
  break;
887
951
  case 'Host':
888
- literalProps.push(ts.factory.createPropertyAssignment('host', ts.factory.createTrue()));
952
+ literalProps.add('host');
889
953
  break;
890
954
  }
891
955
  }
@@ -894,8 +958,8 @@ function createInjectReplacementCall(param, options, localTypeChecker, printer,
894
958
  // which we then replace with the raw text of the `TypeNode`.
895
959
  const injectRef = tracker.addImport(param.getSourceFile(), 'inject', moduleName);
896
960
  const args = [ts.factory.createIdentifier(PLACEHOLDER)];
897
- if (literalProps.length > 0) {
898
- args.push(ts.factory.createObjectLiteralExpression(literalProps));
961
+ if (literalProps.size > 0) {
962
+ args.push(ts.factory.createObjectLiteralExpression(Array.from(literalProps, (prop) => ts.factory.createPropertyAssignment(prop, ts.factory.createTrue()))));
899
963
  }
900
964
  let expression = ts.factory.createCallExpression(injectRef, typeArguments, args);
901
965
  if (hasOptionalDecorator && options.nonNullableOptional) {
@@ -1099,8 +1163,8 @@ function getNextPreservedStatement(startNode, removedStatements) {
1099
1163
  * @param afterInjectCalls Text that will be inserted after the newly-added `inject` calls.
1100
1164
  * @param memberIndentation Indentation string of the class' members.
1101
1165
  */
1102
- function applyInternalOnlyChanges(node, constructor, localTypeChecker, tracker, printer, removedStatements, removedMembers, prependToClass, afterInjectCalls, memberIndentation) {
1103
- const result = findUninitializedPropertiesToCombine(node, constructor, localTypeChecker);
1166
+ function applyInternalOnlyChanges(node, constructor, localTypeChecker, tracker, printer, removedStatements, removedMembers, prependToClass, afterInjectCalls, memberIndentation, options) {
1167
+ const result = findUninitializedPropertiesToCombine(node, constructor, localTypeChecker, options);
1104
1168
  if (result === null) {
1105
1169
  return;
1106
1170
  }
@@ -1113,21 +1177,25 @@ function applyInternalOnlyChanges(node, constructor, localTypeChecker, tracker,
1113
1177
  }
1114
1178
  result.toCombine.forEach(({ declaration, initializer }) => {
1115
1179
  const initializerStatement = nodes.closestNode(initializer, ts.isStatement);
1180
+ // Strip comments if we are just going modify the node in-place.
1181
+ const modifiers = preserveInitOrder
1182
+ ? declaration.modifiers
1183
+ : cloneModifiers(declaration.modifiers);
1184
+ const name = preserveInitOrder ? declaration.name : cloneName(declaration.name);
1185
+ const newProperty = ts.factory.createPropertyDeclaration(modifiers, name, declaration.questionToken, declaration.type, undefined);
1186
+ const propText = printer.printNode(ts.EmitHint.Unspecified, newProperty, declaration.getSourceFile());
1187
+ const initializerText = replaceParameterReferencesInInitializer(initializer, constructor, localTypeChecker);
1188
+ const withInitializer = `${propText.slice(0, -1)} = ${initializerText};`;
1116
1189
  // If the initialization order is being preserved, we have to remove the original
1117
1190
  // declaration and re-declare it. Otherwise we can do the replacement in-place.
1118
1191
  if (preserveInitOrder) {
1119
- // Preserve comment in the new property since we are removing the entire node.
1120
- const newProperty = ts.factory.createPropertyDeclaration(declaration.modifiers, declaration.name, declaration.questionToken, declaration.type, initializer);
1121
1192
  tracker.removeNode(declaration, true);
1122
1193
  removedMembers.add(declaration);
1123
- afterInjectCalls.push(memberIndentation +
1124
- printer.printNode(ts.EmitHint.Unspecified, newProperty, declaration.getSourceFile()));
1194
+ afterInjectCalls.push(memberIndentation + withInitializer);
1125
1195
  }
1126
1196
  else {
1127
- // Strip comments from the declaration since we are replacing just
1128
- // the node, not the leading comment.
1129
- const newProperty = ts.factory.createPropertyDeclaration(cloneModifiers(declaration.modifiers), cloneName(declaration.name), declaration.questionToken, declaration.type, initializer);
1130
- tracker.replaceNode(declaration, newProperty);
1197
+ const sourceFile = declaration.getSourceFile();
1198
+ tracker.replaceText(sourceFile, declaration.getStart(), declaration.getWidth(), withInitializer);
1131
1199
  }
1132
1200
  // This should always be defined, but null check it just in case.
1133
1201
  if (initializerStatement) {
@@ -1145,6 +1213,30 @@ function applyInternalOnlyChanges(node, constructor, localTypeChecker, tracker,
1145
1213
  prependToClass.push('');
1146
1214
  }
1147
1215
  }
1216
+ function replaceParameterReferencesInInitializer(initializer, constructor, localTypeChecker) {
1217
+ // 1. Collect the locations of identifier nodes that reference constructor parameters.
1218
+ // 2. Add `this.` to those locations.
1219
+ const insertLocations = [0];
1220
+ function walk(node) {
1221
+ if (ts.isIdentifier(node) &&
1222
+ !(ts.isPropertyAccessExpression(node.parent) && node === node.parent.name) &&
1223
+ localTypeChecker
1224
+ .getSymbolAtLocation(node)
1225
+ ?.declarations?.some((decl) => constructor.parameters.includes(decl))) {
1226
+ insertLocations.push(node.getStart() - initializer.getStart());
1227
+ }
1228
+ ts.forEachChild(node, walk);
1229
+ }
1230
+ walk(initializer);
1231
+ const initializerText = initializer.getText();
1232
+ insertLocations.push(initializerText.length);
1233
+ insertLocations.sort((a, b) => a - b);
1234
+ const result = [];
1235
+ for (let i = 0; i < insertLocations.length - 1; i++) {
1236
+ result.push(initializerText.slice(insertLocations[i], insertLocations[i + 1]));
1237
+ }
1238
+ return result.join('this.');
1239
+ }
1148
1240
 
1149
1241
  function migrate(options) {
1150
1242
  return async (tree) => {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.0.0-next.6
3
+ * @license Angular v20.0.0-next.8
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -1,20 +1,20 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.0.0-next.6
3
+ * @license Angular v20.0.0-next.8
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
7
7
  'use strict';
8
8
 
9
- require('./compiler-BQ7R7w2v.js');
9
+ require('./compiler-BEZ6sUQS.js');
10
10
  var ts = require('typescript');
11
- var checker = require('./checker-BFBQyesT.js');
11
+ var checker = require('./checker-DV96LHWz.js');
12
12
  require('os');
13
13
  var assert = require('assert');
14
- var index = require('./index-D8tMJPKa.js');
15
- var project_paths = require('./project_paths-ql6qcf_c.js');
14
+ var index = require('./index-6wv04ZFQ.js');
15
+ var project_paths = require('./project_paths-B-Nevd-p.js');
16
16
  var leading_space = require('./leading_space-D9nQ8UQC.js');
17
- require('./index-Cv4Q415G.js');
17
+ require('./index-B1R5GL-k.js');
18
18
  require('path');
19
19
 
20
20
  /**
@@ -158,6 +158,7 @@ var BinaryOperator;
158
158
  BinaryOperator[BinaryOperator["BiggerEquals"] = 16] = "BiggerEquals";
159
159
  BinaryOperator[BinaryOperator["NullishCoalesce"] = 17] = "NullishCoalesce";
160
160
  BinaryOperator[BinaryOperator["Exponentiation"] = 18] = "Exponentiation";
161
+ BinaryOperator[BinaryOperator["In"] = 19] = "In";
161
162
  })(BinaryOperator || (BinaryOperator = {}));
162
163
  function nullSafeIsEquivalent(base, other) {
163
164
  if (base == null || other == null) {
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.0.0-next.6
3
+ * @license Angular v20.0.0-next.8
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */
@@ -1,6 +1,6 @@
1
1
  'use strict';
2
2
  /**
3
- * @license Angular v20.0.0-next.6
3
+ * @license Angular v20.0.0-next.8
4
4
  * (c) 2010-2025 Google LLC. https://angular.io/
5
5
  * License: MIT
6
6
  */