@angular/core 15.2.2 → 15.2.4
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/change_detection/change_detector_ref.mjs +4 -4
- package/esm2020/src/render3/definition.mjs +53 -42
- package/esm2020/src/render3/interfaces/type_checks.mjs +2 -2
- package/esm2020/src/render3/node_selector_matcher.mjs +17 -5
- package/esm2020/src/render3/util/discovery_utils.mjs +3 -2
- package/esm2020/src/render3/view_ref.mjs +1 -1
- 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 +12 -7
- package/fesm2015/core.mjs +72 -66
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +83 -72
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +73 -49
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +84 -55
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +244 -356
- package/package.json +1 -1
- package/schematics/migrations/relative-link-resolution/bundle.js +7 -7
- package/schematics/migrations/router-link-with-href/bundle.js +10 -10
- package/schematics/ng-generate/standalone-migration/bundle.js +323 -323
- package/schematics/ng-generate/standalone-migration/bundle.js.map +1 -1
- package/testing/index.d.ts +1 -1
package/fesm2015/testing.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v15.2.
|
|
2
|
+
* @license Angular v15.2.4
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2195,7 +2195,7 @@ let componentDefCount = 0;
|
|
|
2195
2195
|
*
|
|
2196
2196
|
* # Example
|
|
2197
2197
|
* ```
|
|
2198
|
-
* class
|
|
2198
|
+
* class MyComponent {
|
|
2199
2199
|
* // Generated by Angular Template Compiler
|
|
2200
2200
|
* // [Symbol] syntax will not be supported by TypeScript until v2.7
|
|
2201
2201
|
* static ɵcmp = defineComponent({
|
|
@@ -2210,61 +2210,12 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
2210
2210
|
// Initialize ngDevMode. This must be the first statement in ɵɵdefineComponent.
|
|
2211
2211
|
// See the `initNgDevMode` docstring for more information.
|
|
2212
2212
|
(typeof ngDevMode === 'undefined' || ngDevMode) && initNgDevMode();
|
|
2213
|
-
const
|
|
2214
|
-
const
|
|
2215
|
-
|
|
2216
|
-
const def = {
|
|
2217
|
-
type: type,
|
|
2218
|
-
providersResolver: null,
|
|
2219
|
-
decls: componentDefinition.decls,
|
|
2220
|
-
vars: componentDefinition.vars,
|
|
2221
|
-
factory: null,
|
|
2222
|
-
template: componentDefinition.template || null,
|
|
2223
|
-
consts: componentDefinition.consts || null,
|
|
2224
|
-
ngContentSelectors: componentDefinition.ngContentSelectors,
|
|
2225
|
-
hostBindings: componentDefinition.hostBindings || null,
|
|
2226
|
-
hostVars: componentDefinition.hostVars || 0,
|
|
2227
|
-
hostAttrs: componentDefinition.hostAttrs || null,
|
|
2228
|
-
contentQueries: componentDefinition.contentQueries || null,
|
|
2229
|
-
declaredInputs: declaredInputs,
|
|
2230
|
-
inputs: null,
|
|
2231
|
-
outputs: null,
|
|
2232
|
-
exportAs: componentDefinition.exportAs || null,
|
|
2233
|
-
onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush,
|
|
2234
|
-
directiveDefs: null,
|
|
2235
|
-
pipeDefs: null,
|
|
2236
|
-
standalone,
|
|
2237
|
-
dependencies: standalone && componentDefinition.dependencies || null,
|
|
2238
|
-
getStandaloneInjector: null,
|
|
2239
|
-
selectors: componentDefinition.selectors || EMPTY_ARRAY,
|
|
2240
|
-
viewQuery: componentDefinition.viewQuery || null,
|
|
2241
|
-
features: componentDefinition.features || null,
|
|
2242
|
-
data: componentDefinition.data || {},
|
|
2243
|
-
encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated,
|
|
2244
|
-
id: `c${componentDefCount++}`,
|
|
2245
|
-
styles: componentDefinition.styles || EMPTY_ARRAY,
|
|
2246
|
-
_: null,
|
|
2247
|
-
setInput: null,
|
|
2248
|
-
schemas: componentDefinition.schemas || null,
|
|
2249
|
-
tView: null,
|
|
2250
|
-
findHostDirectiveDefs: null,
|
|
2251
|
-
hostDirectives: null,
|
|
2252
|
-
};
|
|
2213
|
+
const baseDef = getNgDirectiveDef(componentDefinition);
|
|
2214
|
+
const def = Object.assign(Object.assign({}, baseDef), { decls: componentDefinition.decls, vars: componentDefinition.vars, template: componentDefinition.template, consts: componentDefinition.consts || null, ngContentSelectors: componentDefinition.ngContentSelectors, onPush: componentDefinition.changeDetection === ChangeDetectionStrategy.OnPush, directiveDefs: null, pipeDefs: null, dependencies: baseDef.standalone && componentDefinition.dependencies || null, getStandaloneInjector: null, data: componentDefinition.data || {}, encapsulation: componentDefinition.encapsulation || ViewEncapsulation.Emulated, id: `c${componentDefCount++}`, styles: componentDefinition.styles || EMPTY_ARRAY, _: null, schemas: componentDefinition.schemas || null, tView: null });
|
|
2215
|
+
initFeatures(def);
|
|
2253
2216
|
const dependencies = componentDefinition.dependencies;
|
|
2254
|
-
|
|
2255
|
-
def.
|
|
2256
|
-
def.outputs = invertObject(componentDefinition.outputs),
|
|
2257
|
-
feature && feature.forEach((fn) => fn(def));
|
|
2258
|
-
def.directiveDefs = dependencies ?
|
|
2259
|
-
(() => (typeof dependencies === 'function' ? dependencies() : dependencies)
|
|
2260
|
-
.map(extractDirectiveDef)
|
|
2261
|
-
.filter(nonNull)) :
|
|
2262
|
-
null;
|
|
2263
|
-
def.pipeDefs = dependencies ?
|
|
2264
|
-
(() => (typeof dependencies === 'function' ? dependencies() : dependencies)
|
|
2265
|
-
.map(getPipeDef$1)
|
|
2266
|
-
.filter(nonNull)) :
|
|
2267
|
-
null;
|
|
2217
|
+
def.directiveDefs = extractDefListOrFactory(dependencies, /* pipeDef */ false);
|
|
2218
|
+
def.pipeDefs = extractDefListOrFactory(dependencies, /* pipeDef */ true);
|
|
2268
2219
|
return def;
|
|
2269
2220
|
});
|
|
2270
2221
|
}
|
|
@@ -2279,8 +2230,8 @@ function ɵɵdefineComponent(componentDefinition) {
|
|
|
2279
2230
|
*/
|
|
2280
2231
|
function ɵɵsetComponentScope(type, directives, pipes) {
|
|
2281
2232
|
const def = type.ɵcmp;
|
|
2282
|
-
def.directiveDefs = (
|
|
2283
|
-
def.pipeDefs = (
|
|
2233
|
+
def.directiveDefs = extractDefListOrFactory(directives, /* pipeDef */ false);
|
|
2234
|
+
def.pipeDefs = extractDefListOrFactory(pipes, /* pipeDef */ true);
|
|
2284
2235
|
}
|
|
2285
2236
|
function extractDirectiveDef(type) {
|
|
2286
2237
|
return getComponentDef$1(type) || getDirectiveDef(type);
|
|
@@ -2415,7 +2366,13 @@ function invertObject(obj, secondary) {
|
|
|
2415
2366
|
*
|
|
2416
2367
|
* @codeGenApi
|
|
2417
2368
|
*/
|
|
2418
|
-
|
|
2369
|
+
function ɵɵdefineDirective(directiveDefinition) {
|
|
2370
|
+
return noSideEffects(() => {
|
|
2371
|
+
const def = getNgDirectiveDef(directiveDefinition);
|
|
2372
|
+
initFeatures(def);
|
|
2373
|
+
return def;
|
|
2374
|
+
});
|
|
2375
|
+
}
|
|
2419
2376
|
/**
|
|
2420
2377
|
* Create a pipe definition object.
|
|
2421
2378
|
*
|
|
@@ -2475,6 +2432,42 @@ function getNgModuleDef(type, throwNotFound) {
|
|
|
2475
2432
|
}
|
|
2476
2433
|
return ngModuleDef;
|
|
2477
2434
|
}
|
|
2435
|
+
function getNgDirectiveDef(directiveDefinition) {
|
|
2436
|
+
const declaredInputs = {};
|
|
2437
|
+
return {
|
|
2438
|
+
type: directiveDefinition.type,
|
|
2439
|
+
providersResolver: null,
|
|
2440
|
+
factory: null,
|
|
2441
|
+
hostBindings: directiveDefinition.hostBindings || null,
|
|
2442
|
+
hostVars: directiveDefinition.hostVars || 0,
|
|
2443
|
+
hostAttrs: directiveDefinition.hostAttrs || null,
|
|
2444
|
+
contentQueries: directiveDefinition.contentQueries || null,
|
|
2445
|
+
declaredInputs,
|
|
2446
|
+
exportAs: directiveDefinition.exportAs || null,
|
|
2447
|
+
standalone: directiveDefinition.standalone === true,
|
|
2448
|
+
selectors: directiveDefinition.selectors || EMPTY_ARRAY,
|
|
2449
|
+
viewQuery: directiveDefinition.viewQuery || null,
|
|
2450
|
+
features: directiveDefinition.features || null,
|
|
2451
|
+
setInput: null,
|
|
2452
|
+
findHostDirectiveDefs: null,
|
|
2453
|
+
hostDirectives: null,
|
|
2454
|
+
inputs: invertObject(directiveDefinition.inputs, declaredInputs),
|
|
2455
|
+
outputs: invertObject(directiveDefinition.outputs),
|
|
2456
|
+
};
|
|
2457
|
+
}
|
|
2458
|
+
function initFeatures(definition) {
|
|
2459
|
+
var _a;
|
|
2460
|
+
(_a = definition.features) === null || _a === void 0 ? void 0 : _a.forEach((fn) => fn(definition));
|
|
2461
|
+
}
|
|
2462
|
+
function extractDefListOrFactory(dependencies, pipeDef) {
|
|
2463
|
+
if (!dependencies) {
|
|
2464
|
+
return null;
|
|
2465
|
+
}
|
|
2466
|
+
const defExtractor = pipeDef ? getPipeDef$1 : extractDirectiveDef;
|
|
2467
|
+
return () => (typeof dependencies === 'function' ? dependencies() : dependencies)
|
|
2468
|
+
.map(dep => defExtractor(dep))
|
|
2469
|
+
.filter(nonNull);
|
|
2470
|
+
}
|
|
2478
2471
|
|
|
2479
2472
|
/**
|
|
2480
2473
|
* Special location which allows easy identification of type. If we have an array which was
|
|
@@ -2576,7 +2569,7 @@ function isDirectiveHost(tNode) {
|
|
|
2576
2569
|
return (tNode.flags & 1 /* TNodeFlags.isDirectiveHost */) === 1 /* TNodeFlags.isDirectiveHost */;
|
|
2577
2570
|
}
|
|
2578
2571
|
function isComponentDef(def) {
|
|
2579
|
-
return def.template
|
|
2572
|
+
return !!def.template;
|
|
2580
2573
|
}
|
|
2581
2574
|
function isRootView(target) {
|
|
2582
2575
|
return (target[FLAGS] & 256 /* LViewFlags.IsRoot */) !== 0;
|
|
@@ -8702,7 +8695,7 @@ class Version {
|
|
|
8702
8695
|
/**
|
|
8703
8696
|
* @publicApi
|
|
8704
8697
|
*/
|
|
8705
|
-
const VERSION = new Version('15.2.
|
|
8698
|
+
const VERSION = new Version('15.2.4');
|
|
8706
8699
|
|
|
8707
8700
|
// This default value is when checking the hierarchy for a token.
|
|
8708
8701
|
//
|
|
@@ -8936,12 +8929,19 @@ function isCssClassMatching(attrs, cssClassToMatch, isProjectionMode) {
|
|
|
8936
8929
|
ngDevMode &&
|
|
8937
8930
|
assertEqual(cssClassToMatch, cssClassToMatch.toLowerCase(), 'Class name expected to be lowercase.');
|
|
8938
8931
|
let i = 0;
|
|
8932
|
+
// Indicates whether we are processing value from the implicit
|
|
8933
|
+
// attribute section (i.e. before the first marker in the array).
|
|
8934
|
+
let isImplicitAttrsSection = true;
|
|
8939
8935
|
while (i < attrs.length) {
|
|
8940
8936
|
let item = attrs[i++];
|
|
8941
|
-
if (
|
|
8942
|
-
|
|
8943
|
-
if (
|
|
8944
|
-
|
|
8937
|
+
if (typeof item === 'string' && isImplicitAttrsSection) {
|
|
8938
|
+
const value = attrs[i++];
|
|
8939
|
+
if (isProjectionMode && item === 'class') {
|
|
8940
|
+
// We found a `class` attribute in the implicit attribute section,
|
|
8941
|
+
// check if it matches the value of the `cssClassToMatch` argument.
|
|
8942
|
+
if (classIndexOf(value.toLowerCase(), cssClassToMatch, 0) !== -1) {
|
|
8943
|
+
return true;
|
|
8944
|
+
}
|
|
8945
8945
|
}
|
|
8946
8946
|
}
|
|
8947
8947
|
else if (item === 1 /* AttributeMarker.Classes */) {
|
|
@@ -8953,6 +8953,11 @@ function isCssClassMatching(attrs, cssClassToMatch, isProjectionMode) {
|
|
|
8953
8953
|
}
|
|
8954
8954
|
return false;
|
|
8955
8955
|
}
|
|
8956
|
+
else if (typeof item === 'number') {
|
|
8957
|
+
// We've came across a first marker, which indicates
|
|
8958
|
+
// that the implicit attribute section is over.
|
|
8959
|
+
isImplicitAttrsSection = false;
|
|
8960
|
+
}
|
|
8956
8961
|
}
|
|
8957
8962
|
return false;
|
|
8958
8963
|
}
|
|
@@ -20581,7 +20586,8 @@ function sortListeners(a, b) {
|
|
|
20581
20586
|
* See call site for more info.
|
|
20582
20587
|
*/
|
|
20583
20588
|
function isDirectiveDefHack(obj) {
|
|
20584
|
-
return obj.type !== undefined && obj.
|
|
20589
|
+
return obj.type !== undefined && obj.declaredInputs !== undefined &&
|
|
20590
|
+
obj.findHostDirectiveDefs !== undefined;
|
|
20585
20591
|
}
|
|
20586
20592
|
/**
|
|
20587
20593
|
* Retrieve the component `LView` from component/element.
|
|
@@ -23576,10 +23582,11 @@ class TestBedCompiler {
|
|
|
23576
23582
|
}
|
|
23577
23583
|
}
|
|
23578
23584
|
queueTypesFromModulesArray(arr) {
|
|
23579
|
-
// Because we may encounter the same NgModule
|
|
23580
|
-
// NgModule
|
|
23581
|
-
// encountered. In some test setups, this caching
|
|
23582
|
-
|
|
23585
|
+
// Because we may encounter the same NgModule or a standalone Component while processing
|
|
23586
|
+
// the dependencies of an NgModule or a standalone Component, we cache them in this set so we
|
|
23587
|
+
// can skip ones that have already been seen encountered. In some test setups, this caching
|
|
23588
|
+
// resulted in 10X runtime improvement.
|
|
23589
|
+
const processedDefs = new Set();
|
|
23583
23590
|
const queueTypesFromModulesArrayRecur = (arr) => {
|
|
23584
23591
|
var _a;
|
|
23585
23592
|
for (const value of arr) {
|
|
@@ -23588,10 +23595,10 @@ class TestBedCompiler {
|
|
|
23588
23595
|
}
|
|
23589
23596
|
else if (hasNgModuleDef(value)) {
|
|
23590
23597
|
const def = value.ɵmod;
|
|
23591
|
-
if (
|
|
23598
|
+
if (processedDefs.has(def)) {
|
|
23592
23599
|
continue;
|
|
23593
23600
|
}
|
|
23594
|
-
|
|
23601
|
+
processedDefs.add(def);
|
|
23595
23602
|
// Look through declarations, imports, and exports, and queue
|
|
23596
23603
|
// everything found there.
|
|
23597
23604
|
this.queueTypeArray(maybeUnwrapFn(def.declarations), value);
|
|
@@ -23604,6 +23611,10 @@ class TestBedCompiler {
|
|
|
23604
23611
|
else if (isStandaloneComponent(value)) {
|
|
23605
23612
|
this.queueType(value, null);
|
|
23606
23613
|
const def = getComponentDef(value);
|
|
23614
|
+
if (processedDefs.has(def)) {
|
|
23615
|
+
continue;
|
|
23616
|
+
}
|
|
23617
|
+
processedDefs.add(def);
|
|
23607
23618
|
const dependencies = maybeUnwrapFn((_a = def.dependencies) !== null && _a !== void 0 ? _a : []);
|
|
23608
23619
|
dependencies.forEach((dependency) => {
|
|
23609
23620
|
// Note: in AOT, the `dependencies` might also contain regular
|