{"name":"@prettier/sync","version":"0.0.4","author":{"url":"https://www.fiskercheung.com/","name":"fisker Cheung","email":"lionkay@gmail.com"},"license":"MIT","_id":"@prettier/sync@0.0.4","maintainers":[{"name":"fisker","email":"lionkay@gmail.com"},{"name":"suchipi","email":"me@suchipi.com"},{"name":"mgrip","email":"mike.grip@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"}],"homepage":"https://github.com/prettier/prettier-synchronized#readme","bugs":{"url":"https://github.com/prettier/prettier-synchronized/issues"},"c8":{"reporter":["lcov","text"]},"dist":{"shasum":"ed3abb4b924efdaa0d7dd4d16c932b7eb9733962","tarball":"http://registry-npm.ywwl.com/@prettier/sync/download/@prettier/sync-0.0.4.tgz","fileCount":5,"integrity":"sha512-nRjnHRQNii89EtLqGYYUON3ghKCmfgM8/4QEZx+xsC2wqQLxHv4S2C5AskWxrNghFYFStE6G6nDFr+naCKHOZw==","signatures":[{"sig":"MEQCIDGFl0uUe98glGiRR0erVGIRuuiL/iTFPJVWFjHDgNYmAiB7U397LpGx/6yy1rEgtTHMtOKBP7Ui2WucH8e9cS3RZQ==","keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA"}],"unpackedSize":5819,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v4.10.10\r\nComment: https://openpgpjs.org\r\n\r\nwsFzBAEBCAAGBQJjBIqfACEJED1NWxICdlZqFiEECWMYAoorWMhJKdjhPU1b\r\nEgJ2VmpILRAAjEH8osuRWc2vSqH8WPBUoMkNZjphhC1E0ZBXM/QJO/Ld6D67\r\n2rF94m+ivgK/s6BoLvmUZdrXac+goeDgD3GMf5/1gfNzzIR5kxQDg/7zSRCL\r\nPdCYIxkuULzPIOdqLypCc5Gr7AOOQ9Jn17eVdVsiZJ+GrD+JtcXtRlDfU5j7\r\n+crdEhwQJSIYxV43FqKWxkSpiwafWV/m2w0CxE2HgmORoy9bo6mhsz1Z1CI8\r\niM+arqi6SXLOIVvhn0ZwBvqrmj2D+yhMpTAP3dfthsbt19loqlpjqdflpLtY\r\n66pSkdlQ4yHoerQGcimyeQrl+4coDUy/kdBSVHtDj2CuX3IS9HqLbY0j+/WB\r\njE/BU0JQcJ/4VHixn/fSRqcuMW17+D/HXi/6veVdOVjw9syRHTcgcaZWCjkp\r\nVrd4tfSeuUdx1AfS/MCuHL9s+OZeVdIAUFfL0bXFHvCvdxnj6Eh3A3VZyLV6\r\nlP7vFQg3JXkpk0OGuVOb3YtIQc/ErlsSZ/vxMSNUQqQIx7XISFdvn17qr4C1\r\n84YKTPbTv6UlE9Ts4fvUFYL5aLbYWr6z+XzR4061ZN/NsSl87uuk1W6qCHyW\r\nYjteb7NLD4HeiY1WWor9pd+oF/Jy1UkxjMeBVdjtLVcJABmpDKrN8OOWQGhR\r\nLcO34oNT1ruVFW3Cm7n3bTafnFP7Iv5CYXI=\r\n=QQN6\r\n-----END PGP SIGNATURE-----\r\n","size":2626,"noattachment":false,"key":"/@prettier/sync/-/@prettier/sync-0.0.4.tgz"},"type":"module","exports":"./index.cjs","funding":"https://github.com/prettier/prettier-synchronized?sponsor=1","gitHead":"3dccca58bd337f6c77d324d0518df60402ec7ad5","scripts":{"dist":"np --yolo --no-yarn","lint":"prettier . --check","test":"node --test","format":"prettier . --write","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":"7.9.0","description":"Synchronous version of Prettier","directories":{},"sideEffects":false,"_nodeVersion":"18.7.0","publishConfig":{"access":"public","registry":"https://registry.npmjs.org/"},"_hasShrinkwrap":false,"packageManager":"yarn@3.2.2","devDependencies":{"c8":"7.12.0","prettier":"3.0.0-alpha.0","npm-run-all":"4.1.5"},"_npmOperationalInternal":{"tmp":"tmp/sync_0.0.4_1661242015121_0.6773870323419557","host":"s3://npm-registry-packages"},"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":1661242015279,"_cnpm_publish_time":1661242015279,"dist-tags":{"latest":"0.6.1"}}