UNPKG

922 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3exports.TsConfigProvider = void 0;
4const fs_1 = require("fs");
5const path_1 = require("path");
6const ui_1 = require("../../ui");
7class TsConfigProvider {
8 constructor(typescriptLoader) {
9 this.typescriptLoader = typescriptLoader;
10 }
11 getByConfigFilename(configFilename) {
12 const configPath = (0, path_1.join)(process.cwd(), configFilename);
13 if (!(0, fs_1.existsSync)(configPath)) {
14 throw new Error(ui_1.CLI_ERRORS.MISSING_TYPESCRIPT(configFilename));
15 }
16 const tsBinary = this.typescriptLoader.load();
17 const parsedCmd = tsBinary.getParsedCommandLineOfConfigFile(configPath, undefined, tsBinary.sys);
18 const { options, fileNames, projectReferences } = parsedCmd;
19 return { options, fileNames, projectReferences };
20 }
21}
22exports.TsConfigProvider = TsConfigProvider;