(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-cli/ngcc/src/migrations/utils", ["require", "exports", "typescript", "@angular/compiler-cli/src/ngtsc/imports", "@angular/compiler-cli/src/ngtsc/reflection"], factory); } })(function (require, exports) { "use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.createInjectableDecorator = exports.createComponentDecorator = exports.createDirectiveDecorator = exports.hasConstructor = exports.hasPipeDecorator = exports.hasDirectiveDecorator = exports.isClassDeclaration = 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 ts = require("typescript"); var imports_1 = require("@angular/compiler-cli/src/ngtsc/imports"); var reflection_1 = require("@angular/compiler-cli/src/ngtsc/reflection"); function isClassDeclaration(clazz) { return reflection_1.isNamedClassDeclaration(clazz) || reflection_1.isNamedFunctionDeclaration(clazz) || reflection_1.isNamedVariableDeclaration(clazz); } exports.isClassDeclaration = isClassDeclaration; /** * Returns true if the `clazz` is decorated as a `Directive` or `Component`. */ function hasDirectiveDecorator(host, clazz) { var ref = new imports_1.Reference(clazz); return host.metadata.getDirectiveMetadata(ref) !== null; } exports.hasDirectiveDecorator = hasDirectiveDecorator; /** * Returns true if the `clazz` is decorated as a `Pipe`. */ function hasPipeDecorator(host, clazz) { var ref = new imports_1.Reference(clazz); return host.metadata.getPipeMetadata(ref) !== null; } exports.hasPipeDecorator = hasPipeDecorator; /** * Returns true if the `clazz` has its own constructor function. */ function hasConstructor(host, clazz) { return host.reflectionHost.getConstructorParameters(clazz) !== null; } exports.hasConstructor = hasConstructor; /** * Create an empty `Directive` decorator that will be associated with the `clazz`. */ function createDirectiveDecorator(clazz, metadata) { var args = []; if (metadata !== undefined) { var metaArgs = []; if (metadata.selector !== null) { metaArgs.push(property('selector', metadata.selector)); } if (metadata.exportAs !== null) { metaArgs.push(property('exportAs', metadata.exportAs.join(', '))); } args.push(reifySourceFile(ts.createObjectLiteral(metaArgs))); } return { name: 'Directive', identifier: null, import: { name: 'Directive', from: '@angular/core' }, node: null, synthesizedFor: clazz.name, args: args, }; } exports.createDirectiveDecorator = createDirectiveDecorator; /** * Create an empty `Component` decorator that will be associated with the `clazz`. */ function createComponentDecorator(clazz, metadata) { var metaArgs = [ property('template', ''), ]; if (metadata.selector !== null) { metaArgs.push(property('selector', metadata.selector)); } if (metadata.exportAs !== null) { metaArgs.push(property('exportAs', metadata.exportAs.join(', '))); } return { name: 'Component', identifier: null, import: { name: 'Component', from: '@angular/core' }, node: null, synthesizedFor: clazz.name, args: [ reifySourceFile(ts.createObjectLiteral(metaArgs)), ], }; } exports.createComponentDecorator = createComponentDecorator; /** * Create an empty `Injectable` decorator that will be associated with the `clazz`. */ function createInjectableDecorator(clazz) { return { name: 'Injectable', identifier: null, import: { name: 'Injectable', from: '@angular/core' }, node: null, synthesizedFor: clazz.name, args: [], }; } exports.createInjectableDecorator = createInjectableDecorator; function property(name, value) { return ts.createPropertyAssignment(name, ts.createStringLiteral(value)); } var EMPTY_SF = ts.createSourceFile('(empty)', '', ts.ScriptTarget.Latest); /** * Takes a `ts.Expression` and returns the same `ts.Expression`, but with an associated * `ts.SourceFile`. * * This transformation is necessary to use synthetic `ts.Expression`s with the `PartialEvaluator`, * and many decorator arguments are interpreted in this way. */ function reifySourceFile(expr) { var printer = ts.createPrinter(); var exprText = printer.printNode(ts.EmitHint.Unspecified, expr, EMPTY_SF); var sf = ts.createSourceFile('(synthetic)', "const expr = " + exprText + ";", ts.ScriptTarget.Latest, true, ts.ScriptKind.JS); var stmt = sf.statements[0]; if (!ts.isVariableStatement(stmt)) { throw new Error("Expected VariableStatement, got " + ts.SyntaxKind[stmt.kind]); } return stmt.declarationList.declarations[0].initializer; } }); //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlc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