@yume-chan/struct 0.0.0-20240714132542

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 (91) hide show
  1. package/CHANGELOG.md +131 -0
  2. package/LICENSE +21 -0
  3. package/README.md +747 -0
  4. package/esm/basic/definition.d.ts +44 -0
  5. package/esm/basic/definition.d.ts.map +1 -0
  6. package/esm/basic/definition.js +24 -0
  7. package/esm/basic/definition.js.map +1 -0
  8. package/esm/basic/field-value.d.ts +39 -0
  9. package/esm/basic/field-value.d.ts.map +1 -0
  10. package/esm/basic/field-value.js +46 -0
  11. package/esm/basic/field-value.js.map +1 -0
  12. package/esm/basic/index.d.ts +6 -0
  13. package/esm/basic/index.d.ts.map +1 -0
  14. package/esm/basic/index.js +6 -0
  15. package/esm/basic/index.js.map +1 -0
  16. package/esm/basic/options.d.ts +10 -0
  17. package/esm/basic/options.d.ts.map +1 -0
  18. package/esm/basic/options.js +4 -0
  19. package/esm/basic/options.js.map +1 -0
  20. package/esm/basic/stream.d.ts +25 -0
  21. package/esm/basic/stream.d.ts.map +1 -0
  22. package/esm/basic/stream.js +8 -0
  23. package/esm/basic/stream.js.map +1 -0
  24. package/esm/basic/struct-value.d.ts +30 -0
  25. package/esm/basic/struct-value.d.ts.map +1 -0
  26. package/esm/basic/struct-value.js +62 -0
  27. package/esm/basic/struct-value.js.map +1 -0
  28. package/esm/index.d.ts +15 -0
  29. package/esm/index.d.ts.map +1 -0
  30. package/esm/index.js +7 -0
  31. package/esm/index.js.map +1 -0
  32. package/esm/struct.d.ts +151 -0
  33. package/esm/struct.d.ts.map +1 -0
  34. package/esm/struct.js +255 -0
  35. package/esm/struct.js.map +1 -0
  36. package/esm/sync-promise.d.ts +13 -0
  37. package/esm/sync-promise.d.ts.map +1 -0
  38. package/esm/sync-promise.js +71 -0
  39. package/esm/sync-promise.js.map +1 -0
  40. package/esm/types/bigint.d.ts +25 -0
  41. package/esm/types/bigint.d.ts.map +1 -0
  42. package/esm/types/bigint.js +46 -0
  43. package/esm/types/bigint.js.map +1 -0
  44. package/esm/types/buffer/base.d.ts +69 -0
  45. package/esm/types/buffer/base.d.ts.map +1 -0
  46. package/esm/types/buffer/base.js +101 -0
  47. package/esm/types/buffer/base.js.map +1 -0
  48. package/esm/types/buffer/fixed-length.d.ts +9 -0
  49. package/esm/types/buffer/fixed-length.d.ts.map +1 -0
  50. package/esm/types/buffer/fixed-length.js +7 -0
  51. package/esm/types/buffer/fixed-length.js.map +1 -0
  52. package/esm/types/buffer/index.d.ts +4 -0
  53. package/esm/types/buffer/index.d.ts.map +1 -0
  54. package/esm/types/buffer/index.js +4 -0
  55. package/esm/types/buffer/index.js.map +1 -0
  56. package/esm/types/buffer/variable-length.d.ts +46 -0
  57. package/esm/types/buffer/variable-length.d.ts.map +1 -0
  58. package/esm/types/buffer/variable-length.js +88 -0
  59. package/esm/types/buffer/variable-length.js.map +1 -0
  60. package/esm/types/index.d.ts +4 -0
  61. package/esm/types/index.d.ts.map +1 -0
  62. package/esm/types/index.js +4 -0
  63. package/esm/types/index.js.map +1 -0
  64. package/esm/types/number.d.ts +28 -0
  65. package/esm/types/number.d.ts.map +1 -0
  66. package/esm/types/number.js +88 -0
  67. package/esm/types/number.js.map +1 -0
  68. package/esm/utils.d.ts +48 -0
  69. package/esm/utils.d.ts.map +1 -0
  70. package/esm/utils.js +18 -0
  71. package/esm/utils.js.map +1 -0
  72. package/package.json +49 -0
  73. package/src/basic/definition.ts +68 -0
  74. package/src/basic/field-value.ts +71 -0
  75. package/src/basic/index.ts +5 -0
  76. package/src/basic/options.ts +19 -0
  77. package/src/basic/stream.ts +34 -0
  78. package/src/basic/struct-value.ts +85 -0
  79. package/src/index.ts +18 -0
  80. package/src/struct.ts +705 -0
  81. package/src/sync-promise.ts +131 -0
  82. package/src/types/bigint.ts +120 -0
  83. package/src/types/buffer/base.ts +195 -0
  84. package/src/types/buffer/fixed-length.ts +22 -0
  85. package/src/types/buffer/index.ts +3 -0
  86. package/src/types/buffer/variable-length.ts +199 -0
  87. package/src/types/index.ts +3 -0
  88. package/src/types/number.ts +159 -0
  89. package/src/utils.ts +94 -0
  90. package/tsconfig.build.json +3 -0
  91. package/tsconfig.build.tsbuildinfo +1 -0
