@corellium/corellium-cli 1.4.0 → 1.5.0

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 (614) hide show
  1. package/.eslintrc.js +12 -16
  2. package/.gitlab-ci.yml +13 -13
  3. package/.nvmrc +1 -1
  4. package/.nycrc +14 -14
  5. package/.prettierrc.js +8 -7
  6. package/README.md +13 -6
  7. package/docs/OVERVIEW.md +57 -27
  8. package/index.js +8 -8
  9. package/lint-staged.config.js +3 -6
  10. package/node_modules/@babel/cli/README.md +1 -1
  11. package/node_modules/@babel/cli/bin/babel-external-helpers.mjs +3 -0
  12. package/node_modules/@babel/cli/bin/babel.mjs +3 -0
  13. package/node_modules/@babel/cli/lib/babel/dir.js +23 -73
  14. package/node_modules/@babel/cli/lib/babel/dir.js.map +1 -0
  15. package/node_modules/@babel/cli/lib/babel/file.js +27 -72
  16. package/node_modules/@babel/cli/lib/babel/file.js.map +1 -0
  17. package/node_modules/@babel/cli/lib/babel/index.js +6 -8
  18. package/node_modules/@babel/cli/lib/babel/index.js.map +1 -0
  19. package/node_modules/@babel/cli/lib/babel/options.js +70 -143
  20. package/node_modules/@babel/cli/lib/babel/options.js.map +1 -0
  21. package/node_modules/@babel/cli/lib/babel/util.js +39 -59
  22. package/node_modules/@babel/cli/lib/babel/util.js.map +1 -0
  23. package/node_modules/@babel/cli/lib/babel/watcher.js +19 -52
  24. package/node_modules/@babel/cli/lib/babel/watcher.js.map +1 -0
  25. package/node_modules/@babel/cli/lib/babel-external-helpers.js +14 -21
  26. package/node_modules/@babel/cli/lib/babel-external-helpers.js.map +1 -0
  27. package/node_modules/@babel/cli/package.json +11 -9
  28. package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs +19 -29
  29. package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.mjs.map +1 -1
  30. package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js +19 -29
  31. package/node_modules/@jridgewell/resolve-uri/dist/resolve-uri.umd.js.map +1 -1
  32. package/node_modules/@jridgewell/resolve-uri/package.json +2 -2
  33. package/node_modules/@jridgewell/sourcemap-codec/README.md +147 -83
  34. package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs +351 -91
  35. package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.mjs.map +1 -1
  36. package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js +354 -90
  37. package/node_modules/@jridgewell/sourcemap-codec/dist/sourcemap-codec.umd.js.map +1 -1
  38. package/node_modules/@jridgewell/sourcemap-codec/dist/types/scopes.d.ts +49 -0
  39. package/node_modules/@jridgewell/sourcemap-codec/dist/types/sourcemap-codec.d.ts +2 -0
  40. package/node_modules/@jridgewell/sourcemap-codec/dist/types/strings.d.ts +15 -0
  41. package/node_modules/@jridgewell/sourcemap-codec/dist/types/vlq.d.ts +6 -0
  42. package/node_modules/@jridgewell/sourcemap-codec/package.json +7 -7
  43. package/node_modules/@jridgewell/trace-mapping/README.md +5 -0
  44. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs +202 -174
  45. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.mjs.map +1 -1
  46. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js +216 -182
  47. package/node_modules/@jridgewell/trace-mapping/dist/trace-mapping.umd.js.map +1 -1
  48. package/node_modules/@jridgewell/trace-mapping/dist/types/any-map.d.ts +1 -1
  49. package/node_modules/@jridgewell/trace-mapping/dist/types/binary-search.d.ts +1 -1
  50. package/node_modules/@jridgewell/trace-mapping/dist/types/by-source.d.ts +1 -1
  51. package/node_modules/@jridgewell/trace-mapping/dist/types/sourcemap-segment.d.ts +8 -8
  52. package/node_modules/@jridgewell/trace-mapping/dist/types/trace-mapping.d.ts +33 -28
  53. package/node_modules/@jridgewell/trace-mapping/dist/types/types.d.ts +23 -16
  54. package/node_modules/@jridgewell/trace-mapping/package.json +20 -18
  55. package/node_modules/anymatch/index.d.ts +1 -0
  56. package/node_modules/anymatch/index.js +1 -1
  57. package/node_modules/anymatch/package.json +1 -1
  58. package/node_modules/{form-data/README.md.bak → axios/node_modules/form-data/Readme.md} +4 -4
  59. package/node_modules/{superagent → axios}/node_modules/form-data/lib/form_data.js +8 -5
  60. package/node_modules/{superagent → axios}/node_modules/form-data/package.json +9 -6
  61. package/node_modules/binary-extensions/binary-extensions.json +3 -0
  62. package/node_modules/binary-extensions/license +2 -1
  63. package/node_modules/binary-extensions/package.json +4 -2
  64. package/node_modules/binary-extensions/readme.md +2 -18
  65. package/node_modules/braces/LICENSE +1 -1
  66. package/node_modules/braces/README.md +91 -98
  67. package/node_modules/braces/index.js +3 -3
  68. package/node_modules/braces/lib/compile.js +14 -11
  69. package/node_modules/braces/lib/constants.js +1 -1
  70. package/node_modules/braces/lib/expand.js +9 -9
  71. package/node_modules/braces/lib/parse.js +14 -16
  72. package/node_modules/braces/lib/stringify.js +4 -4
  73. package/node_modules/braces/lib/utils.js +13 -3
  74. package/node_modules/braces/package.json +2 -2
  75. package/node_modules/{call-bind → call-bind-apply-helpers}/.eslintrc +0 -1
  76. package/node_modules/call-bind-apply-helpers/.github/FUNDING.yml +12 -0
  77. package/node_modules/call-bind-apply-helpers/.nycrc +9 -0
  78. package/node_modules/call-bind-apply-helpers/CHANGELOG.md +23 -0
  79. package/node_modules/{call-bind → call-bind-apply-helpers}/LICENSE +1 -1
  80. package/node_modules/call-bind-apply-helpers/README.md +62 -0
  81. package/node_modules/call-bind-apply-helpers/actualApply.d.ts +1 -0
  82. package/node_modules/call-bind-apply-helpers/actualApply.js +10 -0
  83. package/node_modules/call-bind-apply-helpers/applyBind.d.ts +19 -0
  84. package/node_modules/call-bind-apply-helpers/applyBind.js +10 -0
  85. package/node_modules/call-bind-apply-helpers/functionApply.d.ts +1 -0
  86. package/node_modules/call-bind-apply-helpers/functionApply.js +4 -0
  87. package/node_modules/call-bind-apply-helpers/functionCall.d.ts +1 -0
  88. package/node_modules/call-bind-apply-helpers/functionCall.js +4 -0
  89. package/node_modules/call-bind-apply-helpers/index.d.ts +46 -0
  90. package/node_modules/call-bind-apply-helpers/index.js +15 -0
  91. package/node_modules/call-bind-apply-helpers/package.json +85 -0
  92. package/node_modules/call-bind-apply-helpers/reflectApply.d.ts +3 -0
  93. package/node_modules/call-bind-apply-helpers/reflectApply.js +4 -0
  94. package/node_modules/call-bind-apply-helpers/test/index.js +63 -0
  95. package/node_modules/call-bind-apply-helpers/tsconfig.json +9 -0
  96. package/node_modules/call-bound/.eslintrc +13 -0
  97. package/node_modules/call-bound/.github/FUNDING.yml +12 -0
  98. package/node_modules/call-bound/.nycrc +9 -0
  99. package/node_modules/call-bound/CHANGELOG.md +34 -0
  100. package/node_modules/call-bound/LICENSE +21 -0
  101. package/node_modules/call-bound/README.md +53 -0
  102. package/node_modules/call-bound/index.d.ts +13 -0
  103. package/node_modules/call-bound/index.js +18 -0
  104. package/node_modules/call-bound/package.json +99 -0
  105. package/node_modules/{call-bind/test/callBound.js → call-bound/test/index.js} +1 -2
  106. package/node_modules/call-bound/tsconfig.json +9 -0
  107. package/node_modules/chokidar/README.md +1 -1
  108. package/node_modules/chokidar/index.js +1 -1
  109. package/node_modules/chokidar/lib/constants.js +1 -0
  110. package/node_modules/chokidar/lib/fsevents-handler.js +2 -0
  111. package/node_modules/chokidar/package.json +5 -20
  112. package/node_modules/chokidar/types/index.d.ts +4 -0
  113. package/node_modules/cliui/CHANGELOG.md +18 -0
  114. package/node_modules/cliui/build/index.d.cts +43 -0
  115. package/node_modules/cliui/package.json +6 -6
  116. package/node_modules/commander/CHANGELOG.md +361 -0
  117. package/node_modules/{@babel/cli/node_modules/commander → commander}/Readme.md +243 -165
  118. package/node_modules/commander/index.js +1881 -0
  119. package/node_modules/{@babel/cli/node_modules/commander → commander}/package.json +19 -9
  120. package/node_modules/commander/typings/index.d.ts +410 -0
  121. package/node_modules/component-emitter/LICENSE +24 -24
  122. package/node_modules/component-emitter/Readme.md +74 -74
  123. package/node_modules/component-emitter/index.js +175 -175
  124. package/node_modules/component-emitter/package.json +3 -2
  125. package/node_modules/convert-source-map/README.md +97 -11
  126. package/node_modules/convert-source-map/index.js +127 -30
  127. package/node_modules/convert-source-map/package.json +3 -9
  128. package/node_modules/cookiejar/cookiejar.js +5 -0
  129. package/node_modules/cookiejar/package.json +1 -1
  130. package/node_modules/debug/README.md +1 -1
  131. package/node_modules/debug/package.json +10 -4
  132. package/node_modules/debug/src/browser.js +4 -1
  133. package/node_modules/debug/src/common.js +57 -39
  134. package/node_modules/debug/src/node.js +2 -2
  135. package/node_modules/dotenv/CHANGELOG.md +133 -1
  136. package/node_modules/dotenv/README-es.md +448 -0
  137. package/node_modules/dotenv/README.md +309 -66
  138. package/node_modules/dotenv/lib/cli-options.js +1 -1
  139. package/node_modules/dotenv/lib/env-options.js +4 -0
  140. package/node_modules/dotenv/lib/main.d.ts +85 -5
  141. package/node_modules/dotenv/lib/main.js +287 -35
  142. package/node_modules/dotenv/package.json +19 -14
  143. package/node_modules/dunder-proto/.eslintrc +5 -0
  144. package/node_modules/dunder-proto/.github/FUNDING.yml +12 -0
  145. package/node_modules/dunder-proto/CHANGELOG.md +24 -0
  146. package/node_modules/dunder-proto/LICENSE +21 -0
  147. package/node_modules/dunder-proto/README.md +54 -0
  148. package/node_modules/dunder-proto/get.d.ts +5 -0
  149. package/node_modules/dunder-proto/get.js +30 -0
  150. package/node_modules/dunder-proto/package.json +76 -0
  151. package/node_modules/dunder-proto/set.d.ts +5 -0
  152. package/node_modules/dunder-proto/set.js +35 -0
  153. package/node_modules/dunder-proto/test/get.js +34 -0
  154. package/node_modules/dunder-proto/test/index.js +4 -0
  155. package/node_modules/dunder-proto/test/set.js +50 -0
  156. package/node_modules/dunder-proto/tsconfig.json +9 -0
  157. package/node_modules/es-define-property/.eslintrc +13 -0
  158. package/node_modules/es-define-property/.github/FUNDING.yml +12 -0
  159. package/node_modules/es-define-property/.nycrc +9 -0
  160. package/node_modules/es-define-property/CHANGELOG.md +29 -0
  161. package/node_modules/es-define-property/LICENSE +21 -0
  162. package/node_modules/es-define-property/README.md +49 -0
  163. package/node_modules/es-define-property/index.d.ts +3 -0
  164. package/node_modules/es-define-property/index.js +14 -0
  165. package/node_modules/es-define-property/package.json +81 -0
  166. package/node_modules/es-define-property/test/index.js +56 -0
  167. package/node_modules/es-define-property/tsconfig.json +10 -0
  168. package/node_modules/es-errors/.eslintrc +5 -0
  169. package/node_modules/es-errors/.github/FUNDING.yml +12 -0
  170. package/node_modules/es-errors/CHANGELOG.md +40 -0
  171. package/node_modules/es-errors/LICENSE +21 -0
  172. package/node_modules/es-errors/README.md +55 -0
  173. package/node_modules/es-errors/eval.d.ts +3 -0
  174. package/node_modules/es-errors/eval.js +4 -0
  175. package/node_modules/es-errors/index.d.ts +3 -0
  176. package/node_modules/es-errors/index.js +4 -0
  177. package/node_modules/es-errors/package.json +80 -0
  178. package/node_modules/es-errors/range.d.ts +3 -0
  179. package/node_modules/es-errors/range.js +4 -0
  180. package/node_modules/es-errors/ref.d.ts +3 -0
  181. package/node_modules/es-errors/ref.js +4 -0
  182. package/node_modules/es-errors/syntax.d.ts +3 -0
  183. package/node_modules/es-errors/syntax.js +4 -0
  184. package/node_modules/es-errors/test/index.js +19 -0
  185. package/node_modules/es-errors/tsconfig.json +49 -0
  186. package/node_modules/es-errors/type.d.ts +3 -0
  187. package/node_modules/es-errors/type.js +4 -0
  188. package/node_modules/es-errors/uri.d.ts +3 -0
  189. package/node_modules/es-errors/uri.js +4 -0
  190. package/node_modules/es-object-atoms/.eslintrc +16 -0
  191. package/node_modules/es-object-atoms/.github/FUNDING.yml +12 -0
  192. package/node_modules/es-object-atoms/CHANGELOG.md +37 -0
  193. package/node_modules/es-object-atoms/LICENSE +21 -0
  194. package/node_modules/es-object-atoms/README.md +63 -0
  195. package/node_modules/es-object-atoms/RequireObjectCoercible.d.ts +3 -0
  196. package/node_modules/es-object-atoms/RequireObjectCoercible.js +11 -0
  197. package/node_modules/es-object-atoms/ToObject.d.ts +7 -0
  198. package/node_modules/es-object-atoms/ToObject.js +10 -0
  199. package/node_modules/es-object-atoms/index.d.ts +3 -0
  200. package/node_modules/es-object-atoms/index.js +4 -0
  201. package/node_modules/es-object-atoms/isObject.d.ts +3 -0
  202. package/node_modules/es-object-atoms/isObject.js +6 -0
  203. package/node_modules/es-object-atoms/package.json +80 -0
  204. package/node_modules/es-object-atoms/test/index.js +38 -0
  205. package/node_modules/es-object-atoms/tsconfig.json +6 -0
  206. package/node_modules/escalade/index.d.mts +11 -0
  207. package/node_modules/escalade/index.d.ts +14 -2
  208. package/node_modules/escalade/package.json +18 -5
  209. package/node_modules/escalade/readme.md +1 -1
  210. package/node_modules/escalade/sync/index.d.mts +9 -0
  211. package/node_modules/escalade/sync/index.d.ts +13 -2
  212. package/node_modules/fill-range/index.js +4 -5
  213. package/node_modules/fill-range/package.json +8 -3
  214. package/node_modules/follow-redirects/index.js +186 -98
  215. package/node_modules/follow-redirects/package.json +3 -4
  216. package/node_modules/form-data/Readme.md +5 -7
  217. package/node_modules/form-data/lib/form_data.js +5 -8
  218. package/node_modules/form-data/package.json +9 -6
  219. package/node_modules/function-bind/.eslintrc +11 -5
  220. package/node_modules/function-bind/.github/FUNDING.yml +12 -0
  221. package/node_modules/function-bind/.github/SECURITY.md +3 -0
  222. package/node_modules/function-bind/.nycrc +13 -0
  223. package/node_modules/function-bind/CHANGELOG.md +136 -0
  224. package/node_modules/function-bind/README.md +25 -27
  225. package/node_modules/function-bind/implementation.js +44 -12
  226. package/node_modules/function-bind/package.json +38 -14
  227. package/node_modules/get-intrinsic/.eslintrc +1 -0
  228. package/node_modules/get-intrinsic/CHANGELOG.md +87 -0
  229. package/node_modules/get-intrinsic/index.js +75 -32
  230. package/node_modules/get-intrinsic/package.json +31 -22
  231. package/node_modules/get-intrinsic/test/GetIntrinsic.js +3 -3
  232. package/node_modules/get-proto/.eslintrc +10 -0
  233. package/node_modules/{call-bind → get-proto}/.github/FUNDING.yml +1 -1
  234. package/node_modules/get-proto/.nycrc +9 -0
  235. package/node_modules/get-proto/CHANGELOG.md +21 -0
  236. package/node_modules/get-proto/LICENSE +21 -0
  237. package/node_modules/get-proto/Object.getPrototypeOf.d.ts +5 -0
  238. package/node_modules/get-proto/Object.getPrototypeOf.js +6 -0
  239. package/node_modules/get-proto/README.md +50 -0
  240. package/node_modules/get-proto/Reflect.getPrototypeOf.d.ts +3 -0
  241. package/node_modules/get-proto/Reflect.getPrototypeOf.js +4 -0
  242. package/node_modules/get-proto/index.d.ts +5 -0
  243. package/node_modules/get-proto/index.js +27 -0
  244. package/node_modules/get-proto/package.json +81 -0
  245. package/node_modules/get-proto/test/index.js +68 -0
  246. package/node_modules/get-proto/tsconfig.json +9 -0
  247. package/node_modules/gopd/.eslintrc +16 -0
  248. package/node_modules/gopd/.github/FUNDING.yml +12 -0
  249. package/node_modules/gopd/CHANGELOG.md +45 -0
  250. package/node_modules/gopd/LICENSE +21 -0
  251. package/node_modules/gopd/README.md +40 -0
  252. package/node_modules/gopd/gOPD.d.ts +1 -0
  253. package/node_modules/gopd/gOPD.js +4 -0
  254. package/node_modules/gopd/index.d.ts +5 -0
  255. package/node_modules/gopd/index.js +15 -0
  256. package/node_modules/gopd/package.json +77 -0
  257. package/node_modules/gopd/test/index.js +36 -0
  258. package/node_modules/gopd/tsconfig.json +9 -0
  259. package/node_modules/has-symbols/CHANGELOG.md +16 -0
  260. package/node_modules/has-symbols/index.d.ts +3 -0
  261. package/node_modules/has-symbols/index.js +1 -0
  262. package/node_modules/has-symbols/package.json +19 -9
  263. package/node_modules/has-symbols/shams.d.ts +3 -0
  264. package/node_modules/has-symbols/shams.js +5 -2
  265. package/node_modules/has-symbols/test/shams/core-js.js +1 -0
  266. package/node_modules/has-symbols/test/shams/get-own-property-symbols.js +1 -0
  267. package/node_modules/has-symbols/test/tests.js +4 -2
  268. package/node_modules/has-symbols/tsconfig.json +10 -0
  269. package/node_modules/hasown/.eslintrc +5 -0
  270. package/node_modules/hasown/.github/FUNDING.yml +12 -0
  271. package/node_modules/hasown/.nycrc +13 -0
  272. package/node_modules/hasown/CHANGELOG.md +40 -0
  273. package/node_modules/hasown/LICENSE +21 -0
  274. package/node_modules/hasown/README.md +40 -0
  275. package/node_modules/hasown/index.d.ts +3 -0
  276. package/node_modules/hasown/index.js +8 -0
  277. package/node_modules/hasown/package.json +92 -0
  278. package/node_modules/hasown/tsconfig.json +6 -0
  279. package/node_modules/make-dir/node_modules/semver/package.json +38 -0
  280. package/node_modules/{@babel/cli → make-dir}/node_modules/semver/semver.js +68 -26
  281. package/node_modules/math-intrinsics/.eslintrc +16 -0
  282. package/node_modules/math-intrinsics/.github/FUNDING.yml +12 -0
  283. package/node_modules/math-intrinsics/CHANGELOG.md +24 -0
  284. package/node_modules/math-intrinsics/LICENSE +21 -0
  285. package/node_modules/math-intrinsics/README.md +50 -0
  286. package/node_modules/math-intrinsics/abs.d.ts +1 -0
  287. package/node_modules/math-intrinsics/abs.js +4 -0
  288. package/node_modules/math-intrinsics/constants/maxArrayLength.d.ts +3 -0
  289. package/node_modules/math-intrinsics/constants/maxArrayLength.js +4 -0
  290. package/node_modules/math-intrinsics/constants/maxSafeInteger.d.ts +3 -0
  291. package/node_modules/math-intrinsics/constants/maxSafeInteger.js +5 -0
  292. package/node_modules/math-intrinsics/constants/maxValue.d.ts +3 -0
  293. package/node_modules/math-intrinsics/constants/maxValue.js +5 -0
  294. package/node_modules/math-intrinsics/floor.d.ts +1 -0
  295. package/node_modules/math-intrinsics/floor.js +4 -0
  296. package/node_modules/math-intrinsics/isFinite.d.ts +3 -0
  297. package/node_modules/math-intrinsics/isFinite.js +12 -0
  298. package/node_modules/math-intrinsics/isInteger.d.ts +3 -0
  299. package/node_modules/math-intrinsics/isInteger.js +16 -0
  300. package/node_modules/math-intrinsics/isNaN.d.ts +1 -0
  301. package/node_modules/math-intrinsics/isNaN.js +6 -0
  302. package/node_modules/math-intrinsics/isNegativeZero.d.ts +3 -0
  303. package/node_modules/math-intrinsics/isNegativeZero.js +6 -0
  304. package/node_modules/math-intrinsics/max.d.ts +1 -0
  305. package/node_modules/math-intrinsics/max.js +4 -0
  306. package/node_modules/math-intrinsics/min.d.ts +1 -0
  307. package/node_modules/math-intrinsics/min.js +4 -0
  308. package/node_modules/math-intrinsics/mod.d.ts +3 -0
  309. package/node_modules/math-intrinsics/mod.js +9 -0
  310. package/node_modules/math-intrinsics/package.json +86 -0
  311. package/node_modules/math-intrinsics/pow.d.ts +1 -0
  312. package/node_modules/math-intrinsics/pow.js +4 -0
  313. package/node_modules/math-intrinsics/round.d.ts +1 -0
  314. package/node_modules/math-intrinsics/round.js +4 -0
  315. package/node_modules/math-intrinsics/sign.d.ts +3 -0
  316. package/node_modules/math-intrinsics/sign.js +11 -0
  317. package/node_modules/math-intrinsics/test/index.js +192 -0
  318. package/node_modules/math-intrinsics/tsconfig.json +3 -0
  319. package/node_modules/ms/index.js +1 -1
  320. package/node_modules/ms/license.md +1 -1
  321. package/node_modules/ms/package.json +5 -4
  322. package/node_modules/ms/readme.md +1 -2
  323. package/node_modules/object-inspect/CHANGELOG.md +56 -0
  324. package/node_modules/object-inspect/index.js +38 -9
  325. package/node_modules/object-inspect/package.json +23 -13
  326. package/node_modules/object-inspect/readme.markdown +9 -11
  327. package/node_modules/object-inspect/test/global.js +17 -0
  328. package/node_modules/object-inspect/test/quoteStyle.js +9 -0
  329. package/node_modules/qs/.editorconfig +3 -0
  330. package/node_modules/qs/.eslintrc +3 -2
  331. package/node_modules/qs/CHANGELOG.md +81 -5
  332. package/node_modules/qs/README.md +158 -50
  333. package/node_modules/qs/dist/qs.js +90 -2003
  334. package/node_modules/qs/lib/parse.js +89 -24
  335. package/node_modules/qs/lib/stringify.js +61 -31
  336. package/node_modules/qs/lib/utils.js +54 -38
  337. package/node_modules/qs/package.json +29 -13
  338. package/node_modules/qs/test/empty-keys-cases.js +267 -0
  339. package/node_modules/qs/test/parse.js +468 -47
  340. package/node_modules/qs/test/stringify.js +454 -57
  341. package/node_modules/qs/test/utils.js +126 -0
  342. package/node_modules/side-channel/.editorconfig +9 -0
  343. package/node_modules/side-channel/.eslintrc +2 -1
  344. package/node_modules/side-channel/CHANGELOG.md +45 -0
  345. package/node_modules/side-channel/README.md +60 -1
  346. package/node_modules/side-channel/index.d.ts +14 -0
  347. package/node_modules/side-channel/index.js +21 -102
  348. package/node_modules/side-channel/package.json +40 -22
  349. package/node_modules/side-channel/test/index.js +78 -52
  350. package/node_modules/side-channel/tsconfig.json +9 -0
  351. package/node_modules/{function-bind → side-channel-list}/.editorconfig +3 -14
  352. package/node_modules/side-channel-list/.eslintrc +11 -0
  353. package/node_modules/side-channel-list/.github/FUNDING.yml +12 -0
  354. package/node_modules/side-channel-list/.nycrc +13 -0
  355. package/node_modules/side-channel-list/CHANGELOG.md +15 -0
  356. package/node_modules/side-channel-list/LICENSE +21 -0
  357. package/node_modules/side-channel-list/README.md +62 -0
  358. package/node_modules/side-channel-list/index.d.ts +13 -0
  359. package/node_modules/side-channel-list/index.js +113 -0
  360. package/node_modules/side-channel-list/list.d.ts +14 -0
  361. package/node_modules/side-channel-list/package.json +77 -0
  362. package/node_modules/side-channel-list/test/index.js +104 -0
  363. package/node_modules/side-channel-list/tsconfig.json +9 -0
  364. package/node_modules/side-channel-map/.editorconfig +9 -0
  365. package/node_modules/side-channel-map/.eslintrc +11 -0
  366. package/node_modules/side-channel-map/.github/FUNDING.yml +12 -0
  367. package/node_modules/side-channel-map/.nycrc +13 -0
  368. package/node_modules/side-channel-map/CHANGELOG.md +22 -0
  369. package/node_modules/side-channel-map/LICENSE +21 -0
  370. package/node_modules/side-channel-map/README.md +62 -0
  371. package/node_modules/side-channel-map/index.d.ts +15 -0
  372. package/node_modules/side-channel-map/index.js +68 -0
  373. package/node_modules/side-channel-map/package.json +80 -0
  374. package/node_modules/side-channel-map/test/index.js +114 -0
  375. package/node_modules/side-channel-map/tsconfig.json +9 -0
  376. package/node_modules/side-channel-weakmap/.editorconfig +9 -0
  377. package/node_modules/side-channel-weakmap/.eslintrc +12 -0
  378. package/node_modules/side-channel-weakmap/.github/FUNDING.yml +12 -0
  379. package/node_modules/side-channel-weakmap/.nycrc +13 -0
  380. package/node_modules/side-channel-weakmap/CHANGELOG.md +28 -0
  381. package/node_modules/side-channel-weakmap/LICENSE +21 -0
  382. package/node_modules/side-channel-weakmap/README.md +62 -0
  383. package/node_modules/side-channel-weakmap/index.d.ts +15 -0
  384. package/node_modules/side-channel-weakmap/index.js +84 -0
  385. package/node_modules/side-channel-weakmap/package.json +87 -0
  386. package/node_modules/side-channel-weakmap/test/index.js +114 -0
  387. package/node_modules/side-channel-weakmap/tsconfig.json +9 -0
  388. package/node_modules/superagent/node_modules/readable-stream/README.md +1 -1
  389. package/node_modules/superagent/node_modules/readable-stream/lib/_stream_duplex.js +12 -25
  390. package/node_modules/superagent/node_modules/readable-stream/lib/_stream_passthrough.js +2 -4
  391. package/node_modules/superagent/node_modules/readable-stream/lib/_stream_readable.js +176 -273
  392. package/node_modules/superagent/node_modules/readable-stream/lib/_stream_transform.js +26 -37
  393. package/node_modules/superagent/node_modules/readable-stream/lib/_stream_writable.js +118 -174
  394. package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/async_iterator.js +10 -37
  395. package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/buffer_list.js +20 -47
  396. package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/destroy.js +8 -17
  397. package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/end-of-stream.js +1 -19
  398. package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/from.js +12 -24
  399. package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/pipeline.js +5 -16
  400. package/node_modules/superagent/node_modules/readable-stream/lib/internal/streams/state.js +2 -7
  401. package/node_modules/superagent/node_modules/readable-stream/package.json +1 -1
  402. package/node_modules/{semver → superagent/node_modules/semver}/README.md +132 -36
  403. package/node_modules/{semver → superagent/node_modules/semver}/bin/semver.js +22 -16
  404. package/node_modules/{semver → superagent/node_modules/semver}/classes/comparator.js +39 -34
  405. package/node_modules/{semver → superagent/node_modules/semver}/classes/range.js +72 -37
  406. package/node_modules/{semver → superagent/node_modules/semver}/classes/semver.js +49 -19
  407. package/node_modules/{semver → superagent/node_modules/semver}/functions/coerce.js +14 -6
  408. package/node_modules/superagent/node_modules/semver/functions/diff.js +58 -0
  409. package/node_modules/{semver → superagent/node_modules/semver}/functions/inc.js +3 -2
  410. package/node_modules/superagent/node_modules/semver/functions/parse.js +16 -0
  411. package/node_modules/superagent/node_modules/semver/index.js +89 -0
  412. package/node_modules/{semver → superagent/node_modules/semver}/internal/constants.js +20 -2
  413. package/node_modules/superagent/node_modules/semver/internal/lrucache.js +40 -0
  414. package/node_modules/superagent/node_modules/semver/internal/parse-options.js +15 -0
  415. package/node_modules/{semver → superagent/node_modules/semver}/internal/re.js +41 -6
  416. package/node_modules/{semver → superagent/node_modules/semver}/package.json +29 -26
  417. package/node_modules/{semver → superagent/node_modules/semver}/ranges/intersects.js +1 -1
  418. package/node_modules/{semver → superagent/node_modules/semver}/ranges/subset.js +6 -3
  419. package/node_modules/yargs/browser.d.ts +5 -0
  420. package/node_modules/yargs/build/index.cjs +1 -1
  421. package/node_modules/yargs/build/lib/command.js +2 -0
  422. package/node_modules/yargs/build/lib/completion.js +19 -12
  423. package/node_modules/yargs/build/lib/usage.js +9 -4
  424. package/node_modules/yargs/build/lib/yargs-factory.js +18 -3
  425. package/node_modules/yargs/locales/cs.json +51 -0
  426. package/node_modules/yargs/locales/en.json +4 -0
  427. package/node_modules/yargs/locales/fi.json +1 -1
  428. package/node_modules/yargs/package.json +4 -4
  429. package/node_modules/yargs-parser/CHANGELOG.md +21 -0
  430. package/node_modules/yargs-parser/build/index.cjs +6 -4
  431. package/node_modules/yargs-parser/build/lib/index.js +4 -2
  432. package/node_modules/yargs-parser/build/lib/yargs-parser.js +2 -2
  433. package/node_modules/yargs-parser/package.json +10 -6
  434. package/output/e3e8277b426d4bc636a8ed30e66dd056e6cc9691-corellium-cli-build.tar.gz +0 -0
  435. package/package.json +1 -1
  436. package/renovate.json +11 -58
  437. package/src/clients/Agent.js +40 -37
  438. package/src/clients/Client.js +42 -40
  439. package/src/clients/Instance.js +24 -24
  440. package/src/clients/Webplayer.js +23 -24
  441. package/src/commands/extensions/delete.js +26 -26
  442. package/src/commands/extensions/index.js +6 -11
  443. package/src/commands/extensions/list.js +25 -25
  444. package/src/commands/extensions/load.js +51 -50
  445. package/src/commands/extensions/validate.js +33 -38
  446. package/src/commands/firmware/index.js +6 -9
  447. package/src/commands/firmware/list.js +49 -38
  448. package/src/commands/firmware/load.js +45 -42
  449. package/src/commands/images/create.js +30 -29
  450. package/src/commands/images/delete.js +21 -21
  451. package/src/commands/images/index.js +6 -10
  452. package/src/commands/images/list.js +21 -20
  453. package/src/commands/index.js +2 -2
  454. package/src/commands/instances/apps/index.js +26 -23
  455. package/src/commands/instances/apps/install.js +14 -14
  456. package/src/commands/instances/apps/open.js +17 -17
  457. package/src/commands/instances/create.js +35 -38
  458. package/src/commands/instances/delete.js +24 -25
  459. package/src/commands/instances/file.js +36 -32
  460. package/src/commands/instances/get.js +23 -16
  461. package/src/commands/instances/index.js +8 -8
  462. package/src/commands/instances/input.js +16 -17
  463. package/src/commands/instances/list.js +38 -28
  464. package/src/commands/instances/netmon/disable.js +17 -15
  465. package/src/commands/instances/netmon/download.js +18 -16
  466. package/src/commands/instances/netmon/enable.js +30 -23
  467. package/src/commands/instances/netmon/index.js +6 -11
  468. package/src/commands/instances/netmon/stream.js +18 -16
  469. package/src/commands/instances/ready.js +30 -27
  470. package/src/commands/instances/restoreBackup.js +39 -36
  471. package/src/commands/instances/rotate.js +20 -21
  472. package/src/commands/instances/start.js +23 -24
  473. package/src/commands/instances/stop.js +20 -21
  474. package/src/commands/instances/unlock.js +17 -19
  475. package/src/commands/instances/upgrade.js +38 -34
  476. package/src/commands/login.js +67 -67
  477. package/src/commands/logout.js +10 -12
  478. package/src/commands/mast/constants.js +2 -2
  479. package/src/commands/mast/create-assessment.js +16 -16
  480. package/src/commands/mast/delete-assessment.js +15 -15
  481. package/src/commands/mast/download-report.js +18 -15
  482. package/src/commands/mast/get-assessment.js +14 -14
  483. package/src/commands/mast/get-assessments.js +13 -13
  484. package/src/commands/mast/index.js +7 -7
  485. package/src/commands/mast/start-monitor.js +15 -15
  486. package/src/commands/mast/stop-monitor.js +15 -15
  487. package/src/commands/mast/test.js +19 -16
  488. package/src/commands/projects/create.js +33 -32
  489. package/src/commands/projects/delete.js +26 -26
  490. package/src/commands/projects/index.js +6 -11
  491. package/src/commands/projects/list.js +21 -19
  492. package/src/commands/projects/vpnConfig.js +29 -26
  493. package/src/commands/webplayer/create.js +57 -50
  494. package/src/commands/webplayer/destroy.js +31 -28
  495. package/src/commands/webplayer/index.js +6 -11
  496. package/src/commands/webplayer/list.js +41 -42
  497. package/src/commands/webplayer/login.js +31 -28
  498. package/src/corellium-api.js +11 -11
  499. package/src/error.js +20 -18
  500. package/src/logging.js +15 -15
  501. package/src/profile.js +22 -22
  502. package/src/progress.js +6 -6
  503. package/src/resumable.js +606 -664
  504. package/src/table.js +20 -22
  505. package/src/upload.js +38 -38
  506. package/src/utils.js +63 -64
  507. package/test/test.js +47 -48
  508. package/coverage/cobertura-coverage.xml +0 -9
  509. package/coverage/lcov-report/base.css +0 -224
  510. package/coverage/lcov-report/block-navigation.js +0 -87
  511. package/coverage/lcov-report/favicon.png +0 -0
  512. package/coverage/lcov-report/index.html +0 -101
  513. package/coverage/lcov-report/prettify.css +0 -1
  514. package/coverage/lcov-report/prettify.js +0 -2
  515. package/coverage/lcov-report/sort-arrow-sprite.png +0 -0
  516. package/coverage/lcov-report/sorter.js +0 -196
  517. package/coverage/lcov.info +0 -0
  518. package/node_modules/@babel/cli/node_modules/commander/CHANGELOG.md +0 -436
  519. package/node_modules/@babel/cli/node_modules/commander/index.js +0 -1649
  520. package/node_modules/@babel/cli/node_modules/commander/typings/index.d.ts +0 -311
  521. package/node_modules/@babel/cli/node_modules/semver/CHANGELOG.md +0 -39
  522. package/node_modules/@babel/cli/node_modules/semver/package.json +0 -28
  523. package/node_modules/@jridgewell/sourcemap-codec/src/sourcemap-codec.ts +0 -198
  524. package/node_modules/braces/CHANGELOG.md +0 -184
  525. package/node_modules/call-bind/.eslintignore +0 -1
  526. package/node_modules/call-bind/CHANGELOG.md +0 -42
  527. package/node_modules/call-bind/README.md +0 -2
  528. package/node_modules/call-bind/callBound.js +0 -15
  529. package/node_modules/call-bind/index.js +0 -47
  530. package/node_modules/call-bind/package.json +0 -80
  531. package/node_modules/call-bind/test/index.js +0 -66
  532. package/node_modules/component-emitter/History.md +0 -75
  533. package/node_modules/function-bind/.jscs.json +0 -176
  534. package/node_modules/function-bind/.npmignore +0 -22
  535. package/node_modules/function-bind/.travis.yml +0 -168
  536. package/node_modules/has/LICENSE-MIT +0 -22
  537. package/node_modules/has/README.md +0 -18
  538. package/node_modules/has/package.json +0 -48
  539. package/node_modules/has/src/index.js +0 -5
  540. package/node_modules/has/test/index.js +0 -10
  541. package/node_modules/lru-cache/README.md +0 -166
  542. package/node_modules/lru-cache/index.js +0 -334
  543. package/node_modules/lru-cache/package.json +0 -34
  544. package/node_modules/semver/LICENSE +0 -15
  545. package/node_modules/semver/functions/diff.js +0 -23
  546. package/node_modules/semver/functions/parse.js +0 -33
  547. package/node_modules/semver/index.js +0 -48
  548. package/node_modules/semver/internal/parse-options.js +0 -11
  549. package/node_modules/side-channel/.eslintignore +0 -1
  550. package/node_modules/superagent/node_modules/form-data/README.md.bak +0 -356
  551. package/node_modules/superagent/node_modules/form-data/Readme.md +0 -356
  552. package/node_modules/yallist/LICENSE +0 -15
  553. package/node_modules/yallist/README.md +0 -204
  554. package/node_modules/yallist/iterator.js +0 -8
  555. package/node_modules/yallist/package.json +0 -29
  556. package/node_modules/yallist/yallist.js +0 -426
  557. /package/node_modules/{superagent → axios}/node_modules/form-data/License +0 -0
  558. /package/node_modules/{superagent → axios}/node_modules/form-data/index.d.ts +0 -0
  559. /package/node_modules/{superagent → axios}/node_modules/form-data/lib/browser.js +0 -0
  560. /package/node_modules/{superagent → axios}/node_modules/form-data/lib/populate.js +0 -0
  561. /package/node_modules/{@babel/cli/node_modules/commander → commander}/LICENSE +0 -0
  562. /package/node_modules/{call-bind → dunder-proto}/.nycrc +0 -0
  563. /package/node_modules/{@babel/cli/node_modules/make-dir → make-dir}/index.d.ts +0 -0
  564. /package/node_modules/{@babel/cli/node_modules/make-dir → make-dir}/index.js +0 -0
  565. /package/node_modules/{@babel/cli/node_modules/make-dir → make-dir}/license +0 -0
  566. /package/node_modules/{@babel/cli → make-dir}/node_modules/semver/LICENSE +0 -0
  567. /package/node_modules/{@babel/cli → make-dir}/node_modules/semver/README.md +0 -0
  568. /package/node_modules/{@babel/cli → make-dir}/node_modules/semver/bin/semver +0 -0
  569. /package/node_modules/{@babel/cli → make-dir}/node_modules/semver/range.bnf +0 -0
  570. /package/node_modules/{@babel/cli/node_modules/make-dir → make-dir}/package.json +0 -0
  571. /package/node_modules/{@babel/cli/node_modules/make-dir → make-dir}/readme.md +0 -0
  572. /package/node_modules/{@babel/cli/node_modules/pify → pify}/index.js +0 -0
  573. /package/node_modules/{@babel/cli/node_modules/pify → pify}/license +0 -0
  574. /package/node_modules/{@babel/cli/node_modules/pify → pify}/package.json +0 -0
  575. /package/node_modules/{@babel/cli/node_modules/pify → pify}/readme.md +0 -0
  576. /package/node_modules/{@babel/cli/node_modules/slash → slash}/index.js +0 -0
  577. /package/node_modules/{@babel/cli/node_modules/slash → slash}/license +0 -0
  578. /package/node_modules/{@babel/cli/node_modules/slash → slash}/package.json +0 -0
  579. /package/node_modules/{@babel/cli/node_modules/slash → slash}/readme.md +0 -0
  580. /package/node_modules/{lru-cache → superagent/node_modules/semver}/LICENSE +0 -0
  581. /package/node_modules/{semver → superagent/node_modules/semver}/classes/index.js +0 -0
  582. /package/node_modules/{semver → superagent/node_modules/semver}/functions/clean.js +0 -0
  583. /package/node_modules/{semver → superagent/node_modules/semver}/functions/cmp.js +0 -0
  584. /package/node_modules/{semver → superagent/node_modules/semver}/functions/compare-build.js +0 -0
  585. /package/node_modules/{semver → superagent/node_modules/semver}/functions/compare-loose.js +0 -0
  586. /package/node_modules/{semver → superagent/node_modules/semver}/functions/compare.js +0 -0
  587. /package/node_modules/{semver → superagent/node_modules/semver}/functions/eq.js +0 -0
  588. /package/node_modules/{semver → superagent/node_modules/semver}/functions/gt.js +0 -0
  589. /package/node_modules/{semver → superagent/node_modules/semver}/functions/gte.js +0 -0
  590. /package/node_modules/{semver → superagent/node_modules/semver}/functions/lt.js +0 -0
  591. /package/node_modules/{semver → superagent/node_modules/semver}/functions/lte.js +0 -0
  592. /package/node_modules/{semver → superagent/node_modules/semver}/functions/major.js +0 -0
  593. /package/node_modules/{semver → superagent/node_modules/semver}/functions/minor.js +0 -0
  594. /package/node_modules/{semver → superagent/node_modules/semver}/functions/neq.js +0 -0
  595. /package/node_modules/{semver → superagent/node_modules/semver}/functions/patch.js +0 -0
  596. /package/node_modules/{semver → superagent/node_modules/semver}/functions/prerelease.js +0 -0
  597. /package/node_modules/{semver → superagent/node_modules/semver}/functions/rcompare.js +0 -0
  598. /package/node_modules/{semver → superagent/node_modules/semver}/functions/rsort.js +0 -0
  599. /package/node_modules/{semver → superagent/node_modules/semver}/functions/satisfies.js +0 -0
  600. /package/node_modules/{semver → superagent/node_modules/semver}/functions/sort.js +0 -0
  601. /package/node_modules/{semver → superagent/node_modules/semver}/functions/valid.js +0 -0
  602. /package/node_modules/{semver → superagent/node_modules/semver}/internal/debug.js +0 -0
  603. /package/node_modules/{semver → superagent/node_modules/semver}/internal/identifiers.js +0 -0
  604. /package/node_modules/{semver → superagent/node_modules/semver}/preload.js +0 -0
  605. /package/node_modules/{semver → superagent/node_modules/semver}/range.bnf +0 -0
  606. /package/node_modules/{semver → superagent/node_modules/semver}/ranges/gtr.js +0 -0
  607. /package/node_modules/{semver → superagent/node_modules/semver}/ranges/ltr.js +0 -0
  608. /package/node_modules/{semver → superagent/node_modules/semver}/ranges/max-satisfying.js +0 -0
  609. /package/node_modules/{semver → superagent/node_modules/semver}/ranges/min-satisfying.js +0 -0
  610. /package/node_modules/{semver → superagent/node_modules/semver}/ranges/min-version.js +0 -0
  611. /package/node_modules/{semver → superagent/node_modules/semver}/ranges/outside.js +0 -0
  612. /package/node_modules/{semver → superagent/node_modules/semver}/ranges/simplify.js +0 -0
  613. /package/node_modules/{semver → superagent/node_modules/semver}/ranges/to-comparators.js +0 -0
  614. /package/node_modules/{semver → superagent/node_modules/semver}/ranges/valid.js +0 -0
