@angular/core 14.1.0-next.1 → 14.1.0-next.2
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/esm2020/src/application_ref.mjs +10 -24
- package/esm2020/src/change_detection/differs/default_iterable_differ.mjs +3 -5
- package/esm2020/src/change_detection/differs/default_keyvalue_differ.mjs +3 -5
- package/esm2020/src/change_detection/differs/iterable_differs.mjs +3 -5
- package/esm2020/src/change_detection/differs/keyvalue_differs.mjs +2 -5
- package/esm2020/src/di/injector_compatibility.mjs +4 -9
- package/esm2020/src/render3/features/inherit_definition_feature.mjs +3 -5
- package/esm2020/src/render3/jit/directive.mjs +20 -3
- package/esm2020/src/render3/ng_module_ref.mjs +10 -2
- package/esm2020/src/render3/view_ref.mjs +3 -5
- package/esm2020/src/sanitization/sanitization.mjs +4 -9
- package/esm2020/src/version.mjs +1 -1
- package/esm2020/testing/src/logger.mjs +3 -3
- package/esm2020/testing/src/ng_zone_mock.mjs +3 -3
- package/esm2020/testing/src/r3_test_bed_compiler.mjs +30 -25
- package/fesm2015/core.mjs +56 -68
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +53 -54
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +56 -68
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +53 -54
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +10 -2
- package/package.json +1 -1
- package/testing/index.d.ts +1 -1
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.1.0-next.
|
|
2
|
+
* @license Angular v14.1.0-next.2
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2046,10 +2046,8 @@ function setCurrentInjector(injector) {
|
|
|
2046
2046
|
}
|
|
2047
2047
|
function injectInjectorOnly(token, flags = InjectFlags.Default) {
|
|
2048
2048
|
if (_currentInjector === undefined) {
|
|
2049
|
-
|
|
2050
|
-
`inject() must be called from an injection context (a constructor, a factory function or a field initializer)`
|
|
2051
|
-
'';
|
|
2052
|
-
throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, errorMessage);
|
|
2049
|
+
throw new RuntimeError(-203 /* RuntimeErrorCode.MISSING_INJECTION_CONTEXT */, ngDevMode &&
|
|
2050
|
+
`inject() must be called from an injection context (a constructor, a factory function or a field initializer)`);
|
|
2053
2051
|
}
|
|
2054
2052
|
else if (_currentInjector === null) {
|
|
2055
2053
|
return injectRootLimpMode(token, undefined, flags);
|
|
@@ -2155,10 +2153,7 @@ function injectArgs(types) {
|
|
|
2155
2153
|
const arg = resolveForwardRef(types[i]);
|
|
2156
2154
|
if (Array.isArray(arg)) {
|
|
2157
2155
|
if (arg.length === 0) {
|
|
2158
|
-
|
|
2159
|
-
'Arguments array must have arguments.' :
|
|
2160
|
-
'';
|
|
2161
|
-
throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, errorMessage);
|
|
2156
|
+
throw new RuntimeError(900 /* RuntimeErrorCode.INVALID_DIFFER_INPUT */, ngDevMode && 'Arguments array must have arguments.');
|
|
2162
2157
|
}
|
|
2163
2158
|
let type = undefined;
|
|
2164
2159
|
let flags = InjectFlags.Default;
|
|
@@ -6489,10 +6484,8 @@ function ɵɵsanitizeResourceUrl(unsafeResourceUrl) {
|
|
|
6489
6484
|
if (allowSanitizationBypassAndThrow(unsafeResourceUrl, "ResourceURL" /* BypassType.ResourceUrl */)) {
|
|
6490
6485
|
return trustedScriptURLFromStringBypass(unwrapSafeValue(unsafeResourceUrl));
|
|
6491
6486
|
}
|
|
6492
|
-
|
|
6493
|
-
'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)'
|
|
6494
|
-
'';
|
|
6495
|
-
throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, errorMessage);
|
|
6487
|
+
throw new RuntimeError(904 /* RuntimeErrorCode.UNSAFE_VALUE_IN_RESOURCE_URL */, ngDevMode &&
|
|
6488
|
+
'unsafe value used in a resource URL context (see https://g.co/ng/security#xss)');
|
|
6496
6489
|
}
|
|
6497
6490
|
/**
|
|
6498
6491
|
* A `script` sanitizer which only lets trusted javascript through.
|
|
@@ -6514,10 +6507,7 @@ function ɵɵsanitizeScript(unsafeScript) {
|
|
|
6514
6507
|
if (allowSanitizationBypassAndThrow(unsafeScript, "Script" /* BypassType.Script */)) {
|
|
6515
6508
|
return trustedScriptFromStringBypass(unwrapSafeValue(unsafeScript));
|
|
6516
6509
|
}
|
|
6517
|
-
|
|
6518
|
-
'unsafe value used in a script context' :
|
|
6519
|
-
'';
|
|
6520
|
-
throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, errorMessage);
|
|
6510
|
+
throw new RuntimeError(905 /* RuntimeErrorCode.UNSAFE_VALUE_IN_SCRIPT */, ngDevMode && 'unsafe value used in a script context');
|
|
6521
6511
|
}
|
|
6522
6512
|
/**
|
|
6523
6513
|
* A template tag function for promoting the associated constant literal to a
|
|
@@ -14387,10 +14377,8 @@ function ɵɵInheritDefinitionFeature(definition) {
|
|
|
14387
14377
|
}
|
|
14388
14378
|
else {
|
|
14389
14379
|
if (superType.ɵcmp) {
|
|
14390
|
-
|
|
14391
|
-
`Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`
|
|
14392
|
-
'';
|
|
14393
|
-
throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, errorMessage);
|
|
14380
|
+
throw new RuntimeError(903 /* RuntimeErrorCode.INVALID_INHERITANCE */, ngDevMode &&
|
|
14381
|
+
`Directives cannot inherit Components. Directive ${stringifyForError(definition.type)} is attempting to extend component ${stringifyForError(superType)}`);
|
|
14394
14382
|
}
|
|
14395
14383
|
// Don't use getComponentDef/getDirectiveDef. This logic relies on inheritance.
|
|
14396
14384
|
superDef = superType.ɵdir;
|
|
@@ -22087,7 +22075,7 @@ class Version {
|
|
|
22087
22075
|
/**
|
|
22088
22076
|
* @publicApi
|
|
22089
22077
|
*/
|
|
22090
|
-
const VERSION = new Version('14.1.0-next.
|
|
22078
|
+
const VERSION = new Version('14.1.0-next.2');
|
|
22091
22079
|
|
|
22092
22080
|
/**
|
|
22093
22081
|
* @license
|
|
@@ -22425,8 +22413,7 @@ class ViewRef {
|
|
|
22425
22413
|
}
|
|
22426
22414
|
attachToViewContainerRef() {
|
|
22427
22415
|
if (this._appRef) {
|
|
22428
|
-
|
|
22429
|
-
throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
|
|
22416
|
+
throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached directly to the ApplicationRef!');
|
|
22430
22417
|
}
|
|
22431
22418
|
this._attachedToViewContainer = true;
|
|
22432
22419
|
}
|
|
@@ -22436,8 +22423,7 @@ class ViewRef {
|
|
|
22436
22423
|
}
|
|
22437
22424
|
attachToAppRef(appRef) {
|
|
22438
22425
|
if (this._attachedToViewContainer) {
|
|
22439
|
-
|
|
22440
|
-
throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, errorMessage);
|
|
22426
|
+
throw new RuntimeError(902 /* RuntimeErrorCode.VIEW_ALREADY_ATTACHED */, ngDevMode && 'This view is already attached to a ViewContainer!');
|
|
22441
22427
|
}
|
|
22442
22428
|
this._appRef = appRef;
|
|
22443
22429
|
}
|
|
@@ -22758,10 +22744,18 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
|
|
|
22758
22744
|
/**
|
|
22759
22745
|
* Create a new environment injector.
|
|
22760
22746
|
*
|
|
22747
|
+
* Learn more about environment injectors in
|
|
22748
|
+
* [this guide](guide/standalone-components#environment-injectors).
|
|
22749
|
+
*
|
|
22750
|
+
* @param providers An array of providers.
|
|
22751
|
+
* @param parent A parent environment injector.
|
|
22752
|
+
* @param debugName An optional name for this injector instance, which will be used in error
|
|
22753
|
+
* messages.
|
|
22754
|
+
*
|
|
22761
22755
|
* @publicApi
|
|
22762
22756
|
* @developerPreview
|
|
22763
22757
|
*/
|
|
22764
|
-
function createEnvironmentInjector(providers, parent
|
|
22758
|
+
function createEnvironmentInjector(providers, parent, debugName = null) {
|
|
22765
22759
|
const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
|
|
22766
22760
|
return adapter.injector;
|
|
22767
22761
|
}
|
|
@@ -24716,7 +24710,7 @@ function patchModuleCompilation() {
|
|
|
24716
24710
|
function isModuleWithProviders$1(value) {
|
|
24717
24711
|
return value.ngModule !== undefined;
|
|
24718
24712
|
}
|
|
24719
|
-
function isNgModule(value) {
|
|
24713
|
+
function isNgModule$1(value) {
|
|
24720
24714
|
return !!getNgModuleDef(value);
|
|
24721
24715
|
}
|
|
24722
24716
|
|
|
@@ -25139,7 +25133,7 @@ function patchComponentDefWithScope(componentDef, transitiveScopes) {
|
|
|
25139
25133
|
* (either a NgModule or a standalone component / directive / pipe).
|
|
25140
25134
|
*/
|
|
25141
25135
|
function transitiveScopesFor(type) {
|
|
25142
|
-
if (isNgModule(type)) {
|
|
25136
|
+
if (isNgModule$1(type)) {
|
|
25143
25137
|
return transitiveScopesForNgModule(type);
|
|
25144
25138
|
}
|
|
25145
25139
|
else if (isStandalone(type)) {
|
|
@@ -25223,7 +25217,7 @@ function transitiveScopesForNgModule(moduleType) {
|
|
|
25223
25217
|
const exportedType = exported;
|
|
25224
25218
|
// Either the type is a module, a pipe, or a component/directive (which may not have a
|
|
25225
25219
|
// ɵcmp as it might be compiled asynchronously).
|
|
25226
|
-
if (isNgModule(exportedType)) {
|
|
25220
|
+
if (isNgModule$1(exportedType)) {
|
|
25227
25221
|
// When this module exports another, the exported module's exported directives and pipes are
|
|
25228
25222
|
// added to both the compilation and exported scopes of this module.
|
|
25229
25223
|
const exportedScope = transitiveScopesFor(exportedType);
|
|
@@ -25523,7 +25517,7 @@ class R3TestBedCompiler {
|
|
|
25523
25517
|
// module's provider list.
|
|
25524
25518
|
this.providerOverridesByModule = new Map();
|
|
25525
25519
|
this.providerOverridesByToken = new Map();
|
|
25526
|
-
this.
|
|
25520
|
+
this.scopesWithOverriddenProviders = new Set();
|
|
25527
25521
|
this.testModuleRef = null;
|
|
25528
25522
|
class DynamicTestModule {
|
|
25529
25523
|
}
|
|
@@ -25694,7 +25688,7 @@ class R3TestBedCompiler {
|
|
|
25694
25688
|
this.queueTypesFromModulesArray([moduleType]);
|
|
25695
25689
|
this.compileTypesSync();
|
|
25696
25690
|
this.applyProviderOverrides();
|
|
25697
|
-
this.
|
|
25691
|
+
this.applyProviderOverridesInScope(moduleType);
|
|
25698
25692
|
this.applyTransitiveScopes();
|
|
25699
25693
|
}
|
|
25700
25694
|
/**
|
|
@@ -25705,7 +25699,7 @@ class R3TestBedCompiler {
|
|
|
25705
25699
|
this.queueTypesFromModulesArray([moduleType]);
|
|
25706
25700
|
yield this.compileComponents();
|
|
25707
25701
|
this.applyProviderOverrides();
|
|
25708
|
-
this.
|
|
25702
|
+
this.applyProviderOverridesInScope(moduleType);
|
|
25709
25703
|
this.applyTransitiveScopes();
|
|
25710
25704
|
});
|
|
25711
25705
|
}
|
|
@@ -25807,51 +25801,53 @@ class R3TestBedCompiler {
|
|
|
25807
25801
|
this.seenComponents.clear();
|
|
25808
25802
|
this.seenDirectives.clear();
|
|
25809
25803
|
}
|
|
25810
|
-
|
|
25804
|
+
/**
|
|
25805
|
+
* Applies provider overrides to a given type (either an NgModule or a standalone component)
|
|
25806
|
+
* and all imported NgModules and standalone components recursively.
|
|
25807
|
+
*/
|
|
25808
|
+
applyProviderOverridesInScope(type) {
|
|
25811
25809
|
var _a;
|
|
25812
|
-
|
|
25810
|
+
const hasScope = isStandaloneComponent(type) || isNgModule(type);
|
|
25811
|
+
// The function can be re-entered recursively while inspecting dependencies
|
|
25812
|
+
// of an NgModule or a standalone component. Exit early if we come across a
|
|
25813
|
+
// type that can not have a scope (directive or pipe) or the type is already
|
|
25814
|
+
// processed earlier.
|
|
25815
|
+
if (!hasScope || this.scopesWithOverriddenProviders.has(type)) {
|
|
25813
25816
|
return;
|
|
25814
25817
|
}
|
|
25815
|
-
this.
|
|
25818
|
+
this.scopesWithOverriddenProviders.add(type);
|
|
25816
25819
|
// NOTE: the line below triggers JIT compilation of the module injector,
|
|
25817
25820
|
// which also invokes verification of the NgModule semantics, which produces
|
|
25818
25821
|
// detailed error messages. The fact that the code relies on this line being
|
|
25819
25822
|
// present here is suspicious and should be refactored in a way that the line
|
|
25820
25823
|
// below can be moved (for ex. after an early exit check below).
|
|
25821
|
-
const injectorDef =
|
|
25824
|
+
const injectorDef = type[ɵNG_INJ_DEF];
|
|
25822
25825
|
// No provider overrides, exit early.
|
|
25823
25826
|
if (this.providerOverridesByToken.size === 0)
|
|
25824
25827
|
return;
|
|
25825
|
-
if (isStandaloneComponent(
|
|
25828
|
+
if (isStandaloneComponent(type)) {
|
|
25826
25829
|
// Visit all component dependencies and override providers there.
|
|
25827
|
-
const def = getComponentDef(
|
|
25830
|
+
const def = getComponentDef(type);
|
|
25828
25831
|
const dependencies = maybeUnwrapFn((_a = def.dependencies) !== null && _a !== void 0 ? _a : []);
|
|
25829
25832
|
for (const dependency of dependencies) {
|
|
25830
|
-
|
|
25831
|
-
// when a dependency is a standalone component or an NgModule.
|
|
25832
|
-
// In AOT, the `dependencies` might also contain regular (NgModule-based)
|
|
25833
|
-
// Component, Directive and Pipes. Skip them here, they are handled in a
|
|
25834
|
-
// different location (in the `configureTestingModule` function).
|
|
25835
|
-
if (isStandaloneComponent(dependency) || hasNgModuleDef(dependency)) {
|
|
25836
|
-
this.applyProviderOverridesToModule(dependency);
|
|
25837
|
-
}
|
|
25833
|
+
this.applyProviderOverridesInScope(dependency);
|
|
25838
25834
|
}
|
|
25839
25835
|
}
|
|
25840
25836
|
else {
|
|
25841
25837
|
const providers = [
|
|
25842
25838
|
...injectorDef.providers,
|
|
25843
|
-
...(this.providerOverridesByModule.get(
|
|
25839
|
+
...(this.providerOverridesByModule.get(type) || [])
|
|
25844
25840
|
];
|
|
25845
25841
|
if (this.hasProviderOverrides(providers)) {
|
|
25846
|
-
this.maybeStoreNgDef(ɵNG_INJ_DEF,
|
|
25847
|
-
this.storeFieldOfDefOnType(
|
|
25842
|
+
this.maybeStoreNgDef(ɵNG_INJ_DEF, type);
|
|
25843
|
+
this.storeFieldOfDefOnType(type, ɵNG_INJ_DEF, 'providers');
|
|
25848
25844
|
injectorDef.providers = this.getOverriddenProviders(providers);
|
|
25849
25845
|
}
|
|
25850
25846
|
// Apply provider overrides to imported modules recursively
|
|
25851
|
-
const moduleDef =
|
|
25847
|
+
const moduleDef = type[ɵNG_MOD_DEF];
|
|
25852
25848
|
const imports = maybeUnwrapFn(moduleDef.imports);
|
|
25853
25849
|
for (const importedModule of imports) {
|
|
25854
|
-
this.
|
|
25850
|
+
this.applyProviderOverridesInScope(importedModule);
|
|
25855
25851
|
}
|
|
25856
25852
|
// Also override the providers on any ModuleWithProviders imports since those don't appear in
|
|
25857
25853
|
// the moduleDef.
|
|
@@ -26089,7 +26085,7 @@ class R3TestBedCompiler {
|
|
|
26089
26085
|
});
|
|
26090
26086
|
});
|
|
26091
26087
|
this.initialNgDefs.clear();
|
|
26092
|
-
this.
|
|
26088
|
+
this.scopesWithOverriddenProviders.clear();
|
|
26093
26089
|
this.restoreComponentResolutionQueue();
|
|
26094
26090
|
// Restore the locale ID to the default value, this shouldn't be necessary but we never know
|
|
26095
26091
|
ɵsetLocaleId(ɵDEFAULT_LOCALE_ID);
|
|
@@ -26116,7 +26112,7 @@ class R3TestBedCompiler {
|
|
|
26116
26112
|
providers,
|
|
26117
26113
|
}, /* allowDuplicateDeclarationsInRoot */ true);
|
|
26118
26114
|
// clang-format on
|
|
26119
|
-
this.
|
|
26115
|
+
this.applyProviderOverridesInScope(this.testModuleType);
|
|
26120
26116
|
}
|
|
26121
26117
|
get injector() {
|
|
26122
26118
|
if (this._injector !== null) {
|
|
@@ -26217,6 +26213,9 @@ function getComponentDef(value) {
|
|
|
26217
26213
|
function hasNgModuleDef(value) {
|
|
26218
26214
|
return value.hasOwnProperty('ɵmod');
|
|
26219
26215
|
}
|
|
26216
|
+
function isNgModule(value) {
|
|
26217
|
+
return hasNgModuleDef(value);
|
|
26218
|
+
}
|
|
26220
26219
|
function maybeUnwrapFn(maybeFn) {
|
|
26221
26220
|
return maybeFn instanceof Function ? maybeFn() : maybeFn;
|
|
26222
26221
|
}
|