@angular/core 18.1.2 → 18.1.3

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 (41) hide show
  1. package/esm2022/src/application/application_init.mjs +2 -2
  2. package/esm2022/src/application/application_module.mjs +2 -2
  3. package/esm2022/src/application/application_ref.mjs +2 -2
  4. package/esm2022/src/change_detection/scheduling/ng_zone_scheduling.mjs +3 -10
  5. package/esm2022/src/change_detection/scheduling/zoneless_scheduling_impl.mjs +2 -2
  6. package/esm2022/src/console.mjs +2 -2
  7. package/esm2022/src/core_private_export.mjs +2 -1
  8. package/esm2022/src/error_handler.mjs +4 -2
  9. package/esm2022/src/event_delegation_utils.mjs +2 -2
  10. package/esm2022/src/image_performance_warning.mjs +2 -2
  11. package/esm2022/src/linker/compiler.mjs +2 -2
  12. package/esm2022/src/platform/platform_ref.mjs +2 -2
  13. package/esm2022/src/render3/component_ref.mjs +1 -1
  14. package/esm2022/src/render3/node_manipulation.mjs +9 -2
  15. package/esm2022/src/testability/testability.mjs +3 -3
  16. package/esm2022/src/util/callback_scheduler.mjs +26 -23
  17. package/esm2022/src/version.mjs +1 -1
  18. package/esm2022/testing/src/application_error_handler.mjs +43 -0
  19. package/esm2022/testing/src/component_fixture.mjs +13 -2
  20. package/esm2022/testing/src/logger.mjs +3 -3
  21. package/esm2022/testing/src/test_bed_common.mjs +1 -1
  22. package/esm2022/testing/src/test_bed_compiler.mjs +24 -2
  23. package/fesm2022/core.mjs +723 -718
  24. package/fesm2022/core.mjs.map +1 -1
  25. package/fesm2022/primitives/event-dispatch.mjs +1 -1
  26. package/fesm2022/primitives/signals.mjs +1 -1
  27. package/fesm2022/rxjs-interop.mjs +1 -1
  28. package/fesm2022/testing.mjs +69 -3
  29. package/fesm2022/testing.mjs.map +1 -1
  30. package/index.d.ts +9 -1
  31. package/package.json +1 -1
  32. package/primitives/event-dispatch/index.d.ts +1 -1
  33. package/primitives/signals/index.d.ts +1 -1
  34. package/rxjs-interop/index.d.ts +1 -1
  35. package/schematics/migrations/invalid-two-way-bindings/bundle.js +6 -5
  36. package/schematics/migrations/invalid-two-way-bindings/bundle.js.map +2 -2
  37. package/schematics/ng-generate/control-flow-migration/bundle.js +6 -5
  38. package/schematics/ng-generate/control-flow-migration/bundle.js.map +2 -2
  39. package/schematics/ng-generate/standalone-migration/bundle.js +109 -76
  40. package/schematics/ng-generate/standalone-migration/bundle.js.map +4 -4
  41. package/testing/index.d.ts +2 -1
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.2
2
+ * @license Angular v18.1.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.2
2
+ * @license Angular v18.1.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v18.1.2
2
+ * @license Angular v18.1.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -1,10 +1,11 @@
1
1
  /**
2
- * @license Angular v18.1.2
2
+ * @license Angular v18.1.3
3
3
  * (c) 2010-2024 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
6
6
 
7
- import { ɵDeferBlockState, ɵtriggerResourceLoading, ɵrenderDeferBlockState, ɵCONTAINER_HEADER_OFFSET, ɵgetDeferBlocks, ɵDeferBlockBehavior, InjectionToken, inject as inject$1, ɵNoopNgZone, NgZone, ɵEffectScheduler, ApplicationRef, ɵPendingTasks, getDebugNode, RendererFactory2, ɵdetectChangesInViewIfRequired, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetAsyncClassMetadataFn, ɵgenerateStandaloneInDeclarationsError, ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ɵdepsTracker, ɵgetInjectableDef, resolveForwardRef, ɵNG_COMP_DEF, ɵisComponentDefPendingResolution, ɵresolveComponentResources, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, ɵclearResolutionOfComponentResourcesQueue, ɵrestoreComponentResolutionQueue, ɵinternalProvideZoneChangeDetection, ɵChangeDetectionScheduler, ɵChangeDetectionSchedulerImpl, Compiler, ɵDEFER_BLOCK_CONFIG, COMPILER_OPTIONS, Injector, ɵisEnvironmentProviders, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, runInInjectionContext, EnvironmentInjector, ɵZONELESS_ENABLED, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
7
+ import * as i0 from '@angular/core';
8
+ import { ɵDeferBlockState, ɵtriggerResourceLoading, ɵrenderDeferBlockState, ɵCONTAINER_HEADER_OFFSET, ɵgetDeferBlocks, ɵDeferBlockBehavior, InjectionToken, inject as inject$1, NgZone, ErrorHandler, Injectable, ɵNoopNgZone, ɵEffectScheduler, ApplicationRef, ɵPendingTasks, getDebugNode, RendererFactory2, ɵdetectChangesInViewIfRequired, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetAsyncClassMetadataFn, ɵgenerateStandaloneInDeclarationsError, ɵUSE_RUNTIME_DEPS_TRACKER_FOR_JIT, ɵdepsTracker, ɵgetInjectableDef, resolveForwardRef, ɵNG_COMP_DEF, ɵisComponentDefPendingResolution, ɵresolveComponentResources, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, ɵclearResolutionOfComponentResourcesQueue, ɵrestoreComponentResolutionQueue, ɵinternalProvideZoneChangeDetection, ɵINTERNAL_APPLICATION_ERROR_HANDLER, ɵZONELESS_ENABLED, ɵChangeDetectionScheduler, ɵChangeDetectionSchedulerImpl, Compiler, ɵDEFER_BLOCK_CONFIG, COMPILER_OPTIONS, Injector, ɵisEnvironmentProviders, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, InjectFlags, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode, ɵsetUnknownPropertyStrictMode, ɵgetUnknownElementStrictMode, ɵgetUnknownPropertyStrictMode, runInInjectionContext, EnvironmentInjector, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
8
9
  export { ɵDeferBlockBehavior as DeferBlockBehavior, ɵDeferBlockState as DeferBlockState } from '@angular/core';
9
10
  import { Subscription } from 'rxjs';
10
11
  import { first } from 'rxjs/operators';
@@ -148,6 +149,40 @@ const ComponentFixtureAutoDetect = new InjectionToken('ComponentFixtureAutoDetec
148
149
  */
