@angular/compiler 14.2.0 → 15.0.0-next.1
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/compiler_facade_interface.mjs +1 -1
- package/esm2020/src/jit_compiler_facade.mjs +23 -1
- package/esm2020/src/render3/partial/api.mjs +1 -1
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/directive.mjs +29 -4
- package/esm2020/src/render3/partial/factory.mjs +1 -1
- package/esm2020/src/render3/partial/injectable.mjs +1 -1
- package/esm2020/src/render3/partial/injector.mjs +1 -1
- package/esm2020/src/render3/partial/ng_module.mjs +1 -1
- package/esm2020/src/render3/partial/pipe.mjs +1 -1
- package/esm2020/src/render3/r3_identifiers.mjs +2 -1
- package/esm2020/src/render3/view/api.mjs +1 -1
- package/esm2020/src/render3/view/compiler.mjs +72 -5
- package/esm2020/src/render3/view/t2_binder.mjs +2 -2
- package/esm2020/src/schema/dom_element_schema_registry.mjs +28 -28
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +161 -42
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2020/compiler.mjs +156 -41
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/index.d.ts +39 -2
- package/package.json +2 -2
- package/testing/index.d.ts +1 -1
package/fesm2015/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular
|
|
2
|
+
* @license Angular v15.0.0-next.1
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2926,6 +2926,7 @@ Identifiers.InheritDefinitionFeature = { name: 'ɵɵInheritDefinitionFeature', m
|
|
|
2926
2926
|
Identifiers.CopyDefinitionFeature = { name: 'ɵɵCopyDefinitionFeature', moduleName: CORE };
|
|
2927
2927
|
Identifiers.StandaloneFeature = { name: 'ɵɵStandaloneFeature', moduleName: CORE };
|
|
2928
2928
|
Identifiers.ProvidersFeature = { name: 'ɵɵProvidersFeature', moduleName: CORE };
|
|
2929
|
+
Identifiers.HostDirectivesFeature = { name: 'ɵɵHostDirectivesFeature', moduleName: CORE };
|
|
2929
2930
|
Identifiers.listener = { name: 'ɵɵlistener', moduleName: CORE };
|
|
2930
2931
|
Identifiers.getInheritedFactory = {
|
|
2931
2932
|
name: 'ɵɵgetInheritedFactory',
|
|
@@ -14778,42 +14779,42 @@ const SCHEMA = [
|
|
|
14778
14779
|
'time^[HTMLElement]|dateTime',
|
|
14779
14780
|
':svg:cursor^:svg:|',
|
|
14780
14781
|
];
|
|
14781
|
-
const _ATTR_TO_PROP = {
|
|
14782
|
+
const _ATTR_TO_PROP = new Map(Object.entries({
|
|
14782
14783
|
'class': 'className',
|
|
14783
14784
|
'for': 'htmlFor',
|
|
14784
14785
|
'formaction': 'formAction',
|
|
14785
14786
|
'innerHtml': 'innerHTML',
|
|
14786
14787
|
'readonly': 'readOnly',
|
|
14787
14788
|
'tabindex': 'tabIndex',
|
|
14788
|
-
};
|
|
14789
|
+
}));
|
|
14789
14790
|
// Invert _ATTR_TO_PROP.
|
|
14790
|
-
const _PROP_TO_ATTR =
|
|
14791
|
-
inverted
|
|
14791
|
+
const _PROP_TO_ATTR = Array.from(_ATTR_TO_PROP).reduce((inverted, [propertyName, attributeName]) => {
|
|
14792
|
+
inverted.set(propertyName, attributeName);
|
|
14792
14793
|
return inverted;
|
|
14793
|
-
},
|
|
14794
|
+
}, new Map());
|
|
14794
14795
|
class DomElementSchemaRegistry extends ElementSchemaRegistry {
|
|
14795
14796
|
constructor() {
|
|
14796
14797
|
super();
|
|
14797
|
-
this._schema =
|
|
14798
|
+
this._schema = new Map();
|
|
14798
14799
|
// We don't allow binding to events for security reasons. Allowing event bindings would almost
|
|
14799
14800
|
// certainly introduce bad XSS vulnerabilities. Instead, we store events in a separate schema.
|
|
14800
|
-
this._eventSchema =
|
|
14801
|
+
this._eventSchema = new Map;
|
|
14801
14802
|
SCHEMA.forEach(encodedType => {
|
|
14802
|
-
const type =
|
|
14803
|
+
const type = new Map();
|
|
14803
14804
|
const events = new Set();
|
|
14804
14805
|
const [strType, strProperties] = encodedType.split('|');
|
|
14805
14806
|
const properties = strProperties.split(',');
|
|
14806
14807
|
const [typeNames, superName] = strType.split('^');
|
|
14807
14808
|
typeNames.split(',').forEach(tag => {
|
|
14808
|
-
this._schema
|
|
14809
|
-
this._eventSchema
|
|
14809
|
+
this._schema.set(tag.toLowerCase(), type);
|
|
14810
|
+
this._eventSchema.set(tag.toLowerCase(), events);
|
|
14810
14811
|
});
|
|
14811
|
-
const superType = superName && this._schema
|
|
14812
|
+
const superType = superName && this._schema.get(superName.toLowerCase());
|
|
14812
14813
|
if (superType) {
|
|
14813
|
-
|
|
14814
|
-
type
|
|
14815
|
-
}
|
|
14816
|
-
for (const superEvent of this._eventSchema
|
|
14814
|
+
for (const [prop, value] of superType) {
|
|
14815
|
+
type.set(prop, value);
|
|
14816
|
+
}
|
|
14817
|
+
for (const superEvent of this._eventSchema.get(superName.toLowerCase())) {
|
|
14817
14818
|
events.add(superEvent);
|
|
14818
14819
|
}
|
|
14819
14820
|
}
|
|
@@ -14824,16 +14825,16 @@ class DomElementSchemaRegistry extends ElementSchemaRegistry {
|
|
|
14824
14825
|
events.add(property.substring(1));
|
|
14825
14826
|
break;
|
|
14826
14827
|
case '!':
|
|
14827
|
-
type
|
|
14828
|
+
type.set(property.substring(1), BOOLEAN);
|
|
14828
14829
|
break;
|
|
14829
14830
|
case '#':
|
|
14830
|
-
type
|
|
14831
|
+
type.set(property.substring(1), NUMBER);
|
|
14831
14832
|
break;
|
|
14832
14833
|
case '%':
|
|
14833
|
-
type
|
|
14834
|
+
type.set(property.substring(1), OBJECT);
|
|
14834
14835
|
break;
|
|
14835
14836
|
default:
|
|
14836
|
-
type
|
|
14837
|
+
type.set(property, STRING);
|
|
14837
14838
|
}
|
|
14838
14839
|
}
|
|
14839
14840
|
});
|
|
@@ -14853,8 +14854,8 @@ class DomElementSchemaRegistry extends ElementSchemaRegistry {
|
|
|
14853
14854
|
return true;
|
|
14854
14855
|
}
|
|
14855
14856
|
}
|
|
14856
|
-
const elementProperties = this._schema
|
|
14857
|
-
return
|
|
14857
|
+
const elementProperties = this._schema.get(tagName.toLowerCase()) || this._schema.get('unknown');
|
|
14858
|
+
return elementProperties.has(propName);
|
|
14858
14859
|
}
|
|
14859
14860
|
hasElement(tagName, schemaMetas) {
|
|
14860
14861
|
if (schemaMetas.some((schema) => schema.name === NO_ERRORS_SCHEMA.name)) {
|
|
@@ -14869,7 +14870,7 @@ class DomElementSchemaRegistry extends ElementSchemaRegistry {
|
|
|
14869
14870
|
return true;
|
|
14870
14871
|
}
|
|
14871
14872
|
}
|
|
14872
|
-
return
|
|
14873
|
+
return this._schema.has(tagName.toLowerCase());
|
|
14873
14874
|
}
|
|
14874
14875
|
/**
|
|
14875
14876
|
* securityContext returns the security context for the given property on the given DOM tag.
|
|
@@ -14898,7 +14899,8 @@ class DomElementSchemaRegistry extends ElementSchemaRegistry {
|
|
|
14898
14899
|
return ctx ? ctx : SecurityContext.NONE;
|
|
14899
14900
|
}
|
|
14900
14901
|
getMappedPropName(propName) {
|
|
14901
|
-
|
|
14902
|
+
var _a;
|
|
14903
|
+
return (_a = _ATTR_TO_PROP.get(propName)) !== null && _a !== void 0 ? _a : propName;
|
|
14902
14904
|
}
|
|
14903
14905
|
getDefaultComponentElementName() {
|
|
14904
14906
|
return 'ng-component';
|
|
@@ -14926,16 +14928,16 @@ class DomElementSchemaRegistry extends ElementSchemaRegistry {
|
|
|
14926
14928
|
}
|
|
14927
14929
|
}
|
|
14928
14930
|
allKnownElementNames() {
|
|
14929
|
-
return
|
|
14931
|
+
return Array.from(this._schema.keys());
|
|
14930
14932
|
}
|
|
14931
14933
|
allKnownAttributesOfElement(tagName) {
|
|
14932
|
-
const elementProperties = this._schema
|
|
14934
|
+
const elementProperties = this._schema.get(tagName.toLowerCase()) || this._schema.get('unknown');
|
|
14933
14935
|
// Convert properties to attributes.
|
|
14934
|
-
return
|
|
14936
|
+
return Array.from(elementProperties.keys()).map(prop => { var _a; return (_a = _PROP_TO_ATTR.get(prop)) !== null && _a !== void 0 ? _a : prop; });
|
|
14935
14937
|
}
|
|
14936
14938
|
allKnownEventsOfElement(tagName) {
|
|
14937
14939
|
var _a;
|
|
14938
|
-
return Array.from((_a = this._eventSchema
|
|
14940
|
+
return Array.from((_a = this._eventSchema.get(tagName.toLowerCase())) !== null && _a !== void 0 ? _a : []);
|
|
14939
14941
|
}
|
|
14940
14942
|
normalizeAnimationStyleProperty(propName) {
|
|
14941
14943
|
return dashCaseToCamelCase(propName);
|
|
@@ -18805,6 +18807,7 @@ function baseDirectiveFields(meta, constantPool, bindingParser) {
|
|
|
18805
18807
|
* Add features to the definition map.
|
|
18806
18808
|
*/
|
|
18807
18809
|
function addFeatures(definitionMap, meta) {
|
|
18810
|
+
var _a;
|
|
18808
18811
|
// e.g. `features: [NgOnChangesFeature]`
|
|
18809
18812
|
const features = [];
|
|
18810
18813
|
const providers = meta.providers;
|
|
@@ -18829,6 +18832,9 @@ function addFeatures(definitionMap, meta) {
|
|
|
18829
18832
|
if (meta.hasOwnProperty('template') && meta.isStandalone) {
|
|
18830
18833
|
features.push(importExpr(Identifiers.StandaloneFeature));
|
|
18831
18834
|
}
|
|
18835
|
+
if ((_a = meta.hostDirectives) === null || _a === void 0 ? void 0 : _a.length) {
|
|
18836
|
+
features.push(importExpr(Identifiers.HostDirectivesFeature).callFn([createHostDirectivesFeatureArg(meta.hostDirectives)]));
|
|
18837
|
+
}
|
|
18832
18838
|
if (features.length) {
|
|
18833
18839
|
definitionMap.set('features', literalArr(features));
|
|
18834
18840
|
}
|
|
@@ -18941,6 +18947,7 @@ function createComponentType(meta) {
|
|
|
18941
18947
|
const typeParams = createBaseDirectiveTypeParams(meta);
|
|
18942
18948
|
typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
|
|
18943
18949
|
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
18950
|
+
typeParams.push(createHostDirectivesType(meta));
|
|
18944
18951
|
return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
|
|
18945
18952
|
}
|
|
18946
18953
|
/**
|
|
@@ -19016,7 +19023,7 @@ function createContentQueriesFunction(queries, constantPool, name) {
|
|
|
19016
19023
|
function stringAsType(str) {
|
|
19017
19024
|
return expressionType(literal(str));
|
|
19018
19025
|
}
|
|
19019
|
-
function
|
|
19026
|
+
function stringMapAsLiteralExpression(map) {
|
|
19020
19027
|
const mapValues = Object.keys(map).map(key => {
|
|
19021
19028
|
const value = Array.isArray(map[key]) ? map[key][0] : map[key];
|
|
19022
19029
|
return {
|
|
@@ -19025,7 +19032,7 @@ function stringMapAsType(map) {
|
|
|
19025
19032
|
quoted: true,
|
|
19026
19033
|
};
|
|
19027
19034
|
});
|
|
19028
|
-
return
|
|
19035
|
+
return literalMap(mapValues);
|
|
19029
19036
|
}
|
|
19030
19037
|
function stringArrayAsType(arr) {
|
|
19031
19038
|
return arr.length > 0 ? expressionType(literalArr(arr.map(value => literal(value)))) :
|
|
@@ -19039,8 +19046,8 @@ function createBaseDirectiveTypeParams(meta) {
|
|
|
19039
19046
|
typeWithParameters(meta.type.type, meta.typeArgumentCount),
|
|
19040
19047
|
selectorForType !== null ? stringAsType(selectorForType) : NONE_TYPE,
|
|
19041
19048
|
meta.exportAs !== null ? stringArrayAsType(meta.exportAs) : NONE_TYPE,
|
|
19042
|
-
|
|
19043
|
-
|
|
19049
|
+
expressionType(stringMapAsLiteralExpression(meta.inputs)),
|
|
19050
|
+
expressionType(stringMapAsLiteralExpression(meta.outputs)),
|
|
19044
19051
|
stringArrayAsType(meta.queries.map(q => q.propertyName)),
|
|
19045
19052
|
];
|
|
19046
19053
|
}
|
|
@@ -19054,6 +19061,7 @@ function createDirectiveType(meta) {
|
|
|
19054
19061
|
// so that future fields align.
|
|
19055
19062
|
typeParams.push(NONE_TYPE);
|
|
19056
19063
|
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
19064
|
+
typeParams.push(createHostDirectivesType(meta));
|
|
19057
19065
|
return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
|
|
19058
19066
|
}
|
|
19059
19067
|
// Define and update any view queries
|
|
@@ -19357,6 +19365,69 @@ function compileStyles(styles, selector, hostSelector) {
|
|
|
19357
19365
|
return shadowCss.shimCssText(style, selector, hostSelector);
|
|
19358
19366
|
});
|
|
19359
19367
|
}
|
|
19368
|
+
function createHostDirectivesType(meta) {
|
|
19369
|
+
var _a;
|
|
19370
|
+
if (!((_a = meta.hostDirectives) === null || _a === void 0 ? void 0 : _a.length)) {
|
|
19371
|
+
return NONE_TYPE;
|
|
19372
|
+
}
|
|
19373
|
+
return expressionType(literalArr(meta.hostDirectives.map(hostMeta => literalMap([
|
|
19374
|
+
{ key: 'directive', value: typeofExpr(hostMeta.directive.type), quoted: false },
|
|
19375
|
+
{ key: 'inputs', value: stringMapAsLiteralExpression(hostMeta.inputs || {}), quoted: false },
|
|
19376
|
+
{ key: 'outputs', value: stringMapAsLiteralExpression(hostMeta.outputs || {}), quoted: false },
|
|
19377
|
+
]))));
|
|
19378
|
+
}
|
|
19379
|
+
function createHostDirectivesFeatureArg(hostDirectives) {
|
|
19380
|
+
const expressions = [];
|
|
19381
|
+
let hasForwardRef = false;
|
|
19382
|
+
for (const current of hostDirectives) {
|
|
19383
|
+
// Use a shorthand if there are no inputs or outputs.
|
|
19384
|
+
if (!current.inputs && !current.outputs) {
|
|
19385
|
+
expressions.push(current.directive.type);
|
|
19386
|
+
}
|
|
19387
|
+
else {
|
|
19388
|
+
const keys = [{ key: 'directive', value: current.directive.type, quoted: false }];
|
|
19389
|
+
if (current.inputs) {
|
|
19390
|
+
const inputsLiteral = createHostDirectivesMappingArray(current.inputs);
|
|
19391
|
+
if (inputsLiteral) {
|
|
19392
|
+
keys.push({ key: 'inputs', value: inputsLiteral, quoted: false });
|
|
19393
|
+
}
|
|
19394
|
+
}
|
|
19395
|
+
if (current.outputs) {
|
|
19396
|
+
const outputsLiteral = createHostDirectivesMappingArray(current.outputs);
|
|
19397
|
+
if (outputsLiteral) {
|
|
19398
|
+
keys.push({ key: 'outputs', value: outputsLiteral, quoted: false });
|
|
19399
|
+
}
|
|
19400
|
+
}
|
|
19401
|
+
expressions.push(literalMap(keys));
|
|
19402
|
+
}
|
|
19403
|
+
if (current.isForwardReference) {
|
|
19404
|
+
hasForwardRef = true;
|
|
19405
|
+
}
|
|
19406
|
+
}
|
|
19407
|
+
// If there's a forward reference, we generate a `function() { return [HostDir] }`,
|
|
19408
|
+
// otherwise we can save some bytes by using a plain array, e.g. `[HostDir]`.
|
|
19409
|
+
return hasForwardRef ?
|
|
19410
|
+
new FunctionExpr([], [new ReturnStatement(literalArr(expressions))]) :
|
|
19411
|
+
literalArr(expressions);
|
|
19412
|
+
}
|
|
19413
|
+
/**
|
|
19414
|
+
* Converts an input/output mapping object literal into an array where the even keys are the
|
|
19415
|
+
* public name of the binding and the odd ones are the name it was aliased to. E.g.
|
|
19416
|
+
* `{inputOne: 'aliasOne', inputTwo: 'aliasTwo'}` will become
|
|
19417
|
+
* `['inputOne', 'aliasOne', 'inputTwo', 'aliasTwo']`.
|
|
19418
|
+
*
|
|
19419
|
+
* This conversion is necessary, because hosts bind to the public name of the host directive and
|
|
19420
|
+
* keeping the mapping in an object literal will break for apps using property renaming.
|
|
19421
|
+
*/
|
|
19422
|
+
function createHostDirectivesMappingArray(mapping) {
|
|
19423
|
+
const elements = [];
|
|
19424
|
+
for (const publicName in mapping) {
|
|
19425
|
+
if (mapping.hasOwnProperty(publicName)) {
|
|
19426
|
+
elements.push(literal(publicName), literal(mapping[publicName]));
|
|
19427
|
+
}
|
|
19428
|
+
}
|
|
19429
|
+
return elements.length > 0 ? literalArr(elements) : null;
|
|
19430
|
+
}
|
|
19360
19431
|
|
|
19361
19432
|
/**
|
|
19362
19433
|
* @license
|
|
@@ -19606,7 +19677,7 @@ function convertDirectiveFacadeToMetadata(facade) {
|
|
|
19606
19677
|
});
|
|
19607
19678
|
}
|
|
19608
19679
|
}
|
|
19609
|
-
return Object.assign(Object.assign({}, facade), { typeArgumentCount: 0, typeSourceSpan: facade.typeSourceSpan, type: wrapReference(facade.type), internalType: new WrappedNodeExpr(facade.type), deps: null, host: extractHostBindings(facade.propMetadata, facade.typeSourceSpan, facade.host), inputs: Object.assign(Object.assign({}, inputsFromMetadata), inputsFromType), outputs: Object.assign(Object.assign({}, outputsFromMetadata), outputsFromType), queries: facade.queries.map(convertToR3QueryMetadata), providers: facade.providers != null ? new WrappedNodeExpr(facade.providers) : null, viewQueries: facade.viewQueries.map(convertToR3QueryMetadata), fullInheritance: false });
|
|
19680
|
+
return Object.assign(Object.assign({}, facade), { typeArgumentCount: 0, typeSourceSpan: facade.typeSourceSpan, type: wrapReference(facade.type), internalType: new WrappedNodeExpr(facade.type), deps: null, host: extractHostBindings(facade.propMetadata, facade.typeSourceSpan, facade.host), inputs: Object.assign(Object.assign({}, inputsFromMetadata), inputsFromType), outputs: Object.assign(Object.assign({}, outputsFromMetadata), outputsFromType), queries: facade.queries.map(convertToR3QueryMetadata), providers: facade.providers != null ? new WrappedNodeExpr(facade.providers) : null, viewQueries: facade.viewQueries.map(convertToR3QueryMetadata), fullInheritance: false, hostDirectives: convertHostDirectivesToMetadata(facade) });
|
|
19610
19681
|
}
|
|
19611
19682
|
function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
19612
19683
|
var _a, _b, _c, _d, _e, _f, _g, _h, _j;
|
|
@@ -19630,6 +19701,7 @@ function convertDeclareDirectiveFacadeToMetadata(declaration, typeSourceSpan) {
|
|
|
19630
19701
|
typeArgumentCount: 0,
|
|
19631
19702
|
fullInheritance: false,
|
|
19632
19703
|
isStandalone: (_j = declaration.isStandalone) !== null && _j !== void 0 ? _j : false,
|
|
19704
|
+
hostDirectives: convertHostDirectivesToMetadata(declaration),
|
|
19633
19705
|
};
|
|
19634
19706
|
}
|
|
19635
19707
|
function convertHostDeclarationToMetadata(host = {}) {
|
|
@@ -19644,6 +19716,27 @@ function convertHostDeclarationToMetadata(host = {}) {
|
|
|
19644
19716
|
},
|
|
19645
19717
|
};
|
|
19646
19718
|
}
|
|
19719
|
+
function convertHostDirectivesToMetadata(metadata) {
|
|
19720
|
+
var _a;
|
|
19721
|
+
if ((_a = metadata.hostDirectives) === null || _a === void 0 ? void 0 : _a.length) {
|
|
19722
|
+
return metadata.hostDirectives.map(hostDirective => {
|
|
19723
|
+
return typeof hostDirective === 'function' ?
|
|
19724
|
+
{
|
|
19725
|
+
directive: wrapReference(hostDirective),
|
|
19726
|
+
inputs: null,
|
|
19727
|
+
outputs: null,
|
|
19728
|
+
isForwardReference: false
|
|
19729
|
+
} :
|
|
19730
|
+
{
|
|
19731
|
+
directive: wrapReference(hostDirective.directive),
|
|
19732
|
+
isForwardReference: false,
|
|
19733
|
+
inputs: hostDirective.inputs ? parseInputOutputs(hostDirective.inputs) : null,
|
|
19734
|
+
outputs: hostDirective.outputs ? parseInputOutputs(hostDirective.outputs) : null,
|
|
19735
|
+
};
|
|
19736
|
+
});
|
|
19737
|
+
}
|
|
19738
|
+
return null;
|
|
19739
|
+
}
|
|
19647
19740
|
function convertOpaqueValuesToExpressions(obj) {
|
|
19648
19741
|
const result = {};
|
|
19649
19742
|
for (const key of Object.keys(obj)) {
|
|
@@ -19862,7 +19955,7 @@ function publishFacade(global) {
|
|
|
19862
19955
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19863
19956
|
* found in the LICENSE file at https://angular.io/license
|
|
19864
19957
|
*/
|
|
19865
|
-
const VERSION = new Version('
|
|
19958
|
+
const VERSION = new Version('15.0.0-next.1');
|
|
19866
19959
|
|
|
19867
19960
|
/**
|
|
19868
19961
|
* @license
|
|
@@ -21556,7 +21649,7 @@ class DirectiveBinder {
|
|
|
21556
21649
|
const cssSelector = createCssSelector(elementName, getAttrsForDirectiveMatching(node));
|
|
21557
21650
|
// Next, use the `SelectorMatcher` to get the list of directives on the node.
|
|
21558
21651
|
const directives = [];
|
|
21559
|
-
this.matcher.match(cssSelector, (
|
|
21652
|
+
this.matcher.match(cssSelector, (_selector, results) => directives.push(...results));
|
|
21560
21653
|
if (directives.length > 0) {
|
|
21561
21654
|
this.directives.set(node, directives);
|
|
21562
21655
|
}
|
|
@@ -21889,7 +21982,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21889
21982
|
function compileDeclareClassMetadata(metadata) {
|
|
21890
21983
|
const definitionMap = new DefinitionMap();
|
|
21891
21984
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21892
|
-
definitionMap.set('version', literal('
|
|
21985
|
+
definitionMap.set('version', literal('15.0.0-next.1'));
|
|
21893
21986
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21894
21987
|
definitionMap.set('type', metadata.type);
|
|
21895
21988
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -22004,9 +22097,10 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
22004
22097
|
* this logic for components, as they extend the directive metadata.
|
|
22005
22098
|
*/
|
|
22006
22099
|
function createDirectiveDefinitionMap(meta) {
|
|
22100
|
+
var _a;
|
|
22007
22101
|
const definitionMap = new DefinitionMap();
|
|
22008
22102
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
22009
|
-
definitionMap.set('version', literal('
|
|
22103
|
+
definitionMap.set('version', literal('15.0.0-next.1'));
|
|
22010
22104
|
// e.g. `type: MyDirective`
|
|
22011
22105
|
definitionMap.set('type', meta.internalType);
|
|
22012
22106
|
if (meta.isStandalone) {
|
|
@@ -22035,6 +22129,9 @@ function createDirectiveDefinitionMap(meta) {
|
|
|
22035
22129
|
if (meta.lifecycle.usesOnChanges) {
|
|
22036
22130
|
definitionMap.set('usesOnChanges', literal(true));
|
|
22037
22131
|
}
|
|
22132
|
+
if ((_a = meta.hostDirectives) === null || _a === void 0 ? void 0 : _a.length) {
|
|
22133
|
+
definitionMap.set('hostDirectives', createHostDirectives(meta.hostDirectives));
|
|
22134
|
+
}
|
|
22038
22135
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22039
22136
|
return definitionMap;
|
|
22040
22137
|
}
|
|
@@ -22089,6 +22186,28 @@ function compileHostMetadata(meta) {
|
|
|
22089
22186
|
return null;
|
|
22090
22187
|
}
|
|
22091
22188
|
}
|
|
22189
|
+
function createHostDirectives(hostDirectives) {
|
|
22190
|
+
const expressions = hostDirectives.map(current => {
|
|
22191
|
+
const keys = [{
|
|
22192
|
+
key: 'directive',
|
|
22193
|
+
value: current.isForwardReference ? generateForwardRef(current.directive.type) :
|
|
22194
|
+
current.directive.type,
|
|
22195
|
+
quoted: false
|
|
22196
|
+
}];
|
|
22197
|
+
const inputsLiteral = current.inputs ? createHostDirectivesMappingArray(current.inputs) : null;
|
|
22198
|
+
const outputsLiteral = current.outputs ? createHostDirectivesMappingArray(current.outputs) : null;
|
|
22199
|
+
if (inputsLiteral) {
|
|
22200
|
+
keys.push({ key: 'inputs', value: inputsLiteral, quoted: false });
|
|
22201
|
+
}
|
|
22202
|
+
if (outputsLiteral) {
|
|
22203
|
+
keys.push({ key: 'outputs', value: outputsLiteral, quoted: false });
|
|
22204
|
+
}
|
|
22205
|
+
return literalMap(keys);
|
|
22206
|
+
});
|
|
22207
|
+
// If there's a forward reference, we generate a `function() { return [{directive: HostDir}] }`,
|
|
22208
|
+
// otherwise we can save some bytes by using a plain array, e.g. `[{directive: HostDir}]`.
|
|
22209
|
+
return literalArr(expressions);
|
|
22210
|
+
}
|
|
22092
22211
|
|
|
22093
22212
|
/**
|
|
22094
22213
|
* @license
|
|
@@ -22220,7 +22339,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22220
22339
|
function compileDeclareFactoryFunction(meta) {
|
|
22221
22340
|
const definitionMap = new DefinitionMap();
|
|
22222
22341
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22223
|
-
definitionMap.set('version', literal('
|
|
22342
|
+
definitionMap.set('version', literal('15.0.0-next.1'));
|
|
22224
22343
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22225
22344
|
definitionMap.set('type', meta.internalType);
|
|
22226
22345
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22262,7 +22381,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22262
22381
|
function createInjectableDefinitionMap(meta) {
|
|
22263
22382
|
const definitionMap = new DefinitionMap();
|
|
22264
22383
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22265
|
-
definitionMap.set('version', literal('
|
|
22384
|
+
definitionMap.set('version', literal('15.0.0-next.1'));
|
|
22266
22385
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22267
22386
|
definitionMap.set('type', meta.internalType);
|
|
22268
22387
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22320,7 +22439,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22320
22439
|
function createInjectorDefinitionMap(meta) {
|
|
22321
22440
|
const definitionMap = new DefinitionMap();
|
|
22322
22441
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22323
|
-
definitionMap.set('version', literal('
|
|
22442
|
+
definitionMap.set('version', literal('15.0.0-next.1'));
|
|
22324
22443
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22325
22444
|
definitionMap.set('type', meta.internalType);
|
|
22326
22445
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22357,7 +22476,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22357
22476
|
function createNgModuleDefinitionMap(meta) {
|
|
22358
22477
|
const definitionMap = new DefinitionMap();
|
|
22359
22478
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22360
|
-
definitionMap.set('version', literal('
|
|
22479
|
+
definitionMap.set('version', literal('15.0.0-next.1'));
|
|
22361
22480
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22362
22481
|
definitionMap.set('type', meta.internalType);
|
|
22363
22482
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22415,7 +22534,7 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22415
22534
|
function createPipeDefinitionMap(meta) {
|
|
22416
22535
|
const definitionMap = new DefinitionMap();
|
|
22417
22536
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22418
|
-
definitionMap.set('version', literal('
|
|
22537
|
+
definitionMap.set('version', literal('15.0.0-next.1'));
|
|
22419
22538
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22420
22539
|
// e.g. `type: MyPipe`
|
|
22421
22540
|
definitionMap.set('type', meta.internalType);
|