@nberlette/utf8 0.2.0 → 0.3.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 +373 -69
- package/cjs/_internal.d.ts +12 -2
- package/cjs/_internal.js +37 -21
- package/cjs/_internal.js.map +1 -1
- package/cjs/text_decoder.d.ts +14 -1
- package/cjs/text_decoder.js.map +1 -1
- package/cjs/text_decoder_stream.d.ts +2 -0
- package/cjs/text_decoder_stream.js.map +1 -1
- package/cjs/text_encoder.d.ts +3 -1
- package/cjs/text_encoder.js +3 -1
- package/cjs/text_encoder.js.map +1 -1
- package/esm/_internal.d.ts +12 -2
- package/esm/_internal.js +22 -7
- package/esm/_internal.js.map +1 -1
- package/esm/text_decoder.d.ts +14 -1
- package/esm/text_decoder.js.map +1 -1
- package/esm/text_decoder_stream.d.ts +2 -0
- package/esm/text_decoder_stream.js.map +1 -1
- package/esm/text_encoder.d.ts +3 -1
- package/esm/text_encoder.js +3 -1
- package/esm/text_encoder.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -2,22 +2,24 @@
|
|
|
2
2
|
|
|
3
3
|
# [`@nick/utf8`]
|
|
4
4
|
|
|
5
|
-
##### Blazing fast ponyfills for `TextEncoder`, `TextDecoder`, and more.
|
|
5
|
+
##### Blazing fast [ponyfills] for `TextEncoder`, `TextDecoder`, and more.
|
|
6
6
|
|
|
7
|
-
|
|
7
|
+

|
|
8
|
+