149
150
  const ComponentFixtureNoNgZone = new InjectionToken('ComponentFixtureNoNgZone');
150
151
 
152
+ const RETHROW_APPLICATION_ERRORS = new InjectionToken('rethrow application errors');
153
+ class TestBedApplicationErrorHandler {
154
+ constructor() {
155
+ this.zone = inject$1(NgZone);
156
+ this.userErrorHandler = inject$1(ErrorHandler);
157
+ this.whenStableRejectFunctions = new Set();
158
+ }
159
+ handleError(e) {
160
+ try {
161
+ this.zone.runOutsideAngular(() => this.userErrorHandler.handleError(e));
162
+ }
163
+ catch (userError) {
164
+ e = userError;
165
+ }
166
+ // Instead of throwing the error when there are outstanding `fixture.whenStable` promises,
167
+ // reject those promises with the error. This allows developers to write
168
+ // expectAsync(fix.whenStable()).toBeRejected();
169
+ if (this.whenStableRejectFunctions.size > 0) {
170
+ for (const fn of this.whenStableRejectFunctions.values()) {
171
+ fn(e);
172
+ }
173
+ this.whenStableRejectFunctions.clear();
174
+ }
175
+ else {
176
+ throw e;
177
+ }
178
+ }
179
+ static { this.ɵfac = i0.ɵɵngDeclareFactory({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: TestBedApplicationErrorHandler, deps: [], target: i0.ɵɵFactoryTarget.Injectable }); }
180
+ static { this.ɵprov = i0.ɵɵngDeclareInjectable({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: TestBedApplicationErrorHandler }); }
181
+ }
182
+ i0.ɵɵngDeclareClassMetadata({ minVersion: "12.0.0", version: "18.1.3", ngImport: i0, type: TestBedApplicationErrorHandler, decorators: [{
183
+ type: Injectable
184
+ }] });
185
+
151
186
  /**
152
187
  * Fixture for debugging and testing a component.
153
188
  *
@@ -175,6 +210,7 @@ class ComponentFixture {
175
210
  /** @internal */
