source: trip-planner-front/node_modules/@angular/compiler-cli/ngcc/src/migrations/utils.js@ 6a80231

Last change on this file since 6a80231 was 6a3a178, checked in by Ema <ema_spirova@…>, 3 years ago

initial commit

  • Property mode set to 100644
File size: 16.0 KB
Line 
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-cli/ngcc/src/migrations/utils", ["require", "exports", "typescript", "@angular/compiler-cli/src/ngtsc/imports", "@angular/compiler-cli/src/ngtsc/reflection"], factory);
8 }
9})(function (require, exports) {
10 "use strict";
11 Object.defineProperty(exports, "__esModule", { value: true });
12 exports.createInjectableDecorator = exports.createComponentDecorator = exports.createDirectiveDecorator = exports.hasConstructor = exports.hasPipeDecorator = exports.hasDirectiveDecorator = exports.isClassDeclaration = 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 ts = require("typescript");
21 var imports_1 = require("@angular/compiler-cli/src/ngtsc/imports");
22 var reflection_1 = require("@angular/compiler-cli/src/ngtsc/reflection");
23 function isClassDeclaration(clazz) {
24 return reflection_1.isNamedClassDeclaration(clazz) || reflection_1.isNamedFunctionDeclaration(clazz) ||
25 reflection_1.isNamedVariableDeclaration(clazz);
26 }
27 exports.isClassDeclaration = isClassDeclaration;
28 /**
29 * Returns true if the `clazz` is decorated as a `Directive` or `Component`.
30 */
31 function hasDirectiveDecorator(host, clazz) {
32 var ref = new imports_1.Reference(clazz);
33 return host.metadata.getDirectiveMetadata(ref) !== null;
34 }
35 exports.hasDirectiveDecorator = hasDirectiveDecorator;
36 /**
37 * Returns true if the `clazz` is decorated as a `Pipe`.
38 */
39 function hasPipeDecorator(host, clazz) {
40 var ref = new imports_1.Reference(clazz);
41 return host.metadata.getPipeMetadata(ref) !== null;
42 }
43 exports.hasPipeDecorator = hasPipeDecorator;
44 /**
45 * Returns true if the `clazz` has its own constructor function.
46 */
47 function hasConstructor(host, clazz) {
48 return host.reflectionHost.getConstructorParameters(clazz) !== null;
49 }
50 exports.hasConstructor = hasConstructor;
51 /**
52 * Create an empty `Directive` decorator that will be associated with the `clazz`.
53 */
54 function createDirectiveDecorator(clazz, metadata) {
55 var args = [];
56 if (metadata !== undefined) {
57 var metaArgs = [];
58 if (metadata.selector !== null) {
59 metaArgs.push(property('selector', metadata.selector));
60 }
61 if (metadata.exportAs !== null) {
62 metaArgs.push(property('exportAs', metadata.exportAs.join(', ')));
63 }
64 args.push(reifySourceFile(ts.createObjectLiteral(metaArgs)));
65 }
66 return {
67 name: 'Directive',
68 identifier: null,
69 import: { name: 'Directive', from: '@angular/core' },
70 node: null,
71 synthesizedFor: clazz.name,
72 args: args,
73 };
74 }
75 exports.createDirectiveDecorator = createDirectiveDecorator;
76 /**
77 * Create an empty `Component` decorator that will be associated with the `clazz`.
78 */
79 function createComponentDecorator(clazz, metadata) {
80 var metaArgs = [
81 property('template', ''),
82 ];
83 if (metadata.selector !== null) {
84 metaArgs.push(property('selector', metadata.selector));
85 }
86 if (metadata.exportAs !== null) {
87 metaArgs.push(property('exportAs', metadata.exportAs.join(', ')));
88 }
89 return {
90 name: 'Component',
91 identifier: null,
92 import: { name: 'Component', from: '@angular/core' },
93 node: null,
94 synthesizedFor: clazz.name,
95 args: [
96 reifySourceFile(ts.createObjectLiteral(metaArgs)),
97 ],
98 };
99 }
100 exports.createComponentDecorator = createComponentDecorator;
101 /**
102 * Create an empty `Injectable` decorator that will be associated with the `clazz`.
103 */
104 function createInjectableDecorator(clazz) {
105 return {
106 name: 'Injectable',
107 identifier: null,
108 import: { name: 'Injectable', from: '@angular/core' },
109 node: null,
110 synthesizedFor: clazz.name,
111 args: [],
112 };
113 }
114 exports.createInjectableDecorator = createInjectableDecorator;
115 function property(name, value) {
116 return ts.createPropertyAssignment(name, ts.createStringLiteral(value));
117 }
118 var EMPTY_SF = ts.createSourceFile('(empty)', '', ts.ScriptTarget.Latest);
119 /**
120 * Takes a `ts.Expression` and returns the same `ts.Expression`, but with an associated
121 * `ts.SourceFile`.
122 *
123 * This transformation is necessary to use synthetic `ts.Expression`s with the `PartialEvaluator`,
124 * and many decorator arguments are interpreted in this way.
125 */
126 function reifySourceFile(expr) {
127 var printer = ts.createPrinter();
128 var exprText = printer.printNode(ts.EmitHint.Unspecified, expr, EMPTY_SF);
129 var sf = ts.createSourceFile('(synthetic)', "const expr = " + exprText + ";", ts.ScriptTarget.Latest, true, ts.ScriptKind.JS);
130 var stmt = sf.statements[0];
131 if (!ts.isVariableStatement(stmt)) {
132 throw new Error("Expected VariableStatement, got " + ts.SyntaxKind[stmt.kind]);
133 }
134 return stmt.declarationList.declarations[0].initializer;
135 }
136});
137//# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoidXRpbHMuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb21waWxlci1jbGkvbmdjYy9zcmMvbWlncmF0aW9ucy91dGlscy50cyJdLCJuYW1lcyI6W10sIm1hcHBpbmdzIjoiOzs7Ozs7Ozs7Ozs7SUFBQTs7Ozs7O09BTUc7SUFDSCwrQkFBaUM7SUFDakMsbUVBQXFEO0lBQ3JELHlFQUEySjtJQUczSixTQUFnQixrQkFBa0IsQ0FBQyxLQUFjO1FBQy9DLE9BQU8sb0NBQXVCLENBQUMsS0FBSyxDQUFDLElBQUksdUNBQTBCLENBQUMsS0FBSyxDQUFDO1lBQ3RFLHVDQUEwQixDQUFDLEtBQUssQ0FBQyxDQUFDO0lBQ3hDLENBQUM7SUFIRCxnREFHQztJQUVEOztPQUVHO0lBQ0gsU0FBZ0IscUJBQXFCLENBQUMsSUFBbUIsRUFBRSxLQUF1QjtRQUNoRixJQUFNLEdBQUcsR0FBRyxJQUFJLG1CQUFTLENBQUMsS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291cmNlRmlsZShcbiAgICAgICcoc3ludGhldGljKScsIGBjb25zdCBleHByID0gJHtleHByVGV4dH07YCwgdHMuU2NyaXB0VGFyZ2V0LkxhdGVzdCwgdHJ1ZSwgdHMuU2NyaXB0S2luZC5KUyk7XG4gIGNvbnN0IHN0bXQgPSBzZi5zdGF0ZW1lbnRzWzBdO1xuICBpZiAoIXRzLmlzVmFyaWFibGVTdGF0ZW1lbnQoc3RtdCkpIHtcbiAgICB0aHJvdyBuZXcgRXJyb3IoYEV4cGVjdGVkIFZhcmlhYmxlU3RhdGVtZW50LCBnb3QgJHt0cy5TeW50YXhLaW5kW3N0bXQua2luZF19YCk7XG4gIH1cbiAgcmV0dXJuIHN0bXQuZGVjbGFyYXRpb25MaXN0LmRlY2xhcmF0aW9uc1swXS5pbml0aWFsaXplciE7XG59XG4iXX0=
Note: See TracBrowser for help on using the repository browser.