@cloudpss/ubjson 0.4.12 → 0.4.13

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.
Files changed (56) hide show
  1. package/benchmark-string.js +32 -32
  2. package/benchmark.js +33 -35
  3. package/dist/common/constants.d.ts +21 -21
  4. package/dist/common/constants.js +21 -21
  5. package/dist/common/decoder.d.ts +52 -52
  6. package/dist/common/decoder.js +277 -277
  7. package/dist/common/encoder.d.ts +74 -74
  8. package/dist/common/encoder.js +282 -282
  9. package/dist/common/string-decoder.d.ts +13 -13
  10. package/dist/common/string-decoder.js +106 -106
  11. package/dist/common/string-encoder.d.ts +6 -6
  12. package/dist/common/string-encoder.js +37 -37
  13. package/dist/decoder.d.ts +2 -2
  14. package/dist/decoder.js +2 -2
  15. package/dist/encoder.d.ts +11 -11
  16. package/dist/encoder.js +77 -77
  17. package/dist/index.d.ts +6 -6
  18. package/dist/index.js +15 -15
  19. package/dist/rxjs/decoder.d.ts +3 -3
  20. package/dist/rxjs/decoder.js +69 -69
  21. package/dist/rxjs/decoder.js.map +1 -1
  22. package/dist/rxjs/encoder.d.ts +3 -3
  23. package/dist/rxjs/encoder.js +27 -27
  24. package/dist/rxjs/encoder.js.map +1 -1
  25. package/dist/rxjs/index.d.ts +2 -2
  26. package/dist/rxjs/index.js +2 -2
  27. package/dist/stream/decoder.d.ts +13 -13
  28. package/dist/stream/decoder.js +51 -51
  29. package/dist/stream/decoder.js.map +1 -1
  30. package/dist/stream/encoder.d.ts +9 -9
  31. package/dist/stream/encoder.js +22 -22
  32. package/dist/stream/encoder.js.map +1 -1
  33. package/dist/stream/index.d.ts +11 -11
  34. package/dist/stream/index.js +31 -31
  35. package/dist/stream/index.js.map +1 -1
  36. package/dist/stream-helper/decoder.d.ts +8 -8
  37. package/dist/stream-helper/decoder.js +12 -12
  38. package/dist/stream-helper/encoder.d.ts +12 -12
  39. package/dist/stream-helper/encoder.js +56 -56
  40. package/dist/utils.d.ts +2 -2
  41. package/dist/utils.js +7 -7
  42. package/package.json +3 -2
  43. package/src/rxjs/decoder.ts +1 -1
  44. package/src/rxjs/encoder.ts +1 -1
  45. package/src/stream/decoder.ts +1 -1
  46. package/src/stream/encoder.ts +1 -1
  47. package/tests/.utils.js +25 -0
  48. package/tests/decode.js +2 -9
  49. package/tests/e2e.js +2 -0
  50. package/tests/encode.js +13 -17
  51. package/tests/rxjs/decode.js +8 -11
  52. package/tests/rxjs/encode.js +17 -19
  53. package/tests/stream/decode.js +7 -10
  54. package/tests/stream/encode.js +16 -18
  55. package/tests/string-encoding.js +7 -14
  56. package/yarn-error.log +4520 -0
