@angular/core 16.1.4 → 16.1.5
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/esm2022/rxjs-interop/src/take_until_destroyed.mjs +3 -3
- package/esm2022/rxjs-interop/src/to_observable.mjs +1 -1
- package/esm2022/rxjs-interop/src/to_signal.mjs +1 -1
- package/esm2022/src/di/contextual.mjs +10 -7
- package/esm2022/src/di/injection_token.mjs +2 -2
- package/esm2022/src/di/injector_compatibility.mjs +4 -3
- package/esm2022/src/di/interface/defs.mjs +3 -2
- package/esm2022/src/di/interface/injector.mjs +2 -2
- package/esm2022/src/di/provider_collection.mjs +2 -2
- package/esm2022/src/di/r3_injector.mjs +1 -1
- package/esm2022/src/errors.mjs +1 -1
- package/esm2022/src/linker/template_ref.mjs +1 -1
- package/esm2022/src/render3/assert.mjs +8 -3
- package/esm2022/src/render3/features/standalone_feature.mjs +4 -4
- package/esm2022/src/render3/pipe.mjs +26 -2
- package/esm2022/src/render3/reactivity/effect.mjs +1 -1
- package/esm2022/src/signals/src/graph.mjs +7 -3
- package/esm2022/src/version.mjs +1 -1
- package/esm2022/src/zone/ng_zone.mjs +10 -1
- package/esm2022/testing/src/logger.mjs +3 -3
- package/fesm2022/core.mjs +68 -21
- package/fesm2022/core.mjs.map +1 -1
- package/fesm2022/rxjs-interop.mjs +9 -5
- package/fesm2022/rxjs-interop.mjs.map +1 -1
- package/fesm2022/testing.mjs +59 -21
- package/fesm2022/testing.mjs.map +1 -1
- package/index.d.ts +33 -18
- package/package.json +1 -1
- package/rxjs-interop/index.d.ts +15 -12
- package/schematics/migrations/guard-and-resolve-interfaces/bundle.js +13 -13
- package/schematics/migrations/remove-module-id/bundle.js +14 -14
- package/schematics/ng-generate/standalone-migration/bundle.js +355 -355
- package/schematics/ng-generate/standalone-migration/bundle.js.map +2 -2
- package/testing/index.d.ts +1 -1
package/fesm2022/core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v16.1.
|
|
2
|
+
* @license Angular v16.1.5
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -358,7 +358,8 @@ function assertOneOf(value, ...validValues) {
|
|
|
358
358
|
* with an `@NgModule` or other `InjectorType`, or by specifying that this injectable should be
|
|
359
359
|
* provided in the `'root'` injector, which will be the application-level injector in most apps.
|
|
360
360
|
* * `factory` gives the zero argument function which will create an instance of the injectable.
|
|
361
|
-
* The factory can call `inject` to access the `Injector` and request injection
|
|
361
|
+
* The factory can call [`inject`](api/core/inject) to access the `Injector` and request injection
|
|
362
|
+
* of dependencies.
|
|
362
363
|
*
|
|
363
364
|
* @codeGenApi
|
|
364
365
|
* @publicApi This instruction has been emitted by ViewEngine for some time and is deployed to npm.
|
|
@@ -456,7 +457,7 @@ const NG_INJECTOR_DEF = getClosureSafeProperty({ ngInjectorDef: getClosureSafePr
|
|
|
456
457
|
* Injection flags for DI.
|
|
457
458
|
*
|
|
458
459
|
* @publicApi
|
|
459
|
-
* @deprecated use an options object for `inject` instead.
|
|
460
|
+
* @deprecated use an options object for [`inject`](api/core/inject) instead.
|
|
460
461
|
*/
|
|
461
462
|
var InjectFlags;
|
|
462
463
|
(function (InjectFlags) {
|
|
@@ -672,13 +673,14 @@ Please check that 1) the type for the parameter at index ${index} is correct and
|
|
|
672
673
|
}
|
|
673
674
|
/**
|
|
674
675
|
* Injects a token from the currently active injector.
|
|
675
|
-
* `inject` is only supported
|
|
676
|
-
* during:
|
|
676
|
+
* `inject` is only supported in a [injection context](/guide/dependency-injection-context). It can
|
|
677
|
+
* be used during:
|
|
677
678
|
* - Construction (via the `constructor`) of a class being instantiated by the DI system, such
|
|
678
679
|
* as an `@Injectable` or `@Component`.
|
|
679
680
|
* - In the initializer for fields of such classes.
|
|
680
681
|
* - In the factory function specified for `useFactory` of a `Provider` or an `@Injectable`.
|
|
681
682
|
* - In the `factory` function specified for an `InjectionToken`.
|
|
683
|
+
* - In a stackframe of a function call in a DI context
|
|
682
684
|
*
|
|
683
685
|
* @param token A token that represents a dependency that should be injected.
|
|
684
686
|
* @param flags Optional flags that control how injection is executed.
|
|
@@ -2086,8 +2088,13 @@ function assertTNodeForLView(tNode, lView) {
|
|
|
2086
2088
|
}
|
|
2087
2089
|
function assertTNodeForTView(tNode, tView) {
|
|
2088
2090
|
assertTNode(tNode);
|
|
2089
|
-
|
|
2090
|
-
|
|
2091
|
+
const tData = tView.data;
|
|
2092
|
+
for (let i = HEADER_OFFSET; i < tData.length; i++) {
|
|
2093
|
+
if (tData[i] === tNode) {
|
|
2094
|
+
return;
|
|
2095
|
+
}
|
|
2096
|
+
}
|
|
2097
|
+
throwError('This TNode does not belong to this TView.');
|
|
2091
2098
|
}
|
|
2092
2099
|
function assertTNode(tNode) {
|
|
2093
2100
|
assertDefined(tNode, 'TNode must be defined');
|
|
@@ -2348,7 +2355,9 @@ class ReactiveNode {
|
|
|
2348
2355
|
consumerPollProducersForChange() {
|
|
2349
2356
|
for (const [producerId, edge] of this.producers) {
|
|
2350
2357
|
const producer = edge.producerNode.deref();
|
|
2351
|
-
|
|
2358
|
+
// On Safari < 16.1 deref can return null, we need to check for null also.
|
|
2359
|
+
// See https://github.com/WebKit/WebKit/commit/44c15ba58912faab38b534fef909dd9e13e095e0
|
|
2360
|
+
if (producer == null || edge.atTrackingVersion !== this.trackingVersion) {
|
|
2352
2361
|
// This dependency edge is stale, so remove it.
|
|
2353
2362
|
this.producers.delete(producerId);
|
|
2354
2363
|
producer?.consumers.delete(this.id);
|
|
@@ -2373,7 +2382,9 @@ class ReactiveNode {
|
|
|
2373
2382
|
try {
|
|
2374
2383
|
for (const [consumerId, edge] of this.consumers) {
|
|
2375
2384
|
const consumer = edge.consumerNode.deref();
|
|
2376
|
-
|
|
2385
|
+
// On Safari < 16.1 deref can return null, we need to check for null also.
|
|
2386
|
+
// See https://github.com/WebKit/WebKit/commit/44c15ba58912faab38b534fef909dd9e13e095e0
|
|
2387
|
+
if (consumer == null || consumer.trackingVersion !== edge.atTrackingVersion) {
|
|
2377
2388
|
this.consumers.delete(consumerId);
|
|
2378
2389
|
consumer?.producers.delete(this.id);
|
|
2379
2390
|
continue;
|
|
@@ -8669,7 +8680,7 @@ function getSanitizer() {
|
|
|
8669
8680
|
* (possibly by creating) a default value of the parameterized type `T`. This sets up the
|
|
8670
8681
|
* `InjectionToken` using this factory as a provider as if it was defined explicitly in the
|
|
8671
8682
|
* application's root injector. If the factory function, which takes zero arguments, needs to inject
|
|
8672
|
-
* dependencies, it can do so using the `inject` function.
|
|
8683
|
+
* dependencies, it can do so using the [`inject`](api/core/inject) function.
|
|
8673
8684
|
* As you can see in the Tree-shakable InjectionToken example below.
|
|
8674
8685
|
*
|
|
8675
8686
|
* Additionally, if a `factory` is specified you can also specify the `providedIn` option, which
|
|
@@ -8767,7 +8778,7 @@ class NullInjector {
|
|
|
8767
8778
|
|
|
8768
8779
|
/**
|
|
8769
8780
|
* Wrap an array of `Provider`s into `EnvironmentProviders`, preventing them from being accidentally
|
|
8770
|
-
* referenced in `@Component in a component injector.
|
|
8781
|
+
* referenced in `@Component` in a component injector.
|
|
8771
8782
|
*/
|
|
8772
8783
|
function makeEnvironmentProviders(providers) {
|
|
8773
8784
|
return {
|
|
@@ -10089,7 +10100,7 @@ class Version {
|
|
|
10089
10100
|
/**
|
|
10090
10101
|
* @publicApi
|
|
10091
10102
|
*/
|
|
10092
|
-
const VERSION = new Version('16.1.
|
|
10103
|
+
const VERSION = new Version('16.1.5');
|
|
10093
10104
|
|
|
10094
10105
|
// This default value is when checking the hierarchy for a token.
|
|
10095
10106
|
//
|
|
@@ -10513,13 +10524,15 @@ function selectIndexInternal(tView, lView, index, checkNoChangesMode) {
|
|
|
10513
10524
|
}
|
|
10514
10525
|
|
|
10515
10526
|
/**
|
|
10516
|
-
* Runs the given function in the context of the given
|
|
10527
|
+
* Runs the given function in the [context](guide/dependency-injection-context) of the given
|
|
10528
|
+
* `Injector`.
|
|
10517
10529
|
*
|
|
10518
|
-
* Within the function's stack frame, `inject` can be used to inject dependencies
|
|
10519
|
-
* `Injector`. Note that `inject` is only usable synchronously, and cannot be used in
|
|
10520
|
-
* asynchronous callbacks or after any `await` points.
|
|
10530
|
+
* Within the function's stack frame, [`inject`](api/core/inject) can be used to inject dependencies
|
|
10531
|
+
* from the given `Injector`. Note that `inject` is only usable synchronously, and cannot be used in
|
|
10532
|
+
* any asynchronous callbacks or after any `await` points.
|
|
10521
10533
|
*
|
|
10522
|
-
* @param injector the injector which will satisfy calls to `inject` while `fn`
|
|
10534
|
+
* @param injector the injector which will satisfy calls to [`inject`](api/core/inject) while `fn`
|
|
10535
|
+
* is executing
|
|
10523
10536
|
* @param fn the closure to be run in the context of `injector`
|
|
10524
10537
|
* @returns the return value of the function, if any
|
|
10525
10538
|
* @publicApi
|
|
@@ -10539,7 +10552,8 @@ function runInInjectionContext(injector, fn) {
|
|
|
10539
10552
|
}
|
|
10540
10553
|
}
|
|
10541
10554
|
/**
|
|
10542
|
-
* Asserts that the current stack frame is within an injection
|
|
10555
|
+
* Asserts that the current stack frame is within an [injection
|
|
10556
|
+
* context](guide/dependency-injection-context) and has access to `inject`.
|
|
10543
10557
|
*
|
|
10544
10558
|
* @param debugFn a reference to the function making the assertion (used for the error message).
|
|
10545
10559
|
*
|
|
@@ -21740,14 +21754,14 @@ class StandaloneService {
|
|
|
21740
21754
|
if (!componentDef.standalone) {
|
|
21741
21755
|
return null;
|
|
21742
21756
|
}
|
|
21743
|
-
if (!this.cachedInjectors.has(componentDef
|
|
21757
|
+
if (!this.cachedInjectors.has(componentDef)) {
|
|
21744
21758
|
const providers = internalImportProvidersFrom(false, componentDef.type);
|
|
21745
21759
|
const standaloneInjector = providers.length > 0 ?
|
|
21746
21760
|
createEnvironmentInjector([providers], this._injector, `Standalone[${componentDef.type.name}]`) :
|
|
21747
21761
|
null;
|
|
21748
|
-
this.cachedInjectors.set(componentDef
|
|
21762
|
+
this.cachedInjectors.set(componentDef, standaloneInjector);
|
|
21749
21763
|
}
|
|
21750
|
-
return this.cachedInjectors.get(componentDef
|
|
21764
|
+
return this.cachedInjectors.get(componentDef);
|
|
21751
21765
|
}
|
|
21752
21766
|
ngOnDestroy() {
|
|
21753
21767
|
try {
|
|
@@ -22596,6 +22610,13 @@ function ɵɵpipe(index, pipeName) {
|
|
|
22596
22610
|
*/
|
|
22597
22611
|
function getPipeDef(name, registry) {
|
|
22598
22612
|
if (registry) {
|
|
22613
|
+
if (ngDevMode) {
|
|
22614
|
+
const pipes = registry.filter(pipe => pipe.name === name);
|
|
22615
|
+
// TODO: Throw an error in the next major
|
|
22616
|
+
if (pipes.length > 1) {
|
|
22617
|
+
console.warn(formatRuntimeError(313 /* RuntimeErrorCode.MULTIPLE_MATCHING_PIPES */, getMultipleMatchingPipesMessage(name)));
|
|
22618
|
+
}
|
|
22619
|
+
}
|
|
22599
22620
|
for (let i = registry.length - 1; i >= 0; i--) {
|
|
22600
22621
|
const pipeDef = registry[i];
|
|
22601
22622
|
if (name === pipeDef.name) {
|
|
@@ -22607,6 +22628,23 @@ function getPipeDef(name, registry) {
|
|
|
22607
22628
|
throw new RuntimeError(-302 /* RuntimeErrorCode.PIPE_NOT_FOUND */, getPipeNotFoundErrorMessage(name));
|
|
22608
22629
|
}
|
|
22609
22630
|
}
|
|
22631
|
+
/**
|
|
22632
|
+
* Generates a helpful error message for the user when multiple pipes match the name.
|
|
22633
|
+
*
|
|
22634
|
+
* @param name Name of the pipe
|
|
22635
|
+
* @returns The error message
|
|
22636
|
+
*/
|
|
22637
|
+
function getMultipleMatchingPipesMessage(name) {
|
|
22638
|
+
const lView = getLView();
|
|
22639
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
22640
|
+
const context = declarationLView[CONTEXT];
|
|
22641
|
+
const hostIsStandalone = isHostComponentStandalone(lView);
|
|
22642
|
+
const componentInfoMessage = context ? ` in the '${context.constructor.name}' component` : '';
|
|
22643
|
+
const verifyMessage = `check ${hostIsStandalone ? '\'@Component.imports\' of this component' :
|
|
22644
|
+
'the imports of this module'}`;
|
|
22645
|
+
const errorMessage = `Multiple pipes match the name \`${name}\`${componentInfoMessage}. ${verifyMessage}`;
|
|
22646
|
+
return errorMessage;
|
|
22647
|
+
}
|
|
22610
22648
|
/**
|
|
22611
22649
|
* Generates a helpful error message for the user when a pipe is not found.
|
|
22612
22650
|
*
|
|
@@ -26098,15 +26136,24 @@ class NgZone {
|
|
|
26098
26136
|
self.nativeRequestAnimationFrame = getNativeRequestAnimationFrame().nativeRequestAnimationFrame;
|
|
26099
26137
|
forkInnerZoneWithAngularBehavior(self);
|
|
26100
26138
|
}
|
|
26139
|
+
/**
|
|
26140
|
+
This method checks whether the method call happens within an Angular Zone instance.
|
|
26141
|
+
*/
|
|
26101
26142
|
static isInAngularZone() {
|
|
26102
26143
|
// Zone needs to be checked, because this method might be called even when NoopNgZone is used.
|
|
26103
26144
|
return typeof Zone !== 'undefined' && Zone.current.get('isAngularZone') === true;
|
|
26104
26145
|
}
|
|
26146
|
+
/**
|
|
26147
|
+
Assures that the method is called within the Angular Zone, otherwise throws an error.
|
|
26148
|
+
*/
|
|
26105
26149
|
static assertInAngularZone() {
|
|
26106
26150
|
if (!NgZone.isInAngularZone()) {
|
|
26107
26151
|
throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to be in Angular Zone, but it is not!');
|
|
26108
26152
|
}
|
|
26109
26153
|
}
|
|
26154
|
+
/**
|
|
26155
|
+
Assures that the method is called outside of the Angular Zone, otherwise throws an error.
|
|
26156
|
+
*/
|
|
26110
26157
|
static assertNotInAngularZone() {
|
|
26111
26158
|
if (NgZone.isInAngularZone()) {
|
|
26112
26159
|
throw new RuntimeError(909 /* RuntimeErrorCode.UNEXPECTED_ZONE_STATE */, ngDevMode && 'Expected to not be in Angular Zone, but it is!');
|