bare-buffer 3.0.0 → 3.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/global.d.ts ADDED
@@ -0,0 +1,9 @@
1
+ import * as buffer from '.'
2
+
3
+ type BufferConstructor = typeof buffer.Buffer
4
+
5
+ declare global {
6
+ type Buffer = buffer.Buffer
7
+
8
+ const Buffer: BufferConstructor
9
+ }
package/index.d.ts CHANGED
@@ -1,3 +1,5 @@
1
+ import constants from './lib/constants'
2
+
1
3
  type BufferEncoding =
2
4
  | 'ascii'
3
5
  | 'base64'
@@ -9,7 +11,7 @@ type BufferEncoding =
9
11
  | 'utf16le'
10
12
  | 'utf8'
11
13
 
12
- declare class Buffer extends Uint8Array {
14
+ interface Buffer extends Uint8Array {
13
15
  compare(
14
16
  target: Buffer,
15
17
  targetStart?: number,
@@ -135,9 +137,11 @@ declare class Buffer extends Uint8Array {
135
137
  writeBigUInt64LE(value: bigint, offset?: number): number
136
138
  }
137
139
 
138
- declare namespace Buffer {
139
- export { Buffer, BufferEncoding }
140
+ declare class Buffer extends Uint8Array {
141
+ constructor(arrayBuffer: ArrayBuffer, offset?: number, length?: number)
142
+ }
140
143
 
144
+ declare namespace Buffer {
141
145
  export let poolSize: number
142
146
 
143
147
  export function isBuffer(value: unknown): value is Buffer
@@ -175,7 +179,7 @@ declare namespace Buffer {
175
179
  length?: number
176
180
  ): Buffer
177
181
 
178
- export const constants: { MAX_LENGTH: number; MAX_STRING_LENGTH: number }
182
+ export { Buffer, type BufferEncoding, constants }
179
183
  }
180
184
 
181
185
  export = Buffer
@@ -0,0 +1,3 @@
1
+ declare const constants: { MAX_LENGTH: number; MAX_STRING_LENGTH: number }
2
+
3
+ export = constants
package/package.json CHANGED
@@ -1,20 +1,27 @@
1
1
  {
2
2
  "name": "bare-buffer",
3
- "version": "3.0.0",
3
+ "version": "3.0.2",
4
4
  "description": "Native buffers for JavaScript",
5
5
  "exports": {
6
+ "./package": "./package.json",
6
7
  ".": {
7
8
  "types": "./index.d.ts",
8
9
  "default": "./index.js"
9
10
  },
10
- "./package": "./package.json",
11
- "./global": "./global.js",
12
- "./constants": "./lib/constants.js"
11
+ "./global": {
12
+ "types": "./global.d.ts",
13
+ "default": "./global.js"
14
+ },
15
+ "./constants": {
16
+ "types": "./lib/constants.d.ts",
17
+ "default": "./lib/constants.js"
18
+ }
13
19
  },
14
20
  "files": [
15
21
  "index.js",
16
22
  "index.d.ts",
17
23
  "global.js",
24
+ "global.d.ts",
18
25
  "binding.c",
19
26
  "binding.js",
20
27
  "CMakeLists.txt",