@dprint/bun 0.0.0-stage → 0.0.2

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/README.md CHANGED
@@ -1,3 +1,18 @@
1
- # Temporary Holding Version
1
+ # @dprint/bun
2
2
 
3
- This version is a temporary placeholder for this package. An operational version to replace this has been submitted for review and is awaiting a staged release.
3
+ npm distribution of [dprint-plugin-bun](https://github.com/dprint/dprint-plugin-bun) which is an adapter plugin for the formatter of [Bun](https://github.com/oven-sh/bun) that formats JavaScript, TypeScript, JSON, CSS, SCSS, Less, GraphQL, YAML, Markdown, MDX, HTML, Vue, and Handlebars.
4
+
5
+ Use this with [@dprint/formatter](https://github.com/dprint/js-formatter) or just use @dprint/formatter and download the [dprint-plugin-bun Wasm file](https://github.com/dprint/dprint-plugin-bun/releases).
6
+
7
+ ## Example
8
+
9
+ ```ts
10
+ import { getBuffer } from "@dprint/bun";
11
+ import { createFromBuffer } from "@dprint/formatter";
12
+
13
+ const formatter = createFromBuffer(getBuffer());
14
+
15
+ console.log(
16
+ formatter.formatText("test.js", "console.log( 5 )"),
17
+ );
18
+ ```
package/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /** Gets a buffer representing the Wasm module. */
2
+ export function getBuffer(): ArrayBuffer;
package/index.js ADDED
@@ -0,0 +1,14 @@
1
+ const fs = require("fs");
2
+ const path = require("path");
3
+
4
+ /**
5
+ * Gets a buffer representing the Wasm module.
6
+ * @returns {ArrayBuffer}
7
+ */
8
+ function getBuffer() {
9
+ return fs.readFileSync(path.join(__dirname, "plugin.wasm"));
10
+ }
11
+
12
+ module.exports = {
13
+ getBuffer,
14
+ };
package/package.json CHANGED
@@ -1,6 +1,29 @@
1
1
  {
2
2
  "name": "@dprint/bun",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
6
- }
3
+ "version": "0.0.2",
4
+ "description": "Wasm buffer for dprint-plugin-bun.",
5
+ "keywords": [
6
+ "bun",
7
+ "code",
8
+ "formatter",
9
+ "dprint"
10
+ ],
11
+ "homepage": "https://github.com/dprint/dprint-plugin-bun#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/dprint/dprint-plugin-bun/issues"
14
+ },
15
+ "repository": {
16
+ "type": "git",
17
+ "url": "git+https://github.com/dprint/dprint-plugin-bun.git"
18
+ },
19
+ "license": "MIT",
20
+ "author": "David Sherret",
21
+ "main": "./index.js",
22
+ "types": "./index.d.ts",
23
+ "scripts": {
24
+ "test": "node index.test.js"
25
+ },
26
+ "devDependencies": {
27
+ "@dprint/formatter": "~0.4.0"
28
+ }
29
+ }
package/plugin.wasm ADDED
Binary file