static-injector 6.0.2 → 6.1.0

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 (42) hide show
  1. package/import/change_detection/scheduling/zoneless_scheduling.d.ts +1 -1
  2. package/import/core_reactivity_export_internal.d.ts +3 -4
  3. package/import/di/forward_ref.d.ts +9 -7
  4. package/import/di/inject_switch.d.ts +4 -4
  5. package/import/di/injector.d.ts +12 -17
  6. package/import/di/injector_compatibility.d.ts +24 -18
  7. package/import/di/interface/injector.d.ts +13 -17
  8. package/import/di/metadata.d.ts +7 -0
  9. package/import/di/provider_collection.d.ts +2 -42
  10. package/import/di/r3_injector.d.ts +10 -11
  11. package/import/error_handler.d.ts +5 -0
  12. package/import/errors.d.ts +11 -1
  13. package/import/index.d.ts +4 -0
  14. package/import/linker/destroy_ref.d.ts +2 -0
  15. package/import/pending_tasks.d.ts +15 -16
  16. package/import/render3/errors_di.d.ts +2 -0
  17. package/import/render3/reactivity/api.d.ts +5 -1
  18. package/import/render3/reactivity/asserts.d.ts +1 -1
  19. package/import/render3/reactivity/effect.d.ts +10 -22
  20. package/import/render3/reactivity/linked_signal.d.ts +3 -3
  21. package/import/render3/reactivity/root_effect_scheduler.d.ts +4 -1
  22. package/import/render3/reactivity/signal.d.ts +3 -1
  23. package/import/resource/api.d.ts +35 -50
  24. package/import/resource/resource.d.ts +9 -7
  25. package/index.js +464 -623
  26. package/index.js.map +4 -4
  27. package/index.mjs +458 -619
  28. package/index.mjs.map +4 -4
  29. package/package.json +2 -2
  30. package/primitives/di/index.d.ts +12 -0
  31. package/primitives/di/src/injection_token.d.ts +63 -0
  32. package/primitives/di/src/injector.d.ts +14 -0
  33. package/primitives/di/src/not_found.d.ts +28 -0
  34. package/primitives/di/src/type.d.ts +61 -0
  35. package/primitives/signals/index.d.ts +5 -4
  36. package/primitives/signals/src/computed.d.ts +1 -1
  37. package/primitives/signals/src/graph.d.ts +3 -0
  38. package/primitives/signals/src/linked_signal.d.ts +2 -29
  39. package/primitives/signals/src/signal.d.ts +8 -6
  40. package/{import/render3/reactivity/patch.d.ts → primitives/signals/src/untracked.d.ts} +3 -2
  41. package/readme.md +1 -1
  42. package/import/render3/reactivity/microtask_effect.d.ts +0 -21
@@ -31,7 +31,7 @@ export declare abstract class ChangeDetectionScheduler {
31
31
  }
32
32
  /** Token used to indicate if zoneless was enabled via provideZonelessChangeDetection(). */
33
33
  export declare const ZONELESS_ENABLED: InjectionToken<boolean>;
34
- /** Token used to indicate `provideExperimentalZonelessChangeDetection` was used. */
34
+ /** Token used to indicate `provideZonelessChangeDetection` was used. */
35
35
  export declare const PROVIDED_ZONELESS: InjectionToken<boolean>;
36
36
  export declare const ZONELESS_SCHEDULER_DISABLED: InjectionToken<boolean>;
37
37
  export declare const SCHEDULE_IN_ROOT_ZONE: InjectionToken<boolean>;
@@ -5,13 +5,12 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
- export { SIGNAL as ɵSIGNAL } from '@angular/core/primitives/signals';
8
+ export { SIGNAL as ɵSIGNAL } from '../primitives/signals';
9
9
  export { isSignal, Signal, ValueEqualityFn } from './render3/reactivity/api';
10
10
  export { computed, CreateComputedOptions } from './render3/reactivity/computed';
11
- export { CreateSignalOptions, signal, WritableSignal, ɵunwrapWritableSignal, } from './render3/reactivity/signal';
11
+ export { CreateSignalOptions, signal, WritableSignal, ɵunwrapWritableSignal } from './render3/reactivity/signal';
12
12
  export { linkedSignal } from './render3/reactivity/linked_signal';
