static-injector 5.0.2 → 6.0.1
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 +2 -2
- package/{typings → import}/di/injection_token.d.ts +3 -4
- package/{typings → import}/di/injector.d.ts +1 -1
- 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 +1 -1
- package/{typings → import}/di/internal_tokens.d.ts +1 -1
- package/{typings → import}/di/metadata.d.ts +5 -9
- package/{typings → import}/di/null_injector.d.ts +1 -1
- package/{typings → import}/di/provider_collection.d.ts +31 -3
- 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 +9 -7
- package/import/index.d.ts +37 -0
- package/{typings → import}/interface/lifecycle_hooks.d.ts +1 -1
- 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 +22 -11
- 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 +19 -15
- package/commonjs/index.js +0 -1586
- 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 -48
- 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 -19
- 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 -1547
- package/typings/di/index.d.ts +0 -1
- package/typings/index.d.ts +0 -18
- 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';
|
|
@@ -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';
|
|
@@ -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
|
/**
|
|
@@ -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,8 +22,7 @@ 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
27
|
* @see [Dependency Injection Guide](guide/di/dependency-injection
|
|
29
28
|
*
|
|
@@ -67,8 +66,7 @@ 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
71
|
* @see [Dependency Injection Guide](guide/di/dependency-injection.
|
|
74
72
|
*/
|
|
@@ -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,8 +146,7 @@ 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
151
|
* @see [Dependency Injection guide](guide/di/di-in-action#skip).
|
|
156
152
|
* @see {@link Self}
|
|
@@ -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
|
*
|
|
@@ -32,7 +60,7 @@ export type ImportProvidersSource = Type<unknown> | ModuleWithProviders<unknown>
|
|
|
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`!
|
|
@@ -0,0 +1,45 @@
|
|
|
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
|
+
/**
|
|
9
|
+
* Provides a hook for centralized exception handling.
|
|
10
|
+
*
|
|
11
|
+
* The default implementation of `ErrorHandler` prints error messages to the `console`. To
|
|
12
|
+
* intercept error handling, write a custom exception handler that replaces this default as
|
|
13
|
+
* appropriate for your app.
|
|
14
|
+
*
|
|
15
|
+
* @usageNotes
|
|
16
|
+
* ### Example
|
|
17
|
+
*
|
|
18
|
+
* ```ts
|
|
19
|
+
* class MyErrorHandler implements ErrorHandler {
|
|
20
|
+
* handleError(error) {
|
|
21
|
+
* // do something with the exception
|
|
22
|
+
* }
|
|
23
|
+
* }
|
|
24
|
+
*
|
|
25
|
+
* // Provide in standalone apps
|
|
26
|
+
* bootstrapApplication(AppComponent, {
|
|
27
|
+
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
|
|
28
|
+
* })
|
|
29
|
+
*
|
|
30
|
+
* // Provide in module-based apps
|
|
31
|
+
* @NgModule({
|
|
32
|
+
* providers: [{provide: ErrorHandler, useClass: MyErrorHandler}]
|
|
33
|
+
* })
|
|
34
|
+
* class MyModule {}
|
|
35
|
+
* ```
|
|
36
|
+
*
|
|
37
|
+
* @publicApi
|
|
38
|
+
*/
|
|
39
|
+
export declare class ErrorHandler {
|
|
40
|
+
/**
|
|
41
|
+
* @internal
|
|
42
|
+
*/
|
|
43
|
+
_console: Console;
|
|
44
|
+
handleError(error: any): void;
|
|
45
|
+
}
|
|
@@ -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
|
* The list of error codes used in runtime code of the `core` package.
|
|
@@ -13,7 +13,7 @@
|
|
|
13
13
|
* angular.io. This extra annotation is needed to avoid introducing a separate set to store
|
|
14
14
|
* error codes which have guides, which might leak into runtime code.
|
|
15
15
|
*
|
|
16
|
-
* Full list of available error guides can be found at https://angular.
|
|
16
|
+
* Full list of available error guides can be found at https://angular.dev/errors.
|
|
17
17
|
*
|
|
18
18
|
* Error code ranges per package:
|
|
19
19
|
* - core (this package): 100-999
|
|
@@ -51,6 +51,7 @@ export declare const enum RuntimeErrorCode {
|
|
|
51
51
|
HOST_DIRECTIVE_UNDEFINED_BINDING = 311,
|
|
52
52
|
HOST_DIRECTIVE_CONFLICTING_ALIAS = 312,
|
|
53
53
|
MULTIPLE_MATCHING_PIPES = 313,
|
|
54
|
+
UNINITIALIZED_LET_ACCESS = 314,
|
|
54
55
|
MULTIPLE_PLATFORMS = 400,
|
|
55
56
|
PLATFORM_NOT_FOUND = 401,
|
|
56
57
|
MISSING_REQUIRED_INJECTABLE_IN_BOOTSTRAP = 402,
|
|
@@ -68,12 +69,13 @@ export declare const enum RuntimeErrorCode {
|
|
|
68
69
|
MISSING_HYDRATION_ANNOTATIONS = -505,
|
|
69
70
|
HYDRATION_STABLE_TIMEDOUT = -506,
|
|
70
71
|
MISSING_SSR_CONTENT_INTEGRITY_MARKER = -507,
|
|
72
|
+
MISCONFIGURED_INCREMENTAL_HYDRATION = 508,
|
|
71
73
|
SIGNAL_WRITE_FROM_ILLEGAL_CONTEXT = 600,
|
|
72
74
|
REQUIRE_SYNC_WITHOUT_SYNC_EMIT = 601,
|
|
73
75
|
ASSERTION_NOT_INSIDE_REACTIVE_CONTEXT = -602,
|
|
74
76
|
INVALID_I18N_STRUCTURE = 700,
|
|
75
77
|
MISSING_LOCALE_DATA = 701,
|
|
76
|
-
DEFER_LOADING_FAILED = 750,
|
|
78
|
+
DEFER_LOADING_FAILED = -750,
|
|
77
79
|
IMPORT_PROVIDERS_FROM_STANDALONE = 800,
|
|
78
80
|
INVALID_DIFFER_INPUT = 900,
|
|
79
81
|
NO_SUPPORTING_DIFFER_FACTORY = 901,
|
|
@@ -92,19 +94,19 @@ export declare const enum RuntimeErrorCode {
|
|
|
92
94
|
UNEXPECTED_ZONEJS_PRESENT_IN_ZONELESS_MODE = 914,
|
|
93
95
|
REQUIRED_INPUT_NO_VALUE = -950,
|
|
94
96
|
REQUIRED_QUERY_NO_VALUE = -951,
|
|
95
|
-
REQUIRED_MODEL_NO_VALUE =
|
|
97
|
+
REQUIRED_MODEL_NO_VALUE = 952,
|
|
96
98
|
OUTPUT_REF_DESTROYED = 953,
|
|
97
99
|
LOOP_TRACK_DUPLICATE_KEYS = -955,
|
|
98
100
|
LOOP_TRACK_RECREATE = -956,
|
|
99
|
-
RUNTIME_DEPS_INVALID_IMPORTED_TYPE =
|
|
100
|
-
RUNTIME_DEPS_ORPHAN_COMPONENT =
|
|
101
|
+
RUNTIME_DEPS_INVALID_IMPORTED_TYPE = 980,
|
|
102
|
+
RUNTIME_DEPS_ORPHAN_COMPONENT = 981
|
|
101
103
|
}
|
|
102
104
|
/**
|
|
103
105
|
* Class that represents a runtime error.
|
|
104
106
|
* Formats and outputs the error message in a consistent way.
|
|
105
107
|
*
|
|
106
108
|
* Example:
|
|
107
|
-
* ```
|
|
109
|
+
* ```ts
|
|
108
110
|
* throw new RuntimeError(
|
|
109
111
|
* RuntimeErrorCode.INJECTOR_ALREADY_DESTROYED,
|
|
110
112
|
* ngDevMode && 'Injector has already been destroyed.');
|
|
@@ -0,0 +1,37 @@
|
|
|
1
|
+
import type { InjectableDecorator } from './di/injectable';
|
|
2
|
+
import { Injector } from './di/injector';
|
|
3
|
+
import { EnvironmentProviders, Provider } from './di/interface/provider';
|
|
4
|
+
import { R3Injector } from './di/r3_injector';
|
|
5
|
+
import { InjectorScope } from './di/scope';
|
|
6
|
+
export * from './di/injectable';
|
|
7
|
+
export * from './di/metadata';
|
|
8
|
+
export * from './di/r3_injector';
|
|
9
|
+
export * from './di/interface/defs';
|
|
10
|
+
export * from './di/injector_compatibility';
|
|
11
|
+
export * from './di/injection_token';
|
|
12
|
+
export * from './di/null_injector';
|
|
13
|
+
export * from './di/injector';
|
|
14
|
+
export * from './di/interface/injector';
|
|
15
|
+
export * from './di/scope';
|
|
16
|
+
export * from './render3/instructions/di';
|
|
17
|
+
export * from './core_reactivity_export_internal';
|
|
18
|
+
export * from './change_detection/scheduling/zoneless_scheduling';
|
|
19
|
+
export * from './change_detection/scheduling/zoneless_scheduling_impl';
|
|
20
|
+
export * from './resource';
|
|
21
|
+
export declare class StaticInjectOptions {
|
|
22
|
+
static injectOptions: Parameters<InjectableDecorator>[0];
|
|
23
|
+
}
|
|
24
|
+
export declare class RootStaticInjectOptions {
|
|
25
|
+
static injectOptions: Parameters<InjectableDecorator>[0];
|
|
26
|
+
}
|
|
27
|
+
export declare function createInjector(options: {
|
|
28
|
+
providers: Array<Provider | EnvironmentProviders>;
|
|
29
|
+
parent: Injector;
|
|
30
|
+
name?: string;
|
|
31
|
+
scopes?: Set<InjectorScope>;
|
|
32
|
+
}): R3Injector;
|
|
33
|
+
export declare function createRootInjector(options: {
|
|
34
|
+
providers: Array<Provider | EnvironmentProviders>;
|
|
35
|
+
name?: string;
|
|
36
|
+
scopes?: Set<InjectorScope>;
|
|
37
|
+
}): R3Injector;
|
|
@@ -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
|
* A lifecycle hook that is called when a directive, pipe, or service is destroyed.
|