@jsonjoy.com/json-pack 1.0.1 → 1.0.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/lib/__demos__/json.js +1 -1
- package/lib/__demos__/json.js.map +1 -1
- package/lib/__demos__/ubjson.js +1 -1
- package/lib/__demos__/ubjson.js.map +1 -1
- package/lib/bencode/BencodeDecoder.d.ts +1 -1
- package/lib/bencode/BencodeDecoder.js +1 -1
- package/lib/bencode/BencodeDecoder.js.map +1 -1
- package/lib/bencode/BencodeEncoder.d.ts +1 -1
- package/lib/bencode/BencodeEncoder.js +2 -2
- package/lib/bencode/BencodeEncoder.js.map +1 -1
- package/lib/bson/BsonEncoder.d.ts +1 -1
- package/lib/cbor/CborDecoder.d.ts +1 -1
- package/lib/cbor/CborDecoderBase.d.ts +2 -2
- package/lib/cbor/CborDecoderBase.js +3 -3
- package/lib/cbor/CborDecoderBase.js.map +1 -1
- package/lib/cbor/CborEncoder.d.ts +1 -1
- package/lib/cbor/CborEncoder.js +1 -1
- package/lib/cbor/CborEncoder.js.map +1 -1
- package/lib/cbor/CborEncoderFast.d.ts +2 -2
- package/lib/cbor/CborEncoderFast.js +1 -1
- package/lib/cbor/CborEncoderFast.js.map +1 -1
- package/lib/cbor/CborEncoderStable.js +2 -2
- package/lib/cbor/CborEncoderStable.js.map +1 -1
- package/lib/cbor/shared.d.ts +2 -2
- package/lib/codecs/Codecs.d.ts +1 -1
- package/lib/codecs/cbor.d.ts +1 -1
- package/lib/codecs/json.d.ts +1 -1
- package/lib/codecs/msgpack.d.ts +1 -1
- package/lib/ion/IonEncoderFast.d.ts +1 -1
- package/lib/ion/IonEncoderFast.js +1 -1
- package/lib/ion/IonEncoderFast.js.map +1 -1
- package/lib/ion/ast.js +1 -1
- package/lib/ion/ast.js.map +1 -1
- package/lib/json/JsonDecoder.d.ts +1 -1
- package/lib/json/JsonDecoder.js +2 -2
- package/lib/json/JsonDecoder.js.map +1 -1
- package/lib/json/JsonEncoder.d.ts +1 -1
- package/lib/json/JsonEncoderStable.js +2 -2
- package/lib/json/JsonEncoderStable.js.map +1 -1
- package/lib/json-binary/codec.js +1 -1
- package/lib/json-binary/codec.js.map +1 -1
- package/lib/json-binary/types.d.ts +1 -1
- package/lib/msgpack/MsgPackDecoder.d.ts +1 -1
- package/lib/msgpack/MsgPackDecoderFast.d.ts +2 -2
- package/lib/msgpack/MsgPackDecoderFast.js +2 -2
- package/lib/msgpack/MsgPackDecoderFast.js.map +1 -1
- package/lib/msgpack/MsgPackEncoder.d.ts +1 -1
- package/lib/msgpack/MsgPackEncoder.js +1 -1
- package/lib/msgpack/MsgPackEncoder.js.map +1 -1
- package/lib/msgpack/MsgPackEncoderFast.d.ts +1 -1
- package/lib/msgpack/MsgPackEncoderFast.js +1 -1
- package/lib/msgpack/MsgPackEncoderFast.js.map +1 -1
- package/lib/msgpack/MsgPackEncoderStable.js +1 -1
- package/lib/msgpack/MsgPackEncoderStable.js.map +1 -1
- package/lib/msgpack/MsgPackToJsonConverter.d.ts +1 -1
- package/lib/msgpack/MsgPackToJsonConverter.js +1 -1
- package/lib/msgpack/MsgPackToJsonConverter.js.map +1 -1
- package/lib/msgpack/shallow-read.js +1 -1
- package/lib/msgpack/shallow-read.js.map +1 -1
- package/lib/msgpack/types.d.ts +1 -1
- package/lib/msgpack/util.d.ts +3 -3
- package/lib/resp/RespDecoder.d.ts +1 -1
- package/lib/resp/RespDecoder.js +2 -2
- package/lib/resp/RespDecoder.js.map +1 -1
- package/lib/resp/RespEncoder.d.ts +2 -2
- package/lib/resp/RespEncoder.js +2 -2
- package/lib/resp/RespEncoder.js.map +1 -1
- package/lib/resp/RespEncoderLegacy.d.ts +1 -1
- package/lib/resp/RespStreamingDecoder.d.ts +1 -1
- package/lib/resp/RespStreamingDecoder.js +1 -1
- package/lib/resp/RespStreamingDecoder.js.map +1 -1
- package/lib/types.d.ts +1 -1
- package/lib/ubjson/UbjsonDecoder.d.ts +1 -1
- package/lib/ubjson/UbjsonDecoder.js +1 -1
- package/lib/ubjson/UbjsonDecoder.js.map +1 -1
- package/lib/ubjson/UbjsonEncoder.d.ts +1 -1
- package/package.json +2 -1
- package/lib/json-brand/index.d.ts +0 -3
- package/lib/json-brand/index.js +0 -5
- package/lib/json-brand/index.js.map +0 -1
- package/lib/json-brand/types.d.ts +0 -10
- package/lib/json-brand/types.js +0 -3
- package/lib/json-brand/types.js.map +0 -1
- package/lib/json-equal/$$deepEqual/index.d.ts +0 -1
- package/lib/json-equal/$$deepEqual/index.js +0 -5
- package/lib/json-equal/$$deepEqual/index.js.map +0 -1
- package/lib/json-equal/$$deepEqual/v1.d.ts +0 -2
- package/lib/json-equal/$$deepEqual/v1.js +0 -52
- package/lib/json-equal/$$deepEqual/v1.js.map +0 -1
- package/lib/json-equal/deepEqual/index.d.ts +0 -1
- package/lib/json-equal/deepEqual/index.js +0 -5
- package/lib/json-equal/deepEqual/index.js.map +0 -1
- package/lib/json-equal/deepEqual/v1.d.ts +0 -1
- package/lib/json-equal/deepEqual/v1.js +0 -34
- package/lib/json-equal/deepEqual/v1.js.map +0 -1
- package/lib/json-equal/deepEqual/v2.d.ts +0 -1
- package/lib/json-equal/deepEqual/v2.js +0 -37
- package/lib/json-equal/deepEqual/v2.js.map +0 -1
- package/lib/json-equal/deepEqual/v3.d.ts +0 -1
- package/lib/json-equal/deepEqual/v3.js +0 -37
- package/lib/json-equal/deepEqual/v3.js.map +0 -1
- package/lib/json-equal/deepEqual/v4.d.ts +0 -1
- package/lib/json-equal/deepEqual/v4.js +0 -34
- package/lib/json-equal/deepEqual/v4.js.map +0 -1
- package/lib/json-random/RandomJson.d.ts +0 -39
- package/lib/json-random/RandomJson.js +0 -267
- package/lib/json-random/RandomJson.js.map +0 -1
- package/lib/json-random/__demos__/json-random.d.ts +0 -1
- package/lib/json-random/__demos__/json-random.js +0 -35
- package/lib/json-random/__demos__/json-random.js.map +0 -1
- package/lib/json-random/index.d.ts +0 -1
- package/lib/json-random/index.js +0 -5
- package/lib/json-random/index.js.map +0 -1
- package/lib/util/Fuzzer.d.ts +0 -13
- package/lib/util/Fuzzer.js +0 -59
- package/lib/util/Fuzzer.js.map +0 -1
- package/lib/util/NullObject.d.ts +0 -1
- package/lib/util/NullObject.js +0 -6
- package/lib/util/NullObject.js.map +0 -1
- package/lib/util/buffers/Reader.d.ts +0 -22
- package/lib/util/buffers/Reader.js +0 -91
- package/lib/util/buffers/Reader.js.map +0 -1
- package/lib/util/buffers/Slice.d.ts +0 -8
- package/lib/util/buffers/Slice.js +0 -16
- package/lib/util/buffers/Slice.js.map +0 -1
- package/lib/util/buffers/StreamingOctetReader.d.ts +0 -18
- package/lib/util/buffers/StreamingOctetReader.js +0 -168
- package/lib/util/buffers/StreamingOctetReader.js.map +0 -1
- package/lib/util/buffers/StreamingReader.d.ts +0 -31
- package/lib/util/buffers/StreamingReader.js +0 -131
- package/lib/util/buffers/StreamingReader.js.map +0 -1
- package/lib/util/buffers/Uint8ArrayCut.d.ts +0 -6
- package/lib/util/buffers/Uint8ArrayCut.js +0 -12
- package/lib/util/buffers/Uint8ArrayCut.js.map +0 -1
- package/lib/util/buffers/Writer.d.ts +0 -33
- package/lib/util/buffers/Writer.js +0 -217
- package/lib/util/buffers/Writer.js.map +0 -1
- package/lib/util/buffers/b.d.ts +0 -1
- package/lib/util/buffers/b.js +0 -6
- package/lib/util/buffers/b.js.map +0 -1
- package/lib/util/buffers/bufferToUint8Array.d.ts +0 -2
- package/lib/util/buffers/bufferToUint8Array.js +0 -6
- package/lib/util/buffers/bufferToUint8Array.js.map +0 -1
- package/lib/util/buffers/cmpUint8Array.d.ts +0 -1
- package/lib/util/buffers/cmpUint8Array.js +0 -14
- package/lib/util/buffers/cmpUint8Array.js.map +0 -1
- package/lib/util/buffers/cmpUint8Array2.d.ts +0 -1
- package/lib/util/buffers/cmpUint8Array2.js +0 -16
- package/lib/util/buffers/cmpUint8Array2.js.map +0 -1
- package/lib/util/buffers/cmpUint8Array3.d.ts +0 -1
- package/lib/util/buffers/cmpUint8Array3.js +0 -18
- package/lib/util/buffers/cmpUint8Array3.js.map +0 -1
- package/lib/util/buffers/concat.d.ts +0 -3
- package/lib/util/buffers/concat.js +0 -36
- package/lib/util/buffers/concat.js.map +0 -1
- package/lib/util/buffers/copy.d.ts +0 -1
- package/lib/util/buffers/copy.js +0 -10
- package/lib/util/buffers/copy.js.map +0 -1
- package/lib/util/buffers/f16.d.ts +0 -1
- package/lib/util/buffers/f16.js +0 -18
- package/lib/util/buffers/f16.js.map +0 -1
- package/lib/util/buffers/index.d.ts +0 -1
- package/lib/util/buffers/index.js +0 -5
- package/lib/util/buffers/index.js.map +0 -1
- package/lib/util/buffers/isArrayBuffer.d.ts +0 -1
- package/lib/util/buffers/isArrayBuffer.js +0 -8
- package/lib/util/buffers/isArrayBuffer.js.map +0 -1
- package/lib/util/buffers/isFloat32.d.ts +0 -1
- package/lib/util/buffers/isFloat32.js +0 -10
- package/lib/util/buffers/isFloat32.js.map +0 -1
- package/lib/util/buffers/isUint8Array.d.ts +0 -1
- package/lib/util/buffers/isUint8Array.js +0 -7
- package/lib/util/buffers/isUint8Array.js.map +0 -1
- package/lib/util/buffers/printOctets.d.ts +0 -1
- package/lib/util/buffers/printOctets.js +0 -23
- package/lib/util/buffers/printOctets.js.map +0 -1
- package/lib/util/buffers/strings.d.ts +0 -6
- package/lib/util/buffers/strings.js +0 -23
- package/lib/util/buffers/strings.js.map +0 -1
- package/lib/util/buffers/toBuf.d.ts +0 -1
- package/lib/util/buffers/toBuf.js +0 -12
- package/lib/util/buffers/toBuf.js.map +0 -1
- package/lib/util/buffers/toUint8Array.d.ts +0 -1
- package/lib/util/buffers/toUint8Array.js +0 -19
- package/lib/util/buffers/toUint8Array.js.map +0 -1
- package/lib/util/buffers/types.d.ts +0 -54
- package/lib/util/buffers/types.js +0 -3
- package/lib/util/buffers/types.js.map +0 -1
- package/lib/util/buffers/utf8/CachedUtf8Decoder.d.ts +0 -7
- package/lib/util/buffers/utf8/CachedUtf8Decoder.js +0 -54
- package/lib/util/buffers/utf8/CachedUtf8Decoder.js.map +0 -1
- package/lib/util/buffers/utf8/decodeAscii.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeAscii.js +0 -163
- package/lib/util/buffers/utf8/decodeAscii.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/index.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/index.js +0 -7
- package/lib/util/buffers/utf8/decodeUtf8/index.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v1.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v1.js +0 -46
- package/lib/util/buffers/utf8/decodeUtf8/v1.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v10.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v10.js +0 -43
- package/lib/util/buffers/utf8/decodeUtf8/v10.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v11.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v11.js +0 -5
- package/lib/util/buffers/utf8/decodeUtf8/v11.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v12.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v12.js +0 -7
- package/lib/util/buffers/utf8/decodeUtf8/v12.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v13.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v13.js +0 -26
- package/lib/util/buffers/utf8/decodeUtf8/v13.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v14.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v14.js +0 -10
- package/lib/util/buffers/utf8/decodeUtf8/v14.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v15.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v15.js +0 -18
- package/lib/util/buffers/utf8/decodeUtf8/v15.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v16.d.ts +0 -3
- package/lib/util/buffers/utf8/decodeUtf8/v16.js +0 -26
- package/lib/util/buffers/utf8/decodeUtf8/v16.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v17.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v17.js +0 -42
- package/lib/util/buffers/utf8/decodeUtf8/v17.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v18.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v18.js +0 -41
- package/lib/util/buffers/utf8/decodeUtf8/v18.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v19.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v19.js +0 -5
- package/lib/util/buffers/utf8/decodeUtf8/v19.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v2.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v2.js +0 -4
- package/lib/util/buffers/utf8/decodeUtf8/v2.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v3.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v3.js +0 -6
- package/lib/util/buffers/utf8/decodeUtf8/v3.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v4.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v4.js +0 -6
- package/lib/util/buffers/utf8/decodeUtf8/v4.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v5.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v5.js +0 -37
- package/lib/util/buffers/utf8/decodeUtf8/v5.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v6.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v6.js +0 -8
- package/lib/util/buffers/utf8/decodeUtf8/v6.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v7.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v7.js +0 -39
- package/lib/util/buffers/utf8/decodeUtf8/v7.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v8.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v8.js +0 -46
- package/lib/util/buffers/utf8/decodeUtf8/v8.js.map +0 -1
- package/lib/util/buffers/utf8/decodeUtf8/v9.d.ts +0 -2
- package/lib/util/buffers/utf8/decodeUtf8/v9.js +0 -39
- package/lib/util/buffers/utf8/decodeUtf8/v9.js.map +0 -1
- package/lib/util/buffers/utf8/encode.d.ts +0 -6
- package/lib/util/buffers/utf8/encode.js +0 -59
- package/lib/util/buffers/utf8/encode.js.map +0 -1
- package/lib/util/buffers/utf8/isUtf8.d.ts +0 -1
- package/lib/util/buffers/utf8/isUtf8.js +0 -43
- package/lib/util/buffers/utf8/isUtf8.js.map +0 -1
- package/lib/util/buffers/utf8/sharedCachedUtf8Decoder.d.ts +0 -3
- package/lib/util/buffers/utf8/sharedCachedUtf8Decoder.js +0 -5
- package/lib/util/buffers/utf8/sharedCachedUtf8Decoder.js.map +0 -1
- package/lib/util/codegen/Codegen.d.ts +0 -44
- package/lib/util/codegen/Codegen.js +0 -121
- package/lib/util/codegen/Codegen.js.map +0 -1
- package/lib/util/codegen/compile.d.ts +0 -4
- package/lib/util/codegen/compile.js +0 -8
- package/lib/util/codegen/compile.js.map +0 -1
- package/lib/util/codegen/dynamicFunction.d.ts +0 -1
- package/lib/util/codegen/dynamicFunction.js +0 -12
- package/lib/util/codegen/dynamicFunction.js.map +0 -1
- package/lib/util/codegen/index.d.ts +0 -3
- package/lib/util/codegen/index.js +0 -7
- package/lib/util/codegen/index.js.map +0 -1
- package/lib/util/codegen/switch.d.ts +0 -1
- package/lib/util/codegen/switch.js +0 -16
- package/lib/util/codegen/switch.js.map +0 -1
- package/lib/util/codegen/types.d.ts +0 -7
- package/lib/util/codegen/types.js +0 -3
- package/lib/util/codegen/types.js.map +0 -1
- package/lib/util/codegen/util/JsExpression.d.ts +0 -11
- package/lib/util/codegen/util/JsExpression.js +0 -30
- package/lib/util/codegen/util/JsExpression.js.map +0 -1
- package/lib/util/codegen/util/helpers.d.ts +0 -1
- package/lib/util/codegen/util/helpers.js +0 -11
- package/lib/util/codegen/util/helpers.js.map +0 -1
- package/lib/util/codegen/util/normalizeAccessor.d.ts +0 -1
- package/lib/util/codegen/util/normalizeAccessor.js +0 -13
- package/lib/util/codegen/util/normalizeAccessor.js.map +0 -1
- package/lib/util/hasOwnProperty.d.ts +0 -1
- package/lib/util/hasOwnProperty.js +0 -9
- package/lib/util/hasOwnProperty.js.map +0 -1
- package/lib/util/isEmpty.d.ts +0 -1
- package/lib/util/isEmpty.js +0 -11
- package/lib/util/isEmpty.js.map +0 -1
- package/lib/util/lazyFunction.d.ts +0 -1
- package/lib/util/lazyFunction.js +0 -14
- package/lib/util/lazyFunction.js.map +0 -1
- package/lib/util/objKeyCmp.d.ts +0 -1
- package/lib/util/objKeyCmp.js +0 -10
- package/lib/util/objKeyCmp.js.map +0 -1
- package/lib/util/sort/insertion.d.ts +0 -1
- package/lib/util/sort/insertion.js +0 -18
- package/lib/util/sort/insertion.js.map +0 -1
- package/lib/util/sort/insertion2.d.ts +0 -1
- package/lib/util/sort/insertion2.js +0 -18
- package/lib/util/sort/insertion2.js.map +0 -1
- package/lib/util/strings/asString.d.ts +0 -1
- package/lib/util/strings/asString.js +0 -28
- package/lib/util/strings/asString.js.map +0 -1
- package/lib/util/strings/escape.d.ts +0 -1
- package/lib/util/strings/escape.js +0 -135
- package/lib/util/strings/escape.js.map +0 -1
- package/lib/util/strings/flatstr.d.ts +0 -1
- package/lib/util/strings/flatstr.js +0 -10
- package/lib/util/strings/flatstr.js.map +0 -1
- package/lib/util/strings/utf8.d.ts +0 -1
- package/lib/util/strings/utf8.js +0 -28
- package/lib/util/strings/utf8.js.map +0 -1
- package/lib/util/strings/util.d.ts +0 -4
- package/lib/util/strings/util.js +0 -12
- package/lib/util/strings/util.js.map +0 -1
- package/lib/util/strings/wordWrap.d.ts +0 -4
- package/lib/util/strings/wordWrap.js +0 -19
- package/lib/util/strings/wordWrap.js.map +0 -1
- package/lib/util/types.d.ts +0 -9
- package/lib/util/types.js +0 -3
- package/lib/util/types.js.map +0 -1
|
@@ -1,37 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = (uint8, start, length) => {
|
|
4
|
-
const end = start + length;
|
|
5
|
-
let x = start;
|
|
6
|
-
let str = '';
|
|
7
|
-
while (x < end) {
|
|
8
|
-
const b1 = uint8[x++];
|
|
9
|
-
if ((b1 & 0x80) === 0) {
|
|
10
|
-
str += String.fromCharCode(b1);
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
else if ((b1 & 0xe0) === 0xc0) {
|
|
14
|
-
str += String.fromCharCode(((b1 & 0x1f) << 6) | (uint8[x++] & 0x3f));
|
|
15
|
-
}
|
|
16
|
-
else if ((b1 & 0xf0) === 0xe0) {
|
|
17
|
-
str += String.fromCharCode(((b1 & 0x1f) << 12) | ((uint8[x++] & 0x3f) << 6) | (uint8[x++] & 0x3f));
|
|
18
|
-
}
|
|
19
|
-
else if ((b1 & 0xf8) === 0xf0) {
|
|
20
|
-
const b2 = uint8[x++] & 0x3f;
|
|
21
|
-
const b3 = uint8[x++] & 0x3f;
|
|
22
|
-
const b4 = uint8[x++] & 0x3f;
|
|
23
|
-
let code = ((b1 & 0x07) << 0x12) | (b2 << 0x0c) | (b3 << 0x06) | b4;
|
|
24
|
-
if (code > 0xffff) {
|
|
25
|
-
code -= 0x10000;
|
|
26
|
-
str += String.fromCharCode(((code >>> 10) & 0x3ff) | 0xd800);
|
|
27
|
-
code = 0xdc00 | (code & 0x3ff);
|
|
28
|
-
}
|
|
29
|
-
str += String.fromCharCode(code);
|
|
30
|
-
}
|
|
31
|
-
else {
|
|
32
|
-
str += String.fromCharCode(b1);
|
|
33
|
-
}
|
|
34
|
-
}
|
|
35
|
-
return str;
|
|
36
|
-
};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AC;YAChC,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,EAAE,CAAE,GAAG,IAAI,CAAC;YAC9B,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,EAAE,CAAE,GAAG,IAAI,CAAC;YAC9B,MAAM,EAAE,GAAG,KAAK,CAAC,CAAC,EAAE,CAAE,GAAG,IAAI,CAAC;YAC9B,IAAI,IAAI,GAAG,CAAC,CAAC,EAAE,GAAG,IAAI,CAAC,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,CAAC,EAAE,IAAI,IAAI,CAAC,GAAG,EAAE,CAAC;YACpE,IAAI,IAAI,GAAG,MAAM,EAAE,CAAC;gBAClB,IAAI,IAAI,OAAO,CAAC;gBAChB,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;gBAC7D,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;YACjC,CAAC;YACD,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,IAAI,CAAC,CAAC;QACnC,CAAC;aAAM,CAAC;YACN,GAAG,IAAI,MAAM,CAAC,YAAY,CAAC,EAAE,CAAC,CAAC;QACjC,CAAC;IACH,CAAC;IACD,OAAO,GAAG,CAAC;AACb,CAAC,CAAC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const sharedTextDecoder = new TextDecoder();
|
|
4
|
-
exports.default = (uint8, start, length) => {
|
|
5
|
-
const stringBytes = uint8.subarray(start, start + length);
|
|
6
|
-
return sharedTextDecoder.decode(stringBytes);
|
|
7
|
-
};
|
|
8
|
-
//# sourceMappingURL=v6.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v6.js","sourceRoot":"","sources":["../../../../../src/util/buffers/utf8/decodeUtf8/v6.ts"],"names":[],"mappings":";;AAAA,MAAM,iBAAiB,GAAG,IAAI,WAAW,EAAE,CAAC;AAE5C,kBAAe,CAAC,KAAiB,EAAE,KAAa,EAAE,MAAc,EAAU,EAAE;IAC1E,MAAM,WAAW,GAAG,KAAK,CAAC,QAAQ,CAAC,KAAK,EAAE,KAAK,GAAG,MAAM,CAAC,CAAC;IAC1D,OAAO,iBAAiB,CAAC,MAAM,CAAC,WAAW,CAAC,CAAC;AAC/C,CAAC,CAAC"}
|
|
@@ -1,39 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = (buf, start, length) => {
|
|
4
|
-
let offset = start;
|
|
5
|
-
const end = offset + length;
|
|
6
|
-
const codes = [];
|
|
7
|
-
while (offset < end) {
|
|
8
|
-
const octet1 = buf[offset++];
|
|
9
|
-
if ((octet1 & 0x80) === 0) {
|
|
10
|
-
codes.push(octet1);
|
|
11
|
-
}
|
|
12
|
-
else if ((octet1 & 0xe0) === 0xc0) {
|
|
13
|
-
const octet2 = buf[offset++] & 0x3f;
|
|
14
|
-
codes.push(((octet1 & 0x1f) << 6) | octet2);
|
|
15
|
-
}
|
|
16
|
-
else if ((octet1 & 0xf0) === 0xe0) {
|
|
17
|
-
const octet2 = buf[offset++] & 0x3f;
|
|
18
|
-
const octet3 = buf[offset++] & 0x3f;
|
|
19
|
-
codes.push(((octet1 & 0x1f) << 12) | (octet2 << 6) | octet3);
|
|
20
|
-
}
|
|
21
|
-
else if ((octet1 & 0xf8) === 0xf0) {
|
|
22
|
-
const octet2 = buf[offset++] & 0x3f;
|
|
23
|
-
const octet3 = buf[offset++] & 0x3f;
|
|
24
|
-
const octet4 = buf[offset++] & 0x3f;
|
|
25
|
-
let unit = ((octet1 & 0x07) << 0x12) | (octet2 << 0x0c) | (octet3 << 0x06) | octet4;
|
|
26
|
-
if (unit > 0xffff) {
|
|
27
|
-
unit -= 0x10000;
|
|
28
|
-
codes.push(((unit >>> 10) & 0x3ff) | 0xd800);
|
|
29
|
-
unit = 0xdc00 | (unit & 0x3ff);
|
|
30
|
-
}
|
|
31
|
-
codes.push(unit);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
codes.push(octet1);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return String.fromCharCode(...codes);
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=v7.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v7.js","sourceRoot":"","sources":["../../../../../src/util/buffers/utf8/decodeUtf8/v7.ts"],"names":[],"mappings":";;AAAA,kBAAe,CAAC,GAAe,EAAE,KAAa,EAAE,MAAc,EAAU,EAAE;IACxE,IAAI,MAAM,GAAG,KAAK,CAAC;IACnB,MAAM,GAAG,GAAG,MAAM,GAAG,MAAM,CAAC;IAC5B,MAAM,KAAK,GAAkB,EAAE,CAAC;IAChC,OAAO,MAAM,GAAG,GAAG,EAAE,CAAC;QACpB,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,CAAE,CAAC;QAC9B,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YAC1B,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,CAAC;aAAM,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACpC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,CAAE,GAAG,IAAI,CAAC;YACrC,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,MAAM,GAAG,IAAI,CAAC,IAAI,CAAC,CAAC,GAAG,MAAM,CAAC,CAAC;QAC9C,CAAC;aAAM,IAAI,CAAC,MAAM,GAAG,IAAI,CAAC,KAAK,IAAI,EAAE,CAAC;YACpC,MAAM,MAAM,GAAG,GAAG,CAAC,MAAM,EAAE,CAAE,GAAG,IAAI,CAAC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ty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = (buf, start, length) => {
|
|
4
|
-
let offset = start;
|
|
5
|
-
const end = offset + length;
|
|
6
|
-
const units = [];
|
|
7
|
-
let result = '';
|
|
8
|
-
while (offset < end) {
|
|
9
|
-
const byte1 = buf[offset++];
|
|
10
|
-
if ((byte1 & 0x80) === 0) {
|
|
11
|
-
units.push(byte1);
|
|
12
|
-
}
|
|
13
|
-
else if ((byte1 & 0xe0) === 0xc0) {
|
|
14
|
-
const byte2 = buf[offset++] & 0x3f;
|
|
15
|
-
units.push(((byte1 & 0x1f) << 6) | byte2);
|
|
16
|
-
}
|
|
17
|
-
else if ((byte1 & 0xf0) === 0xe0) {
|
|
18
|
-
const byte2 = buf[offset++] & 0x3f;
|
|
19
|
-
const byte3 = buf[offset++] & 0x3f;
|
|
20
|
-
units.push(((byte1 & 0x1f) << 12) | (byte2 << 6) | byte3);
|
|
21
|
-
}
|
|
22
|
-
else if ((byte1 & 0xf8) === 0xf0) {
|
|
23
|
-
const byte2 = buf[offset++] & 0x3f;
|
|
24
|
-
const byte3 = buf[offset++] & 0x3f;
|
|
25
|
-
const byte4 = buf[offset++] & 0x3f;
|
|
26
|
-
let unit = ((byte1 & 0x07) << 0x12) | (byte2 << 0x0c) | (byte3 << 0x06) | byte4;
|
|
27
|
-
if (unit > 0xffff) {
|
|
28
|
-
unit -= 0x10000;
|
|
29
|
-
units.push(((unit >>> 10) & 0x3ff) | 0xd800);
|
|
30
|
-
unit = 0xdc00 | (unit & 0x3ff);
|
|
31
|
-
}
|
|
32
|
-
units.push(unit);
|
|
33
|
-
}
|
|
34
|
-
else {
|
|
35
|
-
units.push(byte1);
|
|
36
|
-
}
|
|
37
|
-
if (units.length >= 8) {
|
|
38
|
-
result += String.fromCharCode(...units);
|
|
39
|
-
units.length = 0;
|
|
40
|
-
}
|
|
41
|
-
}
|
|
42
|
-
if (units.length > 0)
|
|
43
|
-
result += String.fromCharCode(...units);
|
|
44
|
-
return result;
|
|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"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.default = (buf, start, length) => {
|
|
4
|
-
let offset = start;
|
|
5
|
-
const end = offset + length;
|
|
6
|
-
const codes = [];
|
|
7
|
-
while (offset < end) {
|
|
8
|
-
const octet1 = buf[offset++];
|
|
9
|
-
if ((octet1 & 0x80) === 0) {
|
|
10
|
-
codes.push(octet1);
|
|
11
|
-
continue;
|
|
12
|
-
}
|
|
13
|
-
const octet2 = buf[offset++] & 0x3f;
|
|
14
|
-
if ((octet1 & 0xe0) === 0xc0) {
|
|
15
|
-
codes.push(((octet1 & 0x1f) << 6) | octet2);
|
|
16
|
-
continue;
|
|
17
|
-
}
|
|
18
|
-
const octet3 = buf[offset++] & 0x3f;
|
|
19
|
-
if ((octet1 & 0xf0) === 0xe0) {
|
|
20
|
-
codes.push(((octet1 & 0x1f) << 12) | (octet2 << 6) | octet3);
|
|
21
|
-
continue;
|
|
22
|
-
}
|
|
23
|
-
if ((octet1 & 0xf8) === 0xf0) {
|
|
24
|
-
const octet4 = buf[offset++] & 0x3f;
|
|
25
|
-
let unit = ((octet1 & 0x07) << 0x12) | (octet2 << 0x0c) | (octet3 << 0x06) | octet4;
|
|
26
|
-
if (unit > 0xffff) {
|
|
27
|
-
unit -= 0x10000;
|
|
28
|
-
codes.push(((unit >>> 10) & 0x3ff) | 0xd800);
|
|
29
|
-
unit = 0xdc00 | (unit & 0x3ff);
|
|
30
|
-
}
|
|
31
|
-
codes.push(unit);
|
|
32
|
-
}
|
|
33
|
-
else {
|
|
34
|
-
codes.push(octet1);
|
|
35
|
-
}
|
|
36
|
-
}
|
|
37
|
-
return String.fromCharCode(...codes);
|
|
38
|
-
};
|
|
39
|
-
//# sourceMappingURL=v9.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"v9.js","sourceRoot":"","sources":["../../../../../src/util/buffers/utf8/decodeUtf8/v9.ts"],"names":[],"mappings":";;AAAA,kBAAe,C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AI,CAAC,GAAG,CAAC,MAAM,IAAI,IAAI,CAAC,GAAG,MAAM,CAAC;YACpF,IAAI,IAAI,GAAG,MAAM,EAAE,CAAC;gBAClB,IAAI,IAAI,OAAO,CAAC;gBAChB,KAAK,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,KAAK,EAAE,CAAC,GAAG,KAAK,CAAC,GAAG,MAAM,CAAC,CAAC;gBAC7C,IAAI,GAAG,MAAM,GAAG,CAAC,IAAI,GAAG,KAAK,CAAC,CAAC;YACjC,CAAC;YACD,KAAK,CAAC,IAAI,CAAC,IAAI,CAAC,CAAC;QACnB,CAAC;aAAM,CAAC;YACN,KAAK,CAAC,IAAI,CAAC,MAAM,CAAC,CAAC;QACrB,CAAC;IACH,CAAC;IACD,OAAO,MAAM,CAAC,YAAY,CAAC,GAAG,KAAK,CAAC,CAAC;AACvC,CAAC,CAAC"}
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
export type EncodeString = (arr: Uint8Array, str: string, pos: number, maxLength: number) => number;
|
|
2
|
-
export declare const encodeUtf8Write: EncodeString;
|
|
3
|
-
export declare const encodeFrom: EncodeString;
|
|
4
|
-
export declare const encodeNative: EncodeString;
|
|
5
|
-
export declare const encodeTe: EncodeString;
|
|
6
|
-
export declare const encode: EncodeString;
|
|
@@ -1,59 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.encode = exports.encodeTe = exports.encodeNative = exports.encodeFrom = exports.encodeUtf8Write = void 0;
|
|
4
|
-
const hasBuffer = typeof Buffer !== undefined;
|
|
5
|
-
const utf8Write = hasBuffer
|
|
6
|
-
? Buffer.prototype.utf8Write
|
|
7
|
-
: null;
|
|
8
|
-
const from = hasBuffer ? Buffer.from : null;
|
|
9
|
-
const encodeUtf8Write = (arr, str, pos, maxLength) => utf8Write.call(arr, str, pos, maxLength);
|
|
10
|
-
exports.encodeUtf8Write = encodeUtf8Write;
|
|
11
|
-
const encodeFrom = (arr, str, pos, maxLength) => {
|
|
12
|
-
const offset = arr.byteOffset + pos;
|
|
13
|
-
const buf = from(arr.buffer).subarray(offset, offset + maxLength);
|
|
14
|
-
return buf.write(str, 0, maxLength, 'utf8');
|
|
15
|
-
};
|
|
16
|
-
exports.encodeFrom = encodeFrom;
|
|
17
|
-
const encodeNative = (arr, str, pos, maxLength) => {
|
|
18
|
-
const length = str.length;
|
|
19
|
-
const start = pos;
|
|
20
|
-
let curr = 0;
|
|
21
|
-
while (curr < length) {
|
|
22
|
-
let value = str.charCodeAt(curr++);
|
|
23
|
-
if ((value & 0xffffff80) === 0) {
|
|
24
|
-
arr[pos++] = value;
|
|
25
|
-
continue;
|
|
26
|
-
}
|
|
27
|
-
else if ((value & 0xfffff800) === 0) {
|
|
28
|
-
arr[pos++] = ((value >> 6) & 0x1f) | 0xc0;
|
|
29
|
-
}
|
|
30
|
-
else {
|
|
31
|
-
if (value >= 0xd800 && value <= 0xdbff) {
|
|
32
|
-
if (curr < length) {
|
|
33
|
-
const extra = str.charCodeAt(curr);
|
|
34
|
-
if ((extra & 0xfc00) === 0xdc00) {
|
|
35
|
-
curr++;
|
|
36
|
-
value = ((value & 0x3ff) << 10) + (extra & 0x3ff) + 0x10000;
|
|
37
|
-
}
|
|
38
|
-
}
|
|
39
|
-
}
|
|
40
|
-
if ((value & 0xffff0000) === 0) {
|
|
41
|
-
arr[pos++] = ((value >> 12) & 0x0f) | 0xe0;
|
|
42
|
-
arr[pos++] = ((value >> 6) & 0x3f) | 0x80;
|
|
43
|
-
}
|
|
44
|
-
else {
|
|
45
|
-
arr[pos++] = ((value >> 18) & 0x07) | 0xf0;
|
|
46
|
-
arr[pos++] = ((value >> 12) & 0x3f) | 0x80;
|
|
47
|
-
arr[pos++] = ((value >> 6) & 0x3f) | 0x80;
|
|
48
|
-
}
|
|
49
|
-
}
|
|
50
|
-
arr[pos++] = (value & 0x3f) | 0x80;
|
|
51
|
-
}
|
|
52
|
-
return pos - start;
|
|
53
|
-
};
|
|
54
|
-
exports.encodeNative = encodeNative;
|
|
55
|
-
const textEncoder = typeof TextEncoder !== 'undefined' ? new TextEncoder() : null;
|
|
56
|
-
const encodeTe = (arr, str, pos, maxLength) => textEncoder.encodeInto(str, arr.subarray(pos, pos + maxLength)).written;
|
|
57
|
-
exports.encodeTe = encodeTe;
|
|
58
|
-
exports.encode = utf8Write ? exports.encodeUtf8Write : from ? exports.encodeFrom : exports.encodeNative;
|
|
59
|
-
//# sourceMappingURL=encode.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"encode.js","sourceRoot":"","sources":["../../../../src/util/buffers/utf8/encode.ts"],"names":[],"mappings":";;;AAAA,MAAM,SAAS,GAAG,OAAO,MAAM,KAAK,SAAS,CAAC;AAC9C,MAAM,SAAS,GAAG,SAAS;IACzB,CAAC,CAAE,MAAM,CAAC,SAAS,CAAC,SAAuF;IAC3G,CAAC,CAAC,IAAI,CAAC;AACT,MAAM,IAAI,GAAG,SAAS,CAAC,CAAC,CAAC,MAAM,CAAC,IAAI,CAAC,CAAC,CAAC,IAAI,CAAC;AAIrC,MAAM,eAAe,GAAiB,CAAC,GAAe,EAAE,GAAW,EAAE,GAAW,EAAE,SAAiB,EAAU,EAAE,CACpH,SAAU,CAAC,IAAI,CAAC,GAAG,EAAE,GAAG,EAAE,GAAG,EAAE,SAAS,CAAC,CAAC;AAD/B,QAAA,eAAe,mBACgB;AAErC,MAAM,UAAU,GAAiB,CAAC,GAAe,EAAE,GAAW,EAAE,GAAW,EAAE,SAAiB,EAAU,EAAE;IAC/G,MAAM,MAAM,GAAG,GAAG,CAAC,UAAU,GAAG,GAAG,CAAC;IACpC,MAAM,GAAG,GAAG,IAAK,CAAC,GAAG,CAAC,MAAM,CAAC,CAAC,QAAQ,CAAC,MAAM,EAAE,MAAM,GAAG,SAAS,CAAC,CAAC;IACnE,OAAO,GAAG,CAAC,KAAK,CAAC,GAAG,EAAE,CAAC,EAAE,SAAS,EA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,CAAC,CAAC,CAAC,IAAI,CAAC,CAAC,CAAC,kBAAU,CAAC,CAAC,CAAC,oBAAY,CAAC"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const isUtf8: (buf: Uint8Array, from: number, length: number) => boolean;
|
|
@@ -1,43 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.isUtf8 = void 0;
|
|
4
|
-
const isUtf8 = (buf, from, length) => {
|
|
5
|
-
const to = from + length;
|
|
6
|
-
while (from < to) {
|
|
7
|
-
const c = buf[from];
|
|
8
|
-
if (c <= 0x7f) {
|
|
9
|
-
from++;
|
|
10
|
-
continue;
|
|
11
|
-
}
|
|
12
|
-
if (c >= 0xc2 && c <= 0xdf) {
|
|
13
|
-
if (buf[from + 1] >> 6 === 2) {
|
|
14
|
-
from += 2;
|
|
15
|
-
continue;
|
|
16
|
-
}
|
|
17
|
-
else
|
|
18
|
-
return false;
|
|
19
|
-
}
|
|
20
|
-
const c1 = buf[from + 1];
|
|
21
|
-
if (((c === 0xe0 && c1 >= 0xa0 && c1 <= 0xbf) || (c === 0xed && c1 >= 0x80 && c1 <= 0x9f)) &&
|
|
22
|
-
buf[from + 2] >> 6 === 2) {
|
|
23
|
-
from += 3;
|
|
24
|
-
continue;
|
|
25
|
-
}
|
|
26
|
-
if (((c >= 0xe1 && c <= 0xec) || (c >= 0xee && c <= 0xef)) && c1 >> 6 === 2 && buf[from + 2] >> 6 === 2) {
|
|
27
|
-
from += 3;
|
|
28
|
-
continue;
|
|
29
|
-
}
|
|
30
|
-
if (((c === 0xf0 && c1 >= 0x90 && c1 <= 0xbf) ||
|
|
31
|
-
(c >= 0xf1 && c <= 0xf3 && c1 >> 6 === 2) ||
|
|
32
|
-
(c === 0xf4 && c1 >= 0x80 && c1 <= 0x8f)) &&
|
|
33
|
-
buf[from + 2] >> 6 === 2 &&
|
|
34
|
-
buf[from + 3] >> 6 === 2) {
|
|
35
|
-
from += 4;
|
|
36
|
-
continue;
|
|
37
|
-
}
|
|
38
|
-
return false;
|
|
39
|
-
}
|
|
40
|
-
return true;
|
|
41
|
-
};
|
|
42
|
-
exports.isUtf8 = isUtf8;
|
|
43
|
-
//# sourceMappingURL=isUtf8.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"isUtf8.js","sourceRoot":"","sources":["../../../../src/util/buffers/utf8/isUtf8.ts"],"names":[],"mappings":";;;AAKO,MAAM,MAAM,GAAG,CAAC,GAAe,EAAE,IAAY,EAAE,MAAc,EAAW,EAAE;IAC/E,MAAM,EAAE,GAAG,IAAI,GAAG,MAAM,CAAC;IACzB,OAAO,IAAI,GAAG,EAAE,EAAE,CAAC;QACjB,MAAM,CAAC,GAAG,GAAG,CAAC,IAAI,CAAC,CAAC;QACpB,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YACd,IAAI,EAAE,CAAC;YACP,SAAS;QACX,CAAC;QACD,IAAI,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,EAAE,CAAC;YAC3B,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;gBAC7B,IAAI,IAAI,CAAC,CAAC;gBACV,SAAS;YACX,CAAC;;gBAAM,OAAO,KAAK,CAAC;QACtB,CAAC;QACD,MAAM,EAAE,GAAG,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,CAAC;QACzB,IACE,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,KAAK,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC;YACtF,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EACxB,CAAC;YACD,IAAI,IAAI,CAAC,CAAC;YACV,SAAS;QACX,CAAC;QACD,IAAI,CAAC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,IAAI,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,CAAC,CAAC,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,IAAI,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EAAE,CAAC;YACxG,IAAI,IAAI,CAAC,CAAC;YACV,SAAS;QACX,CAAC;QACD,IACE,CAAC,CAAC,CAAC,KAAK,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,CAAC;YACvC,CAAC,CAAC,IAAI,IAAI,IAAI,CAAC,IAAI,IAAI,IAAI,EAAE,IAAI,CAAC,KAAK,CAAC,CAAC;YACzC,CAAC,CAAC,KAAK,IAAI,IAAI,EAAE,IAAI,IAAI,IAAI,EAAE,IAAI,IAAI,CAAC,CAAC;YAC3C,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC;YACxB,GAAG,CAAC,IAAI,GAAG,CAAC,CAAC,IAAI,CAAC,KAAK,CAAC,EACxB,CAAC;YACD,IAAI,IAAI,CAAC,CAAC;YACV,SAAS;QACX,CAAC;QACD,OAAO,KAAK,CAAC;IACf,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC,CAAC;AAvCW,QAAA,MAAM,UAuCjB"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"sharedCachedUtf8Decoder.js","sourceRoot":"","sources":["../../../../src/util/buffers/utf8/sharedCachedUtf8Decoder.ts"],"names":[],"mappings":";;AAAA,2DAAsD;AAEtD,kBAAe,IAAI,qCAAiB,EAAE,CAAC"}
|
|
@@ -1,44 +0,0 @@
|
|
|
1
|
-
import type { JavaScriptLinked } from './types';
|
|
2
|
-
export declare class CodegenStepExecJs {
|
|
3
|
-
readonly js: string;
|
|
4
|
-
constructor(js: string);
|
|
5
|
-
}
|
|
6
|
-
type JsonSerializerStep = CodegenStepExecJs | unknown;
|
|
7
|
-
export interface CodegenOptions<Linkable = Record<string, unknown>> {
|
|
8
|
-
args?: string[];
|
|
9
|
-
name?: string;
|
|
10
|
-
prologue?: string;
|
|
11
|
-
epilogue?: string | (() => string);
|
|
12
|
-
processSteps?: (steps: JsonSerializerStep[]) => CodegenStepExecJs[];
|
|
13
|
-
linkable?: Linkable;
|
|
14
|
-
}
|
|
15
|
-
export type CodegenGenerateOptions = Pick<CodegenOptions, 'name' | 'args' | 'prologue' | 'epilogue'>;
|
|
16
|
-
export declare class Codegen<Fn extends (...deps: any[]) => any = (...deps: unknown[]) => unknown, Linkable = Record<string, unknown>> {
|
|
17
|
-
protected steps: JsonSerializerStep[];
|
|
18
|
-
options: Required<CodegenOptions<Linkable>>;
|
|
19
|
-
constructor(opts: CodegenOptions<Linkable>);
|
|
20
|
-
js(js: string): void;
|
|
21
|
-
var(expression?: string): string;
|
|
22
|
-
if(condition: string, then: () => void, otherwise?: () => void): void;
|
|
23
|
-
switch(expression: string, cases: [match: string | number | boolean | null, block: () => void, noBreak?: boolean][], def?: () => void): void;
|
|
24
|
-
return(expression: string): void;
|
|
25
|
-
step(step: unknown): void;
|
|
26
|
-
protected registerCounter: number;
|
|
27
|
-
getRegister(): string;
|
|
28
|
-
r(): string;
|
|
29
|
-
protected dependencies: unknown[];
|
|
30
|
-
protected dependencyNames: string[];
|
|
31
|
-
linkDependency(dep: unknown, name?: string): string;
|
|
32
|
-
linkDependencies(deps: unknown[]): string[];
|
|
33
|
-
protected linked: {
|
|
34
|
-
[key: string]: 1;
|
|
35
|
-
};
|
|
36
|
-
link(name: keyof Linkable): void;
|
|
37
|
-
protected constants: string[];
|
|
38
|
-
protected constantNames: string[];
|
|
39
|
-
addConstant(constant: string, name?: string): string;
|
|
40
|
-
addConstants(constants: string[]): string[];
|
|
41
|
-
generate(opts?: CodegenGenerateOptions): JavaScriptLinked<Fn>;
|
|
42
|
-
compile(opts?: CodegenGenerateOptions): Fn;
|
|
43
|
-
}
|
|
44
|
-
export {};
|
|
@@ -1,121 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.Codegen = exports.CodegenStepExecJs = void 0;
|
|
4
|
-
const _1 = require(".");
|
|
5
|
-
class CodegenStepExecJs {
|
|
6
|
-
constructor(js) {
|
|
7
|
-
this.js = js;
|
|
8
|
-
}
|
|
9
|
-
}
|
|
10
|
-
exports.CodegenStepExecJs = CodegenStepExecJs;
|
|
11
|
-
class Codegen {
|
|
12
|
-
constructor(opts) {
|
|
13
|
-
this.steps = [];
|
|
14
|
-
this.dependencies = [];
|
|
15
|
-
this.dependencyNames = [];
|
|
16
|
-
this.linked = {};
|
|
17
|
-
this.constants = [];
|
|
18
|
-
this.constantNames = [];
|
|
19
|
-
this.options = {
|
|
20
|
-
args: ['r0'],
|
|
21
|
-
name: '',
|
|
22
|
-
prologue: '',
|
|
23
|
-
epilogue: '',
|
|
24
|
-
processSteps: (steps) => steps.filter((step) => step instanceof CodegenStepExecJs),
|
|
25
|
-
linkable: {},
|
|
26
|
-
...opts,
|
|
27
|
-
};
|
|
28
|
-
this.registerCounter = this.options.args.length;
|
|
29
|
-
}
|
|
30
|
-
js(js) {
|
|
31
|
-
this.steps.push(new CodegenStepExecJs(js));
|
|
32
|
-
}
|
|
33
|
-
var(expression) {
|
|
34
|
-
const r = this.getRegister();
|
|
35
|
-
if (expression)
|
|
36
|
-
this.js('var ' + r + ' = ' + expression + ';');
|
|
37
|
-
else
|
|
38
|
-
this.js('var ' + r + ';');
|
|
39
|
-
return r;
|
|
40
|
-
}
|
|
41
|
-
if(condition, then, otherwise) {
|
|
42
|
-
this.js('if (' + condition + ') {');
|
|
43
|
-
then();
|
|
44
|
-
if (otherwise) {
|
|
45
|
-
this.js('} else {');
|
|
46
|
-
otherwise();
|
|
47
|
-
}
|
|
48
|
-
this.js('}');
|
|
49
|
-
}
|
|
50
|
-
switch(expression, cases, def) {
|
|
51
|
-
this.js('switch (' + expression + ') {');
|
|
52
|
-
for (const [match, block, noBreak] of cases) {
|
|
53
|
-
this.js('case ' + match + ': {');
|
|
54
|
-
block();
|
|
55
|
-
if (!noBreak)
|
|
56
|
-
this.js('break;');
|
|
57
|
-
this.js('}');
|
|
58
|
-
}
|
|
59
|
-
if (def) {
|
|
60
|
-
this.js('default: {');
|
|
61
|
-
def();
|
|
62
|
-
this.js('}');
|
|
63
|
-
}
|
|
64
|
-
this.js('}');
|
|
65
|
-
}
|
|
66
|
-
return(expression) {
|
|
67
|
-
this.js('return ' + expression + ';');
|
|
68
|
-
}
|
|
69
|
-
step(step) {
|
|
70
|
-
this.steps.push(step);
|
|
71
|
-
}
|
|
72
|
-
getRegister() {
|
|
73
|
-
return `r${this.registerCounter++}`;
|
|
74
|
-
}
|
|
75
|
-
r() {
|
|
76
|
-
return this.getRegister();
|
|
77
|
-
}
|
|
78
|
-
linkDependency(dep, name = 'd' + this.dependencies.length) {
|
|
79
|
-
this.dependencies.push(dep);
|
|
80
|
-
this.dependencyNames.push(name);
|
|
81
|
-
return name;
|
|
82
|
-
}
|
|
83
|
-
linkDependencies(deps) {
|
|
84
|
-
return deps.map((dep) => this.linkDependency(dep));
|
|
85
|
-
}
|
|
86
|
-
link(name) {
|
|
87
|
-
if (this.linked[name])
|
|
88
|
-
return;
|
|
89
|
-
this.linked[name] = 1;
|
|
90
|
-
this.linkDependency(this.options.linkable[name], name);
|
|
91
|
-
}
|
|
92
|
-
addConstant(constant, name = 'c' + this.constants.length) {
|
|
93
|
-
this.constants.push(constant);
|
|
94
|
-
this.constantNames.push(name);
|
|
95
|
-
return name;
|
|
96
|
-
}
|
|
97
|
-
addConstants(constants) {
|
|
98
|
-
return constants.map((constant) => this.addConstant(constant));
|
|
99
|
-
}
|
|
100
|
-
generate(opts = {}) {
|
|
101
|
-
const { name, args, prologue, epilogue } = { ...this.options, ...opts };
|
|
102
|
-
const steps = this.options.processSteps(this.steps);
|
|
103
|
-
const js = `(function(${this.dependencyNames.join(', ')}) {
|
|
104
|
-
${this.constants.map((constant, index) => `var ${this.constantNames[index]} = (${constant});`).join('\n')}
|
|
105
|
-
return ${name ? `function ${name}` : 'function'}(${args.join(',')}){
|
|
106
|
-
${prologue}
|
|
107
|
-
${steps.map((step) => step.js).join('\n')}
|
|
108
|
-
${typeof epilogue === 'function' ? epilogue() : epilogue || ''}
|
|
109
|
-
}})`;
|
|
110
|
-
return {
|
|
111
|
-
deps: this.dependencies,
|
|
112
|
-
js: js,
|
|
113
|
-
};
|
|
114
|
-
}
|
|
115
|
-
compile(opts) {
|
|
116
|
-
const closure = this.generate(opts);
|
|
117
|
-
return (0, _1.compileClosure)(closure);
|
|
118
|
-
}
|
|
119
|
-
}
|
|
120
|
-
exports.Codegen = Codegen;
|
|
121
|
-
//# sourceMappingURL=Codegen.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"Codegen.js","sourceRoot":"","sources":["../../../src/util/codegen/Codegen.ts"],"names":[],"mappings":";;;AAAA,wBAAiC;AAMjC,MAAa,iBAAiB;IAC5B,YAA4B,EAAU;QAAV,OAAE,GAAF,EAAE,CAAQ;IAAG,CAAC;CAC3C;AAFD,8CAEC;AA0ED,MAAa,OAAO;IAUlB,YAAY,IAA8B;QALhC,UAAK,GAAyB,EAAE,CAAC;QAqGjC,iBAAY,GAAc,EAAE,CAAC;QAC7B,oBAAe,GAAa,EAAE,CAAC;QA2B/B,WAAM,GAAuB,EAAE,CAAC;QAgBhC,cAAS,GAAa,EAAE,CAAC;QACzB,kBAAa,GAAa,EAAE,CAAC;QA5IrC,IAAI,CAAC,OAAO,GAAG;YACb,IAAI,EAAE,CAAC,IAAI,CAAC;YACZ,IAAI,EAAE,EAAE;YACR,QAAQ,EAAE,EAAE;YACZ,QAAQ,EAAE,EAAE;YACZ,YAAY,EAAE,CAAC,KAAK,EAAE,EAAE,CAAC,KAAK,CAAC,MAAM,CAAC,CAAC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AAE,IAA0B,CAAC,EAAE,CAAC,CAAC,IAAI,CAAC,IAAI,CAAC;EAC9D,OAAO,QAAQ,KAAK,UAAU,CAAC,CAAC,CAAC,QAAQ,EAAE,CAAC,CAAC,CAAC,QAAQ,IAAI,EAAE;IAC1D,CAAC;QAED,OAAO;YACL,IAAI,EAAE,IAAI,CAAC,YAAY;YACvB,EAAE,EAAE,EAAgC;SACrC,CAAC;IACJ,CAAC;IAOM,OAAO,CAAC,IAA6B;QAC1C,MAAM,OAAO,GAAG,IAAI,CAAC,QAAQ,CAAC,IAAI,CAAC,CAAC;QACpC,OAAO,IAAA,iBAAc,EAAC,OAAO,CAAC,CAAC;IACjC,CAAC;CACF;AArND,0BAqNC"}
|
|
@@ -1,8 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.compileClosure = exports.compile = void 0;
|
|
4
|
-
const compile = (js) => eval(js);
|
|
5
|
-
exports.compile = compile;
|
|
6
|
-
const compileClosure = (fn) => (0, exports.compile)(fn.js)(...fn.deps);
|
|
7
|
-
exports.compileClosure = compileClosure;
|
|
8
|
-
//# sourceMappingURL=compile.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"compile.js","sourceRoot":"","sources":["../../../src/util/codegen/compile.ts"],"names":[],"mappings":";;;AAIO,MAAM,OAAO,GAAG,CAAI,EAAiB,EAAK,EAAE,CAAC,IAAI,CAAC,EAAE,CAAC,CAAC;AAAhD,QAAA,OAAO,WAAyC;AAEtD,MAAM,cAAc,GAAG,CAAI,EAA4B,EAAK,EAAE,CAAC,IAAA,eAAO,EAAC,EAAE,CAAC,EAAE,CAAC,CAAC,GAAG,EAAE,CAAC,IAAI,CAAC,CAAC;AAApF,QAAA,cAAc,kBAAsE"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const dynamicFunction: <F extends (...args: any[]) => any>(implementation: F) => [fn: F, set: (fn: F) => void];
|
|
@@ -1,12 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.dynamicFunction = void 0;
|
|
4
|
-
const dynamicFunction = (implementation) => {
|
|
5
|
-
const proxy = ((...args) => implementation(...args));
|
|
6
|
-
const set = (f) => {
|
|
7
|
-
implementation = f;
|
|
8
|
-
};
|
|
9
|
-
return [proxy, set];
|
|
10
|
-
};
|
|
11
|
-
exports.dynamicFunction = dynamicFunction;
|
|
12
|
-
//# sourceMappingURL=dynamicFunction.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"dynamicFunction.js","sourceRoot":"","sources":["../../../src/util/codegen/dynamicFunction.ts"],"names":[],"mappings":";;;AAOO,MAAM,eAAe,GAAG,CAC7B,cAAiB,EACc,EAAE;IACjC,MAAM,KAAK,GAAG,CAAC,CAAC,GAAG,IAAI,EAAE,EAAE,CAAC,cAAc,CAAC,GAAG,IAAI,CAAC,CAAM,CAAC;IAC1D,MAAM,GAAG,GAAG,CAAC,CAAI,EAAE,EAAE;QACnB,cAAc,GAAG,CAAC,CAAC;IACrB,CAAC,CAAC;IACF,OAAO,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;AACtB,CAAC,CAAC;AARW,QAAA,eAAe,mBAQ1B"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
const tslib_1 = require("tslib");
|
|
4
|
-
tslib_1.__exportStar(require("./types"), exports);
|
|
5
|
-
tslib_1.__exportStar(require("./compile"), exports);
|
|
6
|
-
tslib_1.__exportStar(require("./Codegen"), exports);
|
|
7
|
-
//# sourceMappingURL=index.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"index.js","sourceRoot":"","sources":["../../../src/util/codegen/index.ts"],"names":[],"mappings":";;;AAAA,kDAAwB;AACxB,oDAA0B;AAC1B,oDAA0B"}
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
export declare const createSwitch: <F extends (...args: any[]) => any>(fn: F, codegen: () => F) => F;
|
|
@@ -1,16 +0,0 @@
|
|
|
1
|
-
"use strict";
|
|
2
|
-
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
-
exports.createSwitch = void 0;
|
|
4
|
-
const dynamicFunction_1 = require("./dynamicFunction");
|
|
5
|
-
const createSwitch = (fn, codegen) => {
|
|
6
|
-
let counter = 0;
|
|
7
|
-
const [proxy, set] = (0, dynamicFunction_1.dynamicFunction)((...args) => {
|
|
8
|
-
if (counter > 2)
|
|
9
|
-
set(codegen());
|
|
10
|
-
counter++;
|
|
11
|
-
return fn(...args);
|
|
12
|
-
});
|
|
13
|
-
return proxy;
|
|
14
|
-
};
|
|
15
|
-
exports.createSwitch = createSwitch;
|
|
16
|
-
//# sourceMappingURL=switch.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"switch.js","sourceRoot":"","sources":["../../../src/util/codegen/switch.ts"],"names":[],"mappings":";;;AAAA,uDAAkD;AAM3C,MAAM,YAAY,GAAG,CAAoC,EAAK,EAAE,OAAgB,EAAK,EAAE;IAC5F,IAAI,OAAO,GAAG,CAAC,CAAC;IAChB,MAAM,CAAC,KAAK,EAAE,GAAG,CAAC,GAAG,IAAA,iCAAe,EAAC,CAAC,GAAG,IAAI,EAAE,EAAE;QAC/C,IAAI,OAAO,GAAG,CAAC;YAAE,GAAG,CAAC,OAAO,EAAE,CAAC,CAAC;QAChC,OAAO,EAAE,CAAC;QACV,OAAO,EAAE,CAAC,GAAG,IAAI,CAAC,CAAC;IACrB,CAAC,CAAC,CAAC;IACH,OAAO,KAAU,CAAC;AACpB,CAAC,CAAC;AARW,QAAA,YAAY,gBAQvB"}
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
import type { Brand } from '../types';
|
|
2
|
-
export type JavaScript<T> = Brand<string, T, 'JavaScript'>;
|
|
3
|
-
export type JavaScriptClosure<Js, D extends unknown[] = unknown[]> = JavaScript<(...deps: D) => Js>;
|
|
4
|
-
export interface JavaScriptLinked<Js, Dependencies extends unknown[] = unknown[]> {
|
|
5
|
-
deps: Dependencies;
|
|
6
|
-
js: JavaScriptClosure<Js, Dependencies>;
|
|
7
|
-
}
|