@nxtedition/slice 1.1.10 → 1.1.11

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
@@ -89,19 +89,23 @@ A lightweight view over a `Buffer` with explicit offset and length tracking.
89
89
 
90
90
  #### `new Slice(buffer?: Buffer, byteOffset?: number, byteLength?: number, maxByteLength?: number)`
91
91
 
92
- Creates a new slice. All parameters are optional — defaults to an empty slice.
92
+ Creates a new slice. All parameters are optional — defaults to an empty slice. The constructor does **no** validation; pass only consistent values, or use `Slice.from` for a checked construction.
93
+
94
+ #### `Slice.from(buffer: Buffer, byteOffset?: number, byteLength?: number): Slice`
95
+
96
+ Validated factory for wrapping an existing `Buffer`. `byteOffset` defaults to `0` and `byteLength` to the remaining bytes (`buffer.byteLength - byteOffset`). Throws `TypeError` if `buffer` is not a `Buffer`, and `RangeError` if `byteOffset`/`byteLength` are negative, non-integer, or `byteOffset + byteLength` exceeds the buffer. Prefer this over the bare constructor when the inputs are untrusted.
93
97
 
94
98
  #### Properties
95
99
 
96
100
  - `buffer: Buffer` — The underlying `Buffer`
97
101
  - `byteOffset: number` — Start offset into the buffer
98
102
  - `byteLength: number` — Current length in bytes
99
- - `maxByteLength: number` — Maximum capacity in bytes
103
+ - `maxByteLength: number` — For a pool-allocated slice, the power-of-2 bucket capacity (always `>= byteLength`). For a manually-constructed slice it defaults to `byteLength` and is purely informational: no method bounds writes against it — reads and writes are validated/clamped against `byteLength`.
100
104
  - `length: number` — Alias for `byteLength`
101
105
 
102
106
  #### Methods
103
107
 
104
- - `reset(): void` — Clear the slice back to empty state. **Note:** this does not return the slot to the `PoolAllocator` you must call `realloc(slice, 0)` to free pool memory.
108
+ - `reset(): void` — Clear the slice back to empty state. **Note:** this does not return the slot to the `PoolAllocator`. To free pool memory call `realloc(slice, 0)` and do **not** `reset()` first: `reset()` detaches the slice from the pool buffer, so a subsequent `realloc(slice, 0)` can no longer locate the slot and the slot leaks.
105
109
  - `copy(target: Uint8Array | Slice, targetStart?: number, sourceStart?: number, sourceEnd?: number): number` — Copy data to a `Uint8Array`/`Buffer` or `Slice`. Returns bytes copied.
106
110
  - `compare(target: Uint8Array | Slice, targetStart?: number, targetEnd?: number, sourceStart?: number, sourceEnd?: number): -1 | 0 | 1` — Compare with a `Uint8Array`/`Buffer` or `Slice`
107
111
  - `write(string: string, offset?: number, length?: number, encoding?: BufferEncoding): number` — Write a string into the slice. Returns bytes written.