@@ -18,29 +18,29 @@
18
18
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
19
19
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
20
20
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
21
+
21
22
  // A bit simpler than readable streams.
22
23
  // Implement an async ._write(chunk, encoding, cb), and it'll handle all
23
24
  // the drain event emission and buffering.
25
+
24
26
  'use strict';
25
27
 
26
28
  module.exports = Writable;
27
- /* <replacement> */
28
29
 
30
+ /* <replacement> */
29
31
  function WriteReq(chunk, encoding, cb) {
30
32
  this.chunk = chunk;
31
33
  this.encoding = encoding;
32
34
  this.callback = cb;
33
35
  this.next = null;
34
- } // It seems a linked list but it is not
35
- // there will be only 2 of these for each stream
36
-
36
+ }
37
37
 
38
+ // It seems a linked list but it is not
39
+ // there will be only 2 of these for each stream
38
40
  function CorkedRequest(state) {
39
41
  var _this = this;
40
-
41
42
  this.next = null;
42
43
  this.entry = null;
43
-
44
44
  this.finish = function () {
45
45
  onCorkedFinish(_this, state);
46
46
  };
@@ -48,155 +48,159 @@ function CorkedRequest(state) {
48
48
  /* </replacement> */
49
49
 
50
50
  /*<replacement>*/
51
-
52
-
53
51
  var Duplex;
54
52
  /*</replacement>*/
55
53
 
56
54
  Writable.WritableState = WritableState;
57
- /*<replacement>*/
58
55
 
56
+ /*<replacement>*/
59
57
  var internalUtil = {
60
58
  deprecate: require('util-deprecate')
61
59
  };
62
60
  /*</replacement>*/
63
61
 
64
62
  /*<replacement>*/
65
-
66
63
  var Stream = require('./internal/streams/stream');
67
64
  /*</replacement>*/
68
65
 
69
-
70
66
  var Buffer = require('buffer').Buffer;
71
-
72
- var OurUint8Array = global.Uint8Array || function () {};
73
-
67
+ var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
74
68
  function _uint8ArrayToBuffer(chunk) {
75
69
  return Buffer.from(chunk);
76
70
  }
77
-
78
71
  function _isUint8Array(obj) {
79
72
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
80
73
  }
81
-
82
74
  var destroyImpl = require('./internal/streams/destroy');
83
-
84
75
  var _require = require('./internal/streams/state'),
85
- getHighWaterMark = _require.getHighWaterMark;
86
-
76
+ getHighWaterMark = _require.getHighWaterMark;
87
77
  var _require$codes = require('../errors').codes,
88
- ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
89
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
90
- ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
91
- ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
92
- ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
93
- ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
94
- ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
95
- ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
96
-
78
+ ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
79
+ ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
80
+ ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
81
+ ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
82
+ ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
83
+ ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
84
+ ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
85
+ ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
97
86
  var errorOrDestroy = destroyImpl.errorOrDestroy;
98
-
99
87
  require('inherits')(Writable, Stream);
100
-
101
88
  function nop() {}
102
-
103
89
  function WritableState(options, stream, isDuplex) {
104
90
  Duplex = Duplex || require('./_stream_duplex');
105
- options = options || {}; // Duplex streams are both readable and writable, but share
91
+ options = options || {};
92
+
93
+ // Duplex streams are both readable and writable, but share
106
94
  // the same options object.
107
95
  // However, some cases require setting options to different
108
96
  // values for the readable and the writable sides of the duplex stream,
109
97
  // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
98
+ if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
110
99
 
111
- if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream
100
+ // object stream flag to indicate whether or not this stream
112
101
  // contains buffers or objects.
113
-
114
102
  this.objectMode = !!options.objectMode;
115
- if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false
103
+ if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
104
+
105
+ // the point at which write() starts returning false
116
106
  // Note: 0 is a valid value, means that we always return false if
117
107
  // the entire buffer is not flushed immediately on write()
108
+ this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);
118
109
 
119
- this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called
110
+ // if _final has been called
111
+ this.finalCalled = false;
120
112
 
121
- this.finalCalled = false; // drain event flag.
113
+ // drain event flag.
114
+ this.needDrain = false;
115
+ // at the start of calling end()
116
+ this.ending = false;
117
+ // when end() has been called, and returned
118
+ this.ended = false;
119
+ // when 'finish' is emitted
120
+ this.finished = false;
122
121
 
123
- this.needDrain = false; // at the start of calling end()
122
+ // has it been destroyed
123
+ this.destroyed = false;
124
124
 
125
- this.ending = false; // when end() has been called, and returned
126
-
127
- this.ended = false; // when 'finish' is emitted
128
-
129
- this.finished = false; // has it been destroyed
130
-
131
- this.destroyed = false; // should we decode strings into buffers before passing to _write?
125
+ // should we decode strings into buffers before passing to _write?
132
126
  // this is here so that some node-core streams can optimize string
133
127
  // handling at a lower level.
134
-
135
128
  var noDecode = options.decodeStrings === false;
136
- this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string
129
+ this.decodeStrings = !noDecode;
130
+
131
+ // Crypto is kind of old and crusty. Historically, its default string
137
132
  // encoding is 'binary' so we have to make this configurable.
138
133
  // Everything else in the universe uses 'utf8', though.
134
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
139
135
 
140
- this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement
136
+ // not an actual buffer we keep track of, but a measurement
141
137
  // of how much we're waiting to get pushed to some underlying
142
138
  // socket or file.
139
+ this.length = 0;
143
140
 
144
- this.length = 0; // a flag to see when we're in the middle of a write.
141
+ // a flag to see when we're in the middle of a write.
142
+ this.writing = false;
145
143
 
146
- this.writing = false; // when true all writes will be buffered until .uncork() call
144
+ // when true all writes will be buffered until .uncork() call
145
+ this.corked = 0;
147
146
 
148
- this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,
147
+ // a flag to be able to tell if the onwrite cb is called immediately,
149
148
  // or on a later tick. We set this to true at first, because any
150
149
  // actions that shouldn't happen until "later" should generally also
151
150
  // not happen before the first write call.
151
+ this.sync = true;
152
152
 
153
- this.sync = true; // a flag to know if we're processing previously buffered items, which
153
+ // a flag to know if we're processing previously buffered items, which
154
154
  // may call the _write() callback in the same tick, so that we don't
155
155
  // end up in an overlapped onwrite situation.
156
+ this.bufferProcessing = false;
156
157
 
157
- this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)
158
-
158
+ // the callback that's passed to _write(chunk,cb)
159
159
  this.onwrite = function (er) {
160
160
  onwrite(stream, er);
161
- }; // the callback that the user supplies to write(chunk,encoding,cb)
162
-
161
+ };
163
162
 
