{"id":14984110,"url":"https://github.com/prettier/prettier-synchronized","last_synced_at":"2025-10-10T06:33:27.183Z","repository":{"id":56807677,"uuid":"525775751","full_name":"prettier/prettier-synchronized","owner":"prettier","description":"Synchronous version of Prettier","archived":false,"fork":false,"pushed_at":"2025-06-08T14:39:24.000Z","size":4363,"stargazers_count":28,"open_issues_count":1,"forks_count":7,"subscribers_count":3,"default_branch":"main","last_synced_at":"2025-09-16T06:50:55.870Z","etag":null,"topics":[],"latest_commit_sha":null,"homepage":null,"language":"JavaScript","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/prettier.png","metadata":{"files":{"readme":"readme.md","changelog":null,"contributing":null,"funding":null,"license":"license","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null,"zenodo":null},"funding":{"github":"prettier","open_collective":"prettier","thanks_dev":"u/gh/prettier","tidelift":"npm/prettier"}},"created_at":"2022-08-17T12:13:16.000Z","updated_at":"2025-06-11T14:56:08.000Z","dependencies_parsed_at":"2024-01-16T21:29:18.651Z","dependency_job_id":"3eae5863-29cb-480e-b404-ce106608099e","html_url":"https://github.com/prettier/prettier-synchronized","commit_stats":{"total_commits":46,"total_committers":6,"mean_commits":7.666666666666667,"dds":"0.13043478260869568","last_synced_commit":"527e8cedc9340b69030bd0996862e0d3c346cbda"},"previous_names":[],"tags_count":17,"template":false,"template_full_name":null,"purl":"pkg:github/prettier/prettier-synchronized","repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettier%2Fprettier-synchronized","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettier%2Fprettier-synchronized/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettier%2Fprettier-synchronized/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettier%2Fprettier-synchronized/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/prettier","download_url":"https://codeload.github.com/prettier/prettier-synchronized/tar.gz/refs/heads/main","sbom_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/prettier%2Fprettier-synchronized/sbom","scorecard":null,"host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":279002962,"owners_count":26083489,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","status":"online","status_checked_at":"2025-10-10T02:00:06.843Z","response_time":62,"last_error":null,"robots_txt_status":"success","robots_txt_updated_at":"2025-07-24T06:49:26.215Z","robots_txt_url":"https://github.com/robots.txt","online":true,"can_crawl_api":true,"host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":[],"created_at":"2024-09-24T14:08:27.703Z","updated_at":"2025-10-10T06:33:27.175Z","avatar_url":"https://github.com/prettier.png","language":"JavaScript","funding_links":["https://github.com/sponsors/prettier","https://opencollective.com/prettier","https://thanks.dev/u/gh/prettier","https://tidelift.com/funding/github/npm/prettier"],"categories":[],"sub_categories":[],"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\u003e 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// =\u003e '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// =\u003e 'foo();\\n'\n```\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprettier%2Fprettier-synchronized","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fprettier%2Fprettier-synchronized","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fprettier%2Fprettier-synchronized/lists"}