github-pages-deploy-action/node_modules/ts-jest/dist/compiler/transpile-module.js
2020-03-31 08:42:07 -04:00

22 lines
1.1 KiB
JavaScript

"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
var path_1 = require("path");
exports.compileUsingTranspileModule = function (configs, logger) {
logger.debug('compileUsingTranspileModule(): create typescript compiler');
return {
compileFn: function (code, fileName) {
logger.debug({ fileName: fileName }, 'getOutput(): compiling as isolated module');
var normalizedFileName = path_1.normalize(fileName), result = configs.compilerModule.transpileModule(code, {
fileName: normalizedFileName,
transformers: configs.tsCustomTransformers,
compilerOptions: configs.typescript.options,
reportDiagnostics: configs.shouldReportDiagnostic(normalizedFileName),
});
if (result.diagnostics && configs.shouldReportDiagnostic(normalizedFileName)) {
configs.raiseDiagnostics(result.diagnostics, normalizedFileName, logger);
}
return [result.outputText, result.sourceMapText];
},
};
};