package/CHANGELOG.md ADDED
@@ -0,0 +1,131 @@
1
+ # Change Log - @yume-chan/struct
2
+
3
+ ## 0.0.0-20240714132542
4
+
5
+ ### Patch Changes
6
+
7
+ - Switch to PNPM workspace and changesets
8
+ - Updated dependencies
9
+ - @yume-chan/no-data-view@0.0.0-20240714132542
10
+
11
+ This log was last generated on Tue, 18 Jun 2024 02:49:43 GMT and should not be manually modified.
12
+
13
+ ## 0.0.24
14
+
15
+ Tue, 18 Jun 2024 02:49:43 GMT
16
+
17
+ ### Updates
18
+
19
+ - Rename some internal types to make them more distinguishable
20
+
21
+ ## 0.0.23
22
+
23
+ Thu, 21 Mar 2024 03:15:10 GMT
24
+
25
+ _Version update only_
26
+
27
+ ## 0.0.22
28
+
29
+ Wed, 13 Dec 2023 05:57:27 GMT
30
+
31
+ _Version update only_
32
+
33
+ ## 0.0.21
34
+
35
+ Fri, 25 Aug 2023 14:05:18 GMT
36
+
37
+ _Version update only_
38
+
39
+ ## 0.0.20
40
+
41
+ Mon, 05 Jun 2023 02:51:41 GMT
42
+
43
+ ### Updates
44
+
45
+ - Rename `StructDeserializeStream` and `StructAsyncDeserializeStream` to `ExactReadable` and `AsyncExactReadable`. Rename its `read` method to `readExactly`. Add a `position` field so the caller can check how many bytes have been read.
46
+ - Improve performance for decoding integers.
47
+ - Rename `Struct#fields` to `Struct#concat`. Now `Struct#fields` returns an array of `[name: PropertyKey, definition: StructFieldDefinition<any, any, any>]` tuples.
48
+ - Use ECMAScript private class fields syntax (supported by Chrome 74, Firefox 90, Safari 14.1 and Node.js 12.0.0).
49
+
50
+ ## 0.0.19
51
+
52
+ Sun, 09 Apr 2023 05:55:33 GMT
53
+
54
+ _Version update only_
55
+
56
+ ## 0.0.18
57
+
58
+ Wed, 25 Jan 2023 21:33:49 GMT
59
+
60
+ ### Updates
61
+
62
+ - Refactor number types for easier extending (see `ScrcpyFloatToInt16FieldDefinition` for an example)
63
+
64
+ ## 0.0.17
65
+
66
+ Tue, 18 Oct 2022 09:32:30 GMT
67
+
68
+ _Version update only_
69
+
70
+ ## 0.0.16
71
+
72
+ Sat, 28 May 2022 03:56:37 GMT
73
+
74
+ ### Updates
75
+
76
+ - Add support for custom TypeScript type for `uint8Array`
77
+ - Upgrade TypeScript to 4.7.2 to enable Node.js ESM
78
+ - Improve performance of `Struct#deserialize()` by up to 200%.
79
+ - Remove `SyncBird`, it's replaced by `SyncPromise`, which is based on native Promise and is 200% faster.
80
+
81
+ ## 0.0.15
82
+
83
+ Mon, 02 May 2022 04:18:01 GMT
84
+
85
+ _Version update only_
86
+
87
+ ## 0.0.14
88
+
89
+ Sat, 30 Apr 2022 14:05:48 GMT
90
+
91
+ _Version update only_
92
+
93
+ ## 0.0.13
94
+
95
+ Thu, 28 Apr 2022 01:23:53 GMT
96
+
97
+ ### Updates
98
+
99
+ - Fix an issue that `uint64` still deserialize to negative numbers
100
+ - Fix an issue where `Syncbird` can't synchronously invoke `then` on some Bluebird internal methods (for example `reduce`)
101
+
102
+ ## 0.0.12
103
+
104
+ Sun, 03 Apr 2022 11:18:47 GMT
105
+
106
+ _Version update only_
107
+
108
+ ## 0.0.11
109
+
110
+ Sun, 03 Apr 2022 11:18:11 GMT
111
+
112
+ ### Updates
113
+
114
+ - Update to use Web Streams API
115
+ - Improve compatibility with Node.js 12 ESM format
116
+ - Update compatibility matrix
117
+ - Update license year
118
+
119
+ ## 0.0.10
120
+
121
+ Sun, 09 Jan 2022 15:52:20 GMT
122
+
123
+ ### Updates
124
+
125
+ - Add synchronized deserialize support
126
+
127
+ ## 0.0.9
128
+
129
+ Sun, 09 Jan 2022 15:50:20 GMT
130
+
131
+ _Initial release_
package/LICENSE ADDED
@@ -0,0 +1,21 @@
1
+ MIT License
2
+
3
+ Copyright (c) 2020-2024 Simon Chan
4
+
5
+ Permission is hereby granted, free of charge, to any person obtaining a copy
6
+ of this software and associated documentation files (the "Software"), to deal
7
+ in the Software without restriction, including without limitation the rights
8
+ to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
9
+ copies of the Software, and to permit persons to whom the Software is
10
+ furnished to do so, subject to the following conditions:
11
+
12
+ The above copyright notice and this permission notice shall be included in all
13
+ copies or substantial portions of the Software.
14
+
15
+ THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
16
+ IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
17
+ FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
18
+ AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
19
+ LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
20
+ OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
21
+ SOFTWARE.