@@ -1,74 +1,74 @@
1
- import { StringEncoder } from './string-encoder.js';
2
- /** 编码至 ubjson */
3
- export declare abstract class EncoderBase {
4
- readonly value: unknown;
5
- /** 字符串编码 */
6
- protected stringEncoder: StringEncoder;
7
- /** 当前写指针位置 */
8
- protected length: number;
9
- /** 数据 */
10
- protected buffer: Uint8Array;
11
- /** buffer 的 DataView */
12
- protected view: DataView;
13
- constructor(value: unknown);
14
- /**
15
- * 确保 buffer 还有 capacity 的空闲空间
16
- */
17
- protected abstract ensureCapacity(capacity: number): void;
18
- /** 写入一个对象 */
19
- protected write(value: unknown): void;
20
- /** 写入 marker */
21
- protected writeMarker(marker: number): void;
22
- /** 写入 marker */
23
- protected writeNull(): void;
24
- /** writeNoOp */
25
- protected writeNoOp(): void;
26
- /** writeBoolean */
27
- protected writeBoolean(value: boolean): void;
28
- /** writeInt8 */
29
- protected writeInt8(value: number): void;
30
- /** writeInt8Data */
31
- protected writeInt8Data(value: number): void;
32
- /** writeUint8 */
33
- protected writeUint8(value: number): void;
34
- /** writeUint8Data */
35
- protected writeUint8Data(value: number): void;
36
- /** writeInt16 */
37
- protected writeInt16(value: number): void;
38
- /** writeInt16Data */
39
- protected writeInt16Data(value: number): void;
40
- /** writeInt32 */
41
- protected writeInt32(value: number): void;
42
- /** writeInt32Data */
43
- protected writeInt32Data(value: number): void;
44
- /** writeFloat32 */
45
- protected writeFloat32(value: number): void;
46
- /** writeFloat32Data */
47
- protected writeFloat32Data(value: number): void;
48
- /** writeFloat64 */
49
- protected writeFloat64(value: number): void;
50
- /** writeFloat64Data */
51
- protected writeFloat64Data(value: number): void;
52
- /** writeChar */
53
- protected writeChar(value: string): void;
54
- /** writeCharData */
55
- protected writeCharData(value: string): void;
56
- /** writeString */
57
- protected writeString(value: string): void;
58
- /** writeStringData */
59
- protected writeStringData(value: string): void;
60
- /**
61
- * 写入整形数字,选取合适的大小
62
- *
63
- * @throws 无法在 int32 范围内表示
64
- */
65
- protected writeInt(value: number): (this: this, value: number) => void;
66
- /** 写入数字,选取合适的大小 */
67
- protected writeNumber(value: number): void;
68
- /** writeObject */
69
- protected writeObject(value: Record<string, unknown>): void;
70
- /** writeArray */
71
- protected writeArray(value: unknown[]): void;
72
- /** writeArray */
73
- protected writeTypedArray(value: ArrayBufferView): void;
74
- }
1
+ import { StringEncoder } from './string-encoder.js';
2
+ /** 编码至 ubjson */
3
+ export declare abstract class EncoderBase {
4
+ readonly value: unknown;
5
+ /** 字符串编码 */
6
+ protected stringEncoder: StringEncoder;
7
+ /** 当前写指针位置 */
8
+ protected length: number;
9
+ /** 数据 */
10
+ protected buffer: Uint8Array;
11
+ /** buffer 的 DataView */
12
+ protected view: DataView;
13
+ constructor(value: unknown);
14
+ /**
15
+ * 确保 buffer 还有 capacity 的空闲空间
16
+ */
17
+ protected abstract ensureCapacity(capacity: number): void;
18
+ /** 写入一个对象 */
19
+ protected write(value: unknown): void;
20
+ /** 写入 marker */
21
+ protected writeMarker(marker: number): void;
22
+ /** 写入 marker */
23
+ protected writeNull(): void;
24
+ /** writeNoOp */
25
+ protected writeNoOp(): void;
26
+ /** writeBoolean */
27
+ protected writeBoolean(value: boolean): void;
28
+ /** writeInt8 */
29
+ protected writeInt8(value: number): void;
30
+ /** writeInt8Data */
31
+ protected writeInt8Data(value: number): void;
32
+ /** writeUint8 */
33
+ protected writeUint8(value: number): void;
34
+ /** writeUint8Data */
35
+ protected writeUint8Data(value: number): void;
36
+ /** writeInt16 */
37
+ protected writeInt16(value: number): void;
38
+ /** writeInt16Data */
39
+ protected writeInt16Data(value: number): void;
40
+ /** writeInt32 */
41
+ protected writeInt32(value: number): void;
42
+ /** writeInt32Data */
43
+ protected writeInt32Data(value: number): void;
44
+ /** writeFloat32 */
45
+ protected writeFloat32(value: number): void;
46
+ /** writeFloat32Data */
47
+ protected writeFloat32Data(value: number): void;
48
+ /** writeFloat64 */
49
+ protected writeFloat64(value: number): void;
50
+ /** writeFloat64Data */
51
+ protected writeFloat64Data(value: number): void;
52
+ /** writeChar */
53
+ protected writeChar(value: string): void;
54
+ /** writeCharData */
55
+ protected writeCharData(value: string): void;
56
+ /** writeString */
57
+ protected writeString(value: string): void;
58
+ /** writeStringData */
59
+ protected writeStringData(value: string): void;
60
+ /**
61
+ * 写入整形数字,选取合适的大小
62
+ *
63
+ * @throws 无法在 int32 范围内表示
64
+ */
65
+ protected writeInt(value: number): (this: this, value: number) => void;
66
+ /** 写入数字,选取合适的大小 */
67
+ protected writeNumber(value: number): void;
68
+ /** writeObject */
69
+ protected writeObject(value: Record<string, unknown>): void;
70
+ /** writeArray */
71
+ protected writeArray(value: unknown[]): void;
72
+ /** writeArray */
73
+ protected writeTypedArray(value: ArrayBufferView): void;
74
+ }