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,109 @@
1
+ inline v8::Local<v8::String> StringFromUtf8(v8::Isolate* isolate, const char* data, int length) {
2
+ return v8::String::NewFromUtf8(isolate, data, v8::NewStringType::kNormal, length).ToLocalChecked();
3
+ }
4
+
5
+ inline v8::Local<v8::String> InternalizedFromUtf8(v8::Isolate* isolate, const char* data, int length) {
6
+ return v8::String::NewFromUtf8(isolate, data, v8::NewStringType::kInternalized, length).ToLocalChecked();
7
+ }
8
+
9
+ inline v8::Local<v8::Value> InternalizedFromUtf8OrNull(v8::Isolate* isolate, const char* data, int length) {
10
+ if (data == NULL) return v8::Null(isolate);
11
+ return InternalizedFromUtf8(isolate, data, length);
12
+ }
13
+
14
+ inline v8::Local<v8::String> InternalizedFromLatin1(v8::Isolate* isolate, const char* str) {
15
+ return v8::String::NewFromOneByte(isolate, reinterpret_cast<const uint8_t*>(str), v8::NewStringType::kInternalized).ToLocalChecked();
16
+ }
17
+
18
+ inline void SetFrozen(v8::Isolate* isolate, v8::Local<v8::Context> ctx, v8::Local<v8::Object> obj, v8::Global<v8::String>& key, v8::Local<v8::Value> value) {
19
+ obj->DefineOwnProperty(ctx, key.Get(isolate), value, static_cast<v8::PropertyAttribute>(v8::DontDelete | v8::ReadOnly)).FromJust();
20
+ }
21
+
22
+ void ThrowError(const char* message) { EasyIsolate; isolate->ThrowException(v8::Exception::Error(StringFromUtf8(isolate, message, -1))); }
23
+ void ThrowTypeError(const char* message) { EasyIsolate; isolate->ThrowException(v8::Exception::TypeError(StringFromUtf8(isolate, message, -1))); }
24
+ void ThrowRangeError(const char* message) { EasyIsolate; isolate->ThrowException(v8::Exception::RangeError(StringFromUtf8(isolate, message, -1))); }
25
+
26
+ // Determines whether to skip the given character at the start of an SQL string.
27
+ inline bool IS_SKIPPED(char c) {
28
+ return c == ' ' || c == ';' || (c >= '\t' && c <= '\r');
29
+ }
30
+
31
+ // Allocates an empty array, without calling constructors/initializers.
32
+ template<class T> inline T* ALLOC_ARRAY(size_t count) {
33
+ return static_cast<T*>(::operator new[](count * sizeof(T)));
34
+ }
35
+
36
+ // Deallocates an array, without calling destructors.
37
+ template<class T> inline void FREE_ARRAY(T* array_pointer) {
38
+ ::operator delete[](array_pointer);
39
+ }
40
+
41
+ v8::Local<v8::FunctionTemplate> NewConstructorTemplate(
42
+ v8::Isolate* isolate,
43
+ v8::Local<v8::External> data,
44
+ v8::FunctionCallback func,
45
+ const char* name
46
+ ) {
47
+ v8::Local<v8::FunctionTemplate> t = v8::FunctionTemplate::New(isolate, func, data);
48
+ t->InstanceTemplate()->SetInternalFieldCount(1);
49
+ t->SetClassName(InternalizedFromLatin1(isolate, name));
50
+ return t;
51
+ }
52
+
53
+ void SetPrototypeMethod(
54
+ v8::Isolate* isolate,
55
+ v8::Local<v8::External> data,
56
+ v8::Local<v8::FunctionTemplate> recv,
57
+ const char* name,
58
+ v8::FunctionCallback func
59
+ ) {
60
+ v8::HandleScope scope(isolate);
61
+ recv->PrototypeTemplate()->Set(
62
+ InternalizedFromLatin1(isolate, name),
63
+ v8::FunctionTemplate::New(isolate, func, data, v8::Signature::New(isolate, recv))
64
+ );
65
+ }
66
+
67
+ void SetPrototypeSymbolMethod(
68
+ v8::Isolate* isolate,
69
+ v8::Local<v8::External> data,
70
+ v8::Local<v8::FunctionTemplate> recv,
71
+ v8::Local<v8::Symbol> symbol,
72
+ v8::FunctionCallback func
73
+ ) {
74
+ v8::HandleScope scope(isolate);
75
+ recv->PrototypeTemplate()->Set(
76
+ symbol,
77
+ v8::FunctionTemplate::New(isolate, func, data, v8::Signature::New(isolate, recv))
78
+ );
79
+ }
80
+
81
+ void SetPrototypeGetter(
82
+ v8::Isolate* isolate,
83
+ v8::Local<v8::External> data,
84
+ v8::Local<v8::FunctionTemplate> recv,
85
+ const char* name,
86
+ v8::AccessorNameGetterCallback func
87
+ ) {
88
+ v8::HandleScope scope(isolate);
89
+ recv->InstanceTemplate()->SetNativeDataProperty(
90
+ InternalizedFromLatin1(isolate, name),
91
+ func,
92
+ 0,
93
+ data
94
+ );
95
+ }
96
+
97
+ #if defined(V8_ENABLE_SANDBOX)
98
+ // When V8 Sandbox is enabled (in newer Electron versions), we need to use Buffer::Copy
99
+ // instead of Buffer::New to ensure the ArrayBuffer backing store is allocated inside the sandbox
100
+ static inline v8::MaybeLocal<v8::Object> BufferSandboxNew(v8::Isolate* isolate, char* data, size_t length, void (*finalizeCallback)(char*, void*), void* finalizeHint) {
101
+ v8::MaybeLocal<v8::Object> buffer = node::Buffer::Copy(isolate, data, length);
102
+ finalizeCallback(data, finalizeHint);
103
+ return buffer;
104
+ }
105
+ #define SAFE_NEW_BUFFER(env, data, length, finalizeCallback, finalizeHint) BufferSandboxNew(env, data, length, finalizeCallback, finalizeHint)
106
+ #else
107
+ // When V8 Sandbox is not enabled, we can use the more efficient Buffer::New
108
+ #define SAFE_NEW_BUFFER(env, data, length, finalizeCallback, finalizeHint) node::Buffer::New(env, data, length, finalizeCallback, finalizeHint)
109
+ #endif
@@ -0,0 +1,63 @@
1
+ #define NODE_ARGUMENTS const v8::FunctionCallbackInfo<v8::Value>&
2
+ #define NODE_ARGUMENTS_POINTER const v8::FunctionCallbackInfo<v8::Value>*
3
+ #define NODE_METHOD(name) void name(NODE_ARGUMENTS info)
4
+ #define NODE_GETTER(name) void name(v8::Local<v8::Name> _, const v8::PropertyCallbackInfo<v8::Value>& info)
5
+ #define INIT(name) v8::Local<v8::Function> name(v8::Isolate* isolate, v8::Local<v8::External> data)
6
+
7
+ #define EasyIsolate v8::Isolate* isolate = v8::Isolate::GetCurrent()
8
+ #define OnlyIsolate info.GetIsolate()
9
+ #define OnlyContext isolate->GetCurrentContext()
10
+ #define OnlyAddon static_cast<Addon*>(info.Data().As<v8::External>()->Value())
11
+ #define UseIsolate v8::Isolate* isolate = OnlyIsolate
12
+ #define UseContext v8::Local<v8::Context> ctx = OnlyContext
13
+ #define UseAddon Addon* addon = OnlyAddon
14
+ #define Unwrap node::ObjectWrap::Unwrap
15
+
16
+ #define REQUIRE_ARGUMENT_ANY(at, var) \
17
+ if (info.Length() <= (at())) \
18
+ return ThrowTypeError("Expected a "#at" argument"); \
19
+ var = info[at()]
20
+
21
+ #define _REQUIRE_ARGUMENT(at, var, Type, message, ...) \
22
+ if (info.Length() <= (at()) || !info[at()]->Is##Type()) \
23
+ return ThrowTypeError("Expected "#at" argument to be "#message); \
24
+ var = (info[at()].As<v8::Type>())__VA_ARGS__
25
+
26
+ #define REQUIRE_ARGUMENT_INT32(at, var) \
27
+ _REQUIRE_ARGUMENT(at, var, Int32, a 32-bit signed integer, ->Value())
28
+ #define REQUIRE_ARGUMENT_BOOLEAN(at, var) \
29
+ _REQUIRE_ARGUMENT(at, var, Boolean, a boolean, ->Value())
30
+ #define REQUIRE_ARGUMENT_STRING(at, var) \
31
+ _REQUIRE_ARGUMENT(at, var, String, a string)
32
+ #define REQUIRE_ARGUMENT_OBJECT(at, var) \
33
+ _REQUIRE_ARGUMENT(at, var, Object, an object)
34
+ #define REQUIRE_ARGUMENT_FUNCTION(at, var) \
35
+ _REQUIRE_ARGUMENT(at, var, Function, a function)
36
+
37
+ #define REQUIRE_DATABASE_OPEN(db) \
38
+ if (!db->open) \
39
+ return ThrowTypeError("The database connection is not open")
40
+ #define REQUIRE_DATABASE_NOT_BUSY(db) \
41
+ if (db->busy) \
42
+ return ThrowTypeError("This database connection is busy executing a query")
43
+ #define REQUIRE_DATABASE_NO_ITERATORS(db) \
44
+ if (db->iterators) \
45
+ return ThrowTypeError("This database connection is busy executing a query")
46
+ #define REQUIRE_DATABASE_NO_ITERATORS_UNLESS_UNSAFE(db) \
47
+ if (!db->unsafe_mode) { \
48
+ REQUIRE_DATABASE_NO_ITERATORS(db); \
49
+ } ((void)0)
50
+ #define REQUIRE_STATEMENT_NOT_LOCKED(stmt) \
51
+ if (stmt->locked) \
52
+ return ThrowTypeError("This statement is busy executing a query")
53
+
54
+ #define first() 0
55
+ #define second() 1
56
+ #define third() 2
57
+ #define fourth() 3
58
+ #define fifth() 4
59
+ #define sixth() 5
60
+ #define seventh() 6
61
+ #define eighth() 7
62
+ #define ninth() 8
63
+ #define tenth() 9
@@ -0,0 +1,71 @@
1
+ #define STATEMENT_BIND(handle) \
2
+ Binder binder(handle); \
3
+ if (!binder.Bind(info, info.Length(), stmt)) { \
4
+ sqlite3_clear_bindings(handle); \
5
+ return; \
6
+ } ((void)0)
7
+
8
+ #define STATEMENT_THROW_LOGIC() \
9
+ db->ThrowDatabaseError(); \
10
+ if (!bound) { sqlite3_clear_bindings(handle); } \
11
+ return
12
+
13
+ #define STATEMENT_RETURN_LOGIC(return_value) \
14
+ info.GetReturnValue().Set(return_value); \
15
+ if (!bound) { sqlite3_clear_bindings(handle); } \
16
+ return
17
+
18
+ #define STATEMENT_START_LOGIC(RETURNS_DATA_CHECK, MUTATE_CHECK) \
19
+ Statement* stmt = Unwrap<Statement>(info.This()); \
20
+ RETURNS_DATA_CHECK(); \
21
+ sqlite3_stmt* handle = stmt->handle; \
22
+ Database* db = stmt->db; \
23
+ REQUIRE_DATABASE_OPEN(db->GetState()); \
24
+ REQUIRE_DATABASE_NOT_BUSY(db->GetState()); \
25
+ MUTATE_CHECK(); \
26
+ const bool bound = stmt->bound; \
27
+ if (!bound) { \
28
+ STATEMENT_BIND(handle); \
29
+ } else if (info.Length() > 0) { \
30
+ return ThrowTypeError("This statement already has bound parameters"); \
31
+ } ((void)0)
32
+
33
+
34
+ #define STATEMENT_THROW() db->GetState()->busy = false; STATEMENT_THROW_LOGIC()
35
+ #define STATEMENT_RETURN(x) db->GetState()->busy = false; STATEMENT_RETURN_LOGIC(x)
36
+ #define STATEMENT_START(x, y) \
37
+ STATEMENT_START_LOGIC(x, y); \
38
+ db->GetState()->busy = true; \
39
+ UseIsolate; \
40
+ if (db->Log(isolate, handle)) { \
41
+ STATEMENT_THROW(); \
42
+ } ((void)0)
43
+
44
+
45
+ #define DOES_NOT_MUTATE() REQUIRE_STATEMENT_NOT_LOCKED(stmt)
46
+ #define DOES_MUTATE() \
47
+ REQUIRE_STATEMENT_NOT_LOCKED(stmt); \
48
+ REQUIRE_DATABASE_NO_ITERATORS_UNLESS_UNSAFE(db->GetState())
49
+ #define DOES_ADD_ITERATOR() \
50
+ DOES_NOT_MUTATE(); \
51
+ if (db->GetState()->iterators == USHRT_MAX) \
52
+ return ThrowRangeError("Too many active database iterators")
53
+ #define REQUIRE_STATEMENT_RETURNS_DATA() \
54
+ if (!stmt->returns_data) \
55
+ return ThrowTypeError("This statement does not return data. Use run() instead")
56
+ #define ALLOW_ANY_STATEMENT() \
57
+ ((void)0)
58
+
59
+
60
+ #define _FUNCTION_START(type) \
61
+ type* self = static_cast<type*>(sqlite3_user_data(invocation)); \
62
+ v8::Isolate* isolate = self->isolate; \
63
+ v8::HandleScope scope(isolate)
64
+
65
+ #define FUNCTION_START() \
66
+ _FUNCTION_START(CustomFunction)
67
+
68
+ #define AGGREGATE_START() \
69
+ _FUNCTION_START(CustomAggregate); \
70
+ Accumulator* acc = self->GetAccumulator(invocation); \
71
+ if (acc->value.IsEmpty()) return
@@ -0,0 +1,49 @@
1
+ class RowBuilder {
2
+ public:
3
+
4
+ explicit RowBuilder(
5
+ v8::Isolate* isolate,
6
+ sqlite3_stmt* handle,
7
+ bool safe_ints
8
+ ) :
9
+ isolate(isolate),
10
+ handle(handle),
11
+ column_count(-1),
12
+ safe_ints(safe_ints),
13
+ keys(isolate) {}
14
+
15
+ v8::Local<v8::Value> GetRowJS() {
16
+ if (column_count < 0) {
17
+ column_count = sqlite3_column_count(handle);
18
+ keys.reserve(column_count);
19
+ for (int i = 0; i < column_count; ++i) {
20
+ keys.emplace_back(
21
+ InternalizedFromUtf8(isolate, sqlite3_column_name(handle, i), -1)
22
+ .As<v8::Name>()
23
+ );
24
+ }
25
+ }
26
+
27
+ v8::LocalVector<v8::Value> values(isolate);
28
+ values.reserve(column_count);
29
+ for (int i = 0; i < column_count; ++i) {
30
+ values.emplace_back(
31
+ Data::GetValueJS(isolate, handle, i, safe_ints)
32
+ );
33
+ }
34
+
35
+ return v8::Object::New(isolate,
36
+ v8::Object::New(isolate)->GetPrototype(),
37
+ keys.data(),
38
+ values.data(),
39
+ column_count
40
+ );
41
+ }
42
+
43
+ private:
44
+ v8::Isolate* isolate;
45
+ sqlite3_stmt* handle;
46
+ int column_count;
47
+ const bool safe_ints;
48
+ v8::LocalVector<v8::Name> keys;
49
+ };
@@ -0,0 +1,201 @@
1
+ Apache License
2
+ Version 2.0, January 2004
3
+ http://www.apache.org/licenses/
4
+
5
+ TERMS AND CONDITIONS FOR USE, REPRODUCTION, AND DISTRIBUTION
6
+
7
+ 1. Definitions.
8
+
9
+ "License" shall mean the terms and conditions for use, reproduction,
10
+ and distribution as defined by Sections 1 through 9 of this document.
11
+
12
+ "Licensor" shall mean the copyright owner or entity authorized by
13
+ the copyright owner that is granting the License.
14
+
15
+ "Legal Entity" shall mean the union of the acting entity and all
16
+ other entities that control, are controlled by, or are under common
17
+ control with that entity. For the purposes of this definition,
18
+ "control" means (i) the power, direct or indirect, to cause the
19
+ direction or management of such entity, whether by contract or
20
+ otherwise, or (ii) ownership of fifty percent (50%) or more of the
21
+ outstanding shares, or (iii) beneficial ownership of such entity.
22
+
23
+ "You" (or "Your") shall mean an individual or Legal Entity
24
+ exercising permissions granted by this License.
25
+
26
+ "Source" form shall mean the preferred form for making modifications,
27
+ including but not limited to software source code, documentation
28
+ source, and configuration files.
29
+
30
+ "Object" form shall mean any form resulting from mechanical
31
+ transformation or translation of a Source form, including but
32
+ not limited to compiled object code, generated documentation,
33
+ and conversions to other media types.
34
+
35
+ "Work" shall mean the work of authorship, whether in Source or
36
+ Object form, made available under the License, as indicated by a
37
+ copyright notice that is included in or attached to the work
38
+ (an example is provided in the Appendix below).
39
+
40
+ "Derivative Works" shall mean any work, whether in Source or Object
41
+ form, that is based on (or derived from) the Work and for which the
42
+ editorial revisions, annotations, elaborations, or other modifications
43
+ represent, as a whole, an original work of authorship. For the purposes
44
+ of this License, Derivative Works shall not include works that remain
45
+ separable from, or merely link (or bind by name) to the interfaces of,
46
+ the Work and Derivative Works thereof.
47
+
48
+ "Contribution" shall mean any work of authorship, including
49
+ the original version of the Work and any modifications or additions
50
+ to that Work or Derivative Works thereof, that is intentionally
51
+ submitted to Licensor for inclusion in the Work by the copyright owner
52
+ or by an individual or Legal Entity authorized to submit on behalf of
53
+ the copyright owner. For the purposes of this definition, "submitted"
54
+ means any form of electronic, verbal, or written communication sent
55
+ to the Licensor or its representatives, including but not limited to
56
+ communication on electronic mailing lists, source code control systems,
57
+ and issue tracking systems that are managed by, or on behalf of, the
58
+ Licensor for the purpose of discussing and improving the Work, but
59
+ excluding communication that is conspicuously marked or otherwise
60
+ designated in writing by the copyright owner as "Not a Contribution."
61
+
62
+ "Contributor" shall mean Licensor and any individual or Legal Entity
63
+ on behalf of whom a Contribution has been received by Licensor and
64
+ subsequently incorporated within the Work.
65
+
66
+ 2. Grant of Copyright License. Subject to the terms and conditions of
67
+ this License, each Contributor hereby grants to You a perpetual,
68
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
69
+ copyright license to reproduce, prepare Derivative Works of,
70
+ publicly display, publicly perform, sublicense, and distribute the
71
+ Work and such Derivative Works in Source or Object form.
72
+
73
+ 3. Grant of Patent License. Subject to the terms and conditions of
74
+ this License, each Contributor hereby grants to You a perpetual,
75
+ worldwide, non-exclusive, no-charge, royalty-free, irrevocable
76
+ (except as stated in this section) patent license to make, have made,
77
+ use, offer to sell, sell, import, and otherwise transfer the Work,
78
+ where such license applies only to those patent claims licensable
79
+ by such Contributor that are necessarily infringed by their
80
+ Contribution(s) alone or by combination of their Contribution(s)
81
+ with the Work to which such Contribution(s) was submitted. If You
82
+ institute patent litigation against any entity (including a
83
+ cross-claim or counterclaim in a lawsuit) alleging that the Work
84
+ or a Contribution incorporated within the Work constitutes direct
85
+ or contributory patent infringement, then any patent licenses
86
+ granted to You under this License for that Work shall terminate
87
+ as of the date such litigation is filed.
88
+
89
+ 4. Redistribution. You may reproduce and distribute copies of the
90
+ Work or Derivative Works thereof in any medium, with or without
91
+ modifications, and in Source or Object form, provided that You
92
+ meet the following conditions:
93
+
94
+ (a) You must give any other recipients of the Work or
95
+ Derivative Works a copy of this License; and
96
+
97
+ (b) You must cause any modified files to carry prominent notices
98
+ stating that You changed the files; and
99
+
100
+ (c) You must retain, in the Source form of any Derivative Works
101
+ that You distribute, all copyright, patent, trademark, and
102
+ attribution notices from the Source form of the Work,
103
+ excluding those notices that do not pertain to any part of
104
+ the Derivative Works; and
105
+
106
+ (d) If the Work includes a "NOTICE" text file as part of its
107
+ distribution, then any Derivative Works that You distribute must
108
+ include a readable copy of the attribution notices contained
109
+ within such NOTICE file, excluding those notices that do not
110
+ pertain to any part of the Derivative Works, in at least one
111
+ of the following places: within a NOTICE text file distributed
112
+ as part of the Derivative Works; within the Source form or
113
+ documentation, if provided along with the Derivative Works; or,
114
+ within a display generated by the Derivative Works, if and
115
+ wherever such third-party notices normally appear. The contents
116
+ of the NOTICE file are for informational purposes only and
117
+ do not modify the License. You may add Your own attribution
118
+ notices within Derivative Works that You distribute, alongside
119
+ or as an addendum to the NOTICE text from the Work, provided
120
+ that such additional attribution notices cannot be construed
121
+ as modifying the License.
122
+
123
+ You may add Your own copyright statement to Your modifications and
124
+ may provide additional or different license terms and conditions
125
+ for use, reproduction, or distribution of Your modifications, or
126
+ for any such Derivative Works as a whole, provided Your use,
127
+ reproduction, and distribution of the Work otherwise complies with
128
+ the conditions stated in this License.
129
+
130
+ 5. Submission of Contributions. Unless You explicitly state otherwise,
131
+ any Contribution intentionally submitted for inclusion in the Work
132
+ by You to the Licensor shall be under the terms and conditions of
133
+ this License, without any additional terms or conditions.
134
+ Notwithstanding the above, nothing herein shall supersede or modify
135
+ the terms of any separate license agreement you may have executed
136
+ with Licensor regarding such Contributions.
137
+
138
+ 6. Trademarks. This License does not grant permission to use the trade
139
+ names, trademarks, service marks, or product names of the Licensor,
140
+ except as required for reasonable and customary use in describing the
141
+ origin of the Work and reproducing the content of the NOTICE file.
142
+
143
+ 7. Disclaimer of Warranty. Unless required by applicable law or
144
+ agreed to in writing, Licensor provides the Work (and each
145
+ Contributor provides its Contributions) on an "AS IS" BASIS,
146
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or
147
+ implied, including, without limitation, any warranties or conditions
148
+ of TITLE, NON-INFRINGEMENT, MERCHANTABILITY, or FITNESS FOR A
149
+ PARTICULAR PURPOSE. You are solely responsible for determining the
150
+ appropriateness of using or redistributing the Work and assume any
151
+ risks associated with Your exercise of permissions under this License.
152
+
153
+ 8. Limitation of Liability. In no event and under no legal theory,
154
+ whether in tort (including negligence), contract, or otherwise,
155
+ unless required by applicable law (such as deliberate and grossly
156
+ negligent acts) or agreed to in writing, shall any Contributor be
157
+ liable to You for damages, including any direct, indirect, special,
158
+ incidental, or consequential damages of any character arising as a
159
+ result of this License or out of the use or inability to use the
160
+ Work (including but not limited to damages for loss of goodwill,
161
+ work stoppage, computer failure or malfunction, or any and all
162
+ other commercial damages or losses), even if such Contributor
163
+ has been advised of the possibility of such damages.
164
+
165
+ 9. Accepting Warranty or Additional Liability. While redistributing
166
+ the Work or Derivative Works thereof, You may choose to offer,
167
+ and charge a fee for, acceptance of support, warranty, indemnity,
168
+ or other liability obligations and/or rights consistent with this
169
+ License. However, in accepting such obligations, You may act only
170
+ on Your own behalf and on Your sole responsibility, not on behalf
171
+ of any other Contributor, and only if You agree to indemnify,
172
+ defend, and hold each Contributor harmless for any liability
173
+ incurred by, or claims asserted against, such Contributor by reason
174
+ of your accepting any such warranty or additional liability.
175
+
176
+ END OF TERMS AND CONDITIONS
177
+
178
+ APPENDIX: How to apply the Apache License to your work.
179
+
180
+ To apply the Apache License to your work, attach the following
181
+ boilerplate notice, with the fields enclosed by brackets "[]"
182
+ replaced with your own identifying information. (Don't include
183
+ the brackets!) The text should be enclosed in the appropriate
184
+ comment syntax for the file format. We also recommend that a
185
+ file or class name and description of purpose be included on the
186
+ same "printed page" as the copyright notice for easier
187
+ identification within third-party archives.
188
+
189
+ Copyright [yyyy] [name of copyright owner]
190
+
191
+ Licensed under the Apache License, Version 2.0 (the "License");
192
+ you may not use this file except in compliance with the License.
193
+ You may obtain a copy of the License at
194
+
195
+ http://www.apache.org/licenses/LICENSE-2.0
196
+
197
+ Unless required by applicable law or agreed to in writing, software
198
+ distributed under the License is distributed on an "AS IS" BASIS,
199
+ WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
200
+ See the License for the specific language governing permissions and
201
+ limitations under the License.
@@ -0,0 +1,17 @@
1
+ # events-universal
2
+
3
+ Universal wrapper for the Node.js `events` module.
4
+
5
+ ```
6
+ npm i events-universal
7
+ ```
8
+
9
+ ## Usage
10
+
11
+ ```js
12
+ const EventEmitter = require('events-universal')
13
+ ```
14
+
15
+ ## License
16
+
17
+ Apache-2.0
@@ -0,0 +1 @@
1
+ module.exports = require('bare-events')
@@ -0,0 +1 @@
1
+ module.exports = require('events')
@@ -0,0 +1 @@
1
+ module.exports = require('bare-events')
@@ -0,0 +1,39 @@
1
+ {
2
+ "name": "events-universal",
3
+ "version": "1.0.1",
4
+ "description": "Universal wrapper for the Node.js events module",
5
+ "exports": {
6
+ "./package": "./package.json",
7
+ ".": {
8
+ "bare": "./bare.js",
9
+ "react-native": "./react-native.js",
10
+ "default": "./default.js"
11
+ }
12
+ },
13
+ "files": [
14
+ "index.js",
15
+ "default.js",
16
+ "bare.js",
17
+ "react-native.js"
18
+ ],
19
+ "scripts": {
20
+ "test": "prettier . --check"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/holepunchto/events-universal.git"
25
+ },
26
+ "author": "Holepunch",
27
+ "license": "Apache-2.0",
28
+ "bugs": {
29
+ "url": "https://github.com/holepunchto/events-universal/issues"
30
+ },
31
+ "homepage": "https://github.com/holepunchto/events-universal#readme",
32
+ "dependencies": {
33
+ "bare-events": "^2.7.0"
34
+ },
35
+ "devDependencies": {
36
+ "prettier": "^3.4.2",
37
+ "prettier-config-holepunch": "^1.0.0"
38
+ }
39
+ }
@@ -0,0 +1 @@
1
+ module.exports = require('bare-events')
@@ -1,6 +1,6 @@
1
1
  The MIT License (MIT)
2
2
 
3
- Copyright (c) 2018 Mathias Buus
3
+ Copyright (c) 2019 Mathias Buus
4
4
 
5
5
  Permission is hereby granted, free of charge, to any person obtaining a copy
6
6
  of this software and associated documentation files (the "Software"), to deal
@@ -0,0 +1,78 @@
1
+ # fast-fifo
2
+
3
+ A fast fifo implementation similar to the one powering nextTick in Node.js core
4
+
5
+ ```
6
+ npm install fast-fifo
7
+ ```
8
+
9
+ Uses a linked list of growing fixed sized arrays to implement the FIFO to avoid
10
+ allocating a wrapper object for each item.
11
+
12
+ ## Usage
13
+
14
+ ``` js
15
+ const FIFO = require('fast-fifo')
16
+
17
+ const q = new FIFO()
18
+
19
+ q.push('hello')
20
+ q.push('world')
21
+
22
+ q.shift() // returns hello
23
+ q.shift() // returns world
24
+ ```
25
+
26
+ ## API
27
+
28
+ #### `q = new FIFO()`
29
+
30
+ Create a new FIFO.
31
+
32
+ #### `q.push(value)`
33
+
34
+ Push a value to the FIFO. `value` can be anything other than undefined.
35
+
36
+ #### `value = q.shift()`
37
+
38
+ Return the oldest value from the FIFO.
39
+
40
+ #### `q.clear()`
41
+
42
+ Remove all values from the FIFO.
43
+
44
+ #### `bool = q.isEmpty()`
45
+
46
+ Returns `true` if the FIFO is empty and false otherwise.
47
+
48
+ #### `value = q.peek()`
49
+
50
+ Return the oldest value from the FIFO without shifting it out.
51
+
52
+ #### `len = q.length`
53
+
54
+ Get the number of entries remaining in the FIFO.
55
+
56
+ ## Benchmarks
57
+
58
+ Included in bench.js is a simple benchmark that benchmarks this against a simple
59
+ linked list based FIFO.
60
+
61
+ On my machine the benchmark looks like this:
62
+
63
+ ```
64
+ fifo bulk push and shift: 2881.508ms
65
+ fifo individual push and shift: 3248.437ms
66
+ fast-fifo bulk push and shift: 1606.972ms
67
+ fast-fifo individual push and shift: 1328.064ms
68
+ fifo bulk push and shift: 3266.902ms
69
+ fifo individual push and shift: 3320.944ms
70
+ fast-fifo bulk push and shift: 1858.307ms
71
+ fast-fifo individual push and shift: 1516.983ms
72
+ ```
73
+
74
+ YMMV
75
+
76
+ ## License
77
+
78
+ MIT