Files
oxc-project__oxc/apps/oxfmt/src-js/cli-worker.ts
leaysgur ca68ea6192 feat(oxfmt): Support gql-in-js substitution (#19670)
Part of #15180

gql-in-js is the simplest among other xxx-in-js cases.

It works by:

- splitting the template with `${}`, converting each part into an IR using:
  - `prettier({ parser:"graphql" })` and `oxc_formatter` respectively
- and then interleaving them

However, for this to work, two things are essential:

- Obtaining a formatted `Doc` from Prettier, rather than just a formatted `string`.
- Converting the `Doc` JSON into `oxc_formatter`'s IR.

The diffs primarily arise from the implementation of these two.

### TODOs

- [x] Implement by Claude
- [x] Self review and fix up
- [x] Check bench, ecosystem
2026-02-26 15:24:01 +00:00

10 lines
212 B
TypeScript

// `oxfmt` CLI - Worker Thread Entry Point
// Re-exports core functions for use in `worker_threads`
export {
formatEmbeddedCode,
formatEmbeddedDoc,
formatFile,
sortTailwindClasses,
} from "./libs/apis";