import { transform } from 'esbuild'; import { node } from './buildConstants.js'; /** * @param {string} source * @param {import('@jest/types').Config.Path} filePath * @return {Promise} */ async function processAsync(source, filePath) { const { code, map } = await transform(source, { loader: filePath.endsWith('tsx') ? 'tsx' : 'ts', sourcefile: filePath, format: 'esm', target: node, sourcemap: true, }); return { code, map, }; } /** @type {import('@jest/transform').AsyncTransformer} */ export default { canInstrument: false, processAsync, };