llonebot-dist 7.1.1 → 7.1.3
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/default_config.json +80 -80
- package/llonebot.js +1120 -1192
- package/llonebot.js.map +1 -1
- package/node_modules/@minatojs/sql.js/dist/sql-wasm.wasm +0 -0
- package/node_modules/uint8array-extras/index.d.ts +26 -7
- package/node_modules/uint8array-extras/index.js +9 -12
- package/node_modules/uint8array-extras/package.json +1 -1
- package/node_modules/uint8array-extras/readme.md +20 -3
- package/package.json +1 -1
- package/webui/assets/{index-D7SfQ8t3.js → index-CAnlmz3O.js} +78 -78
- package/webui/index.html +12 -12
- package//344/275/277/347/224/250/350/257/264/346/230/216.txt +4 -4
- package//346/233/264/346/226/260/346/227/245/345/277/227.txt +454 -441
|
File without changes
|
|
@@ -48,10 +48,25 @@ try {
|
|
|
48
48
|
*/
|
|
49
49
|
export function assertUint8Array(value: unknown): asserts value is Uint8Array;
|
|
50
50
|
|
|
51
|
+
/**
|
|
52
|
+
Throw a `TypeError` if the given value is not an instance of `Uint8Array` or `ArrayBuffer`.
|
|
53
|
+
|
|
54
|
+
Useful as a guard for functions that accept either a `Uint8Array` or `ArrayBuffer`.
|
|
55
|
+
|
|
56
|
+
@example
|
|
57
|
+
```
|
|
58
|
+
import {assertUint8ArrayOrArrayBuffer} from 'uint8array-extras';
|
|
59
|
+
|
|
60
|
+
assertUint8ArrayOrArrayBuffer(new Uint8Array());
|
|
61
|
+
assertUint8ArrayOrArrayBuffer(new ArrayBuffer(8));
|
|
62
|
+
```
|
|
63
|
+
*/
|
|
64
|
+
export function assertUint8ArrayOrArrayBuffer(value: unknown): asserts value is Uint8Array | ArrayBuffer;
|
|
65
|
+
|
|
51
66
|
/**
|
|
52
67
|
Convert a value to a `Uint8Array` without copying its data.
|
|
53
68
|
|
|
54
|
-
This can be useful for converting a `Buffer` to a pure `Uint8Array`. `Buffer` is already
|
|
69
|
+
This can be useful for converting a `Buffer` to a pure `Uint8Array`. `Buffer` is already a `Uint8Array` subclass, but [`Buffer` alters some behavior](https://sindresorhus.com/blog/goodbye-nodejs-buffer), so it can be useful to cast it to a pure `Uint8Array` before returning it.
|
|
55
70
|
|
|
56
71
|
Tip: If you want a copy, just call `.slice()` on the return value.
|
|
57
72
|
*/
|
|
@@ -77,7 +92,7 @@ console.log(concatUint8Arrays([a, b]));
|
|
|
77
92
|
//=> Uint8Array [1, 2, 3, 4, 5, 6]
|
|
78
93
|
```
|
|
79
94
|
*/
|
|
80
|
-
export function concatUint8Arrays(arrays: Uint8Array[], totalLength?: number): Uint8Array
|
|
95
|
+
export function concatUint8Arrays(arrays: Uint8Array[], totalLength?: number): Uint8Array<ArrayBuffer>;
|
|
81
96
|
|
|
82
97
|
/**
|
|
83
98
|
Check if two arrays are identical by verifying that they contain the same bytes in the same sequence.
|
|
@@ -159,7 +174,7 @@ console.log(stringToUint8Array('Hello'));
|
|
|
159
174
|
//=> Uint8Array [72, 101, 108, 108, 111]
|
|
160
175
|
```
|
|
161
176
|
*/
|
|
162
|
-
export function stringToUint8Array(string: string): Uint8Array
|
|
177
|
+
export function stringToUint8Array(string: string): Uint8Array<ArrayBuffer>;
|
|
163
178
|
|
|
164
179
|
/**
|
|
165
180
|
Convert a `Uint8Array` to a Base64-encoded string.
|
|
@@ -183,6 +198,8 @@ export function uint8ArrayToBase64(array: Uint8Array, options?: {urlSafe: boolea
|
|
|
183
198
|
/**
|
|
184
199
|
Convert a Base64-encoded or [Base64URL](https://base64.guru/standards/base64url)-encoded string to a `Uint8Array`.
|
|
185
200
|
|
|
201
|
+
Accepts Base64URL with or without padding.
|
|
202
|
+
|
|
186
203
|
Replacement for [`Buffer.from('SGVsbG8=', 'base64')`](https://nodejs.org/api/buffer.html#static-method-bufferfromstring-encoding).
|
|
187
204
|
|
|
188
205
|
@example
|
|
@@ -193,10 +210,10 @@ console.log(base64ToUint8Array('SGVsbG8='));
|
|
|
193
210
|
//=> Uint8Array [72, 101, 108, 108, 111]
|
|
194
211
|
```
|
|
195
212
|
*/
|
|
196
|
-
export function base64ToUint8Array(string: string): Uint8Array
|
|
213
|
+
export function base64ToUint8Array(string: string): Uint8Array<ArrayBuffer>;
|
|
197
214
|
|
|
198
215
|
/**
|
|
199
|
-
Encode a string to Base64-encoded string.
|
|
216
|
+
Encode a string to a Base64-encoded string.
|
|
200
217
|
|
|
201
218
|
Specify `{urlSafe: true}` to get a [Base64URL](https://base64.guru/standards/base64url)-encoded string.
|
|
202
219
|
|
|
@@ -215,6 +232,8 @@ export function stringToBase64(string: string, options?: {urlSafe: boolean}): st
|
|
|
215
232
|
/**
|
|
216
233
|
Decode a Base64-encoded or [Base64URL](https://base64.guru/standards/base64url)-encoded string to a string.
|
|
217
234
|
|
|
235
|
+
Accepts Base64URL with or without padding.
|
|
236
|
+
|
|
218
237
|
Replacement for `Buffer.from('SGVsbG8=', 'base64').toString()` and [`atob()`](https://developer.mozilla.org/en-US/docs/Web/API/atob).
|
|
219
238
|
|
|
220
239
|
@example
|
|
@@ -257,12 +276,12 @@ console.log(hexToUint8Array('48656c6c6f'));
|
|
|
257
276
|
//=> Uint8Array [72, 101, 108, 108, 111]
|
|
258
277
|
```
|
|
259
278
|
*/
|
|
260
|
-
export function hexToUint8Array(hexString: string): Uint8Array
|
|
279
|
+
export function hexToUint8Array(hexString: string): Uint8Array<ArrayBuffer>;
|
|
261
280
|
|
|
262
281
|
/**
|
|
263
282
|
Read `DataView#byteLength` number of bytes from the given view, up to 48-bit.
|
|
264
283
|
|
|
265
|
-
Replacement for [`Buffer#
|
|
284
|
+
Replacement for [`Buffer#readUIntBE`](https://nodejs.org/api/buffer.html#bufreaduintbeoffset-bytelength)
|
|
266
285
|
|
|
267
286
|
@example
|
|
268
287
|
```
|
|
@@ -137,27 +137,24 @@ function base64ToBase64Url(base64) {
|
|
|
137
137
|
}
|
|
138
138
|
|
|
139
139
|
function base64UrlToBase64(base64url) {
|
|
140
|
-
|
|
140
|
+
const base64 = base64url.replaceAll('-', '+').replaceAll('_', '/');
|
|
141
|
+
const padding = (4 - (base64.length % 4)) % 4;
|
|
142
|
+
return base64 + '='.repeat(padding);
|
|
141
143
|
}
|
|
142
144
|
|
|
143
145
|
// Reference: https://phuoc.ng/collection/this-vs-that/concat-vs-push/
|
|
146
|
+
// Important: Keep this value divisible by 3 so intermediate chunks produce no Base64 padding.
|
|
144
147
|
const MAX_BLOCK_SIZE = 65_535;
|
|
145
148
|
|
|
146
149
|
export function uint8ArrayToBase64(array, {urlSafe = false} = {}) {
|
|
147
150
|
assertUint8Array(array);
|
|
148
151
|
|
|
149
|
-
let base64;
|
|
152
|
+
let base64 = '';
|
|
150
153
|
|
|
151
|
-
|
|
152
|
-
|
|
153
|
-
|
|
154
|
-
|
|
155
|
-
base64 = '';
|
|
156
|
-
for (const value of array) {
|
|
157
|
-
base64 += String.fromCodePoint(value);
|
|
158
|
-
}
|
|
159
|
-
|
|
160
|
-
base64 = globalThis.btoa(base64);
|
|
154
|
+
for (let index = 0; index < array.length; index += MAX_BLOCK_SIZE) {
|
|
155
|
+
const chunk = array.subarray(index, index + MAX_BLOCK_SIZE);
|
|
156
|
+
// Required as `btoa` and `atob` don't properly support Unicode: https://developer.mozilla.org/en-US/docs/Glossary/Base64#the_unicode_problem
|
|
157
|
+
base64 += globalThis.btoa(String.fromCodePoint.apply(undefined, chunk));
|
|
161
158
|
}
|
|
162
159
|
|
|
163
160
|
return urlSafe ? base64ToBase64Url(base64) : base64;
|
|
@@ -65,11 +65,24 @@ try {
|
|
|
65
65
|
}
|
|
66
66
|
```
|
|
67
67
|
|
|
68
|
+
### `assertUint8ArrayOrArrayBuffer(value: unknown)`
|
|
69
|
+
|
|
70
|
+
Throw a `TypeError` if the given value is not an instance of `Uint8Array` or `ArrayBuffer`.
|
|
71
|
+
|
|
72
|
+
Useful as a guard for functions that accept either a `Uint8Array` or `ArrayBuffer`.
|
|
73
|
+
|
|
74
|
+
```js
|
|
75
|
+
import {assertUint8ArrayOrArrayBuffer} from 'uint8array-extras';
|
|
76
|
+
|
|
77
|
+
assertUint8ArrayOrArrayBuffer(new Uint8Array());
|
|
78
|
+
assertUint8ArrayOrArrayBuffer(new ArrayBuffer(8));
|
|
79
|
+
```
|
|
80
|
+
|
|
68
81
|
### `toUint8Array(value: TypedArray | ArrayBuffer | DataView): Uint8Array`
|
|
69
82
|
|
|
70
83
|
Convert a value to a `Uint8Array` without copying its data.
|
|
71
84
|
|
|
72
|
-
This can be useful for converting a `Buffer` to a pure `Uint8Array`. `Buffer` is already
|
|
85
|
+
This can be useful for converting a `Buffer` to a pure `Uint8Array`. `Buffer` is already a `Uint8Array` subclass, but [`Buffer` alters some behavior](https://sindresorhus.com/blog/goodbye-nodejs-buffer), so it can be useful to cast it to a pure `Uint8Array` before returning it.
|
|
73
86
|
|
|
74
87
|
Tip: If you want a copy, just call `.slice()` on the return value.
|
|
75
88
|
|
|
@@ -188,6 +201,8 @@ console.log(uint8ArrayToBase64(byteArray));
|
|
|
188
201
|
|
|
189
202
|
Convert a Base64-encoded or [Base64URL](https://base64.guru/standards/base64url)-encoded string to a `Uint8Array`.
|
|
190
203
|
|
|
204
|
+
Accepts Base64URL with or without padding.
|
|
205
|
+
|
|
191
206
|
Replacement for [`Buffer.from('SGVsbG8=', 'base64')`](https://nodejs.org/api/buffer.html#static-method-bufferfromstring-encoding).
|
|
192
207
|
|
|
193
208
|
```js
|
|
@@ -199,7 +214,7 @@ console.log(base64ToUint8Array('SGVsbG8='));
|
|
|
199
214
|
|
|
200
215
|
### `stringToBase64(string: string, options?: {urlSafe: boolean}): string`
|
|
201
216
|
|
|
202
|
-
Encode a string to Base64-encoded string.
|
|
217
|
+
Encode a string to a Base64-encoded string.
|
|
203
218
|
|
|
204
219
|
Specify `{urlSafe: true}` to get a [Base64URL](https://base64.guru/standards/base64url)-encoded string.
|
|
205
220
|
|
|
@@ -216,6 +231,8 @@ console.log(stringToBase64('Hello'));
|
|
|
216
231
|
|
|
217
232
|
Decode a Base64-encoded or [Base64URL](https://base64.guru/standards/base64url)-encoded string to a string.
|
|
218
233
|
|
|
234
|
+
Accepts Base64URL with or without padding.
|
|
235
|
+
|
|
219
236
|
Replacement for `Buffer.from('SGVsbG8=', 'base64').toString()` and [`atob()`](https://developer.mozilla.org/en-US/docs/Web/API/atob).
|
|
220
237
|
|
|
221
238
|
```js
|
|
@@ -257,7 +274,7 @@ console.log(hexToUint8Array('48656c6c6f'));
|
|
|
257
274
|
|
|
258
275
|
Read `DataView#byteLength` number of bytes from the given view, up to 48-bit.
|
|
259
276
|
|
|
260
|
-
Replacement for [`Buffer#
|
|
277
|
+
Replacement for [`Buffer#readUIntBE`](https://nodejs.org/api/buffer.html#bufreaduintbeoffset-bytelength)
|
|
261
278
|
|
|
262
279
|
```js
|
|
263
280
|
import {getUintBE} from 'uint8array-extras';
|
package/package.json
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"name":"llonebot-dist","version":"7.1.
|
|
1
|
+
{"name":"llonebot-dist","version":"7.1.3","type":"module","description":"","main":"llonebot.js","author":"linyuchen","repository":{"type":"git","url":"https://github.com/LLOneBot/LuckyLilliaBot"}}
|