(function (factory) { if (typeof module === "object" && typeof module.exports === "object") { var v = factory(require, exports); if (v !== undefined) module.exports = v; } else if (typeof define === "function" && define.amd) { 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); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createPipeDefinitionMap = exports.compileDeclarePipeFromMetadata = void 0; /** * @license * Copyright Google LLC All Rights Reserved. * * Use of this source code is governed by an MIT-style license that can be * found in the LICENSE file at https://angular.io/license */ var o = require("@angular/compiler/src/output/output_ast"); var r3_identifiers_1 = require("@angular/compiler/src/render3/r3_identifiers"); var r3_pipe_compiler_1 = require("@angular/compiler/src/render3/r3_pipe_compiler"); var util_1 = require("@angular/compiler/src/render3/view/util"); /** * Every time we make a breaking change to the declaration interface or partial-linker behavior, we * must update this constant to prevent old partial-linkers from incorrectly processing the * declaration. * * Do not include any prerelease in these versions as they are ignored. */ var MINIMUM_PARTIAL_LINKER_VERSION = '12.0.0'; /** * Compile a Pipe declaration defined by the `R3PipeMetadata`. */ function compileDeclarePipeFromMetadata(meta) { var definitionMap = createPipeDefinitionMap(meta); var expression = o.importExpr(r3_identifiers_1.Identifiers.declarePipe).callFn([definitionMap.toLiteralMap()]); var type = r3_pipe_compiler_1.createPipeType(meta); return { expression: expression, type: type, statements: [] }; } exports.compileDeclarePipeFromMetadata = compileDeclarePipeFromMetadata; /** * Gathers the declaration fields for a Pipe into a `DefinitionMap`. */ function createPipeDefinitionMap(meta) { var definitionMap = new util_1.DefinitionMap(); definitionMap.set('minVersion', o.literal(MINIMUM_PARTIAL_LINKER_VERSION)); definitionMap.set('version', o.literal('12.2.13')); definitionMap.set('ngImport', o.importExpr(r3_identifiers_1.Identifiers.core)); // e.g. `type: MyPipe` definitionMap.set('type', meta.internalType); // e.g. `name: "myPipe"` definitionMap.set('name', o.literal(meta.pipeName)); if (meta.pure === false) { // e.g. `pure: false` definitionMap.set('pure', o.literal(meta.pure)); } return definitionMap; } exports.createPipeDefinitionMap = createPipeDefinitionMap; }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoicGlwZS5qcyIsInNvdXJjZVJvb3QiOiIiLCJzb3VyY2VzIjpbIi4uLy4uLy4uLy4uLy4uLy4uLy4uLy4uL3BhY2thZ2VzL2NvbXBpbGVyL3NyYy9yZW5kZXIzL3BhcnRpYWwvcGlwZS50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7SUFBQTs7Ozs7O09BTUc7SUFDSCwyREFBNkM7SUFDN0MsK0VBQW9EO0lBQ3BELG1GQUFtRTtJQUVuRSxnRUFBMkM7SUFHM0M7Ozs7OztPQU1HO0lBQ0gsSUFBTSw4QkFBOEIsR0FBRyxRQUFRLENBQUM7SUFFaEQ7O09BRUc7SUFDSCxTQUFnQiw4QkFBOEIsQ0FBQyxJQUFvQjtRQUNqRSxJQUFNLGFBQWEsR0FBRyx1QkFBdUIsQ0FBQyxJQUFJLENBQUMsQ0FBQztRQUVwRCxJQUFNLFVBQVUsR0FBRyxDQUFDLENBQUMsVUFBVSxDQUFDLDRCQUFFLENBQUMsV0FBVyxDQUFDLENBQUMsTUFBTSxDQUFDLENBQUMsYUFBYSxDQUFDLFlBQVksRUFBRSxDQUFDLENBQUMsQ0FBQztRQUN2RixJQUFNLElBQUksR0FBRyxpQ0FBYyxDQUFDLElBQUksQ0FBQyxDQUFDO1FBRWxDLE9BQU8sRUFBQyxVQUFVLFlBQUEsRUFBRSxJQUFJLE1BQUEsRUFBRSxVQUFVLEVBQUUsRUFBRSxFQUFDLENBQUM7SUFDNUMsQ0FBQztJQVBELHdFQU9DO0lBRUQ7O09BRUc7SUFDSCxTQUFnQix1QkFBdUIsQ0FBQyxJQUFvQjtRQUUxRCxJQUFNLGFBQWEsR0FBRyxJQU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