@angular/core 15.0.0-next.3 → 15.0.0-next.4

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 (33) hide show
  1. package/esm2020/src/core_private_export.mjs +2 -2
  2. package/esm2020/src/di/index.mjs +1 -1
  3. package/esm2020/src/di/injector.mjs +1 -1
  4. package/esm2020/src/di/injector_compatibility.mjs +15 -11
  5. package/esm2020/src/di/interface/injector.mjs +1 -1
  6. package/esm2020/src/di/r3_injector.mjs +3 -2
  7. package/esm2020/src/render3/component_ref.mjs +102 -83
  8. package/esm2020/src/render3/context_discovery.mjs +7 -7
  9. package/esm2020/src/render3/di.mjs +3 -2
  10. package/esm2020/src/render3/features/host_directives_feature.mjs +2 -3
  11. package/esm2020/src/render3/instructions/element.mjs +3 -15
  12. package/esm2020/src/render3/instructions/shared.mjs +93 -106
  13. package/esm2020/src/render3/ng_module_ref.mjs +1 -1
  14. package/esm2020/src/render3/node_manipulation.mjs +15 -1
  15. package/esm2020/src/render3/util/discovery_utils.mjs +2 -2
  16. package/esm2020/src/util/is_dev_mode.mjs +11 -19
  17. package/esm2020/src/version.mjs +1 -1
  18. package/esm2020/src/zone/async-stack-tagging.mjs +28 -0
  19. package/esm2020/src/zone/ng_zone.mjs +8 -3
  20. package/esm2020/testing/src/logger.mjs +3 -3
  21. package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
  22. package/esm2020/testing/src/test_bed.mjs +4 -4
  23. package/fesm2015/core.mjs +1506 -1470
  24. package/fesm2015/core.mjs.map +1 -1
  25. package/fesm2015/testing.mjs +888 -877
  26. package/fesm2015/testing.mjs.map +1 -1
  27. package/fesm2020/core.mjs +1509 -1475
  28. package/fesm2020/core.mjs.map +1 -1
  29. package/fesm2020/testing.mjs +886 -876
  30. package/fesm2020/testing.mjs.map +1 -1
  31. package/index.d.ts +60 -5
  32. package/package.json +1 -1
  33. package/testing/index.d.ts +9 -1
package/index.d.ts CHANGED
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.3
2
+ * @license Angular v15.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -2698,6 +2698,10 @@ export declare abstract class EmbeddedViewRef<C> extends ViewRef {
2698
2698
  * does not result in additional changes to any bindings (also known as
2699
2699
  * unidirectional data flow).
2700
2700
  *
2701
+ * Using this method is discouraged as the Angular CLI will set production mode when using the
2702
+ * `optimization` option.
2703
+ * @see {@link cli/build ng build}
2704
+ *
2701
2705
  * @publicApi
2702
2706
  */
2703
2707
  export declare function enableProdMode(): void;
@@ -2722,6 +2726,27 @@ export declare abstract class EnvironmentInjector implements Injector {
2722
2726
  * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
2723
2727
  * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
2724
2728
  */
2729
+ abstract get<T>(token: ProviderToken<T>, notFoundValue: undefined, options: InjectOptions & {
2730
+ optional?: false;
2731
+ }): T;
2732
+ /**
2733
+ * Retrieves an instance from the injector based on the provided token.
2734
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
2735
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
2736
+ */
2737
+ abstract get<T>(token: ProviderToken<T>, notFoundValue: null | undefined, options: InjectOptions): T | null;
2738
+ /**
2739
+ * Retrieves an instance from the injector based on the provided token.
2740
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
2741
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
2742
+ */
2743
+ abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions): T;
2744
+ /**
2745
+ * Retrieves an instance from the injector based on the provided token.
2746
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
2747
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
2748
+ * @deprecated use object-based flags (`InjectOptions`) instead.
2749
+ */
2725
2750
  abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
2726
2751
  /**
2727
2752
  * @deprecated from v4.0.0 use ProviderToken<T>
@@ -4033,11 +4058,38 @@ export declare const INJECTOR: InjectionToken<Injector>;
4033
4058
  export declare abstract class Injector {
4034
4059
  static THROW_IF_NOT_FOUND: {};
4035
4060
  static NULL: Injector;
4061
+ /**
4062
+ * Internal note on the `options?: InjectOptions|InjectFlags` override of the `get`
4063
+ * method: consider dropping the `InjectFlags` part in one of the major versions.
4064
+ * It can **not** be done in minor/patch, since it's breaking for custom injectors
4065
+ * that only implement the old `InjectorFlags` interface.
4066
+ */
4036
4067
  /**
4037
4068
  * Retrieves an instance from the injector based on the provided token.
4038
4069
  * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4039
4070
  * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4040
4071
  */
4072
+ abstract get<T>(token: ProviderToken<T>, notFoundValue: undefined, options: InjectOptions & {
4073
+ optional?: false;
4074
+ }): T;
4075
+ /**
4076
+ * Retrieves an instance from the injector based on the provided token.
4077
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4078
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4079
+ */
4080
+ abstract get<T>(token: ProviderToken<T>, notFoundValue: null | undefined, options: InjectOptions): T | null;
4081
+ /**
4082
+ * Retrieves an instance from the injector based on the provided token.
4083
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4084
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4085
+ */
4086
+ abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions | InjectFlags): T;
4087
+ /**
4088
+ * Retrieves an instance from the injector based on the provided token.
4089
+ * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
4090
+ * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
4091
+ * @deprecated use object-based flags (`InjectOptions`) instead.
4092
+ */
4041
4093
  abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