164
- this.writecb = null; // the amount that is being written when _write is called.
163
+ // the callback that the user supplies to write(chunk,encoding,cb)
164
+ this.writecb = null;
165
165
 
166
+ // the amount that is being written when _write is called.
166
167
  this.writelen = 0;
167
168
  this.bufferedRequest = null;
168
- this.lastBufferedRequest = null; // number of pending user-supplied write callbacks
169
+ this.lastBufferedRequest = null;
170
+
171
+ // number of pending user-supplied write callbacks
169
172
  // this must be 0 before 'finish' can be emitted
173
+ this.pendingcb = 0;
170
174
 
171
- this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs
175
+ // emit prefinish if the only thing we're waiting for is _write cbs
172
176
  // This is relevant for synchronous Transform streams
177
+ this.prefinished = false;
173
178
 
174
- this.prefinished = false; // True if the error was already emitted and should not be thrown again
179
+ // True if the error was already emitted and should not be thrown again
180
+ this.errorEmitted = false;
175
181
 
176
- this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.
182
+ // Should close be emitted on destroy. Defaults to true.
183
+ this.emitClose = options.emitClose !== false;
177
184
 
178
- this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')
185
+ // Should .destroy() be called after 'finish' (and potentially 'end')
186
+ this.autoDestroy = !!options.autoDestroy;
179
187
 