176
211
  this._testAppRef = this._appRef;
177
212
  this.pendingTasks = inject$1(ɵPendingTasks);
213
+ this.appErrorHandler = inject$1(TestBedApplicationErrorHandler);
178
214
  // TODO(atscott): Remove this from public API
179
215
  this.ngZone = this._noZoneOptionIsSet ? null : this._ngZone;
180
216
  this.changeDetectorRef = componentRef.changeDetectorRef;
@@ -207,7 +243,16 @@ class ComponentFixture {
207
243
  if (this.isStable()) {
208
244
  return Promise.resolve(false);
209
245
  }
210
- return this._appRef.isStable.pipe(first((stable) => stable)).toPromise();
246
+ return new Promise((resolve, reject) => {
247
+ this.appErrorHandler.whenStableRejectFunctions.add(reject);
248
+ this._appRef.isStable
249
+ .pipe(first((stable) => stable))
250
+ .toPromise()
251
+ .then((v) => {
252
+ this.appErrorHandler.whenStableRejectFunctions.delete(reject);
253
+ resolve(v);
254
+ });
255
+ });
211
256
  }
212
257
  /**
213
258
  * Retrieves all defer block fixtures in the component fixture.
@@ -836,6 +881,10 @@ class TestBedCompiler {
836
881
  if (moduleDef.providers !== undefined) {
837
882
  this.providers.push(...moduleDef.providers);
838
883
  }
884
+ this.providers.push({
885
+ provide: RETHROW_APPLICATION_ERRORS,
886
+ useValue: moduleDef._rethrowApplicationTickErrors ?? false,
887
+ });
839
888
  if (moduleDef.schemas !== undefined) {
840
889
  this.schemas.push(...moduleDef.schemas);
841
890
  }
@@ -1453,6 +1502,23 @@ class TestBedCompiler {
1453
1502
  providers: [
1454
1503
  ...this.rootProviderOverrides,
1455
1504
  ɵinternalProvideZoneChangeDetection({}),
1505
+ TestBedApplicationErrorHandler,
1506
+ {
1507
+ provide: ɵINTERNAL_APPLICATION_ERROR_HANDLER,
1508
+ useFactory: () => {
1509
+ if (inject$1(ɵZONELESS_ENABLED) || inject$1(RETHROW_APPLICATION_ERRORS, { optional: true })) {
1510
+ const handler = inject$1(TestBedApplicationErrorHandler);
1511
+ return (e) => {
1512
+ handler.handleError(e);
1513
+ };
1514
+ }
1515
+ else {
1516
+ const userErrorHandler = inject$1(ErrorHandler);
1517
+ const ngZone = inject$1(NgZone);
1518
+ return (e) => ngZone.runOutsideAngular(() => userErrorHandler.handleError(e));
1519
+ }
1520
+ },
1521
+ },
1456
1522
  { provide: ɵChangeDetectionScheduler, useExisting: ɵChangeDetectionSchedulerImpl },
1457
1523
  ],
1458
1524
  });