@angular/core 22.0.0-next.6 → 22.0.0-next.7

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 (63) hide show
  1. package/fesm2022/_attribute-chunk.mjs +1 -1
  2. package/fesm2022/_debug_node-chunk.mjs +98 -60
  3. package/fesm2022/_debug_node-chunk.mjs.map +1 -1
  4. package/fesm2022/_effect-chunk.mjs +1 -1
  5. package/fesm2022/_not_found-chunk.mjs +1 -1
  6. package/fesm2022/_pending_tasks-chunk.mjs +2 -2
  7. package/fesm2022/_pending_tasks-chunk.mjs.map +1 -1
  8. package/fesm2022/_resource-chunk.mjs +1 -1
  9. package/fesm2022/_untracked-chunk.mjs +1 -1
  10. package/fesm2022/_weak_ref-chunk.mjs +1 -1
  11. package/fesm2022/core.mjs +2 -2
  12. package/fesm2022/primitives-di.mjs +1 -1
  13. package/fesm2022/primitives-event-dispatch.mjs +1 -5
  14. package/fesm2022/primitives-event-dispatch.mjs.map +1 -1
  15. package/fesm2022/primitives-signals.mjs +1 -1
  16. package/fesm2022/rxjs-interop.mjs +1 -1
  17. package/fesm2022/testing.mjs +1 -1
  18. package/package.json +2 -2
  19. package/schematics/bundles/apply_import_manager-CxA_YYgB.cjs +1 -1
  20. package/schematics/bundles/can-match-snapshot-required.cjs +104 -0
  21. package/schematics/bundles/change-detection-eager.cjs +1 -1
  22. package/schematics/bundles/cleanup-unused-imports.cjs +1 -1
  23. package/schematics/bundles/common-to-standalone-migration.cjs +1 -1
  24. package/schematics/bundles/compiler_host-CY14HvaP.cjs +1 -1
  25. package/schematics/bundles/control-flow-migration.cjs +1 -1
  26. package/schematics/bundles/http-xhr-backend.cjs +1 -1
  27. package/schematics/bundles/imports-CKV-ITqD.cjs +1 -1
  28. package/schematics/bundles/{index-BtLcQH8g.cjs → index-DADA7AvC.cjs} +7 -3
  29. package/schematics/bundles/inject-migration.cjs +1 -1
  30. package/schematics/bundles/leading_space-BTPRV0wu.cjs +1 -1
  31. package/schematics/bundles/{migrate_ts_type_references-Dp33iyGx.cjs → migrate_ts_type_references-B9LlDDUg.cjs} +2 -2
  32. package/schematics/bundles/ng_component_template-DPAF1aEA.cjs +1 -1
  33. package/schematics/bundles/ng_decorators-IVztR9rk.cjs +1 -1
  34. package/schematics/bundles/ngclass-to-class-migration.cjs +1 -1
  35. package/schematics/bundles/ngstyle-to-style-migration.cjs +1 -1
  36. package/schematics/bundles/nodes-ZSQ7WZRB.cjs +1 -1
  37. package/schematics/bundles/output-migration.cjs +2 -2
  38. package/schematics/bundles/parse_html-C8eKA9px.cjs +1 -1
  39. package/schematics/bundles/project_paths-D2V-Uh2L.cjs +1 -1
  40. package/schematics/bundles/project_tsconfig_paths-DkkMibv-.cjs +1 -1
  41. package/schematics/bundles/property_name-BCpALNpZ.cjs +1 -1
  42. package/schematics/bundles/route-lazy-loading.cjs +1 -1
  43. package/schematics/bundles/router-testing-module-migration.cjs +1 -1
  44. package/schematics/bundles/self-closing-tags-migration.cjs +1 -1
  45. package/schematics/bundles/signal-input-migration.cjs +3 -3
  46. package/schematics/bundles/signal-queries-migration.cjs +3 -3
  47. package/schematics/bundles/signals.cjs +3 -3
  48. package/schematics/bundles/standalone-migration.cjs +29 -17
  49. package/schematics/bundles/strict-templates.cjs +1 -1
  50. package/schematics/migrations.json +5 -0
  51. package/types/_api-chunk.d.ts +1 -1
  52. package/types/_chrome_dev_tools_performance-chunk.d.ts +1 -1
  53. package/types/_debug_node-chunk.d.ts +8 -54
  54. package/types/_effect-chunk.d.ts +1 -1
  55. package/types/_event_dispatcher-chunk.d.ts +1 -1
  56. package/types/_formatter-chunk.d.ts +1 -1
  57. package/types/_weak_ref-chunk.d.ts +1 -1
  58. package/types/core.d.ts +2 -23
  59. package/types/primitives-di.d.ts +1 -1
  60. package/types/primitives-event-dispatch.d.ts +1 -1
  61. package/types/primitives-signals.d.ts +1 -1
  62. package/types/rxjs-interop.d.ts +1 -1
  63. package/types/testing.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v22.0.0-next.6