180
- this.autoDestroy = !!options.autoDestroy; // count buffered requests
188
+ // count buffered requests
189
+ this.bufferedRequestCount = 0;
181
190
 
182
- this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always
191
+ // allocate the first CorkedRequest, there is always
183
192
  // one allocated and free to use, and we maintain at most two
184
-
185
193
  this.corkedRequestsFree = new CorkedRequest(this);
186
194
  }
187
-
188
195
  WritableState.prototype.getBuffer = function getBuffer() {
189
196
  var current = this.bufferedRequest;
190
197
  var out = [];
191
-
192
198
  while (current) {
193
199
  out.push(current);
194
200
  current = current.next;
195
201
  }
196
-
197
202
  return out;
198
203
  };
199
-
200
204
  (function () {
201
205
  try {
202
206
  Object.defineProperty(WritableState.prototype, 'buffer', {
@@ -205,12 +209,11 @@ WritableState.prototype.getBuffer = function getBuffer() {
205
209
  }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
206
210
  });
207
211
  } catch (_) {}
208
- })(); // Test _writableState for inheritance to account for Duplex streams,
209
- // whose prototype chain only points to Readable.
210
-
212
+ })();
211
213
 
214
+ // Test _writableState for inheritance to account for Duplex streams,
215
+ // whose prototype chain only points to Readable.
212
216
  var realHasInstance;
