cline 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.
Files changed (299) hide show
  1. package/bin/cline +0 -0
  2. package/bin/cline-darwin-amd64 +0 -0
  3. package/bin/cline-darwin-arm64 +0 -0
  4. package/bin/cline-host +0 -0
  5. package/bin/cline-host-darwin-amd64 +0 -0
  6. package/bin/cline-host-darwin-arm64 +0 -0
  7. package/bin/cline-host-linux-amd64 +0 -0
  8. package/bin/cline-host-linux-arm64 +0 -0
  9. package/bin/cline-linux-amd64 +0 -0
  10. package/bin/cline-linux-arm64 +0 -0
  11. package/cline-core.js +24143 -16610
  12. package/extension/package.json +12 -4
  13. package/node_modules/b4a/LICENSE +201 -0
  14. package/node_modules/b4a/README.md +153 -0
  15. package/node_modules/b4a/browser.js +563 -0
  16. package/node_modules/b4a/index.js +188 -0
  17. package/node_modules/b4a/lib/ascii.js +31 -0
  18. package/node_modules/b4a/lib/base64.js +65 -0
  19. package/node_modules/b4a/lib/hex.js +51 -0
  20. package/node_modules/b4a/lib/utf16le.js +40 -0
  21. package/node_modules/b4a/lib/utf8.js +141 -0
  22. package/node_modules/b4a/package.json +49 -0
  23. package/node_modules/b4a/react-native.js +5 -0
  24. package/node_modules/bare-events/LICENSE +201 -0
  25. package/node_modules/bare-events/README.md +25 -0
  26. package/node_modules/bare-events/global.d.ts +15 -0
  27. package/node_modules/bare-events/global.js +5 -0
  28. package/node_modules/bare-events/index.d.ts +94 -0
  29. package/node_modules/bare-events/index.js +355 -0
  30. package/node_modules/bare-events/lib/errors.js +32 -0
  31. package/node_modules/bare-events/package.json +61 -0
  32. package/node_modules/bare-events/web.d.ts +79 -0
  33. package/node_modules/bare-events/web.js +347 -0
  34. package/node_modules/bare-fs/CMakeLists.txt +13 -0
  35. package/node_modules/bare-fs/LICENSE +201 -0
  36. package/node_modules/bare-fs/README.md +29 -0
  37. package/node_modules/bare-fs/binding.c +2238 -0
  38. package/node_modules/bare-fs/binding.js +1 -0
  39. package/node_modules/bare-fs/index.d.ts +1115 -0
  40. package/node_modules/bare-fs/index.js +2330 -0
  41. package/node_modules/bare-fs/lib/constants.d.ts +49 -0
  42. package/node_modules/bare-fs/lib/constants.js +49 -0
  43. package/node_modules/bare-fs/lib/errors.d.ts +11 -0
  44. package/node_modules/bare-fs/lib/errors.js +55 -0
  45. package/node_modules/bare-fs/package.json +71 -0
  46. package/node_modules/bare-fs/prebuilds/android-arm/bare-fs.bare +0 -0
  47. package/node_modules/bare-fs/prebuilds/android-arm64/bare-fs.bare +0 -0
  48. package/node_modules/bare-fs/prebuilds/android-ia32/bare-fs.bare +0 -0
  49. package/node_modules/bare-fs/prebuilds/android-x64/bare-fs.bare +0 -0
  50. package/node_modules/bare-fs/prebuilds/darwin-arm64/bare-fs.bare +0 -0
  51. package/node_modules/bare-fs/prebuilds/darwin-x64/bare-fs.bare +0 -0
  52. package/node_modules/bare-fs/prebuilds/ios-arm64/bare-fs.bare +0 -0
  53. package/node_modules/bare-fs/prebuilds/ios-arm64-simulator/bare-fs.bare +0 -0
  54. package/node_modules/bare-fs/prebuilds/ios-x64-simulator/bare-fs.bare +0 -0
  55. package/node_modules/bare-fs/prebuilds/linux-arm64/bare-fs.bare +0 -0
  56. package/node_modules/bare-fs/prebuilds/linux-x64/bare-fs.bare +0 -0
  57. package/node_modules/bare-fs/prebuilds/win32-arm64/bare-fs.bare +0 -0
  58. package/node_modules/bare-fs/prebuilds/win32-x64/bare-fs.bare +0 -0
  59. package/node_modules/bare-fs/promises.d.ts +282 -0
  60. package/node_modules/bare-fs/promises.js +90 -0
  61. package/node_modules/bare-os/CMakeLists.txt +13 -0
  62. package/node_modules/bare-os/LICENSE +201 -0
  63. package/node_modules/bare-os/README.md +11 -0
  64. package/node_modules/bare-os/binding.c +1119 -0
  65. package/node_modules/bare-os/binding.js +1 -0
  66. package/node_modules/bare-os/index.d.ts +109 -0
  67. package/node_modules/bare-os/index.js +99 -0
  68. package/node_modules/bare-os/lib/constants.js +6 -0
  69. package/node_modules/bare-os/lib/errors.js +22 -0
  70. package/node_modules/bare-os/package.json +46 -0
  71. package/node_modules/bare-os/prebuilds/android-arm/bare-os.bare +0 -0
  72. package/node_modules/bare-os/prebuilds/android-arm64/bare-os.bare +0 -0
  73. package/node_modules/bare-os/prebuilds/android-ia32/bare-os.bare +0 -0
  74. package/node_modules/bare-os/prebuilds/android-x64/bare-os.bare +0 -0
  75. package/node_modules/bare-os/prebuilds/darwin-arm64/bare-os.bare +0 -0
  76. package/node_modules/bare-os/prebuilds/darwin-x64/bare-os.bare +0 -0
  77. package/node_modules/bare-os/prebuilds/ios-arm64/bare-os.bare +0 -0
  78. package/node_modules/bare-os/prebuilds/ios-arm64-simulator/bare-os.bare +0 -0
  79. package/node_modules/bare-os/prebuilds/ios-x64-simulator/bare-os.bare +0 -0
  80. package/node_modules/bare-os/prebuilds/linux-arm64/bare-os.bare +0 -0
  81. package/node_modules/bare-os/prebuilds/linux-x64/bare-os.bare +0 -0
  82. package/node_modules/bare-os/prebuilds/win32-arm64/bare-os.bare +0 -0
  83. package/node_modules/bare-os/prebuilds/win32-x64/bare-os.bare +0 -0
  84. package/node_modules/bare-path/LICENSE +201 -0
  85. package/node_modules/bare-path/NOTICE +28 -0
  86. package/node_modules/bare-path/README.md +19 -0
  87. package/node_modules/bare-path/index.js +11 -0
  88. package/node_modules/bare-path/lib/constants.js +11 -0
  89. package/node_modules/bare-path/lib/posix.js +242 -0
  90. package/node_modules/bare-path/lib/shared.js +67 -0
  91. package/node_modules/bare-path/lib/win32.js +513 -0
  92. package/node_modules/bare-path/package.json +36 -0
  93. package/node_modules/bare-stream/LICENSE +201 -0
  94. package/node_modules/bare-stream/README.md +15 -0
  95. package/node_modules/bare-stream/global.js +8 -0
  96. package/node_modules/bare-stream/index.d.ts +237 -0
  97. package/node_modules/bare-stream/index.js +355 -0
  98. package/node_modules/bare-stream/package.json +61 -0
  99. package/node_modules/bare-stream/promises.js +3 -0
  100. package/node_modules/bare-stream/web.d.ts +73 -0
  101. package/node_modules/bare-stream/web.js +229 -0
  102. package/node_modules/bare-url/CMakeLists.txt +27 -0
  103. package/node_modules/bare-url/LICENSE +201 -0
  104. package/node_modules/bare-url/README.md +19 -0
  105. package/node_modules/bare-url/binding.c +188 -0
  106. package/node_modules/bare-url/binding.js +1 -0
  107. package/node_modules/bare-url/global.d.ts +12 -0
  108. package/node_modules/bare-url/global.js +2 -0
  109. package/node_modules/bare-url/index.d.ts +39 -0
  110. package/node_modules/bare-url/index.js +450 -0
  111. package/node_modules/bare-url/lib/errors.d.ts +8 -0
  112. package/node_modules/bare-url/lib/errors.js +38 -0
  113. package/node_modules/bare-url/lib/url-search-params.d.ts +21 -0
  114. package/node_modules/bare-url/lib/url-search-params.js +176 -0
  115. package/node_modules/bare-url/package.json +51 -0
  116. package/node_modules/bare-url/prebuilds/android-arm/bare-url.bare +0 -0
  117. package/node_modules/bare-url/prebuilds/android-arm64/bare-url.bare +0 -0
  118. package/node_modules/bare-url/prebuilds/android-ia32/bare-url.bare +0 -0
  119. package/node_modules/bare-url/prebuilds/android-x64/bare-url.bare +0 -0
  120. package/node_modules/bare-url/prebuilds/darwin-arm64/bare-url.bare +0 -0
  121. package/node_modules/bare-url/prebuilds/darwin-x64/bare-url.bare +0 -0
  122. package/node_modules/bare-url/prebuilds/ios-arm64/bare-url.bare +0 -0
  123. package/node_modules/bare-url/prebuilds/ios-arm64-simulator/bare-url.bare +0 -0
  124. package/node_modules/bare-url/prebuilds/ios-x64-simulator/bare-url.bare +0 -0
  125. package/node_modules/bare-url/prebuilds/linux-arm64/bare-url.bare +0 -0
  126. package/node_modules/bare-url/prebuilds/linux-x64/bare-url.bare +0 -0
  127. package/node_modules/bare-url/prebuilds/win32-arm64/bare-url.bare +0 -0
  128. package/node_modules/bare-url/prebuilds/win32-x64/bare-url.bare +0 -0
  129. package/node_modules/better-sqlite3/deps/download.sh +1 -1
  130. package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.c +122 -81
  131. package/node_modules/better-sqlite3/deps/sqlite3/sqlite3.h +45 -45
  132. package/node_modules/better-sqlite3/lib/database.js +1 -1
  133. package/node_modules/better-sqlite3/package.json +4 -7
  134. package/node_modules/better-sqlite3/src/addon.cpp +47 -0
  135. package/node_modules/better-sqlite3/src/better_sqlite3.cpp +44 -2164
  136. package/node_modules/better-sqlite3/src/objects/backup.cpp +120 -0
  137. package/node_modules/better-sqlite3/src/objects/backup.hpp +36 -0
  138. package/node_modules/better-sqlite3/src/objects/database.cpp +417 -0
  139. package/node_modules/better-sqlite3/src/objects/database.hpp +103 -0
  140. package/node_modules/better-sqlite3/src/objects/statement-iterator.cpp +113 -0
  141. package/node_modules/better-sqlite3/src/objects/statement-iterator.hpp +50 -0
  142. package/node_modules/better-sqlite3/src/objects/statement.cpp +383 -0
  143. package/node_modules/better-sqlite3/src/objects/statement.hpp +58 -0
  144. package/node_modules/better-sqlite3/src/util/bind-map.cpp +73 -0
  145. package/node_modules/better-sqlite3/src/util/binder.cpp +193 -0
  146. package/node_modules/better-sqlite3/src/util/constants.cpp +172 -0
  147. package/node_modules/better-sqlite3/src/util/custom-aggregate.cpp +121 -0
  148. package/node_modules/better-sqlite3/src/util/custom-function.cpp +59 -0
  149. package/node_modules/better-sqlite3/src/util/custom-table.cpp +409 -0
  150. package/node_modules/better-sqlite3/src/util/data-converter.cpp +17 -0
  151. package/node_modules/better-sqlite3/src/util/data.cpp +194 -0
  152. package/node_modules/better-sqlite3/src/util/helpers.cpp +109 -0
  153. package/node_modules/better-sqlite3/src/util/macros.cpp +63 -0
  154. package/node_modules/better-sqlite3/src/util/query-macros.cpp +71 -0
  155. package/node_modules/better-sqlite3/src/util/row-builder.cpp +49 -0
  156. package/node_modules/events-universal/LICENSE +201 -0
  157. package/node_modules/events-universal/README.md +17 -0
  158. package/node_modules/events-universal/bare.js +1 -0
  159. package/node_modules/events-universal/default.js +1 -0
  160. package/node_modules/events-universal/index.js +1 -0
  161. package/node_modules/events-universal/package.json +39 -0
  162. package/node_modules/events-universal/react-native.js +1 -0
  163. package/node_modules/{fs-constants → fast-fifo}/LICENSE +1 -1
  164. package/node_modules/fast-fifo/README.md +78 -0
  165. package/node_modules/fast-fifo/fixed-size.js +39 -0
  166. package/node_modules/fast-fifo/index.js +48 -0
  167. package/node_modules/fast-fifo/package.json +28 -0
  168. package/node_modules/{base64-js → streamx}/LICENSE +1 -1
  169. package/node_modules/streamx/README.md +489 -0
  170. package/node_modules/streamx/index.js +1184 -0
  171. package/node_modules/streamx/package.json +34 -0
  172. package/node_modules/tar-fs/README.md +23 -34
  173. package/node_modules/tar-fs/index.js +211 -184
  174. package/node_modules/tar-fs/package.json +27 -7
  175. package/node_modules/tar-stream/README.md +34 -19
  176. package/node_modules/tar-stream/constants.js +14 -0
  177. package/node_modules/tar-stream/extract.js +341 -192
  178. package/node_modules/tar-stream/headers.js +201 -175
  179. package/node_modules/tar-stream/pack.js +226 -194
  180. package/node_modules/tar-stream/package.json +23 -46
  181. package/node_modules/text-decoder/LICENSE +201 -0
  182. package/node_modules/text-decoder/README.md +36 -0
  183. package/node_modules/text-decoder/index.js +64 -0
  184. package/node_modules/text-decoder/lib/browser-decoder.js +17 -0
  185. package/node_modules/text-decoder/lib/pass-through-decoder.js +19 -0
  186. package/node_modules/text-decoder/lib/utf8-decoder.js +104 -0
  187. package/node_modules/text-decoder/package.json +38 -0
  188. package/package.json +1 -1
  189. package/proto/cline/account.proto +10 -8
  190. package/proto/cline/browser.proto +3 -1
  191. package/proto/cline/checkpoints.proto +5 -3
  192. package/proto/cline/commands.proto +4 -2
  193. package/proto/cline/common.proto +5 -7
  194. package/proto/cline/dictation.proto +3 -1
  195. package/proto/cline/file.proto +36 -34
  196. package/proto/cline/hooks.proto +3 -2
  197. package/proto/cline/mcp.proto +6 -4
  198. package/proto/cline/models.proto +189 -19
  199. package/proto/cline/oca_account.proto +6 -7
  200. package/proto/cline/slash.proto +3 -1
  201. package/proto/cline/state.proto +144 -292
  202. package/proto/cline/task.proto +4 -2
  203. package/proto/cline/ui.proto +25 -24
  204. package/proto/cline/web.proto +3 -1
  205. package/proto/descriptor_set.pb +0 -0
  206. package/proto/host/diff.proto +5 -4
  207. package/proto/host/env.proto +8 -7
  208. package/proto/host/testing.proto +3 -3
  209. package/proto/host/window.proto +2 -2
  210. package/proto/host/workspace.proto +13 -12
  211. package/node_modules/base64-js/README.md +0 -34
  212. package/node_modules/base64-js/base64js.min.js +0 -1
  213. package/node_modules/base64-js/index.d.ts +0 -3
  214. package/node_modules/base64-js/index.js +0 -150
  215. package/node_modules/base64-js/package.json +0 -47
  216. package/node_modules/better-sqlite3/src/better_sqlite3.hpp +0 -1036
  217. package/node_modules/bl/.travis.yml +0 -17
  218. package/node_modules/bl/BufferList.js +0 -396
  219. package/node_modules/bl/LICENSE.md +0 -13
  220. package/node_modules/bl/README.md +0 -247
  221. package/node_modules/bl/bl.js +0 -84
  222. package/node_modules/bl/package.json +0 -37
  223. package/node_modules/bl/test/convert.js +0 -21
  224. package/node_modules/bl/test/indexOf.js +0 -492
  225. package/node_modules/bl/test/isBufferList.js +0 -32
  226. package/node_modules/bl/test/test.js +0 -869
  227. package/node_modules/buffer/AUTHORS.md +0 -70
  228. package/node_modules/buffer/LICENSE +0 -21
  229. package/node_modules/buffer/README.md +0 -410
  230. package/node_modules/buffer/index.d.ts +0 -186
  231. package/node_modules/buffer/index.js +0 -1817
  232. package/node_modules/buffer/package.json +0 -96
  233. package/node_modules/chownr/LICENSE +0 -15
  234. package/node_modules/chownr/README.md +0 -3
  235. package/node_modules/chownr/chownr.js +0 -167
  236. package/node_modules/chownr/package.json +0 -29
  237. package/node_modules/fs-constants/README.md +0 -26
  238. package/node_modules/fs-constants/browser.js +0 -1
  239. package/node_modules/fs-constants/index.js +0 -1
  240. package/node_modules/fs-constants/package.json +0 -19
  241. package/node_modules/ieee754/LICENSE +0 -11
  242. package/node_modules/ieee754/README.md +0 -51
  243. package/node_modules/ieee754/index.d.ts +0 -10
  244. package/node_modules/ieee754/index.js +0 -85
  245. package/node_modules/ieee754/package.json +0 -52
  246. package/node_modules/inherits/LICENSE +0 -16
  247. package/node_modules/inherits/README.md +0 -42
  248. package/node_modules/inherits/inherits.js +0 -9
  249. package/node_modules/inherits/inherits_browser.js +0 -27
  250. package/node_modules/inherits/package.json +0 -29
  251. package/node_modules/readable-stream/CONTRIBUTING.md +0 -38
  252. package/node_modules/readable-stream/GOVERNANCE.md +0 -136
  253. package/node_modules/readable-stream/LICENSE +0 -47
  254. package/node_modules/readable-stream/README.md +0 -106
  255. package/node_modules/readable-stream/errors-browser.js +0 -127
  256. package/node_modules/readable-stream/errors.js +0 -116
  257. package/node_modules/readable-stream/experimentalWarning.js +0 -17
  258. package/node_modules/readable-stream/lib/_stream_duplex.js +0 -126
  259. package/node_modules/readable-stream/lib/_stream_passthrough.js +0 -37
  260. package/node_modules/readable-stream/lib/_stream_readable.js +0 -1027
  261. package/node_modules/readable-stream/lib/_stream_transform.js +0 -190
  262. package/node_modules/readable-stream/lib/_stream_writable.js +0 -641
  263. package/node_modules/readable-stream/lib/internal/streams/async_iterator.js +0 -180
  264. package/node_modules/readable-stream/lib/internal/streams/buffer_list.js +0 -183
  265. package/node_modules/readable-stream/lib/internal/streams/destroy.js +0 -96
  266. package/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +0 -86
  267. package/node_modules/readable-stream/lib/internal/streams/from-browser.js +0 -3
  268. package/node_modules/readable-stream/lib/internal/streams/from.js +0 -52
  269. package/node_modules/readable-stream/lib/internal/streams/pipeline.js +0 -86
  270. package/node_modules/readable-stream/lib/internal/streams/state.js +0 -22
  271. package/node_modules/readable-stream/lib/internal/streams/stream-browser.js +0 -1
  272. package/node_modules/readable-stream/lib/internal/streams/stream.js +0 -1
  273. package/node_modules/readable-stream/package.json +0 -68
  274. package/node_modules/readable-stream/readable-browser.js +0 -9
  275. package/node_modules/readable-stream/readable.js +0 -16
  276. package/node_modules/string_decoder/LICENSE +0 -48
  277. package/node_modules/string_decoder/README.md +0 -47
  278. package/node_modules/string_decoder/lib/string_decoder.js +0 -296
  279. package/node_modules/string_decoder/package.json +0 -34
  280. package/node_modules/tar-fs/.travis.yml +0 -6
  281. package/node_modules/tar-fs/test/fixtures/a/hello.txt +0 -1
  282. package/node_modules/tar-fs/test/fixtures/b/a/test.txt +0 -1
  283. package/node_modules/tar-fs/test/fixtures/d/file1 +0 -0
  284. package/node_modules/tar-fs/test/fixtures/d/file2 +0 -0
  285. package/node_modules/tar-fs/test/fixtures/d/sub-dir/file5 +0 -0
  286. package/node_modules/tar-fs/test/fixtures/d/sub-files/file3 +0 -0
  287. package/node_modules/tar-fs/test/fixtures/d/sub-files/file4 +0 -0
  288. package/node_modules/tar-fs/test/fixtures/e/directory/.ignore +0 -0
  289. package/node_modules/tar-fs/test/fixtures/e/file +0 -0
  290. package/node_modules/tar-fs/test/fixtures/invalid.tar +0 -0
  291. package/node_modules/tar-fs/test/index.js +0 -346
  292. package/node_modules/tar-stream/sandbox.js +0 -11
  293. package/node_modules/util-deprecate/History.md +0 -16
  294. package/node_modules/util-deprecate/LICENSE +0 -24
  295. package/node_modules/util-deprecate/README.md +0 -53
  296. package/node_modules/util-deprecate/browser.js +0 -67
  297. package/node_modules/util-deprecate/node.js +0 -6
  298. package/node_modules/util-deprecate/package.json +0 -27
  299. package/test-startup.sh +0 -14
