1 | /**
|
---|
2 | * @license
|
---|
3 | * Copyright Google LLC All Rights Reserved.
|
---|
4 | *
|
---|
5 | * Use of this source code is governed by an MIT-style license that can be
|
---|
6 | * found in the LICENSE file at https://angular.io/license
|
---|
7 | */
|
---|
8 | (function (factory) {
|
---|
9 | if (typeof module === "object" && typeof module.exports === "object") {
|
---|
10 | var v = factory(require, exports);
|
---|
11 | if (v !== undefined) module.exports = v;
|
---|
12 | }
|
---|
13 | else if (typeof define === "function" && define.amd) {
|
---|
14 | define("@angular/core/schematics/migrations/undecorated-classes-with-di/decorator_rewrite/convert_directive_metadata", ["require", "exports", "@angular/compiler", "typescript"], factory);
|
---|
15 | }
|
---|
16 | })(function (require, exports) {
|
---|
17 | "use strict";
|
---|
18 | Object.defineProperty(exports, "__esModule", { value: true });
|
---|
19 | exports.convertDirectiveMetadataToExpression = exports.UnexpectedMetadataValueError = void 0;
|
---|
20 | const compiler_1 = require("@angular/compiler");
|
---|
21 | const ts = require("typescript");
|
---|
22 | /** Error that will be thrown if an unexpected value needs to be converted. */
|
---|
23 | class UnexpectedMetadataValueError extends Error {
|
---|
24 | }
|
---|
25 | exports.UnexpectedMetadataValueError = UnexpectedMetadataValueError;
|
---|
26 | /**
|
---|
27 | * Converts a directive metadata object into a TypeScript expression. Throws
|
---|
28 | * if metadata cannot be cleanly converted.
|
---|
29 | */
|
---|
30 | function convertDirectiveMetadataToExpression(metadata, resolveSymbolImport, createImport, convertProperty) {
|
---|
31 | if (typeof metadata === 'string') {
|
---|
32 | return ts.createStringLiteral(metadata);
|
---|
33 | }
|
---|
34 | else if (Array.isArray(metadata)) {
|
---|
35 | return ts.createArrayLiteral(metadata.map(el => convertDirectiveMetadataToExpression(el, resolveSymbolImport, createImport, convertProperty)));
|
---|
36 | }
|
---|
37 | else if (typeof metadata === 'number') {
|
---|
38 | return ts.createNumericLiteral(metadata.toString());
|
---|
39 | }
|
---|
40 | else if (typeof metadata === 'boolean') {
|
---|
41 | return metadata ? ts.createTrue() : ts.createFalse();
|
---|
42 | }
|
---|
43 | else if (typeof metadata === 'undefined') {
|
---|
44 | return ts.createIdentifier('undefined');
|
---|
45 | }
|
---|
46 | else if (typeof metadata === 'bigint') {
|
---|
47 | return ts.createBigIntLiteral(metadata.toString());
|
---|
48 | }
|
---|
49 | else if (typeof metadata === 'object') {
|
---|
50 | // In case there is a static symbol object part of the metadata, try to resolve
|
---|
51 | // the import expression of the symbol. If no import path could be resolved, an
|
---|
52 | // error will be thrown as the symbol cannot be converted into TypeScript AST.
|
---|
53 | if (metadata instanceof compiler_1.StaticSymbol) {
|
---|
54 | const resolvedImport = resolveSymbolImport(metadata);
|
---|
55 | if (resolvedImport === null) {
|
---|
56 | throw new UnexpectedMetadataValueError();
|
---|
57 | }
|
---|
58 | return createImport(resolvedImport, metadata.name);
|
---|
59 | }
|
---|
60 | const literalProperties = [];
|
---|
61 | for (const key of Object.keys(metadata)) {
|
---|
62 | const metadataValue = metadata[key];
|
---|
63 | let propertyValue = null;
|
---|
64 | // Allows custom conversion of properties in an object. This is useful for special
|
---|
65 | // cases where we don't want to store the enum values as integers, but rather use the
|
---|
66 | // real enum symbol. e.g. instead of `2` we want to use `ViewEncapsulation.None`.
|
---|
67 | if (convertProperty) {
|
---|
68 | propertyValue = convertProperty(key, metadataValue);
|
---|
69 | }
|
---|
70 | // In case the property value has not been assigned to an expression, we convert
|
---|
71 | // the resolved metadata value into a TypeScript expression.
|
---|
72 | if (propertyValue === null) {
|
---|
73 | propertyValue = convertDirectiveMetadataToExpression(metadataValue, resolveSymbolImport, createImport, convertProperty);
|
---|
74 | }
|
---|
75 | literalProperties.push(ts.createPropertyAssignment(getPropertyName(key), propertyValue));
|
---|
76 | }
|
---|
77 | return ts.createObjectLiteral(literalProperties, true);
|
---|
78 | }
|
---|
79 | throw new UnexpectedMetadataValueError();
|
---|
80 | }
|
---|
81 | exports.convertDirectiveMetadataToExpression = convertDirectiveMetadataToExpression;
|
---|
82 | /**
|
---|
83 | * Gets a valid property name from the given text. If the text cannot be used
|
---|
84 | * as unquoted identifier, the name will be wrapped in a string literal.
|
---|
85 | */
|
---|
86 | function getPropertyName(name) {
|
---|
87 | // Matches the most common identifiers that do not need quotes. Constructing a
|
---|
88 | // regular expression that matches the ECMAScript specification in order to determine
|
---|
89 | // whether quotes are needed is out of scope for this migration. For those more complex
|
---|
90 | // property names, we just always use quotes (when constructing AST from metadata).
|
---|
91 | if (/^[a-zA-Z_$]+$/.test(name)) {
|
---|
92 | return name;
|
---|
93 | }
|
---|
94 | return ts.createStringLiteral(name);
|
---|
95 | }
|
---|
96 | });
|
---|
97 | //# sourceMappingURL=data:application/json;base64,eyJ2ZXJzaW9uIjozLCJmaWxlIjoiY29udmVydF9kaXJlY3RpdmVfbWV0YWRhdGEuanMiLCJzb3VyY2VSb290IjoiIiwic291cmNlcyI6WyIuLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi8uLi9wYWNrYWdlcy9jb3JlL3NjaGVtYXRpY3MvbWlncmF0aW9ucy91bmRlY29yYXRlZC1jbGFzc2VzLXdpdGgtZGkvZGVjb3JhdG9yX3Jld3JpdGUvY29udmVydF9kaXJlY3RpdmVfbWV0YWRhdGEudHMiXSwibmFtZXMiOltdLCJtYXBwaW5ncyI6IkFBQUE7Ozs7OztHQU1HOzs7Ozs7Ozs7Ozs7O0lBRUgsZ0RBQStDO0lBQy9DLGlDQUFpQztJQUVqQyw4RUFBOEU7SUFDOUUsTUFBYSw0QkFBNkIsU0FBUSxLQUFLO0tBQUc7SUFBMUQsb0VBQTBEO0lBRTFEOzs7T0FHRztJQUNILFNBQWdCLG9DQUFvQyxDQUNoRCxRQUFhLEVBQUUsbUJBQTRELEVBQzNFLFlBQWlFLEVBQ2pFLGVBQW1FO1FBQ3JFLElBQUksT0FBTyxRQUFRLEtBQUssUUFBUSxFQUFFO1lBQ2hDLE9BQU8sRUFBRSxDQUFDLG1CQUFtQixDQUFDLFFBQVEsQ0FBQyxDQUFDO1NBQ3pDO2FBQU0sSUFBSSxL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