213
-
214
217
  if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
215
218
  realHasInstance = Function.prototype[Symbol.hasInstance];
216
219
  Object.defineProperty(Writable, Symbol.hasInstance, {
@@ -225,81 +228,73 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot
225
228
  return object instanceof this;
226
229
  };
227
230
  }
228
-
229
231
  function Writable(options) {
230
- Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.
232
+ Duplex = Duplex || require('./_stream_duplex');
233
+
234
+ // Writable ctor is applied to Duplexes, too.
231
235
  // `realHasInstance` is necessary because using plain `instanceof`
232
236
  // would return false, as no `_writableState` property is attached.
237
+
233
238
  // Trying to use the custom `instanceof` for Writable here will also break the
234
239
  // Node.js LazyTransform implementation, which has a non-trivial getter for
235
240
  // `_writableState` that would lead to infinite recursion.
241
+
236
242
  // Checking for a Stream.Duplex instance is faster here instead of inside
237
243
  // the WritableState constructor, at least with V8 6.5
238
-
239
244
  var isDuplex = this instanceof Duplex;
240
245
  if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
241
- this._writableState = new WritableState(options, this, isDuplex); // legacy.
246
+ this._writableState = new WritableState(options, this, isDuplex);
242
247
 
248
+ // legacy.
243
249
  this.writable = true;
244
-
245
250
  if (options) {
246
251
  if (typeof options.write === 'function') this._write = options.write;
247
252
  if (typeof options.writev === 'function') this._writev = options.writev;
248
253
  if (typeof options.destroy === 'function') this._destroy = options.destroy;
249
254
  if (typeof options.final === 'function') this._final = options.final;
250
255
  }
251
-
252
256
  Stream.call(this);
253
- } // Otherwise people can pipe Writable streams, which is just wrong.
254
-
257
+ }
255
258
 