13
13
  export { untracked } from './render3/reactivity/untracked';
14
- export { CreateEffectOptions, effect, EffectRef, EffectCleanupFn, EffectCleanupRegisterFn, } from './render3/reactivity/effect';
15
- export { MicrotaskEffectScheduler as ɵMicrotaskEffectScheduler, microtaskEffect as ɵmicrotaskEffect, } from './render3/reactivity/microtask_effect';
14
+ export { CreateEffectOptions, effect, EffectRef, EffectCleanupFn, EffectCleanupRegisterFn } from './render3/reactivity/effect';
16
15
  export { EffectScheduler as ɵEffectScheduler } from './render3/reactivity/root_effect_scheduler';
17
16
  export { assertNotInReactiveContext } from './render3/reactivity/asserts';
@@ -34,24 +34,26 @@ export interface ForwardRefFn {
34
34
  * ### Circular standalone reference import example
35
35
  * ```angular-ts
36
36
  * @Component({
37
- * standalone: true,
38
37
  * imports: [ChildComponent],
39
38
  * selector: 'app-parent',
40
- * template: `<app-child [hideParent]="hideParent"></app-child>`,
39
+ * template: `<app-child [hideParent]="hideParent()"></app-child>`,
41
40
  * })
42
41
  * export class ParentComponent {
43
- * @Input() hideParent: boolean;
42
+ * hideParent = input.required<boolean>();
44
43
  * }
45
44
  *
46
45
  *
47
46
  * @Component({
48
- * standalone: true,
49
- * imports: [CommonModule, forwardRef(() => ParentComponent)],
47
+ * imports: [forwardRef(() => ParentComponent)],
50
48
  * selector: 'app-child',
51
- * template: `<app-parent *ngIf="!hideParent"></app-parent>`,
49
+ * template: `
50
+ * @if(!hideParent() {
51
+ * <app-parent/>
52
+ * }
53
+ * `,
52
54
  * })
53
55
  * export class ChildComponent {
54
- * @Input() hideParent: boolean;
56
+ * hideParent = input.required<boolean>();
55
57
  * }
56
58
  * ```
57
59
  *
@@ -5,13 +5,13 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
- import { InjectFlags } from './interface/injector';
8
+ import { InternalInjectFlags } from './interface/injector';
9
9
  import { ProviderToken } from './provider_token';
10
- export declare function getInjectImplementation(): (<T>(token: ProviderToken<T>, flags?: InjectFlags) => T | null) | undefined;
10
+ export declare function getInjectImplementation(): (<T>(token: ProviderToken<T>, flags?: InternalInjectFlags) => T | null) | undefined;
11
11
  /**
12
12
  * Sets the current inject implementation.
13
13
  */
14
- export declare function setInjectImplementation(impl: (<T>(token: ProviderToken<T>, flags?: InjectFlags) => T | null) | undefined): (<T>(token: ProviderToken<T>, flags?: InjectFlags) => T | null) | undefined;
14
+ export declare function setInjectImplementation(impl: (<T>(token: ProviderToken<T>, flags?: InternalInjectFlags) => T | null) | undefined): (<T>(token: ProviderToken<T>, flags?: InternalInjectFlags) => T | null) | undefined;
15
15
  /**
16
16
  * Injects `root` tokens in limp mode.
17
17
  *
@@ -19,4 +19,4 @@ export declare function setInjectImplementation(impl: (<T>(token: ProviderToken<
19
19
  * `"root"`. This is known as the limp mode injection. In such case the value is stored in the
20
20
  * injectable definition.
21
21
  */
22
- export declare function injectRootLimpMode<T>(token: ProviderToken<T>, notFoundValue: T | undefined, flags: InjectFlags): T | null;
22
+ export declare function injectRootLimpMode<T>(token: ProviderToken<T>, notFoundValue: T | undefined, flags: InternalInjectFlags): T | null;
@@ -6,7 +6,7 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import { InjectorMarkers } from './injector_marker';
9
- import { InjectFlags, InjectOptions } from './interface/injector';
9
+ import { InjectOptions } from './interface/injector';
10
10
  import { Provider, StaticProvider } from './interface/provider';
11
11
  import { ProviderToken } from './provider_token';
12
12
  /**
@@ -36,12 +36,6 @@ import { ProviderToken } from './provider_token';
36
36
  export declare abstract class Injector {
37
37
  static THROW_IF_NOT_FOUND: {};
38
38
  static NULL: Injector;
39
- /**
40
- * Internal note on the `options?: InjectOptions|InjectFlags` override of the `get`
41
- * method: consider dropping the `InjectFlags` part in one of the major versions.
42
- * It can **not** be done in minor/patch, since it's breaking for custom injectors
43
- * that only implement the old `InjectorFlags` interface.
44
- */
45
39
  /**
46
40
  * Retrieves an instance from the injector based on the provided token.
47
41
  * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
@@ -61,19 +55,12 @@ export declare abstract class Injector {
61
55
  * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
62
56
  * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
63
57
  */
64
- abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions | InjectFlags): T;
65
- /**
66
- * Retrieves an instance from the injector based on the provided token.
67
- * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
68
- * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
69
- * @deprecated use object-based flags (`InjectOptions`) instead.
70
- */
71
- abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
58
+ abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions): T;
72
59
  /**
73
60
  * @deprecated from v4.0.0 use ProviderToken<T>
74
61
  * @suppress {duplicate}
75
62
  */
