@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/fesm2020/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 { ResourceLoader } from '@angular/compiler';
|
|
9
9
|
import { Subject, Subscription } from 'rxjs';
|
|
10
10
|
|
|
@@ -1886,6 +1886,17 @@ function initNgDevMode() {
|
|
|
1886
1886
|
return false;
|
|
1887
1887
|
}
|
|
1888
1888
|
|
|
1889
|
+
/**
|
|
1890
|
+
* @license
|
|
1891
|
+
* Copyright Google LLC All Rights Reserved.
|
|
1892
|
+
*
|
|
1893
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
1894
|
+
* found in the LICENSE file at https://angular.io/license
|
|
1895
|
+
*/
|
|
1896
|
+
function isEnvironmentProviders(value) {
|
|
1897
|
+
return value && !!value.ɵproviders;
|
|
1898
|
+
}
|
|
1899
|
+
|
|
1889
1900
|
/**
|
|
1890
1901
|
* @license
|
|
1891
1902
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -1942,8 +1953,13 @@ function throwInvalidProviderError(ngModuleType, providers, provider) {
|
|
|
1942
1953
|
const providerDetail = providers.map(v => v == provider ? '?' + provider + '?' : '...');
|
|
1943
1954
|
throw new Error(`Invalid provider for the NgModule '${stringify(ngModuleType)}' - only instances of Provider and Type are allowed, got: [${providerDetail.join(', ')}]`);
|
|
1944
1955
|
}
|
|
1945
|
-
else if (provider
|
|
1946
|
-
|
|
1956
|
+
else if (isEnvironmentProviders(provider)) {
|
|
1957
|
+
if (provider.ɵfromNgModule) {
|
|
1958
|
+
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.`);
|
|
1959
|
+
}
|
|
1960
|
+
else {
|
|
1961
|
+
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.`);
|
|
1962
|
+
}
|
|
1947
1963
|
}
|
|
1948
1964
|
else {
|
|
1949
1965
|
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
|
|
@@ -14834,7 +14869,6 @@ function patchDeclaredInputs(declaredInputs, exposedInputs) {
|
|
|
14834
14869
|
* @param matchedDefs Directives that have been matched so far.
|
|
14835
14870
|
*/
|
|
14836
14871
|
function validateHostDirective(hostDirectiveConfig, directiveDef, matchedDefs) {
|
|
14837
|
-
// TODO(crisbeto): implement more of these checks in the compiler.
|
|
14838
14872
|
const type = hostDirectiveConfig.directive;
|
|
14839
14873
|
if (directiveDef === null) {
|
|
14840
14874
|
if (getComponentDef$1(type) !== null) {
|
|
@@ -14857,17 +14891,17 @@ function validateHostDirective(hostDirectiveConfig, directiveDef, matchedDefs) {
|
|
|
14857
14891
|
* Checks that the host directive inputs/outputs configuration is valid.
|
|
14858
14892
|
* @param bindingType Kind of binding that is being validated. Used in the error message.
|
|
14859
14893
|
* @param def Definition of the host directive that is being validated against.
|
|
14860
|
-
* @param
|
|
14894
|
+
* @param hostDirectiveBindings Host directive mapping object that shold be validated.
|
|
14861
14895
|
*/
|
|
14862
|
-
function validateMappings(bindingType, def,
|
|
14896
|
+
function validateMappings(bindingType, def, hostDirectiveBindings) {
|
|
14863
14897
|
const className = def.type.name;
|
|
14864
14898
|
const bindings = bindingType === 'input' ? def.inputs : def.outputs;
|
|
14865
|
-
for (const publicName in
|
|
14866
|
-
if (
|
|
14899
|
+
for (const publicName in hostDirectiveBindings) {
|
|
14900
|
+
if (hostDirectiveBindings.hasOwnProperty(publicName)) {
|
|
14867
14901
|
if (!bindings.hasOwnProperty(publicName)) {
|
|
14868
14902
|
throw new RuntimeError(311 /* RuntimeErrorCode.HOST_DIRECTIVE_UNDEFINED_BINDING */, `Directive ${className} does not have an ${bindingType} with a public name of ${publicName}.`);
|
|
14869
14903
|
}
|
|
14870
|
-
const remappedPublicName =
|
|
14904
|
+
const remappedPublicName = hostDirectiveBindings[publicName];
|
|
14871
14905
|
if (bindings.hasOwnProperty(remappedPublicName) &&
|
|
14872
14906
|
bindings[remappedPublicName] !== publicName) {
|
|
14873
14907
|
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.`);
|
|
@@ -22242,7 +22276,6 @@ class EnvironmentNgModuleRefAdapter extends NgModuleRef$1 {
|
|
|
22242
22276
|
* messages.
|
|
22243
22277
|
*
|
|
22244
22278
|
* @publicApi
|
|
22245
|
-
* @developerPreview
|
|
22246
22279
|
*/
|
|
22247
22280
|
function createEnvironmentInjector(providers, parent, debugName = null) {
|
|
22248
22281
|
const adapter = new EnvironmentNgModuleRefAdapter(providers, parent, debugName);
|
|
@@ -26039,17 +26072,17 @@ class TestBedCompiler {
|
|
|
26039
26072
|
getProviderOverrides(providers) {
|
|
26040
26073
|
if (!providers || !providers.length || this.providerOverridesByToken.size === 0)
|
|
26041
26074
|
return [];
|
|
26042
|
-
// There are two flattening operations here. The inner
|
|
26043
|
-
// providers and applies a mapping function which retrieves overrides for each
|
|
26044
|
-
// provider. The outer flatten() then flattens the produced overrides array. If this is
|
|
26045
|
-
// done, the array can contain other empty arrays (e.g. `[[], []]`) which leak into the
|
|
26075
|
+
// There are two flattening operations here. The inner flattenProviders() operates on the
|
|
26076
|
+
// metadata's providers and applies a mapping function which retrieves overrides for each
|
|
26077
|
+
// incoming provider. The outer flatten() then flattens the produced overrides array. If this is
|
|
26078
|
+
// not done, the array can contain other empty arrays (e.g. `[[], []]`) which leak into the
|
|
26046
26079
|
// providers array and contaminate any error messages that might be generated.
|
|
26047
|
-
return flatten(
|
|
26080
|
+
return flatten(flattenProviders(providers, (provider) => this.getSingleProviderOverrides(provider) || []));
|
|
26048
26081
|
}
|
|
26049
26082
|
getOverriddenProviders(providers) {
|
|
26050
26083
|
if (!providers || !providers.length || this.providerOverridesByToken.size === 0)
|
|
26051
26084
|
return [];
|
|
26052
|
-
const flattenedProviders =
|
|
26085
|
+
const flattenedProviders = flattenProviders(providers);
|
|
26053
26086
|
const overrides = this.getProviderOverrides(flattenedProviders);
|
|
26054
26087
|
const overriddenProviders = [...flattenedProviders, ...overrides];
|
|
26055
26088
|
const final = [];
|
|
@@ -26113,18 +26146,36 @@ function isNgModule(value) {
|
|
|
26113
26146
|
function maybeUnwrapFn(maybeFn) {
|
|
26114
26147
|
return maybeFn instanceof Function ? maybeFn() : maybeFn;
|
|
26115
26148
|
}
|
|
26116
|
-
function flatten(values
|
|
26149
|
+
function flatten(values) {
|
|
26117
26150
|
const out = [];
|
|
26118
26151
|
values.forEach(value => {
|
|
26119
26152
|
if (Array.isArray(value)) {
|
|
26120
|
-
out.push(...flatten(value
|
|
26153
|
+
out.push(...flatten(value));
|
|
26121
26154
|
}
|
|
26122
26155
|
else {
|
|
26123
|
-
out.push(
|
|
26156
|
+
out.push(value);
|
|
26124
26157
|
}
|
|
26125
26158
|
});
|
|
26126
26159
|
return out;
|
|
26127
26160
|
}
|
|
26161
|
+
function identityFn(value) {
|
|
26162
|
+
return value;
|
|
26163
|
+
}
|
|
26164
|
+
function flattenProviders(providers, mapFn = identityFn) {
|
|
26165
|
+
const out = [];
|
|
26166
|
+
for (let provider of providers) {
|
|
26167
|
+
if (ɵisEnvironmentProviders(provider)) {
|
|
26168
|
+
provider = provider.ɵproviders;
|
|
26169
|
+
}
|
|
26170
|
+
if (Array.isArray(provider)) {
|
|
26171
|
+
out.push(...flattenProviders(provider, mapFn));
|
|
26172
|
+
}
|
|
26173
|
+
else {
|
|
26174
|
+
out.push(mapFn(provider));
|
|
26175
|
+
}
|
|
26176
|
+
}
|
|
26177
|
+
return out;
|
|
26178
|
+
}
|
|
26128
26179
|
function getProviderField(provider, field) {
|
|
26129
26180
|
return provider && typeof provider === 'object' && provider[field];
|
|
26130
26181
|
}
|