@angular/core 14.0.0-rc.1 → 14.0.0-rc.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/di/interface/defs.mjs +1 -1
- package/esm2020/src/metadata/directives.mjs +1 -1
- package/esm2020/src/render3/features/standalone_feature.mjs +2 -2
- package/esm2020/src/render3/instructions/element.mjs +14 -7
- package/esm2020/src/render3/instructions/shared.mjs +31 -5
- package/esm2020/src/render3/interfaces/definition.mjs +1 -1
- package/esm2020/src/render3/jit/module.mjs +9 -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/r3_test_bed_compiler.mjs +62 -20
- package/fesm2015/core.mjs +51 -12
- package/fesm2015/core.mjs.map +1 -1
- package/fesm2015/testing.mjs +24645 -38
- package/fesm2015/testing.mjs.map +1 -1
- package/fesm2020/core.mjs +51 -12
- package/fesm2020/core.mjs.map +1 -1
- package/fesm2020/testing.mjs +24644 -38
- package/fesm2020/testing.mjs.map +1 -1
- package/index.d.ts +47 -14
- package/package.json +1 -1
- package/testing/index.d.ts +1 -1
package/fesm2020/core.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-rc.
|
|
2
|
+
* @license Angular v14.0.0-rc.2
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -11368,6 +11368,21 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
|
|
|
11368
11368
|
}
|
|
11369
11369
|
return tNode;
|
|
11370
11370
|
}
|
|
11371
|
+
/**
|
|
11372
|
+
* Checks if the current component is declared inside of a standalone component template.
|
|
11373
|
+
*
|
|
11374
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11375
|
+
*/
|
|
11376
|
+
function isHostComponentStandalone(lView) {
|
|
11377
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
11378
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
11379
|
+
const context = declarationLView[CONTEXT];
|
|
11380
|
+
// Unable to obtain a context, fall back to the non-standalone scenario.
|
|
11381
|
+
if (!context)
|
|
11382
|
+
return false;
|
|
11383
|
+
const componentDef = getComponentDef(context.constructor);
|
|
11384
|
+
return !!(componentDef?.standalone);
|
|
11385
|
+
}
|
|
11371
11386
|
/**
|
|
11372
11387
|
* When elements are created dynamically after a view blueprint is created (e.g. through
|
|
11373
11388
|
* i18nApply()), we need to adjust the blueprint for future
|
|
@@ -12036,7 +12051,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12036
12051
|
validateAgainstEventProperties(propName);
|
|
12037
12052
|
if (!validateProperty(element, tNode.value, propName, tView.schemas)) {
|
|
12038
12053
|
// Return here since we only log warnings for unknown properties.
|
|
12039
|
-
handleUnknownPropertyError(propName, tNode
|
|
12054
|
+
handleUnknownPropertyError(propName, tNode);
|
|
12040
12055
|
return;
|
|
12041
12056
|
}
|
|
12042
12057
|
ngDevMode.rendererSetProperty++;
|
|
@@ -12056,7 +12071,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12056
12071
|
// If the node is a container and the property didn't
|
|
12057
12072
|
// match any of the inputs or schemas we should throw.
|
|
12058
12073
|
if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
|
|
12059
|
-
handleUnknownPropertyError(propName, tNode
|
|
12074
|
+
handleUnknownPropertyError(propName, tNode);
|
|
12060
12075
|
}
|
|
12061
12076
|
}
|
|
12062
12077
|
}
|
|
@@ -12162,7 +12177,17 @@ function matchingSchemas(schemas, tagName) {
|
|
|
12162
12177
|
* @param propName Name of the invalid property.
|
|
12163
12178
|
* @param tagName Name of the node on which we encountered the property.
|
|
12164
12179
|
*/
|
|
12165
|
-
function handleUnknownPropertyError(propName,
|
|
12180
|
+
function handleUnknownPropertyError(propName, tNode) {
|
|
12181
|
+
let tagName = tNode.value;
|
|
12182
|
+
// Special-case a situation when a structural directive is applied to
|
|
12183
|
+
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
12184
|
+
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
12185
|
+
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
12186
|
+
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
12187
|
+
// a default value of the `tNode.value` is not feasible at this moment.
|
|
12188
|
+
if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
|
|
12189
|
+
tagName = 'ng-template';
|
|
12190
|
+
}
|
|
12166
12191
|
const message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'.`;
|
|
12167
12192
|
if (shouldThrowErrorOnUnknownProperty) {
|
|
12168
12193
|
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
@@ -14948,7 +14973,10 @@ function elementStartFirstCreatePass(index, tView, lView, native, name, attrsInd
|
|
|
14948
14973
|
const attrs = getConstant(tViewConsts, attrsIndex);
|
|
14949
14974
|
const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, name, attrs);
|
|
14950
14975
|
const hasDirectives = resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
|
|
14951
|
-
|
|
14976
|
+
if (ngDevMode) {
|
|
14977
|
+
const hostIsStandalone = isHostComponentStandalone(lView);
|
|
14978
|
+
validateElementIsKnown(native, tNode.value, tView.schemas, hasDirectives, hostIsStandalone);
|
|
14979
|
+
}
|
|
14952
14980
|
if (tNode.attrs !== null) {
|
|
14953
14981
|
computeStaticStyling(tNode, tNode.attrs, false);
|
|
14954
14982
|
}
|
|
@@ -15088,8 +15116,9 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
|
|
15088
15116
|
* @param tagName Name of the tag to check
|
|
15089
15117
|
* @param schemas Array of schemas
|
|
15090
15118
|
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
15119
|
+
* @param hostIsStandalone Boolean indicating whether the host is a standalone component
|
|
15091
15120
|
*/
|
|
15092
|
-
function validateElementIsKnown(element, tagName, schemas, hasDirectives) {
|
|
15121
|
+
function validateElementIsKnown(element, tagName, schemas, hasDirectives, hostIsStandalone) {
|
|
15093
15122
|
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
15094
15123
|
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
15095
15124
|
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
@@ -15109,14 +15138,17 @@ function validateElementIsKnown(element, tagName, schemas, hasDirectives) {
|
|
|
15109
15138
|
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
15110
15139
|
!customElements.get(tagName));
|
|
15111
15140
|
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
15141
|
+
const schemas = `'${hostIsStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
15112
15142
|
let message = `'${tagName}' is not a known element:\n`;
|
|
15113
|
-
message += `1. If '${tagName}' is an Angular component, then verify that it is
|
|
15143
|
+
message += `1. If '${tagName}' is an Angular component, then verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
15144
|
+
'a part of this module'}.\n`;
|
|
15114
15145
|
if (tagName && tagName.indexOf('-') > -1) {
|
|
15115
|
-
message +=
|
|
15146
|
+
message +=
|
|
15147
|
+
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
15116
15148
|
}
|
|
15117
15149
|
else {
|
|
15118
15150
|
message +=
|
|
15119
|
-
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the
|
|
15151
|
+
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
15120
15152
|
}
|
|
15121
15153
|
if (shouldThrowErrorOnUnknownElement) {
|
|
15122
15154
|
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
@@ -21609,7 +21641,7 @@ class Version {
|
|
|
21609
21641
|
/**
|
|
21610
21642
|
* @publicApi
|
|
21611
21643
|
*/
|
|
21612
|
-
const VERSION = new Version('14.0.0-rc.
|
|
21644
|
+
const VERSION = new Version('14.0.0-rc.2');
|
|
21613
21645
|
|
|
21614
21646
|
/**
|
|
21615
21647
|
* @license
|
|
@@ -22337,7 +22369,7 @@ StandaloneService.ɵprov = ɵɵdefineInjectable({
|
|
|
22337
22369
|
factory: () => new StandaloneService(ɵɵinject(EnvironmentInjector)),
|
|
22338
22370
|
});
|
|
22339
22371
|
/**
|
|
22340
|
-
* A feature that acts as a setup code for the {@
|
|
22372
|
+
* A feature that acts as a setup code for the {@link StandaloneService}.
|
|
22341
22373
|
*
|
|
22342
22374
|
* The most important responsaibility of this feature is to expose the "getStandaloneInjector"
|
|
22343
22375
|
* function (an entry points to a standalone injector creation) on a component definition object. We
|
|
@@ -24409,6 +24441,12 @@ function isStandalone(type) {
|
|
|
24409
24441
|
const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
|
|
24410
24442
|
return def !== null ? def.standalone : false;
|
|
24411
24443
|
}
|
|
24444
|
+
function generateStandaloneInDeclarationsError(type, location) {
|
|
24445
|
+
const prefix = `Unexpected "${stringifyForError(type)}" found in the "declarations" array of the`;
|
|
24446
|
+
const suffix = `"${stringifyForError(type)}" is marked as standalone and can't be declared ` +
|
|
24447
|
+
'in any NgModule - did you intend to import it instead (by adding it to the "imports" array)?';
|
|
24448
|
+
return `${prefix} ${location}, ${suffix}`;
|
|
24449
|
+
}
|
|
24412
24450
|
function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot, importingModule) {
|
|
24413
24451
|
if (verifiedNgModule.get(moduleType))
|
|
24414
24452
|
return;
|
|
@@ -24480,7 +24518,8 @@ function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRo
|
|
|
24480
24518
|
type = resolveForwardRef(type);
|
|
24481
24519
|
const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
|
|
24482
24520
|
if (def?.standalone) {
|
|
24483
|
-
|
|
24521
|
+
const location = `"${stringifyForError(moduleType)}" NgModule`;
|
|
24522
|
+
errors.push(generateStandaloneInDeclarationsError(type, location));
|
|
24484
24523
|
}
|
|
24485
24524
|
}
|
|
24486
24525
|
function verifyExportsAreDeclaredOrReExported(type) {
|