UNPKG

@trapi/metadata

Version:

Generate REST-API metadata scheme from TypeScript Decorators.

41 lines 1.27 kB
"use strict"; /* * Copyright (c) 2021-2022. * Author Peter Placzek (tada5hi) * For the full copyright and license information, * view the LICENSE file that was distributed with this source code. */ Object.defineProperty(exports, "__esModule", { value: true }); exports.generateMetadata = void 0; const generator_1 = require("./generator"); const utils_1 = require("./utils"); async function generateMetadata(input, tsconfig) { let compilerOptions; if (tsconfig) { if (typeof tsconfig === 'string') { tsconfig = await (0, utils_1.softLoadTsconfig)({ name: tsconfig }); compilerOptions = tsconfig.compilerOptions; } else { compilerOptions = tsconfig.compilerOptions || {}; } } let options; if (typeof input === 'string' || Array.isArray(input)) { options = { entryPoint: input, }; } else { options = input; } const sourceFiles = await (0, utils_1.scanSourceFiles)(options.entryPoint); const generator = new generator_1.MetadataGenerator({ sourceFiles, compilerOptions, options, }); return generator.generate(); } exports.generateMetadata = generateMetadata; //# sourceMappingURL=module.js.map