@angular/compiler 14.0.0-next.13 → 14.0.0-next.14
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 +7 -1
- package/esm2020/src/jit_compiler_facade.mjs +61 -25
- package/esm2020/src/render3/partial/api.mjs +1 -1
- package/esm2020/src/render3/partial/class_metadata.mjs +1 -1
- package/esm2020/src/render3/partial/component.mjs +27 -36
- package/esm2020/src/render3/partial/directive.mjs +5 -2
- 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 +5 -2
- package/esm2020/src/render3/r3_identifiers.mjs +2 -1
- package/esm2020/src/render3/r3_pipe_compiler.mjs +2 -1
- package/esm2020/src/render3/view/api.mjs +7 -2
- package/esm2020/src/render3/view/compiler.mjs +15 -15
- package/esm2020/src/render3/view/i18n/get_msg_utils.mjs +58 -5
- package/esm2020/src/render3/view/i18n/util.mjs +2 -2
- package/esm2020/src/render3/view/template.mjs +4 -4
- package/esm2020/src/version.mjs +1 -1
- package/fesm2015/compiler.mjs +183 -86
- package/fesm2015/compiler.mjs.map +1 -1
- package/fesm2015/testing.mjs +1 -1
- package/fesm2020/compiler.mjs +189 -97
- package/fesm2020/compiler.mjs.map +1 -1
- package/fesm2020/testing.mjs +1 -1
- package/package.json +2 -2
- package/src/compiler_facade_interface.d.ts +26 -11
- package/src/render3/partial/api.d.ts +25 -3
- package/src/render3/partial/component.d.ts +3 -3
- package/src/render3/r3_identifiers.d.ts +1 -0
- package/src/render3/view/api.d.ts +30 -16
- package/src/render3/view/compiler.d.ts +4 -4
- package/src/render3/view/i18n/get_msg_utils.d.ts +35 -1
- package/src/render3/view/i18n/util.d.ts +1 -1
package/esm2020/src/version.mjs
CHANGED
|
@@ -11,5 +11,5 @@
|
|
|
11
11
|
* Entry point for all public APIs of the compiler package.
|
|
12
12
|
*/
|
|
13
13
|
import { Version } from './util';
|
|
14
|
-
export const VERSION = new Version('14.0.0-next.
|
|
14
|
+
export const VERSION = new Version('14.0.0-next.14');
|
|
15
15
|
//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidmVyc2lvbi5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy92ZXJzaW9uLnRzIl0sIm5hbWVzIjpbXSwibWFwcGluZ3MiOiJBQUFBOzs7Ozs7R0FNRztBQUVIOzs7O0dBSUc7QUFFSCxPQUFPLEVBQUMsT0FBTyxFQUFDLE1BQU0sUUFBUSxDQUFDO0FBRS9CLE1BQU0sQ0FBQyxNQUFNLE9BQU8sR0FBRyxJQUFJLE9BQU8sQ0FBQyxtQkFBbUIsQ0FBQyxDQUFDIiwic291cmNlc0NvbnRlbnQiOlsiLyoqXG4gKiBAbGljZW5zZVxuICogQ29weXJpZ2h0IEdvb2dsZSBMTEMgQWxsIFJpZ2h0cyBSZXNlcnZlZC5cbiAqXG4gKiBVc2Ugb2YgdGhpcyBzb3VyY2UgY29kZSBpcyBnb3Zlcm5lZCBieSBhbiBNSVQtc3R5bGUgbGljZW5zZSB0aGF0IGNhbiBiZVxuICogZm91bmQgaW4gdGhlIExJQ0VOU0UgZmlsZSBhdCBodHRwczovL2FuZ3VsYXIuaW8vbGljZW5zZVxuICovXG5cbi8qKlxuICogQG1vZHVsZVxuICogQGRlc2NyaXB0aW9uXG4gKiBFbnRyeSBwb2ludCBmb3IgYWxsIHB1YmxpYyBBUElzIG9mIHRoZSBjb21waWxlciBwYWNrYWdlLlxuICovXG5cbmltcG9ydCB7VmVyc2lvbn0gZnJvbSAnLi91dGlsJztcblxuZXhwb3J0IGNvbnN0IFZFUlNJT04gPSBuZXcgVmVyc2lvbignMC4wLjAtUExBQ0VIT0xERVInKTtcbiJdfQ==
|
package/fesm2015/compiler.mjs
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
/**
|
|
2
|
-
* @license Angular v14.0.0-next.
|
|
2
|
+
* @license Angular v14.0.0-next.14
|
|
3
3
|
* (c) 2010-2022 Google LLC. https://angular.io/
|
|
4
4
|
* License: MIT
|
|
5
5
|
*/
|
|
@@ -2924,6 +2924,7 @@ Identifiers.contentQuery = { name: 'ɵɵcontentQuery', moduleName: CORE };
|
|
|
2924
2924
|
Identifiers.NgOnChangesFeature = { name: 'ɵɵNgOnChangesFeature', moduleName: CORE };
|
|
2925
2925
|
Identifiers.InheritDefinitionFeature = { name: 'ɵɵInheritDefinitionFeature', moduleName: CORE };
|
|
2926
2926
|
Identifiers.CopyDefinitionFeature = { name: 'ɵɵCopyDefinitionFeature', moduleName: CORE };
|
|
2927
|
+
Identifiers.StandaloneFeature = { name: 'ɵɵStandaloneFeature', moduleName: CORE };
|
|
2927
2928
|
Identifiers.ProvidersFeature = { name: 'ɵɵProvidersFeature', moduleName: CORE };
|
|
2928
2929
|
Identifiers.listener = { name: 'ɵɵlistener', moduleName: CORE };
|
|
2929
2930
|
Identifiers.getInheritedFactory = {
|
|
@@ -4795,7 +4796,7 @@ function assembleBoundTextPlaceholders(meta, bindingStartIndex = 0, contextId =
|
|
|
4795
4796
|
* @param useCamelCase whether to camelCase the placeholder name when formatting.
|
|
4796
4797
|
* @returns A new map of formatted placeholder names to expressions.
|
|
4797
4798
|
*/
|
|
4798
|
-
function
|
|
4799
|
+
function formatI18nPlaceholderNamesInMap(params = {}, useCamelCase) {
|
|
4799
4800
|
const _params = {};
|
|
4800
4801
|
if (params && Object.keys(params).length) {
|
|
4801
4802
|
Object.keys(params).forEach(key => _params[formatI18nPlaceholderName(key, useCamelCase)] = params[key]);
|
|
@@ -6162,9 +6163,24 @@ function createPipeType(metadata) {
|
|
|
6162
6163
|
return new ExpressionType(importExpr(Identifiers.PipeDeclaration, [
|
|
6163
6164
|
typeWithParameters(metadata.type.type, metadata.typeArgumentCount),
|
|
6164
6165
|
new ExpressionType(new LiteralExpr(metadata.pipeName)),
|
|
6166
|
+
new ExpressionType(new LiteralExpr(metadata.isStandalone)),
|
|
6165
6167
|
]));
|
|
6166
6168
|
}
|
|
6167
6169
|
|
|
6170
|
+
/**
|
|
6171
|
+
* @license
|
|
6172
|
+
* Copyright Google LLC All Rights Reserved.
|
|
6173
|
+
*
|
|
6174
|
+
* Use of this source code is governed by an MIT-style license that can be
|
|
6175
|
+
* found in the LICENSE file at https://angular.io/license
|
|
6176
|
+
*/
|
|
6177
|
+
var R3TemplateDependencyKind;
|
|
6178
|
+
(function (R3TemplateDependencyKind) {
|
|
6179
|
+
R3TemplateDependencyKind[R3TemplateDependencyKind["Directive"] = 0] = "Directive";
|
|
6180
|
+
R3TemplateDependencyKind[R3TemplateDependencyKind["Pipe"] = 1] = "Pipe";
|
|
6181
|
+
R3TemplateDependencyKind[R3TemplateDependencyKind["NgModule"] = 2] = "NgModule";
|
|
6182
|
+
})(R3TemplateDependencyKind || (R3TemplateDependencyKind = {}));
|
|
6183
|
+
|
|
6168
6184
|
/**
|
|
6169
6185
|
* @license
|
|
6170
6186
|
* Copyright Google LLC All Rights Reserved.
|
|
@@ -16772,11 +16788,64 @@ function i18nMetaToJSDoc(meta) {
|
|
|
16772
16788
|
|
|
16773
16789
|
/** Closure uses `goog.getMsg(message)` to lookup translations */
|
|
16774
16790
|
const GOOG_GET_MSG = 'goog.getMsg';
|
|
16775
|
-
|
|
16791
|
+
/**
|
|
16792
|
+
* Generates a `goog.getMsg()` statement and reassignment. The template:
|
|
16793
|
+
*
|
|
16794
|
+
* ```html
|
|
16795
|
+
* <div i18n>Sent from {{ sender }} to <span class="receiver">{{ receiver }}</span></div>
|
|
16796
|
+
* ```
|
|
16797
|
+
*
|
|
16798
|
+
* Generates:
|
|
16799
|
+
*
|
|
16800
|
+
* ```typescript
|
|
16801
|
+
* const MSG_FOO = goog.getMsg(
|
|
16802
|
+
* // Message template.
|
|
16803
|
+
* 'Sent from {$interpolation} to {$startTagSpan}{$interpolation_1}{$closeTagSpan}.',
|
|
16804
|
+
* // Placeholder values, set to magic strings which get replaced by the Angular runtime.
|
|
16805
|
+
* {
|
|
16806
|
+
* 'interpolation': '\uFFFD0\uFFFD',
|
|
16807
|
+
* 'startTagSpan': '\uFFFD1\uFFFD',
|
|
16808
|
+
* 'interpolation_1': '\uFFFD2\uFFFD',
|
|
16809
|
+
* 'closeTagSpan': '\uFFFD3\uFFFD',
|
|
16810
|
+
* },
|
|
16811
|
+
* // Options bag.
|
|
16812
|
+
* {
|
|
16813
|
+
* // Maps each placeholder to the original Angular source code which generates it's value.
|
|
16814
|
+
* original_code: {
|
|
16815
|
+
* 'interpolation': '{{ sender }}',
|
|
16816
|
+
* 'startTagSpan': '<span class="receiver">',
|
|
16817
|
+
* 'interploation_1': '{{ receiver }}',
|
|
16818
|
+
* 'closeTagSpan': '</span>',
|
|
16819
|
+
* },
|
|
16820
|
+
* },
|
|
16821
|
+
* );
|
|
16822
|
+
* const I18N_0 = MSG_FOO;
|
|
16823
|
+
* ```
|
|
16824
|
+
*/
|
|
16825
|
+
function createGoogleGetMsgStatements(variable$1, message, closureVar, placeholderValues) {
|
|
16776
16826
|
const messageString = serializeI18nMessageForGetMsg(message);
|
|
16777
16827
|
const args = [literal(messageString)];
|
|
16778
|
-
if (Object.keys(
|
|
16779
|
-
|
|
16828
|
+
if (Object.keys(placeholderValues).length) {
|
|
16829
|
+
// Message template parameters containing the magic strings replaced by the Angular runtime with
|
|
16830
|
+
// real data, e.g. `{'interpolation': '\uFFFD0\uFFFD'}`.
|
|
16831
|
+
args.push(mapLiteral(formatI18nPlaceholderNamesInMap(placeholderValues, true /* useCamelCase */), true /* quoted */));
|
|
16832
|
+
// Message options object, which contains original source code for placeholders (as they are
|
|
16833
|
+
// present in a template, e.g.
|
|
16834
|
+
// `{original_code: {'interpolation': '{{ name }}', 'startTagSpan': '<span>'}}`.
|
|
16835
|
+
args.push(mapLiteral({
|
|
16836
|
+
original_code: literalMap(Object.keys(placeholderValues)
|
|
16837
|
+
.map((param) => ({
|
|
16838
|
+
key: formatI18nPlaceholderName(param),
|
|
16839
|
+
quoted: true,
|
|
16840
|
+
value: message.placeholders[param] ?
|
|
16841
|
+
// Get source span for typical placeholder if it exists.
|
|
16842
|
+
literal(message.placeholders[param].sourceSpan.toString()) :
|
|
16843
|
+
// Otherwise must be an ICU expression, get it's source span.
|
|
16844
|
+
literal(message.placeholderToMessage[param]
|
|
16845
|
+
.nodes.map((node) => node.sourceSpan.toString())
|
|
16846
|
+
.join('')),
|
|
16847
|
+
}))),
|
|
16848
|
+
}));
|
|
16780
16849
|
}
|
|
16781
16850
|
// /**
|
|
16782
16851
|
// * @desc description of message
|
|
@@ -17730,7 +17799,7 @@ class TemplateDefinitionBuilder {
|
|
|
17730
17799
|
// - all ICU vars (such as `VAR_SELECT` or `VAR_PLURAL`) are replaced with correct values
|
|
17731
17800
|
const transformFn = (raw) => {
|
|
17732
17801
|
const params = Object.assign(Object.assign({}, vars), placeholders);
|
|
17733
|
-
const formatted =
|
|
17802
|
+
const formatted = formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false);
|
|
17734
17803
|
return invokeInstruction(null, Identifiers.i18nPostprocess, [raw, mapLiteral(formatted, true)]);
|
|
17735
17804
|
};
|
|
17736
17805
|
// in case the whole i18n message is a single ICU - we do not need to
|
|
@@ -18651,7 +18720,7 @@ const NG_I18N_CLOSURE_MODE = 'ngI18nClosureMode';
|
|
|
18651
18720
|
function getTranslationDeclStmts(message, variable, closureVar, params = {}, transformFn) {
|
|
18652
18721
|
const statements = [
|
|
18653
18722
|
declareI18nVariable(variable),
|
|
18654
|
-
ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable, message, closureVar,
|
|
18723
|
+
ifStmt(createClosureModeGuard(), createGoogleGetMsgStatements(variable, message, closureVar, params), createLocalizeStatements(variable, message, formatI18nPlaceholderNamesInMap(params, /* useCamelCase */ false))),
|
|
18655
18724
|
];
|
|
18656
18725
|
if (transformFn) {
|
|
18657
18726
|
statements.push(new ExpressionStatement(variable.set(transformFn(variable))));
|
|
@@ -18745,6 +18814,10 @@ function addFeatures(definitionMap, meta) {
|
|
|
18745
18814
|
if (meta.lifecycle.usesOnChanges) {
|
|
18746
18815
|
features.push(importExpr(Identifiers.NgOnChangesFeature));
|
|
18747
18816
|
}
|
|
18817
|
+
// TODO: better way of differentiating component vs directive metadata.
|
|
18818
|
+
if (meta.hasOwnProperty('template') && meta.isStandalone) {
|
|
18819
|
+
features.push(importExpr(Identifiers.StandaloneFeature));
|
|
18820
|
+
}
|
|
18748
18821
|
if (features.length) {
|
|
18749
18822
|
definitionMap.set('features', literalArr(features));
|
|
18750
18823
|
}
|
|
@@ -18808,17 +18881,8 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18808
18881
|
definitionMap.set('consts', constsExpr);
|
|
18809
18882
|
}
|
|
18810
18883
|
definitionMap.set('template', templateFunctionExpression);
|
|
18811
|
-
|
|
18812
|
-
|
|
18813
|
-
const directivesList = literalArr(meta.directives.map(dir => dir.type));
|
|
18814
|
-
const directivesExpr = compileDeclarationList(directivesList, meta.declarationListEmitMode);
|
|
18815
|
-
definitionMap.set('directives', directivesExpr);
|
|
18816
|
-
}
|
|
18817
|
-
// e.g. `pipes: [MyPipe]`
|
|
18818
|
-
if (meta.pipes.size > 0) {
|
|
18819
|
-
const pipesList = literalArr(Array.from(meta.pipes.values()));
|
|
18820
|
-
const pipesExpr = compileDeclarationList(pipesList, meta.declarationListEmitMode);
|
|
18821
|
-
definitionMap.set('pipes', pipesExpr);
|
|
18884
|
+
if (meta.declarations.length > 0) {
|
|
18885
|
+
definitionMap.set('dependencies', compileDeclarationList(literalArr(meta.declarations.map(decl => decl.type)), meta.declarationListEmitMode));
|
|
18822
18886
|
}
|
|
18823
18887
|
if (meta.encapsulation === null) {
|
|
18824
18888
|
meta.encapsulation = ViewEncapsulation.Emulated;
|
|
@@ -18856,8 +18920,9 @@ function compileComponentFromMetadata(meta, constantPool, bindingParser) {
|
|
|
18856
18920
|
* to be consumed by upstream compilations.
|
|
18857
18921
|
*/
|
|
18858
18922
|
function createComponentType(meta) {
|
|
18859
|
-
const typeParams =
|
|
18923
|
+
const typeParams = createBaseDirectiveTypeParams(meta);
|
|
18860
18924
|
typeParams.push(stringArrayAsType(meta.template.ngContentSelectors));
|
|
18925
|
+
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
18861
18926
|
return expressionType(importExpr(Identifiers.ComponentDeclaration, typeParams));
|
|
18862
18927
|
}
|
|
18863
18928
|
/**
|
|
@@ -18948,7 +19013,7 @@ function stringArrayAsType(arr) {
|
|
|
18948
19013
|
return arr.length > 0 ? expressionType(literalArr(arr.map(value => literal(value)))) :
|
|
18949
19014
|
NONE_TYPE;
|
|
18950
19015
|
}
|
|
18951
|
-
function
|
|
19016
|
+
function createBaseDirectiveTypeParams(meta) {
|
|
18952
19017
|
// On the type side, remove newlines from the selector as it will need to fit into a TypeScript
|
|
18953
19018
|
// string literal, which must be on one line.
|
|
18954
19019
|
const selectorForType = meta.selector !== null ? meta.selector.replace(/\n/g, '') : null;
|
|
@@ -18966,7 +19031,11 @@ function createDirectiveTypeParams(meta) {
|
|
|
18966
19031
|
* to be consumed by upstream compilations.
|
|
18967
19032
|
*/
|
|
18968
19033
|
function createDirectiveType(meta) {
|
|
18969
|
-
const typeParams =
|
|
19034
|
+
const typeParams = createBaseDirectiveTypeParams(meta);
|
|
19035
|
+
// Directives have no NgContentSelectors slot, but instead express a `never` type
|
|
19036
|
+
// so that future fields align.
|
|
19037
|
+
typeParams.push(NONE_TYPE);
|
|
19038
|
+
typeParams.push(expressionType(literal(meta.isStandalone)));
|
|
18970
19039
|
return expressionType(importExpr(Identifiers.DirectiveDeclaration, typeParams));
|
|
18971
19040
|
}
|
|
18972
19041
|
// Define and update any view queries
|
|
@@ -19411,7 +19480,7 @@ class CompilerFacadeImpl {
|
|
|
19411
19480
|
// Parse the template and check for errors.
|
|
19412
19481
|
const { template, interpolation } = parseJitTemplate(facade.template, facade.name, sourceMapUrl, facade.preserveWhitespaces, facade.interpolation);
|
|
19413
19482
|
// Compile the component metadata, including template, into an expression.
|
|
19414
|
-
const meta = Object.assign(Object.assign(Object.assign({}, facade), convertDirectiveFacadeToMetadata(facade)), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template, declarationListEmitMode: 0 /* Direct */, styles: [...facade.styles, ...template.styles], encapsulation: facade.encapsulation, interpolation, changeDetection: facade.changeDetection, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) :
|
|
19483
|
+
const meta = Object.assign(Object.assign(Object.assign({}, facade), convertDirectiveFacadeToMetadata(facade)), { selector: facade.selector || this.elementSchemaRegistry.getDefaultComponentElementName(), template, declarations: facade.declarations.map(convertDeclarationFacadeToMetadata), declarationListEmitMode: 0 /* Direct */, styles: [...facade.styles, ...template.styles], encapsulation: facade.encapsulation, interpolation, changeDetection: facade.changeDetection, animations: facade.animations != null ? new WrappedNodeExpr(facade.animations) : null, viewProviders: facade.viewProviders != null ? new WrappedNodeExpr(facade.viewProviders) :
|
|
19415
19484
|
null, relativeContextFilePath: '', i18nUseExternalIds: true });
|
|
19416
19485
|
const jitExpressionSourceMap = `ng:///${facade.name}.js`;
|
|
19417
19486
|
return this.compileComponentFromMeta(angularCoreEnv, jitExpressionSourceMap, meta);
|
|
@@ -19564,19 +19633,43 @@ function convertOpaqueValuesToExpressions(obj) {
|
|
|
19564
19633
|
}
|
|
19565
19634
|
return result;
|
|
19566
19635
|
}
|
|
19567
|
-
function convertDeclareComponentFacadeToMetadata(
|
|
19568
|
-
var _a, _b, _c, _d
|
|
19569
|
-
const { template, interpolation } = parseJitTemplate(
|
|
19570
|
-
|
|
19571
|
-
|
|
19572
|
-
|
|
19573
|
-
|
|
19574
|
-
|
|
19575
|
-
|
|
19576
|
-
|
|
19577
|
-
|
|
19636
|
+
function convertDeclareComponentFacadeToMetadata(decl, typeSourceSpan, sourceMapUrl) {
|
|
19637
|
+
var _a, _b, _c, _d;
|
|
19638
|
+
const { template, interpolation } = parseJitTemplate(decl.template, decl.type.name, sourceMapUrl, (_a = decl.preserveWhitespaces) !== null && _a !== void 0 ? _a : false, decl.interpolation);
|
|
19639
|
+
const declarations = [];
|
|
19640
|
+
if (decl.dependencies) {
|
|
19641
|
+
for (const innerDep of decl.dependencies) {
|
|
19642
|
+
switch (innerDep.kind) {
|
|
19643
|
+
case 'directive':
|
|
19644
|
+
case 'component':
|
|
19645
|
+
declarations.push(convertDirectiveDeclarationToMetadata(innerDep));
|
|
19646
|
+
break;
|
|
19647
|
+
case 'pipe':
|
|
19648
|
+
declarations.push(convertPipeDeclarationToMetadata(innerDep));
|
|
19649
|
+
break;
|
|
19650
|
+
}
|
|
19651
|
+
}
|
|
19652
|
+
}
|
|
19653
|
+
else if (decl.components || decl.directives || decl.pipes) {
|
|
19654
|
+
// Existing declarations on NPM may not be using the new `dependencies` merged field, and may
|
|
19655
|
+
// have separate fields for dependencies instead. Unify them for JIT compilation.
|
|
19656
|
+
decl.components &&
|
|
19657
|
+
declarations.push(...decl.components.map(dir => convertDirectiveDeclarationToMetadata(dir, /* isComponent */ true)));
|
|
19658
|
+
decl.directives &&
|
|
19659
|
+
declarations.push(...decl.directives.map(dir => convertDirectiveDeclarationToMetadata(dir)));
|
|
19660
|
+
decl.pipes && declarations.push(...convertPipeMapToMetadata(decl.pipes));
|
|
19661
|
+
}
|
|
19662
|
+
return Object.assign(Object.assign({}, convertDeclareDirectiveFacadeToMetadata(decl, typeSourceSpan)), { template, styles: (_b = decl.styles) !== null && _b !== void 0 ? _b : [], declarations, viewProviders: decl.viewProviders !== undefined ? new WrappedNodeExpr(decl.viewProviders) :
|
|
19663
|
+
null, animations: decl.animations !== undefined ? new WrappedNodeExpr(decl.animations) : null, changeDetection: (_c = decl.changeDetection) !== null && _c !== void 0 ? _c : ChangeDetectionStrategy.Default, encapsulation: (_d = decl.encapsulation) !== null && _d !== void 0 ? _d : ViewEncapsulation.Emulated, interpolation, declarationListEmitMode: 2 /* ClosureResolved */, relativeContextFilePath: '', i18nUseExternalIds: true });
|
|
19664
|
+
}
|
|
19665
|
+
function convertDeclarationFacadeToMetadata(declaration) {
|
|
19666
|
+
return Object.assign(Object.assign({}, declaration), { type: new WrappedNodeExpr(declaration.type) });
|
|
19667
|
+
}
|
|
19668
|
+
function convertDirectiveDeclarationToMetadata(declaration, isComponent = null) {
|
|
19578
19669
|
var _a, _b, _c;
|
|
19579
19670
|
return {
|
|
19671
|
+
kind: R3TemplateDependencyKind.Directive,
|
|
19672
|
+
isComponent: isComponent || declaration.kind === 'component',
|
|
19580
19673
|
selector: declaration.selector,
|
|
19581
19674
|
type: new WrappedNodeExpr(declaration.type),
|
|
19582
19675
|
inputs: (_a = declaration.inputs) !== null && _a !== void 0 ? _a : [],
|
|
@@ -19584,16 +19677,24 @@ function convertUsedDirectiveDeclarationToMetadata(declaration) {
|
|
|
19584
19677
|
exportAs: (_c = declaration.exportAs) !== null && _c !== void 0 ? _c : null,
|
|
19585
19678
|
};
|
|
19586
19679
|
}
|
|
19587
|
-
function
|
|
19588
|
-
|
|
19589
|
-
|
|
19590
|
-
return pipes;
|
|
19591
|
-
}
|
|
19592
|
-
for (const pipeName of Object.keys(declaredPipes)) {
|
|
19593
|
-
const pipeType = declaredPipes[pipeName];
|
|
19594
|
-
pipes.set(pipeName, new WrappedNodeExpr(pipeType));
|
|
19680
|
+
function convertPipeMapToMetadata(pipes) {
|
|
19681
|
+
if (!pipes) {
|
|
19682
|
+
return [];
|
|
19595
19683
|
}
|
|
19596
|
-
return pipes
|
|
19684
|
+
return Object.keys(pipes).map(name => {
|
|
19685
|
+
return {
|
|
19686
|
+
kind: R3TemplateDependencyKind.Pipe,
|
|
19687
|
+
name,
|
|
19688
|
+
type: new WrappedNodeExpr(pipes[name]),
|
|
19689
|
+
};
|
|
19690
|
+
});
|
|
19691
|
+
}
|
|
19692
|
+
function convertPipeDeclarationToMetadata(pipe) {
|
|
19693
|
+
return {
|
|
19694
|
+
kind: R3TemplateDependencyKind.Pipe,
|
|
19695
|
+
name: pipe.name,
|
|
19696
|
+
type: new WrappedNodeExpr(pipe.type),
|
|
19697
|
+
};
|
|
19597
19698
|
}
|
|
19598
19699
|
function parseJitTemplate(template, typeName, sourceMapUrl, preserveWhitespaces, interpolation) {
|
|
19599
19700
|
const interpolationConfig = interpolation ? InterpolationConfig.fromArray(interpolation) : DEFAULT_INTERPOLATION_CONFIG;
|
|
@@ -19742,7 +19843,7 @@ function publishFacade(global) {
|
|
|
19742
19843
|
* Use of this source code is governed by an MIT-style license that can be
|
|
19743
19844
|
* found in the LICENSE file at https://angular.io/license
|
|
19744
19845
|
*/
|
|
19745
|
-
const VERSION = new Version('14.0.0-next.
|
|
19846
|
+
const VERSION = new Version('14.0.0-next.14');
|
|
19746
19847
|
|
|
19747
19848
|
/**
|
|
19748
19849
|
* @license
|
|
@@ -21769,7 +21870,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$6 = '12.0.0';
|
|
|
21769
21870
|
function compileDeclareClassMetadata(metadata) {
|
|
21770
21871
|
const definitionMap = new DefinitionMap();
|
|
21771
21872
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$6));
|
|
21772
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
21873
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
21773
21874
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
21774
21875
|
definitionMap.set('type', metadata.type);
|
|
21775
21876
|
definitionMap.set('decorators', metadata.decorators);
|
|
@@ -21886,9 +21987,12 @@ function compileDeclareDirectiveFromMetadata(meta) {
|
|
|
21886
21987
|
function createDirectiveDefinitionMap(meta) {
|
|
21887
21988
|
const definitionMap = new DefinitionMap();
|
|
21888
21989
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$5));
|
|
21889
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
21990
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
21890
21991
|
// e.g. `type: MyDirective`
|
|
21891
21992
|
definitionMap.set('type', meta.internalType);
|
|
21993
|
+
if (meta.isStandalone) {
|
|
21994
|
+
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
21995
|
+
}
|
|
21892
21996
|
// e.g. `selector: 'some-dir'`
|
|
21893
21997
|
if (meta.selector !== null) {
|
|
21894
21998
|
definitionMap.set('selector', literal(meta.selector));
|
|
@@ -21993,9 +22097,7 @@ function createComponentDefinitionMap(meta, template, templateInfo) {
|
|
|
21993
22097
|
definitionMap.set('isInline', literal(true));
|
|
21994
22098
|
}
|
|
21995
22099
|
definitionMap.set('styles', toOptionalLiteralArray(meta.styles, literal));
|
|
21996
|
-
definitionMap.set('
|
|
21997
|
-
definitionMap.set('directives', compileUsedDirectiveMetadata(meta, directive => directive.isComponent !== true));
|
|
21998
|
-
definitionMap.set('pipes', compileUsedPipeMetadata(meta));
|
|
22100
|
+
definitionMap.set('dependencies', compileUsedDependenciesMetadata(meta));
|
|
21999
22101
|
definitionMap.set('viewProviders', meta.viewProviders);
|
|
22000
22102
|
definitionMap.set('animations', meta.animations);
|
|
22001
22103
|
if (meta.changeDetection !== undefined) {
|
|
@@ -22051,43 +22153,35 @@ function computeEndLocation(file, contents) {
|
|
|
22051
22153
|
} while (lineStart !== -1);
|
|
22052
22154
|
return new ParseLocation(file, length, line, length - lastLineStart);
|
|
22053
22155
|
}
|
|
22054
|
-
|
|
22055
|
-
* Compiles the directives as registered in the component metadata into an array literal of the
|
|
22056
|
-
* individual directives. If the component does not use any directives, then null is returned.
|
|
22057
|
-
*/
|
|
22058
|
-
function compileUsedDirectiveMetadata(meta, predicate) {
|
|
22156
|
+
function compileUsedDependenciesMetadata(meta) {
|
|
22059
22157
|
const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
|
22060
22158
|
generateForwardRef :
|
|
22061
22159
|
(expr) => expr;
|
|
22062
|
-
|
|
22063
|
-
|
|
22064
|
-
|
|
22065
|
-
|
|
22066
|
-
|
|
22067
|
-
|
|
22068
|
-
|
|
22069
|
-
|
|
22070
|
-
|
|
22160
|
+
return toOptionalLiteralArray(meta.declarations, decl => {
|
|
22161
|
+
switch (decl.kind) {
|
|
22162
|
+
case R3TemplateDependencyKind.Directive:
|
|
22163
|
+
const dirMeta = new DefinitionMap();
|
|
22164
|
+
dirMeta.set('kind', literal(decl.isComponent ? 'component' : 'directive'));
|
|
22165
|
+
dirMeta.set('type', wrapType(decl.type));
|
|
22166
|
+
dirMeta.set('selector', literal(decl.selector));
|
|
22167
|
+
dirMeta.set('inputs', toOptionalLiteralArray(decl.inputs, literal));
|
|
22168
|
+
dirMeta.set('outputs', toOptionalLiteralArray(decl.outputs, literal));
|
|
22169
|
+
dirMeta.set('exportAs', toOptionalLiteralArray(decl.exportAs, literal));
|
|
22170
|
+
return dirMeta.toLiteralMap();
|
|
22171
|
+
case R3TemplateDependencyKind.Pipe:
|
|
22172
|
+
const pipeMeta = new DefinitionMap();
|
|
22173
|
+
pipeMeta.set('kind', literal('pipe'));
|
|
22174
|
+
pipeMeta.set('type', wrapType(decl.type));
|
|
22175
|
+
pipeMeta.set('name', literal(decl.name));
|
|
22176
|
+
return pipeMeta.toLiteralMap();
|
|
22177
|
+
case R3TemplateDependencyKind.NgModule:
|
|
22178
|
+
const ngModuleMeta = new DefinitionMap();
|
|
22179
|
+
ngModuleMeta.set('kind', literal('ngmodule'));
|
|
22180
|
+
ngModuleMeta.set('type', wrapType(decl.type));
|
|
22181
|
+
return ngModuleMeta.toLiteralMap();
|
|
22182
|
+
}
|
|
22071
22183
|
});
|
|
22072
22184
|
}
|
|
22073
|
-
/**
|
|
22074
|
-
* Compiles the pipes as registered in the component metadata into an object literal, where the
|
|
22075
|
-
* pipe's name is used as key and a reference to its type as value. If the component does not use
|
|
22076
|
-
* any pipes, then null is returned.
|
|
22077
|
-
*/
|
|
22078
|
-
function compileUsedPipeMetadata(meta) {
|
|
22079
|
-
if (meta.pipes.size === 0) {
|
|
22080
|
-
return null;
|
|
22081
|
-
}
|
|
22082
|
-
const wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
|
22083
|
-
generateForwardRef :
|
|
22084
|
-
(expr) => expr;
|
|
22085
|
-
const entries = [];
|
|
22086
|
-
for (const [name, pipe] of meta.pipes) {
|
|
22087
|
-
entries.push({ key: name, value: wrapType(pipe), quoted: true });
|
|
22088
|
-
}
|
|
22089
|
-
return literalMap(entries);
|
|
22090
|
-
}
|
|
22091
22185
|
|
|
22092
22186
|
/**
|
|
22093
22187
|
* @license
|
|
@@ -22107,7 +22201,7 @@ const MINIMUM_PARTIAL_LINKER_VERSION$4 = '12.0.0';
|
|
|
22107
22201
|
function compileDeclareFactoryFunction(meta) {
|
|
22108
22202
|
const definitionMap = new DefinitionMap();
|
|
22109
22203
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$4));
|
|
22110
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22204
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
22111
22205
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22112
22206
|
definitionMap.set('type', meta.internalType);
|
|
22113
22207
|
definitionMap.set('deps', compileDependencies(meta.deps));
|
|
@@ -22149,7 +22243,7 @@ function compileDeclareInjectableFromMetadata(meta) {
|
|
|
22149
22243
|
function createInjectableDefinitionMap(meta) {
|
|
22150
22244
|
const definitionMap = new DefinitionMap();
|
|
22151
22245
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$3));
|
|
22152
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22246
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
22153
22247
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22154
22248
|
definitionMap.set('type', meta.internalType);
|
|
22155
22249
|
// Only generate providedIn property if it has a non-null value
|
|
@@ -22207,7 +22301,7 @@ function compileDeclareInjectorFromMetadata(meta) {
|
|
|
22207
22301
|
function createInjectorDefinitionMap(meta) {
|
|
22208
22302
|
const definitionMap = new DefinitionMap();
|
|
22209
22303
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$2));
|
|
22210
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22304
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
22211
22305
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22212
22306
|
definitionMap.set('type', meta.internalType);
|
|
22213
22307
|
definitionMap.set('providers', meta.providers);
|
|
@@ -22244,7 +22338,7 @@ function compileDeclareNgModuleFromMetadata(meta) {
|
|
|
22244
22338
|
function createNgModuleDefinitionMap(meta) {
|
|
22245
22339
|
const definitionMap = new DefinitionMap();
|
|
22246
22340
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION$1));
|
|
22247
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22341
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
22248
22342
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22249
22343
|
definitionMap.set('type', meta.internalType);
|
|
22250
22344
|
// We only generate the keys in the metadata if the arrays contain values.
|
|
@@ -22302,10 +22396,13 @@ function compileDeclarePipeFromMetadata(meta) {
|
|
|
22302
22396
|
function createPipeDefinitionMap(meta) {
|
|
22303
22397
|
const definitionMap = new DefinitionMap();
|
|
22304
22398
|
definitionMap.set('minVersion', literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
|
22305
|
-
definitionMap.set('version', literal('14.0.0-next.
|
|
22399
|
+
definitionMap.set('version', literal('14.0.0-next.14'));
|
|
22306
22400
|
definitionMap.set('ngImport', importExpr(Identifiers.core));
|
|
22307
22401
|
// e.g. `type: MyPipe`
|
|
22308
22402
|
definitionMap.set('type', meta.internalType);
|
|
22403
|
+
if (meta.isStandalone) {
|
|
22404
|
+
definitionMap.set('isStandalone', literal(meta.isStandalone));
|
|
22405
|
+
}
|
|
22309
22406
|
// e.g. `name: "myPipe"`
|
|
22310
22407
|
definitionMap.set('name', literal(meta.pipeName));
|
|
22311
22408
|
if (meta.pure === false) {
|
|
@@ -22352,5 +22449,5 @@ publishFacade(_global);
|
|
|
22352
22449
|
* found in the LICENSE file at https://angular.io/license
|
|
22353
22450
|
*/
|
|
22354
22451
|
|
|
22355
|
-
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3SelectorScopeMode, R3TargetBinder, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BoundAttribute as TmplAstBoundAttribute, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, Element$1 as TmplAstElement, Icu$1 as TmplAstIcu, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, Variable as TmplAstVariable, Token, TokenType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
|
|
22452
|
+
export { AST, ASTWithName, ASTWithSource, AbsoluteSourceSpan, ArrayType, AstMemoryEfficientTransformer, AstTransformer, Attribute, Binary, BinaryOperator, BinaryOperatorExpr, BindingPipe, BoundElementProperty, BuiltinType, BuiltinTypeName, CUSTOM_ELEMENTS_SCHEMA, Call, Chain, ChangeDetectionStrategy, CommaExpr, Comment, CompilerConfig, Conditional, ConditionalExpr, ConstantPool, CssSelector, DEFAULT_INTERPOLATION_CONFIG, DYNAMIC_TYPE, DeclareFunctionStmt, DeclareVarStmt, DomElementSchemaRegistry, EOF, Element, ElementSchemaRegistry, EmitterVisitorContext, EmptyExpr, Expansion, ExpansionCase, Expression, ExpressionBinding, ExpressionStatement, ExpressionType, ExternalExpr, ExternalReference, FactoryTarget$1 as FactoryTarget, FunctionExpr, HtmlParser, HtmlTagDefinition, I18NHtmlParser, IfStmt, ImplicitReceiver, InstantiateExpr, Interpolation, InterpolationConfig, InvokeFunctionExpr, JSDocComment, JitEvaluator, KeyedRead, KeyedWrite, LeadingComment, Lexer, LiteralArray, LiteralArrayExpr, LiteralExpr, LiteralMap, LiteralMapExpr, LiteralPrimitive, LocalizedString, MapType, MessageBundle, NONE_TYPE, NO_ERRORS_SCHEMA, NodeWithI18n, NonNullAssert, NotExpr, ParseError, ParseErrorLevel, ParseLocation, ParseSourceFile, ParseSourceSpan, ParseSpan, ParseTreeResult, ParsedEvent, ParsedProperty, ParsedPropertyType, ParsedVariable, Parser$1 as Parser, ParserError, PrefixNot, PropertyRead, PropertyWrite, R3BoundTarget, Identifiers as R3Identifiers, R3SelectorScopeMode, R3TargetBinder, R3TemplateDependencyKind, ReadKeyExpr, ReadPropExpr, ReadVarExpr, RecursiveAstVisitor, RecursiveVisitor, ResourceLoader, ReturnStatement, STRING_TYPE, SafeCall, SafeKeyedRead, SafePropertyRead, SelectorContext, SelectorListContext, SelectorMatcher, Serializer, SplitInterpolation, Statement, StmtModifier, TagContentType, TaggedTemplateExpr, TemplateBindingParseResult, TemplateLiteral, TemplateLiteralElement, Text, ThisReceiver, BoundAttribute as TmplAstBoundAttribute, BoundEvent as TmplAstBoundEvent, BoundText as TmplAstBoundText, Content as TmplAstContent, Element$1 as TmplAstElement, Icu$1 as TmplAstIcu, RecursiveVisitor$1 as TmplAstRecursiveVisitor, Reference as TmplAstReference, Template as TmplAstTemplate, Text$3 as TmplAstText, TextAttribute as TmplAstTextAttribute, Variable as TmplAstVariable, Token, TokenType, TreeError, Type, TypeModifier, TypeofExpr, Unary, UnaryOperator, UnaryOperatorExpr, VERSION, VariableBinding, Version, ViewEncapsulation, WrappedNodeExpr, WriteKeyExpr, WritePropExpr, WriteVarExpr, Xliff, Xliff2, Xmb, XmlParser, Xtb, _ParseAST, compileClassMetadata, compileComponentFromMetadata, compileDeclareClassMetadata, compileDeclareComponentFromMetadata, compileDeclareDirectiveFromMetadata, compileDeclareFactoryFunction, compileDeclareInjectableFromMetadata, compileDeclareInjectorFromMetadata, compileDeclareNgModuleFromMetadata, compileDeclarePipeFromMetadata, compileDirectiveFromMetadata, compileFactoryFunction, compileInjectable, compileInjector, compileNgModule, compilePipeFromMetadata, computeMsgId, core, createInjectableType, createMayBeForwardRefExpression, devOnlyGuardedExpression, emitDistinctChangesOnlyDefaultValue, getHtmlTagDefinition, getNsPrefix, getSafePropertyAccessString, identifierName, isIdentifier, isNgContainer, isNgContent, isNgTemplate, jsDocComment, leadingComment, literalMap, makeBindingParser, mergeNsAndName, output_ast as outputAst, parseHostBindings, parseTemplate, preserveWhitespacesDefault, publishFacade, r3JitTypeSourceSpan, sanitizeIdentifier, splitNsName, verifyHostBindings, visitAll };
|
|
22356
22453
|
//# sourceMappingURL=compiler.mjs.map
|