|
|
8
9
|
|
|
9
|
-
|
|
10
|
+
</div>
|
|
10
11
|
|
|
11
12
|
## Overview
|
|
12
13
|
|
|
13
|
-
This package provides
|
|
14
|
-
|
|
15
|
-
use in any ES2015+ environment.
|
|
14
|
+
This package provides dependency-free TypeScript implementations of the native
|
|
15
|
+
text encoding classes, designed as [ponyfills] for the following standard APIs.
|
|
16
16
|
|
|
17
|
-
|
|
18
|
-
|
|
19
|
-
|
|
20
|
-
|
|
17
|
+
| API | Description | Notes |
|
|
18
|
+
| --------------------------------------------- | ------------------------------------------ | ------------------------------- |
|
|
19
|
+
| [`TextEncoder`](#textencoder) | Encodes strings into UTF-8 byte sequences. | `--` |
|
|
20
|
+
| [`TextDecoder`](#textdecoder) | Decodes UTF-8 byte sequences into strings. | Currently only supports UTF-8. |
|
|
21
|
+
| [`TextEncoderStream`](#textencoderstream-mdn) | Full-duplex text-to-bytes encoding stream. | Requires `TransformStream` API. |
|
|
22
|
+
| [`TextDecoderStream`](#textdecoderstream-mdn) | Full-duplex bytes-to-text decoding stream. | Requires `TransformStream` API. |
|
|
21
23
|
|
|
22
24
|
[^1]: Requires the `TransformStream` API to be available in the environment.
|
|
23
25
|
|
|
@@ -31,7 +33,7 @@ use in any ES2015+ environment.
|
|
|
31
33
|
</picture>
|
|
32
34
|
|
|
33
35
|
```sh
|
|
34
|
-
deno add
|
|
36
|
+
deno add jsr:@nick/utf8
|
|
35
37
|
```
|
|
36
38
|
|
|
37
39
|
<img align="left" src="https://api.iconify.design/simple-icons:jsr.svg?color=%23fc0" alt="JSR" width="32" height="48" />
|
|
@@ -86,17 +88,43 @@ console.log(decoded); // Hello, World!
|
|
|
86
88
|
|
|
87
89
|
---
|
|
88
90
|
|
|
89
|
-
##
|
|
90
|
-
|
|
91
|
-
### `TextEncoder`
|
|
91
|
+
## `TextEncoder`
|
|
92
92
|
|
|
93
93
|
The `TextEncoder` class encodes strings into UTF-8 byte sequences.
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
### `constructor`
|
|
96
|
+
|
|
97
|
+
Creates a new `TextEncoder` instance.
|
|
98
|
+
|
|
99
|
+
#### Signature
|
|
100
|
+
|
|
101
|
+
```ts ignore
|
|
102
|
+
new TextEncoder();
|
|
103
|
+
```
|
|
104
|
+
|
|
105
|
+
<br /><div align="center">·<b>·</b>•<b>•</b>•<b>·</b>·</div>
|
|
106
|
+
|
|
107
|
+
<a id="textencoder.encode"></a>
|
|
108
|
+
|
|
109
|
+
### `encode` <sup><small>[📚 MDN][textencoderencode-mdn]</small></sup>
|
|
96
110
|
|
|
97
111
|
Encodes the given `input` into a new `Uint8Array`.
|
|
98
112
|
|
|
99
|
-
|
|
113
|
+
#### Signature
|
|
114
|
+
|
|
115
|
+
```ts ignore
|
|
116
|
+
encode(input: string): Uint8Array;
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
##### Parameters
|
|
120
|
+
|
|
121
|
+
- `input`: The string to encode.
|
|
122
|
+
|
|
123
|
+
##### Returns
|
|
124
|
+
|
|
125
|
+
A new `Uint8Array` containing the encoded bytes.
|
|
126
|
+
|
|
127
|
+
#### Example
|
|
100
128
|
|
|
101
129
|
```ts
|
|
102
130
|
import { TextEncoder } from "@nick/utf8";
|
|
@@ -106,11 +134,38 @@ const encoded = encoder.encode("Hello, World!");
|
|
|
106
134
|
console.log(encoded); // Uint8Array([...])
|
|
107
135
|
```
|
|
108
136
|
|
|
109
|
-
|
|
137
|
+
<br /><div align="center">·<b>·</b>•<b>•</b>•<b>·</b>·</div>
|
|
138
|
+
|
|
139
|
+
<a id="textencoder.encodeinto"></a>
|
|
140
|
+
|
|
141
|
+
### `encodeInto` <sup><small>[📚 MDN][textencoderencodeinto-mdn]</small></sup>
|
|
110
142
|
|
|
111
143
|
Encodes an `input` string into an existing `Uint8Array` output buffer.
|
|
112
144
|
|
|
113
|
-
|
|
145
|
+
#### Signature
|
|
146
|
+
|
|
147
|
+
```ts ignore
|
|
148
|
+
encodeInto(input: string, output: Uint8Array): TextEncoderEncodeIntoResult;
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
##### Parameters
|
|
152
|
+
|
|
153
|
+
- `input`: The string to encode.
|
|
154
|
+
- `output`: The output buffer to write the encoded bytes into.
|
|
155
|
+
|
|
156
|
+
##### Returns
|
|
157
|
+
|
|
158
|
+
A [`TextEncoderEncodeIntoResult`] object, containing the number of characters
|
|
159
|
+
read and number of bytes written.
|
|
160
|
+
|
|
161
|
+
> [!NOTE]
|
|
162
|
+
>
|
|
163
|
+
> Refer to the [MDN documentation][textencoderencodeinto-mdn] for more
|
|
164
|
+
> information.
|
|
165
|
+
|
|
166
|
+
[`TextEncoderEncodeIntoResult`]: ./#textencoderencodeintoresult--mdn
|
|
167
|
+
|
|
168
|
+
#### Example
|
|
114
169
|
|
|
115
170
|
```ts
|
|
116
171
|
import { TextEncoder } from "@nick/utf8";
|
|
@@ -121,16 +176,51 @@ const input = "Hello, my name is Nick!"; // 23 characters
|
|
|
121
176
|
const { read, written } = encoder.encodeInto(input, output);
|
|
122
177
|
```
|
|
123
178
|
|
|
124
|
-
|
|
179
|
+
---
|
|
180
|
+
|
|
181
|
+
## `TextDecoder`
|
|
182
|
+
|
|
183
|
+
The `TextDecoder` class decodes encoded byte sequences into strings.
|
|
184
|
+
|
|
185
|
+
### `constructor`
|
|
186
|
+
|
|
187
|
+
Creates a new `TextDecoder` instance with the given `encoding` and `options`.
|
|
188
|
+
|
|
189
|
+
#### Signature
|
|
190
|
+
|
|
191
|
+
```ts ignore
|
|
192
|
+
new TextDecoder(encoding?: string, options?: TextDecoderOptions)
|
|
193
|
+
```
|
|
125
194
|
|
|
126
|
-
|
|
195
|
+
- `encoding`: The encoding to use. Currently, only `"utf-8"` is supported.
|
|
196
|
+
- `options`: An optional [`TextDecoderOptions`](#textdecoderoptions) object.
|
|
127
197
|
|
|
128
|
-
|
|
198
|
+
<br /><div align="center">·<b>·</b>•<b>•</b>•<b>·</b>·</div>
|
|
129
199
|
|
|
130
|
-
|
|
200
|
+
### `decode` <sup><small>[📚 MDN][textdecoderdecode-mdn]</small></sup>
|
|
131
201
|
|
|
132
202
|
Decodes UTF-8 bytes from the given `BufferSource` into a string.
|
|
133
203
|
|
|
204
|
+
#### Signature
|
|
205
|
+
|
|
206
|
+
```ts ignore
|
|
207
|
+
decode(input?: BufferSource, options?: TextDecodeOptions): string;
|
|
208
|
+
```
|
|
209
|
+
|
|
210
|
+
##### Parameters
|
|
211
|
+
|
|
212
|
+
- `input`: The `BufferSource` containing the UTF-8 bytes to decode. If omitted,
|
|
213
|
+
defaults to an empty `Uint8Array`.
|
|
214
|
+
- `options`: An optional [`TextDecodeOptions`](#textdecodeoptions) object.
|
|
215
|
+
|
|
216
|
+
##### Returns
|
|
217
|
+
|
|
218
|
+
The decoded bytes as a string.
|
|
219
|
+
|
|
220
|
+
<br /><div align="center">·<b>·</b>•<b>•</b>•<b>·</b>·</div>
|
|
221
|
+
|
|
222
|
+
#### Example
|
|
223
|
+
|
|
134
224
|
```ts
|
|
135
225
|
import { TextDecoder } from "@nick/utf8";
|
|
136
226
|
|
|
@@ -140,87 +230,274 @@ const decoded = decoder.decode(encoded);
|
|
|
140
230
|
console.log(decoded); // Hello!
|
|
141
231
|
```
|
|
142
232
|
|
|
233
|
+
---
|
|
234
|
+
|
|
235
|
+
## `TextDecoderStream`
|
|
236
|
+
|
|
237
|
+
Provides a full-duplex decoding stream, allowing UTF-8 bytes to be written to
|
|
238
|
+
its writable side, and the decoded strings to be read from its readable side.
|
|
239
|
+
|
|
240
|
+
### `constructor`
|
|
241
|
+
|
|
242
|
+
Creates a new `TextDecoderStream` instance with an optional `encoding` standard
|
|
243
|
+
and `options` to configure the underlying `TextDecoder` instance.
|
|
244
|
+
|
|
245
|
+
#### Signature
|
|
246
|
+
|
|
247
|
+
```ts ignore
|
|
248
|
+
new TextDecoderStream(encoding?: string, options?: TextDecoderOptions)
|
|
249
|
+
```
|
|
250
|
+
|
|
251
|
+
This class supports the same arguments as the `TextDecoder` API, which it uses
|
|
252
|
+
under the hood to perform the decoding. The `fatal` and `ignoreBOM` options,
|
|
253
|
+
just like in the `TextDecoder` class, go on to become read-only properties of
|
|
254
|
+
the same name on the new `TextDecoderStream` instance.
|
|
255
|
+
|
|
256
|
+
##### Parameters
|
|
257
|
+
|
|
258
|
+
- `encoding`: The encoding to use. Currently, only `"utf-8"` is supported.
|
|
259
|
+
- `options`: An optional [`TextDecoderOptions`](#textdecoderoptions) object.
|
|
260
|
+
|
|
143
261
|
<br /><div align="center">·<b>·</b>•<b>•</b>•<b>·</b>·</div>
|
|
144
262
|
|
|
145
|
-
###
|
|
263
|
+
### Properties
|
|
264
|
+
|
|
265
|
+
#### `encoding: string` <sup>[📚 MDN][textdecoderstreamencoding-mdn]</sup>
|
|
146
266
|
|
|
147
|
-
|
|
148
|
-
|
|
267
|
+
The encoding used by the underlying decoder. Represents the value passed to the
|
|
268
|
+
constructor as the `encoding` parameter.
|
|
149
269
|
|
|
150
|
-
|
|
270
|
+
#### `fatal: boolean` <sup>[📚 MDN][textdecoderstreamfatal-mdn]</sup>
|
|
151
271
|
|
|
152
|
-
|
|
272
|
+
Whether to throw an error if the input contains invalid bytes. Represents the
|
|
273
|
+
value passed to the constructor as the `fatal` option.
|
|
274
|
+
|
|
275
|
+
#### `ignoreBOM: boolean` <sup>[📚 MDN][textdecoderstreamignorebom-mdn]</sup>
|
|
276
|
+
|
|
277
|
+
Whether to ignore a leading BOM character in the input. Represents the value
|
|
278
|
+
passed to the constructor as the `ignoreBOM` option.
|
|
279
|
+
|
|
280
|
+
#### `readable: ReadableStream<string>` <sup>[📚 MDN][textdecoderstreamreadable-mdn]</sup>
|
|
281
|
+
|
|
282
|
+
The _output_ side of the duplex stream, from which decoded strings are read.
|
|
283
|
+
|
|
284
|
+
#### `writable: WritableStream<BufferSource>` <sup>[📚 MDN][textdecoderstreamwritable-mdn]</sup>
|
|
285
|
+
|
|
286
|
+
The _input_ side of the duplex, into which `BufferSource` objects are written.
|
|
287
|
+
|
|
288
|
+
Just like the [`TextDecoder`](#textdecoder) API, the `writable` stream supports
|
|
289
|
+
any type of `BufferSource` object (an `ArrayBuffer` or a view of one) as input.
|
|
290
|
+
|
|
291
|
+
<br>
|
|
292
|
+
|
|
293
|
+
> [!IMPORTANT]
|
|
294
|
+
>
|
|
295
|
+
> `TextDecoderStream` requires runtime support for [`TransformStream`].
|
|
296
|
+
|
|
297
|
+
---
|
|
298
|
+
|
|
299
|
+
## `TextEncoderStream`
|
|
300
|
+
|
|
301
|
+
Provides a full-duplex encoding stream, allowing strings to be written to its
|
|
302
|
+
writable side, and the encoded bytes to be read from its readable side.
|
|
303
|
+
|
|
304
|
+
### `constructor`
|
|
305
|
+
|
|
306
|
+
Creates a new `TextEncoderStream` instance with an optional `encoding` standard
|
|
307
|
+
and `options` to configure the underlying `TextEncoder` instance.
|
|
308
|
+
|
|
309
|
+
#### Signature
|
|
153
310
|
|
|
154
311
|
```ts ignore
|
|
155
|
-
|
|
312
|
+
new TextEncoderStream();
|
|
313
|
+
```
|
|
314
|
+
|
|
315
|
+
<br /><div align="center">·<b>·</b>•<b>•</b>•<b>·</b>·</div>
|
|
316
|
+
|
|
317
|
+
### Properties
|
|
318
|
+
|
|
319
|
+
#### `encoding: string` <sup>[📚 MDN][textencoderstreamencoding-mdn]</sup>
|
|
320
|
+
|
|
321
|
+
The encoding used by the underlying encoder. Represents the value passed to the
|
|
322
|
+
constructor as the `encoding` parameter.
|
|
323
|
+
|
|
324
|
+
#### `readable: ReadableStream<Uint8Array>` <sup>[📚 MDN][textencoderstreamreadable-mdn]</sup>
|
|
325
|
+
|
|
326
|
+
The _output_ side of the duplex stream, from which encoded chunks are read.
|
|
327
|
+
|
|
328
|
+
#### `writable: WritableStream<string>` <sup>[📚 MDN][textencoderstreamwritable-mdn]</sup>
|
|
329
|
+
|
|
330
|
+
The _input_ side of the duplex, into which strings are written.
|
|
331
|
+
|
|
332
|
+
<br>
|
|
333
|
+
|
|
334
|
+
> [!IMPORTANT]
|
|
335
|
+
>
|
|
336
|
+
> `TextEncoderStream` requires runtime support for [`TransformStream`].
|
|
337
|
+
|
|
338
|
+
---
|
|
339
|
+
|
|
340
|
+
---
|
|
341
|
+
|
|
342
|
+
## Interfaces and Types
|
|
156
343
|
|
|
157
|
-
|
|
344
|
+
### `TextDecodeOptions`
|
|
158
345
|
|
|
159
|
-
|
|
160
|
-
|
|
161
|
-
|
|
162
|
-
|
|
163
|
-
|
|
346
|
+
Options that can be passed to [`TextDecoder.decode`](./#textdecoder.decode).
|
|
347
|
+
|
|
348
|
+
#### Signature
|
|
349
|
+
|
|
350
|
+
```ts
|
|
351
|
+
interface TextDecodeOptions {
|
|
352
|
+
stream?: boolean;
|
|
353
|
+
}
|
|
164
354
|
```
|
|
165
355
|
|
|
166
|
-
|
|
356
|
+
##### `stream`
|
|
357
|
+
|
|
358
|
+
Boolean flag that indicates the call to `decode` is part of a stream, which
|
|
359
|
+
affects the behavior of the decoder.
|
|
360
|
+
|
|
361
|
+
When set to `true`, incomplete byte sequences will be buffered internally and
|
|
362
|
+
their errors will be suppressed, allowing the stream to continue processing. The
|
|
363
|
+
next call to `decode` will resume decoding from the buffered bytes.
|
|
364
|
+
|
|
365
|
+
> [!TIP]
|
|
366
|
+
>
|
|
367
|
+
> It is important to flush any buffered bytes from the `TextDecoder` internal
|
|
368
|
+
> state once the stream is complete. This can be done by calling `decode` with
|
|
369
|
+
> no arguments, as shown in the example below.
|
|
370
|
+
>
|
|
371
|
+
> ```ts
|
|
372
|
+
> import { TextDecoder } from "@nick/utf8";
|
|
373
|
+
>
|
|
374
|
+
> const decoder = new TextDecoder();
|
|
375
|
+
> const stream = new Uint8Array([0xF0, 0x9F, 0x98, 0x8A]);
|
|
376
|
+
>
|
|
377
|
+
> let result = "";
|
|
378
|
+
> for (const chunk of stream) {
|
|
379
|
+
> result += decoder.decode(chunk, { stream: true });
|
|
380
|
+
> }
|
|
381
|
+
>
|
|
382
|
+
> // Flush any remaining bytes from the internal state.
|
|
383
|
+
> result += decoder.decode();
|
|
384
|
+
> ```
|
|
385
|
+
|
|
386
|
+
<br /><div align="center">·<b>·</b>•<b>•</b>•<b>·</b>·</div>
|
|
387
|
+
|
|
388
|
+
### `TextDecoderOptions`
|
|
389
|
+
|
|
390
|
+
Options that can be passed to the [`TextDecoder`](#textdecoder) and
|
|
391
|
+
[`TextDecoderStream`](#textdecoderstream) class constructors to configure the
|
|
392
|
+
behavior of the decoder instance.
|
|
393
|
+
|
|
394
|
+
#### Signature
|
|
395
|
+
|
|
396
|
+
```ts
|
|
397
|
+
interface TextDecoderOptions {
|
|
398
|
+
fatal?: boolean;
|
|
399
|
+
ignoreBOM?: boolean;
|
|
400
|
+
}
|
|
401
|
+
```
|
|
167
402
|
|
|
168
|
-
##### `
|
|
403
|
+
##### `fatal`
|
|
169
404
|
|
|
170
|
-
|
|
405
|
+
Boolean flag that indicates whether to throw an error if the input contains
|
|
406
|
+
invalid bytes. The value passed to this option will be exposed as the `fatal`
|
|
407
|
+
property on the decoder instance (read-only).
|
|
171
408
|
|
|
172
|
-
|
|
409
|
+
**Default**: `false`
|
|
173
410
|
|
|
174
|
-
|
|
411
|
+
##### `ignoreBOM`
|
|
175
412
|
|
|
176
|
-
|
|
413
|
+
Instructs the `TextDecoder` to ignore a leading BOM character in the input. The
|
|
414
|
+
value passed to this option will be exposed as the `ignoreBOM` property on the
|
|
415
|
+
decoder instance (read-only).
|
|
177
416
|
|
|
178
|
-
|
|
417
|
+
**Default**: `false`
|
|
179
418
|
|
|
180
419
|
<br /><div align="center">·<b>·</b>•<b>•</b>•<b>·</b>·</div>
|
|
181
420
|
|
|
182
|
-
### `
|
|
421
|
+
### `TextEncoderEncodeIntoResult` <sup><small>[📚 MDN][textencoderencodeinto-mdn]</small></sup>
|
|
422
|
+
|
|
423
|
+
The object returned by [`TextEncoder.encodeInto`](./#textencoder.encodeinto),
|
|
424
|
+
containing the number of characters read from the input string and the number of
|
|
425
|
+
bytes written to the output buffer.
|
|
183
426
|
|
|
184
|
-
|
|
185
|
-
to its writable side, and the decoded strings to be read from its readable side.
|
|
427
|
+
#### Signature
|
|
186
428
|
|
|
187
|
-
|
|
188
|
-
|
|
189
|
-
|
|
190
|
-
|
|
429
|
+
```ts
|
|
430
|
+
interface TextEncoderEncodeIntoResult {
|
|
431
|
+
read: number;
|
|
432
|
+
written: number;
|
|
433
|
+
}
|
|
434
|
+
```
|
|
191
435
|
|
|
192
|
-
|
|
436
|
+
##### `read`
|
|
193
437
|
|
|
194
|
-
|
|
438
|
+
The number of characters read from the input string.
|
|
439
|
+
|
|
440
|
+
##### `written`
|
|
441
|
+
|
|
442
|
+
The number of bytes written to the output buffer.
|
|
443
|
+
|
|
444
|
+
---
|
|
445
|
+
|
|
446
|
+
## Polyfill (shim)
|
|
447
|
+
|
|
448
|
+
This package is **not a polyfill**, but rather a **_[ponyfill]_** that doesn't
|
|
449
|
+
overwrite the native implementation. It provides a drop-in replacement for the
|
|
450
|
+
native APIs, allowing you to use them in environments that don't support them.
|
|
451
|
+
|
|
452
|
+
That being said, some users and use cases may indeed require a side-effecting
|
|
453
|
+
polyfill that patches the native APIs. For those cases, you can import the
|
|
454
|
+
`./shim` module, which will gracefully patch the native APIs **as needed**.
|
|
455
|
+
|
|
456
|
+
If the APIs already exist on the global scope, no changes will be made. If the
|
|
457
|
+
`TransformStream` API is not available, the streaming APIs will not be patched.
|
|
195
458
|
|
|
196
459
|
```ts
|
|
197
|
-
import
|
|
460
|
+
import "@nick/utf8/shim";
|
|
198
461
|
|
|
199
|
-
|
|
462
|
+
// The native APIs are now patched if needed.
|
|
463
|
+
console.log(new TextEncoder().encode("Hello, World!"));
|
|
464
|
+
```
|
|
200
465
|
|
|
201
|
-
|
|
202
|
-
writer.write(new Uint8Array([72, 101, 108, 108, 111]));
|
|
203
|
-
writer.close();
|
|
466
|
+
#### Type Definitions and Augmentation
|
|
204
467
|
|
|
205
|
-
|
|
206
|
-
|
|
207
|
-
|
|
208
|
-
|
|
468
|
+
[JSR], the primary distribution channel for this package, does not support type
|
|
469
|
+
augmentation on the global scope. As a result, this package cannot provide an
|
|
470
|
+
"all-in-one" polyfill experience from a single import of the `./shim` module.
|
|
471
|
+
|
|
472
|
+
If you need type definitions for the patched APIs, or if for some reason you're
|
|
473
|
+
only looking for type definitions alone, the `@nick/utf8/shim.d.ts` module has
|
|
474
|
+
ambient declarations for all of the APIs provided by this package.
|
|
475
|
+
|
|
476
|
+
```ts
|
|
477
|
+
import type {} from "@nick/utf8/shim.d.ts";
|
|
209
478
|
```
|
|
210
479
|
|
|
211
|
-
|
|
480
|
+
```ts
|
|
481
|
+
/// <reference types="@nick/utf8/shim.d.ts" />
|
|
482
|
+
```
|
|
212
483
|
|
|
213
|
-
|
|
484
|
+
> Deno users will need to include the `.d.ts` extension as seen above. Users of
|
|
485
|
+
> TypeScript in Node.js / Bun environments _might_ be able to omit that in their
|
|
486
|
+
> triple-slash references, but I'm not 100% certain in that regard.
|
|
214
487
|
|
|
215
|
-
|
|
488
|
+
---
|
|
216
489
|
|
|
217
|
-
|
|
490
|
+
## Compatibility
|
|
218
491
|
|
|
219
|
-
|
|
492
|
+
This package is compatible with all modern browsers, Deno, Node.js, Bun, and
|
|
493
|
+
Cloudflare Workers. The streaming APIs require support for the
|
|
494
|
+
[`TransformStream`] interface, which is available in all of the previously
|
|
495
|
+
mentioned environments.
|
|
220
496
|
|
|
221
|
-
|
|
497
|
+
> If you're running in an environment that doesn't support the `TransformStream`
|
|
498
|
+
> interface, you can find a full-featured polyfill for it in [core-js].
|
|
222
499
|
|
|
223
|
-
|
|
500
|
+
[core-js]: https://github.com/zloirock/core-js "A modular standard library for JavaScript."
|
|
224
501
|
|
|
225
502
|
---
|
|
226
503
|
|
|
@@ -230,8 +507,16 @@ The implementations in this package are highly optimized for performance. They
|
|
|
230
507
|
are written in a way that minimizes the number of allocations and copies, and
|
|
231
508
|
they take advantage of the fastest available APIs in the environment.
|
|
232
509
|
|
|
233
|
-
Take a look at the benchmarks below
|
|
234
|
-
native APIs in Deno
|
|
510
|
+
Take a look at the benchmarks below for a performance sample comparing this
|
|
511
|
+
package side-by-side with the native APIs in Deno v2.1.2.
|
|
512
|
+
|
|
513
|
+
> While benchmarks are far from a definitive measure of performance, they're a
|
|
514
|
+
> good indicator of general performance characteristics. The results may vary
|
|
515
|
+
> depending on the environment, machine, workload, and other factors.
|
|
516
|
+
|
|
517
|
+
<details><summary><b><u>View Benchmarks</u>: <code>@nick/utf8</code></b> <small>vs.</small> <b>Deno v2.1.2</b></summary>
|
|
518
|
+
|
|
519
|
+
<br>
|
|
235
520
|
|
|
236
521
|
```scala
|
|
237
522
|
> deno bench -A --no-check
|
|
@@ -278,6 +563,8 @@ summary
|
|
|
278
563
|
1.37x faster than Native TextEncoderStream
|
|
279
564
|
```
|
|
280
565
|
|
|
566
|
+
</details>
|
|
567
|
+
|
|
281
568
|
---
|
|
282
569
|
|
|
283
570
|
<div align="center">
|
|
@@ -291,8 +578,25 @@ summary
|
|
|
291
578
|
[MIT]: https://nick.mit-license.org "MIT © Nicholas Berlette. All rights reserved."
|
|
292
579
|
[Nicholas Berlette]: https://github.com/nberlette "Nicholas Berlette's GitHub Profile"
|
|
293
580
|
[`@nick/utf8`]: https://jsr.io/@nick/utf8 "Blazing fast ponyfills for `TextEncoder`, `TextDecoder`, and more."
|
|
294
|
-
[
|
|
581
|
+
[ponyfills]: https://ponyfill.com "A polyfill that doesn't overwrite the native implementation."
|
|
295
582
|
[GitHub]: https://github.com/nberlette/utf8#readme "Give me a star on GitHub! :) 🌟"
|
|
296
583
|
[JSR]: https://jsr.io/@nick/utf8 "View on JSR - The JavaScript Registry"
|
|
297
584
|
[NPM]: https://www.npmjs.com/package/@nick/utf8 "View @nberlette/utf8 on NPM"
|
|
298
585
|
[Bugs]: https://github.com/nberlette/utf8/issues "Submit a bug report or feature request"
|
|
586
|
+
|
|
587
|
+
<!-- mdn links -->
|
|
588
|
+
|
|
589
|
+
[`TransformStream`]: https://developer.mozilla.org/en-US/docs/Web/API/TransformStream "View MDN reference for the TransformStream API."
|
|
590
|
+
[textdecoderstream-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream "View MDN reference for the TextDecoderStream API."
|
|
591
|
+
[textdecoderstreamencoding-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/encoding "View MDN reference for the TextDecoderStream.encoding API."
|
|
592
|
+
[textdecoderstreamfatal-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/fatal "View MDN reference for the TextDecoderStream.fatal API."
|
|
593
|
+
[textdecoderstreamignorebom-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/ignoreBOM "View MDN reference for the TextDecoderStream.ignoreBOM API."
|
|
594
|
+
[textdecoderstreamreadable-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/readable "View MDN reference for the TextDecoderStream.readable API."
|
|
595
|
+
[textdecoderstreamwritable-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoderStream/writable "View MDN reference for the TextDecoderStream.writable API."
|
|
596
|
+
[textencoderstream-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream "View MDN reference for the TextEncoderStream API."
|
|
597
|
+
[textencoderstreamencoding-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream/encoding "View MDN reference for the TextEncoderStream.encoding API."
|
|
598
|
+
[textencoderstreamreadable-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream/readable "View MDN reference for the TextEncoderStream.readable API."
|
|
599
|
+
[textencoderstreamwritable-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoderStream/writable "View MDN reference for the TextEncoderStream.writable API."
|
|
600
|
+
[textdecoderdecode-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextDecoder/decode "View MDN reference for the TextDecoder.decode API."
|
|
601
|
+
[textencoderencodeinto-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encodeInto "View MDN reference for the TextEncoder.encodeInto API."
|
|
602
|
+
[textencoderencode-mdn]: https://developer.mozilla.org/en-US/docs/Web/API/TextEncoder/encode "View MDN reference for the TextEncoder.encode API."
|
package/cjs/_internal.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import * as dntShim from "./_dnt.shims.js";
|
|
1
2
|
export declare var undefined: undefined;
|
|
3
|
+
export declare const $global: typeof dntShim.dntGlobalThis;
|
|
2
4
|
type Uncurry<T, This = void> = T extends (this: infer ThisArg, ...args: infer A) => infer R ? [This] extends [void] ? (thisArg: ThisArg, ...args: A) => R : (thisArg: This, ...args: A) => R : T extends (...args: infer A) => infer R ? (thisArg: [This] extends [void] ? unknown : This, ...args: A) => R : never;
|
|
3
|
-
export type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor |
|
|
5
|
+
export type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | BigInt64ArrayConstructor | BigUint64ArrayConstructor | (typeof dntShim.dntGlobalThis extends {
|
|
6
|
+
Float16Array: infer F;
|
|
7
|
+
} ? F : never);
|
|
4
8
|
export type TypedArray = InstanceType<TypedArrayConstructor>;
|
|
5
9
|
type TypedArrayToStringTag = TypedArray[typeof Symbol.toStringTag];
|
|
6
10
|
type TypedArrayFromTag<T extends TypedArrayToStringTag> = TypedArray extends infer A extends TypedArray ? A extends {
|
|
@@ -11,6 +15,9 @@ export declare const Object: typeof globalThis.Object;
|
|
|
11
15
|
export declare const ObjectGetPrototypeOf: (o: any) => any;
|
|
12
16
|
export declare const ObjectDefineProperty: <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T;
|
|
13
17
|
export declare const ObjectGetOwnPropertyDescriptor: (o: any, p: PropertyKey) => PropertyDescriptor | undefined;
|
|
18
|
+
export declare function gracefulDefine<T extends object, K extends PropertyKey, V>(target: T, key: K, value: V): asserts target is T & {
|
|
19
|
+
[P in K]: P extends keyof T ? T[P] : V;
|
|
20
|
+
};
|
|
14
21
|
export declare const toString: (thisArg: unknown) => string;
|
|
15
22
|
export declare const Error: typeof globalThis.Error;
|
|
16
23
|
export declare const TypeError: typeof globalThis.TypeError;
|
|
@@ -28,7 +35,9 @@ export declare const Uint8ArrayPrototypeSlice: Uncurry<typeof Uint8Array.prototy
|
|
|
28
35
|
export declare const Uint8ArrayPrototypeSubarray: Uncurry<typeof Uint8Array.prototype.subarray, Uint8Array>;
|
|
29
36
|
export declare const TypedArray: TypedArrayConstructor;
|
|
30
37
|
export declare const TypedArrayPrototype: InstanceType<TypedArrayConstructor>;
|
|
31
|
-
export declare const TypedArrayPrototypeGetToStringTag:
|
|
38
|
+
export declare const TypedArrayPrototypeGetToStringTag: {
|
|
39
|
+
(target: unknown): TypedArrayToStringTag | undefined;
|
|
40
|
+
};
|
|
32
41
|
export declare const TypedArrayPrototypeSubarray: Uncurry<typeof TypedArrayPrototype.subarray, typeof TypedArrayPrototype>;
|
|
33
42
|
export declare const String: typeof globalThis.String;
|
|
34
43
|
export declare const StringFromCharCode: typeof String.fromCharCode;
|
|
@@ -47,6 +56,7 @@ export declare const PromiseResolve: {
|
|
|
47
56
|
};
|
|
48
57
|
export declare const PromiseReject: <T = never>(reason?: any) => Promise<T>;
|
|
49
58
|
export declare const TransformStream: typeof globalThis.TransformStream;
|
|
59
|
+
export type BufferSource = ArrayBufferLike | ArrayBufferView;
|
|
50
60
|
export declare function getCodePoint(input: string, index: number): number;
|
|
51
61
|
export declare function utf8BytesNeeded(codePoint: number): number;
|
|
52
62
|
export declare function normalizeEncoding(label: string): string;
|
package/cjs/_internal.js
CHANGED
|
@@ -23,23 +23,25 @@ var __importStar = (this && this.__importStar) || function (mod) {
|
|
|
23
23
|
return result;
|
|
24
24
|
};
|
|
25
25
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
26
|
-
exports.TransformStream = exports.PromiseReject = exports.PromiseResolve = exports.Promise = exports.StringPrototypeTrim = exports.StringPrototypeToLowerCase = exports.StringPrototypeCodePointAt = exports.StringPrototypeSlice = exports.StringPrototypeReplace = exports.StringPrototypeCharCodeAt = exports.StringPrototype = exports.StringFromCharCode = exports.String = exports.TypedArrayPrototypeSubarray = exports.TypedArrayPrototypeGetToStringTag = exports.TypedArrayPrototype = exports.TypedArray = exports.Uint8ArrayPrototypeSubarray = exports.Uint8ArrayPrototypeSlice = exports.Uint8Array = exports.SharedArrayBufferPrototypeGetByteLength = exports.SharedArrayBuffer = exports.ArrayBufferPrototypeGetByteLength = exports.ArrayBufferIsView = exports.ArrayBuffer = exports.Symbol = exports.Array = exports.ReferenceError = exports.RangeError = exports.TypeError = exports.Error = exports.toString = exports.ObjectGetOwnPropertyDescriptor = exports.ObjectDefineProperty = exports.ObjectGetPrototypeOf = exports.Object = exports.undefined = void 0;
|
|
26
|
+
exports.TransformStream = exports.PromiseReject = exports.PromiseResolve = exports.Promise = exports.StringPrototypeTrim = exports.StringPrototypeToLowerCase = exports.StringPrototypeCodePointAt = exports.StringPrototypeSlice = exports.StringPrototypeReplace = exports.StringPrototypeCharCodeAt = exports.StringPrototype = exports.StringFromCharCode = exports.String = exports.TypedArrayPrototypeSubarray = exports.TypedArrayPrototypeGetToStringTag = exports.TypedArrayPrototype = exports.TypedArray = exports.Uint8ArrayPrototypeSubarray = exports.Uint8ArrayPrototypeSlice = exports.Uint8Array = exports.SharedArrayBufferPrototypeGetByteLength = exports.SharedArrayBuffer = exports.ArrayBufferPrototypeGetByteLength = exports.ArrayBufferIsView = exports.ArrayBuffer = exports.Symbol = exports.Array = exports.ReferenceError = exports.RangeError = exports.TypeError = exports.Error = exports.toString = exports.ObjectGetOwnPropertyDescriptor = exports.ObjectDefineProperty = exports.ObjectGetPrototypeOf = exports.Object = exports.$global = exports.undefined = void 0;
|
|
27
27
|
exports.isTypedArray = isTypedArray;
|
|
28
|
+
exports.gracefulDefine = gracefulDefine;
|
|
28
29
|
exports.getCodePoint = getCodePoint;
|
|
29
30
|
exports.utf8BytesNeeded = utf8BytesNeeded;
|
|
30
31
|
exports.normalizeEncoding = normalizeEncoding;
|
|
31
32
|
exports.toUint8Array = toUint8Array;
|
|
33
|
+
// deno-lint-ignore-file no-explicit-any
|
|
32
34
|
// deno-lint-ignore no-var
|
|
33
35
|
const dntShim = __importStar(require("./_dnt.shims.js"));
|
|
34
|
-
|
|
36
|
+
exports.$global = (() => {
|
|
35
37
|
try {
|
|
36
38
|
if (typeof dntShim.dntGlobalThis === "object")
|
|
37
39
|
return dntShim.dntGlobalThis;
|
|
38
40
|
return (0, eval)("this");
|
|
39
41
|
}
|
|
40
42
|
catch {
|
|
41
|
-
if (typeof
|
|
42
|
-
return
|
|
43
|
+
if (typeof window === "object")
|
|
44
|
+
return window;
|
|
43
45
|
if (typeof self === "object")
|
|
44
46
|
return self;
|
|
45
47
|
if (typeof global === "object")
|
|
@@ -60,11 +62,11 @@ function isTypedArray(it, type) {
|
|
|
60
62
|
return false;
|
|
61
63
|
}
|
|
62
64
|
}
|
|
63
|
-
exports.Object =
|
|
65
|
+
exports.Object = exports.$global.Object;
|
|
64
66
|
exports.ObjectGetPrototypeOf = exports.Object.getPrototypeOf;
|
|
65
67
|
exports.ObjectDefineProperty = exports.Object.defineProperty;
|
|
66
68
|
exports.ObjectGetOwnPropertyDescriptor = exports.Object.getOwnPropertyDescriptor;
|
|
67
|
-
const Function =
|
|
69
|
+
const Function = exports.$global.Function;
|
|
68
70
|
const FunctionPrototype = Function.prototype;
|
|
69
71
|
const { bind, call } = FunctionPrototype;
|
|
70
72
|
const uncurryThis = (fn) => {
|
|
@@ -79,33 +81,45 @@ function uncurryGetter(o, p) {
|
|
|
79
81
|
function lookupGetter(o, p, _allowUndefined) {
|
|
80
82
|
return (0, exports.ObjectGetOwnPropertyDescriptor)(o, p)?.get ?? (() => exports.undefined);
|
|
81
83
|
}
|
|
82
|
-
// deno-lint-ignore no-explicit-any
|
|
83
84
|
function bindAndRename(fn, thisArg, name = fn.name) {
|
|
84
85
|
const bound = FunctionPrototypeBind(fn, thisArg);
|
|
85
86
|
(0, exports.ObjectDefineProperty)(bound, "name", { value: name });
|
|
86
87
|
return bound;
|
|
87
88
|
}
|
|
89
|
+
function gracefulDefine(target, key, value) {
|
|
90
|
+
if (!(key in target && target[key] !== value)) {
|
|
91
|
+
if (typeof value === "function" && typeof key === "string") {
|
|
92
|
+
// ensure function names are preserved when minified etc.
|
|
93
|
+
(0, exports.ObjectDefineProperty)(value, "name", { value: key });
|
|
94
|
+
}
|
|
95
|
+
(0, exports.ObjectDefineProperty)(target, key, {
|
|
96
|
+
value,
|
|
97
|
+
writable: true,
|
|
98
|
+
enumerable: false,
|
|
99
|
+
configurable: true,
|
|
100
|
+
});
|
|
101
|
+
}
|
|
102
|
+
}
|
|
88
103
|
exports.toString = uncurryThis(exports.Object.prototype.toString);
|
|
89
|
-
exports.Error =
|
|
90
|
-
exports.TypeError =
|
|
91
|
-
exports.RangeError =
|
|
92
|
-
exports.ReferenceError =
|
|
93
|
-
exports.Array =
|
|
94
|
-
exports.Symbol =
|
|
95
|
-
exports.ArrayBuffer =
|
|
104
|
+
exports.Error = exports.$global.Error;
|
|
105
|
+
exports.TypeError = exports.$global.TypeError;
|
|
106
|
+
exports.RangeError = exports.$global.RangeError;
|
|
107
|
+
exports.ReferenceError = exports.$global.ReferenceError;
|
|
108
|
+
exports.Array = exports.$global.Array;
|
|
109
|
+
exports.Symbol = exports.$global.Symbol;
|
|
110
|
+
exports.ArrayBuffer = exports.$global.ArrayBuffer;
|
|
96
111
|
exports.ArrayBufferIsView = exports.ArrayBuffer.isView;
|
|
97
112
|
exports.ArrayBufferPrototypeGetByteLength = uncurryGetter(exports.ArrayBuffer.prototype, "byteLength");
|
|
98
|
-
exports.SharedArrayBuffer =
|
|
113
|
+
exports.SharedArrayBuffer = exports.$global.SharedArrayBuffer;
|
|
99
114
|
exports.SharedArrayBufferPrototypeGetByteLength = uncurryGetter(exports.SharedArrayBuffer.prototype, "byteLength");
|
|
100
|
-
exports.Uint8Array =
|
|
115
|
+
exports.Uint8Array = exports.$global.Uint8Array;
|
|
101
116
|
exports.Uint8ArrayPrototypeSlice = uncurryThis(exports.Uint8Array.prototype.slice);
|
|
102
117
|
exports.Uint8ArrayPrototypeSubarray = uncurryThis(exports.Uint8Array.prototype.subarray);
|
|
103
118
|
exports.TypedArray = (0, exports.ObjectGetPrototypeOf)(exports.Uint8Array);
|
|
104
119
|
exports.TypedArrayPrototype = exports.TypedArray?.prototype;
|
|
105
120
|
exports.TypedArrayPrototypeGetToStringTag = uncurryGetter(exports.TypedArrayPrototype, exports.Symbol.toStringTag);
|
|
106
|
-
exports.TypedArrayPrototypeSubarray
|
|
107
|
-
=
|
|
108
|
-
exports.String = $global.String;
|
|
121
|
+
exports.TypedArrayPrototypeSubarray = uncurryThis(exports.TypedArrayPrototype.subarray);
|
|
122
|
+
exports.String = exports.$global.String;
|
|
109
123
|
exports.StringFromCharCode = exports.String.fromCharCode;
|
|
110
124
|
exports.StringPrototype = exports.String.prototype;
|
|
111
125
|
exports.StringPrototypeCharCodeAt = uncurryThis(exports.StringPrototype.charCodeAt);
|
|
@@ -114,10 +128,12 @@ exports.StringPrototypeSlice = uncurryThis(exports.StringPrototype.slice);
|
|
|
114
128
|
exports.StringPrototypeCodePointAt = uncurryThis(exports.StringPrototype.codePointAt);
|
|
115
129
|
exports.StringPrototypeToLowerCase = uncurryThis(exports.StringPrototype.toLowerCase);
|
|
116
130
|
exports.StringPrototypeTrim = uncurryThis(exports.StringPrototype.trim);
|
|
117
|
-
exports.Promise =
|
|
131
|
+
exports.Promise = exports.$global.Promise;
|
|
118
132
|
exports.PromiseResolve = bindAndRename(exports.Promise.resolve, exports.Promise);
|
|
119
133
|
exports.PromiseReject = bindAndRename(exports.Promise.reject, exports.Promise);
|
|
120
|
-
exports.TransformStream =
|
|
134
|
+
exports.TransformStream = exports.$global.TransformStream || function TransformStream() {
|
|
135
|
+
throw new exports.TypeError("TransformStream is not supported in this environment");
|
|
136
|
+
};
|
|
121
137
|
function getCodePoint(input, index) {
|
|
122
138
|
const first = (0, exports.StringPrototypeCharCodeAt)(input, index);
|
|
123
139
|
if (first >= 0xd800 && first <= 0xdbff) {
|
package/cjs/_internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_internal.js","sourceRoot":"","sources":["../src/_internal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;
|
|
1
|
+
{"version":3,"file":"_internal.js","sourceRoot":"","sources":["../src/_internal.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;;;;;;;;;;;;AAyEA,oCAWC;AAgDD,wCAiBC;AA2FD,oCASC;AAED,0CAKC;AAED,8CAKC;AAED,oCAsBC;AA/RD,wCAAwC;AACxC,0BAA0B;AAC1B,yDAA2C;AAS9B,QAAA,OAAO,GAAiC,CAAC,GAAG,EAAE;IACzD,IAAI,CAAC;QACH,IAAI,OAAO,OAAO,CAAC,aAAa,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC,aAAa,CAAC;QAC5E,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC;QAC9C,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC;QAC9C,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1C,OAAO;QACP,MAAM,gCAAgC,CAAC;IACzC,CAAC;AACH,CAAC,CAAC,EAAE,CAAC;AAiDL,SAAgB,YAAY,CAG1B,EAAW,EACX,IAAoB;IAEpB,IAAI,CAAC;QACH,OAAO,IAAA,yCAAiC,EAAC,EAAgB,CAAC,KAAK,IAAI,CAAC;IACtE,CAAC;IAAC,MAAM,CAAC;QACP,OAAO,KAAK,CAAC;IACf,CAAC;AACH,CAAC;AAEY,QAAA,MAAM,GAA6B,eAAO,CAAC,MAAM,CAAC;AAClD,QAAA,oBAAoB,GAAG,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SAAgB,YAAY,CAAC,KAA2B;IACtD,IAAI,KAAK,IAAI,IAAI,EAAE,CAAC;QAClB,OAAO,IAAI,kBAAU,EAAE,CAAC;IAC1B,CAAC;SAAM,IAAI,YAAY,CAAC,KAAK,EAAE,YAAY,CAAC,EAAE,CAAC;QAC7C,OAAO,KAAK,CAAC;IACf,CAAC;SAAM,IAAI,IAAA,yBAAiB,EAAC,KAAK,CAAC,EAAE,CAAC;QACpC,OAAO,IAAI,kBAAU,CAAC,KAAK,CAAC,MAAM,EAAE,KAAK,CAAC,UAAU,EAAE,KAAK,CAAC,UAAU,CAAC,CAAC;IAC1E,CAAC;SAAM,CAAC;QACN,IAAI,CAAC;YACH,IAAA,+CAAuC,EAAC,KAA0B,CAAC,CAAC;YACpE,OAAO,IAAI,kBAAU,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC;gBACH,IAAA,yCAAiC,EAAC,KAAK,CAAC,CAAC;gBACzC,OAAO,IAAI,kBAAU,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,IAAI,iBAAS,CACjB,mDAAmD,CACpD,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/cjs/text_decoder.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A BufferSource is a source of bytes, such as an ArrayBuffer, TypedArray,
|
|
3
|
+
* SharedArrayBuffer, or DataView.
|
|
4
|
+
*
|
|
5
|
+
* @category Types
|
|
6
|
+
*/
|
|
7
|
+
export type BufferSource = ArrayBufferLike | ArrayBufferView;
|
|
1
8
|
/**
|
|
2
9
|
* Options for the {@linkcode TextDecoder} constructor.
|
|
10
|
+
*
|
|
11
|
+
* @category Types
|
|
3
12
|
*/
|
|
4
13
|
export interface TextDecoderOptions {
|
|
5
14
|
/**
|
|
@@ -14,7 +23,11 @@ export interface TextDecoderOptions {
|
|
|
14
23
|
*/
|
|
15
24
|
ignoreBOM?: boolean;
|
|
16
25
|
}
|
|
17
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Options for the {@linkcode TextDecoder.decode} method.
|
|
28
|
+
*
|
|
29
|
+
* @category Types
|
|
30
|
+
*/
|
|
18
31
|
export interface TextDecodeOptions {
|
|
19
32
|
/**
|
|
20
33
|
* If true, indicates that the data being decoded is part of a larger stream.
|
package/cjs/text_decoder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text_decoder.js","sourceRoot":"","sources":["../src/text_decoder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,iDAQwB;
|
|
1
|
+
{"version":3,"file":"text_decoder.js","sourceRoot":"","sources":["../src/text_decoder.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;GAUG;AACH,iDAQwB;AA2CxB;;;;;;;GAOG;AACH,MAAa,WAAW;IAOtB;;;;OAIG;IACH,YAAY,KAAK,GAAG,OAAO,EAAE,UAA8B,EAAE;QAXpD,wCAAkB;QAClB,qCAAgB;QAChB,yCAAoB;QAE7B,8BAAU,IAAI,yBAAU,CAAC,CAAC,CAAC,EAAC;QAQ1B,uBAAA,IAAI,yBAAa,IAAA,gCAAiB,EAAC,KAAK,CAAC,MAAA,CAAC;QAC1C,uBAAA,IAAI,sBAAU,CAAC,CAAC,OAAO,CAAC,KAAK,MAAA,CAAC;QAC9B,uBAAA,IAAI,0BAAc,CAAC,CAAC,OAAO,CAAC,SAAS,MAAA,CAAC;QAEtC,IAAI,uBAAA,IAAI,6BAAU,KAAK,OAAO,EAAE,CAAC;YAC/B,MAAM,IAAI,wBAAS,CAAC,iBAAiB,KAAK,qBAAqB,CAAC,CAAC;QACnE,CAAC;IACH,CAAC;IAED,oCAAoC;IACpC,IAAI,QAAQ;QACV,OAAO,uBAAA,IAAI,6BAAU,CAA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CAAqC;QACrC,IAAI,CAAC,MAAM;YAAE,uBAAA,IAAI,uBAAW,IAAI,yBAAU,EAAE,MAAA,CAAC;QAE7C,OAAO,MAAM,CAAC;IAChB,CAAC;CACF;AA1MD,kCA0MC"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type TextDecoderOptions } from "./text_decoder.js";
|
|
2
|
+
type BufferSource = ArrayBufferLike | ArrayBufferView;
|
|
2
3
|
/**
|
|
3
4
|
* Zero-dependency ponyfill for the native `TextDecoderStream` Web API.
|
|
4
5
|
*
|
|
@@ -39,3 +40,4 @@ export declare class TextDecoderStream {
|
|
|
39
40
|
*/
|
|
40
41
|
get writable(): WritableStream<BufferSource>;
|
|
41
42
|
}
|
|
43
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text_decoder_stream.js","sourceRoot":"","sources":["../src/text_decoder_stream.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,iDAAgF;AAChF,uDAAyE;
|
|
1
|
+
{"version":3,"file":"text_decoder_stream.js","sourceRoot":"","sources":["../src/text_decoder_stream.ts"],"names":[],"mappings":";;;;;;;;;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,iDAAgF;AAChF,uDAAyE;AAIzE;;;;;;;;;;GAUG;AACH,MAAa,iBAAiB;IAI5B,YACE,KAAK,GAAG,OAAO,EACf,UAA8B,EAAE,SAAS,EAAE,IAAI,EAAwB;QALzE,6CAAsB;QACtB,+CAAkD;QAMhD,uBAAA,IAAI,8BAAY,IAAI,6BAAW,CAAC,KAAK,EAAE,OAAO,CAAC,MAAA,CAAC;QAChD,uBAAA,IAAI,gCAAc,IAAI,8BAAe,CAAC;YACpC,SAAS,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;gBAC/B,IAAI,CAAC;oBACH,MAAM,OAAO,GAAG,uBAAA,IAAI,kCAAS,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,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BAAA,IAAI,oCAAW,CAAC,QAAQ,CAAC;IAClC,CAAC;IAED;;;OAGG;IACH,IAAI,QAAQ;QACV,OAAO,uBAAA,IAAI,oCAAW,CAAC,QAAQ,CAAC;IAClC,CAAC;CACF;AA9ED,8CA8EC"}
|
package/cjs/text_encoder.d.ts
CHANGED
|
@@ -10,7 +10,9 @@ export interface TextEncoderEncodeIntoResult {
|
|
|
10
10
|
written: number;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Encode strings into binary data (in the form of a `Uint8Array`) using the
|
|
14
|
+
* UTF-8 encoding standard. This is a high performance ponyfill for the native
|
|
15
|
+
* `TextEncoder` class.
|
|
14
16
|
*
|
|
15
17
|
* @category Encoding
|
|
16
18
|
* @tags utf-8, encoder
|
package/cjs/text_encoder.js
CHANGED
|
@@ -10,7 +10,9 @@ exports.TextEncoder = void 0;
|
|
|
10
10
|
*/
|
|
11
11
|
const _internal_js_1 = require("./_internal.js");
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Encode strings into binary data (in the form of a `Uint8Array`) using the
|
|
14
|
+
* UTF-8 encoding standard. This is a high performance ponyfill for the native
|
|
15
|
+
* `TextEncoder` class.
|
|
14
16
|
*
|
|
15
17
|
* @category Encoding
|
|
16
18
|
* @tags utf-8, encoder
|
package/cjs/text_encoder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text_encoder.js","sourceRoot":"","sources":["../src/text_encoder.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,iDAKwB;AAcxB
|
|
1
|
+
{"version":3,"file":"text_encoder.js","sourceRoot":"","sources":["../src/text_encoder.ts"],"names":[],"mappings":";;;AAAA;;;;;;GAMG;AACH,iDAKwB;AAcxB;;;;;;;GAOG;AACH,MAAa,WAAW;IACtB;;;OAGG;IACH,IAAI,QAAQ;QACV,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,MAAM,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AAI,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;gBAC7C,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;gBACrD,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;gBAC7C,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;gBACtD,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;gBACrD,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;YAChD,CAAC;YACD,IAAI,EAAE,CAAC;QACT,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF;AAxDD,kCAwDC"}
|
package/esm/_internal.d.ts
CHANGED
|
@@ -1,6 +1,10 @@
|
|
|
1
|
+
import * as dntShim from "./_dnt.shims.js";
|
|
1
2
|
export declare var undefined: undefined;
|
|
3
|
+
export declare const $global: typeof dntShim.dntGlobalThis;
|
|
2
4
|
type Uncurry<T, This = void> = T extends (this: infer ThisArg, ...args: infer A) => infer R ? [This] extends [void] ? (thisArg: ThisArg, ...args: A) => R : (thisArg: This, ...args: A) => R : T extends (...args: infer A) => infer R ? (thisArg: [This] extends [void] ? unknown : This, ...args: A) => R : never;
|
|
3
|
-
export type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor |
|
|
5
|
+
export type TypedArrayConstructor = Int8ArrayConstructor | Uint8ArrayConstructor | Uint8ClampedArrayConstructor | Int16ArrayConstructor | Uint16ArrayConstructor | Int32ArrayConstructor | Uint32ArrayConstructor | Float32ArrayConstructor | Float64ArrayConstructor | BigInt64ArrayConstructor | BigUint64ArrayConstructor | (typeof dntShim.dntGlobalThis extends {
|
|
6
|
+
Float16Array: infer F;
|
|
7
|
+
} ? F : never);
|
|
4
8
|
export type TypedArray = InstanceType<TypedArrayConstructor>;
|
|
5
9
|
type TypedArrayToStringTag = TypedArray[typeof Symbol.toStringTag];
|
|
6
10
|
type TypedArrayFromTag<T extends TypedArrayToStringTag> = TypedArray extends infer A extends TypedArray ? A extends {
|
|
@@ -11,6 +15,9 @@ export declare const Object: typeof globalThis.Object;
|
|
|
11
15
|
export declare const ObjectGetPrototypeOf: (o: any) => any;
|
|
12
16
|
export declare const ObjectDefineProperty: <T>(o: T, p: PropertyKey, attributes: PropertyDescriptor & ThisType<any>) => T;
|
|
13
17
|
export declare const ObjectGetOwnPropertyDescriptor: (o: any, p: PropertyKey) => PropertyDescriptor | undefined;
|
|
18
|
+
export declare function gracefulDefine<T extends object, K extends PropertyKey, V>(target: T, key: K, value: V): asserts target is T & {
|
|
19
|
+
[P in K]: P extends keyof T ? T[P] : V;
|
|
20
|
+
};
|
|
14
21
|
export declare const toString: (thisArg: unknown) => string;
|
|
15
22
|
export declare const Error: typeof globalThis.Error;
|
|
16
23
|
export declare const TypeError: typeof globalThis.TypeError;
|
|
@@ -28,7 +35,9 @@ export declare const Uint8ArrayPrototypeSlice: Uncurry<typeof Uint8Array.prototy
|
|
|
28
35
|
export declare const Uint8ArrayPrototypeSubarray: Uncurry<typeof Uint8Array.prototype.subarray, Uint8Array>;
|
|
29
36
|
export declare const TypedArray: TypedArrayConstructor;
|
|
30
37
|
export declare const TypedArrayPrototype: InstanceType<TypedArrayConstructor>;
|
|
31
|
-
export declare const TypedArrayPrototypeGetToStringTag:
|
|
38
|
+
export declare const TypedArrayPrototypeGetToStringTag: {
|
|
39
|
+
(target: unknown): TypedArrayToStringTag | undefined;
|
|
40
|
+
};
|
|
32
41
|
export declare const TypedArrayPrototypeSubarray: Uncurry<typeof TypedArrayPrototype.subarray, typeof TypedArrayPrototype>;
|
|
33
42
|
export declare const String: typeof globalThis.String;
|
|
34
43
|
export declare const StringFromCharCode: typeof String.fromCharCode;
|
|
@@ -47,6 +56,7 @@ export declare const PromiseResolve: {
|
|
|
47
56
|
};
|
|
48
57
|
export declare const PromiseReject: <T = never>(reason?: any) => Promise<T>;
|
|
49
58
|
export declare const TransformStream: typeof globalThis.TransformStream;
|
|
59
|
+
export type BufferSource = ArrayBufferLike | ArrayBufferView;
|
|
50
60
|
export declare function getCodePoint(input: string, index: number): number;
|
|
51
61
|
export declare function utf8BytesNeeded(codePoint: number): number;
|
|
52
62
|
export declare function normalizeEncoding(label: string): string;
|
package/esm/_internal.js
CHANGED
|
@@ -1,15 +1,16 @@
|
|
|
1
|
+
// deno-lint-ignore-file no-explicit-any
|
|
1
2
|
// deno-lint-ignore no-var
|
|
2
3
|
import * as dntShim from "./_dnt.shims.js";
|
|
3
4
|
export var undefined;
|
|
4
|
-
const $global = (() => {
|
|
5
|
+
export const $global = (() => {
|
|
5
6
|
try {
|
|
6
7
|
if (typeof dntShim.dntGlobalThis === "object")
|
|
7
8
|
return dntShim.dntGlobalThis;
|
|
8
9
|
return (0, eval)("this");
|
|
9
10
|
}
|
|
10
11
|
catch {
|
|
11
|
-
if (typeof
|
|
12
|
-
return
|
|
12
|
+
if (typeof window === "object")
|
|
13
|
+
return window;
|
|
13
14
|
if (typeof self === "object")
|
|
14
15
|
return self;
|
|
15
16
|
if (typeof global === "object")
|
|
@@ -49,12 +50,25 @@ function uncurryGetter(o, p) {
|
|
|
49
50
|
function lookupGetter(o, p, _allowUndefined) {
|
|
50
51
|
return ObjectGetOwnPropertyDescriptor(o, p)?.get ?? (() => undefined);
|
|
51
52
|
}
|
|
52
|
-
// deno-lint-ignore no-explicit-any
|
|
53
53
|
function bindAndRename(fn, thisArg, name = fn.name) {
|
|
54
54
|
const bound = FunctionPrototypeBind(fn, thisArg);
|
|
55
55
|
ObjectDefineProperty(bound, "name", { value: name });
|
|
56
56
|
return bound;
|
|
57
57
|
}
|
|
58
|
+
export function gracefulDefine(target, key, value) {
|
|
59
|
+
if (!(key in target && target[key] !== value)) {
|
|
60
|
+
if (typeof value === "function" && typeof key === "string") {
|
|
61
|
+
// ensure function names are preserved when minified etc.
|
|
62
|
+
ObjectDefineProperty(value, "name", { value: key });
|
|
63
|
+
}
|
|
64
|
+
ObjectDefineProperty(target, key, {
|
|
65
|
+
value,
|
|
66
|
+
writable: true,
|
|
67
|
+
enumerable: false,
|
|
68
|
+
configurable: true,
|
|
69
|
+
});
|
|
70
|
+
}
|
|
71
|
+
}
|
|
58
72
|
export const toString = uncurryThis(Object.prototype.toString);
|
|
59
73
|
export const Error = $global.Error;
|
|
60
74
|
export const TypeError = $global.TypeError;
|
|
@@ -73,8 +87,7 @@ export const Uint8ArrayPrototypeSubarray = uncurryThis(Uint8Array.prototype.suba
|
|
|
73
87
|
export const TypedArray = ObjectGetPrototypeOf(Uint8Array);
|
|
74
88
|
export const TypedArrayPrototype = TypedArray?.prototype;
|
|
75
89
|
export const TypedArrayPrototypeGetToStringTag = uncurryGetter(TypedArrayPrototype, Symbol.toStringTag);
|
|
76
|
-
export const TypedArrayPrototypeSubarray
|
|
77
|
-
= uncurryThis(TypedArrayPrototype.subarray);
|
|
90
|
+
export const TypedArrayPrototypeSubarray = uncurryThis(TypedArrayPrototype.subarray);
|
|
78
91
|
export const String = $global.String;
|
|
79
92
|
export const StringFromCharCode = String.fromCharCode;
|
|
80
93
|
export const StringPrototype = String.prototype;
|
|
@@ -87,7 +100,9 @@ export const StringPrototypeTrim = uncurryThis(StringPrototype.trim);
|
|
|
87
100
|
export const Promise = $global.Promise;
|
|
88
101
|
export const PromiseResolve = bindAndRename(Promise.resolve, Promise);
|
|
89
102
|
export const PromiseReject = bindAndRename(Promise.reject, Promise);
|
|
90
|
-
export const TransformStream = $global.TransformStream
|
|
103
|
+
export const TransformStream = $global.TransformStream || function TransformStream() {
|
|
104
|
+
throw new TypeError("TransformStream is not supported in this environment");
|
|
105
|
+
};
|
|
91
106
|
export function getCodePoint(input, index) {
|
|
92
107
|
const first = StringPrototypeCharCodeAt(input, index);
|
|
93
108
|
if (first >= 0xd800 && first <= 0xdbff) {
|
package/esm/_internal.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"_internal.js","sourceRoot":"","sources":["../src/_internal.ts"],"names":[],"mappings":"AAAA,0BAA0B;AAC1B,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAE3C,MAAM,CAAC,IAAI,SAAoB,CAAC;
|
|
1
|
+
{"version":3,"file":"_internal.js","sourceRoot":"","sources":["../src/_internal.ts"],"names":[],"mappings":"AAAA,wCAAwC;AACxC,0BAA0B;AAC1B,OAAO,KAAK,OAAO,MAAM,iBAAiB,CAAC;AAE3C,MAAM,CAAC,IAAI,SAAoB,CAAC;AAOhC,MAAM,CAAC,MAAM,OAAO,GAAiC,CAAC,GAAG,EAAE;IACzD,IAAI,CAAC;QACH,IAAI,OAAO,OAAO,CAAC,aAAa,KAAK,QAAQ;YAAE,OAAO,OAAO,CAAC,aAAa,CAAC;QAC5E,OAAO,CAAC,CAAC,EAAE,IAAI,CAAC,CAAC,MAAM,CAAC,CAAC;IAC3B,CAAC;IAAC,MAAM,CAAC;QACP,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC;QAC9C,IAAI,OAAO,IAAI,KAAK,QAAQ;YAAE,OAAO,IAAI,CAAC;QAC1C,IAAI,OAAO,MAAM,KAAK,QAAQ;YAAE,OAAO,MAAM,CAAC;QAC9C,IAAI,OAAO,IAAI,KAAK,QAA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N,IAAI,CAAC;YACH,uCAAuC,CAAC,KAA0B,CAAC,CAAC;YACpE,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;QAC/B,CAAC;QAAC,OAAO,CAAC,EAAE,CAAC;YACX,IAAI,CAAC;gBACH,iCAAiC,CAAC,KAAK,CAAC,CAAC;gBACzC,OAAO,IAAI,UAAU,CAAC,KAAK,CAAC,CAAC;YAC/B,CAAC;YAAC,OAAO,CAAC,EAAE,CAAC;gBACX,MAAM,IAAI,SAAS,CACjB,mDAAmD,CACpD,CAAC;YACJ,CAAC;QACH,CAAC;IACH,CAAC;AACH,CAAC"}
|
package/esm/text_decoder.d.ts
CHANGED
|
@@ -1,5 +1,14 @@
|
|
|
1
|
+
/**
|
|
2
|
+
* A BufferSource is a source of bytes, such as an ArrayBuffer, TypedArray,
|
|
3
|
+
* SharedArrayBuffer, or DataView.
|
|
4
|
+
*
|
|
5
|
+
* @category Types
|
|
6
|
+
*/
|
|
7
|
+
export type BufferSource = ArrayBufferLike | ArrayBufferView;
|
|
1
8
|
/**
|
|
2
9
|
* Options for the {@linkcode TextDecoder} constructor.
|
|
10
|
+
*
|
|
11
|
+
* @category Types
|
|
3
12
|
*/
|
|
4
13
|
export interface TextDecoderOptions {
|
|
5
14
|
/**
|
|
@@ -14,7 +23,11 @@ export interface TextDecoderOptions {
|
|
|
14
23
|
*/
|
|
15
24
|
ignoreBOM?: boolean;
|
|
16
25
|
}
|
|
17
|
-
/**
|
|
26
|
+
/**
|
|
27
|
+
* Options for the {@linkcode TextDecoder.decode} method.
|
|
28
|
+
*
|
|
29
|
+
* @category Types
|
|
30
|
+
*/
|
|
18
31
|
export interface TextDecodeOptions {
|
|
19
32
|
/**
|
|
20
33
|
* If true, indicates that the data being decoded is part of a larger stream.
|
package/esm/text_decoder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text_decoder.js","sourceRoot":"","sources":["../src/text_decoder.ts"],"names":[],"mappings":";;;;;;;;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K,GAAG,IAAI,CAAC,KAAK,IAAI;oBACvB,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI;oBACvB,CAAC,KAAK,GAAG,IAAI,CAAC,KAAK,IAAI,EACvB,CAAC;oBACD,IAAI,IAAI,CAAC,KAAK;wBAAE,MAAM,IAAI,SAAS,CAAC,4BAA4B,CAAC,CAAC;oBAClE,MAAM,IAAI,QAAQ,CAAC;oBACnB,CAAC,GAAG,UAAU,GAAG,CAAC,CAAC;oBACnB,SAAS;gBACX,CAAC;gBACD,IAAI,SAAS,GAAG,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;oBACpC,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,EAAE,CAAC;oBACtB,CAAC,CAAC,KAAK,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC;oBACrB,CAAC,KAAK,GAAG,IAAI,CAAC,CAAC;gBACjB,SAAS,IAAI,OAAO,CAAC;gBACrB,MAAM,IAAI,kBAAkB,CAC1B,MAAM,GAAG,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,GAAG,KAAK,CAAC,EACpC,MAAM,GAAG,CAAC,SAAS,GAAG,KAAK,CAAC,CAC7B,CAAC;YACJ,CAAC;iBAAM,CAAC;gBACN,IAAI,IAAI,CAAC,KAAK;oBAAE,MAAM,IAAI,SAAS,CAAC,cAAc,CAAC,CAAC;gBACpD,MAAM,IAAI,QAAQ,CAAC;YACrB,CAAC;QACH,CAAC;QAED,qCAAqC;QACrC,IAAI,CAAC,MAAM;YAAE,uBAAA,IAAI,uBAAW,IAAI,UAAU,EAAE,MAAA,CAAC;QAE7C,OAAO,MAAM,CAAC;IAChB,CAAC;CACF"}
|
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { type TextDecoderOptions } from "./text_decoder.js";
|
|
2
|
+
type BufferSource = ArrayBufferLike | ArrayBufferView;
|
|
2
3
|
/**
|
|
3
4
|
* Zero-dependency ponyfill for the native `TextDecoderStream` Web API.
|
|
4
5
|
*
|
|
@@ -39,3 +40,4 @@ export declare class TextDecoderStream {
|
|
|
39
40
|
*/
|
|
40
41
|
get writable(): WritableStream<BufferSource>;
|
|
41
42
|
}
|
|
43
|
+
export {};
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text_decoder_stream.js","sourceRoot":"","sources":["../src/text_decoder_stream.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;
|
|
1
|
+
{"version":3,"file":"text_decoder_stream.js","sourceRoot":"","sources":["../src/text_decoder_stream.ts"],"names":[],"mappings":";;;;;;;;;;;;AAAA;;;;;;;;;;;;;GAaG;AACH,OAAO,EAAE,aAAa,EAAE,cAAc,EAAE,eAAe,EAAE,MAAM,gBAAgB,CAAC;AAChF,OAAO,EAAE,WAAW,EAA2B,MAAM,mBAAmB,CAAC;AAIzE;;;;;;;;;;GAUG;AACH,MAAM,OAAO,iBAAiB;IAI5B,YACE,KAAK,GAAG,OAAO,EACf,UAA8B,EAAE,SAAS,EAAE,IAAI,EAAwB;QALzE,6CAAsB;QACtB,+CAAkD;QAMhD,uBAAA,IAAI,8BAAY,IAAI,WAAW,CAAC,KAAK,EAAE,OAAO,CAAC,MAAA,CAAC;QAChD,uBAAA,IAAI,gCAAc,IAAI,eAAe,CAAC;YACpC,SAAS,EAAE,CAAC,KAAK,EAAE,UAAU,EAAE,EAAE;gBAC/B,IAAI,CAAC;oBACH,MAAM,OAAO,GAAG,uBAAA,IAAI,kCAAS,CAAC,MAAM,CAAC,KAAK,EAAE,EAAE,MAAM,EAAE,IAAI,EAAE,CAAC,CAAC;oBAC9D,IAAI,OAAO;wBAAE,UAAU,CAAC,OAAO,CAAC,OAAO,CAAC,CAAC;oBACzC,OAAO,cAAc,EA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ts
CHANGED
|
@@ -10,7 +10,9 @@ export interface TextEncoderEncodeIntoResult {
|
|
|
10
10
|
written: number;
|
|
11
11
|
}
|
|
12
12
|
/**
|
|
13
|
-
*
|
|
13
|
+
* Encode strings into binary data (in the form of a `Uint8Array`) using the
|
|
14
|
+
* UTF-8 encoding standard. This is a high performance ponyfill for the native
|
|
15
|
+
* `TextEncoder` class.
|
|
14
16
|
*
|
|
15
17
|
* @category Encoding
|
|
16
18
|
* @tags utf-8, encoder
|
package/esm/text_encoder.js
CHANGED
|
@@ -7,7 +7,9 @@
|
|
|
7
7
|
*/
|
|
8
8
|
import { getCodePoint, Uint8Array, Uint8ArrayPrototypeSubarray, utf8BytesNeeded, } from "./_internal.js";
|
|
9
9
|
/**
|
|
10
|
-
*
|
|
10
|
+
* Encode strings into binary data (in the form of a `Uint8Array`) using the
|
|
11
|
+
* UTF-8 encoding standard. This is a high performance ponyfill for the native
|
|
12
|
+
* `TextEncoder` class.
|
|
11
13
|
*
|
|
12
14
|
* @category Encoding
|
|
13
15
|
* @tags utf-8, encoder
|
package/esm/text_encoder.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"text_encoder.js","sourceRoot":"","sources":["../src/text_encoder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,YAAY,EACZ,UAAU,EACV,2BAA2B,EAC3B,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAcxB
|
|
1
|
+
{"version":3,"file":"text_encoder.js","sourceRoot":"","sources":["../src/text_encoder.ts"],"names":[],"mappings":"AAAA;;;;;;GAMG;AACH,OAAO,EACL,YAAY,EACZ,UAAU,EACV,2BAA2B,EAC3B,eAAe,GAChB,MAAM,gBAAgB,CAAC;AAcxB;;;;;;;GAOG;AACH,MAAM,OAAO,WAAW;IACtB;;;OAGG;IACH,IAAI,QAAQ;QACV,OAAO,OAAO,CAAC;IACjB,CAAC;IAED;;;;;OAKG;IACH,MAAM,CAAC,KAAK,GAAG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C,CAAC;gBAC7C,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;gBACrD,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;YAChD,CAAC;iBAAM,CAAC;gBACN,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,IAAI,EAAE,CAAC,CAAC;gBAC7C,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;gBACtD,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,CAAC,SAAS,IAAI,CAAC,CAAC,GAAG,IAAI,CAAC,CAAC;gBACrD,MAAM,CAAC,OAAO,EAAE,CAAC,GAAG,IAAI,GAAG,CAAC,SAAS,GAAG,IAAI,CAAC,CAAC;YAChD,CAAC;YACD,IAAI,EAAE,CAAC;QACT,CAAC;QACD,OAAO,EAAE,IAAI,EAAE,OAAO,EAAE,CAAC;IAC3B,CAAC;CACF"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@nberlette/utf8",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.3.0",
|
|
4
4
|
"description": "Blazing fast universal ponyfills for TextEncoder and TextDecoder.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"text-encoder",
|
|
@@ -68,7 +68,7 @@
|
|
|
68
68
|
},
|
|
69
69
|
"default": "./esm/text_decoder.js"
|
|
70
70
|
},
|
|
71
|
-
"./
|
|
71
|
+
"./shim": {
|
|
72
72
|
"types": "./esm/shim.d.ts",
|
|
73
73
|
"import": {
|
|
74
74
|
"types": "./esm/shim.d.ts",
|
|
@@ -80,7 +80,7 @@
|
|
|
80
80
|
},
|
|
81
81
|
"default": "./esm/shim.js"
|
|
82
82
|
},
|
|
83
|
-
"./shim": {
|
|
83
|
+
"./shim.d.ts": {
|
|
84
84
|
"types": "./esm/shim.d.ts",
|
|
85
85
|
"import": {
|
|
86
86
|
"types": "./esm/shim.d.ts",
|