76
- abstract get(token: any, notFoundValue?: any): any;
63
+ abstract get<T>(token: string | ProviderToken<T>, notFoundValue?: any): any;
77
64
  /**
78
65
  * @deprecated from v5 use the new signature Injector.create(options)
79
66
  */
@@ -94,7 +81,7 @@ export declare abstract class Injector {
94
81
  providers: Array<Provider | StaticProvider>;
95
82
  parent?: Injector;
96
83
  name?: string;
97
- }): Injector;
84
+ }): DestroyableInjector;
98
85
  /** @nocollapse */
99
86
  static ɵprov: unknown;
100
87
  /**
@@ -103,3 +90,11 @@ export declare abstract class Injector {
103
90
  */
104
91
  static __NG_ELEMENT_ID__: InjectorMarkers;
105
92
  }
93
+ /**
94
+ * An Injector that the owner can destroy and trigger the DestroyRef.destroy hooks.
95
+ *
96
+ * @publicApi
97
+ */
98
+ export interface DestroyableInjector extends Injector {
99
+ destroy(): void;
100
+ }
@@ -6,15 +6,32 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import type { Injector } from './injector';
9
- import { DecoratorFlags, InjectFlags, InjectOptions, InternalInjectFlags } from './interface/injector';
9
+ import { DecoratorFlags, InternalInjectFlags, InjectOptions } from './interface/injector';
10
10
  import { ProviderToken } from './provider_token';
11
+ import { Injector as PrimitivesInjector, NotFound, InjectionToken as PrimitivesInjectionToken } from '../../primitives/di';
11
12
  export declare const THROW_IF_NOT_FOUND: {};
13
+ export { getCurrentInjector, setCurrentInjector } from '../../primitives/di';
14
+ /**
15
+ * A wrapper around an `Injector` that implements the `PrimitivesInjector` interface.
16
+ *
17
+ * This is used to allow the `inject` function to be used with the new primitives-based DI system.
18
+ */
19
+ export declare class RetrievingInjector implements PrimitivesInjector {
20
+ readonly injector: Injector;
21
+ constructor(injector: Injector);
22
+ retrieve<T>(token: PrimitivesInjectionToken<T>, options: unknown): T | NotFound;
23
+ }
12
24
  export declare const NG_TEMP_TOKEN_PATH = "ngTempTokenPath";
13
25
  export declare const SOURCE = "__source";
14
- export declare function getCurrentInjector(): Injector | undefined | null;
15
- export declare function setCurrentInjector(injector: Injector | null | undefined): Injector | undefined | null;
26
+ /**
27
+ * Temporary type to allow internal symbols to use inject flags. This should be
28
+ * removed once we consolidate the flags and the object literal approach.
29
+ */
30
+ export type BackwardsCompatibleInjector = Injector & {
31
+ get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InternalInjectFlags | InjectOptions): T;
32
+ };
16
33
  export declare function injectInjectorOnly<T>(token: ProviderToken<T>): T;
