{"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":{"integrity":"sha512-N9fxCxbaBOrDkteSOzaCqwWjso5iAe+WJPsHC021JfHNj2ThInPNEF13ORDKta3llq5D1TlclODCvOvipH7bWQ==","shasum":"e374398c8e8d7dbf50e8208c87af44a66de0cb2e","tarball":"http://registry-npm.ywwl.com/@dprint/formatter/download/@dprint/formatter-0.3.0.tgz","fileCount":9,"unpackedSize":31293,"signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIARgfPRZHGktId8ftdociivB8IfTkhOQYR/4h6iQVkSRAiAaes6FFj9sCFrja+9NHEdww3xXfDBf471EMU4T+dmo7w=="}],"size":5220,"noattachment":false,"key":"/@dprint/formatter/-/@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,"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":1714855043925,"_cnpm_publish_time":1714855043925,"dist-tags":{"latest":"0.6.0"}}