@@ -117,8 +121,10 @@ All offsets are **relative to the slice** (i.e. `0` is `byteOffset`). For a `Sli
117
121
 
118
122
  The rule is consistent across the API:
119
123
 
120
- - **Start/offset arguments are validated** — `set`'s `offset`, `copy`/`compare`'s `sourceStart`/`targetStart`, `toString`/`toBuffer`'s `start`, `write`'s `offset`/`length`, and `at`'s `index` must be in-range integers. Out-of-range or non-integer values throw `RangeError`. This prevents a negative offset from resolving to a position **before** the slice and reading/writing adjacent (pool) memory.
124
+ - **Start/offset arguments are validated** — `set`'s `offset`, `copy`/`compare`'s `sourceStart`/`targetStart`, `toString`/`toBuffer`'s `start`, `write`'s `offset`, and `at`'s `index` must be in-range integers. Out-of-range or non-integer values throw `RangeError`. This prevents a negative offset from resolving to a position **before** the slice and reading/writing adjacent (pool) memory.
121
125
  - **End arguments are clamped** — `sourceEnd`/`targetEnd`/`end` are clamped to the slice's logical length (matching `Buffer`'s lenient end-of-range behavior), so over-long ranges never read past the slice's end.
126
+ - **`write`'s `length` is hybrid** — a negative or non-integer `length` throws `RangeError`, but a too-large `length` is clamped to the bytes available in the slice (it behaves like an end argument, not a strict start argument).
127
+ - For a raw `Buffer`/`Uint8Array` target, `targetStart`/`targetEnd` (and a non-`Slice` `compare` target's range) are passed straight through to the underlying `Buffer` method, so they follow `Buffer`'s own coercion/validation rather than the rules above.
122
128
 
123
129
  #### Static
124
130
 
@@ -137,7 +143,7 @@ Creates a pool allocator. Pass a byte size to allocate a fresh backing buffer (d
137
143
  #### Methods
138
144
 
139
145
  - `realloc(byteLength: number): Slice` — Allocate a fresh slice.
140
- - `realloc(slice: Slice, byteLength: number): Slice` — Resize a slice, or free it by passing `0`. **Contents are not preserved** — `realloc` has `malloc` semantics, not C `realloc` semantics; after a resize the bytes are undefined (a same-bucket resize happens to keep them in place, but do not rely on it). Only call `realloc` with a slice that belongs to this allocator (or a fresh/empty `Slice`); passing a slice from another pool, or freeing the same slice twice, corrupts the allocator's accounting.
146
+ - `realloc(slice: Slice, byteLength: number): Slice` — Resize a slice, or free it by passing `0`. **Contents are not preserved** — `realloc` has `malloc` semantics, not C `realloc` semantics; after a resize the bytes are undefined (a same-bucket resize happens to keep them in place, but do not rely on it). Only call `realloc` with a slice that belongs to this allocator (or a fresh/empty `Slice`); passing a slice from another pool, or freeing the same pool slot through two aliasing `Slice` objects, corrupts the allocator's accounting. (Calling `realloc(slice, 0)` twice on the _same_ object is a harmless no-op — the first free empties the slice, so the second returns immediately.)
141
147
  - `isFromPool(slice: Slice | null | undefined): boolean` — Check if a slice's buffer is this pool's backing buffer. Note this is an identity check; it returns `true` for any slice over the same buffer, not only ones this allocator handed out.
142
148
 
143
149
  Allocations larger than 256 KB (the largest bucket), or made when the contiguous pool is exhausted, fall back to a fresh standalone `Buffer` (`isFromPool` returns `false`) and are excluded from `size`/`stats`.
package/lib/index.d.ts CHANGED
@@ -49,3 +49,4 @@ export declare class PoolAllocator {
49
49
  }[];
50
50
  };
51
51
  }
52
+ //# sourceMappingURL=index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.d.ts","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAI5B,MAAM,MAAM,SAAS,GAAG;IACtB,MAAM,EAAE,MAAM,CAAA;IACd,UAAU,EAAE,MAAM,CAAA;IAClB,UAAU,EAAE,MAAM,CAAA;CACnB,CAAA;AAED,qBAAa,KAAM,YAAW,SAAS;IACrC,MAAM,EAAE,MAAM,CAAY;IAC1B,UAAU,EA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AE,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;IA4BzE,QAAQ,CAAC,KAAK,CAAC,EAAE,MAAM,EAAE,GAAG,CAAC,EAAE,MAAM,GAAG,MAAM;IA8B9C,IAAI,CAAC,MAAM,CAAC,WAAW,CAAC,IAAI,MAAM,CAEjC;IAED,CAAC,IAAI,CAAC,OAAO,CAAC,MAAM,CAAC,IAAI,MAAM;CAkChC;AAED,qBAAa,aAAa;;gBAYtB,iBAAiB,GAAE,MAAM,GAAG,eAAe,GAAG,WAAW,GAAG,iBAAiB,GAAG,MAE1E;IAgCR,IAAI,IAAI,WAEP;IAED,UAAU,CAAC,KAAK,EAAE,KAAK,GAAG,IAAI,GAAG,SAAS,GAAG,OAAO;IAIpD,OAAO,CAAC,UAAU,EAAE,MAAM,GAAG,KAAK;IAClC,OAAO,CAAC,KAAK,EAAE,KAAK,EAAE,UAAU,EAAE,MAAM,GAAG,KAAK;IAuGhD,IAAI,KAAK;;;;;;;;;;;;;MAeR;CACF"}
package/lib/index.js CHANGED
@@ -1,517 +1,438 @@
1
- import util from 'node:util'
2
-
3
- const EMPTY_BUF = Buffer.alloc(0)
4
-
5
-
6
-
7
-
8
-
9
-
10
-
11
- export class Slice {
12
- buffer = EMPTY_BUF
13
- byteOffset = 0
14
- byteLength = 0
15
- maxByteLength = 0
16
-
17
- static get EMPTY_BUF() {
18
- return EMPTY_BUF
19
- }
20
-
21
- static from(buffer , byteOffset = 0, byteLength = buffer.byteLength - byteOffset) {
22
- if (!(buffer instanceof Buffer)) {
23
- throw new TypeError('buffer must be a Buffer')
24
- }
25
-
26
- if (byteOffset < 0 || !Number.isInteger(byteOffset)) {
27
- throw new RangeError(`Invalid byteOffset: ${byteOffset}`)
28
- }
29
-
30
- if (byteLength < 0 || !Number.isInteger(byteLength)) {
31
- throw new RangeError(`Invalid byteLength: ${byteLength}`)
32
- }
33
-
34
- if (byteOffset + byteLength > buffer.byteLength) {
35
- throw new RangeError(
36
- `byteOffset + byteLength (${byteOffset + byteLength}) exceeds buffer size (${buffer.byteLength})`,
37
- )
38
- }
39
-
40
- return new Slice(buffer, byteOffset, byteLength)
41
- }
42
-
43
- constructor(
44
- buffer = Slice.EMPTY_BUF,
45
- byteOffset = 0,
46
- byteLength = buffer.byteLength,
47
- maxByteLength = byteLength,
48
- ) {
49
- this.buffer = buffer
50
- this.byteOffset = byteOffset
51
- this.byteLength = byteLength
52
- this.maxByteLength = maxByteLength
53
- }
54
-
55
- reset() {
56
- this.buffer = Slice.EMPTY_BUF
57
- this.byteOffset = 0
58
- this.byteLength = 0
59
- this.maxByteLength = 0
60
- }
61
-
62
- get length() {
63
- return this.byteLength
64
- }
65
-
66
- copy(
67
- target ,
68
- targetStart ,
69
- sourceStart ,
70
- sourceEnd ,
71
- ) {
72
- const sliceEnd = this.byteOffset + this.byteLength
73
-
74
- if (sourceStart === undefined) {
75
- sourceStart = this.byteOffset
76
- } else {
77
- // Start offsets are validated (not clamped) so a negative offset can
78
- // never resolve to a position before the slice and read adjacent
79
- // (pool) memory.
80
- if (sourceStart < 0 || sourceStart > this.byteLength || !Number.isInteger(sourceStart)) {
81
- throw new RangeError(`Invalid sourceStart: ${sourceStart}`)
82
- }
83
- sourceStart += this.byteOffset
84
- }
85
-
86
- if (sourceEnd === undefined) {
87
- sourceEnd = sliceEnd
88
- } else {
89
- sourceEnd += this.byteOffset
90
- }
91
-
92
- // Clamp the end against the logical slice length so copy() cannot read
93
- // past the slice's own end and leak adjacent (pool) memory.
94
- if (sourceEnd > sliceEnd) {
95
- sourceEnd = sliceEnd
96
- }
97
- if (sourceEnd < sourceStart) {
98
- sourceEnd = sourceStart
99
- }
100
-
101
- if (target instanceof Slice) {
102
- const targetEnd = target.byteOffset + target.byteLength
103
- if (targetStart === undefined) {
104
- targetStart = target.byteOffset
105
- } else {
106
- if (targetStart < 0 || targetStart > target.byteLength || !Number.isInteger(targetStart)) {
107
- throw new RangeError(`Invalid targetStart: ${targetStart}`)
108
- }
109
- targetStart += target.byteOffset
110
- }
111
-
112
- target = target.buffer
113
- if (sourceEnd - sourceStart > targetEnd - targetStart) {
114
- sourceEnd = sourceStart + (targetEnd - targetStart)
115
- }
116
- }
117
-
118
- if (
119
- sourceStart === targetStart &&
120
- this.buffer.buffer === target.buffer &&
121
- this.buffer.byteOffset === target.byteOffset
122
- ) {
123
- return sourceEnd - sourceStart
124
- }
125
-
126
- return this.buffer.copy(target, targetStart, sourceStart, sourceEnd)
127
- }
128
-
129
- compare(
130
- target ,
131
- targetStart ,
132
- targetEnd ,
133
- sourceStart ,
134
- sourceEnd ,
135
- ) {
136
- if (
137
- target === this &&
138
- targetStart === undefined &&
139
- targetEnd === undefined &&
140
- sourceStart === undefined &&
141
- sourceEnd === undefined
142
- ) {
143
- return 0
144
- }
145
-
146
- const sliceEnd = this.byteOffset + this.byteLength
147
-
148
- if (target instanceof Slice) {
149
- const targetSliceEnd = target.byteOffset + target.byteLength
150
- if (targetStart === undefined) {
151
- targetStart = target.byteOffset
152
- } else {
153
- if (targetStart < 0 || targetStart > target.byteLength || !Number.isInteger(targetStart)) {
154
- throw new RangeError(`Invalid targetStart: ${targetStart}`)
155
- }
156
- targetStart += target.byteOffset
157
- }
158
-
159
- if (targetEnd === undefined) {
160
- targetEnd = targetSliceEnd
161
- } else {
162
- targetEnd += target.byteOffset
163
- }
164
-
165
- if (targetEnd > targetSliceEnd) {
166
- targetEnd = targetSliceEnd
167
- }
168
- if (targetEnd < targetStart) {
169
- targetEnd = targetStart
170
- }
171
- target = target.buffer
172
- }
173
-
174
- if (sourceStart === undefined) {
175
- sourceStart = this.byteOffset
176
- } else {
177
- if (sourceStart < 0 || sourceStart > this.byteLength || !Number.isInteger(sourceStart)) {
178
- throw new RangeError(`Invalid sourceStart: ${sourceStart}`)
179
- }
180
- sourceStart += this.byteOffset
181
- }
182
-
183
- if (sourceEnd === undefined) {
184
- sourceEnd = sliceEnd
185
- } else {
186
- sourceEnd += this.byteOffset
187
- }
188
-
189
- if (sourceEnd > sliceEnd) {
190
- sourceEnd = sliceEnd
191
- }
192
- if (sourceEnd < sourceStart) {
193
- sourceEnd = sourceStart
194
- }
195
-
196
- return this.buffer.compare(target, targetStart, targetEnd, sourceStart, sourceEnd)
197
- }
198
-
199
- write(string , offset , length , encoding ) {
200
- const sliceEnd = this.byteOffset + this.byteLength
201
-
202
- if (offset === undefined) {
203
- offset = this.byteOffset
204
- } else {
205
- if (offset < 0 || offset > this.byteLength || !Number.isInteger(offset)) {
206
- throw new RangeError(`Invalid offset: ${offset}`)
207
- }
208
- offset += this.byteOffset
209
- }
210
-
211
- const available = sliceEnd - offset
212
- if (length === undefined) {
213
- length = available
214
- } else {
215
- if (length < 0 || !Number.isInteger(length)) {
216
- throw new RangeError(`Invalid length: ${length}`)
217
- }
218
- if (length > available) {
219
- length = available
220
- }
221
- }
222
-
223
- return this.buffer.write(string, offset, length, encoding)
224
- }
225
-
226
- set(source , offset ) {
227
- if (source == null) {
228
- return
229
- }
230
-
231
- if (offset === undefined) {
232
- offset = this.byteOffset
233
- } else {
234
- // Validate (not clamp): a negative offset would resolve to a position
235
- // before the slice and corrupt adjacent (pool) memory.
236
- if (offset < 0 || offset > this.byteLength || !Number.isInteger(offset)) {
237
- throw new RangeError(`Invalid offset: ${offset}`)
238
- }
239
- offset += this.byteOffset
240
- }
241
-
242
- const available = this.byteOffset + this.byteLength - offset
243
- if (available <= 0) {
244
- return
245
- }
246
-
247
- const end = source.byteLength < available ? source.byteLength : available
248
- source.copy(this.buffer, offset, 0, end)
249
- }
250
-
251
- at(index ) {
252
- if (!Number.isInteger(index) || index >= this.byteLength || index < -this.byteLength) {
253
- throw new RangeError(`Index out of range: ${index}`)
254
- }
255
- return index >= 0
256
- ? this.buffer[this.byteOffset + index]
257
- : this.buffer[this.byteOffset + this.byteLength + index]
258
- }
259
-
260
- test(expr
261
-
262
- ) {
263
- return expr.test(this.buffer, this.byteOffset, this.byteLength)
264
- }
265
-
266
- toString(encoding , start , end ) {
267
- const sliceEnd = this.byteOffset + this.byteLength
268
-
269
- if (start === undefined) {
270
- start = this.byteOffset
271
- } else {
272
- if (start < 0 || start > this.byteLength || !Number.isInteger(start)) {
273
- throw new RangeError(`Invalid start: ${start}`)
274
- }
275
- start += this.byteOffset
276
- }
277
-
278
- if (end === undefined) {
279
- end = sliceEnd
280
- } else {
281
- end += this.byteOffset
282
- }
283
-
284
- if (end > sliceEnd) {
285
- end = sliceEnd
286
- }
287
- if (end < start) {
288
- end = start
1
+ import util from 'node:util';
2
+ const EMPTY_BUF = Buffer.alloc(0);
3
+ export class Slice {
4
+ buffer = EMPTY_BUF;
5
+ byteOffset = 0;
6
+ byteLength = 0;
7
+ maxByteLength = 0;
8
+ static get EMPTY_BUF() {
9
+ return EMPTY_BUF;
10
+ }
11
+ static from(buffer, byteOffset = 0, byteLength = buffer.byteLength - byteOffset) {
12
+ if (!(buffer instanceof Buffer)) {
13
+ throw new TypeError('buffer must be a Buffer');
14
+ }
15
+ if (byteOffset < 0 || !Number.isInteger(byteOffset)) {
16
+ throw new RangeError(`Invalid byteOffset: ${byteOffset}`);
17
+ }
18
+ if (byteLength < 0 || !Number.isInteger(byteLength)) {
19
+ throw new RangeError(`Invalid byteLength: ${byteLength}`);
20
+ }
21
+ if (byteOffset + byteLength > buffer.byteLength) {
22
+ throw new RangeError(`byteOffset + byteLength (${byteOffset + byteLength}) exceeds buffer size (${buffer.byteLength})`);
23
+ }
24
+ return new Slice(buffer, byteOffset, byteLength);
25
+ }
26
+ constructor(buffer = Slice.EMPTY_BUF, byteOffset = 0, byteLength = buffer.byteLength, maxByteLength = byteLength) {
27
+ this.buffer = buffer;
28
+ this.byteOffset = byteOffset;
29
+ this.byteLength = byteLength;
30
+ this.maxByteLength = maxByteLength;
31
+ }
32
+ reset() {
33
+ this.buffer = Slice.EMPTY_BUF;
34
+ this.byteOffset = 0;
35
+ this.byteLength = 0;
36
+ this.maxByteLength = 0;
37
+ }
38
+ get length() {
39
+ return this.byteLength;
40
+ }
41
+ copy(target, targetStart, sourceStart, sourceEnd) {
42
+ const sliceEnd = this.byteOffset + this.byteLength;
43
+ if (sourceStart === undefined) {
44
+ sourceStart = this.byteOffset;
45
+ }
46
+ else {
47
+ // Start offsets are validated (not clamped) so a negative offset can
48
+ // never resolve to a position before the slice and read adjacent
49
+ // (pool) memory.
50
+ if (sourceStart < 0 || sourceStart > this.byteLength || !Number.isInteger(sourceStart)) {
51
+ throw new RangeError(`Invalid sourceStart: ${sourceStart}`);
52
+ }
53
+ sourceStart += this.byteOffset;
54
+ }
55
+ if (sourceEnd === undefined) {
56
+ sourceEnd = sliceEnd;
57
+ }
58
+ else {
59
+ sourceEnd += this.byteOffset;
60
+ }
61
+ // Clamp the end against the logical slice length so copy() cannot read
62
+ // past the slice's own end and leak adjacent (pool) memory.
63
+ if (sourceEnd > sliceEnd) {
64
+ sourceEnd = sliceEnd;
65
+ }
66
+ if (sourceEnd < sourceStart) {
67
+ sourceEnd = sourceStart;
68
+ }
69
+ if (target instanceof Slice) {
70
+ const targetEnd = target.byteOffset + target.byteLength;
71
+ if (targetStart === undefined) {
72
+ targetStart = target.byteOffset;
73
+ }
74
+ else {
75
+ if (targetStart < 0 || targetStart > target.byteLength || !Number.isInteger(targetStart)) {
76
+ throw new RangeError(`Invalid targetStart: ${targetStart}`);
77
+ }
78
+ targetStart += target.byteOffset;
79
+ }
80
+ target = target.buffer;
81
+ if (sourceEnd - sourceStart > targetEnd - targetStart) {
82
+ sourceEnd = sourceStart + (targetEnd - targetStart);
83
+ }
84
+ }
85
+ if (sourceStart === targetStart &&
86
+ this.buffer.buffer === target.buffer &&
87
+ this.buffer.byteOffset === target.byteOffset) {
88
+ return sourceEnd - sourceStart;
89
+ }
90
+ return this.buffer.copy(target, targetStart, sourceStart, sourceEnd);
91
+ }
92
+ compare(target, targetStart, targetEnd, sourceStart, sourceEnd) {
93
+ if (target === this &&
94
+ targetStart === undefined &&
95
+ targetEnd === undefined &&
96
+ sourceStart === undefined &&
97
+ sourceEnd === undefined) {
98
+ return 0;
99
+ }
100
+ const sliceEnd = this.byteOffset + this.byteLength;
101
+ if (target instanceof Slice) {
102
+ const targetSliceEnd = target.byteOffset + target.byteLength;
103
+ if (targetStart === undefined) {
104
+ targetStart = target.byteOffset;
105
+ }
106
+ else {
107
+ if (targetStart < 0 || targetStart > target.byteLength || !Number.isInteger(targetStart)) {
108
+ throw new RangeError(`Invalid targetStart: ${targetStart}`);
109
+ }
110
+ targetStart += target.byteOffset;
111
+ }
112
+ if (targetEnd === undefined) {
113
+ targetEnd = targetSliceEnd;
114
+ }
115
+ else {
116
+ targetEnd += target.byteOffset;
117
+ }
118
+ if (targetEnd > targetSliceEnd) {
119
+ targetEnd = targetSliceEnd;
120
+ }
121
+ if (targetEnd < targetStart) {
122
+ targetEnd = targetStart;
123
+ }
124
+ target = target.buffer;
125
+ }
126
+ if (sourceStart === undefined) {
127
+ sourceStart = this.byteOffset;
128
+ }
129
+ else {
130
+ if (sourceStart < 0 || sourceStart > this.byteLength || !Number.isInteger(sourceStart)) {
131
+ throw new RangeError(`Invalid sourceStart: ${sourceStart}`);
132
+ }
133
+ sourceStart += this.byteOffset;
134
+ }
135
+ if (sourceEnd === undefined) {
136
+ sourceEnd = sliceEnd;
137
+ }
138
+ else {
139
+ sourceEnd += this.byteOffset;
140
+ }
141
+ if (sourceEnd > sliceEnd) {
142
+ sourceEnd = sliceEnd;
143
+ }
144
+ if (sourceEnd < sourceStart) {
145
+ sourceEnd = sourceStart;
146
+ }
147
+ return this.buffer.compare(target, targetStart, targetEnd, sourceStart, sourceEnd);
289
148
  }
290
-
291
- return this.buffer.toString(encoding, start, end)
292
- }
293
-
294
- toBuffer(start , end ) {
295
- const sliceEnd = this.byteOffset + this.byteLength
296
-
297
- if (start === undefined) {
298
- start = this.byteOffset
299
- } else {
300
- if (start < 0 || start > this.byteLength || !Number.isInteger(start)) {
301
- throw new RangeError(`Invalid start: ${start}`)
302
- }
303
- start += this.byteOffset
149
+ write(string, offset, length, encoding) {
150
+ const sliceEnd = this.byteOffset + this.byteLength;
151
+ if (offset === undefined) {
152
+ offset = this.byteOffset;
153
+ }
154
+ else {
155
+ if (offset < 0 || offset > this.byteLength || !Number.isInteger(offset)) {
156
+ throw new RangeError(`Invalid offset: ${offset}`);
157
+ }
158
+ offset += this.byteOffset;
159
+ }
160
+ const available = sliceEnd - offset;
161
+ if (length === undefined) {
162
+ length = available;
163
+ }
164
+ else {
165
+ if (length < 0 || !Number.isInteger(length)) {
166
+ throw new RangeError(`Invalid length: ${length}`);
167
+ }
168
+ if (length > available) {
169
+ length = available;
170
+ }
171
+ }
172
+ return this.buffer.write(string, offset, length, encoding);
304
173
  }
305
-
306
- if (end === undefined) {
307
- end = sliceEnd
308
- } else {
309
- end += this.byteOffset
174
+ set(source, offset) {
175
+ if (source == null) {
176
+ return;
177
+ }
178
+ if (offset === undefined) {
179
+ offset = this.byteOffset;
180
+ }
181
+ else {
182
+ // Validate (not clamp): a negative offset would resolve to a position
183
+ // before the slice and corrupt adjacent (pool) memory.
184
+ if (offset < 0 || offset > this.byteLength || !Number.isInteger(offset)) {
185
+ throw new RangeError(`Invalid offset: ${offset}`);
186
+ }
187
+ offset += this.byteOffset;
188
+ }
189
+ const available = this.byteOffset + this.byteLength - offset;
190
+ if (available <= 0) {
191
+ return;
192
+ }
193
+ const end = source.byteLength < available ? source.byteLength : available;
194
+ source.copy(this.buffer, offset, 0, end);
310
195
  }
311
-
312
- if (end > sliceEnd) {
313
- end = sliceEnd
196
+ at(index) {
197
+ if (!Number.isInteger(index) || index >= this.byteLength || index < -this.byteLength) {
198
+ throw new RangeError(`Index out of range: ${index}`);
199
+ }
200
+ return index >= 0
201
+ ? this.buffer[this.byteOffset + index]
202
+ : this.buffer[this.byteOffset + this.byteLength + index];
314
203
  }
315
- if (end < start) {
316
- end = start
204
+ test(expr) {
205
+ return expr.test(this.buffer, this.byteOffset, this.byteLength);
317
206
  }
318
-
319
- return start === 0 && end === this.buffer.byteLength
320
- ? this.buffer
321
- : this.buffer.subarray(start, end)
322
- }
323
-
324
- get [Symbol.toStringTag]() {
325
- return 'Slice'
326
- }
327
-
328
- [util.inspect.custom]() {
329
- const MAX_BYTES = 32
330
- const len = this.byteLength
331
-
332
- // Never read past the underlying buffer. A malformed slice (byteOffset /
333
- // byteLength extending beyond the buffer) is exactly the state a developer
334
- // inspects while debugging pool corruption — inspect must not throw on it.
335
- const available = this.buffer.byteLength - this.byteOffset
336
- const safeLen = available > 0 ? (len < available ? len : available) : 0
337
- const shown = safeLen < MAX_BYTES ? safeLen : MAX_BYTES
338
-
339
- let hex = ''
340
- for (let i = 0; i < shown; i++) {
341
- if (i !== 0) {
342
- hex += ' '
343
- }
344
- hex += this.buffer[this.byteOffset + i].toString(16).padStart(2, '0')
207
+ toString(encoding, start, end) {
208
+ const sliceEnd = this.byteOffset + this.byteLength;
209
+ if (start === undefined) {
210
+ start = this.byteOffset;
211
+ }
212
+ else {
213
+ if (start < 0 || start > this.byteLength || !Number.isInteger(start)) {
214
+ throw new RangeError(`Invalid start: ${start}`);
215
+ }
216
+ start += this.byteOffset;
217
+ }
218
+ if (end === undefined) {
219
+ end = sliceEnd;
220
+ }
221
+ else {
222
+ end += this.byteOffset;
223
+ }
224
+ if (end > sliceEnd) {
225
+ end = sliceEnd;
226
+ }
227
+ if (end < start) {
228
+ end = start;
229
+ }
230
+ return this.buffer.toString(encoding, start, end);
345
231
  }
346
- if (shown < len) {
347
- hex += ` ... (${len - shown} more)`
232
+ toBuffer(start, end) {
233
+ const sliceEnd = this.byteOffset + this.byteLength;
234
+ if (start === undefined) {
235
+ start = this.byteOffset;
236
+ }
237
+ else {
238
+ if (start < 0 || start > this.byteLength || !Number.isInteger(start)) {
239
+ throw new RangeError(`Invalid start: ${start}`);
240
+ }
241
+ start += this.byteOffset;
242
+ }
243
+ if (end === undefined) {
244
+ end = sliceEnd;
245
+ }
246
+ else {
247
+ end += this.byteOffset;
248
+ }
249
+ if (end > sliceEnd) {
250
+ end = sliceEnd;
251
+ }
252
+ if (end < start) {
253
+ end = start;
254
+ }
255
+ return start === 0 && end === this.buffer.byteLength
256
+ ? this.buffer
257
+ : this.buffer.subarray(start, end);
258
+ }
259
+ get [Symbol.toStringTag]() {
260
+ return 'Slice';
261
+ }
262
+ [util.inspect.custom]() {
263
+ const MAX_BYTES = 32;
264
+ const len = this.byteLength;
265
+ // A malformed slice (a NaN/non-finite/fractional/negative/out-of-bounds
266
+ // byteOffset or byteLength) is exactly the state a developer inspects while
267
+ // debugging pool corruption — inspect must never throw on it. Coerce
268
+ // byteOffset to a safe integer index in [0, buffer.byteLength]: the
269
+ // `>= 0` test is false for NaN and -Infinity (→ 0), Math.floor truncates a
270
+ // fractional offset, and Math.min caps Infinity/oversize at the buffer end
271
+ // (available 0). Every buffer access below is then guaranteed in-bounds and
272
+ // begin + shown <= buffer.byteLength holds.
273
+ const bufferLength = this.buffer.byteLength;
274
+ const begin = this.byteOffset >= 0 ? Math.min(Math.floor(this.byteOffset), bufferLength) : 0;
275
+ const cap = bufferLength - begin;
276
+ const safeLen = len > 0 ? (len < cap ? len : cap) : 0;
277
+ const shown = safeLen < MAX_BYTES ? safeLen : MAX_BYTES;
278
+ let hex = '';
279
+ for (let i = 0; i < shown; i++) {
280
+ if (i !== 0) {
281
+ hex += ' ';
282
+ }
283
+ hex += this.buffer[begin + i].toString(16).padStart(2, '0');
284
+ }
285
+ if (shown < len) {
286
+ hex += ` ... (${len - shown} more)`;
287
+ }
288
+ const str = this.buffer.toString('utf8', begin, begin + shown);
289
+ const truncated = shown < len ? '…' : '';
290
+ return `Slice(${len}): "${str}${truncated}" <${hex}>`;
348
291
  }
349
-
350
- const str = this.buffer.toString('utf8', this.byteOffset, this.byteOffset + shown)
351
- const truncated = shown < len ? '…' : ''
352
-
353
- return `Slice(${len}): "${str}${truncated}" <${hex}>`
354
- }
355
292
  }
356
-
357
293
  export class PoolAllocator {
358
- #size = 0
359
- #padding = 0
360
-
361
- #poolsBucket = []
362
- #poolsBucketUsed = []
363
- #poolBuffer
364
- #poolOffset = 0
365
- #poolSize = 0
366
- #poolCount = 0
367
-
368
- constructor(
369
- poolTotalOrBuffer = 128 *
370
- 1024 *
371
- 1024,
372
- ) {
373
- if (typeof poolTotalOrBuffer === 'number') {
374
- if (!Number.isInteger(poolTotalOrBuffer) || poolTotalOrBuffer < 0) {
375
- throw new RangeError(`Invalid pool size: ${poolTotalOrBuffer}`)
376
- }
377
- this.#poolBuffer = Buffer.allocUnsafeSlow(poolTotalOrBuffer)
378
- } else if (poolTotalOrBuffer instanceof Buffer) {
379
- this.#poolBuffer = poolTotalOrBuffer
380
- } else if (ArrayBuffer.isView(poolTotalOrBuffer)) {
381
- this.#poolBuffer = Buffer.from(
382
- poolTotalOrBuffer.buffer,
383
- poolTotalOrBuffer.byteOffset,
384
- poolTotalOrBuffer.byteLength,
385
- )
386
- } else if (
387
- poolTotalOrBuffer instanceof ArrayBuffer ||
388
- poolTotalOrBuffer instanceof SharedArrayBuffer
389
- ) {
390
- this.#poolBuffer = Buffer.from(poolTotalOrBuffer)
391
- } else {
392
- throw new TypeError(
393
- 'Invalid poolTotalOrBuffer: must be a Buffer, ArrayBufferView, ArrayBuffer, SharedArrayBuffer, or number',
394
- )
395
- }
396
-
397
- for (let n = 0; 2 ** n <= 256 * 1024; n++) {
398
- this.#poolsBucket.push([])
399
- this.#poolsBucketUsed.push(0)
400
- }
401
- }
402
-
403
- get size() {
404
- return this.#size
405
- }
406
-
407
- isFromPool(slice ) {
408
- return slice != null && slice.buffer === this.#poolBuffer
409
- }
410
-
411
-
412
-
413
- realloc(slice , byteLength ) {
414
- if (typeof slice === 'number') {
415
- byteLength = slice
416
- slice = new Slice()
417
- }
418
-
419
- if (byteLength == null || !Number.isInteger(byteLength) || byteLength < 0) {
420
- throw new TypeError(`Invalid byteLength: ${byteLength}`)
421
- }
422
-
423
- // 2^30 is the largest power-of-two that fits a 32-bit signed int; a
424
- // larger request overflows `1 << dstIdx` to a negative bucket size.
425
- if (byteLength > 1 << 30) {
426
- throw new RangeError(`byteLength too large: ${byteLength} (max ${1 << 30})`)
427
- }
428
-
429
- if (slice.byteLength === byteLength) {
430
- return slice
431
- }
432
-
433
- // Ceil to nearest power of two.
434
- const dstIdx = byteLength <= 8 ? 3 : 32 - Math.clz32(byteLength - 1)
435
-
436
- if (slice.buffer === this.#poolBuffer) {
437
- const srcIdx = 32 - Math.clz32(slice.maxByteLength - 1)
438
-
439
- if (slice.maxByteLength !== 1 << srcIdx) {
440
- throw new Error(`Invalid pool state`)
441
- }
442
-
443
- this.#size -= slice.maxByteLength
444
- this.#padding -= slice.maxByteLength - slice.byteLength
445
-
446
- if (srcIdx === dstIdx) {
447
- slice.byteLength = byteLength
448
- this.#size += slice.maxByteLength
449
- this.#padding += slice.maxByteLength - slice.byteLength
450
- return slice
451
- }
452
-
453
- this.#poolsBucket[srcIdx].push(slice.byteOffset)
454
- this.#poolsBucketUsed[srcIdx] -= 1
455
- this.#poolSize -= slice.maxByteLength
294
+ #size = 0;
295
+ #padding = 0;
296
+ #poolsBucket = [];
297
+ #poolsBucketUsed = [];
298
+ #poolBuffer;
299
+ #poolOffset = 0;
300
+ #poolSize = 0;
301
+ #poolCount = 0;
302
+ constructor(poolTotalOrBuffer = 128 *
303
+ 1024 *
304
+ 1024) {
305
+ if (typeof poolTotalOrBuffer === 'number') {
306
+ if (!Number.isInteger(poolTotalOrBuffer) || poolTotalOrBuffer < 0) {
307
+ throw new RangeError(`Invalid pool size: ${poolTotalOrBuffer}`);
308
+ }
309
+ this.#poolBuffer = Buffer.allocUnsafeSlow(poolTotalOrBuffer);
310
+ }
311
+ else if (poolTotalOrBuffer instanceof Buffer) {
312
+ this.#poolBuffer = poolTotalOrBuffer;
313
+ }
314
+ else if (ArrayBuffer.isView(poolTotalOrBuffer)) {
315
+ this.#poolBuffer = Buffer.from(poolTotalOrBuffer.buffer, poolTotalOrBuffer.byteOffset, poolTotalOrBuffer.byteLength);
316
+ }
317
+ else if (poolTotalOrBuffer instanceof ArrayBuffer ||
318
+ poolTotalOrBuffer instanceof SharedArrayBuffer) {
319
+ this.#poolBuffer = Buffer.from(poolTotalOrBuffer);
320
+ }
321
+ else {
322
+ throw new TypeError('Invalid poolTotalOrBuffer: must be a Buffer, ArrayBufferView, ArrayBuffer, SharedArrayBuffer, or number');
323
+ }
324
+ for (let n = 0; 2 ** n <= 256 * 1024; n++) {
325
+ this.#poolsBucket.push([]);
326
+ this.#poolsBucketUsed.push(0);
327
+ }
456
328
  }
457
-
458
- slice.reset()
459
-
460
- if (byteLength === 0) {
461
- return slice
329
+ get size() {
330
+ return this.#size;
462
331
  }
463
-
464
- const maxByteLength = 1 << dstIdx
465
-
466
- if (dstIdx < this.#poolsBucket.length && this.#poolsBucket[dstIdx].length) {
467
- slice.buffer = this.#poolBuffer
468
- slice.byteOffset = this.#poolsBucket[dstIdx].pop()
469
- slice.byteLength = byteLength
470
- slice.maxByteLength = maxByteLength
471
-
472
- this.#poolsBucketUsed[dstIdx] += 1
473
- this.#poolSize += maxByteLength
474
- this.#size += maxByteLength
475
- this.#padding += maxByteLength - byteLength
476
- } else if (
477
- dstIdx < this.#poolsBucket.length &&
478
- this.#poolOffset + maxByteLength <= this.#poolBuffer.byteLength
479
- ) {
480
- slice.buffer = this.#poolBuffer
481
- slice.byteOffset = this.#poolOffset
482
- slice.byteLength = byteLength
483
- slice.maxByteLength = maxByteLength
484
-
485
- this.#poolOffset += maxByteLength
486
- this.#poolCount += 1
487
- this.#poolsBucketUsed[dstIdx] += 1
488
- this.#poolSize += maxByteLength
489
- this.#size += maxByteLength
490
- this.#padding += maxByteLength - byteLength
491
- } else {
492
- slice.buffer = Buffer.allocUnsafeSlow(byteLength)
493
- slice.byteOffset = 0
494
- slice.byteLength = byteLength
495
- slice.maxByteLength = byteLength
332
+ isFromPool(slice) {
333
+ return slice != null && slice.buffer === this.#poolBuffer;
496
334
  }
497
-
498
- return slice
499
- }
500
-
501
- get stats() {
502
- return {
503
- size: this.#size,
504
- padding: this.#padding,
505
- ratio: this.#size > this.#padding ? this.#size / (this.#size - this.#padding) : 1,
506
- poolTotal: this.#poolBuffer.byteLength,
507
- poolUsed: this.#poolOffset,
508
- poolSize: this.#poolSize,
509
- poolCount: this.#poolCount,
510
- buckets: this.#poolsBucket.map((pool, i) => ({
511
- free: pool.length,
512
- used: this.#poolsBucketUsed[i],
513
- size: pool.length + this.#poolsBucketUsed[i],
514
- })),
335
+ realloc(slice, byteLength) {
336
+ if (typeof slice === 'number') {
337
+ byteLength = slice;
338
+ slice = new Slice();
339
+ }
340
+ if (byteLength == null || !Number.isInteger(byteLength) || byteLength < 0) {
341
+ throw new TypeError(`Invalid byteLength: ${byteLength}`);
342
+ }
343
+ // 2^30 is the largest power-of-two that fits a 32-bit signed int; a
344
+ // larger request overflows `1 << dstIdx` to a negative bucket size.
345
+ if (byteLength > 1 << 30) {
346
+ throw new RangeError(`byteLength too large: ${byteLength} (max ${1 << 30})`);
347
+ }
348
+ if (slice.byteLength === byteLength) {
349
+ return slice;
350
+ }
351
+ // Ceil to nearest power of two — the destination bucket and its byte size.
352
+ const dstIdx = byteLength <= 8 ? 3 : 32 - Math.clz32(byteLength - 1);
353
+ const maxByteLength = 1 << dstIdx;
354
+ if (slice.buffer === this.#poolBuffer) {
355
+ const srcMaxByteLength = slice.maxByteLength;
356
+ // Same-bucket resize is the hot path: just update the logical length and
357
+ // adjust padding by the delta — no bucket bookkeeping, no second clz32,
358
+ // no net change to #size. A free (byteLength === 0) is deliberately
359
+ // excluded so it always falls through to the free-list path below:
360
+ // byteLength 0 maps to dstIdx 3 / maxByteLength 8, which would otherwise
361
+ // match a live bucket-3 slot here and "resize" it to 0 — leaking the slot
362
+ // (never returned to the free list, still counted in #size/#poolSize).
363
+ if (byteLength !== 0 && srcMaxByteLength === maxByteLength) {
364
+ this.#padding += slice.byteLength - byteLength;
365
+ slice.byteLength = byteLength;
366
+ return slice;
367
+ }
368
+ const srcIdx = 32 - Math.clz32(srcMaxByteLength - 1);
369
+ // Corruption tripwire for a foreign/double-freed slice. maxByteLength must
370
+ // be a power of two that maps to a real pool bucket — index in
371
+ // [3, poolsBucket.length). The pool never hands out a slot below bucket 3
372
+ // (8 bytes), so a smaller power of two (1/2/4 → srcIdx 0/1/2) is just as
373
+ // corrupt as an oversized one (e.g. 2^20 → srcIdx 20, out of range):
374
+ // `=== 1 << srcIdx` alone passes both, after which the bucket bookkeeping
375
+ // below would drive an always-empty bucket's `used` count negative (or
376
+ // index a non-existent bucket) and drift #size/#poolSize.
377
+ if (srcMaxByteLength !== 1 << srcIdx || srcIdx < 3 || srcIdx >= this.#poolsBucket.length) {
378
+ throw new Error(`Invalid pool state`);
379
+ }
380
+ this.#size -= srcMaxByteLength;
381
+ this.#padding -= srcMaxByteLength - slice.byteLength;
382
+ this.#poolsBucket[srcIdx].push(slice.byteOffset);
383
+ this.#poolsBucketUsed[srcIdx] -= 1;
384
+ this.#poolSize -= srcMaxByteLength;
385
+ }
386
+ slice.reset();
387
+ if (byteLength === 0) {
388
+ return slice;
389
+ }
390
+ if (dstIdx < this.#poolsBucket.length && this.#poolsBucket[dstIdx].length) {
391
+ slice.buffer = this.#poolBuffer;
392
+ slice.byteOffset = this.#poolsBucket[dstIdx].pop();
393
+ slice.byteLength = byteLength;
394
+ slice.maxByteLength = maxByteLength;
395
+ this.#poolsBucketUsed[dstIdx] += 1;
396
+ this.#poolSize += maxByteLength;
397
+ this.#size += maxByteLength;
398
+ this.#padding += maxByteLength - byteLength;
399
+ }
400
+ else if (dstIdx < this.#poolsBucket.length &&
401
+ this.#poolOffset + maxByteLength <= this.#poolBuffer.byteLength) {
402
+ slice.buffer = this.#poolBuffer;
403
+ slice.byteOffset = this.#poolOffset;
404
+ slice.byteLength = byteLength;
405
+ slice.maxByteLength = maxByteLength;
406
+ this.#poolOffset += maxByteLength;
407
+ this.#poolCount += 1;
408
+ this.#poolsBucketUsed[dstIdx] += 1;
409
+ this.#poolSize += maxByteLength;
410
+ this.#size += maxByteLength;
411
+ this.#padding += maxByteLength - byteLength;
412
+ }
413
+ else {
414
+ slice.buffer = Buffer.allocUnsafeSlow(byteLength);
415
+ slice.byteOffset = 0;
416
+ slice.byteLength = byteLength;
417
+ slice.maxByteLength = byteLength;
418
+ }
419
+ return slice;
420
+ }
421
+ get stats() {
422
+ return {
423
+ size: this.#size,
424
+ padding: this.#padding,
425
+ ratio: this.#size > this.#padding ? this.#size / (this.#size - this.#padding) : 1,
426
+ poolTotal: this.#poolBuffer.byteLength,
427
+ poolUsed: this.#poolOffset,
428
+ poolSize: this.#poolSize,
429
+ poolCount: this.#poolCount,
430
+ buckets: this.#poolsBucket.map((pool, i) => ({
431
+ free: pool.length,
432
+ used: this.#poolsBucketUsed[i],
433
+ size: pool.length + this.#poolsBucketUsed[i],
434
+ })),
435
+ };
515
436
  }
516
- }
517
437
  }
438
+ //# sourceMappingURL=index.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"index.js","sourceRoot":"","sources":["../src/index.ts"],"names":[],"mappings":"AAAA,OAAO,IAAI,MAAM,WAAW,CAAA;AAE5B,MAAM,SAAS,GAAG,MAAM,CAAC,KAAK,CAAC,CAAC,CAAC,CAAA;AAQjC,MAAM,OAAO,KAAK;IAChB,MAAM,GAAW,SAAS,CAAA;IAC1B,UAAU,GAAW,CAAC,CAAA;IACtB,UAAU,GAAW,CAAC,CAAA;IACtB,aAAa,GAAW,CAAC,CAAA;IAEzB,MAAM,KAAK,SAAS;QAClB,OAAO,SAAS,CAAA;IAClB,CAAC;IAED,MAAM,CAAC,IAAI,CAAC,MAAc,EAAE,UAAU,GAAG,CAAC,EAAE,UAAU,GAAG,MAAM,CAAC,UAAU,GAAG,UAAU;QACrF,IAAI,CAAC,CAAC,MAAM,YAAY,MAAM,CAAC,EAAE,CAAC;YAChC,MAAM,IAAI,SAAS,CAAC,yBAAyB,CAAC,CAAA;QAChD,CAAC;QAED,IAAI,UAAU,GAAG,CAAC,IAAI,CAAC,MAAM,CAAC,SAAS,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AAa,GAAG,UAAU,CAAA;QAC7C,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,MAAM,GAAG,MAAM,CAAC,eAAe,CAAC,UAAU,CAAC,CAAA;YACjD,KAAK,CAAC,UAAU,GAAG,CAAC,CAAA;YACpB,KAAK,CAAC,UAAU,GAAG,UAAU,CAAA;YAC7B,KAAK,CAAC,aAAa,GAAG,UAAU,CAAA;QAClC,CAAC;QAED,OAAO,KAAK,CAAA;IACd,CAAC;IAED,IAAI,KAAK;QACP,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,KAAK;YAChB,OAAO,EAAE,IAAI,CAAC,QAAQ;YACtB,KAAK,EAAE,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,IAAI,CAAC,KAAK,GAAG,CAAC,IAAI,CAAC,KAAK,GAAG,IAAI,CAAC,QAAQ,CAAC,CAAC,CAAC,CAAC,CAAC;YACjF,SAAS,EAAE,IAAI,CAAC,WAAW,CAAC,UAAU;YACtC,QAAQ,EAAE,IAAI,CAAC,WAAW;YAC1B,QAAQ,EAAE,IAAI,CAAC,SAAS;YACxB,SAAS,EAAE,IAAI,CAAC,UAAU;YAC1B,OAAO,EAAE,IAAI,CAAC,YAAY,CAAC,GAAG,CAAC,CAAC,IAAI,EAAE,CAAC,EAAE,EAAE,CAAC,CAAC;gBAC3C,IAAI,EAAE,IAAI,CAAC,MAAM;gBACjB,IAAI,EAAE,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;gBAC9B,IAAI,EAAE,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,gBAAgB,CAAC,CAAC,CAAC;aAC7C,CAAC,CAAC;SACJ,CAAA;IACH,CAAC;CACF"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@nxtedition/slice",
3
- "version": "1.1.10",
3
+ "version": "1.1.11",
4
4
  "type": "module",
5
5
  "main": "lib/index.js",
6
6
  "types": "lib/index.d.ts",
@@ -14,7 +14,7 @@
14
14
  "access": "public"
15
15
  },
16
16
  "scripts": {
17
- "build": "rimraf lib && tsc -p tsconfig.build.json && amaroc ./src/index.ts && mv src/index.js lib/",
17
+ "build": "rimraf lib && tsc -p tsconfig.build.json",
18
18
  "prepublishOnly": "yarn build",
19
19
  "typecheck": "tsc --noEmit",
20
20
  "test": "yarn build && node --test",
@@ -24,7 +24,6 @@
24
24
  },
25
25
  "devDependencies": {
26
26
  "@types/node": "^25.5.0",
27
- "amaroc": "^1.0.1",
28
27
  "oxlint-tsgolint": "^0.17.0",
29
28
  "rimraf": "^6.1.3",
30
29
  "tsd": "^0.33.0",