259
+ // Otherwise people can pipe Writable streams, which is just wrong.
256
260
  Writable.prototype.pipe = function () {
257
261
  errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
258
262
  };
259
-
260
263
  function writeAfterEnd(stream, cb) {
261
- var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb
262
-
264
+ var er = new ERR_STREAM_WRITE_AFTER_END();
265
+ // TODO: defer error events consistently everywhere, not just the cb
263
266
  errorOrDestroy(stream, er);
264
267
  process.nextTick(cb, er);
265
- } // Checks that a user-supplied chunk is valid, especially for the particular
268
+ }
269
+
270
+ // Checks that a user-supplied chunk is valid, especially for the particular
266
271
  // mode the stream is in. Currently this means that `null` is never accepted
267
272
  // and undefined/non-string values are only allowed in object mode.
268
-
269
-
270
273
  function validChunk(stream, state, chunk, cb) {
271
274
  var er;
272
-
273
275
  if (chunk === null) {
274
276
  er = new ERR_STREAM_NULL_VALUES();
275
277
  } else if (typeof chunk !== 'string' && !state.objectMode) {
276
278
  er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
277
279
  }
278
-
279
280
  if (er) {
280
281
  errorOrDestroy(stream, er);
281
282
  process.nextTick(cb, er);
282
283
  return false;
283
284
  }
284
-
285
285
  return true;
286
286
  }