17
- export declare function injectInjectorOnly<T>(token: ProviderToken<T>, flags?: InjectFlags): T | null;
34
+ export declare function injectInjectorOnly<T>(token: ProviderToken<T>, flags?: InternalInjectFlags): T | null;
18
35
  /**
19
36
  * Generated instruction: injects a token from the currently active injector.
20
37
  *
@@ -26,8 +43,8 @@ export declare function injectInjectorOnly<T>(token: ProviderToken<T>, flags?: I
26
43
  * @publicApi This instruction has been emitted by ViewEngine for some time and is deployed to npm.
27
44
  */
28
45
  export declare function ɵɵinject<T>(token: ProviderToken<T>): T;
29
- export declare function ɵɵinject<T>(token: ProviderToken<T>, flags?: InjectFlags): T | null;
30
- export declare function ɵɵinject<T>(token: ProviderToken<T>, flags?: InjectFlags): string | null;
46
+ export declare function ɵɵinject<T>(token: ProviderToken<T>, flags?: InternalInjectFlags): T | null;
47
+ export declare function ɵɵinject<T>(token: ProviderToken<T>, flags?: InternalInjectFlags): string | null;
31
48
  /**
32
49
  * Throws an error indicating that a factory function could not be generated by the compiler for a
33
50
  * particular class.
@@ -46,17 +63,6 @@ export declare function ɵɵinvalidFactoryDep(index: number): void;
46
63
  * @publicApi
47
64
  */
48
65
  export declare function inject<T>(token: ProviderToken<T>): T;
49
- /**
50
- * @param token A token that represents a dependency that should be injected.
51
- * @param flags Control how injection is executed. The flags correspond to injection strategies that
52
- * can be specified with parameter decorators `@Host`, `@Self`, `@SkipSelf`, and `@Optional`.
53
- * @returns the injected value if operation is successful, `null` otherwise.
54
- * @throws if called outside of a supported context.
55
- *
56
- * @publicApi
57
- * @deprecated prefer an options object instead of `InjectFlags`
58
- */
59
- export declare function inject<T>(token: ProviderToken<T>, flags?: InjectFlags): T | null;
60
66
  /**
61
67
  * @param token A token that represents a dependency that should be injected.
62
68
  * @param options Control how injection is executed. Options correspond to injection strategies
@@ -83,7 +89,7 @@ export declare function inject<T>(token: ProviderToken<T>, options: InjectOption
83
89
  * @publicApi
84
90
  */
85
91
  export declare function inject<T>(token: ProviderToken<T>, options: InjectOptions): T | null;
86
- export declare function convertToBitFlags(flags: InjectOptions | InjectFlags | undefined): InjectFlags | undefined;
92
+ export declare function convertToBitFlags(flags: InjectOptions | InternalInjectFlags | undefined): InternalInjectFlags | undefined;
87
93
  export declare function injectArgs(types: (ProviderToken<any> | any[])[]): any[];
88
94
  /**
89
95
  * Attaches a given InjectFlag to a given decorator using monkey-patching.
@@ -13,22 +13,6 @@
13
13
  export declare const enum DecoratorFlags {
14
14
  Inject = -1
15
15
  }
16
- /**
17
- * Injection flags for DI.
18
- *
19
- * @publicApi
20
- * @deprecated use an options object for [`inject`](api/core/inject) instead.
21
- */
22
- export declare enum InjectFlags {
23
- /** Check self and check parent injector if needed */
24
- Default = 0,
25
- /** Don't ascend to ancestors of the node requesting injection. */
26
- Self = 2,
27
- /** Skip the node that is requesting injection. */
28
- SkipSelf = 4,
29
- /** Inject `defaultValue` instead if token not found. */
30
- Optional = 8
31
- }
32
16
  /**
33
17
  * This enum is an exact copy of the `InjectFlags` enum above, but the difference is that this is a
34
18
  * const enum, so actual enum values would be inlined in generated code. The `InjectFlags` enum can
@@ -40,12 +24,24 @@ export declare enum InjectFlags {
40
24
  export declare const enum InternalInjectFlags {
41
25
  /** Check self and check parent injector if needed */
42
26
  Default = 0,
27
+ /**
28
+ * Specifies that an injector should retrieve a dependency from any injector until reaching the
29
+ * host element of the current component. (Only used with Element Injector)
30
+ */
31
+ Host = 1,
43
32
  /** Don't ascend to ancestors of the node requesting injection. */
