Something went wrong. Try again.
A collaborative coding-agent orchestrator for atproto radl.app
Something went wrong. Try again.
JavaScript
123456789101112131415161718192021222324252627282930import { transform } from 'esbuild'import { mkdir, readFile, writeFile } from 'node:fs/promises'import { dirname, resolve } from 'node:path'import { fileURLToPath } from 'node:url'
const here = dirname(fileURLToPath(import.meta.url))const outputRoot = resolve(here, '../dist')
async function compile(input, output, rewriteTestImports = false) { await mkdir(dirname(output), { recursive: true }) const source = await readFile(input, 'utf8') const { code } = await transform(source, { loader: 'ts', format: 'esm', target: 'es2023', sourcemap: 'inline', sourcefile: input, }) let javascript = code // esbuild normalizes string literals to double quotes, so match either style. if (rewriteTestImports) javascript = javascript.replaceAll(/(['"])\.\.\/src\//g, '$1../') await writeFile(output, javascript)}
await compile( resolve(here, '../test/scenario.ts'), resolve(outputRoot, 'test/scenario.js'), true,)