@angular/core 19.2.8 → 19.2.10

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 (46) hide show
  1. package/event_dispatcher.d-DlbccpYq.d.ts +1 -1
  2. package/fesm2022/core.mjs +75 -52
  3. package/fesm2022/core.mjs.map +1 -1
  4. package/fesm2022/primitives/di.mjs +1 -1
  5. package/fesm2022/primitives/event-dispatch.mjs +2 -2
  6. package/fesm2022/primitives/event-dispatch.mjs.map +1 -1
  7. package/fesm2022/primitives/signals.mjs +1 -1
  8. package/fesm2022/rxjs-interop.mjs +1 -1
  9. package/fesm2022/testing.mjs +30 -11
  10. package/fesm2022/testing.mjs.map +1 -1
  11. package/fesm2022/untracked-BKcld_ew.mjs +1 -1
  12. package/index.d.ts +14 -5
  13. package/navigation_types.d-fAxd92YV.d.ts +1 -1
  14. package/package.json +1 -1
  15. package/primitives/di/index.d.ts +1 -1
  16. package/primitives/event-dispatch/index.d.ts +1 -1
  17. package/primitives/signals/index.d.ts +1 -1
  18. package/rxjs-interop/index.d.ts +1 -1
  19. package/schematics/bundles/{apply_import_manager-COqnCltX.js → apply_import_manager-DdHXpkne.js} +3 -3
  20. package/schematics/bundles/{checker-BNmiXJIJ.js → checker-CGGdizaF.js} +12 -14
  21. package/schematics/bundles/cleanup-unused-imports.js +5 -5
  22. package/schematics/bundles/{compiler_host-BafHjBMK.js → compiler_host-BmQrIxJT.js} +2 -2
  23. package/schematics/bundles/control-flow-migration.js +3 -3
  24. package/schematics/bundles/explicit-standalone-flag.js +3 -3
  25. package/schematics/bundles/imports-CIX-JgAN.js +1 -1
  26. package/schematics/bundles/{index-CAJ-Rm56.js → index-BF06LaCS.js} +12 -12
  27. package/schematics/bundles/{index-rvZ5aROS.js → index-DGcgCgNa.js} +4 -4
  28. package/schematics/bundles/inject-migration.js +3 -3
  29. package/schematics/bundles/leading_space-D9nQ8UQC.js +1 -1
  30. package/schematics/bundles/{migrate_ts_type_references-BIV-FPWl.js → migrate_ts_type_references-CE_V0IM9.js} +5 -5
  31. package/schematics/bundles/ng_decorators-DznZ5jMl.js +1 -1
  32. package/schematics/bundles/nodes-B16H9JUd.js +1 -1
  33. package/schematics/bundles/output-migration.js +6 -6
  34. package/schematics/bundles/pending-tasks.js +3 -3
  35. package/schematics/bundles/{project_paths-A9I0g_ID.js → project_paths-CmS2U6KE.js} +3 -3
  36. package/schematics/bundles/project_tsconfig_paths-CDVxT6Ov.js +1 -1
  37. package/schematics/bundles/property_name-BBwFuqMe.js +1 -1
  38. package/schematics/bundles/provide-initializer.js +3 -3
  39. package/schematics/bundles/route-lazy-loading.js +3 -3
  40. package/schematics/bundles/self-closing-tags-migration.js +4 -4
  41. package/schematics/bundles/signal-input-migration.js +7 -7
  42. package/schematics/bundles/signal-queries-migration.js +7 -7
  43. package/schematics/bundles/signals.js +7 -7
  44. package/schematics/bundles/standalone-migration.js +4 -4
  45. package/testing/index.d.ts +5 -3
  46. package/weak_ref.d-DWHPG08n.d.ts +1 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.2.8
2
+ * @license Angular v19.2.10
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
package/fesm2022/core.mjs CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v19.2.8
2
+ * @license Angular v19.2.10
3
3
  * (c) 2010-2025 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2140,7 +2140,7 @@ class R3Injector extends EnvironmentInjector {
2140
2140
  }
2141
2141
  // If a record was found, get the instance for it and return it.
2142
2142
  if (record != null /* NOT null || undefined */) {
2143
- return this.hydrate(token, record);
2143
+ return this.hydrate(token, record, flags);
2144
2144
  }
2145
2145
  }
2146
2146
  // Select the next injector based on the Self flag - if self is set, the next injector is