287
-
288
287
  Writable.prototype.write = function (chunk, encoding, cb) {
289
288
  var state = this._writableState;
290
289
  var ret = false;
291
-
292
290
  var isBuf = !state.objectMode && _isUint8Array(chunk);
293
-
294
291
  if (isBuf && !Buffer.isBuffer(chunk)) {
295
292
  chunk = _uint8ArrayToBuffer(chunk);
296
293
  }
297
-
298
294
  if (typeof encoding === 'function') {
299
295
  cb = encoding;
300
296
  encoding = null;
301
297
  }
302
-
303
298
  if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
304
299
  if (typeof cb !== 'function') cb = nop;
305
300
  if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
@@ -308,20 +303,16 @@ Writable.prototype.write = function (chunk, encoding, cb) {
308
303
  }
309
304
  return ret;
310
305
  };
311
-
312
306
  Writable.prototype.cork = function () {
313
307
  this._writableState.corked++;
314
308
  };
315
-
316
309
  Writable.prototype.uncork = function () {
317
310
  var state = this._writableState;
318
-
319
311
  if (state.corked) {
320
312
  state.corked--;
321
313
  if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
322
314
  }
323
315
  };
324
-
325
316
  Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
326
317
  // node::ParseEncoding() requires lower case.
327
318
  if (typeof encoding === 'string') encoding = encoding.toLowerCase();
@@ -329,7 +320,6 @@ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
329
320
  this._writableState.defaultEncoding = encoding;
330
321
  return this;
331
322
  };
332
-
333
323
  Object.defineProperty(Writable.prototype, 'writableBuffer', {
334
324
  // making it explicit this property is not enumerable
335
325
  // because otherwise some prototype manipulation in
@@ -339,15 +329,12 @@ Object.defineProperty(Writable.prototype, 'writableBuffer', {
339
329
  return this._writableState && this._writableState.getBuffer();
340
330
  }
341
331
  });
342
-
343
332
  function decodeChunk(state, chunk, encoding) {
344
333
  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
345
334
  chunk = Buffer.from(chunk, encoding);
346
335
  }
347
-
348
336
  return chunk;
349
337
  }
350
-
351
338
  Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
352
339
  // making it explicit this property is not enumerable
353
340
  // because otherwise some prototype manipulation in
@@ -356,27 +343,25 @@ Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
356
343
  get: function get() {
357
344
  return this._writableState.highWaterMark;
358
345
  }
359
- }); // if we're already writing something, then just put this
346
+ });
347
+
348
+ // if we're already writing something, then just put this
360
349
  // in the queue, and wait our turn. Otherwise, call _write
361
350
  // If we return false, then we need a drain event, so set that flag.
362
-
363
351
  function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
364
352
  if (!isBuf) {
365
353
  var newChunk = decodeChunk(state, chunk, encoding);
366
-
367
354
  if (chunk !== newChunk) {
368
355
  isBuf = true;
369
356
  encoding = 'buffer';
370
357
  chunk = newChunk;
371
358
  }
372
359
  }
373
-
374
360
  var len = state.objectMode ? 1 : chunk.length;
375
361
  state.length += len;
376
- var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.
377
-
362
+ var ret = state.length < state.highWaterMark;
363
+ // we must ensure that previous needDrain will not be reset to false.
378
364
  if (!ret) state.needDrain = true;
379
-
380
365
  if (state.writing || state.corked) {
381
366
  var last = state.lastBufferedRequest;
382
367
  state.lastBufferedRequest = {
@@ -386,21 +371,17 @@ function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
386
371
  callback: cb,
387
372
  next: null
388
373
  };
389
-
390
374
  if (last) {
391
375
  last.next = state.lastBufferedRequest;
392
376
  } else {
393
377
  state.bufferedRequest = state.lastBufferedRequest;
394
378
  }
395
-
396
379
  state.bufferedRequestCount += 1;
397
380
  } else {
398
381
  doWrite(stream, state, false, len, chunk, encoding, cb);
399
382
  }
400
-
401
383
  return ret;
402
384
  }
403
-
404
385
  function doWrite(stream, state, writev, len, chunk, encoding, cb) {
405
386
  state.writelen = len;
406
387
  state.writecb = cb;
@@ -409,16 +390,14 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) {
409
390
  if (state.destroyed) state.onwrite(new ERR_STREAM_DESTROYED('write'));else if (writev) stream._writev(chunk, state.onwrite);else stream._write(chunk, encoding, state.onwrite);
410
391
  state.sync = false;
411
392
  }
