{"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":{"integrity":"sha512-GCzgRt2o4mhZLy8L47k2A+q9EMG/jWhzZebE29EqKsxmjDrSfv2VisEj/Q+39OOf04jTkEfB/TRO+IZSyxHdYg==","shasum":"36345ed2e7ed15da9ba3a7c575f5864fffcd9794","tarball":"http://registry-npm.ywwl.com/@dprint/formatter/download/@dprint/formatter-0.2.1.tgz","fileCount":9,"unpackedSize":24814,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEUCIQCv3M7LtCAIuuZ4vLDNKQX919rAcAJXEn7qhJYe1hLr2wIgRSlIF3//IEqz5XbxaSFxwvmiiWLkQp3ldJjXaBsNYfA="}],"size":4747,"noattachment":false,"key":"/@dprint/formatter/-/@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,"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[![deno doc](https://doc.deno.land/badge.svg)](https://doc.deno.land/https/deno.land/x/dprint/mod.ts)\n\nJS formatter for dprint Wasm plugins.\n\n## Deno\n\n```ts\nimport {\n  createStreaming,\n  GlobalConfiguration,\n} from \"https://deno.land/x/dprint/mod.ts\";\n\nconst globalConfig: GlobalConfiguration = {\n  indentWidth: 2,\n  lineWidth: 80,\n};\nconst tsFormatter = await createStreaming(\n  // check https://plugins.dprint.dev/ for latest plugin versions\n  fetch(\"https://plugins.dprint.dev/typescript-0.57.0.wasm\"),\n);\n\ntsFormatter.setConfig(globalConfig, {\n  semiColons: \"asi\",\n});\n\n// outputs: \"const t = 5\\n\"\nconsole.log(tsFormatter.formatText(\"file.ts\", \"const   t    = 5;\"));\n```\n\n## Node.js\n\nUse the following:\n\n```ts\nimport { createFromBuffer } from \"@dprint/formatter\";\n// You may have to use `getBuffer` on plugins that haven't updated yet.\n// See the plugins README.md for details.\nimport { getPath } from \"@dprint/json\";\nimport * as fs from \"fs\";\n\nconst buffer = fs.readFileSync(getPath());\nconst formatter = createFromBuffer(buffer);\n\nconsole.log(formatter.formatText(\"test.json\", \"{test: 5}\"));\n```\n\nUnfortunately Node.js doesn't have any way to cache compiles at the moment and so it will have a slower than ideal startup time.\n\n### Plugin NPM Packages\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","publish_time":1703561243826,"_cnpm_publish_time":1703561243826,"dist-tags":{"latest":"0.6.0"}}