4042
4094
  /**
4043
4095
  * @deprecated from v4.0.0 use ProviderToken<T>
@@ -4188,10 +4240,11 @@ declare interface InternalViewRef extends ViewRef {
4188
4240
 
4189
4241
 
4190
4242
  /**
4191
- * Returns whether Angular is in development mode. After called once,
4192
- * the value is locked and won't change any more.
4243
+ * Returns whether Angular is in development mode.
4193
4244
  *
4194
- * By default, this is true, unless a user calls `enableProdMode` before calling this.
4245
+ * By default, this is true, unless `enableProdMode` is invoked prior to calling this method or the
4246
+ * application is built using the Angular CLI with the `optimization` option.
4247
+ * @see {@link cli/build ng build}
4195
4248
  *
4196
4249
  * @publicApi
4197
4250
  */
@@ -6447,7 +6500,7 @@ declare class R3Injector extends EnvironmentInjector {
6447
6500
  destroy(): void;
6448
6501
  onDestroy(callback: () => void): void;
6449
6502
  runInContext<ReturnT>(fn: () => ReturnT): ReturnT;
6450
- get<T>(token: ProviderToken<T>, notFoundValue?: any, flags?: InjectFlags): T;
6503
+ get<T>(token: ProviderToken<T>, notFoundValue?: any, flags?: InjectFlags | InjectOptions): T;
6451
6504
  toString(): string;
6452
6505
  private assertNotDestroyed;
6453
6506
  /**
@@ -10018,6 +10071,8 @@ export declare class ɵConsole {
10018
10071
  static ɵprov: i0.ɵɵInjectableDeclaration<ɵConsole>;
10019
10072
  }
10020
10073
 
10074
+ export declare function ɵconvertToBitFlags(flags: InjectOptions | InjectFlags | undefined): InjectFlags | undefined;
10075
+
10021
10076
  /**
10022
10077
  * Create a new `Injector` which is configured using a `defType` of `InjectorType<any>`s.
10023
10078
  *
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@angular/core",
3
- "version": "15.0.0-next.3",
3
+ "version": "15.0.0-next.4",
4
4
  "description": "Angular - the core framework",
5
5
  "author": "angular",
6
6
  "license": "MIT",
@@ -1,5 +1,5 @@
1
1
  /**
2
- * @license Angular v15.0.0-next.3
2
+ * @license Angular v15.0.0-next.4
3
3
  * (c) 2010-2022 Google LLC. https://angular.io/
4
4
  * License: MIT
5
5
  */
@@ -13,6 +13,7 @@ import { Directive } from '@angular/core';
13
13
  import { ElementRef } from '@angular/core';
14
14
  import { InjectFlags } from '@angular/core';
15
15
  import { InjectionToken } from '@angular/core';
16
+ import { InjectOptions } from '@angular/core';
16
17
  import { NgModule } from '@angular/core';
17
18
  import { NgZone } from '@angular/core';
18
19
  import { Pipe } from '@angular/core';
@@ -278,7 +279,14 @@ export declare interface TestBed {
278
279
  }): void;
279
280
  configureTestingModule(moduleDef: TestModuleMetadata): TestBed;
280
281
  compileComponents(): Promise<any>;
282
+ inject<T>(token: ProviderToken<T>, notFoundValue: undefined, options: InjectOptions & {
283
+ optional?: false;
284
+ }): T;
285
+ inject<T>(token: ProviderToken<T>, notFoundValue: null | undefined, options: InjectOptions): T | null;
286
+ inject<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions): T;
287
+ /** @deprecated use object-based flags (`InjectOptions`) instead. */
281
288
  inject<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
289
+ /** @deprecated use object-based flags (`InjectOptions`) instead. */
282
290
  inject<T>(token: ProviderToken<T>, notFoundValue: null, flags?: InjectFlags): T | null;
283
291
  /** @deprecated from v9.0.0 use TestBed.inject */
284
292
  get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): any;