bin-serde 1.1.1 → 1.2.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/lib/index.js CHANGED
@@ -1,10 +1,7 @@
1
- "use strict";
2
- Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.Reader = exports.Writer = void 0;
4
- const utf8 = require("utf8-buffer");
5
- const utf8_buffer_size_1 = require("utf8-buffer-size");
1
+ import * as utf8 from "utf8-buffer";
2
+ import utf8Size from "utf8-buffer-size";
6
3
  const { pack, unpack } = utf8.default ?? utf8;
7
- class Writer {
4
+ export class Writer {
8
5
  pos = 0;
9
6
  view;
10
7
  bytes;
@@ -96,7 +93,7 @@ class Writer {
96
93
  }
97
94
  writeString(val) {
98
95
  if (val.length > 0) {
99
- const byteSize = (0, utf8_buffer_size_1.default)(val);
96
+ const byteSize = utf8Size(val);
100
97
  this.writeUVarint(byteSize);
101
98
  this.ensureSize(byteSize);
102
99
  pack(val, this.bytes, this.pos);
@@ -126,8 +123,7 @@ class Writer {
126
123
  }
127
124
  }
128
125
  }
129
- exports.Writer = Writer;
130
- class Reader {
126
+ export class Reader {
131
127
  pos = 0;
132
128
  view;
133
129
  bytes;
@@ -199,4 +195,3 @@ class Reader {
199
195
  return this.view.byteLength - this.pos;
200
196
  }
201
197
  }
202
- exports.Reader = Reader;
package/package.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "name": "bin-serde",
3
- "version": "1.1.1",
3
+ "version": "1.2.0",
4
4
  "description": "A low level library for efficiently writing and reading binary data in javascript",
5
+ "type": "module",
5
6
  "main": "lib/index.js",
6
7
  "types": "lib/index.d.ts",
7
8
  "scripts": {
package/tsconfig.json CHANGED
@@ -1,7 +1,8 @@
1
1
  {
2
2
  "compilerOptions": {
3
3
  "target": "esnext",
4
- "module": "commonjs",
4
+ "module": "esnext",
5
+ "moduleResolution": "node",
5
6
  "declaration": true,
6
7
  "outDir": "./lib",
7
8
  "strict": true