{"name":"@prettier/sync","version":"0.5.5","author":{"url":"https://www.fiskercheung.com/","name":"fisker Cheung","email":"lionkay@gmail.com"},"license":"MIT","_id":"@prettier/sync@0.5.5","maintainers":[{"name":"suchipi","email":"me@suchipi.com"},{"name":"mgrip","email":"necktie_airfoil.0m@icloud.com"},{"name":"czosel","email":"christian@zosel.ch"},{"name":"patrick91","email":"patrick.arminio@gmail.com"},{"name":"zimme","email":"simon@fridlund.email"},{"name":"azz","email":"lucas@azzola.dev"},{"name":"vjeux","email":"vjeuxx@gmail.com"},{"name":"evilebottnawi","email":"sheo13666q@gmail.com"},{"name":"kddeisz","email":"kddnewton+npm@gmail.com"},{"name":"shinigami92","email":"chrissi92@hotmail.de"},{"name":"j-f","email":"git@jedfox.com"},{"name":"lydell","email":"simon.lydell@gmail.com"},{"name":"fisker","email":"lionkay@gmail.com"},{"name":"sosukesuzuki","email":"aosukeke@gmail.com"}],"homepage":"https://github.com/prettier/prettier-synchronized#readme","bugs":{"url":"https://github.com/prettier/prettier-synchronized/issues"},"c8":{"reporter":["lcov","text"]},"dist":{"shasum":"6d02d07a55d25c4aae57a111ba2ae8a5844b9e9e","tarball":"http://registry-npm.ywwl.com/@prettier/sync/download/@prettier/sync-0.5.5.tgz","fileCount":5,"integrity":"sha512-6BMtNr7aQhyNcGzmumkL0tgr1YQGfm9d7ZdmRpWqWuqpc9vZBind4xMe5NMiRECOhjuSiWHfBWLBnXkpeE90bw==","signatures":[{"sig":"MEQCIErnw7bvM8ERSFjCEyR/2dNn1o4SRE404oWeztEqzSzTAiBibdRtpehmZ1qedX+a7UtYyjfZ0/nHALkrWBbP0URm/g==","keyid":"SHA256:DhQ8wR5APBvFHLF/+Tc+AYvPOdTpcIDqOhxsBHRwC7U"}],"unpackedSize":7231,"size":2766,"noattachment":false,"key":"/@prettier/sync/-/@prettier/sync-0.5.5.tgz"},"main":"./index.cjs","type":"module","exports":{".":{"types":"./index.d.cts","default":"./index.cjs"},"./*":"./*"},"funding":"https://github.com/prettier/prettier-synchronized?sponsor=1","gitHead":"85747ae473ad44c53446172f6a300fdb3561e129","scripts":{"fix":"prettier . --write","dist":"release-it","lint":"prettier . --check","test":"node --test","release":"run-s lint test dist","test-coverage":"c8 node --test"},"_npmUser":{"name":"fisker","email":"lionkay@gmail.com"},"repository":{"url":"git+https://github.com/prettier/prettier-synchronized.git","type":"git"},"_npmVersion":"9.1.2","description":"Synchronous version of Prettier","directories":{},"sideEffects":false,"_nodeVersion":"22.14.0","dependencies":{"make-synchronized":"^0.4.2"},"publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"packageManager":"yarn@4.7.0","devDependencies":{"c8":"10.1.3","prettier":"3.5.3","release-it":"18.1.2","@types/node":"22.13.13","npm-run-all":"4.1.5"},"peerDependencies":{"prettier":"*"},"_npmOperationalInternal":{"tmp":"tmp/sync_0.5.5_1742837673165_0.4270877353412865","host":"s3://npm-registry-packages-npm-production"},"readme":"# @prettier/sync\n\n[![Build Status][github_actions_badge]][github_actions_link]\n[![Coverage][codecov_badge]][codecov_link]\n[![Npm Version][package_version_badge]][package_link]\n[![MIT License][license_badge]][license_link]\n\n[github_actions_badge]: https://img.shields.io/github/actions/workflow/status/prettier/prettier-synchronized/continuous-integration.yml?style=flat-square\n[github_actions_link]: https://github.com/prettier/prettier-synchronized/actions?query=branch%3Amain\n[codecov_badge]: https://img.shields.io/codecov/c/github/prettier/prettier-synchronized?style=flat-square\n[codecov_link]: https://codecov.io/gh/prettier/prettier-synchronized\n[license_badge]: https://img.shields.io/npm/l/@prettier/sync.svg?style=flat-square\n[license_link]: https://github.com/prettier/prettier-synchronized/blob/main/license\n[package_version_badge]: https://img.shields.io/npm/v/@prettier/sync.svg?style=flat-square\n[package_link]: https://www.npmjs.com/package/@prettier/sync\n\n> Synchronous version of Prettier\n\n## Installation\n\n```sh\nyarn add prettier @prettier/sync\n```\n\n## Usage\n\n```js\nimport synchronizedPrettier from \"@prettier/sync\";\n\nsynchronizedPrettier.format(\"foo( )\", { parser: \"babel\" });\n// => 'foo();\\n'\n```\n\nThis package is a simple wrapper of [`make-synchronized`](https://github.com/fisker/make-synchronized).\n\nFor more complex use cases, it's better to use [`make-synchronized`](https://github.com/fisker/make-synchronized) directly:\n\nExample 1:\n\n```js\n// utilities.js\nimport * as fs from \"node:fs/promises\";\nimport * as prettier from \"prettier\";\n\nexport async function formatFile(file) {\n  const config = await prettier.resolveConfig(file);\n  const content = await fs.readFile(file, \"utf8\");\n  const formatted = await prettier.format(content, {\n    ...config,\n    filepath: file,\n  });\n  await fs.writeFile(file, formatted);\n}\n\n// index.js\nimport makeSynchronized from \"make-synchronized\";\n\nconst utilities = makeSynchronized(new URL(\"./utilities.js\", import.meta.url));\n\nutilities.formatFile(\"/path/to/file.js\");\n```\n\nExample 2:\n\n```js\nimport * as fs from \"node:fs/promises\";\nimport * as prettier from \"prettier\";\nimport makeSynchronized from \"make-synchronized\";\n\nexport default makeSynchronized(import.meta, async function formatFile(file) {\n  const config = await prettier.resolveConfig(file);\n  const content = await fs.readFile(file, \"utf8\");\n  const formatted = await prettier.format(content, {\n    ...config,\n    filepath: file,\n  });\n  await fs.writeFile(file, formatted);\n});\n```\n\nAlternatively you can also use [`synckit`](https://github.com/un-ts/synckit) or [`make-synchronous`](https://github.com/sindresorhus/make-synchronous).\n\n### `createSynchronizedPrettier(options)`\n\n#### `options`\n\nType: `object`\n\n##### `prettierEntry`\n\nType: `string | URL`\n\nPath or URL to prettier entry.\n\n```js\nimport { createSynchronizedPrettier } from \"@prettier/sync\";\n\nconst synchronizedPrettier = createSynchronizedPrettier({\n  prettierEntry: \"/path/to/prettier/index.js\",\n});\n\nsynchronizedPrettier.format(\"foo( )\", { parser: \"babel\" });\n// => 'foo();\\n'\n```\n","publish_time":1742837673353,"_cnpm_publish_time":1742837673353,"dist-tags":{"latest":"0.6.1"}}