{"_id":"@dprint/formatter","_rev":"4664662","name":"@dprint/formatter","description":"Wasm formatter for dprint plugins.","dist-tags":{"latest":"0.5.1"},"maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"time":{"modified":"2026-04-10T22:32:00.000Z","created":"2021-06-13T21:39:57.186Z","0.5.1":"2026-01-06T00:51:00.621Z","0.4.1":"2024-06-30T22:29:03.269Z","0.4.0":"2024-06-30T22:07:32.899Z","0.3.0":"2024-05-04T20:37:23.925Z","0.2.1":"2023-12-26T03:27:23.826Z","0.2.0":"2022-01-08T18:33:11.226Z","0.1.5":"2021-10-19T14:20:13.706Z","0.1.4":"2021-06-13T21:53:46.469Z","0.1.3":"2021-06-13T21:42:07.654Z","0.1.2":"2021-06-13T21:39:57.186Z"},"users":{},"author":{"name":"David Sherret"},"repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"versions":{"0.5.1":{"name":"@dprint/formatter","version":"0.5.1","description":"Wasm formatter for dprint plugins.","keywords":["dprint","formatter","wasm"],"author":{"name":"David Sherret"},"homepage":"https://github.com/dprint/js-formatter#readme","repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"license":"MIT","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"main":"./script/mod.js","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"devDependencies":{"@types/node":"^25","picocolors":"^1.0.0","@dprint/json":"^0.21.1","@dprint/markdown":"^0.20.0","@dprint/typescript":"^0.95.13","@deno/shim-deno-test":"~0.5.0","undici":"^4.12.1"},"gitHead":"7f9052414d1f2ef13eccb59bbaebb47eb404f2ff","types":"./script/mod.d.ts","_id":"@dprint/formatter@0.5.1","_nodeVersion":"24.12.0","_npmVersion":"11.6.2","dist":{"shasum":"1f776471d0af07c3c42595cab3d70ba78aaee6b3","size":15845,"noattachment":false,"key":"/@dprint/formatter/-/@dprint/formatter-0.5.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@dprint/formatter/download/@dprint/formatter-0.5.1.tgz"},"_npmUser":{"name":"GitHub Actions","email":"npm-oidc-no-reply@github.com","trustedPublisher":{"id":"github","oidcConfigId":"oidc:439403a8-7dc1-4219-9632-6f91647d68d3"}},"directories":{},"maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages-npm-production","tmp":"tmp/formatter_0.5.1_1767660660475_0.9519218293136535"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2026-01-06T00:51:00.621Z","publish_time":1767660660621,"_source_registry_name":"default","_cnpm_publish_time":1767660660621},"0.4.1":{"name":"@dprint/formatter","version":"0.4.1","description":"Wasm formatter for dprint plugins.","keywords":["dprint","formatter","wasm"],"author":{"name":"David Sherret"},"homepage":"https://github.com/dprint/js-formatter#readme","repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"license":"MIT","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"main":"./script/mod.js","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"devDependencies":{"@types/node":"^20.9.0","picocolors":"^1.0.0","@deno/shim-deno-test":"~0.5.0","undici":"^4.12.1"},"_id":"@dprint/formatter@0.4.1","gitHead":"aa1332003aacbc89e45cfe02056e278e2b47d8c6","types":"./script/mod.d.ts","_nodeVersion":"20.15.0","_npmVersion":"10.7.0","dist":{"shasum":"06a0f78403464dbda1a5cad07f9a272478cfdb4e","size":13818,"noattachment":false,"key":"/@dprint/formatter/-/@dprint/formatter-0.4.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@dprint/formatter/download/@dprint/formatter-0.4.1.tgz"},"_npmUser":{"name":"dsherret","email":"dsherret@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/formatter_0.4.1_1719786543048_0.47999091369324187"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-06-30T22:29:03.269Z","publish_time":1719786543269,"_source_registry_name":"default","maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_cnpm_publish_time":1719786543269},"0.4.0":{"name":"@dprint/formatter","version":"0.4.0","description":"Wasm formatter for dprint plugins.","keywords":["dprint","formatter","wasm"],"author":{"name":"David Sherret"},"homepage":"https://github.com/dprint/js-formatter#readme","repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"license":"MIT","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"main":"./script/mod.js","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"devDependencies":{"@types/node":"^20.9.0","picocolors":"^1.0.0","@deno/shim-deno-test":"~0.5.0","undici":"^4.12.1"},"_id":"@dprint/formatter@0.4.0","gitHead":"627d2d7620156d1f1a7556131ba9ff91ff43c11d","types":"./script/mod.d.ts","_nodeVersion":"20.15.0","_npmVersion":"10.7.0","dist":{"shasum":"6bcc62e2cd18739ae82e2767921461d52d6ccf1b","size":13824,"noattachment":false,"key":"/@dprint/formatter/-/@dprint/formatter-0.4.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@dprint/formatter/download/@dprint/formatter-0.4.0.tgz"},"_npmUser":{"name":"dsherret","email":"dsherret@gmail.com"},"directories":{},"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/formatter_0.4.0_1719785252728_0.8317046457183142"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-06-30T22:07:32.899Z","publish_time":1719785252899,"_source_registry_name":"default","maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_cnpm_publish_time":1719785252899},"0.3.0":{"name":"@dprint/formatter","version":"0.3.0","description":"Wasm formatter for dprint plugins.","keywords":["dprint","formatter","wasm"],"author":{"name":"David Sherret"},"homepage":"https://github.com/dprint/js-formatter#readme","repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"license":"MIT","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"main":"./script/mod.js","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"devDependencies":{"@types/node":"^20.9.0","picocolors":"^1.0.0","@deno/shim-deno-test":"~0.5.0","undici":"^4.12.1"},"_id":"@dprint/formatter@0.3.0","gitHead":"f274692c30a49f650364fac4b14ddb175e1b0697","types":"./script/mod.d.ts","_nodeVersion":"20.12.2","_npmVersion":"10.5.0","dist":{"shasum":"e374398c8e8d7dbf50e8208c87af44a66de0cb2e","size":5220,"noattachment":false,"key":"/@dprint/formatter/-/@dprint/formatter-0.3.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@dprint/formatter/download/@dprint/formatter-0.3.0.tgz"},"_npmUser":{"name":"dsherret","email":"dsherret@gmail.com"},"directories":{},"maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/formatter_0.3.0_1714855043730_0.6027934492033866"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2024-05-04T20:37:23.925Z","publish_time":1714855043925,"_source_registry_name":"default","_cnpm_publish_time":1714855043925},"0.2.1":{"name":"@dprint/formatter","version":"0.2.1","description":"Wasm formatter for dprint plugins.","keywords":["dprint","formatter","wasm"],"author":{"name":"David Sherret"},"homepage":"https://github.com/dprint/js-formatter#readme","repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"license":"MIT","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"main":"./script/mod.js","module":"./esm/mod.js","exports":{".":{"import":"./esm/mod.js","require":"./script/mod.js"}},"scripts":{"test":"node test_runner.js"},"devDependencies":{"@types/node":"^20.9.0","picocolors":"^1.0.0","@deno/shim-deno-test":"~0.5.0","undici":"^4.12.1"},"_id":"@dprint/formatter@0.2.1","gitHead":"ee37a981f63600fe41ac444034f25c71d75ad996","types":"./script/mod.d.ts","_nodeVersion":"18.19.0","_npmVersion":"10.2.3","dist":{"shasum":"36345ed2e7ed15da9ba3a7c575f5864fffcd9794","size":4747,"noattachment":false,"key":"/@dprint/formatter/-/@dprint/formatter-0.2.1.tgz","tarball":"http://registry.cnpm.dingdandao.com/@dprint/formatter/download/@dprint/formatter-0.2.1.tgz"},"_npmUser":{"name":"dsherret","email":"dsherret@gmail.com"},"directories":{},"maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/formatter_0.2.1_1703561243677_0.32512279866839444"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2023-12-26T03:27:23.826Z","publish_time":1703561243826,"_source_registry_name":"default","_cnpm_publish_time":1703561243826},"0.2.0":{"module":"./esm/mod.js","main":"./umd/mod.js","types":"./types/mod.d.ts","name":"@dprint/formatter","version":"0.2.0","description":"Wasm formatter for dprint plugins.","repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"keywords":["dprint","formatter","wasm"],"author":{"name":"David Sherret"},"license":"MIT","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"homepage":"https://github.com/dprint/js-formatter#readme","exports":{".":{"import":"./esm/mod.js","require":"./umd/mod.js","types":"./types/mod.d.ts"}},"scripts":{"test":"node test_runner.js"},"dependencies":{},"devDependencies":{"@types/node":"16.11.1","chalk":"4.1.2","@deno/shim-deno-test":"~0.2.0","undici":"^4.12.1"},"gitHead":"29ad3fe918d72a84bebd4a8c8c393d2b292792de","_id":"@dprint/formatter@0.2.0","_nodeVersion":"16.13.1","_npmVersion":"8.1.2","dist":{"shasum":"5eb044e0969ef5b918b26db42eb9d75e7c6661ee","size":5053,"noattachment":false,"key":"/@dprint/formatter/-/@dprint/formatter-0.2.0.tgz","tarball":"http://registry.cnpm.dingdandao.com/@dprint/formatter/download/@dprint/formatter-0.2.0.tgz"},"_npmUser":{"name":"dsherret","email":"dsherret@gmail.com"},"directories":{},"maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/formatter_0.2.0_1641666791083_0.4448332828607642"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2022-01-08T18:33:18.090Z","publish_time":1641666791226,"_cnpm_publish_time":1641666791226},"0.1.5":{"name":"@dprint/formatter","version":"0.1.5","description":"Wasm formatter for dprint plugins.","repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"keywords":["dprint","formatter","wasm"],"author":{"name":"David Sherret"},"license":"MIT","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"homepage":"https://github.com/dprint/js-formatter#readme","module":"./esm/mod.js","main":"./cjs/mod.js","types":"./types/mod.d.ts","exports":{".":{"import":"./esm/mod.js","require":"./cjs/mod.js","types":"./types/mod.d.ts"}},"dependencies":{},"_id":"@dprint/formatter@0.1.5","_nodeVersion":"14.18.0","_npmVersion":"6.14.15","dist":{"shasum":"ea2119f4dd231b5ffe96636df3eb9b993cc6586b","size":4307,"noattachment":false,"key":"/@dprint/formatter/-/@dprint/formatter-0.1.5.tgz","tarball":"http://registry.cnpm.dingdandao.com/@dprint/formatter/download/@dprint/formatter-0.1.5.tgz"},"_npmUser":{"name":"dsherret","email":"dsherret@gmail.com"},"directories":{},"maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/formatter_0.1.5_1634653213492_0.2775745331543358"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T16:28:27.424Z","publish_time":1634653213706,"_cnpm_publish_time":1634653213706},"0.1.4":{"name":"@dprint/formatter","version":"0.1.4","description":"Wasm formatter for dprint plugins.","main":"mod.js","types":"mod.d.ts","repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"keywords":["dprint","formatter","wasm"],"author":{"name":"David Sherret"},"license":"MIT","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"homepage":"https://github.com/dprint/js-formatter#readme","_id":"@dprint/formatter@0.1.4","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"shasum":"71ae71afa2bdd9667c862493fbf27201807ce63f","size":3043,"noattachment":false,"key":"/@dprint/formatter/-/@dprint/formatter-0.1.4.tgz","tarball":"http://registry.cnpm.dingdandao.com/@dprint/formatter/download/@dprint/formatter-0.1.4.tgz"},"_npmUser":{"name":"dsherret","email":"dsherret@gmail.com"},"directories":{},"maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/formatter_0.1.4_1623621226349_0.3341985384402961"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T16:28:25.649Z","publish_time":1623621226469,"_cnpm_publish_time":1623621226469},"0.1.3":{"name":"@dprint/formatter","version":"0.1.3","description":"Wasm formatter for dprint plugins.","main":"mod.js","types":"mod.d.ts","repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"keywords":["dprint","formatter","wasm"],"author":{"name":"David Sherret"},"license":"MIT","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"homepage":"https://github.com/dprint/js-formatter#readme","_id":"@dprint/formatter@0.1.3","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"shasum":"559fa0d74ca65cc73a00e8bf6aa1b9e37e3c2785","size":3043,"noattachment":false,"key":"/@dprint/formatter/-/@dprint/formatter-0.1.3.tgz","tarball":"http://registry.cnpm.dingdandao.com/@dprint/formatter/download/@dprint/formatter-0.1.3.tgz"},"_npmUser":{"name":"dsherret","email":"dsherret@gmail.com"},"directories":{},"maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/formatter_0.1.3_1623620527505_0.4503075384788653"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T16:28:23.869Z","publish_time":1623620527654,"_cnpm_publish_time":1623620527654},"0.1.2":{"name":"@dprint/formatter","version":"0.1.2","description":"Wasm formatter for dprint plugins.","main":"mod.js","types":"mod.d.ts","repository":{"type":"git","url":"git+https://github.com/dprint/js-formatter.git"},"keywords":["dprint","formatter","wasm"],"author":{"name":"David Sherret"},"license":"MIT","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"homepage":"https://github.com/dprint/js-formatter#readme","_id":"@dprint/formatter@0.1.2","_nodeVersion":"14.17.0","_npmVersion":"6.14.13","dist":{"shasum":"767c7cf3c1bd435135b23f6aeacf3d0f411ec2ac","size":3043,"noattachment":false,"key":"/@dprint/formatter/-/@dprint/formatter-0.1.2.tgz","tarball":"http://registry.cnpm.dingdandao.com/@dprint/formatter/download/@dprint/formatter-0.1.2.tgz"},"_npmUser":{"name":"dsherret","email":"dsherret@gmail.com"},"directories":{},"maintainers":[{"name":"dsherret","email":"dsherret@gmail.com"}],"_npmOperationalInternal":{"host":"s3://npm-registry-packages","tmp":"tmp/formatter_0.1.2_1623620397079_0.2111451013685508"},"_hasShrinkwrap":false,"_cnpmcore_publish_time":"2021-12-27T16:28:22.136Z","publish_time":1623620397186,"_cnpm_publish_time":1623620397186}},"readme":"# dprint - JS Formatter\n\n[![CI](https://github.com/dprint/js-formatter/workflows/CI/badge.svg)](https://github.com/dprint/js-formatter/actions?query=workflow%3ACI)\n[![npm version](https://badge.fury.io/js/%40dprint%2Fformatter.svg)](https://badge.fury.io/js/%40dprint%2Fformatter)\n[![JSR](https://jsr.io/badges/@dprint/formatter)](https://jsr.io/@dprint/formatter)\n\nJS formatter for dprint Wasm plugins.\n\n## Setup\n\nDeno:\n\n```sh\ndeno add npm:@dprint/formatter\n```\n\nNode.js:\n\n```sh\nnpm i @dprint/formatter\n```\n\n## Use\n\nThe context API allows you to manage multiple plugins with shared configuration and automatic plugin selection based on file type:\n\n```ts\nimport { createContext } from \"@dprint/formatter\";\nimport * as json from \"@dprint/json\";\nimport * as markdown from \"@dprint/markdown\";\nimport * as typescript from \"@dprint/typescript\";\nimport fs from \"node:fs\";\n\nconst context = createContext({\n  // global config\n  indentWidth: 2,\n  lineWidth: 80,\n});\n\n// note: some plugins might have a getBuffer() export instead\ncontext.addPlugin(fs.readFileSync(typescript.getPath()), {\n  semiColons: \"asi\",\n});\ncontext.addPlugin(fs.readFileSync(json.getPath()));\ncontext.addPlugin(fs.readFileSync(markdown.getPath()));\n\nconsole.log(context.formatText({\n  filePath: \"config.json\",\n  fileText: \"{\\\"a\\\":1}\",\n}));\n\nconsole.log(context.formatText({\n  filePath: \"app.ts\",\n  fileText: \"const x=1\",\n}));\n```\n\nThe context also handles host formatting automatically, so embedded code blocks (like JSON in Markdown) will be formatted by the appropriate plugin.\n\n### Plugin NPM Packages\n\nNote: In the future I will ensure plugins are published to JSR as well.\n\n- [@dprint/json](https://www.npmjs.com/package/@dprint/json)\n- [@dprint/typescript](https://www.npmjs.com/package/@dprint/typescript)\n- [@dprint/markdown](https://www.npmjs.com/package/@dprint/markdown)\n- [@dprint/toml](https://www.npmjs.com/package/@dprint/toml)\n- [@dprint/dockerfile](https://www.npmjs.com/package/@dprint/dockerfile)\n- [@dprint/biome](https://www.npmjs.com/package/@dprint/biome)\n- [@dprint/oxc](https://www.npmjs.com/package/@dprint/oxc)\n- [@dprint/mago](https://www.npmjs.com/package/@dprint/mago)\n- [@dprint/ruff](https://www.npmjs.com/package/@dprint/ruff)\n","_attachments":{},"homepage":"https://github.com/dprint/js-formatter#readme","bugs":{"url":"https://github.com/dprint/js-formatter/issues"},"license":"MIT"}