@lesnoypudge/builder
Version:
lesnoypudge-builder
37 lines (36 loc) • 762 B
JavaScript
import ts from "typescript";
const processTSFiles = ({
compilerOptions,
filePathsToProcess,
beforeTransformers,
afterTransformers
}) => {
const jsFilePathToDataMap = /* @__PURE__ */ new Map();
const program = ts.createProgram(
filePathsToProcess,
compilerOptions
);
const emitResult = program.emit(
void 0,
(fileName, text, mark) => {
jsFilePathToDataMap.set(fileName, text);
ts.sys.writeFile(fileName, text, mark);
},
void 0,
false,
{
before: beforeTransformers,
after: afterTransformers
}
);
if (emitResult.emitSkipped) {
throw new Error("Failed to emit");
}
return {
jsFilePathToDataMap
};
};
export {
processTSFiles
};
//# sourceMappingURL=processTSFiles.js.map