{"version":3,"file":"format-file.mjs","names":[],"sources":["../../src/utils/format-file.ts"],"sourcesContent":["/* -------------------------------------------------------------------\n\n                       ⚡ Storm Software - Stryke\n\n This code was released as part of the Stryke project. Stryke\n is maintained by Storm Software under the Apache-2.0 license, and is\n free for commercial and private use. For more information, please visit\n our licensing page at https://stormsoftware.com/licenses/projects/stryke.\n\n Website:                  https://stormsoftware.com\n Repository:               https://github.com/storm-software/stryke\n Documentation:            https://docs.stormsoftware.com/projects/stryke\n Contact:                  https://stormsoftware.com/contact\n\n SPDX-License-Identifier:  Apache-2.0\n\n ------------------------------------------------------------------- */\n\nimport prettier from \"prettier\";\n\nexport async function formatFile(content: string): Promise<string> {\n  const options = await prettier.resolveConfig(process.cwd());\n\n  let formatOptions = options;\n  if (!options) {\n    formatOptions = {\n      trailingComma: \"all\",\n      tabWidth: 2,\n      printWidth: 80,\n      bracketSpacing: true,\n      semi: true,\n      singleQuote: true,\n      useTabs: false\n    };\n  }\n\n  const formatted = await prettier.format(content, {\n    ...formatOptions,\n    parser: \"typescript\"\n  });\n\n  return formatted;\n}\n"],"mappings":";;;AAoBA,eAAsB,WAAW,SAAkC;CACjE,MAAM,UAAU,MAAM,SAAS,cAAc,QAAQ,KAAK,CAAC;CAE3D,IAAI,gBAAgB;AACpB,KAAI,CAAC,QACH,iBAAgB;EACd,eAAe;EACf,UAAU;EACV,YAAY;EACZ,gBAAgB;EAChB,MAAM;EACN,aAAa;EACb,SAAS;EACV;AAQH,QAAO,MALiB,SAAS,OAAO,SAAS;EAC/C,GAAG;EACH,QAAQ;EACT,CAAC"}