| 6 | import { markInRegisterWorker } from "./is-in-register-worker.ts"; |
| 7 | |
| 8 | class Client implements IClient { |
| 9 | #send; |
| 10 | |
| 11 | constructor(send: (action: ACTIONS, payload: any) => any) { |
| 12 | this.#send = send; |
| 13 | } |
| 14 | |
| 15 | #eCache: string[] | undefined; |
| 16 | getDefaultExtensions(): string[] { |
| 17 | return (this.#eCache ??= this.#send( |
| 18 | ACTIONS.GET_DEFAULT_EXTENSIONS, |
| 19 | undefined, |
| 20 | )); |
| 21 | } |
| 22 | |
| 23 | setOptions(options: Options): void { |
| 24 | return this.#send(ACTIONS.SET_OPTIONS, options); |
| 25 | } |
| 26 | |
| 27 | transform( |
| 28 | code: string, |
| 29 | filename: string, |
| 30 | ): { code: string; map: object } | null { |
| 31 | return this.#send(ACTIONS.TRANSFORM, { code, filename }); |
| 32 | } |
| 33 | |
| 34 | isFileIgnored(filename: string): boolean { |
| 35 | return this.#send(ACTIONS.IS_FILE_IGNORED, filename); |
| 36 | } |
| 37 | |
| 38 | close() { |
| 39 | this.#send(ACTIONS.CLOSE, undefined); |
| 40 | } |
| 41 | } |
| 42 | |
| 43 | // We need to run Babel in a worker because require hooks must |
| 44 | // run synchronously, but many steps of Babel's config loading |
nothing calls this directly
no outgoing calls
no test coverage detected
searching dependent graphs…