@@ -2263,7 +2263,7 @@ class R3Injector extends EnvironmentInjector {
2263
2263
  }
2264
2264
  this.records.set(token, record);
2265
2265
  }
2266
- hydrate(token, record) {
2266
+ hydrate(token, record, flags) {
2267
2267
  const prevConsumer = setActiveConsumer(null);
2268
2268
  try {
2269
2269
  if (record.value === CIRCULAR) {
@@ -2273,12 +2273,12 @@ class R3Injector extends EnvironmentInjector {
2273
2273
  record.value = CIRCULAR;
2274
2274
  if (ngDevMode) {
2275
2275
  runInInjectorProfilerContext(this, token, () => {
2276
- record.value = record.factory();
2276
+ record.value = record.factory(undefined, flags);
2277
2277
  emitInstanceCreatedByInjectorEvent(record.value);
2278
2278
  });
2279
2279
  }
2280
2280
  else {
2281
- record.value = record.factory();
2281
+ record.value = record.factory(undefined, flags);
2282
2282
  }
2283
2283
  }
2284
2284
  if (typeof record.value === 'object' && record.value && hasOnDestroy(record.value)) {
@@ -2379,7 +2379,7 @@ function providerToFactory(provider, ngModuleType, providers) {
2379
2379
  factory = () => provider.useFactory(...injectArgs(provider.deps || []));
2380
2380
  }
2381
2381
  else if (isExistingProvider(provider)) {
2382
- factory = () => ɵɵinject(resolveForwardRef(provider.useExisting));
2382
+ factory = (_, flags) => ɵɵinject(resolveForwardRef(provider.useExisting), flags !== undefined && flags & InjectFlags.Optional ? InjectFlags.Optional : undefined);
2383
2383
  }
2384
2384
  else {
2385
2385
  const classRef = resolveForwardRef(provider &&
@@ -5245,7 +5245,7 @@ function searchTokensOnInjector(injectorIndex, lView, token, previousTView, flag
5245
5245
  const isHostSpecialCase = flags & InjectFlags.Host && hostTElementNode === tNode;
5246
5246
  const injectableIdx = locateDirectiveOrProvider(tNode, currentTView, token, canAccessViewProviders, isHostSpecialCase);
5247
5247
  if (injectableIdx !== null) {
5248
- return getNodeInjectable(lView, currentTView, injectableIdx, tNode);
5248
+ return getNodeInjectable(lView, currentTView, injectableIdx, tNode, flags);
5249
5249
  }
5250
5250
  else {
5251
5251
  return NOT_FOUND;
@@ -5295,7 +5295,7 @@ function locateDirectiveOrProvider(tNode, tView, token, canAccessViewProviders,
5295
5295
  * cached `injectable`. Otherwise if it detects that the value is still a factory it
5296
5296
  * instantiates the `injectable` and caches the value.
5297
5297
  */
5298
- function getNodeInjectable(lView, tView, index, tNode) {
5298
+ function getNodeInjectable(lView, tView, index, tNode, flags) {
5299
5299
  let value = lView[index];
5300
5300
  const tData = tView.data;
5301
5301
  if (value instanceof NodeInjectorFactory) {
@@ -5322,7 +5322,7 @@ function getNodeInjectable(lView, tView, index, tNode) {
5322
5322
  ngDevMode &&
5323
5323
  assertEqual(success, true, "Because flags do not contain `SkipSelf' we expect this to always succeed.");
5324
5324
  try {
5325
- value = lView[index] = factory.factory(undefined, tData, lView, tNode);
5325
+ value = lView[index] = factory.factory(undefined, flags, tData, lView, tNode);
5326
5326
  ngDevMode && emitInstanceCreatedByInjectorEvent(value);
5327
5327
  // This code path is hit for both directives and providers.
5328
5328
  // For perf reasons, we want to avoid searching for hooks on providers.
@@ -5902,8 +5902,26 @@ class NodeInjectorDestroyRef extends DestroyRef {
5902
5902
  this._lView = _lView;
5903
5903
  }
5904
5904
  onDestroy(callback) {
5905
- storeLViewOnDestroy(this._lView, callback);
5906
- return () => removeLViewOnDestroy(this._lView, callback);
5905
+ const lView = this._lView;
5906
+ // Checking if `lView` is already destroyed before storing the `callback` enhances
5907
+ // safety and integrity for applications.
5908
+ // If `lView` is destroyed, we call the `callback` immediately to ensure that
5909
+ // any necessary cleanup is handled gracefully.
5910
+ // With this approach, we're providing better reliability in managing resources.
5911
+ // One of the use cases is `takeUntilDestroyed`, which aims to replace `takeUntil`
5912
+ // in existing applications. While `takeUntil` can be safely called once the view
5913
+ // is destroyed — resulting in no errors and finalizing the subscription depending
5914
+ // on whether a subject or replay subject is used, replacing it with
5915
+ // `takeUntilDestroyed` introduces a breaking change, as it throws an error if
5916
+ // the `lView` is destroyed (https://github.com/angular/angular/issues/54527).
5917
+ if (isDestroyed(lView)) {
5918
+ callback();
5919
+ // We return a "noop" callback, which, when executed, does nothing because
5920
+ // we haven't stored anything on the `lView`, and thus there's nothing to remove.
5921
+ return () => { };
5922
+ }
5923
+ storeLViewOnDestroy(lView, callback);
5924
+ return () => removeLViewOnDestroy(lView, callback);
5907
5925
  }
5908
5926
  }
5909
5927
  function injectDestroyRef() {
@@ -6097,9 +6115,13 @@ class EventEmitter_ extends Subject {
6097
6115
  return (value) => {
6098
6116
  const taskId = this.pendingTasks?.add();
6099
6117
  setTimeout(() => {
6100
- fn(value);
6101
- if (taskId !== undefined) {
6102
- this.pendingTasks?.remove(taskId);
6118
+ try {
6119
+ fn(value);
6120
+ }
6121
+ finally {
6122
+ if (taskId !== undefined) {
6123
+ this.pendingTasks?.remove(taskId);
6124
+ }
6103
6125
  }
6104
6126
  });
6105
6127
  };
@@ -6917,12 +6939,13 @@ function createElementRef(tNode, lView) {
6917
6939
  // and could do better codegen in the future.
6918
6940
  class ElementRef {
6919
6941
  /**
6920
- * <div class="callout is-critical">
6942
+ * <div class="docs-alert docs-alert-important">
6921
6943
  * <header>Use with caution</header>
6922
6944
  * <p>
6923
6945
  * Use this API as the last resort when direct access to DOM is needed. Use templating and
6924
- * data-binding provided by Angular instead. Alternatively you can take a look at
6925
- * {@link Renderer2} which provides an API that can be safely used.
6946
+ * data-binding provided by Angular instead. If used, it is recommended in combination with
6947
+ * {@link /best-practices/security#direct-use-of-the-dom-apis-and-explicit-sanitization-calls DomSanitizer}
6948
+ * for maxiumum security;
6926
6949
  * </p>
6927
6950
  * </div>
6928
6951
  */
@@ -16849,6 +16872,14 @@ class RendererFactory2 {
16849
16872
  * renders a template into DOM. You can use custom rendering to intercept
16850
16873
  * rendering calls, or to render to something other than DOM.
16851
16874
  *
16875
+ * <div class="docs-alert docs-alert-important">
16876
+ * <p>
16877
+ * Please be aware that usage of `Renderer2`, in context of accessing DOM elements, provides no
16878
+ * extra security which makes it equivalent to
16879
+ * {@link /best-practices/security#direct-use-of-the-dom-apis-and-explicit-sanitization-calls Security vulnerabilities}.
16880
+ * </p>
16881
+ * </div>
16882
+ *
16852
16883
  * Create your custom renderer using `RendererFactory2`.
16853
16884
  *
16854
16885
  * Use a custom renderer to bypass Angular's templating and
@@ -17913,7 +17944,7 @@ class ComponentFactory extends ComponentFactory$1 {
17913
17944
  const cmpDef = this.componentDef;
17914
17945
  ngDevMode && verifyNotAnOrphanComponent(cmpDef);
17915
17946
  const tAttributes = rootSelectorOrNode
17916
- ? ['ng-version', '19.2.8']
17947
+ ? ['ng-version', '19.2.10']
17917
17948
  : // Extract attributes and classes from the first selector only to match VE behavior.
17918
17949
  extractAttrsAndClassesFromSelector(this.componentDef.selectors[0]);
17919
17950
  // Create the root view. Uses empty TView and ContentTemplate.
@@ -23881,8 +23912,7 @@ function triggerResourceLoading(tDetails, lView, tNode) {
23881
23912
  }
23882
23913
  }
23883
23914
  // Indicate that an application is not stable and has a pending task.
23884
- const pendingTasks = injector.get(PendingTasksInternal);
23885
- const taskId = pendingTasks.add();
23915
+ const removeTask = injector.get(PendingTasks).add();
23886
23916
  // The `dependenciesFn` might be `null` when all dependencies within
23887
23917
  // a given defer block were eagerly referenced elsewhere in a file,
23888
23918
  // thus no dynamic `import()`s were produced.
@@ -23890,7 +23920,7 @@ function triggerResourceLoading(tDetails, lView, tNode) {
23890
23920
  tDetails.loadingPromise = Promise.resolve().then(() => {
23891
23921
  tDetails.loadingPromise = null;
23892
23922
  tDetails.loadingState = DeferDependenciesLoadingState.COMPLETE;
23893
- pendingTasks.remove(taskId);
23923
+ removeTask();
23894
23924
  });
23895
23925
  return tDetails.loadingPromise;
23896
23926
  }
@@ -23918,10 +23948,6 @@ function triggerResourceLoading(tDetails, lView, tNode) {
23918
23948
  break;
23919
23949
  }
23920
23950
  }
23921
- // Loading is completed, we no longer need the loading Promise
23922
- // and a pending task should also be removed.
23923
- tDetails.loadingPromise = null;
23924
- pendingTasks.remove(taskId);
23925
23951
  if (failed) {
23926
23952
  tDetails.loadingState = DeferDependenciesLoadingState.FAILED;
23927
23953
  if (tDetails.errorTmplIndex === null) {
@@ -23950,7 +23976,12 @@ function triggerResourceLoading(tDetails, lView, tNode) {
23950
23976
  }
23951
23977
  }
23952
23978
  });
23953
- return tDetails.loadingPromise;
23979
+ return tDetails.loadingPromise.finally(() => {
23980
+ // Loading is completed, we no longer need the loading Promise
23981
+ // and a pending task should also be removed.
23982
+ tDetails.loadingPromise = null;
23983
+ removeTask();
23984
+ });
23954
23985
  }
23955
23986
  /**
23956
23987
  * Defines whether we should proceed with triggering a given defer block.
@@ -30108,15 +30139,12 @@ function isOutputSubscribable(value) {
30108
30139
  return (value != null && typeof value.subscribe === 'function');
30109
30140
  }
30110
30141
 
30111
- /**
30112
- * Contains a reference to a function that disables event replay feature
30113
- * for server-side rendered applications. This function is overridden with
30114
- * an actual implementation when the event replay feature is enabled via
30115
- * `withEventReplay()` call.
30116
- */
30117
- let stashEventListener = (el, eventName, listenerFn) => { };
30118
- function setStashFn(fn) {
30119
- stashEventListener = fn;
30142
+ const stashEventListeners = new Map();
30143
+ function setStashFn(appId, fn) {
30144
+ stashEventListeners.set(appId, fn);
30145
+ }
30146
+ function clearStashFn(appId) {
30147
+ stashEventListeners.delete(appId);
30120
30148
  }
30121
30149
  /**
30122
30150
  * Adds an event listener to the current node.
@@ -30255,7 +30283,9 @@ function listenerInternal(tView, lView, renderer, tNode, eventName, listenerFn,
30255
30283
  }
30256
30284
  else {
30257
30285
  listenerFn = wrapListener(tNode, lView, listenerFn);
30258
- stashEventListener(target, eventName, listenerFn);
30286
+ const appId = lView[INJECTOR].get(APP_ID);
30287
+ const stashEventListener = stashEventListeners.get(appId);
30288
+ stashEventListener?.(target, eventName, listenerFn);
30259
30289
  const cleanupFn = renderer.listen(target, eventName, listenerFn);
30260
30290
  ngDevMode && ngDevMode.rendererAddEventListener++;
30261
30291
  lCleanup.push(listenerFn, cleanupFn);
@@ -32392,7 +32422,7 @@ function indexOf(item, arr, begin, end) {
32392
32422
  /**
32393
32423
  * Use this with `multi` `providers`.
32394
32424
  */
32395
- function multiProvidersFactoryResolver(_, tData, lData, tNode) {
32425
+ function multiProvidersFactoryResolver(_, flags, tData, lData, tNode) {
32396
32426
  return multiResolve(this.multi, []);
32397
32427
  }
32398
32428
  /**
@@ -32400,7 +32430,7 @@ function multiProvidersFactoryResolver(_, tData, lData, tNode) {
32400
32430
  *
32401
32431
  * This factory knows how to concatenate itself with the existing `multi` `providers`.
32402
32432
  */
32403
- function multiViewProvidersFactoryResolver(_, tData, lView, tNode) {
32433
+ function multiViewProvidersFactoryResolver(_, _flags, _tData, lView, tNode) {
32404
32434
  const factories = this.multi;
32405
32435
  let result;
32406
32436
  if (this.providerFactory) {
@@ -34653,7 +34683,7 @@ class Version {
34653
34683
  /**
34654
34684
  * @publicApi
34655
34685
  */
34656
- const VERSION = new Version('19.2.8');
34686
+ const VERSION = new Version('19.2.10');
34657
34687
 
34658
34688
  /**
34659
34689
  * Combination of NgModuleFactory and ComponentFactories.
@@ -38156,7 +38186,8 @@ function withEventReplay() {
38156
38186
  if (!appsWithEventReplay.has(appRef)) {
38157
38187
  const jsActionMap = inject(JSACTION_BLOCK_ELEMENT_MAP);
38158
38188
  if (shouldEnableEventReplay(injector)) {
38159
- setStashFn((rEl, eventName, listenerFn) => {
38189
+ const appId = injector.get(APP_ID);
38190
+ setStashFn(appId, (rEl, eventName, listenerFn) => {
38160
38191
  // If a user binds to a ng-container and uses a directive that binds using a host listener,
38161
38192
  // this element could be a comment node. So we need to ensure we have an actual element
38162
38193
  // node before stashing anything.
@@ -38172,7 +38203,6 @@ function withEventReplay() {
38172
38203
  }, {
38173
38204
  provide: APP_BOOTSTRAP_LISTENER,
38174
38205
  useFactory: () => {
38175
- const appId = inject(APP_ID);
38176
38206
  const appRef = inject(ApplicationRef);
38177
38207
  const { injector } = appRef;
38178
38208
  return () => {
@@ -38187,6 +38217,7 @@ function withEventReplay() {
38187
38217
  appsWithEventReplay.delete(appRef);
38188
38218
  // Ensure that we're always safe calling this in the browser.
38189
38219
  if (typeof ngServerMode !== 'undefined' && !ngServerMode) {
38220
+ const appId = injector.get(APP_ID);
38190
38221
  // `_ejsa` should be deleted when the app is destroyed, ensuring that
38191
38222
  // no elements are still captured in the global list and are not prevented
38192
38223
  // from being garbage collected.
@@ -38194,7 +38225,7 @@ function withEventReplay() {
38194
38225
  // Clean up the reference to the function set by the environment initializer,
38195
38226
  // as the function closure may capture injected elements and prevent them
38196
38227
  // from being properly garbage collected.
38197
- setStashFn(() => { });
38228
+ clearStashFn(appId);
38198
38229
  }
38199
38230
  });
38200
38231
  // Kick off event replay logic once hydration for the initial part
@@ -39587,14 +39618,6 @@ function effect(effectFn, options) {
39587
39618
  }
39588
39619
  return effectRef;
39589
39620
  }
39590
- /**
39591
- * Not public API, which guarantees `EffectScheduler` only ever comes from the application root
39592
- * injector.
39593
- */
39594
- /* @__PURE__ */ new InjectionToken('', {
39595
- providedIn: 'root',
39596
- factory: () => inject(EffectScheduler),
39597
- });
39598
39621
  const BASE_EFFECT_NODE =
39599
39622
  /* @__PURE__ */ (() => ({
39600
39623
  ...REACTIVE_NODE,
@@ -40198,8 +40221,8 @@ function ɵɵngDeclarePipe(decl) {
40198
40221
  return compiler.compilePipeDeclaration(angularCoreEnv, `ng:///${decl.type.name}/ɵpipe.js`, decl);
40199
40222
  }
40200
40223
 
40201
- const NOT_SET = Symbol('NOT_SET');
40202
- const EMPTY_CLEANUP_SET = new Set();
40224
+ const NOT_SET = /* @__PURE__ */ Symbol('NOT_SET');
40225
+ const EMPTY_CLEANUP_SET = /* @__PURE__ */ new Set();
40203
40226
  const AFTER_RENDER_PHASE_EFFECT_NODE = /* @__PURE__ */ (() => ({
40204
40227
  ...SIGNAL_NODE,
40205
40228
  consumerIsAlwaysLive: true,