es6-crawler-detect 3.2.0 → 4.0.0-beta.1

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 (361) hide show
  1. package/.babelrc +1 -1
  2. package/.mocharc.json +5 -0
  3. package/README.md +1 -0
  4. package/dist/main.bundle.js +1 -1
  5. package/eslint.config.mjs +62 -0
  6. package/example/node/package.json +1 -1
  7. package/example/node/server.js +38 -32
  8. package/example/node/yarn.lock +222 -99
  9. package/package.json +30 -25
  10. package/src/index.js +20 -14
  11. package/src/index.ts +18 -0
  12. package/src/lib/crawler/crawlers.js +9 -12
  13. package/src/lib/crawler/crawlers.ts +1397 -0
  14. package/src/lib/crawler/exclusions.js +7 -11
  15. package/src/lib/crawler/exclusions.ts +56 -0
  16. package/src/lib/crawler/headers.js +6 -10
  17. package/src/lib/crawler/headers.ts +18 -0
  18. package/src/lib/crawler/provider.js +1 -10
  19. package/src/lib/crawler/provider.ts +3 -0
  20. package/src/lib/crawler.js +61 -98
  21. package/src/lib/crawler.ts +128 -0
  22. package/src/types.js +2 -0
  23. package/src/types.ts +15 -0
  24. package/test/lib/crawler.spec.js +149 -0
  25. package/test/lib/crawler.spec.ts +116 -0
  26. package/test/lib/database/crawlers.txt +3651 -0
  27. package/test/lib/database/devices.txt +165636 -0
  28. package/tsconfig.json +16 -0
  29. package/webpack.common.js +20 -20
  30. package/webpack.dev.js +7 -7
  31. package/webpack.prod.js +14 -14
  32. package/.eslintignore +0 -6
  33. package/.eslintrc.json +0 -30
  34. package/example/node/node_modules/.bin/mime +0 -15
  35. package/example/node/node_modules/.bin/mime.cmd +0 -7
  36. package/example/node/node_modules/.yarn-integrity +0 -67
  37. package/example/node/node_modules/accepts/HISTORY.md +0 -236
  38. package/example/node/node_modules/accepts/LICENSE +0 -23
  39. package/example/node/node_modules/accepts/README.md +0 -142
  40. package/example/node/node_modules/accepts/index.js +0 -238
  41. package/example/node/node_modules/accepts/package.json +0 -47
  42. package/example/node/node_modules/array-flatten/LICENSE +0 -21
  43. package/example/node/node_modules/array-flatten/README.md +0 -43
  44. package/example/node/node_modules/array-flatten/array-flatten.js +0 -64
  45. package/example/node/node_modules/array-flatten/package.json +0 -39
  46. package/example/node/node_modules/body-parser/HISTORY.md +0 -624
  47. package/example/node/node_modules/body-parser/LICENSE +0 -23
  48. package/example/node/node_modules/body-parser/README.md +0 -456
  49. package/example/node/node_modules/body-parser/index.js +0 -157
  50. package/example/node/node_modules/body-parser/lib/read.js +0 -181
  51. package/example/node/node_modules/body-parser/lib/types/json.js +0 -230
  52. package/example/node/node_modules/body-parser/lib/types/raw.js +0 -101
  53. package/example/node/node_modules/body-parser/lib/types/text.js +0 -121
  54. package/example/node/node_modules/body-parser/lib/types/urlencoded.js +0 -284
  55. package/example/node/node_modules/body-parser/package.json +0 -52
  56. package/example/node/node_modules/bytes/History.md +0 -92
  57. package/example/node/node_modules/bytes/LICENSE +0 -23
  58. package/example/node/node_modules/bytes/Readme.md +0 -152
  59. package/example/node/node_modules/bytes/index.js +0 -166
  60. package/example/node/node_modules/bytes/package.json +0 -42
  61. package/example/node/node_modules/content-disposition/HISTORY.md +0 -60
  62. package/example/node/node_modules/content-disposition/LICENSE +0 -22
  63. package/example/node/node_modules/content-disposition/README.md +0 -142
  64. package/example/node/node_modules/content-disposition/index.js +0 -458
  65. package/example/node/node_modules/content-disposition/package.json +0 -44
  66. package/example/node/node_modules/content-type/HISTORY.md +0 -24
  67. package/example/node/node_modules/content-type/LICENSE +0 -22
  68. package/example/node/node_modules/content-type/README.md +0 -92
  69. package/example/node/node_modules/content-type/index.js +0 -222
  70. package/example/node/node_modules/content-type/package.json +0 -40
  71. package/example/node/node_modules/cookie/HISTORY.md +0 -128
  72. package/example/node/node_modules/cookie/LICENSE +0 -24
  73. package/example/node/node_modules/cookie/README.md +0 -257
  74. package/example/node/node_modules/cookie/index.js +0 -202
  75. package/example/node/node_modules/cookie/package.json +0 -40
  76. package/example/node/node_modules/cookie-signature/History.md +0 -38
  77. package/example/node/node_modules/cookie-signature/Readme.md +0 -42
  78. package/example/node/node_modules/cookie-signature/index.js +0 -51
  79. package/example/node/node_modules/cookie-signature/package.json +0 -18
  80. package/example/node/node_modules/debug/.coveralls.yml +0 -1
  81. package/example/node/node_modules/debug/.eslintrc +0 -11
  82. package/example/node/node_modules/debug/.travis.yml +0 -14
  83. package/example/node/node_modules/debug/CHANGELOG.md +0 -362
  84. package/example/node/node_modules/debug/LICENSE +0 -19
  85. package/example/node/node_modules/debug/Makefile +0 -50
  86. package/example/node/node_modules/debug/README.md +0 -312
  87. package/example/node/node_modules/debug/component.json +0 -19
  88. package/example/node/node_modules/debug/karma.conf.js +0 -70
  89. package/example/node/node_modules/debug/node.js +0 -1
  90. package/example/node/node_modules/debug/package.json +0 -49
  91. package/example/node/node_modules/debug/src/browser.js +0 -185
  92. package/example/node/node_modules/debug/src/debug.js +0 -202
  93. package/example/node/node_modules/debug/src/index.js +0 -10
  94. package/example/node/node_modules/debug/src/inspector-log.js +0 -15
  95. package/example/node/node_modules/debug/src/node.js +0 -248
  96. package/example/node/node_modules/depd/History.md +0 -96
  97. package/example/node/node_modules/depd/LICENSE +0 -22
  98. package/example/node/node_modules/depd/Readme.md +0 -280
  99. package/example/node/node_modules/depd/index.js +0 -522
  100. package/example/node/node_modules/depd/lib/browser/index.js +0 -77
  101. package/example/node/node_modules/depd/lib/compat/callsite-tostring.js +0 -103
  102. package/example/node/node_modules/depd/lib/compat/event-listener-count.js +0 -22
  103. package/example/node/node_modules/depd/lib/compat/index.js +0 -79
  104. package/example/node/node_modules/depd/package.json +0 -41
  105. package/example/node/node_modules/destroy/LICENSE +0 -22
  106. package/example/node/node_modules/destroy/README.md +0 -60
  107. package/example/node/node_modules/destroy/index.js +0 -75
  108. package/example/node/node_modules/destroy/package.json +0 -37
  109. package/example/node/node_modules/ee-first/LICENSE +0 -22
  110. package/example/node/node_modules/ee-first/README.md +0 -80
  111. package/example/node/node_modules/ee-first/index.js +0 -95
  112. package/example/node/node_modules/ee-first/package.json +0 -29
  113. package/example/node/node_modules/encodeurl/HISTORY.md +0 -14
  114. package/example/node/node_modules/encodeurl/LICENSE +0 -22
  115. package/example/node/node_modules/encodeurl/README.md +0 -128
  116. package/example/node/node_modules/encodeurl/index.js +0 -60
  117. package/example/node/node_modules/encodeurl/package.json +0 -40
  118. package/example/node/node_modules/escape-html/LICENSE +0 -24
  119. package/example/node/node_modules/escape-html/Readme.md +0 -43
  120. package/example/node/node_modules/escape-html/index.js +0 -78
  121. package/example/node/node_modules/escape-html/package.json +0 -24
  122. package/example/node/node_modules/etag/HISTORY.md +0 -83
  123. package/example/node/node_modules/etag/LICENSE +0 -22
  124. package/example/node/node_modules/etag/README.md +0 -159
  125. package/example/node/node_modules/etag/index.js +0 -131
  126. package/example/node/node_modules/etag/package.json +0 -47
  127. package/example/node/node_modules/express/History.md +0 -3510
  128. package/example/node/node_modules/express/LICENSE +0 -24
  129. package/example/node/node_modules/express/Readme.md +0 -158
  130. package/example/node/node_modules/express/index.js +0 -11
  131. package/example/node/node_modules/express/lib/application.js +0 -644
  132. package/example/node/node_modules/express/lib/express.js +0 -116
  133. package/example/node/node_modules/express/lib/middleware/init.js +0 -43
  134. package/example/node/node_modules/express/lib/middleware/query.js +0 -47
  135. package/example/node/node_modules/express/lib/request.js +0 -525
  136. package/example/node/node_modules/express/lib/response.js +0 -1147
  137. package/example/node/node_modules/express/lib/router/index.js +0 -668
  138. package/example/node/node_modules/express/lib/router/layer.js +0 -181
  139. package/example/node/node_modules/express/lib/router/route.js +0 -216
  140. package/example/node/node_modules/express/lib/utils.js +0 -302
  141. package/example/node/node_modules/express/lib/view.js +0 -182
  142. package/example/node/node_modules/express/package.json +0 -99
  143. package/example/node/node_modules/finalhandler/HISTORY.md +0 -187
  144. package/example/node/node_modules/finalhandler/LICENSE +0 -22
  145. package/example/node/node_modules/finalhandler/README.md +0 -148
  146. package/example/node/node_modules/finalhandler/index.js +0 -331
  147. package/example/node/node_modules/finalhandler/package.json +0 -45
  148. package/example/node/node_modules/forwarded/HISTORY.md +0 -21
  149. package/example/node/node_modules/forwarded/LICENSE +0 -22
  150. package/example/node/node_modules/forwarded/README.md +0 -57
  151. package/example/node/node_modules/forwarded/index.js +0 -90
  152. package/example/node/node_modules/forwarded/package.json +0 -45
  153. package/example/node/node_modules/fresh/HISTORY.md +0 -70
  154. package/example/node/node_modules/fresh/LICENSE +0 -23
  155. package/example/node/node_modules/fresh/README.md +0 -119
  156. package/example/node/node_modules/fresh/index.js +0 -137
  157. package/example/node/node_modules/fresh/package.json +0 -46
  158. package/example/node/node_modules/http-errors/HISTORY.md +0 -165
  159. package/example/node/node_modules/http-errors/LICENSE +0 -23
  160. package/example/node/node_modules/http-errors/README.md +0 -169
  161. package/example/node/node_modules/http-errors/index.js +0 -299
  162. package/example/node/node_modules/http-errors/package.json +0 -49
  163. package/example/node/node_modules/iconv-lite/Changelog.md +0 -162
  164. package/example/node/node_modules/iconv-lite/LICENSE +0 -21
  165. package/example/node/node_modules/iconv-lite/README.md +0 -156
  166. package/example/node/node_modules/iconv-lite/encodings/dbcs-codec.js +0 -555
  167. package/example/node/node_modules/iconv-lite/encodings/dbcs-data.js +0 -176
  168. package/example/node/node_modules/iconv-lite/encodings/index.js +0 -22
  169. package/example/node/node_modules/iconv-lite/encodings/internal.js +0 -188
  170. package/example/node/node_modules/iconv-lite/encodings/sbcs-codec.js +0 -72
  171. package/example/node/node_modules/iconv-lite/encodings/sbcs-data-generated.js +0 -451
  172. package/example/node/node_modules/iconv-lite/encodings/sbcs-data.js +0 -174
  173. package/example/node/node_modules/iconv-lite/encodings/tables/big5-added.json +0 -122
  174. package/example/node/node_modules/iconv-lite/encodings/tables/cp936.json +0 -264
  175. package/example/node/node_modules/iconv-lite/encodings/tables/cp949.json +0 -273
  176. package/example/node/node_modules/iconv-lite/encodings/tables/cp950.json +0 -177
  177. package/example/node/node_modules/iconv-lite/encodings/tables/eucjp.json +0 -182
  178. package/example/node/node_modules/iconv-lite/encodings/tables/gb18030-ranges.json +0 -1
  179. package/example/node/node_modules/iconv-lite/encodings/tables/gbk-added.json +0 -55
  180. package/example/node/node_modules/iconv-lite/encodings/tables/shiftjis.json +0 -125
  181. package/example/node/node_modules/iconv-lite/encodings/utf16.js +0 -177
  182. package/example/node/node_modules/iconv-lite/encodings/utf7.js +0 -290
  183. package/example/node/node_modules/iconv-lite/lib/bom-handling.js +0 -52
  184. package/example/node/node_modules/iconv-lite/lib/extend-node.js +0 -217
  185. package/example/node/node_modules/iconv-lite/lib/index.d.ts +0 -24
  186. package/example/node/node_modules/iconv-lite/lib/index.js +0 -153
  187. package/example/node/node_modules/iconv-lite/lib/streams.js +0 -121
  188. package/example/node/node_modules/iconv-lite/package.json +0 -46
  189. package/example/node/node_modules/inherits/LICENSE +0 -16
  190. package/example/node/node_modules/inherits/README.md +0 -42
  191. package/example/node/node_modules/inherits/inherits.js +0 -9
  192. package/example/node/node_modules/inherits/inherits_browser.js +0 -27
  193. package/example/node/node_modules/inherits/package.json +0 -29
  194. package/example/node/node_modules/ipaddr.js/LICENSE +0 -19
  195. package/example/node/node_modules/ipaddr.js/README.md +0 -233
  196. package/example/node/node_modules/ipaddr.js/ipaddr.min.js +0 -1
  197. package/example/node/node_modules/ipaddr.js/lib/ipaddr.js +0 -673
  198. package/example/node/node_modules/ipaddr.js/lib/ipaddr.js.d.ts +0 -68
  199. package/example/node/node_modules/ipaddr.js/package.json +0 -35
  200. package/example/node/node_modules/media-typer/HISTORY.md +0 -22
  201. package/example/node/node_modules/media-typer/LICENSE +0 -22
  202. package/example/node/node_modules/media-typer/README.md +0 -81
  203. package/example/node/node_modules/media-typer/index.js +0 -270
  204. package/example/node/node_modules/media-typer/package.json +0 -26
  205. package/example/node/node_modules/merge-descriptors/HISTORY.md +0 -21
  206. package/example/node/node_modules/merge-descriptors/LICENSE +0 -23
  207. package/example/node/node_modules/merge-descriptors/README.md +0 -48
  208. package/example/node/node_modules/merge-descriptors/index.js +0 -60
  209. package/example/node/node_modules/merge-descriptors/package.json +0 -32
  210. package/example/node/node_modules/methods/HISTORY.md +0 -29
  211. package/example/node/node_modules/methods/LICENSE +0 -24
  212. package/example/node/node_modules/methods/README.md +0 -51
  213. package/example/node/node_modules/methods/index.js +0 -69
  214. package/example/node/node_modules/methods/package.json +0 -36
  215. package/example/node/node_modules/mime/CHANGELOG.md +0 -164
  216. package/example/node/node_modules/mime/LICENSE +0 -21
  217. package/example/node/node_modules/mime/README.md +0 -90
  218. package/example/node/node_modules/mime/cli.js +0 -8
  219. package/example/node/node_modules/mime/mime.js +0 -108
  220. package/example/node/node_modules/mime/package.json +0 -44
  221. package/example/node/node_modules/mime/src/build.js +0 -53
  222. package/example/node/node_modules/mime/src/test.js +0 -60
  223. package/example/node/node_modules/mime/types.json +0 -1
  224. package/example/node/node_modules/mime-db/HISTORY.md +0 -499
  225. package/example/node/node_modules/mime-db/LICENSE +0 -22
  226. package/example/node/node_modules/mime-db/README.md +0 -100
  227. package/example/node/node_modules/mime-db/db.json +0 -8471
  228. package/example/node/node_modules/mime-db/index.js +0 -11
  229. package/example/node/node_modules/mime-db/package.json +0 -59
  230. package/example/node/node_modules/mime-types/HISTORY.md +0 -388
  231. package/example/node/node_modules/mime-types/LICENSE +0 -23
  232. package/example/node/node_modules/mime-types/README.md +0 -113
  233. package/example/node/node_modules/mime-types/index.js +0 -188
  234. package/example/node/node_modules/mime-types/package.json +0 -44
  235. package/example/node/node_modules/ms/index.js +0 -152
  236. package/example/node/node_modules/ms/license.md +0 -21
  237. package/example/node/node_modules/ms/package.json +0 -37
  238. package/example/node/node_modules/ms/readme.md +0 -51
  239. package/example/node/node_modules/negotiator/HISTORY.md +0 -103
  240. package/example/node/node_modules/negotiator/LICENSE +0 -24
  241. package/example/node/node_modules/negotiator/README.md +0 -203
  242. package/example/node/node_modules/negotiator/index.js +0 -124
  243. package/example/node/node_modules/negotiator/lib/charset.js +0 -169
  244. package/example/node/node_modules/negotiator/lib/encoding.js +0 -184
  245. package/example/node/node_modules/negotiator/lib/language.js +0 -179
  246. package/example/node/node_modules/negotiator/lib/mediaType.js +0 -294
  247. package/example/node/node_modules/negotiator/package.json +0 -42
  248. package/example/node/node_modules/on-finished/HISTORY.md +0 -88
  249. package/example/node/node_modules/on-finished/LICENSE +0 -23
  250. package/example/node/node_modules/on-finished/README.md +0 -154
  251. package/example/node/node_modules/on-finished/index.js +0 -196
  252. package/example/node/node_modules/on-finished/package.json +0 -31
  253. package/example/node/node_modules/parseurl/HISTORY.md +0 -58
  254. package/example/node/node_modules/parseurl/LICENSE +0 -24
  255. package/example/node/node_modules/parseurl/README.md +0 -133
  256. package/example/node/node_modules/parseurl/index.js +0 -158
  257. package/example/node/node_modules/parseurl/package.json +0 -40
  258. package/example/node/node_modules/path-to-regexp/History.md +0 -36
  259. package/example/node/node_modules/path-to-regexp/LICENSE +0 -21
  260. package/example/node/node_modules/path-to-regexp/Readme.md +0 -35
  261. package/example/node/node_modules/path-to-regexp/index.js +0 -129
  262. package/example/node/node_modules/path-to-regexp/package.json +0 -30
  263. package/example/node/node_modules/proxy-addr/HISTORY.md +0 -161
  264. package/example/node/node_modules/proxy-addr/LICENSE +0 -22
  265. package/example/node/node_modules/proxy-addr/README.md +0 -139
  266. package/example/node/node_modules/proxy-addr/index.js +0 -327
  267. package/example/node/node_modules/proxy-addr/package.json +0 -47
  268. package/example/node/node_modules/qs/.editorconfig +0 -39
  269. package/example/node/node_modules/qs/.eslintignore +0 -2
  270. package/example/node/node_modules/qs/.eslintrc +0 -35
  271. package/example/node/node_modules/qs/.github/FUNDING.yml +0 -12
  272. package/example/node/node_modules/qs/.nycrc +0 -13
  273. package/example/node/node_modules/qs/CHANGELOG.md +0 -359
  274. package/example/node/node_modules/qs/LICENSE.md +0 -29
  275. package/example/node/node_modules/qs/README.md +0 -604
  276. package/example/node/node_modules/qs/dist/qs.js +0 -832
  277. package/example/node/node_modules/qs/lib/formats.js +0 -23
  278. package/example/node/node_modules/qs/lib/index.js +0 -11
  279. package/example/node/node_modules/qs/lib/parse.js +0 -257
  280. package/example/node/node_modules/qs/lib/stringify.js +0 -278
  281. package/example/node/node_modules/qs/lib/utils.js +0 -251
  282. package/example/node/node_modules/qs/package.json +0 -69
  283. package/example/node/node_modules/qs/test/parse.js +0 -772
  284. package/example/node/node_modules/qs/test/stringify.js +0 -793
  285. package/example/node/node_modules/qs/test/utils.js +0 -136
  286. package/example/node/node_modules/range-parser/HISTORY.md +0 -56
  287. package/example/node/node_modules/range-parser/LICENSE +0 -23
  288. package/example/node/node_modules/range-parser/README.md +0 -84
  289. package/example/node/node_modules/range-parser/index.js +0 -162
  290. package/example/node/node_modules/range-parser/package.json +0 -44
  291. package/example/node/node_modules/raw-body/HISTORY.md +0 -284
  292. package/example/node/node_modules/raw-body/LICENSE +0 -22
  293. package/example/node/node_modules/raw-body/README.md +0 -217
  294. package/example/node/node_modules/raw-body/index.d.ts +0 -87
  295. package/example/node/node_modules/raw-body/index.js +0 -286
  296. package/example/node/node_modules/raw-body/package.json +0 -48
  297. package/example/node/node_modules/safe-buffer/LICENSE +0 -21
  298. package/example/node/node_modules/safe-buffer/README.md +0 -584
  299. package/example/node/node_modules/safe-buffer/index.d.ts +0 -187
  300. package/example/node/node_modules/safe-buffer/index.js +0 -65
  301. package/example/node/node_modules/safe-buffer/package.json +0 -51
  302. package/example/node/node_modules/safer-buffer/LICENSE +0 -21
  303. package/example/node/node_modules/safer-buffer/Porting-Buffer.md +0 -268
  304. package/example/node/node_modules/safer-buffer/Readme.md +0 -156
  305. package/example/node/node_modules/safer-buffer/dangerous.js +0 -58
  306. package/example/node/node_modules/safer-buffer/package.json +0 -34
  307. package/example/node/node_modules/safer-buffer/safer.js +0 -77
  308. package/example/node/node_modules/safer-buffer/tests.js +0 -406
  309. package/example/node/node_modules/send/HISTORY.md +0 -506
  310. package/example/node/node_modules/send/LICENSE +0 -23
  311. package/example/node/node_modules/send/README.md +0 -327
  312. package/example/node/node_modules/send/index.js +0 -1133
  313. package/example/node/node_modules/send/node_modules/.bin/mime +0 -15
  314. package/example/node/node_modules/send/node_modules/.bin/mime.cmd +0 -7
  315. package/example/node/node_modules/send/node_modules/ms/index.js +0 -162
  316. package/example/node/node_modules/send/node_modules/ms/license.md +0 -21
  317. package/example/node/node_modules/send/node_modules/ms/package.json +0 -38
  318. package/example/node/node_modules/send/node_modules/ms/readme.md +0 -59
  319. package/example/node/node_modules/send/package.json +0 -61
  320. package/example/node/node_modules/serve-static/HISTORY.md +0 -459
  321. package/example/node/node_modules/serve-static/LICENSE +0 -25
  322. package/example/node/node_modules/serve-static/README.md +0 -257
  323. package/example/node/node_modules/serve-static/index.js +0 -210
  324. package/example/node/node_modules/serve-static/package.json +0 -42
  325. package/example/node/node_modules/setprototypeof/LICENSE +0 -13
  326. package/example/node/node_modules/setprototypeof/README.md +0 -31
  327. package/example/node/node_modules/setprototypeof/index.d.ts +0 -2
  328. package/example/node/node_modules/setprototypeof/index.js +0 -17
  329. package/example/node/node_modules/setprototypeof/package.json +0 -38
  330. package/example/node/node_modules/setprototypeof/test/index.js +0 -24
  331. package/example/node/node_modules/statuses/HISTORY.md +0 -65
  332. package/example/node/node_modules/statuses/LICENSE +0 -23
  333. package/example/node/node_modules/statuses/README.md +0 -127
  334. package/example/node/node_modules/statuses/codes.json +0 -66
  335. package/example/node/node_modules/statuses/index.js +0 -113
  336. package/example/node/node_modules/statuses/package.json +0 -48
  337. package/example/node/node_modules/toidentifier/HISTORY.md +0 -9
  338. package/example/node/node_modules/toidentifier/LICENSE +0 -21
  339. package/example/node/node_modules/toidentifier/README.md +0 -61
  340. package/example/node/node_modules/toidentifier/index.js +0 -32
  341. package/example/node/node_modules/toidentifier/package.json +0 -38
  342. package/example/node/node_modules/type-is/HISTORY.md +0 -259
  343. package/example/node/node_modules/type-is/LICENSE +0 -23
  344. package/example/node/node_modules/type-is/README.md +0 -170
  345. package/example/node/node_modules/type-is/index.js +0 -266
  346. package/example/node/node_modules/type-is/package.json +0 -45
  347. package/example/node/node_modules/unpipe/HISTORY.md +0 -4
  348. package/example/node/node_modules/unpipe/LICENSE +0 -22
  349. package/example/node/node_modules/unpipe/README.md +0 -43
  350. package/example/node/node_modules/unpipe/index.js +0 -69
  351. package/example/node/node_modules/unpipe/package.json +0 -27
  352. package/example/node/node_modules/utils-merge/LICENSE +0 -20
  353. package/example/node/node_modules/utils-merge/README.md +0 -34
  354. package/example/node/node_modules/utils-merge/index.js +0 -23
  355. package/example/node/node_modules/utils-merge/package.json +0 -40
  356. package/example/node/node_modules/vary/HISTORY.md +0 -39
  357. package/example/node/node_modules/vary/LICENSE +0 -22
  358. package/example/node/node_modules/vary/README.md +0 -101
  359. package/example/node/node_modules/vary/index.js +0 -149
  360. package/example/node/node_modules/vary/package.json +0 -43
  361. package/test/lib/crawler.test.js +0 -52
