1 | "use strict";
|
2 | Object.defineProperty(exports, "__esModule", { value: true });
|
3 | exports.TsConfigProvider = void 0;
|
4 | const fs_1 = require("fs");
|
5 | const path_1 = require("path");
|
6 | const ui_1 = require("../../ui");
|
7 | class 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 | }
|
22 | exports.TsConfigProvider = TsConfigProvider;
|