412
-
413
393
  function onwriteError(stream, state, sync, er, cb) {
414
394
  --state.pendingcb;
415
-
416
395
  if (sync) {
417
396
  // defer the callback if we are being called synchronously
418
397
  // to avoid piling up things on the stack
419
- process.nextTick(cb, er); // this can emit finish, and it will always happen
398
+ process.nextTick(cb, er);
399
+ // this can emit finish, and it will always happen
420
400
  // after error
421
-
422
401
  process.nextTick(finishMaybe, stream, state);
423
402
  stream._writableState.errorEmitted = true;
424
403
  errorOrDestroy(stream, er);
@@ -427,20 +406,18 @@ function onwriteError(stream, state, sync, er, cb) {
427
406
  // it is async
428
407
  cb(er);
429
408
  stream._writableState.errorEmitted = true;
430
- errorOrDestroy(stream, er); // this can emit finish, but finish must
409
+ errorOrDestroy(stream, er);
410
+ // this can emit finish, but finish must
431
411
  // always follow error
432
-
433
412
  finishMaybe(stream, state);
434
413
  }
435
414
  }
436
-
437
415
  function onwriteStateUpdate(state) {
438
416
  state.writing = false;
439
417
  state.writecb = null;
440
418
  state.length -= state.writelen;
441
419
  state.writelen = 0;
442
420
  }
443
-
444
421
  function onwrite(stream, er) {
445
422
  var state = stream._writableState;
446
423
  var sync = state.sync;
@@ -450,11 +427,9 @@ function onwrite(stream, er) {
450
427
  if (er) onwriteError(stream, state, sync, er, cb);else {
451
428
  // Check if we're actually ready to finish, but don't emit yet
452
429
  var finished = needFinish(state) || stream.destroyed;
453
-
454
430
  if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
455
431
  clearBuffer(stream, state);
456
432
  }
457
-
458
433
  if (sync) {
459
434
  process.nextTick(afterWrite, stream, state, finished, cb);
460
435
  } else {
@@ -462,29 +437,27 @@ function onwrite(stream, er) {
462
437
  }
463
438
  }
464
439
  }
465
-
466
440
  function afterWrite(stream, state, finished, cb) {
467
441
  if (!finished) onwriteDrain(stream, state);
468
442
  state.pendingcb--;
469
443
  cb();
470
444
  finishMaybe(stream, state);
471
- } // Must force callback to be called on nextTick, so that we don't
445
+ }
446
+
447
+ // Must force callback to be called on nextTick, so that we don't
472
448
  // emit 'drain' before the write() consumer gets the 'false' return
473
449
  // value, and has a chance to attach a 'drain' listener.
474
-
475
-
476
450
  function onwriteDrain(stream, state) {
477
451
  if (state.length === 0 && state.needDrain) {
478
452
  state.needDrain = false;
479
453
  stream.emit('drain');
480
454
  }
481
- } // if there's something in the buffer waiting, then process it
482
-
455
+ }
483
456
 
457
+ // if there's something in the buffer waiting, then process it
484
458
  function clearBuffer(stream, state) {
485
459
  state.bufferProcessing = true;
486
460
  var entry = state.bufferedRequest;
487
-
488
461
  if (stream._writev && entry && entry.next) {
489
462
  // Fast case, write everything using _writev()
490
463
  var l = state.bufferedRequestCount;
@@ -493,28 +466,25 @@ function clearBuffer(stream, state) {
493
466
  holder.entry = entry;
494
467
  var count = 0;
495
468
  var allBuffers = true;
496
-
497
469
  while (entry) {
498
470
  buffer[count] = entry;
499
471
  if (!entry.isBuf) allBuffers = false;
500
472
  entry = entry.next;
501
473
  count += 1;
502
474
  }
503
-
504
475
  buffer.allBuffers = allBuffers;
505
- doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time
506
- // as the hot path ends with doWrite
476
+ doWrite(stream, state, true, state.length, buffer, '', holder.finish);
507
477
 
478
+ // doWrite is almost always async, defer these to save a bit of time
479
+ // as the hot path ends with doWrite
508
480
  state.pendingcb++;
509
481
  state.lastBufferedRequest = null;
510
-
511
482
  if (holder.next) {
512
483
  state.corkedRequestsFree = holder.next;
513
484
  holder.next = null;
514
485
  } else {
515
486
  state.corkedRequestsFree = new CorkedRequest(state);
516
487
  }
517
-
518
488
  state.bufferedRequestCount = 0;
519
489
  } else {
520
490
  // Slow case, write chunks one-by-one
@@ -525,32 +495,26 @@ function clearBuffer(stream, state) {
525
495
  var len = state.objectMode ? 1 : chunk.length;
526
496
  doWrite(stream, state, false, len, chunk, encoding, cb);
527
497
  entry = entry.next;
528
- state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then
498
+ state.bufferedRequestCount--;
499
+ // if we didn't call the onwrite immediately, then
529
500
  // it means that we need to wait until it does.
530
501
  // also, that means that the chunk and cb are currently
531
502
  // being processed, so move the buffer counter past them.
532
-
533
503
  if (state.writing) {
534
504
  break;
535
505
  }
536
506
  }
537
-
538
507
  if (entry === null) state.lastBufferedRequest = null;
539
508
  }
540
-
541
509
  state.bufferedRequest = entry;
542
510
  state.bufferProcessing = false;
543
511
  }
544
-
545
512
  Writable.prototype._write = function (chunk, encoding, cb) {
546
513
  cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
547
514
  };
548
-
549
515
  Writable.prototype._writev = null;
550
-
551
516
  Writable.prototype.end = function (chunk, encoding, cb) {
552
517
  var state = this._writableState;
553
-
554
518
  if (typeof chunk === 'function') {
555
519
  cb = chunk;
556
520
  chunk = null;
@@ -559,19 +523,18 @@ Writable.prototype.end = function (chunk, encoding, cb) {
559
523
  cb = encoding;
560
524
  encoding = null;
561
525
  }
526
+ if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
562
527
 
563
- if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks
564
-
528
+ // .end() fully uncorks
565
529
  if (state.corked) {
566
530
  state.corked = 1;
567
531
  this.uncork();
568
- } // ignore unnecessary end() calls.
569
-
532
+ }
570
533
 
534
+ // ignore unnecessary end() calls.
571
535
  if (!state.ending) endWritable(this, state, cb);
572
536
  return this;
573
537
  };
574
-
575
538
  Object.defineProperty(Writable.prototype, 'writableLength', {
576
539
  // making it explicit this property is not enumerable
577
540
  // because otherwise some prototype manipulation in
@@ -581,25 +544,20 @@ Object.defineProperty(Writable.prototype, 'writableLength', {
581
544
  return this._writableState.length;
582
545
  }
583
546
  });
584
-
585
547
  function needFinish(state) {
586
548
  return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
587
549
  }
588
-
589
550
  function callFinal(stream, state) {
590
551
  stream._final(function (err) {
591
552
  state.pendingcb--;
592
-
593
553
  if (err) {
594
554
  errorOrDestroy(stream, err);
595
555
  }
596
-
597
556
  state.prefinished = true;
598
557
  stream.emit('prefinish');
599
558
  finishMaybe(stream, state);
600
559
  });
601
560
  }
602
-
603
561
  function prefinish(stream, state) {
604
562
  if (!state.prefinished && !state.finalCalled) {
605
563
  if (typeof stream._final === 'function' && !state.destroyed) {
@@ -612,59 +570,47 @@ function prefinish(stream, state) {
612
570
  }
613
571
  }
614
572
  }
615
-
616
573
  function finishMaybe(stream, state) {
617
574
  var need = needFinish(state);
618
-
619
575
  if (need) {
620
576
  prefinish(stream, state);
621
-
622
577
  if (state.pendingcb === 0) {
623
578
  state.finished = true;
624
579
  stream.emit('finish');
625
-
626
580
  if (state.autoDestroy) {
627
581
  // In case of duplex streams we need a way to detect
628
582
  // if the readable side is ready for autoDestroy as well
629
583
  var rState = stream._readableState;
630
-
631
584
  if (!rState || rState.autoDestroy && rState.endEmitted) {
632
585
  stream.destroy();
633
586
  }
634
587
  }
635
588
  }
636
589
  }
637
-
638
590
  return need;
639
591
  }
640
-
641
592
  function endWritable(stream, state, cb) {
642
593
  state.ending = true;
643
594
  finishMaybe(stream, state);
644
-
645
595
  if (cb) {
646
596
  if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
647
597
  }
648
-
649
598
  state.ended = true;
650
599
  stream.writable = false;
651
600
  }
652
-
653
601
  function onCorkedFinish(corkReq, state, err) {
654
602
  var entry = corkReq.entry;
655
603
  corkReq.entry = null;
656
-
657
604
  while (entry) {
658
605
  var cb = entry.callback;
659
606
  state.pendingcb--;
660
607
  cb(err);
661
608
  entry = entry.next;
662
- } // reuse the free corkReq.
663
-
609
+ }
664
610
 
611
+ // reuse the free corkReq.
665
612
  state.corkedRequestsFree.next = corkReq;
666
613
  }
667
-
668
614
  Object.defineProperty(Writable.prototype, 'destroyed', {
669
615
  // making it explicit this property is not enumerable
670
616
  // because otherwise some prototype manipulation in
@@ -674,7 +620,6 @@ Object.defineProperty(Writable.prototype, 'destroyed', {
674
620
  if (this._writableState === undefined) {
675
621
  return false;
676
622
  }
677
-
678
623
  return this._writableState.destroyed;
679
624
  },
680
625
  set: function set(value) {
@@ -682,16 +627,15 @@ Object.defineProperty(Writable.prototype, 'destroyed', {
682
627
  // has not been initialized yet
683
628
  if (!this._writableState) {
684
629
  return;
685
- } // backward compatibility, the user is explicitly
686
- // managing destroyed
687
-
630
+ }
688
631
 
632
+ // backward compatibility, the user is explicitly
633
+ // managing destroyed
689
634
  this._writableState.destroyed = value;
690
635
  }
691
636
  });
692
637
  Writable.prototype.destroy = destroyImpl.destroy;
693
638
  Writable.prototype._undestroy = destroyImpl.undestroy;
694
-
695
639
  Writable.prototype._destroy = function (err, cb) {
696
640
  cb(err);
697
641
  };