@@ -0,0 +1,188 @@
1
+ function isBuffer(value) {
2
+ return Buffer.isBuffer(value) || value instanceof Uint8Array
3
+ }
4
+
5
+ function isEncoding(encoding) {
6
+ return Buffer.isEncoding(encoding)
7
+ }
8
+
9
+ function alloc(size, fill, encoding) {
10
+ return Buffer.alloc(size, fill, encoding)
11
+ }
12
+
13
+ function allocUnsafe(size) {
14
+ return Buffer.allocUnsafe(size)
15
+ }
16
+
17
+ function allocUnsafeSlow(size) {
18
+ return Buffer.allocUnsafeSlow(size)
19
+ }
20
+
21
+ function byteLength(string, encoding) {
22
+ return Buffer.byteLength(string, encoding)
23
+ }
24
+
25
+ function compare(a, b) {
26
+ return Buffer.compare(a, b)
27
+ }
28
+
29
+ function concat(buffers, totalLength) {
30
+ return Buffer.concat(buffers, totalLength)
31
+ }
32
+
33
+ function copy(source, target, targetStart, start, end) {
34
+ return toBuffer(source).copy(target, targetStart, start, end)
35
+ }
36
+
37
+ function equals(a, b) {
38
+ return toBuffer(a).equals(b)
39
+ }
40
+
41
+ function fill(buffer, value, offset, end, encoding) {
42
+ return toBuffer(buffer).fill(value, offset, end, encoding)
43
+ }
44
+
45
+ function from(value, encodingOrOffset, length) {
46
+ return Buffer.from(value, encodingOrOffset, length)
47
+ }
48
+
49
+ function includes(buffer, value, byteOffset, encoding) {
50
+ return toBuffer(buffer).includes(value, byteOffset, encoding)
51
+ }
52
+
53
+ function indexOf(buffer, value, byfeOffset, encoding) {
54
+ return toBuffer(buffer).indexOf(value, byfeOffset, encoding)
55
+ }
56
+
57
+ function lastIndexOf(buffer, value, byteOffset, encoding) {
58
+ return toBuffer(buffer).lastIndexOf(value, byteOffset, encoding)
59
+ }
60
+
61
+ function swap16(buffer) {
62
+ return toBuffer(buffer).swap16()
63
+ }
64
+
65
+ function swap32(buffer) {
66
+ return toBuffer(buffer).swap32()
67
+ }
68
+
69
+ function swap64(buffer) {
70
+ return toBuffer(buffer).swap64()
71
+ }
72
+
73
+ function toBuffer(buffer) {
74
+ if (Buffer.isBuffer(buffer)) return buffer
75
+ return Buffer.from(buffer.buffer, buffer.byteOffset, buffer.byteLength)
76
+ }
77
+
78
+ function toString(buffer, encoding, start, end) {
79
+ return toBuffer(buffer).toString(encoding, start, end)
80
+ }
81
+
82
+ function write(buffer, string, offset, length, encoding) {
83
+ return toBuffer(buffer).write(string, offset, length, encoding)
84
+ }
85
+
86
+ function readDoubleBE(buffer, offset) {
87
+ return toBuffer(buffer).readDoubleBE(offset)
88
+ }
89
+
90
+ function readDoubleLE(buffer, offset) {
91
+ return toBuffer(buffer).readDoubleLE(offset)
92
+ }
93
+
94
+ function readFloatBE(buffer, offset) {
95
+ return toBuffer(buffer).readFloatBE(offset)
96
+ }
97
+
98
+ function readFloatLE(buffer, offset) {
99
+ return toBuffer(buffer).readFloatLE(offset)
100
+ }
101
+
102
+ function readInt32BE(buffer, offset) {
103
+ return toBuffer(buffer).readInt32BE(offset)
104
+ }
105
+
106
+ function readInt32LE(buffer, offset) {
107
+ return toBuffer(buffer).readInt32LE(offset)
108
+ }
109
+
110
+ function readUInt32BE(buffer, offset) {
111
+ return toBuffer(buffer).readUInt32BE(offset)
112
+ }
113
+
114
+ function readUInt32LE(buffer, offset) {
115
+ return toBuffer(buffer).readUInt32LE(offset)
116
+ }
117
+
118
+ function writeDoubleBE(buffer, value, offset) {
119
+ return toBuffer(buffer).writeDoubleBE(value, offset)
120
+ }
121
+
122
+ function writeDoubleLE(buffer, value, offset) {
123
+ return toBuffer(buffer).writeDoubleLE(value, offset)
124
+ }
125
+
126
+ function writeFloatBE(buffer, value, offset) {
127
+ return toBuffer(buffer).writeFloatBE(value, offset)
128
+ }
129
+
130
+ function writeFloatLE(buffer, value, offset) {
131
+ return toBuffer(buffer).writeFloatLE(value, offset)
132
+ }
133
+
134
+ function writeInt32BE(buffer, value, offset) {
135
+ return toBuffer(buffer).writeInt32BE(value, offset)
136
+ }
137
+
138
+ function writeInt32LE(buffer, value, offset) {
139
+ return toBuffer(buffer).writeInt32LE(value, offset)
140
+ }
141
+
142
+ function writeUInt32BE(buffer, value, offset) {
143
+ return toBuffer(buffer).writeUInt32BE(value, offset)
144
+ }
145
+
146
+ function writeUInt32LE(buffer, value, offset) {
147
+ return toBuffer(buffer).writeUInt32LE(value, offset)
148
+ }
149
+
150
+ module.exports = {
151
+ isBuffer,
152
+ isEncoding,
153
+ alloc,
154
+ allocUnsafe,
155
+ allocUnsafeSlow,
156
+ byteLength,
157
+ compare,
158
+ concat,
159
+ copy,
160
+ equals,
161
+ fill,
162
+ from,
163
+ includes,
164
+ indexOf,
165
+ lastIndexOf,
166
+ swap16,
167
+ swap32,
168
+ swap64,
169
+ toBuffer,
170
+ toString,
171
+ write,
172
+ readDoubleBE,
173
+ readDoubleLE,
174
+ readFloatBE,
175
+ readFloatLE,
176
+ readInt32BE,
177
+ readInt32LE,
178
+ readUInt32BE,
179
+ readUInt32LE,
180
+ writeDoubleBE,
181
+ writeDoubleLE,
182
+ writeFloatBE,
183
+ writeFloatLE,
184
+ writeInt32BE,
185
+ writeInt32LE,
186
+ writeUInt32BE,
187
+ writeUInt32LE
188
+ }
@@ -0,0 +1,31 @@
1
+ function byteLength(string) {
2
+ return string.length
3
+ }
4
+
5
+ function toString(buffer) {
6
+ const len = buffer.byteLength
7
+
8
+ let result = ''
9
+
10
+ for (let i = 0; i < len; i++) {
11
+ result += String.fromCharCode(buffer[i])
12
+ }
13
+
14
+ return result
15
+ }
16
+
17
+ function write(buffer, string) {
18
+ const len = buffer.byteLength
19
+
20
+ for (let i = 0; i < len; i++) {
21
+ buffer[i] = string.charCodeAt(i)
22
+ }
23
+
24
+ return len
25
+ }
26
+
27
+ module.exports = {
28
+ byteLength,
29
+ toString,
30
+ write
31
+ }
@@ -0,0 +1,65 @@
1
+ const alphabet =
2
+ 'ABCDEFGHIJKLMNOPQRSTUVWXYZabcdefghijklmnopqrstuvwxyz0123456789+/'
3
+
4
+ const codes = new Uint8Array(256)
5
+
6
+ for (let i = 0; i < alphabet.length; i++) {
7
+ codes[alphabet.charCodeAt(i)] = i
8
+ }
9
+
10
+ codes[/* - */ 0x2d] = 62
11
+ codes[/* _ */ 0x5f] = 63
12
+
13
+ function byteLength(string) {
14
+ let len = string.length
15
+
16
+ if (string.charCodeAt(len - 1) === 0x3d) len--
17
+ if (len > 1 && string.charCodeAt(len - 1) === 0x3d) len--
18
+
19
+ return (len * 3) >>> 2
20
+ }
21
+
22
+ function toString(buffer) {
23
+ const len = buffer.byteLength
24
+
25
+ let result = ''
26
+
27
+ for (let i = 0; i < len; i += 3) {
28
+ result +=
29
+ alphabet[buffer[i] >> 2] +
30
+ alphabet[((buffer[i] & 3) << 4) | (buffer[i + 1] >> 4)] +
31
+ alphabet[((buffer[i + 1] & 15) << 2) | (buffer[i + 2] >> 6)] +
32
+ alphabet[buffer[i + 2] & 63]
33
+ }
34
+
35
+ if (len % 3 === 2) {
36
+ result = result.substring(0, result.length - 1) + '='
37
+ } else if (len % 3 === 1) {
38
+ result = result.substring(0, result.length - 2) + '=='
39
+ }
40
+
41
+ return result
42
+ }
43
+
44
+ function write(buffer, string) {
45
+ const len = buffer.byteLength
46
+
47
+ for (let i = 0, j = 0; j < len; i += 4) {
48
+ const a = codes[string.charCodeAt(i)]
49
+ const b = codes[string.charCodeAt(i + 1)]
50
+ const c = codes[string.charCodeAt(i + 2)]
51
+ const d = codes[string.charCodeAt(i + 3)]
52
+
53
+ buffer[j++] = (a << 2) | (b >> 4)
54
+ buffer[j++] = ((b & 15) << 4) | (c >> 2)
55
+ buffer[j++] = ((c & 3) << 6) | (d & 63)
56
+ }
57
+
58
+ return len
59
+ }
60
+
61
+ module.exports = {
62
+ byteLength,
63
+ toString,
64
+ write
65
+ }
@@ -0,0 +1,51 @@
1
+ function byteLength(string) {
2
+ return string.length >>> 1
3
+ }
4
+
5
+ function toString(buffer) {
6
+ const len = buffer.byteLength
7
+
8
+ buffer = new DataView(buffer.buffer, buffer.byteOffset, len)
9
+
10
+ let result = ''
11
+ let i = 0
12
+
13
+ for (let n = len - (len % 4); i < n; i += 4) {
14
+ result += buffer.getUint32(i).toString(16).padStart(8, '0')
15
+ }
16
+
17
+ for (; i < len; i++) {
18
+ result += buffer.getUint8(i).toString(16).padStart(2, '0')
19
+ }
20
+
21
+ return result
22
+ }
23
+
24
+ function write(buffer, string) {
25
+ const len = buffer.byteLength
26
+
27
+ for (let i = 0; i < len; i++) {
28
+ const a = hexValue(string.charCodeAt(i * 2))
29
+ const b = hexValue(string.charCodeAt(i * 2 + 1))
30
+
31
+ if (a === undefined || b === undefined) {
32
+ return buffer.subarray(0, i)
33
+ }
34
+
35
+ buffer[i] = (a << 4) | b
36
+ }
37
+
38
+ return len
39
+ }
40
+
41
+ module.exports = {
42
+ byteLength,
43
+ toString,
44
+ write
45
+ }
46
+
47
+ function hexValue(char) {
48
+ if (char >= 0x30 && char <= 0x39) return char - 0x30
49
+ if (char >= 0x41 && char <= 0x46) return char - 0x41 + 10
50
+ if (char >= 0x61 && char <= 0x66) return char - 0x61 + 10
51
+ }
@@ -0,0 +1,40 @@
1
+ function byteLength(string) {
2
+ return string.length * 2
3
+ }
4
+
5
+ function toString(buffer) {
6
+ const len = buffer.byteLength
7
+
8
+ let result = ''
9
+
10
+ for (let i = 0; i < len - 1; i += 2) {
11
+ result += String.fromCharCode(buffer[i] + buffer[i + 1] * 256)
12
+ }
13
+
14
+ return result
15
+ }
16
+
17
+ function write(buffer, string) {
18
+ const len = buffer.byteLength
19
+
20
+ let units = len
21
+
22
+ for (let i = 0; i < string.length; ++i) {
23
+ if ((units -= 2) < 0) break
24
+
25
+ const c = string.charCodeAt(i)
26
+ const hi = c >> 8
27
+ const lo = c % 256
28
+
29
+ buffer[i * 2] = lo
30
+ buffer[i * 2 + 1] = hi
31
+ }
32
+
33
+ return len
34
+ }
35
+
36
+ module.exports = {
37
+ byteLength,
38
+ toString,
39
+ write
40
+ }
@@ -0,0 +1,141 @@
1
+ function byteLength(string) {
2
+ let length = 0
3
+
4
+ for (let i = 0, n = string.length; i < n; i++) {
5
+ const code = string.charCodeAt(i)
6
+
7
+ if (code >= 0xd800 && code <= 0xdbff && i + 1 < n) {
8
+ const code = string.charCodeAt(i + 1)
9
+
10
+ if (code >= 0xdc00 && code <= 0xdfff) {
11
+ length += 4
12
+ i++
13
+ continue
14
+ }
15
+ }
16
+
17
+ if (code <= 0x7f) length += 1
18
+ else if (code <= 0x7ff) length += 2
19
+ else length += 3
20
+ }
21
+
22
+ return length
23
+ }
24
+
25
+ let toString
26
+
27
+ if (typeof TextDecoder !== 'undefined') {
28
+ const decoder = new TextDecoder()
29
+
30
+ toString = function toString(buffer) {
31
+ return decoder.decode(buffer)
32
+ }
33
+ } else {
34
+ toString = function toString(buffer) {
35
+ const len = buffer.byteLength
36
+
37
+ let output = ''
38
+ let i = 0
39
+
40
+ while (i < len) {
41
+ let byte = buffer[i]
42
+
43
+ if (byte <= 0x7f) {
44
+ output += String.fromCharCode(byte)
45
+ i++
46
+ continue
47
+ }
48
+
49
+ let bytesNeeded = 0
50
+ let codePoint = 0
51
+
52
+ if (byte <= 0xdf) {
53
+ bytesNeeded = 1
54
+ codePoint = byte & 0x1f
55
+ } else if (byte <= 0xef) {
56
+ bytesNeeded = 2
57
+ codePoint = byte & 0x0f
58
+ } else if (byte <= 0xf4) {
59
+ bytesNeeded = 3
60
+ codePoint = byte & 0x07
61
+ }
62
+
63
+ if (len - i - bytesNeeded > 0) {
64
+ let k = 0
65
+
66
+ while (k < bytesNeeded) {
67
+ byte = buffer[i + k + 1]
68
+ codePoint = (codePoint << 6) | (byte & 0x3f)
69
+ k += 1
70
+ }
71
+ } else {
72
+ codePoint = 0xfffd
73
+ bytesNeeded = len - i
74
+ }
75
+
76
+ output += String.fromCodePoint(codePoint)
77
+ i += bytesNeeded + 1
78
+ }
79
+
80
+ return output
81
+ }
82
+ }
83
+
84
+ let write
85
+
86
+ if (typeof TextEncoder !== 'undefined') {
87
+ const encoder = new TextEncoder()
88
+
89
+ write = function write(buffer, string) {
90
+ return encoder.encodeInto(string, buffer).written
91
+ }
92
+ } else {
93
+ write = function write(buffer, string) {
94
+ const len = buffer.byteLength
95
+
96
+ let i = 0
97
+ let j = 0
98
+
99
+ while (i < string.length) {
100
+ const code = string.codePointAt(i)
101
+
102
+ if (code <= 0x7f) {
103
+ buffer[j++] = code
104
+ i++
105
+ continue
106
+ }
107
+
108
+ let count = 0
109
+ let bits = 0
110
+
111
+ if (code <= 0x7ff) {
112
+ count = 6
113
+ bits = 0xc0
114
+ } else if (code <= 0xffff) {
115
+ count = 12
116
+ bits = 0xe0
117
+ } else if (code <= 0x1fffff) {
118
+ count = 18
119
+ bits = 0xf0
120
+ }
121
+
122
+ buffer[j++] = bits | (code >> count)
123
+ count -= 6
124
+
125
+ while (count >= 0) {
126
+ buffer[j++] = 0x80 | ((code >> count) & 0x3f)
127
+ count -= 6
128
+ }
129
+
130
+ i += code >= 0x10000 ? 2 : 1
131
+ }
132
+
133
+ return len
134
+ }
135
+ }
136
+
137
+ module.exports = {
138
+ byteLength,
139
+ toString,
140
+ write
141
+ }
@@ -0,0 +1,49 @@
1
+ {
2
+ "name": "b4a",
3
+ "version": "1.7.3",
4
+ "description": "Bridging the gap between buffers and typed arrays",
5
+ "exports": {
6
+ "./package": "./package.json",
7
+ ".": {
8
+ "react-native": "./react-native.js",
9
+ "browser": "./browser.js",
10
+ "default": "./index.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "browser.js",
15
+ "index.js",
16
+ "react-native.js",
17
+ "lib"
18
+ ],
19
+ "scripts": {
20
+ "test": "npm run lint && npm run test:bare && npm run test:node",
21
+ "test:bare": "bare test.mjs",
22
+ "test:node": "node test.mjs",
23
+ "lint": "prettier . --check"
24
+ },
25
+ "repository": {
26
+ "type": "git",
27
+ "url": "git+https://github.com/holepunchto/b4a.git"
28
+ },
29
+ "author": "Holepunch",
30
+ "license": "Apache-2.0",
31
+ "bugs": {
32
+ "url": "https://github.com/holepunchto/b4a/issues"
33
+ },
34
+ "homepage": "https://github.com/holepunchto/b4a#readme",
35
+ "devDependencies": {
36
+ "brittle": "^3.5.2",
37
+ "nanobench": "^3.0.0",
38
+ "prettier": "^3.6.2",
39
+ "prettier-config-holepunch": "^1.0.0"
40
+ },
41
+ "peerDependencies": {
42
+ "react-native-b4a": "*"
43
+ },
44
+ "peerDependenciesMeta": {
45
+ "react-native-b4a": {
46
+ "optional": true
47
+ }
48
+ }
49
+ }
@@ -0,0 +1,5 @@
1
+ try {
2
+ module.exports = require('react-native-b4a')
3
+ } catch {
4
+ module.exports = require('./browser')
5
+ }