1 | import { tsModule } from "./tsproxy";
|
2 | import * as tsTypes from "typescript";
|
3 | import { IOptions } from "./ioptions";
|
4 | import * as _ from "lodash";
|
5 |
|
6 | export function getOptionsOverrides({ useTsconfigDeclarationDir, cacheRoot }: IOptions, tsConfigJson?: any): tsTypes.CompilerOptions
|
7 | {
|
8 | const overrides = {
|
9 | noEmitHelpers: false,
|
10 | importHelpers: true,
|
11 | noResolve: false,
|
12 | noEmit: false,
|
13 | inlineSourceMap: false,
|
14 | outDir: `${cacheRoot}/placeholder`,
|
15 | moduleResolution: tsModule.ModuleResolutionKind.NodeJs,
|
16 | };
|
17 |
|
18 | const declaration = _.get(tsConfigJson, "compilerOptions.declaration", false);
|
19 |
|
20 | if (!declaration)
|
21 | (overrides as any).declarationDir = null;
|
22 | if (declaration && !useTsconfigDeclarationDir)
|
23 | (overrides as any).declarationDir = process.cwd();
|
24 |
|
25 |
|
26 | const sourceMap = _.get(tsConfigJson, "compilerOptions.sourceMap", false);
|
27 | if (!sourceMap)
|
28 | (overrides as any).sourceRoot = null;
|
29 |
|
30 | return overrides;
|
31 | }
|