import { createRequire as $createRequire } from "node:module";

const require = $createRequire(import.meta.url);

import { r as runAsWorker, f as format2, a as resolveConfig } from './vendor-C0JAkCK-.mjs';
import 'node:url';
import 'node:path';
import 'fs';
import 'node:fs';
import 'node:fs/promises';
import 'node:events';
import 'node:stream';
import 'node:string_decoder';
import 'node:worker_threads';
import 'node:crypto';
import 'node:module';
import 'constants';
import 'stream';
import 'util';
import 'assert';
import 'path';
import 'readline';
import 'events';
import 'node:os';
import 'http';
import 'https';
import 'url';
import 'buffer';
import 'crypto';
import 'net';
import 'tls';
import 'tty';
import 'querystring';
import 'module';
import 'fs/promises';
import 'process';
import 'v8';

const configCache = /* @__PURE__ */ new Map();
async function getConfig(filepath) {
  const cached = configCache.get(filepath);
  if (cached !== void 0) {
    return cached;
  }
  const options = await resolveConfig(filepath);
  configCache.set(filepath, options);
  return options;
}
async function formatCode(source, filepath) {
  const options = await getConfig(filepath);
  const formatted = await format2(source, { ...options, filepath });
  return formatted.trim();
}
runAsWorker(formatCode);

export { formatCode };
//# sourceMappingURL=format-code.worker-CXHm5Lxb.mjs.map
