@dprint/mago 0.0.0

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 ADDED
@@ -0,0 +1,18 @@
1
+ # @dprint/mago
2
+
3
+ npm distribution of [dprint-plugin-mago](https://github.com/dprint/dprint-plugin-mago) which is an adapter plugin for [Mago](https://github.com/carthage-software/mago).
4
+
5
+ Use this with [@dprint/formatter](https://github.com/dprint/js-formatter) or just use @dprint/formatter and download the [dprint-plugin-mago Wasm file](https://github.com/dprint/dprint-plugin-mago/releases).
6
+
7
+ ## Example
8
+
9
+ ```ts
10
+ import { createFromBuffer } from "@dprint/formatter";
11
+ import { getBuffer } from "@dprint/mago";
12
+
13
+ const formatter = createFromBuffer(getBuffer());
14
+
15
+ console.log(
16
+ formatter.formatText("test.php", "<?php\necho '1'"),
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 ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@dprint/mago",
3
+ "version": "0.0.0",
4
+ "description": "Wasm buffer for dprint-plugin-mago.",
5
+ "main": "./index.js",
6
+ "types": "./index.d.ts",
7
+ "repository": {
8
+ "type": "git",
9
+ "url": "git+https://github.com/dprint/dprint-plugin-mago.git"
10
+ },
11
+ "keywords": [
12
+ "mago",
13
+ "code",
14
+ "formatter",
15
+ "dprint",
16
+ "php"
17
+ ],
18
+ "author": "David Sherret",
19
+ "license": "MIT",
20
+ "bugs": {
21
+ "url": "https://github.com/dprint/dprint-plugin-mago/issues"
22
+ },
23
+ "homepage": "https://github.com/dprint/dprint-plugin-mago#readme",
24
+ "scripts": {
25
+ "test": "node index.test.js"
26
+ },
27
+ "devDependencies": {
28
+ "@dprint/formatter": "~0.4.0"
29
+ }
30
+ }
package/plugin.wasm ADDED
Binary file