UNPKG

548 BJavaScriptView Raw
1"use strict";
2Object.defineProperty(exports, "__esModule", { value: true });
3var fs_extra_1 = require("fs-extra");
4var path_1 = require("path");
5var appRootDir = require("app-root-dir");
6var typescript_1 = require("typescript");
7function process(source, path) {
8 var tsConfig = fs_extra_1.readJSONSync(path_1.join(appRootDir.get(), 'tsconfig.json'));
9 if (path.endsWith('.ts') || path.endsWith('.tsx')) {
10 return typescript_1.transpile(source, tsConfig.compilerOptions, path, []);
11 }
12 return source;
13}
14exports.process = process;