44
33
  Self = 2,
45
34
  /** Skip the node that is requesting injection. */
46
35
  SkipSelf = 4,
47
36
  /** Inject `defaultValue` instead if token not found. */
48
- Optional = 8
37
+ Optional = 8,
38
+ /**
39
+ * This token is being injected into a pipe.
40
+ *
41
+ * This flag is intentionally not in the public facing `InjectFlags` because it is only added by
42
+ * the compiler and is not a developer applicable flag.
43
+ */
44
+ ForPipe = 16
49
45
  }
50
46
  /**
51
47
  * Type of the options argument to [`inject`](api/core/inject).
@@ -11,6 +11,13 @@
11
11
  * @publicApi
12
12
  */
13
13
  export interface InjectDecorator {
14
+ /**
15
+ * Warning: String tokens are not recommended.
16
+ *
17
+ * Use an InjectionToken or a class as a token instead.
18
+ */
19
+ (token: string): any;
20
+ new (token: string): Inject;
14
21
  /**
15
22
  * Parameter decorator on a dependency parameter of a class constructor
16
23
  * that specifies a custom provider of the dependency.
@@ -10,6 +10,8 @@ import { ClassProvider, ConstructorProvider, EnvironmentProviders, ExistingProvi
10
10
  /**
11
11
  * Wrap an array of `Provider`s into `EnvironmentProviders`, preventing them from being accidentally
12
12
  * referenced in `@Component` in a component injector.
13
+ *
14
+ * @publicApi
13
15
  */
14
16
  export declare function makeEnvironmentProviders(providers: (Provider | EnvironmentProviders)[]): EnvironmentProviders;
15
17
  /**
@@ -46,48 +48,6 @@ export declare function provideEnvironmentInitializer(initializerFn: () => void)
46
48
  * @publicApi
47
49
  */
48
50
  export type ImportProvidersSource = Type<unknown> | ModuleWithProviders<unknown> | Array<ImportProvidersSource>;
49
- /**
50
- * Collects providers from all NgModules and standalone components, including transitively imported
51
- * ones.
52
- *
53
- * Providers extracted via `importProvidersFrom` are only usable in an application injector or
54
- * another environment injector (such as a route injector). They should not be used in component
55
- * providers.
56
- *
57
- * More information about standalone components can be found in [this
58
- * guide](guide/components/importing).
59
- *
60
- * @usageNotes
61
- * The results of the `importProvidersFrom` call can be used in the `bootstrapApplication` call:
62
- *
63
- * ```ts
64
- * await bootstrapApplication(RootComponent, {
65
- * providers: [
66
- * importProvidersFrom(NgModuleOne, NgModuleTwo)
67
- * ]
68
- * });
69
- * ```
70
- *
71
- * You can also use the `importProvidersFrom` results in the `providers` field of a route, when a
72
- * standalone component is used:
73
- *
74
- * ```ts
75
- * export const ROUTES: Route[] = [
76
- * {
77
- * path: 'foo',
78
- * providers: [
79
- * importProvidersFrom(NgModuleOne, NgModuleTwo)
80
- * ],
81
- * component: YourStandaloneComponent
82
- * }
83
- * ];
84
- * ```
85
- *
86
- * @returns Collected providers from the specified list of types.
87
- * @publicApi
88
- */
89
- export declare function importProvidersFrom(...sources: ImportProvidersSource[]): EnvironmentProviders;
90
- export declare function internalImportProvidersFrom(checkForStandaloneCmp: boolean, ...sources: ImportProvidersSource[]): Provider[];
91
51
  /**
92
52
  * Internal type for a single provider in a deep provider array.
93
53
  */
@@ -7,15 +7,18 @@
7
7
  */
8
8
  import type { Injector } from './injector';
9
9
  import { InjectorType } from './interface/defs';
10
- import { InjectFlags, InjectOptions } from './interface/injector';
10
+ import { InjectOptions } from './interface/injector';
11
11
  import { EnvironmentProviders, Provider } from './interface/provider';
12
12
  import { SingleProvider } from './provider_collection';
13
13
  import { ProviderToken } from './provider_token';
14
14
  import { InjectorScope } from './scope';
15
+ import { Injector as PrimitivesInjector, InjectionToken as PrimitivesInjectionToken, NotFound } from '@angular/core/primitives/di';
15
16
  export declare function getNullInjector(): Injector;
16
17
  /**
17
18
  * An `Injector` that's part of the environment injector hierarchy, which exists outside of the
18
19
  * component tree.
20
+ *
21
+ * @publicApi
19
22
  */
20
23
  export declare abstract class EnvironmentInjector implements Injector {
21
24
  /**
@@ -38,18 +41,11 @@ export declare abstract class EnvironmentInjector implements Injector {
38
41
  * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
39
42
  */
40
43
  abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, options?: InjectOptions): T;
41
- /**
42
- * Retrieves an instance from the injector based on the provided token.
43
- * @returns The instance from the injector if defined, otherwise the `notFoundValue`.
44
- * @throws When the `notFoundValue` is `undefined` or `Injector.THROW_IF_NOT_FOUND`.
45
- * @deprecated use object-based flags (`InjectOptions`) instead.
46
- */
47
- abstract get<T>(token: ProviderToken<T>, notFoundValue?: T, flags?: InjectFlags): T;
48
44
  /**
49
45
  * @deprecated from v4.0.0 use ProviderToken<T>
50
46
  * @suppress {duplicate}
51
47
  */
52
- abstract get(token: any, notFoundValue?: any): any;
48
+ abstract get<T>(token: string | ProviderToken<T>, notFoundValue?: any): any;
53
49
  /**
54
50
  * Runs the given function in the context of this `EnvironmentInjector`.
55
51
  *
@@ -63,12 +59,14 @@ export declare abstract class EnvironmentInjector implements Injector {
63
59
  */
64
60
  abstract runInContext<ReturnT>(fn: () => ReturnT): ReturnT;
65
61
  abstract destroy(): void;
62
+ /** @internal */
63
+ abstract get destroyed(): boolean;
66
64
  /**
67
65
  * @internal
68
66
  */
69
67
  abstract onDestroy(callback: () => void): () => void;
70
68
  }
