@dprint/typescript 0.55.0 → 0.56.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/index.d.ts ADDED
@@ -0,0 +1,2 @@
1
+ /** Gets a buffer representing the WASM module. */
2
+ export function getBuffer(): ArrayBuffer;
package/index.js CHANGED
@@ -3,8 +3,8 @@
3
3
  * @returns {ArrayBuffer}
4
4
  */
5
5
  function getBuffer() {
6
- const encodedBuffer = require("./buffer.generated").encodedBuffer;
7
- return decodeEncodedBuffer(encodedBuffer);
6
+ const encodedBuffer = require("./buffer.generated").encodedBuffer;
7
+ return decodeEncodedBuffer(encodedBuffer);
8
8
  }
9
9
 
10
10
  /**
@@ -12,23 +12,23 @@ function getBuffer() {
12
12
  * @returns {ArrayBuffer}
13
13
  */
14
14
  function decodeEncodedBuffer(encodedBuffer) {
15
- // https://stackoverflow.com/a/51473757/188246
16
- const binaryString = toBinaryString();
17
- const bytes = new Uint8Array(binaryString.length);
18
- for (let i = 0; i < binaryString.length; i++) {
19
- bytes[i] = binaryString.charCodeAt(i);
20
- }
21
- return bytes.buffer;
15
+ // https://stackoverflow.com/a/51473757/188246
16
+ const binaryString = toBinaryString();
17
+ const bytes = new Uint8Array(binaryString.length);
18
+ for (let i = 0; i < binaryString.length; i++) {
19
+ bytes[i] = binaryString.charCodeAt(i);
20
+ }
21
+ return bytes.buffer;
22
22
 
23
- function toBinaryString() {
24
- if (typeof atob === "function") {
25
- return atob(encodedBuffer);
26
- } else {
27
- return Buffer.from(encodedBuffer, "base64").toString("binary");
28
- }
23
+ function toBinaryString() {
24
+ if (typeof atob === "function") {
25
+ return atob(encodedBuffer);
26
+ } else {
27
+ return Buffer.from(encodedBuffer, "base64").toString("binary");
29
28
  }
29
+ }
30
30
  }
31
31
 
32
32
  module.exports = {
33
- getBuffer,
33
+ getBuffer,
34
34
  };
package/package.json CHANGED
@@ -1,8 +1,9 @@
1
1
  {
2
2
  "name": "@dprint/typescript",
3
- "version": "0.55.0",
3
+ "version": "0.56.0",
4
4
  "description": "Wasm buffer for dprint-plugin-typescript.",
5
5
  "main": "./index.js",
6
+ "types": "./index.d.ts",
6
7
  "repository": {
7
8
  "type": "git",
8
9
  "url": "git+https://github.com/dprint/dprint-plugin-typescript.git"