{"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":{"integrity":"sha512-miYP8OjRyT6Ad46De9Dp5N5MAMpJjQ3Tkk+vq9oeW5iu1y8mOGssXXPEqqGW4H2BYJdo1kQDCovuWqgtbJR4fg==","shasum":"767c7cf3c1bd435135b23f6aeacf3d0f411ec2ac","tarball":"http://registry-npm.ywwl.com/@dprint/formatter/download/@dprint/formatter-0.1.2.tgz","fileCount":3,"unpackedSize":11489,"npm-signature":"-----BEGIN PGP SIGNATURE-----\r\nVersion: OpenPGP.js v3.0.13\r\nComment: https://openpgpjs.org\r\n\r\nwsFcBAEBCAAQBQJgxnstCRA9TVsSAnZWagAAqegP/Aw/0eV0W6Iy9uiAZBLu\nDnFRFUhQYtBp2da4eYzVOiR1hCZSxBs4og1Zk+f7TdNpHM3GzNrAUWr9lSM8\nfvXMallIDuC0sYZq8nkw8qCPPCmNPdOx8cAzoIKPlSKtbp17SAwUredvPRWf\nyBzHDLPC21dxV2ODHCGX7T+iM3WFJoepo5XfQq9BykwIJqtSBHExuWoFq2Vh\njUBy0DQrTb4eqJt9U4zpLZeMgsXQt+2qNsbLP+QSkXP5L8gui50p+O9+k10w\nuAcVToJmiRpCUD7wGAxDxEHa5/sFxLfjliF0TvN4QyWQqK5Jz/wX+cwydrz8\nOlwCNsytrW5oeCON4GTESy90/AEDP2dXK+wWYkmJ8+aJL3JrC2vVBOlZ2Pnk\nenh7INVTGNIg0edKKmqZEaFuRJrX5twmvdwZDdWZWbZVHMO6wk45IbHgIS3z\njisZXmTI3Fmp6fQRKc7NZyVwfwuLU/hbNjWun+eBNRxQlkNm6p76R9QRaokf\n4d7WzWrnOjFcxCim1ealRX+uAQwWXBLYipckfzO/n5wXmTRMOQRmOpIgM7+7\nGs8Irxllv6RXeRdOzFSy8NpliCy5+wnB4vztIZjyl2swH3YPpx0tEg525cCc\nREpRJQCEzEzwt27Ldm/y8ebMpcCzKRIr8Ujww51/YIt5nVMnVToVWGYNkj71\nrCRx\r\n=Aqyc\r\n-----END PGP SIGNATURE-----\r\n","signatures":[{"keyid":"SHA256:jl3bwswu80PjjokCgh0o2w5c2U4LhQAE57gj9cz1kzA","sig":"MEQCIB7V/Tb0sO+SFibZPjD+0BqD8m87mzuHriQeX5SLh4eyAiBjTZ16CtNDcNBWKLdJmnnBiVNfAZrYQFCgT1qpgBtRRw=="}],"size":3043,"noattachment":false,"key":"/@dprint/formatter/-/@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,"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":1623620397186,"_cnpm_publish_time":1623620397186,"dist-tags":{"latest":"0.6.0"}}