@@ -1,156 +0,0 @@
1
- # safer-buffer [![travis][travis-image]][travis-url] [![npm][npm-image]][npm-url] [![javascript style guide][standard-image]][standard-url] [![Security Responsible Disclosure][secuirty-image]][secuirty-url]
2
-
3
- [travis-image]: https://travis-ci.org/ChALkeR/safer-buffer.svg?branch=master
4
- [travis-url]: https://travis-ci.org/ChALkeR/safer-buffer
5
- [npm-image]: https://img.shields.io/npm/v/safer-buffer.svg
6
- [npm-url]: https://npmjs.org/package/safer-buffer
7
- [standard-image]: https://img.shields.io/badge/code_style-standard-brightgreen.svg
8
- [standard-url]: https://standardjs.com
9
- [secuirty-image]: https://img.shields.io/badge/Security-Responsible%20Disclosure-green.svg
10
- [secuirty-url]: https://github.com/nodejs/security-wg/blob/master/processes/responsible_disclosure_template.md
11
-
12
- Modern Buffer API polyfill without footguns, working on Node.js from 0.8 to current.
13
-
14
- ## How to use?
15
-
16
- First, port all `Buffer()` and `new Buffer()` calls to `Buffer.alloc()` and `Buffer.from()` API.
17
-
18
- Then, to achieve compatibility with outdated Node.js versions (`<4.5.0` and 5.x `<5.9.0`), use
19
- `const Buffer = require('safer-buffer').Buffer` in all files where you make calls to the new
20
- Buffer API. _Use `var` instead of `const` if you need that for your Node.js version range support._
21
-
22
- Also, see the
23
- [porting Buffer](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md) guide.
24
-
25
- ## Do I need it?
26
-
27
- Hopefully, not — dropping support for outdated Node.js versions should be fine nowdays, and that
28
- is the recommended path forward. You _do_ need to port to the `Buffer.alloc()` and `Buffer.from()`
29
- though.
30
-
31
- See the [porting guide](https://github.com/ChALkeR/safer-buffer/blob/master/Porting-Buffer.md)
32
- for a better description.
33
-
34
- ## Why not [safe-buffer](https://npmjs.com/safe-buffer)?
35
-
36
- _In short: while `safe-buffer` serves as a polyfill for the new API, it allows old API usage and
37
- itself contains footguns._
38
-
39
- `safe-buffer` could be used safely to get the new API while still keeping support for older
40
- Node.js versions (like this module), but while analyzing ecosystem usage of the old Buffer API
41
- I found out that `safe-buffer` is itself causing problems in some cases.
42
-
43
- For example, consider the following snippet:
44
-
45
- ```console
46
- $ cat example.unsafe.js
47
- console.log(Buffer(20))
48
- $ ./node-v6.13.0-linux-x64/bin/node example.unsafe.js
49
- <Buffer 0a 00 00 00 00 00 00 00 28 13 de 02 00 00 00 00 05 00 00 00>
50
- $ standard example.unsafe.js
51
- standard: Use JavaScript Standard Style (https://standardjs.com)
52
- /home/chalker/repo/safer-buffer/example.unsafe.js:2:13: 'Buffer()' was deprecated since v6. Use 'Buffer.alloc()' or 'Buffer.from()' (use 'https://www.npmjs.com/package/safe-buffer' for '<4.5.0') instead.
53
- ```
54
-
55
- This is allocates and writes to console an uninitialized chunk of memory.
56
- [standard](https://www.npmjs.com/package/standard) linter (among others) catch that and warn people
57
- to avoid using unsafe API.
58
-
59
- Let's now throw in `safe-buffer`!
60
-
61
- ```console
62
- $ cat example.safe-buffer.js
63
- const Buffer = require('safe-buffer').Buffer
64
- console.log(Buffer(20))
65
- $ standard example.safe-buffer.js
66
- $ ./node-v6.13.0-linux-x64/bin/node example.safe-buffer.js
67
- <Buffer 08 00 00 00 00 00 00 00 28 58 01 82 fe 7f 00 00 00 00 00 00>
68
- ```
69
-
70
- See the problem? Adding in `safe-buffer` _magically removes the lint warning_, but the behavior
71
- remains identiсal to what we had before, and when launched on Node.js 6.x LTS — this dumps out
72
- chunks of uninitialized memory.
73
- _And this code will still emit runtime warnings on Node.js 10.x and above._
74
-
75
- That was done by design. I first considered changing `safe-buffer`, prohibiting old API usage or
76
- emitting warnings on it, but that significantly diverges from `safe-buffer` design. After some
77
- discussion, it was decided to move my approach into a separate package, and _this is that separate
78
- package_.
79
-
80
- This footgun is not imaginary — I observed top-downloaded packages doing that kind of thing,
81
- «fixing» the lint warning by blindly including `safe-buffer` without any actual changes.
82
-
83
- Also in some cases, even if the API _was_ migrated to use of safe Buffer API — a random pull request
84
- can bring unsafe Buffer API usage back to the codebase by adding new calls — and that could go
85
- unnoticed even if you have a linter prohibiting that (becase of the reason stated above), and even
86
- pass CI. _I also observed that being done in popular packages._
87
-
88
- Some examples:
89
- * [webdriverio](https://github.com/webdriverio/webdriverio/commit/05cbd3167c12e4930f09ef7cf93b127ba4effae4#diff-124380949022817b90b622871837d56cR31)
90
- (a module with 548 759 downloads/month),
91
- * [websocket-stream](https://github.com/maxogden/websocket-stream/commit/c9312bd24d08271687d76da0fe3c83493871cf61)
92
- (218 288 d/m, fix in [maxogden/websocket-stream#142](https://github.com/maxogden/websocket-stream/pull/142)),
93
- * [node-serialport](https://github.com/node-serialport/node-serialport/commit/e8d9d2b16c664224920ce1c895199b1ce2def48c)
94
- (113 138 d/m, fix in [node-serialport/node-serialport#1510](https://github.com/node-serialport/node-serialport/pull/1510)),
95
- * [karma](https://github.com/karma-runner/karma/commit/3d94b8cf18c695104ca195334dc75ff054c74eec)
96
- (3 973 193 d/m, fix in [karma-runner/karma#2947](https://github.com/karma-runner/karma/pull/2947)),
97
- * [spdy-transport](https://github.com/spdy-http2/spdy-transport/commit/5375ac33f4a62a4f65bcfc2827447d42a5dbe8b1)
98
- (5 970 727 d/m, fix in [spdy-http2/spdy-transport#53](https://github.com/spdy-http2/spdy-transport/pull/53)).
99
- * And there are a lot more over the ecosystem.
100
-
101
- I filed a PR at
102
- [mysticatea/eslint-plugin-node#110](https://github.com/mysticatea/eslint-plugin-node/pull/110) to
103
- partially fix that (for cases when that lint rule is used), but it is a semver-major change for
104
- linter rules and presets, so it would take significant time for that to reach actual setups.
105
- _It also hasn't been released yet (2018-03-20)._
106
-
107
- Also, `safer-buffer` discourages the usage of `.allocUnsafe()`, which is often done by a mistake.
108
- It still supports it with an explicit concern barier, by placing it under
109
- `require('safer-buffer/dangereous')`.
110
-
111
- ## But isn't throwing bad?
112
-
113
- Not really. It's an error that could be noticed and fixed early, instead of causing havoc later like
114
- unguarded `new Buffer()` calls that end up receiving user input can do.
115
-
116
- This package affects only the files where `var Buffer = require('safer-buffer').Buffer` was done, so
117
- it is really simple to keep track of things and make sure that you don't mix old API usage with that.
118
- Also, CI should hint anything that you might have missed.
119
-
120
- New commits, if tested, won't land new usage of unsafe Buffer API this way.
121
- _Node.js 10.x also deals with that by printing a runtime depecation warning._
122
-
123
- ### Would it affect third-party modules?
124
-
125
- No, unless you explicitly do an awful thing like monkey-patching or overriding the built-in `Buffer`.
126
- Don't do that.
127
-
128
- ### But I don't want throwing…
129
-
130
- That is also fine!
131
-
132
- Also, it could be better in some cases when you don't comprehensive enough test coverage.
133
-
134
- In that case — just don't override `Buffer` and use
135
- `var SaferBuffer = require('safer-buffer').Buffer` instead.
136
-
137
- That way, everything using `Buffer` natively would still work, but there would be two drawbacks:
138
-
139
- * `Buffer.from`/`Buffer.alloc` won't be polyfilled — use `SaferBuffer.from` and
140
- `SaferBuffer.alloc` instead.
141
- * You are still open to accidentally using the insecure deprecated API — use a linter to catch that.
142
-
143
- Note that using a linter to catch accidential `Buffer` constructor usage in this case is strongly
144
- recommended. `Buffer` is not overriden in this usecase, so linters won't get confused.
145
-
146
- ## «Without footguns»?
147
-
148
- Well, it is still possible to do _some_ things with `Buffer` API, e.g. accessing `.buffer` property
149
- on older versions and duping things from there. You shouldn't do that in your code, probabably.
150
-
151
- The intention is to remove the most significant footguns that affect lots of packages in the
152
- ecosystem, and to do it in the proper way.
153
-
154
- Also, this package doesn't protect against security issues affecting some Node.js versions, so for
155
- usage in your own production code, it is still recommended to update to a Node.js version
156
- [supported by upstream](https://github.com/nodejs/release#release-schedule).
@@ -1,58 +0,0 @@
1
- /* eslint-disable node/no-deprecated-api */
2
-
3
- 'use strict'
4
-
5
- var buffer = require('buffer')
6
- var Buffer = buffer.Buffer
7
- var safer = require('./safer.js')
8
- var Safer = safer.Buffer
9
-
10
- var dangerous = {}
11
-
12
- var key
13
-
14
- for (key in safer) {
15
- if (!safer.hasOwnProperty(key)) continue
16
- dangerous[key] = safer[key]
17
- }
18
-
19
- var Dangereous = dangerous.Buffer = {}
20
-
21
- // Copy Safer API
22
- for (key in Safer) {
23
- if (!Safer.hasOwnProperty(key)) continue
24
- Dangereous[key] = Safer[key]
25
- }
26
-
27
- // Copy those missing unsafe methods, if they are present
28
- for (key in Buffer) {
29
- if (!Buffer.hasOwnProperty(key)) continue
30
- if (Dangereous.hasOwnProperty(key)) continue
31
- Dangereous[key] = Buffer[key]
32
- }
33
-
34
- if (!Dangereous.allocUnsafe) {
35
- Dangereous.allocUnsafe = function (size) {
36
- if (typeof size !== 'number') {
37
- throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
38
- }
39
- if (size < 0 || size >= 2 * (1 << 30)) {
40
- throw new RangeError('The value "' + size + '" is invalid for option "size"')
41
- }
42
- return Buffer(size)
43
- }
44
- }
45
-
46
- if (!Dangereous.allocUnsafeSlow) {
47
- Dangereous.allocUnsafeSlow = function (size) {
48
- if (typeof size !== 'number') {
49
- throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
50
- }
51
- if (size < 0 || size >= 2 * (1 << 30)) {
52
- throw new RangeError('The value "' + size + '" is invalid for option "size"')
53
- }
54
- return buffer.SlowBuffer(size)
55
- }
56
- }
57
-
58
- module.exports = dangerous
@@ -1,34 +0,0 @@
1
- {
2
- "name": "safer-buffer",
3
- "version": "2.1.2",
4
- "description": "Modern Buffer API polyfill without footguns",
5
- "main": "safer.js",
6
- "scripts": {
7
- "browserify-test": "browserify --external tape tests.js > browserify-tests.js && tape browserify-tests.js",
8
- "test": "standard && tape tests.js"
9
- },
10
- "author": {
11
- "name": "Nikita Skovoroda",
12
- "email": "chalkerx@gmail.com",
13
- "url": "https://github.com/ChALkeR"
14
- },
15
- "license": "MIT",
16
- "repository": {
17
- "type": "git",
18
- "url": "git+https://github.com/ChALkeR/safer-buffer.git"
19
- },
20
- "bugs": {
21
- "url": "https://github.com/ChALkeR/safer-buffer/issues"
22
- },
23
- "devDependencies": {
24
- "standard": "^11.0.1",
25
- "tape": "^4.9.0"
26
- },
27
- "files": [
28
- "Porting-Buffer.md",
29
- "Readme.md",
30
- "tests.js",
31
- "dangerous.js",
32
- "safer.js"
33
- ]
34
- }
@@ -1,77 +0,0 @@
1
- /* eslint-disable node/no-deprecated-api */
2
-
3
- 'use strict'
4
-
5
- var buffer = require('buffer')
6
- var Buffer = buffer.Buffer
7
-
8
- var safer = {}
9
-
10
- var key
11
-
12
- for (key in buffer) {
13
- if (!buffer.hasOwnProperty(key)) continue
14
- if (key === 'SlowBuffer' || key === 'Buffer') continue
15
- safer[key] = buffer[key]
16
- }
17
-
18
- var Safer = safer.Buffer = {}
19
- for (key in Buffer) {
20
- if (!Buffer.hasOwnProperty(key)) continue
21
- if (key === 'allocUnsafe' || key === 'allocUnsafeSlow') continue
22
- Safer[key] = Buffer[key]
23
- }
24
-
25
- safer.Buffer.prototype = Buffer.prototype
26
-
27
- if (!Safer.from || Safer.from === Uint8Array.from) {
28
- Safer.from = function (value, encodingOrOffset, length) {
29
- if (typeof value === 'number') {
30
- throw new TypeError('The "value" argument must not be of type number. Received type ' + typeof value)
31
- }
32
- if (value && typeof value.length === 'undefined') {
33
- throw new TypeError('The first argument must be one of type string, Buffer, ArrayBuffer, Array, or Array-like Object. Received type ' + typeof value)
34
- }
35
- return Buffer(value, encodingOrOffset, length)
36
- }
37
- }
38
-
39
- if (!Safer.alloc) {
40
- Safer.alloc = function (size, fill, encoding) {
41
- if (typeof size !== 'number') {
42
- throw new TypeError('The "size" argument must be of type number. Received type ' + typeof size)
43
- }
44
- if (size < 0 || size >= 2 * (1 << 30)) {
45
- throw new RangeError('The value "' + size + '" is invalid for option "size"')
46
- }
47
- var buf = Buffer(size)
48
- if (!fill || fill.length === 0) {
49
- buf.fill(0)
50
- } else if (typeof encoding === 'string') {
51
- buf.fill(fill, encoding)
52
- } else {
53
- buf.fill(fill)
54
- }
55
- return buf
56
- }
57
- }
58
-
59
- if (!safer.kStringMaxLength) {
60
- try {
61
- safer.kStringMaxLength = process.binding('buffer').kStringMaxLength
62
- } catch (e) {
63
- // we can't determine kStringMaxLength in environments where process.binding
64
- // is unsupported, so let's not set it
65
- }
66
- }
67
-
68
- if (!safer.constants) {
69
- safer.constants = {
70
- MAX_LENGTH: safer.kMaxLength
71
- }
72
- if (safer.kStringMaxLength) {
73
- safer.constants.MAX_STRING_LENGTH = safer.kStringMaxLength
74
- }
75
- }
76
-
77
- module.exports = safer