[6a3a178] | 1 | (function (factory) {
|
---|
| 2 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
| 3 | var v = factory(require, exports);
|
---|
| 4 | if (v !== undefined) module.exports = v;
|
---|
| 5 | }
|
---|
| 6 | else if (typeof define === "function" && define.amd) {
|
---|
| 7 | define("@angular/compiler/src/render3/partial/component", ["require", "exports", "tslib", "@angular/compiler/src/core", "@angular/compiler/src/ml_parser/interpolation_config", "@angular/compiler/src/output/output_ast", "@angular/compiler/src/parse_util", "@angular/compiler/src/render3/r3_identifiers", "@angular/compiler/src/render3/view/compiler", "@angular/compiler/src/render3/view/util", "@angular/compiler/src/render3/partial/directive", "@angular/compiler/src/render3/partial/util"], factory);
|
---|
| 8 | }
|
---|
| 9 | })(function (require, exports) {
|
---|
| 10 | "use strict";
|
---|
| 11 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 12 | exports.createComponentDefinitionMap = exports.compileDeclareComponentFromMetadata = void 0;
|
---|
| 13 | var tslib_1 = require("tslib");
|
---|
| 14 | /**
|
---|
| 15 | * @license
|
---|
| 16 | * Copyright Google LLC All Rights Reserved.
|
---|
| 17 | *
|
---|
| 18 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 19 | * found in the LICENSE file at https://angular.io/license
|
---|
| 20 | */
|
---|
| 21 | var core = require("@angular/compiler/src/core");
|
---|
| 22 | var interpolation_config_1 = require("@angular/compiler/src/ml_parser/interpolation_config");
|
---|
| 23 | var o = require("@angular/compiler/src/output/output_ast");
|
---|
| 24 | var parse_util_1 = require("@angular/compiler/src/parse_util");
|
---|
| 25 | var r3_identifiers_1 = require("@angular/compiler/src/render3/r3_identifiers");
|
---|
| 26 | var compiler_1 = require("@angular/compiler/src/render3/view/compiler");
|
---|
| 27 | var util_1 = require("@angular/compiler/src/render3/view/util");
|
---|
| 28 | var directive_1 = require("@angular/compiler/src/render3/partial/directive");
|
---|
| 29 | var util_2 = require("@angular/compiler/src/render3/partial/util");
|
---|
| 30 | /**
|
---|
| 31 | * Compile a component declaration defined by the `R3ComponentMetadata`.
|
---|
| 32 | */
|
---|
| 33 | function compileDeclareComponentFromMetadata(meta, template, additionalTemplateInfo) {
|
---|
| 34 | var definitionMap = createComponentDefinitionMap(meta, template, additionalTemplateInfo);
|
---|
| 35 | var expression = o.importExpr(r3_identifiers_1.Identifiers.declareComponent).callFn([definitionMap.toLiteralMap()]);
|
---|
| 36 | var type = compiler_1.createComponentType(meta);
|
---|
| 37 | return { expression: expression, type: type, statements: [] };
|
---|
| 38 | }
|
---|
| 39 | exports.compileDeclareComponentFromMetadata = compileDeclareComponentFromMetadata;
|
---|
| 40 | /**
|
---|
| 41 | * Gathers the declaration fields for a component into a `DefinitionMap`.
|
---|
| 42 | */
|
---|
| 43 | function createComponentDefinitionMap(meta, template, templateInfo) {
|
---|
| 44 | var definitionMap = directive_1.createDirectiveDefinitionMap(meta);
|
---|
| 45 | definitionMap.set('template', getTemplateExpression(template, templateInfo));
|
---|
| 46 | if (templateInfo.isInline) {
|
---|
| 47 | definitionMap.set('isInline', o.literal(true));
|
---|
| 48 | }
|
---|
| 49 | definitionMap.set('styles', util_2.toOptionalLiteralArray(meta.styles, o.literal));
|
---|
| 50 | definitionMap.set('components', compileUsedDirectiveMetadata(meta, function (directive) { return directive.isComponent === true; }));
|
---|
| 51 | definitionMap.set('directives', compileUsedDirectiveMetadata(meta, function (directive) { return directive.isComponent !== true; }));
|
---|
| 52 | definitionMap.set('pipes', compileUsedPipeMetadata(meta));
|
---|
| 53 | definitionMap.set('viewProviders', meta.viewProviders);
|
---|
| 54 | definitionMap.set('animations', meta.animations);
|
---|
| 55 | if (meta.changeDetection !== undefined) {
|
---|
| 56 | definitionMap.set('changeDetection', o.importExpr(r3_identifiers_1.Identifiers.ChangeDetectionStrategy)
|
---|
| 57 | .prop(core.ChangeDetectionStrategy[meta.changeDetection]));
|
---|
| 58 | }
|
---|
| 59 | if (meta.encapsulation !== core.ViewEncapsulation.Emulated) {
|
---|
| 60 | definitionMap.set('encapsulation', o.importExpr(r3_identifiers_1.Identifiers.ViewEncapsulation).prop(core.ViewEncapsulation[meta.encapsulation]));
|
---|
| 61 | }
|
---|
| 62 | if (meta.interpolation !== interpolation_config_1.DEFAULT_INTERPOLATION_CONFIG) {
|
---|
| 63 | definitionMap.set('interpolation', o.literalArr([o.literal(meta.interpolation.start), o.literal(meta.interpolation.end)]));
|
---|
| 64 | }
|
---|
| 65 | if (template.preserveWhitespaces === true) {
|
---|
| 66 | definitionMap.set('preserveWhitespaces', o.literal(true));
|
---|
| 67 | }
|
---|
| 68 | return definitionMap;
|
---|
| 69 | }
|
---|
| 70 | exports.createComponentDefinitionMap = createComponentDefinitionMap;
|
---|
| 71 | function getTemplateExpression(template, templateInfo) {
|
---|
| 72 | // If the template has been defined using a direct literal, we use that expression directly
|
---|
| 73 | // without any modifications. This is ensures proper source mapping from the partially
|
---|
| 74 | // compiled code to the source file declaring the template. Note that this does not capture
|
---|
| 75 | // template literals referenced indirectly through an identifier.
|
---|
| 76 | if (templateInfo.inlineTemplateLiteralExpression !== null) {
|
---|
| 77 | return templateInfo.inlineTemplateLiteralExpression;
|
---|
| 78 | }
|
---|
| 79 | // If the template is defined inline but not through a literal, the template has been resolved
|
---|
| 80 | // through static interpretation. We create a literal but cannot provide any source span. Note
|
---|
| 81 | // that we cannot use the expression defining the template because the linker expects the template
|
---|
| 82 | // to be defined as a literal in the declaration.
|
---|
| 83 | if (templateInfo.isInline) {
|
---|
| 84 | return o.literal(templateInfo.content, null, null);
|
---|
| 85 | }
|
---|
| 86 | // The template is external so we must synthesize an expression node with
|
---|
| 87 | // the appropriate source-span.
|
---|
| 88 | var contents = templateInfo.content;
|
---|
| 89 | var file = new parse_util_1.ParseSourceFile(contents, templateInfo.sourceUrl);
|
---|
| 90 | var start = new parse_util_1.ParseLocation(file, 0, 0, 0);
|
---|
| 91 | var end = computeEndLocation(file, contents);
|
---|
| 92 | var span = new parse_util_1.ParseSourceSpan(start, end);
|
---|
| 93 | return o.literal(contents, null, span);
|
---|
| 94 | }
|
---|
| 95 | function computeEndLocation(file, contents) {
|
---|
| 96 | var length = contents.length;
|
---|
| 97 | var lineStart = 0;
|
---|
| 98 | var lastLineStart = 0;
|
---|
| 99 | var line = 0;
|
---|
| 100 | do {
|
---|
| 101 | lineStart = contents.indexOf('\n', lastLineStart);
|
---|
| 102 | if (lineStart !== -1) {
|
---|
| 103 | lastLineStart = lineStart + 1;
|
---|
| 104 | line++;
|
---|
| 105 | }
|
---|
| 106 | } while (lineStart !== -1);
|
---|
| 107 | return new parse_util_1.ParseLocation(file, length, line, length - lastLineStart);
|
---|
| 108 | }
|
---|
| 109 | /**
|
---|
| 110 | * Compiles the directives as registered in the component metadata into an array literal of the
|
---|
| 111 | * individual directives. If the component does not use any directives, then null is returned.
|
---|
| 112 | */
|
---|
| 113 | function compileUsedDirectiveMetadata(meta, predicate) {
|
---|
| 114 | var wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
---|
| 115 | util_2.generateForwardRef :
|
---|
| 116 | function (expr) { return expr; };
|
---|
| 117 | var directives = meta.directives.filter(predicate);
|
---|
| 118 | return util_2.toOptionalLiteralArray(directives, function (directive) {
|
---|
| 119 | var dirMeta = new util_1.DefinitionMap();
|
---|
| 120 | dirMeta.set('type', wrapType(directive.type));
|
---|
| 121 | dirMeta.set('selector', o.literal(directive.selector));
|
---|
| 122 | dirMeta.set('inputs', util_2.toOptionalLiteralArray(directive.inputs, o.literal));
|
---|
| 123 | dirMeta.set('outputs', util_2.toOptionalLiteralArray(directive.outputs, o.literal));
|
---|
| 124 | dirMeta.set('exportAs', util_2.toOptionalLiteralArray(directive.exportAs, o.literal));
|
---|
| 125 | return dirMeta.toLiteralMap();
|
---|
| 126 | });
|
---|
| 127 | }
|
---|
| 128 | /**
|
---|
| 129 | * Compiles the pipes as registered in the component metadata into an object literal, where the
|
---|
| 130 | * pipe's name is used as key and a reference to its type as value. If the component does not use
|
---|
| 131 | * any pipes, then null is returned.
|
---|
| 132 | */
|
---|
| 133 | function compileUsedPipeMetadata(meta) {
|
---|
| 134 | var e_1, _a;
|
---|
| 135 | if (meta.pipes.size === 0) {
|
---|
| 136 | return null;
|
---|
| 137 | }
|
---|
| 138 | var wrapType = meta.declarationListEmitMode !== 0 /* Direct */ ?
|
---|
| 139 | util_2.generateForwardRef :
|
---|
| 140 | function (expr) { return expr; };
|
---|
| 141 | var entries = [];
|
---|
| 142 | try {
|
---|
| 143 | for (var _b = tslib_1.__values(meta.pipes), _c = _b.next(); !_c.done; _c = _b.next()) {
|
---|
| 144 | var _d = tslib_1.__read(_c.value, 2), name_1 = _d[0], pipe = _d[1];
|
---|
| 145 | entries.push({ key: name_1, value: wrapType(pipe), quoted: true });
|
---|
| 146 | }
|
---|
| 147 | }
|
---|
| 148 | catch (e_1_1) { e_1 = { error: e_1_1 }; }
|
---|
| 149 | finally {
|
---|
| 150 | try {
|
---|
| 151 | if (_c && !_c.done && (_a = _b.return)) _a.call(_b);
|
---|
| 152 | }
|
---|
| 153 | finally { if (e_1) throw e_1.error; }
|
---|
| 154 | }
|
---|
| 155 | return o.literalMap(entries);
|
---|
| 156 | }
|
---|
| 157 | });
|
---|
| 158 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29tcG9uZW50LmpzIiwic291cmNlUm9vdCI6IiIsInNvdXJjZXMiOlsiLi4vLi4vLi4vLi4vLi4vLi4vLi4vLi4vcGFja2FnZXMvY29tcGlsZXIvc3JjL3JlbmRlcjMvcGFydGlhbC9jb21wb25lbnQudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6Ijs7Ozs7Ozs7Ozs7OztJQUFBOzs7Ozs7T0FNRztJQUNILGlEQUFtQztJQUNuQyw2RkFBa0Y7SUFDbEYsMkRBQTZDO0lBQzdDLCtEQUFpRjtJQUNqRiwrRUFBb0Q7SUFHcEQsd0VBQXFEO0lBRXJELGdFQUEyQztJQUczQyw2RUFBeUQ7SUFDekQsbUVBQWtFO0l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