[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/pipe", ["require", "exports", "@angular/compiler/src/output/output_ast", "@angular/compiler/src/render3/r3_identifiers", "@angular/compiler/src/render3/r3_pipe_compiler", "@angular/compiler/src/render3/view/util"], factory);
|
---|
| 8 | }
|
---|
| 9 | })(function (require, exports) {
|
---|
| 10 | "use strict";
|
---|
| 11 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
| 12 | exports.createPipeDefinitionMap = exports.compileDeclarePipeFromMetadata = void 0;
|
---|
| 13 | /**
|
---|
| 14 | * @license
|
---|
| 15 | * Copyright Google LLC All Rights Reserved.
|
---|
| 16 | *
|
---|
| 17 | * Use of this source code is governed by an MIT-style license that can be
|
---|
| 18 | * found in the LICENSE file at https://angular.io/license
|
---|
| 19 | */
|
---|
| 20 | var o = require("@angular/compiler/src/output/output_ast");
|
---|
| 21 | var r3_identifiers_1 = require("@angular/compiler/src/render3/r3_identifiers");
|
---|
| 22 | var r3_pipe_compiler_1 = require("@angular/compiler/src/render3/r3_pipe_compiler");
|
---|
| 23 | var util_1 = require("@angular/compiler/src/render3/view/util");
|
---|
| 24 | /**
|
---|
| 25 | * Every time we make a breaking change to the declaration interface or partial-linker behavior, we
|
---|
| 26 | * must update this constant to prevent old partial-linkers from incorrectly processing the
|
---|
| 27 | * declaration.
|
---|
| 28 | *
|
---|
| 29 | * Do not include any prerelease in these versions as they are ignored.
|
---|
| 30 | */
|
---|
| 31 | var MINIMUM_PARTIAL_LINKER_VERSION = '12.0.0';
|
---|
| 32 | /**
|
---|
| 33 | * Compile a Pipe declaration defined by the `R3PipeMetadata`.
|
---|
| 34 | */
|
---|
| 35 | function compileDeclarePipeFromMetadata(meta) {
|
---|
| 36 | var definitionMap = createPipeDefinitionMap(meta);
|
---|
| 37 | var expression = o.importExpr(r3_identifiers_1.Identifiers.declarePipe).callFn([definitionMap.toLiteralMap()]);
|
---|
| 38 | var type = r3_pipe_compiler_1.createPipeType(meta);
|
---|
| 39 | return { expression: expression, type: type, statements: [] };
|
---|
| 40 | }
|
---|
| 41 | exports.compileDeclarePipeFromMetadata = compileDeclarePipeFromMetadata;
|
---|
| 42 | /**
|
---|
| 43 | * Gathers the declaration fields for a Pipe into a `DefinitionMap`.
|
---|
| 44 | */
|
---|
| 45 | function createPipeDefinitionMap(meta) {
|
---|
| 46 | var definitionMap = new util_1.DefinitionMap();
|
---|
| 47 | definitionMap.set('minVersion', o.literal(MINIMUM_PARTIAL_LINKER_VERSION));
|
---|
[e29cc2e] | 48 | definitionMap.set('version', o.literal('12.2.13'));
|
---|
[6a3a178] | 49 | definitionMap.set('ngImport', o.importExpr(r3_identifiers_1.Identifiers.core));
|
---|
| 50 | // e.g. `type: MyPipe`
|
---|
| 51 | definitionMap.set('type', meta.internalType);
|
---|
| 52 | // e.g. `name: "myPipe"`
|
---|
| 53 | definitionMap.set('name', o.literal(meta.pipeName));
|
---|
| 54 | if (meta.pure === false) {
|
---|
| 55 | // e.g. `pure: false`
|
---|
| 56 | definitionMap.set('pure', o.literal(meta.pure));
|
---|
| 57 | }
|
---|
| 58 | return definitionMap;
|
---|
| 59 | }
|
---|
| 60 | exports.createPipeDefinitionMap = createPipeDefinitionMap;
|
---|
| 61 | });
|
---|
| 62 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9yZW5kZXIzL3BhcnRpYWwvcGlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7SUFBQTs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