setup-kubectl/node_modules/ts-jest/dist/compiler/transpiler.js
github-actions[bot] 7f7e5ba5ea
Add node modules and compiled JavaScript from main (#57)
Co-authored-by: Oliver King <oking3@uncc.edu>
2022-06-21 12:18:30 -04:00

24 lines
1.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
exports.initializeTranspilerInstance = void 0;
exports.initializeTranspilerInstance = function (configs, logger) {
logger.debug('initializeTranspilerInstance(): create typescript compiler');
var options = configs.parsedTsConfig.options;
var ts = configs.compilerModule;
return {
compileFn: function (code, fileName) {
logger.debug({ fileName: fileName }, 'compileFn(): compiling as isolated module');
var result = ts.transpileModule(code, {
fileName: fileName,
transformers: configs.customTransformers,
compilerOptions: options,
reportDiagnostics: configs.shouldReportDiagnostics(fileName),
});
if (result.diagnostics && configs.shouldReportDiagnostics(fileName)) {
configs.raiseDiagnostics(result.diagnostics, fileName, logger);
}
return [result.outputText, result.sourceMapText];
},
program: undefined,
};
};