@angular/core 15.0.0-next.5 → 15.0.0-rc.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/esm2020/src/application_ref.mjs +1 -1
- package/esm2020/src/core_private_export.mjs +2 -1
- package/esm2020/src/di/index.mjs +2 -2
- package/esm2020/src/di/interface/defs.mjs +1 -1
- package/esm2020/src/di/interface/provider.mjs +4 -2
- package/esm2020/src/di/provider_collection.mjs +30 -5
- package/esm2020/src/di/r3_injector.mjs +4 -8
- package/esm2020/src/metadata/directives.mjs +1 -1
- package/esm2020/src/metadata/ng_module.mjs +1 -1
- package/esm2020/src/render3/errors_di.mjs +9 -3
- package/esm2020/src/render3/features/host_directives_feature.mjs +6 -7
- package/esm2020/src/render3/jit/directive.mjs +2 -6
- package/esm2020/src/render3/ng_module_ref.mjs +1 -2
- 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/test_bed_compiler.mjs +29 -11
- package/fesm2015/core.mjs +57 -28
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +83 -32
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +57 -28
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +83 -32
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +58 -24
- package/package.json +2 -2
- package/schematics/migrations/relative-link-resolution/index.d.ts +10 -0
- package/schematics/migrations/relative-link-resolution/index.js +68 -0
- package/schematics/migrations/relative-link-resolution/util.d.ts +20 -0
- package/schematics/migrations/relative-link-resolution/util.js +82 -0
- package/schematics/migrations/router-link-with-href/index.d.ts +10 -0
- package/schematics/migrations/router-link-with-href/index.js +70 -0
- package/schematics/migrations/router-link-with-href/util.d.ts +19 -0
- package/schematics/migrations/router-link-with-href/util.js +111 -0
- package/schematics/migrations.json +10 -0
- package/schematics/utils/typescript/imports.d.ts +10 -0
- package/schematics/utils/typescript/imports.js +17 -2
- package/testing/index.d.ts +1 -1
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.0.0-
|
|
2
|
+
* @license Angular v15.0.0-rc.0
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
6
6
|
|
|
7
|
-
import { getDebugNode as getDebugNode$1, RendererFactory2 as RendererFactory2$1, InjectionToken as InjectionToken$1, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef as resolveForwardRef$1, ɵNG_COMP_DEF, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID as LOCALE_ID$1, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ModuleWithComponentFactories, ɵconvertToBitFlags, Injector as Injector$1, InjectFlags as InjectFlags$1, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode as ɵsetUnknownElementStrictMode$1, ɵsetUnknownPropertyStrictMode as ɵsetUnknownPropertyStrictMode$1, ɵgetUnknownElementStrictMode as ɵgetUnknownElementStrictMode$1, ɵgetUnknownPropertyStrictMode as ɵgetUnknownPropertyStrictMode$1, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
7
|
+
import { getDebugNode as getDebugNode$1, RendererFactory2 as RendererFactory2$1, InjectionToken as InjectionToken$1, ɵstringify, ɵReflectionCapabilities, Directive, Component, Pipe, NgModule, ɵgetInjectableDef, resolveForwardRef as resolveForwardRef$1, ɵNG_COMP_DEF, ɵRender3NgModuleRef, ApplicationInitStatus, LOCALE_ID as LOCALE_ID$1, ɵDEFAULT_LOCALE_ID, ɵsetLocaleId, ɵRender3ComponentFactory, ɵcompileComponent, ɵNG_DIR_DEF, ɵcompileDirective, ɵNG_PIPE_DEF, ɵcompilePipe, ɵNG_MOD_DEF, ɵtransitiveScopesFor, ɵpatchComponentDefWithScope, ɵNG_INJ_DEF, ɵcompileNgModuleDefs, NgZone, Compiler, COMPILER_OPTIONS, ɵNgModuleFactory, ɵisEnvironmentProviders, ModuleWithComponentFactories, ɵconvertToBitFlags, Injector as Injector$1, InjectFlags as InjectFlags$1, ɵsetAllowDuplicateNgModuleIdsForTest, ɵresetCompiledComponents, ɵsetUnknownElementStrictMode as ɵsetUnknownElementStrictMode$1, ɵsetUnknownPropertyStrictMode as ɵsetUnknownPropertyStrictMode$1, ɵgetUnknownElementStrictMode as ɵgetUnknownElementStrictMode$1, ɵgetUnknownPropertyStrictMode as ɵgetUnknownPropertyStrictMode$1, ɵflushModuleScopingQueueAsMuchAsPossible } from '@angular/core';
|
|
8
8
|
import { __awaiter } from 'tslib';
|
|
9
9
|
import { ResourceLoader } from '@angular/compiler';
|
|
10
10
|
import { Subject, Subscription } from 'rxjs';
|
|
@@ -1887,6 +1887,17 @@ function initNgDevMode() {
|
|
|
1887
1887
|
return false;
|
|
1888
1888
|
}
|
|
1889
1889
|
|
|
1890
|
+
/**
|
|
1891
|
+
* @license
|
|
1892
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1893
|
+
*
|
|
1894
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1895
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1896
|
+
*/
|
|
1897
|
+
function isEnvironmentProviders(value) {
|
|
1898
|
+
return value && !!value.ɵproviders;
|
|
1899
|
+
}
|
|
1900
|
+
|
|
1890
1901
|
/**
|
|
1891
1902
|
* @license
|
|
1892
1903
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -1943,8 +1954,13 @@ function throwInvalidProviderError(ngModuleType, providers, provider) {
|
|
|
1943
1954
|
const providerDetail = providers.map(v => v == provider ? '?' + provider + '?' : '...');
|
|
1944
1955
|
throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}' - only instances of Provider and Type are allowed, got: [${providerDetail.join(', ')}]`);
|
|
1945
1956
|
}
|
|
1946
|
-
else if (provider
|
|
1947
|
-
|
|
1957
|
+
else if (isEnvironmentProviders(provider)) {
|
|
1958
|
+
if (provider.ɵfromNgModule) {
|
|
1959
|
+
throw new RuntimeError(207 /* RuntimeErrorCode.PROVIDER_IN_WRONG_CONTEXT */, `Invalid providers from 'importProvidersFrom' present in a non-environment injector. 'importProvidersFrom' can't be used for component providers.`);
|
|
1960
|
+
}
|
|
1961
|
+
else {
|
|
1962
|
+
throw new RuntimeError(207 /* RuntimeErrorCode.PROVIDER_IN_WRONG_CONTEXT */, `Invalid providers present in a non-environment injector. 'EnvironmentProviders' can't be used for component providers.`);
|
|
1963
|
+
}
|
|
1948
1964
|
}
|
|
1949
1965
|
else {
|
|
1950
1966
|
throw new Error('Invalid provider');
|
|
@@ -6775,6 +6791,15 @@ class NullInjector {
|
|
|
6775
6791
|
* Use of this source code is governed by an MIT-style license that can be
|
|
6776
6792
|
* found in the LICENSE file at https://angular.io/license
|
|
6777
6793
|
*/
|
|
6794
|
+
/**
|
|
6795
|
+
* Wrap an array of `Provider`s into `EnvironmentProviders`, preventing them from being accidentally
|
|
6796
|
+
* referenced in `@Component in a component injector.
|
|
6797
|
+
*/
|
|
6798
|
+
function makeEnvironmentProviders(providers) {
|
|
6799
|
+
return {
|
|
6800
|
+
ɵproviders: providers,
|
|
6801
|
+
};
|
|
6802
|
+
}
|
|
6778
6803
|
/**
|
|
6779
6804
|
* Collects providers from all NgModules and standalone components, including transitively imported
|
|
6780
6805
|
* ones.
|
|
@@ -6814,10 +6839,12 @@ class NullInjector {
|
|
|
6814
6839
|
*
|
|
6815
6840
|
* @returns Collected providers from the specified list of types.
|
|
6816
6841
|
* @publicApi
|
|
6817
|
-
* @developerPreview
|
|
6818
6842
|
*/
|
|
6819
6843
|
function importProvidersFrom(...sources) {
|
|
6820
|
-
return {
|
|
6844
|
+
return {
|
|
6845
|
+
ɵproviders: internalImportProvidersFrom(true, sources),
|
|
6846
|
+
ɵfromNgModule: true,
|
|
6847
|
+
};
|
|
6821
6848
|
}
|
|
6822
6849
|
function internalImportProvidersFrom(checkForStandaloneCmp, ...sources) {
|
|
6823
6850
|
const providersOut = [];
|
|
@@ -6850,7 +6877,7 @@ function internalImportProvidersFrom(checkForStandaloneCmp, ...sources) {
|
|
|
6850
6877
|
function processInjectorTypesWithProviders(typesWithProviders, providersOut) {
|
|
6851
6878
|
for (let i = 0; i < typesWithProviders.length; i++) {
|
|
6852
6879
|
const { ngModule, providers } = typesWithProviders[i];
|
|
6853
|
-
|
|
6880
|
+
deepForEachProvider(providers, provider => {
|
|
6854
6881
|
ngDevMode && validateProvider(provider, providers || EMPTY_ARRAY, ngModule);
|
|
6855
6882
|
providersOut.push(provider);
|
|
6856
6883
|
});
|
|
@@ -6967,7 +6994,7 @@ function walkProviderTree(container, providersOut, parents, dedup) {
|
|
|
6967
6994
|
const defProviders = injDef.providers;
|
|
6968
6995
|
if (defProviders != null && !isDuplicate) {
|
|
6969
6996
|
const injectorType = container;
|
|
6970
|
-
|
|
6997
|
+
deepForEachProvider(defProviders, provider => {
|
|
6971
6998
|
ngDevMode && validateProvider(provider, defProviders, injectorType);
|
|
6972
6999
|
providersOut.push(provider);
|
|
6973
7000
|
});
|
|
@@ -6991,6 +7018,19 @@ function validateProvider(provider, providers, containerType) {
|
|
|
6991
7018
|
throwInvalidProviderError(containerType, providers, provider);
|
|
6992
7019
|
}
|
|
6993
7020
|
}
|
|
7021
|
+
function deepForEachProvider(providers, fn) {
|
|
7022
|
+
for (let provider of providers) {
|
|
7023
|
+
if (isEnvironmentProviders(provider)) {
|
|
7024
|
+
provider = provider.ɵproviders;
|
|
7025
|
+
}
|
|
7026
|
+
if (Array.isArray(provider)) {
|
|
7027
|
+
deepForEachProvider(provider, fn);
|
|
7028
|
+
}
|
|
7029
|
+
else {
|
|
7030
|
+
fn(provider);
|
|
7031
|
+
}
|
|
7032
|
+
}
|
|
7033
|
+
}
|
|
6994
7034
|
const USE_VALUE$1 = getClosureSafeProperty({ provide: String, useValue: getClosureSafeProperty });
|
|
6995
7035
|
function isValueProvider(value) {
|
|
6996
7036
|
return value !== null && typeof value == 'object' && USE_VALUE$1 in value;
|
|
@@ -7054,8 +7094,6 @@ function getNullInjector() {
|
|
|
7054
7094
|
/**
|
|
7055
7095
|
* An `Injector` that's part of the environment injector hierarchy, which exists outside of the
|
|
7056
7096
|
* component tree.
|
|
7057
|
-
*
|
|
7058
|
-
* @developerPreview
|
|
7059
7097
|
*/
|
|
7060
7098
|
class EnvironmentInjector {
|
|
7061
7099
|
}
|
|
@@ -7356,7 +7394,7 @@ function providerToRecord(provider) {
|
|
|
7356
7394
|
*/
|
|
7357
7395
|
function providerToFactory(provider, ngModuleType, providers) {
|
|
7358
7396
|
let factory = undefined;
|
|
7359
|
-
if (ngDevMode &&
|
|
7397
|
+
if (ngDevMode && isEnvironmentProviders(provider)) {
|
|
7360
7398
|
throwInvalidProviderError(undefined, providers, provider);
|
|
7361
7399
|
}
|
|
7362
7400
|
if (isTypeProvider(provider)) {
|
|
@@ -7407,15 +7445,12 @@ function couldBeInjectableType(value) {
|
|
|
7407
7445
|
return (typeof value === 'function') ||
|
|
7408
7446
|
(typeof value === 'object' && value instanceof InjectionToken);
|
|
7409
7447
|
}
|
|
7410
|
-
function isImportedNgModuleProviders(provider) {
|
|
7411
|
-
return !!provider.ɵproviders;
|
|
7412
|
-
}
|
|
7413
7448
|
function forEachSingleProvider(providers, fn) {
|
|
7414
7449
|
for (const provider of providers) {
|
|
7415
7450
|
if (Array.isArray(provider)) {
|
|
7416
7451
|
forEachSingleProvider(provider, fn);
|
|
7417
7452
|
}
|
|
7418
|
-
else if (
|
|
7453
|
+
else if (provider && isEnvironmentProviders(provider)) {
|
|
7419
7454
|
forEachSingleProvider(provider.ɵproviders, fn);
|
|
7420
7455
|
}
|
|
7421
7456
|
else {
|
|
@@ -7646,7 +7681,7 @@ class Version {
|
|
|
7646
7681
|
/**
|
|
7647
7682
|
* @publicApi
|
|
7648
7683
|
*/
|
|
7649
|
-
const VERSION = new Version('15.0.0-
|
|
7684
|
+
const VERSION = new Version('15.0.0-rc.0');
|
|
7650
7685
|
|
|
7651
7686
|
/**
|
|
7652
7687
|
* @license
|
|
@@ -14837,7 +14872,6 @@ function patchDeclaredInputs(declaredInputs, exposedInputs) {
|
|
|
14837
14872
|
* @param matchedDefs Directives that have been matched so far.
|
|
14838
14873
|
*/
|
|
14839
14874
|
function validateHostDirective(hostDirectiveConfig, directiveDef, matchedDefs) {
|
|
14840
|
-
// TODO(crisbeto): implement more of these checks in the compiler.
|
|
14841
14875
|
const type = hostDirectiveConfig.directive;
|
|
14842
14876
|
if (directiveDef === null) {
|
|
14843
14877
|
if (getComponentDef$1(type) !== null) {
|
|
@@ -14860,17 +14894,17 @@ function validateHostDirective(hostDirectiveConfig, directiveDef, matchedDefs) {
|
|
|
14860
14894
|
* Checks that the host directive inputs/outputs configuration is valid.
|
|
14861
14895
|
* @param bindingType Kind of binding that is being validated. Used in the error message.
|
|
14862
14896
|
* @param def Definition of the host directive that is being validated against.
|
|
14863
|
-
* @param
|
|
14897
|
+
* @param hostDirectiveBindings Host directive mapping object that shold be validated.
|
|
14864
14898
|
*/
|
|
14865
|
-
function validateMappings(bindingType, def,
|
|
14899
|
+
function validateMappings(bindingType, def, hostDirectiveBindings) {
|
|
14866
14900
|
const className = def.type.name;
|
|
14867
14901
|
const bindings = bindingType === 'input' ? def.inputs : def.outputs;
|
|
14868
|
-
for (const publicName in
|
|
14869
|
-
if (
|
|
14902
|
+
for (const publicName in hostDirectiveBindings) {
|
|
14903
|
+
if (hostDirectiveBindings.hasOwnProperty(publicName)) {
|
|
14870
14904
|
if (!bindings.hasOwnProperty(publicName)) {
|
|
14871
14905
|
throw new RuntimeError(311 /* RuntimeErrorCode.HOST_DIRECTIVE_UNDEFINED_BINDING */, `Directive ${className} does not have an ${bindingType} with a public name of ${publicName}.`);
|
|
14872
14906
|
}
|
|
14873
|
-
const remappedPublicName =
|
|
14907
|
+
const remappedPublicName = hostDirectiveBindings[publicName];
|
|
14874
14908
|
if (bindings.hasOwnProperty(remappedPublicName) &&
|
|
14875
14909
|
bindings[remappedPublicName] !== publicName) {
|
|
14876
14910
|
throw new RuntimeError(312 /* RuntimeErrorCode.HOST_DIRECTIVE_CONFLICTING_ALIAS */, `Cannot alias ${bindingType} ${publicName} of host directive ${className} to ${remappedPublicName}, because it already has a different ${bindingType} with the same public name.`);
|
|
@@ -22245,7 +22279,6 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
|
|
|
22245
22279
|
* messages.
|
|
22246
22280
|
*
|
|
22247
22281
|
* @publicApi
|
|
22248
|
-
* @developerPreview
|
|
22249
22282
|
*/
|
|
22250
22283
|
function createEnvironmentInjector(providers, parent, debugName = null) {
|
|
22251
22284
|
const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
|
|
@@ -26043,17 +26076,17 @@ class TestBedCompiler {
|
|
|
26043
26076
|
getProviderOverrides(providers) {
|
|
26044
26077
|
if (!providers || !providers.length || this.providerOverridesByToken.size === 0)
|
|
26045
26078
|
return [];
|
|
26046
|
-
// There are two flattening operations here. The inner
|
|
26047
|
-
// providers and applies a mapping function which retrieves overrides for each
|
|
26048
|
-
// provider. The outer flatten() then flattens the produced overrides array. If this is
|
|
26049
|
-
// done, the array can contain other empty arrays (e.g. `[[], []]`) which leak into the
|
|
26079
|
+
// There are two flattening operations here. The inner flattenProviders() operates on the
|
|
26080
|
+
// metadata's providers and applies a mapping function which retrieves overrides for each
|
|
26081
|
+
// incoming provider. The outer flatten() then flattens the produced overrides array. If this is
|
|
26082
|
+
// not done, the array can contain other empty arrays (e.g. `[[], []]`) which leak into the
|
|
26050
26083
|
// providers array and contaminate any error messages that might be generated.
|
|
26051
|
-
return flatten(
|
|
26084
|
+
return flatten(flattenProviders(providers, (provider) => this.getSingleProviderOverrides(provider) || []));
|
|
26052
26085
|
}
|
|
26053
26086
|
getOverriddenProviders(providers) {
|
|
26054
26087
|
if (!providers || !providers.length || this.providerOverridesByToken.size === 0)
|
|
26055
26088
|
return [];
|
|
26056
|
-
const flattenedProviders =
|
|
26089
|
+
const flattenedProviders = flattenProviders(providers);
|
|
26057
26090
|
const overrides = this.getProviderOverrides(flattenedProviders);
|
|
26058
26091
|
const overriddenProviders = [...flattenedProviders, ...overrides];
|
|
26059
26092
|
const final = [];
|
|
@@ -26118,18 +26151,36 @@ function isNgModule(value) {
|
|
|
26118
26151
|
function maybeUnwrapFn(maybeFn) {
|
|
26119
26152
|
return maybeFn instanceof Function ? maybeFn() : maybeFn;
|
|
26120
26153
|
}
|
|
26121
|
-
function flatten(values
|
|
26154
|
+
function flatten(values) {
|
|
26122
26155
|
const out = [];
|
|
26123
26156
|
values.forEach(value => {
|
|
26124
26157
|
if (Array.isArray(value)) {
|
|
26125
|
-
out.push(...flatten(value
|
|
26158
|
+
out.push(...flatten(value));
|
|
26126
26159
|
}
|
|
26127
26160
|
else {
|
|
26128
|
-
out.push(
|
|
26161
|
+
out.push(value);
|
|
26129
26162
|
}
|
|
26130
26163
|
});
|
|
26131
26164
|
return out;
|
|
26132
26165
|
}
|
|
26166
|
+
function identityFn(value) {
|
|
26167
|
+
return value;
|
|
26168
|
+
}
|
|
26169
|
+
function flattenProviders(providers, mapFn = identityFn) {
|
|
26170
|
+
const out = [];
|
|
26171
|
+
for (let provider of providers) {
|
|
26172
|
+
if (ɵisEnvironmentProviders(provider)) {
|
|
26173
|
+
provider = provider.ɵproviders;
|
|
26174
|
+
}
|
|
26175
|
+
if (Array.isArray(provider)) {
|
|
26176
|
+
out.push(...flattenProviders(provider, mapFn));
|
|
26177
|
+
}
|
|
26178
|
+
else {
|
|
26179
|
+
out.push(mapFn(provider));
|
|
26180
|
+
}
|
|
26181
|
+
}
|
|
26182
|
+
return out;
|
|
26183
|
+
}
|
|
26133
26184
|
function getProviderField(provider, field) {
|
|
26134
26185
|
return provider && typeof provider === 'object' && provider[field];
|
|
26135
26186
|
}
|