mirror of
https://github.com/stashapp/stash.git
synced 2025-12-18 04:44:37 +03:00
23 lines
600 B
JavaScript
23 lines
600 B
JavaScript
const tsc = require('typescript');
|
|
const tsConfig = require('./../tsconfig.json');
|
|
|
|
module.exports = {
|
|
process(src, path) {
|
|
const isTs = path.endsWith('.ts');
|
|
const isTsx = path.endsWith('.tsx');
|
|
const isTypescriptFile = (isTs || isTsx);
|
|
|
|
if ( isTypescriptFile ) {
|
|
return tsc.transpileModule(
|
|
src,
|
|
{
|
|
compilerOptions: tsConfig.compilerOptions,
|
|
fileName: path
|
|
}
|
|
).outputText;
|
|
}
|
|
|
|
return src;
|
|
},
|
|
};
|