UNPKG

@typed/test

Version:
19 lines 777 B
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); const typescript_1 = require("typescript"); const diagnosticToString_1 = require("./diagnosticToString"); function transpileFile(contents, options, basePath, moduleName) { const { outputText, diagnostics, sourceMapText = '' } = typescript_1.transpileModule(contents, { compilerOptions: Object.assign(Object.assign({}, options), { sourceMap: true }), moduleName, }); if (diagnostics && diagnostics.length > 0) { throw new Error(diagnosticToString_1.diagnosticsToString(diagnostics, basePath)); } return { content: outputText, sourceMap: sourceMapText, }; } exports.transpileFile = transpileFile; //# sourceMappingURL=transpileFile.js.map