UNPKG

nestjs-auto-reflect-metadata-emitter

Version:

[![Actions Status](https://github.com/Codibre/nestjs-auto-reflect-metadata-emitter/workflows/build/badge.svg)](https://github.com/Codibre/nestjs-auto-reflect-metadata-emitter/actions) [![Actions Status](https://github.com/Codibre/nestjs-auto-reflect-metad

45 lines 1.75 kB
"use strict"; var __importDefault = (this && this.__importDefault) || function (mod) { return (mod && mod.__esModule) ? mod : { "default": mod }; }; Object.defineProperty(exports, "__esModule", { value: true }); exports.matcher = exports.tsConfig = exports.tsConfigProvider = exports.tsBinary = exports.tsLoader = void 0; exports.getModuleRealPath = getModuleRealPath; const tsconfig_provider_1 = require("./tsconfig-provider"); const typescript_loader_1 = require("./typescript-loader"); const tsPaths = require("tsconfig-paths"); const os_1 = __importDefault(require("os")); const path_1 = require("path"); exports.tsLoader = new typescript_loader_1.TypeScriptBinaryLoader(); exports.tsBinary = exports.tsLoader.load(); exports.tsConfigProvider = new tsconfig_provider_1.TsConfigProvider(exports.tsLoader); exports.tsConfig = exports.tsConfigProvider.getByConfigFilename('tsconfig.json'); const { paths = {}, baseUrl = './' } = exports.tsConfig.options; exports.matcher = tsPaths.createMatchPath(baseUrl, paths, ['main']); function getModuleRealPath(text) { let result = (0, exports.matcher)(text, undefined, undefined, [ '.ts', '.tsx', '.js', '.jsx', ]); if (!result) { return; } if (os_1.default.platform() === 'win32') { result = result.replace(/\\/g, '/'); } try { const packagePath = require.resolve(text, { paths: [process.cwd(), ...module.paths], }); if (packagePath) { return text; } } catch { } const resolvedPath = path_1.posix.relative(process.cwd(), result) || './'; return resolvedPath[0] === '.' ? resolvedPath : './' + resolvedPath; } //# sourceMappingURL=ts-loader.js.map