@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/fesm2015/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
|
*/
|
|
@@ -11354,6 +11354,21 @@ function createTNodeAtIndex(tView, index, type, name, attrs) {
|
|
|
11354
11354
|
}
|
|
11355
11355
|
return tNode;
|
|
11356
11356
|
}
|
|
11357
|
+
/**
|
|
11358
|
+
* Checks if the current component is declared inside of a standalone component template.
|
|
11359
|
+
*
|
|
11360
|
+
* @param lView An `LView` that represents a current component that is being rendered.
|
|
11361
|
+
*/
|
|
11362
|
+
function isHostComponentStandalone(lView) {
|
|
11363
|
+
!ngDevMode && throwError('Must never be called in production mode');
|
|
11364
|
+
const declarationLView = lView[DECLARATION_COMPONENT_VIEW];
|
|
11365
|
+
const context = declarationLView[CONTEXT];
|
|
11366
|
+
// Unable to obtain a context, fall back to the non-standalone scenario.
|
|
11367
|
+
if (!context)
|
|
11368
|
+
return false;
|
|
11369
|
+
const componentDef = getComponentDef(context.constructor);
|
|
11370
|
+
return !!(componentDef === null || componentDef === void 0 ? void 0 : componentDef.standalone);
|
|
11371
|
+
}
|
|
11357
11372
|
/**
|
|
11358
11373
|
* When elements are created dynamically after a view blueprint is created (e.g. through
|
|
11359
11374
|
* i18nApply()), we need to adjust the blueprint for future
|
|
@@ -12022,7 +12037,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12022
12037
|
validateAgainstEventProperties(propName);
|
|
12023
12038
|
if (!validateProperty(element, tNode.value, propName, tView.schemas)) {
|
|
12024
12039
|
// Return here since we only log warnings for unknown properties.
|
|
12025
|
-
handleUnknownPropertyError(propName, tNode
|
|
12040
|
+
handleUnknownPropertyError(propName, tNode);
|
|
12026
12041
|
return;
|
|
12027
12042
|
}
|
|
12028
12043
|
ngDevMode.rendererSetProperty++;
|
|
@@ -12042,7 +12057,7 @@ function elementPropertyInternal(tView, tNode, lView, propName, value, renderer,
|
|
|
12042
12057
|
// If the node is a container and the property didn't
|
|
12043
12058
|
// match any of the inputs or schemas we should throw.
|
|
12044
12059
|
if (ngDevMode && !matchingSchemas(tView.schemas, tNode.value)) {
|
|
12045
|
-
handleUnknownPropertyError(propName, tNode
|
|
12060
|
+
handleUnknownPropertyError(propName, tNode);
|
|
12046
12061
|
}
|
|
12047
12062
|
}
|
|
12048
12063
|
}
|
|
@@ -12148,7 +12163,17 @@ function matchingSchemas(schemas, tagName) {
|
|
|
12148
12163
|
* @param propName Name of the invalid property.
|
|
12149
12164
|
* @param tagName Name of the node on which we encountered the property.
|
|
12150
12165
|
*/
|
|
12151
|
-
function handleUnknownPropertyError(propName,
|
|
12166
|
+
function handleUnknownPropertyError(propName, tNode) {
|
|
12167
|
+
let tagName = tNode.value;
|
|
12168
|
+
// Special-case a situation when a structural directive is applied to
|
|
12169
|
+
// an `<ng-template>` element, for example: `<ng-template *ngIf="true">`.
|
|
12170
|
+
// In this case the compiler generates the `ɵɵtemplate` instruction with
|
|
12171
|
+
// the `null` as the tagName. The directive matching logic at runtime relies
|
|
12172
|
+
// on this effect (see `isInlineTemplate`), thus using the 'ng-template' as
|
|
12173
|
+
// a default value of the `tNode.value` is not feasible at this moment.
|
|
12174
|
+
if (!tagName && tNode.type === 4 /* TNodeType.Container */) {
|
|
12175
|
+
tagName = 'ng-template';
|
|
12176
|
+
}
|
|
12152
12177
|
const message = `Can't bind to '${propName}' since it isn't a known property of '${tagName}'.`;
|
|
12153
12178
|
if (shouldThrowErrorOnUnknownProperty) {
|
|
12154
12179
|
throw new RuntimeError(303 /* RuntimeErrorCode.UNKNOWN_BINDING */, message);
|
|
@@ -14934,7 +14959,10 @@ function elementStartFirstCreatePass(index, tView, lView, native, name, attrsInd
|
|
|
14934
14959
|
const attrs = getConstant(tViewConsts, attrsIndex);
|
|
14935
14960
|
const tNode = getOrCreateTNode(tView, index, 2 /* TNodeType.Element */, name, attrs);
|
|
14936
14961
|
const hasDirectives = resolveDirectives(tView, lView, tNode, getConstant(tViewConsts, localRefsIndex));
|
|
14937
|
-
|
|
14962
|
+
if (ngDevMode) {
|
|
14963
|
+
const hostIsStandalone = isHostComponentStandalone(lView);
|
|
14964
|
+
validateElementIsKnown(native, tNode.value, tView.schemas, hasDirectives, hostIsStandalone);
|
|
14965
|
+
}
|
|
14938
14966
|
if (tNode.attrs !== null) {
|
|
14939
14967
|
computeStaticStyling(tNode, tNode.attrs, false);
|
|
14940
14968
|
}
|
|
@@ -15074,8 +15102,9 @@ function ɵɵelement(index, name, attrsIndex, localRefsIndex) {
|
|
|
15074
15102
|
* @param tagName Name of the tag to check
|
|
15075
15103
|
* @param schemas Array of schemas
|
|
15076
15104
|
* @param hasDirectives Boolean indicating that the element matches any directive
|
|
15105
|
+
* @param hostIsStandalone Boolean indicating whether the host is a standalone component
|
|
15077
15106
|
*/
|
|
15078
|
-
function validateElementIsKnown(element, tagName, schemas, hasDirectives) {
|
|
15107
|
+
function validateElementIsKnown(element, tagName, schemas, hasDirectives, hostIsStandalone) {
|
|
15079
15108
|
// If `schemas` is set to `null`, that's an indication that this Component was compiled in AOT
|
|
15080
15109
|
// mode where this check happens at compile time. In JIT mode, `schemas` is always present and
|
|
15081
15110
|
// defined as an array (as an empty array in case `schemas` field is not defined) and we should
|
|
@@ -15095,14 +15124,17 @@ function validateElementIsKnown(element, tagName, schemas, hasDirectives) {
|
|
|
15095
15124
|
(typeof customElements !== 'undefined' && tagName.indexOf('-') > -1 &&
|
|
15096
15125
|
!customElements.get(tagName));
|
|
15097
15126
|
if (isUnknown && !matchingSchemas(schemas, tagName)) {
|
|
15127
|
+
const schemas = `'${hostIsStandalone ? '@Component' : '@NgModule'}.schemas'`;
|
|
15098
15128
|
let message = `'${tagName}' is not a known element:\n`;
|
|
15099
|
-
message += `1. If '${tagName}' is an Angular component, then verify that it is
|
|
15129
|
+
message += `1. If '${tagName}' is an Angular component, then verify that it is ${hostIsStandalone ? 'included in the \'@Component.imports\' of this component' :
|
|
15130
|
+
'a part of this module'}.\n`;
|
|
15100
15131
|
if (tagName && tagName.indexOf('-') > -1) {
|
|
15101
|
-
message +=
|
|
15132
|
+
message +=
|
|
15133
|
+
`2. If '${tagName}' is a Web Component then add 'CUSTOM_ELEMENTS_SCHEMA' to the ${schemas} of this component to suppress this message.`;
|
|
15102
15134
|
}
|
|
15103
15135
|
else {
|
|
15104
15136
|
message +=
|
|
15105
|
-
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the
|
|
15137
|
+
`2. To allow any element add 'NO_ERRORS_SCHEMA' to the ${schemas} of this component.`;
|
|
15106
15138
|
}
|
|
15107
15139
|
if (shouldThrowErrorOnUnknownElement) {
|
|
15108
15140
|
throw new RuntimeError(304 /* RuntimeErrorCode.UNKNOWN_ELEMENT */, message);
|
|
@@ -21595,7 +21627,7 @@ class Version {
|
|
|
21595
21627
|
/**
|
|
21596
21628
|
* @publicApi
|
|
21597
21629
|
*/
|
|
21598
|
-
const VERSION = new Version('14.0.0-rc.
|
|
21630
|
+
const VERSION = new Version('14.0.0-rc.2');
|
|
21599
21631
|
|
|
21600
21632
|
/**
|
|
21601
21633
|
* @license
|
|
@@ -22323,7 +22355,7 @@ StandaloneService.ɵprov = ɵɵdefineInjectable({
|
|
|
22323
22355
|
factory: () => new StandaloneService(ɵɵinject(EnvironmentInjector)),
|
|
22324
22356
|
});
|
|
22325
22357
|
/**
|
|
22326
|
-
* A feature that acts as a setup code for the {@
|
|
22358
|
+
* A feature that acts as a setup code for the {@link StandaloneService}.
|
|
22327
22359
|
*
|
|
22328
22360
|
* The most important responsaibility of this feature is to expose the "getStandaloneInjector"
|
|
22329
22361
|
* function (an entry points to a standalone injector creation) on a component definition object. We
|
|
@@ -24396,6 +24428,12 @@ function isStandalone(type) {
|
|
|
24396
24428
|
const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
|
|
24397
24429
|
return def !== null ? def.standalone : false;
|
|
24398
24430
|
}
|
|
24431
|
+
function generateStandaloneInDeclarationsError(type, location) {
|
|
24432
|
+
const prefix = `Unexpected "${stringifyForError(type)}" found in the "declarations" array of the`;
|
|
24433
|
+
const suffix = `"${stringifyForError(type)}" is marked as standalone and can't be declared ` +
|
|
24434
|
+
'in any NgModule - did you intend to import it instead (by adding it to the "imports" array)?';
|
|
24435
|
+
return `${prefix} ${location}, ${suffix}`;
|
|
24436
|
+
}
|
|
24399
24437
|
function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRoot, importingModule) {
|
|
24400
24438
|
if (verifiedNgModule.get(moduleType))
|
|
24401
24439
|
return;
|
|
@@ -24467,7 +24505,8 @@ function verifySemanticsOfNgModuleDef(moduleType, allowDuplicateDeclarationsInRo
|
|
|
24467
24505
|
type = resolveForwardRef(type);
|
|
24468
24506
|
const def = getComponentDef(type) || getDirectiveDef(type) || getPipeDef$1(type);
|
|
24469
24507
|
if (def === null || def === void 0 ? void 0 : def.standalone) {
|
|
24470
|
-
|
|
24508
|
+
const location = `"${stringifyForError(moduleType)}" NgModule`;
|
|
24509
|
+
errors.push(generateStandaloneInDeclarationsError(type, location));
|
|
24471
24510
|
}
|
|
24472
24511
|
}
|
|
24473
24512
|
function verifyExportsAreDeclaredOrReExported(type) {
|