static-injector 5.0.1 → 6.0.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.
- package/import/change_detection/scheduling/zoneless_scheduling.d.ts +37 -0
- package/import/change_detection/scheduling/zoneless_scheduling_impl.d.ts +16 -0
- package/import/core_reactivity_export_internal.d.ts +17 -0
- package/import/di/contextual.d.ts +36 -0
- package/{typings → import}/di/create_injector.d.ts +1 -1
- package/{typings → import}/di/forward_ref.d.ts +2 -2
- package/import/di/index.d.ts +3 -0
- package/{typings → import}/di/initializer_token.d.ts +8 -1
- package/{typings → import}/di/inject_switch.d.ts +2 -2
- package/{typings → import}/di/injectable.d.ts +4 -4
- package/{typings → import}/di/injection_token.d.ts +3 -4
- package/{typings → import}/di/injector.d.ts +4 -4
- package/{typings → import}/di/injector_compatibility.d.ts +1 -1
- package/{typings → import}/di/injector_marker.d.ts +1 -1
- package/{typings → import}/di/injector_token.d.ts +1 -1
- package/{typings → import}/di/interface/defs.d.ts +1 -1
- package/{typings → import}/di/interface/injector.d.ts +1 -1
- package/{typings → import}/di/interface/provider.d.ts +16 -18
- package/{typings → import}/di/internal_tokens.d.ts +1 -1
- package/{typings → import}/di/metadata.d.ts +9 -13
- package/{typings → import}/di/null_injector.d.ts +1 -1
- package/{typings → import}/di/provider_collection.d.ts +32 -4
- package/{typings → import}/di/provider_token.d.ts +1 -1
- package/{typings → import}/di/r3_injector.d.ts +2 -2
- package/{typings → import}/di/scope.d.ts +1 -1
- package/{typings → import}/di.d.ts +1 -1
- package/import/error_handler.d.ts +45 -0
- package/{typings → import}/errors.d.ts +13 -7
- package/import/index.d.ts +37 -0
- package/{typings → import}/interface/lifecycle_hooks.d.ts +2 -2
- package/{typings → import}/interface/type.d.ts +4 -9
- package/import/linker/destroy_ref.d.ts +44 -0
- package/import/pending_tasks.d.ts +78 -0
- package/{typings → import}/render3/definition_factory.d.ts +1 -1
- package/{typings → import}/render3/errors_di.d.ts +1 -1
- package/{typings → import}/render3/fields.d.ts +1 -1
- package/{typings → import}/render3/instructions/di.d.ts +1 -1
- package/import/render3/reactivity/api.d.ts +27 -0
- package/import/render3/reactivity/asserts.d.ts +16 -0
- package/import/render3/reactivity/computed.d.ts +25 -0
- package/import/render3/reactivity/effect.d.ts +121 -0
- package/import/render3/reactivity/linked_signal.d.ts +33 -0
- package/import/render3/reactivity/microtask_effect.d.ts +21 -0
- package/import/render3/reactivity/patch.d.ts +11 -0
- package/import/render3/reactivity/root_effect_scheduler.d.ts +54 -0
- package/import/render3/reactivity/signal.d.ts +61 -0
- package/import/render3/reactivity/untracked.d.ts +12 -0
- package/import/resource/api.d.ts +219 -0
- package/{es2022/di/injectable.js → import/resource/index.d.ts} +3 -2
- package/import/resource/resource.d.ts +89 -0
- package/import/util/callback_scheduler.d.ts +35 -0
- package/{typings → import}/util/closure.d.ts +1 -1
- package/{typings → import}/util/decorators.d.ts +3 -3
- package/{typings → import}/util/empty.d.ts +1 -1
- package/{es2022/di/provider_token.js → import/util/noop.d.ts} +2 -2
- package/{typings → import}/util/property.d.ts +1 -1
- package/{typings → import}/util/stringify.d.ts +1 -1
- package/index.js +2349 -0
- package/index.js.map +7 -0
- package/index.mjs +2258 -0
- package/index.mjs.map +7 -0
- package/package.json +19 -10
- package/primitives/signals/index.d.ts +15 -0
- package/primitives/signals/src/computed.d.ts +55 -0
- package/primitives/signals/src/equality.d.ts +15 -0
- package/primitives/signals/src/errors.d.ts +10 -0
- package/primitives/signals/src/graph.d.ts +182 -0
- package/primitives/signals/src/linked_signal.d.ts +72 -0
- package/primitives/signals/src/signal.d.ts +29 -0
- package/primitives/signals/src/watch.d.ts +43 -0
- package/{es2022/di/injector_marker.js → primitives/signals/src/weak_ref.d.ts} +2 -2
- package/readme.md +18 -14
- package/commonjs/index.js +0 -1576
- package/es2022/di/create_injector.js +0 -32
- package/es2022/di/forward_ref.js +0 -80
- package/es2022/di/index.js +0 -1
- package/es2022/di/initializer_token.js +0 -15
- package/es2022/di/inject_switch.js +0 -51
- package/es2022/di/injection_token.js +0 -93
- package/es2022/di/injector.js +0 -60
- package/es2022/di/injector_compatibility.js +0 -265
- package/es2022/di/injector_token.js +0 -20
- package/es2022/di/interface/defs.js +0 -110
- package/es2022/di/interface/injector.js +0 -26
- package/es2022/di/interface/provider.js +0 -10
- package/es2022/di/internal_tokens.js +0 -9
- package/es2022/di/metadata.js +0 -49
- package/es2022/di/null_injector.js +0 -19
- package/es2022/di/provider_collection.js +0 -104
- package/es2022/di/r3_injector.js +0 -449
- package/es2022/di/scope.js +0 -14
- package/es2022/di.js +0 -24
- package/es2022/errors.js +0 -44
- package/es2022/index.js +0 -11
- package/es2022/interface/lifecycle_hooks.js +0 -8
- package/es2022/interface/type.js +0 -21
- package/es2022/render3/definition_factory.js +0 -10
- package/es2022/render3/errors_di.js +0 -13
- package/es2022/render3/fields.js +0 -22
- package/es2022/render3/instructions/di.js +0 -23
- package/es2022/render3/util/stringify_utils.js +0 -38
- package/es2022/util/closure.js +0 -19
- package/es2022/util/decorators.js +0 -31
- package/es2022/util/empty.js +0 -18
- package/es2022/util/property.js +0 -15
- package/es2022/util/stringify.js +0 -45
- package/fesm2022/index.js +0 -1539
- package/typings/di/index.d.ts +0 -1
- package/typings/index.d.ts +0 -11
- package/typings/render3/util/stringify_utils.d.ts +0 -21
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { InjectionToken } from '../../di/injection_token';
|
|
9
|
+
export declare const enum NotificationSource {
|
|
10
|
+
MarkAncestorsForTraversal = 0,
|
|
11
|
+
SetInput = 1,
|
|
12
|
+
DeferBlockStateUpdate = 2,
|
|
13
|
+
DebugApplyChanges = 3,
|
|
14
|
+
MarkForCheck = 4,
|
|
15
|
+
Listener = 5,
|
|
16
|
+
CustomElement = 6,
|
|
17
|
+
RenderHook = 7,
|
|
18
|
+
ViewAttached = 8,
|
|
19
|
+
ViewDetachedFromDOM = 9,
|
|
20
|
+
AsyncAnimationsLoaded = 10,
|
|
21
|
+
PendingTaskRemoved = 11,
|
|
22
|
+
RootEffect = 12,
|
|
23
|
+
ViewEffect = 13
|
|
24
|
+
}
|
|
25
|
+
/**
|
|
26
|
+
* Injectable that is notified when an `LView` is made aware of changes to application state.
|
|
27
|
+
*/
|
|
28
|
+
export declare abstract class ChangeDetectionScheduler {
|
|
29
|
+
abstract notify(source: NotificationSource): void;
|
|
30
|
+
abstract runningTick: boolean;
|
|
31
|
+
}
|
|
32
|
+
/** Token used to indicate if zoneless was enabled via provideZonelessChangeDetection(). */
|
|
33
|
+
export declare const ZONELESS_ENABLED: InjectionToken<boolean>;
|
|
34
|
+
/** Token used to indicate `provideExperimentalZonelessChangeDetection` was used. */
|
|
35
|
+
export declare const PROVIDED_ZONELESS: InjectionToken<boolean>;
|
|
36
|
+
export declare const ZONELESS_SCHEDULER_DISABLED: InjectionToken<boolean>;
|
|
37
|
+
export declare const SCHEDULE_IN_ROOT_ZONE: InjectionToken<boolean>;
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import { ChangeDetectionScheduler, NotificationSource } from './zoneless_scheduling';
|
|
9
|
+
export declare class ChangeDetectionSchedulerImpl implements ChangeDetectionScheduler {
|
|
10
|
+
#private;
|
|
11
|
+
runningTick: boolean;
|
|
12
|
+
private cancelScheduledCallback;
|
|
13
|
+
notify(source: NotificationSource): void;
|
|
14
|
+
private cleanup;
|
|
15
|
+
ngOnDestroy(): void;
|
|
16
|
+
}
|
|
@@ -0,0 +1,17 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
export { SIGNAL as ɵSIGNAL } from '@angular/core/primitives/signals';
|
|
9
|
+
export { isSignal, Signal, ValueEqualityFn } from './render3/reactivity/api';
|
|
10
|
+
export { computed, CreateComputedOptions } from './render3/reactivity/computed';
|
|
11
|
+
export { CreateSignalOptions, signal, WritableSignal, ɵunwrapWritableSignal, } from './render3/reactivity/signal';
|
|
12
|
+
export { linkedSignal } from './render3/reactivity/linked_signal';
|
|
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';
|
|
16
|
+
export { EffectScheduler as ɵEffectScheduler } from './render3/reactivity/root_effect_scheduler';
|
|
17
|
+
export { assertNotInReactiveContext } from './render3/reactivity/asserts';
|
|
@@ -0,0 +1,36 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* @license
|
|
3
|
+
* Copyright Google LLC All Rights Reserved.
|
|
4
|
+
*
|
|
5
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
|
+
*/
|
|
8
|
+
import type { Injector } from './injector';
|
|
9
|
+
/**
|
|
10
|
+
* Runs the given function in the [context](guide/di/dependency-injection-context) of the given
|
|
11
|
+
* `Injector`.
|
|
12
|
+
*
|
|
13
|
+
* Within the function's stack frame, [`inject`](api/core/inject) can be used to inject dependencies
|
|
14
|
+
* from the given `Injector`. Note that `inject` is only usable synchronously, and cannot be used in
|
|
15
|
+
* any asynchronous callbacks or after any `await` points.
|
|
16
|
+
*
|
|
17
|
+
* @param injector the injector which will satisfy calls to [`inject`](api/core/inject) while `fn`
|
|
18
|
+
* is executing
|
|
19
|
+
* @param fn the closure to be run in the context of `injector`
|
|
20
|
+
* @returns the return value of the function, if any
|
|
21
|
+
* @publicApi
|
|
22
|
+
*/
|
|
23
|
+
export declare function runInInjectionContext<ReturnT>(injector: Injector, fn: () => ReturnT): ReturnT;
|
|
24
|
+
/**
|
|
25
|
+
* Whether the current stack frame is inside an injection context.
|
|
26
|
+
*/
|
|
27
|
+
export declare function isInInjectionContext(): boolean;
|
|
28
|
+
/**
|
|
29
|
+
* Asserts that the current stack frame is within an [injection
|
|
30
|
+
* context](guide/di/dependency-injection-context) and has access to `inject`.
|
|
31
|
+
*
|
|
32
|
+
* @param debugFn a reference to the function making the assertion (used for the error message).
|
|
33
|
+
*
|
|
34
|
+
* @publicApi
|
|
35
|
+
*/
|
|
36
|
+
export declare function assertInInjectionContext(debugFn: Function): void;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Injector } from './injector';
|
|
9
9
|
import type { Provider, StaticProvider } from './interface/provider';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Type } from '../interface/type';
|
|
9
9
|
/**
|
|
@@ -32,7 +32,7 @@ export interface ForwardRefFn {
|
|
|
32
32
|
* {@example core/di/ts/forward_ref/forward_ref_spec.ts region='forward_ref'}
|
|
33
33
|
*
|
|
34
34
|
* ### Circular standalone reference import example
|
|
35
|
-
* ```ts
|
|
35
|
+
* ```angular-ts
|
|
36
36
|
* @Component({
|
|
37
37
|
* standalone: true,
|
|
38
38
|
* imports: [ChildComponent],
|
|
@@ -3,13 +3,20 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { InjectionToken } from './injection_token';
|
|
9
9
|
/**
|
|
10
10
|
* A multi-provider token for initialization functions that will run upon construction of an
|
|
11
11
|
* environment injector.
|
|
12
12
|
*
|
|
13
|
+
* @deprecated from v19.0.0, use provideEnvironmentInitializer instead
|
|
14
|
+
*
|
|
15
|
+
* @see {@link provideEnvironmentInitializer}
|
|
16
|
+
*
|
|
17
|
+
* Note: As opposed to the `APP_INITIALIZER` token, the `ENVIRONMENT_INITIALIZER` functions are not awaited,
|
|
18
|
+
* hence they should not be `async`.
|
|
19
|
+
*
|
|
13
20
|
* @publicApi
|
|
14
21
|
*/
|
|
15
22
|
export declare const ENVIRONMENT_INITIALIZER: InjectionToken<readonly (() => void)[]>;
|
|
@@ -3,11 +3,11 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { InjectFlags } from './interface/injector';
|
|
9
9
|
import { ProviderToken } from './provider_token';
|
|
10
|
-
export declare function getInjectImplementation(): (<T>(token: ProviderToken<T>, flags?: InjectFlags
|
|
10
|
+
export declare function getInjectImplementation(): (<T>(token: ProviderToken<T>, flags?: InjectFlags) => T | null) | undefined;
|
|
11
11
|
/**
|
|
12
12
|
* Sets the current inject implementation.
|
|
13
13
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Type } from '../interface/type';
|
|
9
9
|
import { TypeDecorator } from '../util/decorators';
|
|
@@ -24,8 +24,8 @@ export interface InjectableDecorator {
|
|
|
24
24
|
* Decorator that marks a class as available to be
|
|
25
25
|
* provided and injected as a dependency.
|
|
26
26
|
*
|
|
27
|
-
* @see [Introduction to Services and DI](guide/
|
|
28
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
27
|
+
* @see [Introduction to Services and DI](guide/di)
|
|
28
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection
|
|
29
29
|
*
|
|
30
30
|
* @usageNotes
|
|
31
31
|
*
|
|
@@ -36,7 +36,7 @@ export interface InjectableDecorator {
|
|
|
36
36
|
* The following example shows how a service class is properly
|
|
37
37
|
* marked so that a supporting service can be injected upon creation.
|
|
38
38
|
*
|
|
39
|
-
*
|
|
39
|
+
* {@example core/di/ts/metadata_spec.ts region='Injectable'}
|
|
40
40
|
*
|
|
41
41
|
*/
|
|
42
42
|
(): TypeDecorator;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Type } from '../interface/type';
|
|
9
9
|
/**
|
|
@@ -16,7 +16,7 @@ import { Type } from '../interface/type';
|
|
|
16
16
|
* `InjectionToken` is parameterized on `T` which is the type of object which will be returned by
|
|
17
17
|
* the `Injector`. This provides an additional level of type safety.
|
|
18
18
|
*
|
|
19
|
-
* <div class="alert
|
|
19
|
+
* <div class="docs-alert docs-alert-helpful">
|
|
20
20
|
*
|
|
21
21
|
* **Important Note**: Ensure that you use the same instance of the `InjectionToken` in both the
|
|
22
22
|
* provider and the injection call. Creating a new instance of `InjectionToken` in different places,
|
|
@@ -25,8 +25,7 @@ import { Type } from '../interface/type';
|
|
|
25
25
|
*
|
|
26
26
|
* </div>
|
|
27
27
|
*
|
|
28
|
-
*
|
|
29
|
-
* region="InjectionToken"></code-example>
|
|
28
|
+
* {@example injection-token/src/main.ts region='InjectionToken'}
|
|
30
29
|
*
|
|
31
30
|
* When creating an `InjectionToken`, you can optionally specify a factory function which returns
|
|
32
31
|
* (possibly by creating) a default value of the parameterized type `T`. This sets up the
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { InjectorMarkers } from './injector_marker';
|
|
9
9
|
import { InjectFlags, InjectOptions } from './interface/injector';
|
|
@@ -11,10 +11,10 @@ import { Provider, StaticProvider } from './interface/provider';
|
|
|
11
11
|
import { ProviderToken } from './provider_token';
|
|
12
12
|
/**
|
|
13
13
|
* Concrete injectors implement this interface. Injectors are configured
|
|
14
|
-
* with [providers](guide/dependency-injection-providers) that associate
|
|
15
|
-
* dependencies of various types with [injection tokens](guide/dependency-injection-providers).
|
|
14
|
+
* with [providers](guide/di/dependency-injection-providers) that associate
|
|
15
|
+
* dependencies of various types with [injection tokens](guide/di/dependency-injection-providers).
|
|
16
16
|
*
|
|
17
|
-
* @see [DI Providers](guide/dependency-injection-providers).
|
|
17
|
+
* @see [DI Providers](guide/di/dependency-injection-providers).
|
|
18
18
|
* @see {@link StaticProvider}
|
|
19
19
|
*
|
|
20
20
|
* @usageNotes
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Injector } from './injector';
|
|
9
9
|
import { DecoratorFlags, InjectFlags, InjectOptions, InternalInjectFlags } from './interface/injector';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Special markers which can be left on `Type.__NG_ELEMENT_ID__` which are used by the Ivy's
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { InjectionToken } from './injection_token';
|
|
9
9
|
import type { Injector } from './injector';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Type } from '../../interface/type';
|
|
9
9
|
import { ClassProvider, ConstructorProvider, EnvironmentProviders, ExistingProvider, FactoryProvider, StaticClassProvider, ValueProvider } from './provider';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Special flag indicating that a decorator is of type `Inject`. It's used to make `Inject`
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Type } from '../../interface/type';
|
|
9
9
|
/**
|
|
@@ -20,7 +20,7 @@ export interface ValueSansProvider {
|
|
|
20
20
|
}
|
|
21
21
|
/**
|
|
22
22
|
* Configures the `Injector` to return a value for a token.
|
|
23
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
23
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
24
24
|
*
|
|
25
25
|
* @usageNotes
|
|
26
26
|
*
|
|
@@ -65,7 +65,7 @@ export interface StaticClassSansProvider {
|
|
|
65
65
|
}
|
|
66
66
|
/**
|
|
67
67
|
* Configures the `Injector` to return an instance of `useClass` for a token.
|
|
68
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
68
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
69
69
|
*
|
|
70
70
|
* @usageNotes
|
|
71
71
|
*
|
|
@@ -95,7 +95,7 @@ export interface StaticClassProvider extends StaticClassSansProvider {
|
|
|
95
95
|
/**
|
|
96
96
|
* Configures the `Injector` to return an instance of a token.
|
|
97
97
|
*
|
|
98
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
98
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
99
99
|
*
|
|
100
100
|
* @usageNotes
|
|
101
101
|
*
|
|
@@ -115,7 +115,7 @@ export interface ConstructorSansProvider {
|
|
|
115
115
|
/**
|
|
116
116
|
* Configures the `Injector` to return an instance of a token.
|
|
117
117
|
*
|
|
118
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
118
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
119
119
|
*
|
|
120
120
|
* @usageNotes
|
|
121
121
|
*
|
|
@@ -142,7 +142,7 @@ export interface ConstructorProvider extends ConstructorSansProvider {
|
|
|
142
142
|
* Configures the `Injector` to return a value of another `useExisting` token.
|
|
143
143
|
*
|
|
144
144
|
* @see {@link ExistingProvider}
|
|
145
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
145
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
146
146
|
*
|
|
147
147
|
* @publicApi
|
|
148
148
|
*/
|
|
@@ -155,7 +155,7 @@ export interface ExistingSansProvider {
|
|
|
155
155
|
/**
|
|
156
156
|
* Configures the `Injector` to return a value of another `useExisting` token.
|
|
157
157
|
*
|
|
158
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
158
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
159
159
|
*
|
|
160
160
|
* @usageNotes
|
|
161
161
|
*
|
|
@@ -182,7 +182,7 @@ export interface ExistingProvider extends ExistingSansProvider {
|
|
|
182
182
|
* Configures the `Injector` to return a value by invoking a `useFactory` function.
|
|
183
183
|
*
|
|
184
184
|
* @see {@link FactoryProvider}
|
|
185
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
185
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
186
186
|
*
|
|
187
187
|
* @publicApi
|
|
188
188
|
*/
|
|
@@ -200,7 +200,7 @@ export interface FactorySansProvider {
|
|
|
200
200
|
}
|
|
201
201
|
/**
|
|
202
202
|
* Configures the `Injector` to return a value by invoking a `useFactory` function.
|
|
203
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
203
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
204
204
|
*
|
|
205
205
|
* @usageNotes
|
|
206
206
|
*
|
|
@@ -232,7 +232,7 @@ export interface FactoryProvider extends FactorySansProvider {
|
|
|
232
232
|
* A static provider provides tokens to an injector for various types of dependencies.
|
|
233
233
|
*
|
|
234
234
|
* @see {@link Injector.create()}
|
|
235
|
-
* @see [Dependency Injection Guide](guide/dependency-injection-providers).
|
|
235
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection-providers).
|
|
236
236
|
*
|
|
237
237
|
* @publicApi
|
|
238
238
|
*/
|
|
@@ -243,7 +243,7 @@ export type StaticProvider = ValueProvider | ExistingProvider | StaticClassProvi
|
|
|
243
243
|
* Create an instance by invoking the `new` operator and supplying additional arguments.
|
|
244
244
|
* This form is a short form of `TypeProvider`;
|
|
245
245
|
*
|
|
246
|
-
* For more details, see the ["Dependency Injection Guide"](guide/dependency-injection
|
|
246
|
+
* For more details, see the ["Dependency Injection Guide"](guide/di/dependency-injection.
|
|
247
247
|
*
|
|
248
248
|
* @usageNotes
|
|
249
249
|
*
|
|
@@ -257,7 +257,7 @@ export interface TypeProvider extends Type<any> {
|
|
|
257
257
|
* Configures the `Injector` to return a value by invoking a `useClass` function.
|
|
258
258
|
* Base for `ClassProvider` decorator.
|
|
259
259
|
*
|
|
260
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
260
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
261
261
|
*
|
|
262
262
|
* @publicApi
|
|
263
263
|
*/
|
|
@@ -269,7 +269,7 @@ export interface ClassSansProvider {
|
|
|
269
269
|
}
|
|
270
270
|
/**
|
|
271
271
|
* Configures the `Injector` to return an instance of `useClass` for a token.
|
|
272
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
272
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
273
273
|
*
|
|
274
274
|
* @usageNotes
|
|
275
275
|
*
|
|
@@ -298,7 +298,7 @@ export interface ClassProvider extends ClassSansProvider {
|
|
|
298
298
|
}
|
|
299
299
|
/**
|
|
300
300
|
* Describes how the `Injector` should be configured.
|
|
301
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
301
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
302
302
|
*
|
|
303
303
|
* @see {@link StaticProvider}
|
|
304
304
|
*
|
|
@@ -339,10 +339,8 @@ export declare function isEnvironmentProviders(value: Provider | EnvironmentProv
|
|
|
339
339
|
*/
|
|
340
340
|
export type ProcessProvidersFunction = (providers: Provider[]) => Provider[];
|
|
341
341
|
/**
|
|
342
|
-
* A wrapper around an NgModule that associates it with
|
|
343
|
-
*
|
|
344
|
-
*
|
|
345
|
-
* @see [Deprecations](guide/deprecations#modulewithproviders-type-without-a-generic)
|
|
342
|
+
* A wrapper around an NgModule that associates it with providers
|
|
343
|
+
* Usage without a generic type is deprecated.
|
|
346
344
|
*
|
|
347
345
|
* @publicApi
|
|
348
346
|
*/
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Type } from '../interface/type';
|
|
9
9
|
import { InjectionToken } from './injection_token';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* Type of the Inject decorator / constructor function.
|
|
@@ -22,10 +22,9 @@ export interface InjectDecorator {
|
|
|
22
22
|
* When `@Inject()` is not present, the injector uses the type annotation of the
|
|
23
23
|
* parameter as the provider.
|
|
24
24
|
*
|
|
25
|
-
*
|
|
26
|
-
* </code-example>
|
|
25
|
+
* {@example core/di/ts/metadata_spec.ts region='InjectWithoutDecorator'}
|
|
27
26
|
*
|
|
28
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
27
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection
|
|
29
28
|
*
|
|
30
29
|
*/
|
|
31
30
|
(token: any): any;
|
|
@@ -38,7 +37,7 @@ export interface InjectDecorator {
|
|
|
38
37
|
*/
|
|
39
38
|
export interface Inject {
|
|
40
39
|
/**
|
|
41
|
-
* A
|
|
40
|
+
* A DI token that maps to the dependency to be injected.
|
|
42
41
|
*/
|
|
43
42
|
token: any;
|
|
44
43
|
}
|
|
@@ -67,10 +66,9 @@ export interface OptionalDecorator {
|
|
|
67
66
|
*
|
|
68
67
|
* The following code allows the possibility of a `null` result:
|
|
69
68
|
*
|
|
70
|
-
*
|
|
71
|
-
* </code-example>
|
|
69
|
+
* {@example core/di/ts/metadata_spec.ts region='Optional'}
|
|
72
70
|
*
|
|
73
|
-
* @see [Dependency Injection Guide](guide/dependency-injection
|
|
71
|
+
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
74
72
|
*/
|
|
75
73
|
(): any;
|
|
76
74
|
new (): Optional;
|
|
@@ -108,8 +106,7 @@ export interface SelfDecorator {
|
|
|
108
106
|
* by the local injector when instantiating the class itself, but not
|
|
109
107
|
* when instantiating a child.
|
|
110
108
|
*
|
|
111
|
-
*
|
|
112
|
-
* </code-example>
|
|
109
|
+
* {@example core/di/ts/metadata_spec.ts region='Self'}
|
|
113
110
|
*
|
|
114
111
|
* @see {@link SkipSelf}
|
|
115
112
|
* @see {@link Optional}
|
|
@@ -149,10 +146,9 @@ export interface SkipSelfDecorator {
|
|
|
149
146
|
* In the following example, the dependency can be resolved when
|
|
150
147
|
* instantiating a child, but not when instantiating the class itself.
|
|
151
148
|
*
|
|
152
|
-
*
|
|
153
|
-
* </code-example>
|
|
149
|
+
* {@example core/di/ts/metadata_spec.ts region='SkipSelf'}
|
|
154
150
|
*
|
|
155
|
-
* @see [Dependency Injection guide](guide/
|
|
151
|
+
* @see [Dependency Injection guide](guide/di/di-in-action#skip).
|
|
156
152
|
* @see {@link Self}
|
|
157
153
|
* @see {@link Optional}
|
|
158
154
|
*
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Injector } from './injector';
|
|
9
9
|
export declare class NullInjector implements Injector {
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { Type } from '../interface/type';
|
|
9
9
|
import { ClassProvider, ConstructorProvider, EnvironmentProviders, ExistingProvider, FactoryProvider, ModuleWithProviders, Provider, StaticClassProvider, TypeProvider, ValueProvider } from './interface/provider';
|
|
@@ -12,6 +12,34 @@ import { ClassProvider, ConstructorProvider, EnvironmentProviders, ExistingProvi
|
|
|
12
12
|
* referenced in `@Component` in a component injector.
|
|
13
13
|
*/
|
|
14
14
|
export declare function makeEnvironmentProviders(providers: (Provider | EnvironmentProviders)[]): EnvironmentProviders;
|
|
15
|
+
/**
|
|
16
|
+
* @description
|
|
17
|
+
* This function is used to provide initialization functions that will be executed upon construction
|
|
18
|
+
* of an environment injector.
|
|
19
|
+
*
|
|
20
|
+
* Note that the provided initializer is run in the injection context.
|
|
21
|
+
*
|
|
22
|
+
* Previously, this was achieved using the `ENVIRONMENT_INITIALIZER` token which is now deprecated.
|
|
23
|
+
*
|
|
24
|
+
* @see {@link ENVIRONMENT_INITIALIZER}
|
|
25
|
+
*
|
|
26
|
+
* @usageNotes
|
|
27
|
+
* The following example illustrates how to configure an initialization function using
|
|
28
|
+
* `provideEnvironmentInitializer()`
|
|
29
|
+
* ```ts
|
|
30
|
+
* createEnvironmentInjector(
|
|
31
|
+
* [
|
|
32
|
+
* provideEnvironmentInitializer(() => {
|
|
33
|
+
* console.log('environment initialized');
|
|
34
|
+
* }),
|
|
35
|
+
* ],
|
|
36
|
+
* parentInjector
|
|
37
|
+
* );
|
|
38
|
+
* ```
|
|
39
|
+
*
|
|
40
|
+
* @publicApi
|
|
41
|
+
*/
|
|
42
|
+
export declare function provideEnvironmentInitializer(initializerFn: () => void): EnvironmentProviders;
|
|
15
43
|
/**
|
|
16
44
|
* A source of providers for the `importProvidersFrom` function.
|
|
17
45
|
*
|
|
@@ -27,12 +55,12 @@ export type ImportProvidersSource = Type<unknown> | ModuleWithProviders<unknown>
|
|
|
27
55
|
* providers.
|
|
28
56
|
*
|
|
29
57
|
* More information about standalone components can be found in [this
|
|
30
|
-
* guide](guide/
|
|
58
|
+
* guide](guide/components/importing).
|
|
31
59
|
*
|
|
32
60
|
* @usageNotes
|
|
33
61
|
* The results of the `importProvidersFrom` call can be used in the `bootstrapApplication` call:
|
|
34
62
|
*
|
|
35
|
-
* ```
|
|
63
|
+
* ```ts
|
|
36
64
|
* await bootstrapApplication(RootComponent, {
|
|
37
65
|
* providers: [
|
|
38
66
|
* importProvidersFrom(NgModuleOne, NgModuleTwo)
|
|
@@ -43,7 +71,7 @@ export type ImportProvidersSource = Type<unknown> | ModuleWithProviders<unknown>
|
|
|
43
71
|
* You can also use the `importProvidersFrom` results in the `providers` field of a route, when a
|
|
44
72
|
* standalone component is used:
|
|
45
73
|
*
|
|
46
|
-
* ```
|
|
74
|
+
* ```ts
|
|
47
75
|
* export const ROUTES: Route[] = [
|
|
48
76
|
* {
|
|
49
77
|
* path: 'foo',
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { AbstractType, Type } from '../interface/type';
|
|
9
9
|
import { InjectionToken } from './injection_token';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import type { Injector } from './injector';
|
|
9
9
|
import { InjectorType } from './interface/defs';
|
|
@@ -103,7 +103,6 @@ export declare class R3Injector extends EnvironmentInjector {
|
|
|
103
103
|
/** @internal */
|
|
104
104
|
resolveInjectorInitializers(): void;
|
|
105
105
|
toString(): string;
|
|
106
|
-
assertNotDestroyed(): void;
|
|
107
106
|
/**
|
|
108
107
|
* Process a `SingleProvider` and add it.
|
|
109
108
|
*/
|
|
@@ -118,3 +117,4 @@ export declare class R3Injector extends EnvironmentInjector {
|
|
|
118
117
|
* @param provider provider to convert to factory
|
|
119
118
|
*/
|
|
120
119
|
export declare function providerToFactory(provider: SingleProvider, ngModuleType?: InjectorType<any>, providers?: any[]): () => any;
|
|
120
|
+
export declare function assertNotDestroyed(injector: R3Injector): void;
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
import { InjectionToken } from './injection_token';
|
|
9
9
|
export type InjectorScope = 'root' | 'platform' | 'environment';
|
|
@@ -3,7 +3,7 @@
|
|
|
3
3
|
* Copyright Google LLC All Rights Reserved.
|
|
4
4
|
*
|
|
5
5
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6
|
-
* found in the LICENSE file at https://angular.
|
|
6
|
+
* found in the LICENSE file at https://angular.dev/license
|
|
7
7
|
*/
|
|
8
8
|
/**
|
|
9
9
|
* This file should not be necessary because node resolution should just default to `./di/index`!
|