{"version":3,"file":"toml.mjs","names":[],"sources":["../src/toml.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 TOML from \"smol-toml\";\nimport { readFile, readFileSync } from \"./read-file\";\nimport { writeFile, writeFileSync } from \"./write-file\";\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param options - TOML parse options\n * @returns Object the TOML content of the file represents\n */\nexport function readTomlFileSync(\n  path: string,\n  options?: Parameters<typeof TOML.parse>[1]\n) {\n  const content = readFileSync(path);\n\n  return TOML.parse(content, options);\n}\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param options - TOML parse options\n * @returns Object the TOML content of the file represents\n */\nexport async function readTomlFile(\n  path: string,\n  options?: Parameters<typeof TOML.parse>[1]\n) {\n  const content = await readFile(path);\n\n  return TOML.parse(content, options);\n}\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized/formatted to TOML and written to the file\n * @param options - TOML parse options\n */\nexport function writeTomlFileSync(\n  path: string,\n  data: object,\n  options?: Parameters<typeof TOML.stringify>[1]\n): void {\n  return writeFileSync(path, TOML.stringify(data, options));\n}\n\n/**\n * Reads a TOML file and returns the object the TOML content represents.\n *\n * @param path - A path to a file.\n * @param data - data which should be serialized/formatted to TOML and written to the file\n * @param options - TOML parse options\n */\nexport async function writeTomlFile(\n  path: string,\n  data: object,\n  options?: Parameters<typeof TOML.stringify>[1]\n): Promise<void> {\n  return writeFile(path, TOML.stringify(data, options));\n}\n"],"mappings":";;;;;;;;;;;;AA6BA,SAAgB,iBACd,MACA,SACA;CACA,MAAM,UAAU,aAAa,KAAK;AAElC,QAAO,KAAK,MAAM,SAAS,QAAQ;;;;;;;;;AAUrC,eAAsB,aACpB,MACA,SACA;CACA,MAAM,UAAU,MAAM,SAAS,KAAK;AAEpC,QAAO,KAAK,MAAM,SAAS,QAAQ;;;;;;;;;AAUrC,SAAgB,kBACd,MACA,MACA,SACM;AACN,QAAO,cAAc,MAAM,KAAK,UAAU,MAAM,QAAQ,CAAC;;;;;;;;;AAU3D,eAAsB,cACpB,MACA,MACA,SACe;AACf,QAAO,UAAU,MAAM,KAAK,UAAU,MAAM,QAAQ,CAAC"}