1 | "use strict";
|
2 | var __importDefault = (this && this.__importDefault) || function (mod) {
|
3 | return (mod && mod.__esModule) ? mod : { "default": mod };
|
4 | };
|
5 | Object.defineProperty(exports, "__esModule", { value: true });
|
6 | const path_1 = __importDefault(require("path"));
|
7 | class CompilerOutRootFiles {
|
8 | constructor() {
|
9 | this.files = [];
|
10 | }
|
11 | update(rootNames, inDir, outDir) {
|
12 | let isOutputChanged = false;
|
13 | if (!rootNames || !rootNames.length) {
|
14 | if (this.files.length) {
|
15 | isOutputChanged = true;
|
16 | }
|
17 | this.files = [];
|
18 | }
|
19 | else {
|
20 |
|
21 | this.files.forEach((v, i) => {
|
22 | if (!rootNames.includes(v.rootName)) {
|
23 | isOutputChanged = true;
|
24 | this.files.splice(i, 1);
|
25 | }
|
26 | });
|
27 |
|
28 | rootNames.forEach(rootName => {
|
29 | const ePath = rootName.replace(/(.ts)$/, ".js");
|
30 | const outPath = path_1.default.join(outDir, path_1.default.relative(inDir || process.cwd(), ePath));
|
31 | if (!this.files.find(f => f.path === outPath)) {
|
32 | this.files.push({ path: outPath, rootName });
|
33 | }
|
34 | });
|
35 | }
|
36 | return isOutputChanged;
|
37 | }
|
38 | }
|
39 | exports.CompilerOutRootFiles = CompilerOutRootFiles;
|