71
- export declare class R3Injector extends EnvironmentInjector {
69
+ export declare class R3Injector extends EnvironmentInjector implements PrimitivesInjector {
72
70
  readonly parent: Injector;
73
71
  readonly source: string | null;
74
72
  readonly scopes: Set<InjectorScope>;
@@ -90,6 +88,7 @@ export declare class R3Injector extends EnvironmentInjector {
90
88
  private _destroyed;
91
89
  private injectorDefTypes;
92
90
  constructor(providers: Array<Provider | EnvironmentProviders>, parent: Injector, source: string | null, scopes: Set<InjectorScope>);
91
+ retrieve<T>(token: PrimitivesInjectionToken<T>, options?: unknown): T | NotFound;
93
92
  /**
94
93
  * Destroy the injector and release references to every instance or provider associated with it.
95
94
  *
@@ -99,7 +98,7 @@ export declare class R3Injector extends EnvironmentInjector {
99
98
  destroy(): void;
100
99
  onDestroy(callback: () => void): () => void;
101
100
  runInContext<ReturnT>(fn: () => ReturnT): ReturnT;
102
- get<T>(token: ProviderToken<T>, notFoundValue?: any, flags?: InjectFlags | InjectOptions): T;
101
+ get<T>(token: ProviderToken<T>, notFoundValue?: any, options?: InjectOptions): T;
103
102
  /** @internal */
104
103
  resolveInjectorInitializers(): void;
105
104
  toString(): string;
@@ -5,6 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
+ import { InjectionToken } from './di/injection_token';
8
9
  /**
9
10
  * Provides a hook for centralized exception handling.
10
11
  *
@@ -43,3 +44,7 @@ export declare class ErrorHandler {
43
44
  _console: Console;
44
45
  handleError(error: any): void;
45
46
  }
47
+ /**
48
+ * `InjectionToken` used to configure how to call the `ErrorHandler`.
49
+ */
50
+ export declare const INTERNAL_APPLICATION_ERROR_HANDLER: InjectionToken<(e: any) => void>;
@@ -52,6 +52,9 @@ export declare const enum RuntimeErrorCode {
52
52
  HOST_DIRECTIVE_CONFLICTING_ALIAS = 312,
53
53
  MULTIPLE_MATCHING_PIPES = 313,
54
54
  UNINITIALIZED_LET_ACCESS = 314,
55
+ NO_BINDING_TARGET = 315,
56
+ INVALID_BINDING_TARGET = 316,
57
+ INVALID_SET_INPUT_CALL = 317,
55
58
  MULTIPLE_PLATFORMS = 400,
56
59
  PLATFORM_NOT_FOUND = 401,
57
60
  MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP = 402,
@@ -76,6 +79,7 @@ export declare const enum RuntimeErrorCode {
76
79
  INVALID_I18N_STRUCTURE = 700,
77
80
  MISSING_LOCALE_DATA = 701,
78
81
  DEFER_LOADING_FAILED = -750,
82
+ DEFER_IN_HMR_MODE = -751,
79
83
  IMPORT_PROVIDERS_FROM_STANDALONE = 800,
80
84
  INVALID_DIFFER_INPUT = 900,
81
85
  NO_SUPPORTING_DIFFER_FACTORY = 901,
@@ -92,6 +96,9 @@ export declare const enum RuntimeErrorCode {
92
96
  COMPONENT_ID_COLLISION = -912,
93
97
  IMAGE_PERFORMANCE_WARNING = -913,
94
98
  UNEXPECTED_ZONEJS_PRESENT_IN_ZONELESS_MODE = 914,
99
+ MISSING_NG_MODULE_DEFINITION = 915,
100
+ MISSING_DIRECTIVE_DEFINITION = 916,
101
+ NO_COMPONENT_FACTORY_FOUND = 917,
95
102
  REQUIRED_INPUT_NO_VALUE = -950,
96
103
  REQUIRED_QUERY_NO_VALUE = -951,
97
104
  REQUIRED_MODEL_NO_VALUE = 952,
@@ -99,7 +106,9 @@ export declare const enum RuntimeErrorCode {
99
106
  LOOP_TRACK_DUPLICATE_KEYS = -955,
100
107
  LOOP_TRACK_RECREATE = -956,
101
108
  RUNTIME_DEPS_INVALID_IMPORTED_TYPE = 980,
102
- RUNTIME_DEPS_ORPHAN_COMPONENT = 981
109
+ RUNTIME_DEPS_ORPHAN_COMPONENT = 981,
110
+ MUST_PROVIDE_STREAM_OPTION = 990,
111
+ RESOURCE_COMPLETED_BEFORE_PRODUCING_VALUE = 991
103
112
  }
104
113
  /**
105
114
  * Class that represents a runtime error.
@@ -121,6 +130,7 @@ export declare class RuntimeError<T extends number = RuntimeErrorCode> extends E
121
130
  code: T;
122
131
  constructor(code: T, message: null | false | string);
123
132
  }
133
+ export declare function formatRuntimeErrorCode<T extends number = RuntimeErrorCode>(code: T): string;
124
134
  /**
125
135
  * Called to format a runtime error.
126
136
  * See additional info on the `message` argument type in the `RuntimeError` class description.
package/import/index.d.ts CHANGED
@@ -19,6 +19,10 @@ export * from './core_reactivity_export_internal';
19
19
  export * from './change_detection/scheduling/zoneless_scheduling';
20
20
  export * from './change_detection/scheduling/zoneless_scheduling_impl';
21
21
  export * from './resource';
22
+ export * from './di/provider_token';
23
+ export * from './error_handler';
24
+ export * from './pending_tasks';
25
+ export declare function Injectable(args?: any): (constructor: Function) => void;
22
26
  export declare class StaticInjectOptions {
23
27
  static injectOptions: Parameters<InjectableDecorator>[0];
24
28
  }
@@ -32,6 +32,8 @@ export declare abstract class DestroyRef {
32
32
  * ```
33
33
  */
34
34
  abstract onDestroy(callback: () => void): () => void;
35
+ /** @internal */
36
+ abstract get destroyed(): boolean;
35
37
  /**
36
38
  * @internal
37
39
  * @nocollapse
@@ -5,7 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
- import { BehaviorSubject } from 'rxjs';
8
+ import { Observable } from 'rxjs';
9
9
  import { OnDestroy } from './interface/lifecycle_hooks';
10
10
  /**
11
11
  * Internal implementation of the pending tasks service.
@@ -13,8 +13,14 @@ import { OnDestroy } from './interface/lifecycle_hooks';
13
13
  export declare class PendingTasksInternal implements OnDestroy {
14
14
  private taskId;
15
15
  private pendingTasks;
16
- private get _hasPendingTasks();
17
- hasPendingTasks: BehaviorSubject<boolean>;
16
+ private destroyed;
17
+ private pendingTask;
18
+ get hasPendingTasks(): boolean;
19
+ /**
20
+ * In case the service is about to be destroyed, return a self-completing observable.
21
+ * Otherwise, return the observable that emits the current state of pending tasks.
22
+ */
23
+ get hasPendingTasksObservable(): Observable<boolean>;
18
24
  add(): number;
19
25
  has(taskId: number): boolean;
20
26
  remove(taskId: number): void;
@@ -41,12 +47,12 @@ export declare class PendingTasksInternal implements OnDestroy {
41
47
  * taskCleanup();
42
48
  * ```
43
49
  *
44
- * @publicApi
45
- * @developerPreview
50
+ * @publicApi 20.0
46
51
  */
47
52
  export declare class PendingTasks {
48
- private internalPendingTasks;
49
- private scheduler;
53
+ private readonly internalPendingTasks;
54
+ private readonly scheduler;
55
+ private readonly errorHandler;
50
56
  /**
51
57
  * Adds a new task that should block application's stability.
52
58
  * @returns A cleanup function that removes a task when called.
@@ -62,17 +68,10 @@ export declare class PendingTasks {
62
68
  * });
63
69
  * ```
64
70
  *
65
- * Application stability is at least delayed until the next tick after the `run` method resolves
66
- * so it is safe to make additional updates to application state that would require UI synchronization:
67
- *
68
- * ```ts
69
- * const userData = await pendingTasks.run(() => fetch('/api/user'));
70
- * this.userData.set(userData);
71
- * ```
72
- *
73
71
  * @param fn The asynchronous function to execute
72
+ * @developerPreview 19.0
74
73
  */
75
- run<T>(fn: () => Promise<T>): Promise<T>;
74
+ run(fn: () => Promise<unknown>): void;
76
75
  /** @nocollapse */
77
76
  static ɵprov: unknown;
78
77
  }
@@ -6,5 +6,7 @@
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
8
  import type { ProviderToken } from '../di';
9
+ /** Called when directives inject each other (creating a circular dependency) */
10
+ export declare function throwCyclicDependencyError(token: string, path?: string[]): never;
9
11
  /** Throws an error when a token is not found in DI. */
10
12
  export declare function throwProviderNotFoundError(token: ProviderToken<unknown>, injectorName?: string): never;
@@ -5,7 +5,7 @@
5
5
  * Use of this source code is governed by an MIT-style license that can be
6
6
  * found in the LICENSE file at https://angular.dev/license
7
7
  */
8
- import { SIGNAL } from '@angular/core/primitives/signals';
8
+ import { SIGNAL } from '../../../primitives/signals';
9
9
  /**
10
10
  * A reactive value which notifies consumers of any changes.
11
11
  *
@@ -13,12 +13,16 @@ import { SIGNAL } from '@angular/core/primitives/signals';
13
13
  * call it.
14
14
  *
15
15
  * Ordinary values can be turned into `Signal`s with the `signal` function.
16
+ *
17
+ * @publicApi 17.0
16
18
  */
17
19
  export type Signal<T> = (() => T) & {
18
20
  [SIGNAL]: unknown;
19
21
  };
20
22
  /**
21
23
  * Checks if the given `value` is a reactive `Signal`.
24
+ *
25
+ * @publicApi 17.0
22
26
  */
23
27
  export declare function isSignal(value: unknown): value is Signal<unknown>;
24
28
  /**
@@ -7,7 +7,7 @@
7
7
  */
8
8
  /**
9
9
  * Asserts that the current stack frame is not within a reactive context. Useful
10
- * to disallow certain code from running inside a reactive context (see {@link toSignal}).
10
+ * to disallow certain code from running inside a reactive context (see {@link /api/core/rxjs/toSignal toSignal})
11
11
  *
12
12
  * @param debugFn a reference to the function making the assertion (used for the error message).
13
13
  *