|
31 | 31 | * Copyright (c) 2014-present, Facebook, Inc.
|
32 | 32 | * released under MIT license
|
33 | 33 | *
|
34 |
| - * build: Wed, 27 Oct 2021 10:22:54 +0000 |
| 34 | + * build: Wed, 27 Oct 2021 10:47:38 +0000 |
35 | 35 | */
|
36 | 36 | (function (global, factory) {
|
37 | 37 | typeof exports === 'object' && typeof module !== 'undefined' ? module.exports = factory() :
|
|
4669 | 4669 |
|
4670 | 4670 | /**@license
|
4671 | 4671 | *
|
4672 |
| - * No Dependency fast LZJB Compression for Browser and Node |
| 4672 | + * No Dependency fast and small LZJB Compression for Browser and Node |
4673 | 4673 | *
|
4674 | 4674 | * Copyright (c) 2021 Jakub T. Jankiewicz https://jcubic.pl/me
|
4675 | 4675 | * Released under BSD-3-Clause License
|
4676 | 4676 | *
|
4677 |
| - * build: Tue, 26 Oct 2021 18:34:12 GMT |
| 4677 | + * build: Wed, 27 Oct 2021 10:43:10 GMT |
4678 | 4678 | */
|
4679 | 4679 |
|
4680 | 4680 | Object.defineProperty(lzjbPack, '__esModule', { value: true });
|
|
4922 | 4922 | return result;
|
4923 | 4923 | }
|
4924 | 4924 |
|
4925 |
| - function pack(input) { |
| 4925 | + function pack(input, { magic = true } = {}) { |
4926 | 4926 | const out = new Uint8Array(Math.max(input.length * 1.5 | 0, 16 * 1024));
|
4927 | 4927 | const len = compress(input, out);
|
4928 | 4928 | const len_array = number_to_bytes(input.length);
|
4929 |
| - return merge_uint8_array$1( |
4930 |
| - MAGIC, |
| 4929 | + const payload = [ |
4931 | 4930 | Uint8Array.of(len_array.length),
|
4932 | 4931 | len_array,
|
4933 | 4932 | out.slice(0, len)
|
4934 |
| - ); |
| 4933 | + ]; |
| 4934 | + if (magic) { |
| 4935 | + payload.unshift(MAGIC); |
| 4936 | + } |
| 4937 | + return merge_uint8_array$1(...payload); |
4935 | 4938 | }
|
4936 | 4939 |
|
4937 |
| - function unpack(input) { |
4938 |
| - const decoder = new TextDecoder('utf-8'); |
4939 |
| - const magic = decoder.decode(input.slice(0, MAGIC.length)); |
4940 |
| - if (magic !== MAGIC_STRING) { |
4941 |
| - throw new Error('Invalid magic value'); |
| 4940 | + function unpack(input, { magic = true } = {}) { |
| 4941 | + if (magic) { |
| 4942 | + const decoder = new TextDecoder('utf-8'); |
| 4943 | + const magic_prefix = decoder.decode(input.slice(0, MAGIC.length)); |
| 4944 | + if (magic_prefix !== MAGIC_STRING) { |
| 4945 | + throw new Error('Invalid magic value'); |
| 4946 | + } |
4942 | 4947 | }
|
4943 |
| - const size = input[MAGIC.length]; |
4944 |
| - const start = MAGIC.length + 1; |
4945 |
| - const end = MAGIC.length + size + 1; |
| 4948 | + const magic_length = magic ? MAGIC.length : 0; |
| 4949 | + const size = input[magic_length]; |
| 4950 | + const start = magic_length + 1; |
| 4951 | + const end = magic_length + size + 1; |
4946 | 4952 | const len = bytes_to_number(input.slice(start, end));
|
4947 | 4953 | input = input.slice(end);
|
4948 | 4954 | const out = new Uint8Array(len);
|
|
4989 | 4995 | * The rationalize algorithm is by Per M.A. Bothner, Alan Bawden and Marc Feeley.
|
4990 | 4996 | * source: Kawa, C-Gambit
|
4991 | 4997 | *
|
4992 |
| - * Build time: Wed, 27 Oct 2021 10:22:54 +0000 |
| 4998 | + * Build time: Wed, 27 Oct 2021 10:47:38 +0000 |
4993 | 4999 | */
|
4994 | 5000 | var _excluded = ["token"],
|
4995 | 5001 | _excluded2 = ["stderr", "stdin", "stdout"];
|
|
18396 | 18402 | function serialize_bin(obj) {
|
18397 | 18403 | var magic = encode_magic();
|
18398 | 18404 | var payload = cbor.encode(obj);
|
18399 |
| - return merge_uint8_array(magic, pack_1(payload)); |
| 18405 | + return merge_uint8_array(magic, pack_1(payload, { |
| 18406 | + magic: false |
| 18407 | + })); |
18400 | 18408 | } // -------------------------------------------------------------------------
|
18401 | 18409 |
|
18402 | 18410 |
|
|
18408 | 18416 | if (type === 'CBOR' && version === 1) {
|
18409 | 18417 | return cbor.decode(data.slice(MAGIC_LENGTH));
|
18410 | 18418 | } else if (type === 'CBRZ' && version === 1) {
|
18411 |
| - var arr = unpack_1(data.slice(MAGIC_LENGTH)); |
| 18419 | + var arr = unpack_1(data.slice(MAGIC_LENGTH), { |
| 18420 | + magic: false |
| 18421 | + }); |
18412 | 18422 | return cbor.decode(arr);
|
18413 | 18423 | } else {
|
18414 | 18424 | throw new Error("Invalid file format ".concat(type));
|
@@ -18509,10 +18519,10 @@
|
18509 | 18519 |
|
18510 | 18520 | var banner = function () {
|
18511 | 18521 | // Rollup tree-shaking is removing the variable if it's normal string because
|
18512 |
| - // obviously 'Wed, 27 Oct 2021 10:22:54 +0000' == '{{' + 'DATE}}'; can be removed |
| 18522 | + // obviously 'Wed, 27 Oct 2021 10:47:38 +0000' == '{{' + 'DATE}}'; can be removed |
18513 | 18523 | // but disablig Tree-shaking is adding lot of not used code so we use this
|
18514 | 18524 | // hack instead
|
18515 |
| - var date = LString('Wed, 27 Oct 2021 10:22:54 +0000').valueOf(); |
| 18525 | + var date = LString('Wed, 27 Oct 2021 10:47:38 +0000').valueOf(); |
18516 | 18526 |
|
18517 | 18527 | var _date = date === '{{' + 'DATE}}' ? new Date() : new Date(date);
|
18518 | 18528 |
|
|
18557 | 18567 | var lips = {
|
18558 | 18568 | version: 'DEV',
|
18559 | 18569 | banner: banner,
|
18560 |
| - date: 'Wed, 27 Oct 2021 10:22:54 +0000', |
| 18570 | + date: 'Wed, 27 Oct 2021 10:47:38 +0000', |
18561 | 18571 | exec: exec,
|
18562 | 18572 | // unwrap async generator into Promise<Array>
|
18563 | 18573 | parse: compose(uniterate_async, parse),
|
|
0 commit comments