2
+ * @license Angular v22.0.0-next.7
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v22.0.0-next.6
2
+ * @license Angular v22.0.0-next.7
3
3
  * (c) 2010-2026 Google LLC. https://angular.dev/
4
4
  * License: MIT
5
5
  */
@@ -8946,7 +8946,7 @@ class ComponentFactory extends ComponentFactory$1 {
8946
8946
  }
8947
8947
  }
8948
8948
  function createRootTView(rootSelectorOrNode, componentDef, componentBindings, directives) {
8949
- const tAttributes = rootSelectorOrNode ? ['ng-version', '22.0.0-next.6'] : extractAttrsAndClassesFromSelector(componentDef.selectors[0]);
8949
+ const tAttributes = rootSelectorOrNode ? ['ng-version', '22.0.0-next.7'] : extractAttrsAndClassesFromSelector(componentDef.selectors[0]);
8950
8950
  let creationBindings = null;
8951
8951
  let updateBindings = null;
8952
8952
  let varsToAllocate = 0;
@@ -9137,34 +9137,26 @@ class R3ViewContainerRef extends ViewContainerRef {
9137
9137
  this.insertImpl(viewRef, index, shouldAddViewToDom(this._hostTNode, dehydratedView));
9138
9138
  return viewRef;
9139
9139
  }
9140
- createComponent(componentFactoryOrType, indexOrOptions, injector, projectableNodes, environmentInjector, directives, bindings) {
9141
- const isComponentFactory = componentFactoryOrType && !isType(componentFactoryOrType);
9140
+ createComponent(componentType, opts, injector, projectableNodes, environmentInjector, directives, bindings) {
9142
9141
  let index;
9143
- if (isComponentFactory) {
9144
- if (ngDevMode) {
9145
- assertEqual(typeof indexOrOptions !== 'object', true, 'It looks like Component factory was provided as the first argument ' + 'and an options object as the second argument. This combination of arguments ' + 'is incompatible. You can either change the first argument to provide Component ' + 'type or change the second argument to be a number (representing an index at ' + "which to insert the new component's host view into this container)");
9146
- }
9147
- index = indexOrOptions;
9148
- } else {
9149
- if (ngDevMode) {
9150
- assertDefined(getComponentDef(componentFactoryOrType), `Provided Component class doesn't contain Component definition. ` + `Please check whether provided class has @Component decorator.`);
9151
- assertEqual(typeof indexOrOptions !== 'number', true, 'It looks like Component type was provided as the first argument ' + "and a number (representing an index at which to insert the new component's " + 'host view into this container as the second argument. This combination of arguments ' + 'is incompatible. Please use an object as the second argument instead.');
9152
- }
9153
- const options = indexOrOptions || {};
9154
- if (ngDevMode && options.environmentInjector && options.ngModuleRef) {
9155
- throwError(`Cannot pass both environmentInjector and ngModuleRef options to createComponent().`);
9156
- }
9157
- index = options.index;
9158
- injector = options.injector;
9159
- projectableNodes = options.projectableNodes;
9160
- environmentInjector = options.environmentInjector || options.ngModuleRef;
9161
- directives = options.directives;
9162
- bindings = options.bindings;
9163
- }
9164
- const componentFactory = isComponentFactory ? componentFactoryOrType : new ComponentFactory(getComponentDef(componentFactoryOrType));
9142
+ if (ngDevMode) {
9143
+ assertDefined(getComponentDef(componentType), `Provided Component class doesn't contain Component definition. ` + `Please check whether provided class has @Component decorator.`);
9144
+ assertEqual(typeof opts !== 'number', true, 'It looks like Component type was provided as the first argument ' + "and a number (representing an index at which to insert the new component's " + 'host view into this container as the second argument. This combination of arguments ' + 'is incompatible. Please use an object as the second argument instead.');
9145
+ }
9146
+ const options = opts || {};
9147
+ if (ngDevMode && options.environmentInjector && options.ngModuleRef) {
9148
+ throwError(`Cannot pass both environmentInjector and ngModuleRef options to createComponent().`);
9149
+ }
9150
+ index = options.index;
9151
+ injector = options.injector;
9152
+ projectableNodes = options.projectableNodes;
9153
+ environmentInjector = options.environmentInjector || options.ngModuleRef;
9154
+ directives = options.directives;
9155
+ bindings = options.bindings;
9156
+ const componentFactory = new ComponentFactory(getComponentDef(componentType));
9165
9157
  const contextInjector = injector || this.parentInjector;
9166
9158
  if (!environmentInjector && componentFactory.ngModule == null) {
9167
- const _injector = isComponentFactory ? contextInjector : this.parentInjector;
9159
+ const _injector = this.parentInjector;
9168
9160
  const result = _injector.get(EnvironmentInjector, null);
9169
9161
  if (result) {
9170
9162
  environmentInjector = result;
@@ -9293,7 +9285,10 @@ function populateDehydratedViewsInLContainerImpl(lContainer, tNode, hostLView) {
9293
9285
  }
9294
9286
  const currentRNode = getSegmentHead(hydrationInfo, noOffsetIndex);
9295
9287
  const serializedViews = hydrationInfo.data[CONTAINERS]?.[noOffsetIndex];
9296
- ngDevMode && assertDefined(serializedViews, 'Unexpected state: no hydration info available for a given TNode, ' + 'which represents a view container.');
9288
+ if (serializedViews === undefined) {
9289
+ ngDevMode && console.warn('Unexpected state: no hydration info available for a given TNode, ' + 'which represents a view container.');
9290
+ return false;
9291
+ }
9297
9292
  const [commentNode, dehydratedViews] = locateDehydratedViewsInContainer(currentRNode, serializedViews);
9298
9293
  if (ngDevMode) {
9299
9294
  validateMatchingNode(commentNode, Node.COMMENT_NODE, null, hostLView, tNode, true);
@@ -10306,7 +10301,7 @@ function resolveHostDirectives(matches) {
10306
10301
  const start = allDirectiveDefs.length;
10307
10302
  hostDirectiveDefs ??= new Map();
10308
10303
  hostDirectiveRanges ??= new Map();
10309
- findHostDirectiveDefs(def, allDirectiveDefs, hostDirectiveDefs);
10304
+ findHostDirectiveDefs(def, allDirectiveDefs, hostDirectiveDefs, matches);
10310
10305
  hostDirectiveRanges.set(def, [start, allDirectiveDefs.length - 1]);
10311
10306
  }
10312
10307
  if (i === 0 && isComponentDef(def)) {
@@ -10317,37 +10312,59 @@ function resolveHostDirectives(matches) {
10317
10312
  for (let i = hasComponent ? 1 : 0; i < matches.length; i++) {
10318
10313
  allDirectiveDefs.push(matches[i]);
10319
10314
  }
10315
+ if (hostDirectiveDefs !== null) {
10316
+ hostDirectiveDefs.forEach((def, hostDirectiveDef) => {
10317
+ patchDeclaredInputs(hostDirectiveDef.declaredInputs, def.inputs);
10318
+ });
10319
+ }
10320
10320
  return [allDirectiveDefs, hostDirectiveDefs, hostDirectiveRanges];
10321
10321
  }
10322
- function findHostDirectiveDefs(currentDef, matchedDefs, hostDirectiveDefs) {
10322
+ function findHostDirectiveDefs(currentDef, matchedDefs, hostDirectiveDefs, templateMatches) {
10323
10323
  if (currentDef.hostDirectives !== null) {
10324
10324
  for (const configOrFn of currentDef.hostDirectives) {
10325
10325
  if (typeof configOrFn === 'function') {
10326
10326
  const resolved = configOrFn();
10327
10327
  for (const config of resolved) {
10328
- trackHostDirectiveDef(createHostDirectiveDef(config), matchedDefs, hostDirectiveDefs);
10328
+ trackHostDirectiveDef(createHostDirectiveDef(config), matchedDefs, hostDirectiveDefs, templateMatches);
10329
10329
  }
10330
10330
  } else {
10331
- trackHostDirectiveDef(configOrFn, matchedDefs, hostDirectiveDefs);
10331
+ trackHostDirectiveDef(configOrFn, matchedDefs, hostDirectiveDefs, templateMatches);
10332
10332
  }
10333
10333
  }
10334
10334
  }
10335
10335
  }
10336
- function trackHostDirectiveDef(def, matchedDefs, hostDirectiveDefs) {
10336
+ function trackHostDirectiveDef(def, finalMatches, hostDirectiveDefs, templateMatches) {
10337
10337
  const hostDirectiveDef = getDirectiveDef(def.directive);
10338
10338
  if (typeof ngDevMode === 'undefined' || ngDevMode) {
10339
10339
  validateHostDirective(def, hostDirectiveDef);
10340
10340
  }
10341
- patchDeclaredInputs(hostDirectiveDef.declaredInputs, def.inputs);
10342
- findHostDirectiveDefs(hostDirectiveDef, matchedDefs, hostDirectiveDefs);
10343
- hostDirectiveDefs.set(hostDirectiveDef, def);
10344
- matchedDefs.push(hostDirectiveDef);
10341
+ findHostDirectiveDefs(hostDirectiveDef, finalMatches, hostDirectiveDefs, templateMatches);
10342
+ if (hostDirectiveDefs.has(hostDirectiveDef)) {
10343
+ const existing = hostDirectiveDefs.get(hostDirectiveDef);
10344
+ mergeBindingMaps(existing, def.inputs, 'input');
10345
+ mergeBindingMaps(existing, def.outputs, 'output');
10346
+ } else if (!templateMatches.includes(hostDirectiveDef)) {
10347
+ hostDirectiveDefs.set(hostDirectiveDef, def);
10348
+ finalMatches.push(hostDirectiveDef);
10349
+ }
10350
+ }
10351
+ function mergeBindingMaps(existingDef, newMap, kind) {
10352
+ const targetMap = kind === 'input' ? existingDef.inputs : existingDef.outputs;
10353
+ Object.keys(newMap).forEach(publicName => {
10354
+ const alias = newMap[publicName];
10355
+ if (!targetMap.hasOwnProperty(publicName) || targetMap[publicName] === alias) {
10356
+ targetMap[publicName] = alias;
10357
+ } else if (typeof ngDevMode === 'undefined' || ngDevMode) {
10358
+ const message = `${kind === 'input' ? 'Input' : 'Output'} "${publicName}" from ${existingDef.directive.name} ` + `is exposed under the following conflicting names: "${targetMap[publicName]}" and "${alias}". ` + `An ${kind} can only be exposed under a single name.`;
10359
+ throw new RuntimeError(312, message);
10360
+ }
10361
+ });
10345
10362
  }
10346
10363
  function createHostDirectiveDef(config) {
10347
10364
  return typeof config === 'function' ? {
10348
10365
  directive: resolveForwardRef(config),
10349
- inputs: EMPTY_OBJ,
10350
- outputs: EMPTY_OBJ
10366
+ inputs: {},
10367
+ outputs: {}
10351
10368
  } : {
10352
10369
  directive: resolveForwardRef(config.directive),
10353
10370
  inputs: bindingArrayToMap(config.inputs),
@@ -10355,12 +10372,11 @@ function createHostDirectiveDef(config) {
10355
10372
  };
10356
10373
  }
10357
10374
  function bindingArrayToMap(bindings) {
10358
- if (bindings === undefined || bindings.length === 0) {
10359
- return EMPTY_OBJ;
10360
- }
10361
10375
  const result = {};
10362
- for (let i = 0; i < bindings.length; i += 2) {
10363
- result[bindings[i]] = bindings[i + 1];
10376
+ if (bindings !== undefined && bindings.length > 0) {
10377
+ for (let i = 0; i < bindings.length; i += 2) {
10378
+ result[bindings[i]] = bindings[i + 1];
10379
+ }
10364
10380
  }
10365
10381
  return result;
10366
10382
  }
@@ -12178,35 +12194,34 @@ class ApplicationRef {
12178
12194
  get injector() {
12179
12195
  return this._injector;
12180
12196
  }
12181
- bootstrap(componentOrFactory, rootSelectorOrNode) {
12182
- return this.bootstrapImpl(componentOrFactory, rootSelectorOrNode);
12197
+ bootstrap(component, rootSelectorOrNode) {
12198
+ return this.bootstrapImpl(component, rootSelectorOrNode);
12183
12199
  }
12184
- bootstrapImpl(componentOrFactory, rootSelectorOrNode, injector = Injector.NULL) {
12200
+ bootstrapImpl(component, hostElementOrOptions, injector = Injector.NULL) {
12185
12201
  const ngZone = this._injector.get(NgZone);
12186
12202
  return ngZone.run(() => {
12187
12203
  profiler(ProfilerEvent.BootstrapComponentStart);
12188
12204
  (typeof ngDevMode === 'undefined' || ngDevMode) && warnIfDestroyed(this._destroyed);
12189
- const isComponentFactory = componentOrFactory instanceof ComponentFactory$1;
12190
12205
  const initStatus = this._injector.get(ApplicationInitStatus);
12191
12206
  if (!initStatus.done) {
12192
12207
  let errorMessage = '';
12193
12208
  if (typeof ngDevMode === 'undefined' || ngDevMode) {
12194
- const standalone = !isComponentFactory && isStandalone(componentOrFactory);
12209
+ const standalone = isStandalone(component);
12195
12210
  errorMessage = 'Cannot bootstrap as there are still asynchronous initializers running.' + (standalone ? '' : ' Bootstrap components in the `ngDoBootstrap` method of the root module.');
12196
12211
  }
12197
12212
  throw new RuntimeError(405, errorMessage);
12198
12213
  }
12199
- let componentFactory;
12200
- if (isComponentFactory) {
12201
- componentFactory = componentOrFactory;
12202
- } else {
12203
- const resolver = this._injector.get(ComponentFactoryResolver$1);
12204
- componentFactory = resolver.resolveComponentFactory(componentOrFactory);
12205
- }
12214
+ const resolver = this._injector.get(ComponentFactoryResolver$1);
12215
+ const componentFactory = resolver.resolveComponentFactory(component);
12206
12216
  this.componentTypes.push(componentFactory.componentType);
12207
12217
  const ngModule = isBoundToModule(componentFactory) ? undefined : this._injector.get(NgModuleRef$1);
12208
- const selectorOrNode = rootSelectorOrNode || componentFactory.selector;
12209
- const compRef = componentFactory.create(injector, [], selectorOrNode, ngModule);
12218
+ const {
12219
+ hostElement,
12220
+ directives,
12221
+ bindings
12222
+ } = normalizeBootstrapOptions(hostElementOrOptions);
12223
+ const selectorOrNode = hostElement || componentFactory.selector;
12224
+ const compRef = componentFactory.create(injector, [], selectorOrNode, ngModule, directives, bindings);
12210
12225
  const nativeElement = compRef.location.nativeElement;
12211
12226
  const testability = compRef.injector.get(TESTABILITY, null);
12212
12227
  testability?.registerApplication(nativeElement);
@@ -12398,6 +12413,14 @@ class ApplicationRef {
12398
12413
  }]
12399
12414
  }], () => [], null);
12400
12415
  })();
12416
+ function normalizeBootstrapOptions(hostElementOrOptions) {
12417
+ if (hostElementOrOptions === undefined || typeof hostElementOrOptions === 'string' || hostElementOrOptions instanceof Element) {
12418
+ return {
12419
+ hostElement: hostElementOrOptions
12420
+ };
12421
+ }
12422
+ return hostElementOrOptions;
12423
+ }
12401
12424
  function warnIfDestroyed(destroyed) {
12402
12425
  if (destroyed) {
12403
12426
  console.warn(formatRuntimeError(406, 'This instance of the `ApplicationRef` has already been destroyed.'));
@@ -12909,9 +12932,11 @@ function triggerResourceLoading(tDetails, lView, tNode) {
12909
12932
  }
12910
12933
  tDetails.loadingPromise = Promise.allSettled(dependenciesFn()).then(results => {
12911
12934
  let failed = false;
12935
+ let failedReason = null;
12912
12936
  const directiveDefs = [];
12913
12937
  const pipeDefs = [];
12914
- for (const result of results) {
12938
+ for (let i = 0; i < results.length; i++) {
12939
+ const result = results[i];
12915
12940
  if (result.status === 'fulfilled') {
12916
12941
  const dependency = result.value;
12917
12942
  const directiveDef = getComponentDef(dependency) || getDirectiveDef(dependency);
@@ -12925,6 +12950,7 @@ function triggerResourceLoading(tDetails, lView, tNode) {
12925
12950
  }
12926
12951
  } else {
12927
12952
  failed = true;
12953
+ failedReason = result.reason instanceof Error ? result.reason : new Error(String(result.reason));
12928
12954
  break;
12929
12955
  }
12930
12956
  }
@@ -12932,7 +12958,19 @@ function triggerResourceLoading(tDetails, lView, tNode) {
12932
12958
  tDetails.loadingState = DeferDependenciesLoadingState.FAILED;
12933
12959
  if (tDetails.errorTmplIndex === null) {
12934
12960
  const templateLocation = ngDevMode ? getTemplateLocationDetails(lView) : '';
12935
- const error = new RuntimeError(-750, ngDevMode && 'Loading dependencies for `@defer` block failed, ' + `but no \`@error\` block was configured${templateLocation}. ` + 'Consider using the `@error` block to render an error state.');
12961
+ let errorMsg = '';
12962
+ if (ngDevMode) {
12963
+ errorMsg = 'Loading dependencies for `@defer` block failed, ' + `but no \`@error\` block was configured${templateLocation}. ` + 'Consider using the `@error` block to render an error state.';
12964
+ const depsFn = tDetails.dependencyResolverFn;
12965
+ const errorReason = failedReason?.message;
12966
+ if (depsFn) {
12967
+ errorMsg += `\n\nAngular tried to invoke the following dependency function (compiler-generated):\n` + `\`\`\`\n${depsFn.toString()}\n\`\`\``;
12968
+ }
12969
+ if (errorReason) {
12970
+ errorMsg += depsFn ? `\n\nbut it resulted in the following error:\n\n${errorReason}` : `\n\nThe loading resulted in the following error:\n\n${errorReason}`;
12971
+ }
12972
+ }
12973
+ const error = new RuntimeError(-750, errorMsg);
12936
12974
  handleUncaughtError(lView, error);
12937
12975
  }
12938
12976
  } else {