slnodejs 6.1.309 → 6.1.319

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 (285) hide show
  1. package/browser-agent/dist/browser-agent-all.js +823 -1066
  2. package/browser-agent/dist/browser-agent-all.min.js +3 -3
  3. package/browser-agent/package.json +1 -1
  4. package/package.json +5 -4
  5. package/tsOutputs/api.js +1 -1
  6. package/tsOutputs/build-scanner/ast-utils.js +3 -3
  7. package/tsOutputs/build-scanner/ast-utils.js.map +1 -1
  8. package/tsOutputs/build-scanner/diagnostic/build-scan-diagnosis.js +5 -2
  9. package/tsOutputs/build-scanner/diagnostic/build-scan-diagnosis.js.map +1 -1
  10. package/tsOutputs/build-scanner/diagnostic/index.js +5 -1
  11. package/tsOutputs/build-scanner/diagnostic/index.js.map +1 -1
  12. package/tsOutputs/build-scanner/diagnostic/none-diagnosis.js +1 -1
  13. package/tsOutputs/build-scanner/instrumentation/browser-instrumenter.js +11 -11
  14. package/tsOutputs/build-scanner/instrumentation/browser-instrumenter.js.map +1 -1
  15. package/tsOutputs/build-scanner/instrumentation/content-instrumenter.js +3 -3
  16. package/tsOutputs/build-scanner/instrumentation/content-instrumenter.js.map +1 -1
  17. package/tsOutputs/build-scanner/instrumentation/files-instrumenter.js +6 -6
  18. package/tsOutputs/build-scanner/instrumentation/files-instrumenter.js.map +1 -1
  19. package/tsOutputs/build-scanner/instrumentation/process-pool/contracts.d.ts +1 -1
  20. package/tsOutputs/build-scanner/instrumentation/process-pool/instrumenter-spawn.js +1 -1
  21. package/tsOutputs/build-scanner/instrumentation/process-pool/instrumenter-spawn.js.map +1 -1
  22. package/tsOutputs/build-scanner/instrumentation/process-pool/process-pool.js +10 -8
  23. package/tsOutputs/build-scanner/instrumentation/process-pool/process-pool.js.map +1 -1
  24. package/tsOutputs/build-scanner/instrumentation/process-pool/split-by-transform-stream.js +2 -0
  25. package/tsOutputs/build-scanner/instrumentation/process-pool/split-by-transform-stream.js.map +1 -1
  26. package/tsOutputs/build-scanner/instrumentation/strategies/js-instrumnetation-strategy.js +4 -4
  27. package/tsOutputs/build-scanner/instrumentation/strategies/js-instrumnetation-strategy.js.map +1 -1
  28. package/tsOutputs/build-scanner/instrumentation/strategies/markup-instrumnetation-strategy.js +6 -4
  29. package/tsOutputs/build-scanner/instrumentation/strategies/markup-instrumnetation-strategy.js.map +1 -1
  30. package/tsOutputs/build-scanner/js_diff/sl-mapper.js +8 -6
  31. package/tsOutputs/build-scanner/js_diff/sl-mapper.js.map +1 -1
  32. package/tsOutputs/build-scanner/mappings/ensure-files-handler.service.js +14 -14
  33. package/tsOutputs/build-scanner/mappings/ensure-files-handler.service.js.map +1 -1
  34. package/tsOutputs/build-scanner/mappings/file-element-utils.js +1 -1
  35. package/tsOutputs/build-scanner/mappings/file-element-utils.js.map +1 -1
  36. package/tsOutputs/build-scanner/mappings/file-enricher.js +17 -15
  37. package/tsOutputs/build-scanner/mappings/file-enricher.js.map +1 -1
  38. package/tsOutputs/build-scanner/mappings/files-data-container.js +1 -1
  39. package/tsOutputs/build-scanner/mappings/files-data-container.js.map +1 -1
  40. package/tsOutputs/build-scanner/mappings/scm-file-fixer.js +16 -14
  41. package/tsOutputs/build-scanner/mappings/scm-file-fixer.js.map +1 -1
  42. package/tsOutputs/build-scanner/mappings/source-path-mapper.js +1 -1
  43. package/tsOutputs/cli-parse/child-process-wrapper.js +4 -4
  44. package/tsOutputs/cli-parse/child-process-wrapper.js.map +1 -1
  45. package/tsOutputs/cli-parse/cli.js +10 -10
  46. package/tsOutputs/cli-parse/cli.js.map +1 -1
  47. package/tsOutputs/cli-parse/constants/constants.js +11 -10
  48. package/tsOutputs/cli-parse/constants/constants.js.map +1 -1
  49. package/tsOutputs/cli-parse/custom-commander.js +2 -2
  50. package/tsOutputs/cli-parse/custom-commander.js.map +1 -1
  51. package/tsOutputs/cli-parse/executors/base-executor.js +10 -10
  52. package/tsOutputs/cli-parse/executors/base-executor.js.map +1 -1
  53. package/tsOutputs/cli-parse/executors/build-end-executor.js +4 -2
  54. package/tsOutputs/cli-parse/executors/build-end-executor.js.map +1 -1
  55. package/tsOutputs/cli-parse/executors/build-executor.js +6 -4
  56. package/tsOutputs/cli-parse/executors/build-executor.js.map +1 -1
  57. package/tsOutputs/cli-parse/executors/config-executor.js +5 -3
  58. package/tsOutputs/cli-parse/executors/config-executor.js.map +1 -1
  59. package/tsOutputs/cli-parse/executors/dry-run/base-data.js +4 -4
  60. package/tsOutputs/cli-parse/executors/dry-run/base-data.js.map +1 -1
  61. package/tsOutputs/cli-parse/executors/dry-run/build-mapping-data.js +24 -22
  62. package/tsOutputs/cli-parse/executors/dry-run/build-mapping-data.js.map +1 -1
  63. package/tsOutputs/cli-parse/executors/dry-run/dry-run-executor.js +20 -18
  64. package/tsOutputs/cli-parse/executors/dry-run/dry-run-executor.js.map +1 -1
  65. package/tsOutputs/cli-parse/executors/dry-run/dry-run-validation.js +3 -1
  66. package/tsOutputs/cli-parse/executors/dry-run/dry-run-validation.js.map +1 -1
  67. package/tsOutputs/cli-parse/executors/dry-run/footprints-data.js +7 -5
  68. package/tsOutputs/cli-parse/executors/dry-run/footprints-data.js.map +1 -1
  69. package/tsOutputs/cli-parse/executors/dry-run/helper-methods.js +7 -7
  70. package/tsOutputs/cli-parse/executors/dry-run/helper-methods.js.map +1 -1
  71. package/tsOutputs/cli-parse/executors/end-execution-executor.js +4 -2
  72. package/tsOutputs/cli-parse/executors/end-execution-executor.js.map +1 -1
  73. package/tsOutputs/cli-parse/executors/integration-build-components-executor.js +4 -2
  74. package/tsOutputs/cli-parse/executors/integration-build-components-executor.js.map +1 -1
  75. package/tsOutputs/cli-parse/executors/integration-build-delete-components-executor.js +3 -1
  76. package/tsOutputs/cli-parse/executors/integration-build-delete-components-executor.js.map +1 -1
  77. package/tsOutputs/cli-parse/executors/integration-build-update-components-executor.js +3 -1
  78. package/tsOutputs/cli-parse/executors/integration-build-update-components-executor.js.map +1 -1
  79. package/tsOutputs/cli-parse/executors/mocha-executor.js +4 -2
  80. package/tsOutputs/cli-parse/executors/mocha-executor.js.map +1 -1
  81. package/tsOutputs/cli-parse/executors/nyc-report-executor.js +6 -4
  82. package/tsOutputs/cli-parse/executors/nyc-report-executor.js.map +1 -1
  83. package/tsOutputs/cli-parse/executors/pr-config-executor.js +3 -1
  84. package/tsOutputs/cli-parse/executors/pr-config-executor.js.map +1 -1
  85. package/tsOutputs/cli-parse/executors/run-executor.js +3 -1
  86. package/tsOutputs/cli-parse/executors/run-executor.js.map +1 -1
  87. package/tsOutputs/cli-parse/executors/start-execution-executor.js +4 -2
  88. package/tsOutputs/cli-parse/executors/start-execution-executor.js.map +1 -1
  89. package/tsOutputs/cli-parse/executors/test-executions-executor.js +3 -1
  90. package/tsOutputs/cli-parse/executors/test-executions-executor.js.map +1 -1
  91. package/tsOutputs/cli-parse/executors/test-listener-executor.js +4 -2
  92. package/tsOutputs/cli-parse/executors/test-listener-executor.js.map +1 -1
  93. package/tsOutputs/cli-parse/executors/test-runner-build-session-data-builder.js +4 -2
  94. package/tsOutputs/cli-parse/executors/test-runner-build-session-data-builder.js.map +1 -1
  95. package/tsOutputs/cli-parse/executors/upload-report-executor.js +4 -2
  96. package/tsOutputs/cli-parse/executors/upload-report-executor.js.map +1 -1
  97. package/tsOutputs/cli-parse/utils.js +5 -5
  98. package/tsOutputs/cli-parse/utils.js.map +1 -1
  99. package/tsOutputs/common/agent-events/agent-events-controller.js +17 -15
  100. package/tsOutputs/common/agent-events/agent-events-controller.js.map +1 -1
  101. package/tsOutputs/common/agent-events/agent-events-guard.js +1 -1
  102. package/tsOutputs/common/agent-events/agent-events-guard.js.map +1 -1
  103. package/tsOutputs/common/agent-events/agent-instance-info-builder.js +1 -1
  104. package/tsOutputs/common/agent-events/agent-instance-info-builder.js.map +1 -1
  105. package/tsOutputs/common/agent-events/cockpit-notifier.js +1 -1
  106. package/tsOutputs/common/agent-events/dry-run-agent-events-controller.js +2 -0
  107. package/tsOutputs/common/agent-events/dry-run-agent-events-controller.js.map +1 -1
  108. package/tsOutputs/common/agent-events/machine-info-builder.js +1 -1
  109. package/tsOutputs/common/agent-events/machine-info-builder.js.map +1 -1
  110. package/tsOutputs/common/agent-events/no-op-agent-events-controller.js +3 -1
  111. package/tsOutputs/common/agent-events/no-op-agent-events-controller.js.map +1 -1
  112. package/tsOutputs/common/agent-events/sensitive-data-filter.js +1 -1
  113. package/tsOutputs/common/agent-events/sensitive-data-filter.js.map +1 -1
  114. package/tsOutputs/common/agent-instance-data.js +2 -2
  115. package/tsOutputs/common/agent-instance-data.js.map +1 -1
  116. package/tsOutputs/common/cli-progress.js.map +1 -1
  117. package/tsOutputs/common/config-process/config.js +2 -0
  118. package/tsOutputs/common/config-process/config.js.map +1 -1
  119. package/tsOutputs/common/config-process/index.js +2 -0
  120. package/tsOutputs/common/config-process/index.js.map +1 -1
  121. package/tsOutputs/common/config-process/no-op-config-process.js +2 -0
  122. package/tsOutputs/common/config-process/no-op-config-process.js.map +1 -1
  123. package/tsOutputs/common/constants/constants.js +1 -1
  124. package/tsOutputs/common/constants/constants.js.map +1 -1
  125. package/tsOutputs/common/contracts.d.ts +1 -1
  126. package/tsOutputs/common/coverage-elements/istanbul-unique-id-converter.js +2 -0
  127. package/tsOutputs/common/coverage-elements/istanbul-unique-id-converter.js.map +1 -1
  128. package/tsOutputs/common/coverage-elements/new-id-resolver.js +7 -7
  129. package/tsOutputs/common/coverage-elements/new-id-resolver.js.map +1 -1
  130. package/tsOutputs/common/coverage-elements/unique-id-converter.js +4 -4
  131. package/tsOutputs/common/coverage-elements/unique-id-converter.js.map +1 -1
  132. package/tsOutputs/common/events-process/events-creator.js +3 -5
  133. package/tsOutputs/common/events-process/events-creator.js.map +1 -1
  134. package/tsOutputs/common/events-process/index.js +5 -5
  135. package/tsOutputs/common/events-process/index.js.map +1 -1
  136. package/tsOutputs/common/footprints-process/collection-interval.js +2 -2
  137. package/tsOutputs/common/footprints-process/collection-interval.js.map +1 -1
  138. package/tsOutputs/common/footprints-process/index.js +3 -3
  139. package/tsOutputs/common/footprints-process/index.js.map +1 -1
  140. package/tsOutputs/common/footprints-process/istanbul-to-footprints.js +5 -5
  141. package/tsOutputs/common/footprints-process/istanbul-to-footprints.js.map +1 -1
  142. package/tsOutputs/common/footprints-process/production-footprints-handler.js +5 -5
  143. package/tsOutputs/common/footprints-process/production-footprints-handler.js.map +1 -1
  144. package/tsOutputs/common/footprints-process-v6/base-browser-hits-converter.js +3 -1
  145. package/tsOutputs/common/footprints-process-v6/base-browser-hits-converter.js.map +1 -1
  146. package/tsOutputs/common/footprints-process-v6/collector-footprints-buffer.js +2 -0
  147. package/tsOutputs/common/footprints-process-v6/collector-footprints-buffer.js.map +1 -1
  148. package/tsOutputs/common/footprints-process-v6/collector-footprints-process.js +5 -3
  149. package/tsOutputs/common/footprints-process-v6/collector-footprints-process.js.map +1 -1
  150. package/tsOutputs/common/footprints-process-v6/contracts.d.ts +1 -1
  151. package/tsOutputs/common/footprints-process-v6/footprints-buffer.js +2 -0
  152. package/tsOutputs/common/footprints-process-v6/footprints-buffer.js.map +1 -1
  153. package/tsOutputs/common/footprints-process-v6/hits-collector.d.ts +2 -0
  154. package/tsOutputs/common/footprints-process-v6/hits-collector.js +9 -1
  155. package/tsOutputs/common/footprints-process-v6/hits-collector.js.map +1 -1
  156. package/tsOutputs/common/footprints-process-v6/hits-converter.js +3 -3
  157. package/tsOutputs/common/footprints-process-v6/hits-converter.js.map +1 -1
  158. package/tsOutputs/common/footprints-process-v6/index.js +10 -9
  159. package/tsOutputs/common/footprints-process-v6/index.js.map +1 -1
  160. package/tsOutputs/common/footprints-process-v6/location-formatter.js +2 -2
  161. package/tsOutputs/common/footprints-process-v6/location-formatter.js.map +1 -1
  162. package/tsOutputs/common/footprints-process-v6/remote-browser-hits-converter.js +2 -0
  163. package/tsOutputs/common/footprints-process-v6/remote-browser-hits-converter.js.map +1 -1
  164. package/tsOutputs/common/footprints-process-v6/remote-footprints-process.js +3 -1
  165. package/tsOutputs/common/footprints-process-v6/remote-footprints-process.js.map +1 -1
  166. package/tsOutputs/common/footprints-process-v6/remote-hits-collector.js +2 -0
  167. package/tsOutputs/common/footprints-process-v6/remote-hits-collector.js.map +1 -1
  168. package/tsOutputs/common/footprints-process-v6/source-map-data.js +1 -1
  169. package/tsOutputs/common/footprints-process-v6/source-map-data.js.map +1 -1
  170. package/tsOutputs/common/http/backend-proxy.js +3 -3
  171. package/tsOutputs/common/http/backend-proxy.js.map +1 -1
  172. package/tsOutputs/common/http/contracts.js +3 -1
  173. package/tsOutputs/common/http/contracts.js.map +1 -1
  174. package/tsOutputs/common/http/dry-run-proxy.js +1 -1
  175. package/tsOutputs/common/http/http-client.js +13 -13
  176. package/tsOutputs/common/http/http-client.js.map +1 -1
  177. package/tsOutputs/common/http/sl-routes.js +1 -1
  178. package/tsOutputs/common/http/sl-routes.js.map +1 -1
  179. package/tsOutputs/common/ignored-files-handler.js +2 -2
  180. package/tsOutputs/common/ignored-files-handler.js.map +1 -1
  181. package/tsOutputs/common/logger.d.ts +1 -0
  182. package/tsOutputs/common/logger.js +7 -5
  183. package/tsOutputs/common/logger.js.map +1 -1
  184. package/tsOutputs/common/no-op-state-tracker.js +2 -0
  185. package/tsOutputs/common/no-op-state-tracker.js.map +1 -1
  186. package/tsOutputs/common/queue.js +2 -0
  187. package/tsOutputs/common/queue.js.map +1 -1
  188. package/tsOutputs/common/scm/git-cloner.js +4 -4
  189. package/tsOutputs/common/scm/git-cloner.js.map +1 -1
  190. package/tsOutputs/common/scm/git.js +2 -2
  191. package/tsOutputs/common/scm/git.js.map +1 -1
  192. package/tsOutputs/common/scm/none.js +1 -1
  193. package/tsOutputs/common/short-name-to-file-mapper.js +3 -3
  194. package/tsOutputs/common/short-name-to-file-mapper.js.map +1 -1
  195. package/tsOutputs/common/source-map-handler.js +7 -7
  196. package/tsOutputs/common/source-map-handler.js.map +1 -1
  197. package/tsOutputs/common/source-map-reader.js +7 -7
  198. package/tsOutputs/common/source-map-reader.js.map +1 -1
  199. package/tsOutputs/common/state-tracker-fpv6.js +3 -1
  200. package/tsOutputs/common/state-tracker-fpv6.js.map +1 -1
  201. package/tsOutputs/common/state-tracker.js +6 -4
  202. package/tsOutputs/common/state-tracker.js.map +1 -1
  203. package/tsOutputs/common/utils/abstract-data-builder.js +2 -2
  204. package/tsOutputs/common/utils/abstract-data-builder.js.map +1 -1
  205. package/tsOutputs/common/utils/build-session-data-builder.js +3 -1
  206. package/tsOutputs/common/utils/build-session-data-builder.js.map +1 -1
  207. package/tsOutputs/common/utils/process-utils.js +9 -7
  208. package/tsOutputs/common/utils/process-utils.js.map +1 -1
  209. package/tsOutputs/common/utils/test-utils/mock-server-utils/mock-server-proxy.js +4 -4
  210. package/tsOutputs/common/utils/test-utils/mock-server-utils/mock-server-proxy.js.map +1 -1
  211. package/tsOutputs/common/utils/token-data-builder.js +4 -2
  212. package/tsOutputs/common/utils/token-data-builder.js.map +1 -1
  213. package/tsOutputs/common/utils/validation-utils.js +2 -2
  214. package/tsOutputs/common/utils/validation-utils.js.map +1 -1
  215. package/tsOutputs/common/v8-utils.js +1 -1
  216. package/tsOutputs/common/v8-utils.js.map +1 -1
  217. package/tsOutputs/common/watchdog.js +2 -0
  218. package/tsOutputs/common/watchdog.js.map +1 -1
  219. package/tsOutputs/mocha-reporter/otel-agent.js +2 -2
  220. package/tsOutputs/mocha-reporter/otel-agent.js.map +1 -1
  221. package/tsOutputs/test-listener/agent-loader.js +9 -7
  222. package/tsOutputs/test-listener/agent-loader.js.map +1 -1
  223. package/tsOutputs/test-listener/agent.js +4 -4
  224. package/tsOutputs/test-listener/agent.js.map +1 -1
  225. package/tsOutputs/test-listener/api.js +1 -1
  226. package/tsOutputs/test-listener/child-process-patcher.js +1 -1
  227. package/tsOutputs/test-listener/child-process-patcher.js.map +1 -1
  228. package/tsOutputs/test-listener/config-process/index.js +2 -0
  229. package/tsOutputs/test-listener/config-process/index.js.map +1 -1
  230. package/tsOutputs/test-listener/config.js +2 -0
  231. package/tsOutputs/test-listener/config.js.map +1 -1
  232. package/tsOutputs/test-listener/entities/build-scanner/ConfigModeData.js +2 -0
  233. package/tsOutputs/test-listener/entities/build-scanner/ConfigModeData.js.map +1 -1
  234. package/tsOutputs/test-listener/entities/build-scanner/ScanModeData.js +2 -0
  235. package/tsOutputs/test-listener/entities/build-scanner/ScanModeData.js.map +1 -1
  236. package/tsOutputs/test-listener/execution-process/execution-service-proxy.js +3 -1
  237. package/tsOutputs/test-listener/execution-process/execution-service-proxy.js.map +1 -1
  238. package/tsOutputs/test-listener/factory.js +1 -1
  239. package/tsOutputs/test-listener/footprints-process/footprints-service-proxy.js +2 -0
  240. package/tsOutputs/test-listener/footprints-process/footprints-service-proxy.js.map +1 -1
  241. package/tsOutputs/test-listener/footprints-process/index.js +2 -2
  242. package/tsOutputs/test-listener/footprints-process/index.js.map +1 -1
  243. package/tsOutputs/test-listener/footprints-process/istanbul-to-footprints-base.js +1 -1
  244. package/tsOutputs/test-listener/footprints-process/istanbul-to-footprints-base.js.map +1 -1
  245. package/tsOutputs/test-listener/footprints-process/istanbul-to-footprints-v3.js +2 -0
  246. package/tsOutputs/test-listener/footprints-process/istanbul-to-footprints-v3.js.map +1 -1
  247. package/tsOutputs/test-listener/footprints-process/ts-node-hits-collector.js +22 -22
  248. package/tsOutputs/test-listener/footprints-process/ts-node-hits-collector.js.map +1 -1
  249. package/tsOutputs/test-listener/logs-process/index.js +1 -1
  250. package/tsOutputs/test-listener/logs-process/index.js.map +1 -1
  251. package/tsOutputs/test-listener/logs-process/log-service-proxy.js +2 -0
  252. package/tsOutputs/test-listener/logs-process/log-service-proxy.js.map +1 -1
  253. package/tsOutputs/test-listener/nyc-report-executor-fpv6.js +4 -4
  254. package/tsOutputs/test-listener/nyc-report-executor-fpv6.js.map +1 -1
  255. package/tsOutputs/test-listener/nyc-report-executor.js +4 -4
  256. package/tsOutputs/test-listener/nyc-report-executor.js.map +1 -1
  257. package/tsOutputs/test-listener/otel-agent-loader.js.map +1 -1
  258. package/tsOutputs/test-listener/queue.js +2 -0
  259. package/tsOutputs/test-listener/queue.js.map +1 -1
  260. package/tsOutputs/test-listener/remote-agent.js +2 -2
  261. package/tsOutputs/test-listener/remote-agent.js.map +1 -1
  262. package/tsOutputs/test-listener/resolvers/AppNameResolver.js +2 -0
  263. package/tsOutputs/test-listener/resolvers/AppNameResolver.js.map +1 -1
  264. package/tsOutputs/test-listener/resolvers/ArgumentResolver.js +2 -2
  265. package/tsOutputs/test-listener/resolvers/ArgumentResolver.js.map +1 -1
  266. package/tsOutputs/test-listener/resolvers/BuildResolver.js +2 -0
  267. package/tsOutputs/test-listener/resolvers/BuildResolver.js.map +1 -1
  268. package/tsOutputs/test-listener/resolvers/BuildSessionIdFileResolver.js +2 -0
  269. package/tsOutputs/test-listener/resolvers/BuildSessionIdFileResolver.js.map +1 -1
  270. package/tsOutputs/test-listener/resolvers/BuildSessionIdResolver.js +2 -0
  271. package/tsOutputs/test-listener/resolvers/BuildSessionIdResolver.js.map +1 -1
  272. package/tsOutputs/test-listener/resolvers/ProxyResolver.js +2 -0
  273. package/tsOutputs/test-listener/resolvers/ProxyResolver.js.map +1 -1
  274. package/tsOutputs/test-listener/resolvers/TokenResolver.js +2 -0
  275. package/tsOutputs/test-listener/resolvers/TokenResolver.js.map +1 -1
  276. package/tsOutputs/test-listener/state-tracker-process/index.js +4 -2
  277. package/tsOutputs/test-listener/state-tracker-process/index.js.map +1 -1
  278. package/tsOutputs/test-listener/state-tracker-process/state-tracker-proxy.js +3 -1
  279. package/tsOutputs/test-listener/state-tracker-process/state-tracker-proxy.js.map +1 -1
  280. package/tsOutputs/test-listener/test-recommendation-handler.js +6 -6
  281. package/tsOutputs/test-listener/test-recommendation-handler.js.map +1 -1
  282. package/tsOutputs/test-listener/upload-report-handler.js +1 -1
  283. package/tsOutputs/test-listener/upload-report-handler.js.map +1 -1
  284. package/tsOutputs/test-listener/watchdog.js +2 -0
  285. package/tsOutputs/test-listener/watchdog.js.map +1 -1
@@ -22556,66 +22556,54 @@ module.exports.codes = codes;
22556
22556
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22557
22557
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22558
22558
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
22559
+
22559
22560
  // a duplex stream is just a stream that is both readable and writable.
22560
22561
  // Since JS doesn't have multiple prototypal inheritance, this class
22561
22562
  // prototypally inherits from Readable, and then parasitically from
22562
22563
  // Writable.
22564
+
22563
22565
  'use strict';
22564
- /*<replacement>*/
22565
22566
 
22567
+ /*<replacement>*/
22566
22568
  var objectKeys = Object.keys || function (obj) {
22567
22569
  var keys = [];
22568
-
22569
- for (var key in obj) {
22570
- keys.push(key);
22571
- }
22572
-
22570
+ for (var key in obj) keys.push(key);
22573
22571
  return keys;
22574
22572
  };
22575
22573
  /*</replacement>*/
22576
22574
 
22577
-
22578
22575
  module.exports = Duplex;
22579
-
22580
- var Readable = require('./_stream_readable');
22581
-
22582
- var Writable = require('./_stream_writable');
22583
-
22576
+ const Readable = require('./_stream_readable');
22577
+ const Writable = require('./_stream_writable');
22584
22578
  require('inherits')(Duplex, Readable);
22585
-
22586
22579
  {
22587
22580
  // Allow the keys array to be GC'ed.
22588
- var keys = objectKeys(Writable.prototype);
22589
-
22581
+ const keys = objectKeys(Writable.prototype);
22590
22582
  for (var v = 0; v < keys.length; v++) {
22591
- var method = keys[v];
22583
+ const method = keys[v];
22592
22584
  if (!Duplex.prototype[method]) Duplex.prototype[method] = Writable.prototype[method];
22593
22585
  }
22594
22586
  }
22595
-
22596
22587
  function Duplex(options) {
22597
22588
  if (!(this instanceof Duplex)) return new Duplex(options);
22598
22589
  Readable.call(this, options);
22599
22590
  Writable.call(this, options);
22600
22591
  this.allowHalfOpen = true;
22601
-
22602
22592
  if (options) {
22603
22593
  if (options.readable === false) this.readable = false;
22604
22594
  if (options.writable === false) this.writable = false;
22605
-
22606
22595
  if (options.allowHalfOpen === false) {
22607
22596
  this.allowHalfOpen = false;
22608
22597
  this.once('end', onend);
22609
22598
  }
22610
22599
  }
22611
22600
  }
22612
-
22613
22601
  Object.defineProperty(Duplex.prototype, 'writableHighWaterMark', {
22614
22602
  // making it explicit this property is not enumerable
22615
22603
  // because otherwise some prototype manipulation in
22616
22604
  // userland will fail
22617
22605
  enumerable: false,
22618
- get: function get() {
22606
+ get() {
22619
22607
  return this._writableState.highWaterMark;
22620
22608
  }
22621
22609
  });
@@ -22633,44 +22621,43 @@ Object.defineProperty(Duplex.prototype, 'writableLength', {
22633
22621
  // because otherwise some prototype manipulation in
22634
22622
  // userland will fail
22635
22623
  enumerable: false,
22636
- get: function get() {
22624
+ get() {
22637
22625
  return this._writableState.length;
22638
22626
  }
22639
- }); // the no-half-open enforcer
22627
+ });
22640
22628
 
22629
+ // the no-half-open enforcer
22641
22630
  function onend() {
22642
22631
  // If the writable side ended, then we're ok.
22643
- if (this._writableState.ended) return; // no more data can be written.
22644
- // But allow more writes to happen in this tick.
22632
+ if (this._writableState.ended) return;
22645
22633
 
22634
+ // no more data can be written.
22635
+ // But allow more writes to happen in this tick.
22646
22636
  process.nextTick(onEndNT, this);
22647
22637
  }
22648
-
22649
22638
  function onEndNT(self) {
22650
22639
  self.end();
22651
22640
  }
22652
-
22653
22641
  Object.defineProperty(Duplex.prototype, 'destroyed', {
22654
22642
  // making it explicit this property is not enumerable
22655
22643
  // because otherwise some prototype manipulation in
22656
22644
  // userland will fail
22657
22645
  enumerable: false,
22658
- get: function get() {
22646
+ get() {
22659
22647
  if (this._readableState === undefined || this._writableState === undefined) {
22660
22648
  return false;
22661
22649
  }
22662
-
22663
22650
  return this._readableState.destroyed && this._writableState.destroyed;
22664
22651
  },
22665
- set: function set(value) {
22652
+ set(value) {
22666
22653
  // we ignore the value if the stream
22667
22654
  // has not been initialized yet
22668
22655
  if (this._readableState === undefined || this._writableState === undefined) {
22669
22656
  return;
22670
- } // backward compatibility, the user is explicitly
22671
- // managing destroyed
22672
-
22657
+ }
22673
22658
 
22659
+ // backward compatibility, the user is explicitly
22660
+ // managing destroyed
22674
22661
  this._readableState.destroyed = value;
22675
22662
  this._writableState.destroyed = value;
22676
22663
  }
@@ -22697,22 +22684,20 @@ Object.defineProperty(Duplex.prototype, 'destroyed', {
22697
22684
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22698
22685
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22699
22686
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
22687
+
22700
22688
  // a passthrough stream.
22701
22689
  // basically just the most minimal sort of Transform stream.
22702
22690
  // Every written chunk gets output as-is.
22691
+
22703
22692
  'use strict';
22704
22693
 
22705
22694
  module.exports = PassThrough;
22706
-
22707
- var Transform = require('./_stream_transform');
22708
-
22695
+ const Transform = require('./_stream_transform');
22709
22696
  require('inherits')(PassThrough, Transform);
22710
-
22711
22697
  function PassThrough(options) {
22712
22698
  if (!(this instanceof PassThrough)) return new PassThrough(options);
22713
22699
  Transform.call(this, options);
22714
22700
  }
22715
-
22716
22701
  PassThrough.prototype._transform = function (chunk, encoding, cb) {
22717
22702
  cb(null, chunk);
22718
22703
  };
@@ -22738,49 +22723,40 @@ PassThrough.prototype._transform = function (chunk, encoding, cb) {
22738
22723
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
22739
22724
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
22740
22725
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
22726
+
22741
22727
  'use strict';
22742
22728
 
22743
22729
  module.exports = Readable;
22744
- /*<replacement>*/
22745
22730
 
22731
+ /*<replacement>*/
22746
22732
  var Duplex;
22747
22733
  /*</replacement>*/
22748
22734
 
22749
22735
  Readable.ReadableState = ReadableState;
22750
- /*<replacement>*/
22751
-
22752
- var EE = require('events').EventEmitter;
22753
22736
 
22737
+ /*<replacement>*/
22738
+ const EE = require('events').EventEmitter;
22754
22739
  var EElistenerCount = function EElistenerCount(emitter, type) {
22755
22740
  return emitter.listeners(type).length;
22756
22741
  };
22757
22742
  /*</replacement>*/
22758
22743
 
22759
22744
  /*<replacement>*/
22760
-
22761
-
22762
22745
  var Stream = require('./internal/streams/stream');
22763
22746
  /*</replacement>*/
22764
22747
 
22765
-
22766
- var Buffer = require('buffer').Buffer;
22767
-
22768
- var OurUint8Array = global.Uint8Array || function () {};
22769
-
22748
+ const Buffer = require('buffer').Buffer;
22749
+ const OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
22770
22750
  function _uint8ArrayToBuffer(chunk) {
22771
22751
  return Buffer.from(chunk);
22772
22752
  }
22773
-
22774
22753
  function _isUint8Array(obj) {
22775
22754
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
22776
22755
  }
22777
- /*<replacement>*/
22778
-
22779
-
22780
- var debugUtil = require('util');
22781
-
22782
- var debug;
22783
22756
 
22757
+ /*<replacement>*/
22758
+ const debugUtil = require('util');
22759
+ let debug;
22784
22760
  if (debugUtil && debugUtil.debuglog) {
22785
22761
  debug = debugUtil.debuglog('stream');
22786
22762
  } else {
@@ -22788,60 +22764,57 @@ if (debugUtil && debugUtil.debuglog) {
22788
22764
  }
22789
22765
  /*</replacement>*/
22790
22766
 
22791
-
22792
- var BufferList = require('./internal/streams/buffer_list');
22793
-
22794
- var destroyImpl = require('./internal/streams/destroy');
22795
-
22796
- var _require = require('./internal/streams/state'),
22797
- getHighWaterMark = _require.getHighWaterMark;
22798
-
22799
- var _require$codes = require('../errors').codes,
22800
- ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
22801
- ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
22802
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
22803
- ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT; // Lazy loaded to improve the startup performance.
22804
-
22805
-
22806
- var StringDecoder;
22807
- var createReadableStreamAsyncIterator;
22808
- var from;
22809
-
22767
+ const BufferList = require('./internal/streams/buffer_list');
22768
+ const destroyImpl = require('./internal/streams/destroy');
22769
+ const _require = require('./internal/streams/state'),
22770
+ getHighWaterMark = _require.getHighWaterMark;
22771
+ const _require$codes = require('../errors').codes,
22772
+ ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
22773
+ ERR_STREAM_PUSH_AFTER_EOF = _require$codes.ERR_STREAM_PUSH_AFTER_EOF,
22774
+ ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
22775
+ ERR_STREAM_UNSHIFT_AFTER_END_EVENT = _require$codes.ERR_STREAM_UNSHIFT_AFTER_END_EVENT;
22776
+
22777
+ // Lazy loaded to improve the startup performance.
22778
+ let StringDecoder;
22779
+ let createReadableStreamAsyncIterator;
22780
+ let from;
22810
22781
  require('inherits')(Readable, Stream);
22811
-
22812
- var errorOrDestroy = destroyImpl.errorOrDestroy;
22813
- var kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
22814
-
22782
+ const errorOrDestroy = destroyImpl.errorOrDestroy;
22783
+ const kProxyEvents = ['error', 'close', 'destroy', 'pause', 'resume'];
22815
22784
  function prependListener(emitter, event, fn) {
22816
22785
  // Sadly this is not cacheable as some libraries bundle their own
22817
22786
  // event emitter implementation with them.
22818
- if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn); // This is a hack to make sure that our error handler is attached before any
22787
+ if (typeof emitter.prependListener === 'function') return emitter.prependListener(event, fn);
22788
+
22789
+ // This is a hack to make sure that our error handler is attached before any
22819
22790
  // userland ones. NEVER DO THIS. This is here only because this code needs
22820
22791
  // to continue to work with older versions of Node.js that do not include
22821
22792
  // the prependListener() method. The goal is to eventually remove this hack.
22822
-
22823
22793
  if (!emitter._events || !emitter._events[event]) emitter.on(event, fn);else if (Array.isArray(emitter._events[event])) emitter._events[event].unshift(fn);else emitter._events[event] = [fn, emitter._events[event]];
22824
22794
  }
22825
-
22826
22795
  function ReadableState(options, stream, isDuplex) {
22827
22796
  Duplex = Duplex || require('./_stream_duplex');
22828
- options = options || {}; // Duplex streams are both readable and writable, but share
22797
+ options = options || {};
22798
+
22799
+ // Duplex streams are both readable and writable, but share
22829
22800
  // the same options object.
22830
22801
  // However, some cases require setting options to different
22831
22802
  // values for the readable and the writable sides of the duplex stream.
22832
22803
  // These options can be provided separately as readableXXX and writableXXX.
22804
+ if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
22833
22805
 
22834
- if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag. Used to make read(n) ignore n and to
22806
+ // object stream flag. Used to make read(n) ignore n and to
22835
22807
  // make all the buffer merging and length checks go away
22836
-
22837
22808
  this.objectMode = !!options.objectMode;
22838
- if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode; // the point at which it stops calling _read() to fill the buffer
22809
+ if (isDuplex) this.objectMode = this.objectMode || !!options.readableObjectMode;
22810
+
22811
+ // the point at which it stops calling _read() to fill the buffer
22839
22812
  // Note: 0 is a valid value, means "don't call _read preemptively ever"
22813
+ this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex);
22840
22814
 
22841
- this.highWaterMark = getHighWaterMark(this, options, 'readableHighWaterMark', isDuplex); // A linked list is used to store data chunks instead of an array because the
22815
+ // A linked list is used to store data chunks instead of an array because the
22842
22816
  // linked list can remove elements from the beginning faster than
22843
22817
  // array.shift()
22844
-
22845
22818
  this.buffer = new BufferList();
22846
22819
  this.length = 0;
22847
22820
  this.pipes = null;
@@ -22849,141 +22822,136 @@ function ReadableState(options, stream, isDuplex) {
22849
22822
  this.flowing = null;
22850
22823
  this.ended = false;
22851
22824
  this.endEmitted = false;
22852
- this.reading = false; // a flag to be able to tell if the event 'readable'/'data' is emitted
22825
+ this.reading = false;
22826
+
22827
+ // a flag to be able to tell if the event 'readable'/'data' is emitted
22853
22828
  // immediately, or on a later tick. We set this to true at first, because
22854
22829
  // any actions that shouldn't happen until "later" should generally also
22855
22830
  // not happen before the first read call.
22831
+ this.sync = true;
22856
22832
 
22857
- this.sync = true; // whenever we return null, then we set a flag to say
22833
+ // whenever we return null, then we set a flag to say
22858
22834
  // that we're awaiting a 'readable' event emission.
22859
-
22860
22835
  this.needReadable = false;
22861
22836
  this.emittedReadable = false;
22862
22837
  this.readableListening = false;
22863
22838
  this.resumeScheduled = false;
22864
- this.paused = true; // Should close be emitted on destroy. Defaults to true.
22839
+ this.paused = true;
22840
+
22841
+ // Should close be emitted on destroy. Defaults to true.
22842
+ this.emitClose = options.emitClose !== false;
22865
22843
 
22866
- this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'end' (and potentially 'finish')
22844
+ // Should .destroy() be called after 'end' (and potentially 'finish')
22845
+ this.autoDestroy = !!options.autoDestroy;
22867
22846
 
22868
- this.autoDestroy = !!options.autoDestroy; // has it been destroyed
22847
+ // has it been destroyed
22848
+ this.destroyed = false;
22869
22849
 
22870
- this.destroyed = false; // Crypto is kind of old and crusty. Historically, its default string
22850
+ // Crypto is kind of old and crusty. Historically, its default string
22871
22851
  // encoding is 'binary' so we have to make this configurable.
22872
22852
  // Everything else in the universe uses 'utf8', though.
22853
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
22873
22854
 
22874
- this.defaultEncoding = options.defaultEncoding || 'utf8'; // the number of writers that are awaiting a drain event in .pipe()s
22875
-
22876
- this.awaitDrain = 0; // if true, a maybeReadMore has been scheduled
22855
+ // the number of writers that are awaiting a drain event in .pipe()s
22856
+ this.awaitDrain = 0;
22877
22857
 
22858
+ // if true, a maybeReadMore has been scheduled
22878
22859
  this.readingMore = false;
22879
22860
  this.decoder = null;
22880
22861
  this.encoding = null;
22881
-
22882
22862
  if (options.encoding) {
22883
22863
  if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
22884
22864
  this.decoder = new StringDecoder(options.encoding);
22885
22865
  this.encoding = options.encoding;
22886
22866
  }
22887
22867
  }
22888
-
22889
22868
  function Readable(options) {
22890
22869
  Duplex = Duplex || require('./_stream_duplex');
22891
- if (!(this instanceof Readable)) return new Readable(options); // Checking for a Stream.Duplex instance is faster here instead of inside
22892
- // the ReadableState constructor, at least with V8 6.5
22870
+ if (!(this instanceof Readable)) return new Readable(options);
22893
22871
 
22894
- var isDuplex = this instanceof Duplex;
22895
- this._readableState = new ReadableState(options, this, isDuplex); // legacy
22872
+ // Checking for a Stream.Duplex instance is faster here instead of inside
22873
+ // the ReadableState constructor, at least with V8 6.5
22874
+ const isDuplex = this instanceof Duplex;
22875
+ this._readableState = new ReadableState(options, this, isDuplex);
22896
22876
 
22877
+ // legacy
22897
22878
  this.readable = true;
22898
-
22899
22879
  if (options) {
22900
22880
  if (typeof options.read === 'function') this._read = options.read;
22901
22881
  if (typeof options.destroy === 'function') this._destroy = options.destroy;
22902
22882
  }
22903
-
22904
22883
  Stream.call(this);
22905
22884
  }
22906
-
22907
22885
  Object.defineProperty(Readable.prototype, 'destroyed', {
22908
22886
  // making it explicit this property is not enumerable
22909
22887
  // because otherwise some prototype manipulation in
22910
22888
  // userland will fail
22911
22889
  enumerable: false,
22912
- get: function get() {
22890
+ get() {
22913
22891
  if (this._readableState === undefined) {
22914
22892
  return false;
22915
22893
  }
22916
-
22917
22894
  return this._readableState.destroyed;
22918
22895
  },
22919
- set: function set(value) {
22896
+ set(value) {
22920
22897
  // we ignore the value if the stream
22921
22898
  // has not been initialized yet
22922
22899
  if (!this._readableState) {
22923
22900
  return;
22924
- } // backward compatibility, the user is explicitly
22925
- // managing destroyed
22926
-
22901
+ }
22927
22902
 
22903
+ // backward compatibility, the user is explicitly
22904
+ // managing destroyed
22928
22905
  this._readableState.destroyed = value;
22929
22906
  }
22930
22907
  });
22931
22908
  Readable.prototype.destroy = destroyImpl.destroy;
22932
22909
  Readable.prototype._undestroy = destroyImpl.undestroy;
22933
-
22934
22910
  Readable.prototype._destroy = function (err, cb) {
22935
22911
  cb(err);
22936
- }; // Manually shove something into the read() buffer.
22912
+ };
22913
+
22914
+ // Manually shove something into the read() buffer.
22937
22915
  // This returns true if the highWaterMark has not been hit yet,
22938
22916
  // similar to how Writable.write() returns true if you should
22939
22917
  // write() some more.
22940
-
22941
-
22942
22918
  Readable.prototype.push = function (chunk, encoding) {
22943
22919
  var state = this._readableState;
22944
22920
  var skipChunkCheck;
22945
-
22946
22921
  if (!state.objectMode) {
22947
22922
  if (typeof chunk === 'string') {
22948
22923
  encoding = encoding || state.defaultEncoding;
22949
-
22950
22924
  if (encoding !== state.encoding) {
22951
22925
  chunk = Buffer.from(chunk, encoding);
22952
22926
  encoding = '';
22953
22927
  }
22954
-
22955
22928
  skipChunkCheck = true;
22956
22929
  }
22957
22930
  } else {
22958
22931
  skipChunkCheck = true;
22959
22932
  }
22960
-
22961
22933
  return readableAddChunk(this, chunk, encoding, false, skipChunkCheck);
22962
- }; // Unshift should *always* be something directly out of read()
22963
-
22934
+ };
22964
22935
 
22936
+ // Unshift should *always* be something directly out of read()
22965
22937
  Readable.prototype.unshift = function (chunk) {
22966
22938
  return readableAddChunk(this, chunk, null, true, false);
22967
22939
  };
22968
-
22969
22940
  function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
22970
22941
  debug('readableAddChunk', chunk);
22971
22942
  var state = stream._readableState;
22972
-
22973
22943
  if (chunk === null) {
22974
22944
  state.reading = false;
22975
22945
  onEofChunk(stream, state);
22976
22946
  } else {
22977
22947
  var er;
22978
22948
  if (!skipChunkCheck) er = chunkInvalid(state, chunk);
22979
-
22980
22949
  if (er) {
22981
22950
  errorOrDestroy(stream, er);
22982
22951
  } else if (state.objectMode || chunk && chunk.length > 0) {
22983
22952
  if (typeof chunk !== 'string' && !state.objectMode && Object.getPrototypeOf(chunk) !== Buffer.prototype) {
22984
22953
  chunk = _uint8ArrayToBuffer(chunk);
22985
22954
  }
22986
-
22987
22955
  if (addToFront) {
22988
22956
  if (state.endEmitted) errorOrDestroy(stream, new ERR_STREAM_UNSHIFT_AFTER_END_EVENT());else addChunk(stream, state, chunk, true);
22989
22957
  } else if (state.ended) {
@@ -22992,7 +22960,6 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
22992
22960
  return false;
22993
22961
  } else {
22994
22962
  state.reading = false;
22995
-
22996
22963
  if (state.decoder && !encoding) {
22997
22964
  chunk = state.decoder.write(chunk);
22998
22965
  if (state.objectMode || chunk.length !== 0) addChunk(stream, state, chunk, false);else maybeReadMore(stream, state);
@@ -23004,14 +22971,13 @@ function readableAddChunk(stream, chunk, encoding, addToFront, skipChunkCheck) {
23004
22971
  state.reading = false;
23005
22972
  maybeReadMore(stream, state);
23006
22973
  }
23007
- } // We can push more data if we are below the highWaterMark.
22974
+ }
22975
+
22976
+ // We can push more data if we are below the highWaterMark.
23008
22977
  // Also, if we have no data yet, we can stand some more bytes.
23009
22978
  // This is to work around cases where hwm=0, such as the repl.
23010
-
23011
-
23012
22979
  return !state.ended && (state.length < state.highWaterMark || state.length === 0);
23013
22980
  }
23014
-
23015
22981
  function addChunk(stream, state, chunk, addToFront) {
23016
22982
  if (state.flowing && state.length === 0 && !state.sync) {
23017
22983
  state.awaitDrain = 0;
@@ -23022,50 +22988,42 @@ function addChunk(stream, state, chunk, addToFront) {
23022
22988
  if (addToFront) state.buffer.unshift(chunk);else state.buffer.push(chunk);
23023
22989
  if (state.needReadable) emitReadable(stream);
23024
22990
  }
23025
-
23026
22991
  maybeReadMore(stream, state);
23027
22992
  }
23028
-
23029
22993
  function chunkInvalid(state, chunk) {
23030
22994
  var er;
23031
-
23032
22995
  if (!_isUint8Array(chunk) && typeof chunk !== 'string' && chunk !== undefined && !state.objectMode) {
23033
22996
  er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer', 'Uint8Array'], chunk);
23034
22997
  }
23035
-
23036
22998
  return er;
23037
22999
  }
23038
-
23039
23000
  Readable.prototype.isPaused = function () {
23040
23001
  return this._readableState.flowing === false;
23041
- }; // backwards compatibility.
23042
-
23002
+ };
23043
23003
 
23004
+ // backwards compatibility.
23044
23005
  Readable.prototype.setEncoding = function (enc) {
23045
23006
  if (!StringDecoder) StringDecoder = require('string_decoder/').StringDecoder;
23046
- var decoder = new StringDecoder(enc);
23047
- this._readableState.decoder = decoder; // If setEncoding(null), decoder.encoding equals utf8
23048
-
23049
- this._readableState.encoding = this._readableState.decoder.encoding; // Iterate over current buffer to convert already stored Buffers:
23050
-
23051
- var p = this._readableState.buffer.head;
23052
- var content = '';
23053
-
23007
+ const decoder = new StringDecoder(enc);
23008
+ this._readableState.decoder = decoder;
23009
+ // If setEncoding(null), decoder.encoding equals utf8
23010
+ this._readableState.encoding = this._readableState.decoder.encoding;
23011
+
23012
+ // Iterate over current buffer to convert already stored Buffers:
23013
+ let p = this._readableState.buffer.head;
23014
+ let content = '';
23054
23015
  while (p !== null) {
23055
23016
  content += decoder.write(p.data);
23056
23017
  p = p.next;
23057
23018
  }
23058
-
23059
23019
  this._readableState.buffer.clear();
23060
-
23061
23020
  if (content !== '') this._readableState.buffer.push(content);
23062
23021
  this._readableState.length = content.length;
23063
23022
  return this;
23064
- }; // Don't raise the hwm > 1GB
23065
-
23066
-
23067
- var MAX_HWM = 0x40000000;
23023
+ };
23068
23024
 
23025
+ // Don't raise the hwm > 1GB
23026
+ const MAX_HWM = 0x40000000;
23069
23027
  function computeNewHighWaterMark(n) {
23070
23028
  if (n >= MAX_HWM) {
23071
23029
  // TODO(ronag): Throw ERR_VALUE_OUT_OF_RANGE.
@@ -23081,55 +23039,54 @@ function computeNewHighWaterMark(n) {
23081
23039
  n |= n >>> 16;
23082
23040
  n++;
23083
23041
  }
23084
-
23085
23042
  return n;
23086
- } // This function is designed to be inlinable, so please take care when making
23087
- // changes to the function body.
23088
-
23043
+ }
23089
23044
 
23045
+ // This function is designed to be inlinable, so please take care when making
23046
+ // changes to the function body.
23090
23047
  function howMuchToRead(n, state) {
23091
23048
  if (n <= 0 || state.length === 0 && state.ended) return 0;
23092
23049
  if (state.objectMode) return 1;
23093
-
23094
23050
  if (n !== n) {
23095
23051
  // Only flow one buffer at a time
23096
23052
  if (state.flowing && state.length) return state.buffer.head.data.length;else return state.length;
23097
- } // If we're asking for more than the current hwm, then raise the hwm.
23098
-
23099
-
23053
+ }
23054
+ // If we're asking for more than the current hwm, then raise the hwm.
23100
23055
  if (n > state.highWaterMark) state.highWaterMark = computeNewHighWaterMark(n);
23101
- if (n <= state.length) return n; // Don't have enough
23102
-
23056
+ if (n <= state.length) return n;
23057
+ // Don't have enough
23103
23058
  if (!state.ended) {
23104
23059
  state.needReadable = true;
23105
23060
  return 0;
23106
23061
  }
23107
-
23108
23062
  return state.length;
23109
- } // you can override either this method, or the async _read(n) below.
23110
-
23063
+ }
23111
23064
 
23065
+ // you can override either this method, or the async _read(n) below.
23112
23066
  Readable.prototype.read = function (n) {
23113
23067
  debug('read', n);
23114
23068
  n = parseInt(n, 10);
23115
23069
  var state = this._readableState;
23116
23070
  var nOrig = n;
23117
- if (n !== 0) state.emittedReadable = false; // if we're doing read(0) to trigger a readable event, but we
23071
+ if (n !== 0) state.emittedReadable = false;
23072
+
23073
+ // if we're doing read(0) to trigger a readable event, but we
23118
23074
  // already have a bunch of data in the buffer, then just trigger
23119
23075
  // the 'readable' event and move on.
23120
-
23121
23076
  if (n === 0 && state.needReadable && ((state.highWaterMark !== 0 ? state.length >= state.highWaterMark : state.length > 0) || state.ended)) {
23122
23077
  debug('read: emitReadable', state.length, state.ended);
23123
23078
  if (state.length === 0 && state.ended) endReadable(this);else emitReadable(this);
23124
23079
  return null;
23125
23080
  }
23081
+ n = howMuchToRead(n, state);
23126
23082
 
23127
- n = howMuchToRead(n, state); // if we've ended, and we're now clear, then finish it up.
23128
-
23083
+ // if we've ended, and we're now clear, then finish it up.
23129
23084
  if (n === 0 && state.ended) {
23130
23085
  if (state.length === 0) endReadable(this);
23131
23086
  return null;
23132
- } // All the actual chunk generation logic needs to be
23087
+ }
23088
+
23089
+ // All the actual chunk generation logic needs to be
23133
23090
  // *below* the call to _read. The reason is that in certain
23134
23091
  // synthetic stream cases, such as passthrough streams, _read
23135
23092
  // may be a completely synchronous operation which may change
@@ -23150,40 +23107,37 @@ Readable.prototype.read = function (n) {
23150
23107
  // 'readable' etc.
23151
23108
  //
23152
23109
  // 3. Actually pull the requested chunks out of the buffer and return.
23153
- // if we need a readable event, then we need to do some reading.
23154
-
23155
23110
 
23111
+ // if we need a readable event, then we need to do some reading.
23156
23112
  var doRead = state.needReadable;
23157
- debug('need readable', doRead); // if we currently have less than the highWaterMark, then also read some
23113
+ debug('need readable', doRead);
23158
23114
 
23115
+ // if we currently have less than the highWaterMark, then also read some
23159
23116
  if (state.length === 0 || state.length - n < state.highWaterMark) {
23160
23117
  doRead = true;
23161
23118
  debug('length less than watermark', doRead);
23162
- } // however, if we've ended, then there's no point, and if we're already
23163
- // reading, then it's unnecessary.
23164
-
23119
+ }
23165
23120
 
23121
+ // however, if we've ended, then there's no point, and if we're already
23122
+ // reading, then it's unnecessary.
23166
23123
  if (state.ended || state.reading) {
23167
23124
  doRead = false;
23168
23125
  debug('reading or ended', doRead);
23169
23126
  } else if (doRead) {
23170
23127
  debug('do read');
23171
23128
  state.reading = true;
23172
- state.sync = true; // if the length is currently zero, then we *need* a readable event.
23173
-
23174
- if (state.length === 0) state.needReadable = true; // call internal read method
23175
-
23129
+ state.sync = true;
23130
+ // if the length is currently zero, then we *need* a readable event.
23131
+ if (state.length === 0) state.needReadable = true;
23132
+ // call internal read method
23176
23133
  this._read(state.highWaterMark);
23177
-
23178
- state.sync = false; // If _read pushed data synchronously, then `reading` will be false,
23134
+ state.sync = false;
23135
+ // If _read pushed data synchronously, then `reading` will be false,
23179
23136
  // and we need to re-evaluate how much data we can return to the user.
23180
-
23181
23137
  if (!state.reading) n = howMuchToRead(nOrig, state);
23182
23138
  }
23183
-
23184
23139
  var ret;
23185
23140
  if (n > 0) ret = fromList(n, state);else ret = null;
23186
-
23187
23141
  if (ret === null) {
23188
23142
  state.needReadable = state.length <= state.highWaterMark;
23189
23143
  n = 0;
@@ -23191,34 +23145,28 @@ Readable.prototype.read = function (n) {
23191
23145
  state.length -= n;
23192
23146
  state.awaitDrain = 0;
23193
23147
  }
23194
-
23195
23148
  if (state.length === 0) {
23196
23149
  // If we have nothing in the buffer, then we want to know
23197
23150
  // as soon as we *do* get something into the buffer.
23198
- if (!state.ended) state.needReadable = true; // If we tried to read() past the EOF, then emit end on the next tick.
23151
+ if (!state.ended) state.needReadable = true;
23199
23152
 
23153
+ // If we tried to read() past the EOF, then emit end on the next tick.
23200
23154
  if (nOrig !== n && state.ended) endReadable(this);
23201
23155
  }
23202
-
23203
23156
  if (ret !== null) this.emit('data', ret);
23204
23157
  return ret;
23205
23158
  };
23206
-
23207
23159
  function onEofChunk(stream, state) {
23208
23160
  debug('onEofChunk');
23209
23161
  if (state.ended) return;
23210
-
23211
23162
  if (state.decoder) {
23212
23163
  var chunk = state.decoder.end();
23213
-
23214
23164
  if (chunk && chunk.length) {
23215
23165
  state.buffer.push(chunk);
23216
23166
  state.length += state.objectMode ? 1 : chunk.length;
23217
23167
  }
23218
23168
  }
23219
-
23220
23169
  state.ended = true;
23221
-
23222
23170
  if (state.sync) {
23223
23171
  // if we are sync, wait until next tick to emit the data.
23224
23172
  // Otherwise we risk emitting data in the flow()
@@ -23227,61 +23175,56 @@ function onEofChunk(stream, state) {
23227
23175
  } else {
23228
23176
  // emit 'readable' now to make sure it gets picked up.
23229
23177
  state.needReadable = false;
23230
-
23231
23178
  if (!state.emittedReadable) {
23232
23179
  state.emittedReadable = true;
23233
23180
  emitReadable_(stream);
23234
23181
  }
23235
23182
  }
23236
- } // Don't emit readable right away in sync mode, because this can trigger
23183
+ }
23184
+
23185
+ // Don't emit readable right away in sync mode, because this can trigger
23237
23186
  // another read() call => stack overflow. This way, it might trigger
23238
23187
  // a nextTick recursion warning, but that's not so bad.
23239
-
23240
-
23241
23188
  function emitReadable(stream) {
23242
23189
  var state = stream._readableState;
23243
23190
  debug('emitReadable', state.needReadable, state.emittedReadable);
23244
23191
  state.needReadable = false;
23245
-
23246
23192
  if (!state.emittedReadable) {
23247
23193
  debug('emitReadable', state.flowing);
23248
23194
  state.emittedReadable = true;
23249
23195
  process.nextTick(emitReadable_, stream);
23250
23196
  }
23251
23197
  }
23252
-
23253
23198
  function emitReadable_(stream) {
23254
23199
  var state = stream._readableState;
23255
23200
  debug('emitReadable_', state.destroyed, state.length, state.ended);
23256
-
23257
23201
  if (!state.destroyed && (state.length || state.ended)) {
23258
23202
  stream.emit('readable');
23259
23203
  state.emittedReadable = false;
23260
- } // The stream needs another readable event if
23204
+ }
23205
+
23206
+ // The stream needs another readable event if
23261
23207
  // 1. It is not flowing, as the flow mechanism will take
23262
23208
  // care of it.
23263
23209
  // 2. It is not ended.
23264
23210
  // 3. It is below the highWaterMark, so we can schedule
23265
23211
  // another readable later.
23266
-
23267
-
23268
23212
  state.needReadable = !state.flowing && !state.ended && state.length <= state.highWaterMark;
23269
23213
  flow(stream);
23270
- } // at this point, the user has presumably seen the 'readable' event,
23214
+ }
23215
+
23216
+ // at this point, the user has presumably seen the 'readable' event,
23271
23217
  // and called read() to consume some data. that may have triggered
23272
23218
  // in turn another _read(n) call, in which case reading = true if
23273
23219
  // it's in progress.
23274
23220
  // However, if we're not ended, or reading, and the length < hwm,
23275
23221
  // then go ahead and try to read some more preemptively.
23276
-
23277
-
23278
23222
  function maybeReadMore(stream, state) {
23279
23223
  if (!state.readingMore) {
23280
23224
  state.readingMore = true;
23281
23225
  process.nextTick(maybeReadMore_, stream, state);
23282
23226
  }
23283
23227
  }
23284
-
23285
23228
  function maybeReadMore_(stream, state) {
23286
23229
  // Attempt to read more data if we should.
23287
23230
  //
@@ -23307,52 +23250,45 @@ function maybeReadMore_(stream, state) {
23307
23250
  // read()s. The execution ends in this method again after the _read() ends
23308
23251
  // up calling push() with more data.
23309
23252
  while (!state.reading && !state.ended && (state.length < state.highWaterMark || state.flowing && state.length === 0)) {
23310
- var len = state.length;
23253
+ const len = state.length;
23311
23254
  debug('maybeReadMore read 0');
23312
23255
  stream.read(0);
23313
- if (len === state.length) // didn't get any data, stop spinning.
23256
+ if (len === state.length)
23257
+ // didn't get any data, stop spinning.
23314
23258
  break;
23315
23259
  }
23316
-
23317
23260
  state.readingMore = false;
23318
- } // abstract method. to be overridden in specific implementation classes.
23261
+ }
23262
+
23263
+ // abstract method. to be overridden in specific implementation classes.
23319
23264
  // call cb(er, data) where data is <= n in length.
23320
23265
  // for virtual (non-string, non-buffer) streams, "length" is somewhat
23321
23266
  // arbitrary, and perhaps not very meaningful.
23322
-
23323
-
23324
23267
  Readable.prototype._read = function (n) {
23325
23268
  errorOrDestroy(this, new ERR_METHOD_NOT_IMPLEMENTED('_read()'));
23326
23269
  };
23327
-
23328
23270
  Readable.prototype.pipe = function (dest, pipeOpts) {
23329
23271
  var src = this;
23330
23272
  var state = this._readableState;
23331
-
23332
23273
  switch (state.pipesCount) {
23333
23274
  case 0:
23334
23275
  state.pipes = dest;
23335
23276
  break;
23336
-
23337
23277
  case 1:
23338
23278
  state.pipes = [state.pipes, dest];
23339
23279
  break;
23340
-
23341
23280
  default:
23342
23281
  state.pipes.push(dest);
23343
23282
  break;
23344
23283
  }
23345
-
23346
23284
  state.pipesCount += 1;
23347
23285
  debug('pipe count=%d opts=%j', state.pipesCount, pipeOpts);
23348
23286
  var doEnd = (!pipeOpts || pipeOpts.end !== false) && dest !== process.stdout && dest !== process.stderr;
23349
23287
  var endFn = doEnd ? onend : unpipe;
23350
23288
  if (state.endEmitted) process.nextTick(endFn);else src.once('end', endFn);
23351
23289
  dest.on('unpipe', onunpipe);
23352
-
23353
23290
  function onunpipe(readable, unpipeInfo) {
23354
23291
  debug('onunpipe');
23355
-
23356
23292
  if (readable === src) {
23357
23293
  if (unpipeInfo && unpipeInfo.hasUnpiped === false) {
23358
23294
  unpipeInfo.hasUnpiped = true;
@@ -23360,23 +23296,21 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
23360
23296
  }
23361
23297
  }
23362
23298
  }
23363
-
23364
23299
  function onend() {
23365
23300
  debug('onend');
23366
23301
  dest.end();
23367
- } // when the dest drains, it reduces the awaitDrain counter
23302
+ }
23303
+
23304
+ // when the dest drains, it reduces the awaitDrain counter
23368
23305
  // on the source. This would be more elegant with a .once()
23369
23306
  // handler in flow(), but adding and removing repeatedly is
23370
23307
  // too slow.
23371
-
23372
-
23373
23308
  var ondrain = pipeOnDrain(src);
23374
23309
  dest.on('drain', ondrain);
23375
23310
  var cleanedUp = false;
23376
-
23377
23311
  function cleanup() {
23378
- debug('cleanup'); // cleanup event handlers once the pipe is broken
23379
-
23312
+ debug('cleanup');
23313
+ // cleanup event handlers once the pipe is broken
23380
23314
  dest.removeListener('close', onclose);
23381
23315
  dest.removeListener('finish', onfinish);
23382
23316
  dest.removeListener('drain', ondrain);
@@ -23385,22 +23319,20 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
23385
23319
  src.removeListener('end', onend);
23386
23320
  src.removeListener('end', unpipe);
23387
23321
  src.removeListener('data', ondata);
23388
- cleanedUp = true; // if the reader is waiting for a drain event from this
23322
+ cleanedUp = true;
23323
+
23324
+ // if the reader is waiting for a drain event from this
23389
23325
  // specific writer, then it would cause it to never start
23390
23326
  // flowing again.
23391
23327
  // So, if this is awaiting a drain, then we just call it now.
23392
23328
  // If we don't know, then assume that we are waiting for one.
23393
-
23394
23329
  if (state.awaitDrain && (!dest._writableState || dest._writableState.needDrain)) ondrain();
23395
23330
  }
23396
-
23397
23331
  src.on('data', ondata);
23398
-
23399
23332
  function ondata(chunk) {
23400
23333
  debug('ondata');
23401
23334
  var ret = dest.write(chunk);
23402
23335
  debug('dest.write', ret);
23403
-
23404
23336
  if (ret === false) {
23405
23337
  // If the user unpiped during `dest.write()`, it is possible
23406
23338
  // to get stuck in a permanently paused state if that write
@@ -23410,87 +23342,84 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
23410
23342
  debug('false write response, pause', state.awaitDrain);
23411
23343
  state.awaitDrain++;
23412
23344
  }
23413
-
23414
23345
  src.pause();
23415
23346
  }
23416
- } // if the dest has an error, then stop piping into it.
23417
- // however, don't suppress the throwing behavior for this.
23418
-
23347
+ }
23419
23348
 
23349
+ // if the dest has an error, then stop piping into it.
23350
+ // however, don't suppress the throwing behavior for this.
23420
23351
  function onerror(er) {
23421
23352
  debug('onerror', er);
23422
23353
  unpipe();
23423
23354
  dest.removeListener('error', onerror);
23424
23355
  if (EElistenerCount(dest, 'error') === 0) errorOrDestroy(dest, er);
23425
- } // Make sure our error handler is attached before userland ones.
23426
-
23356
+ }
23427
23357
 
23428
- prependListener(dest, 'error', onerror); // Both close and finish should trigger unpipe, but only once.
23358
+ // Make sure our error handler is attached before userland ones.
23359
+ prependListener(dest, 'error', onerror);
23429
23360
 
23361
+ // Both close and finish should trigger unpipe, but only once.
23430
23362
  function onclose() {
23431
23363
  dest.removeListener('finish', onfinish);
23432
23364
  unpipe();
23433
23365
  }
23434
-
23435
23366
  dest.once('close', onclose);
23436
-
23437
23367
  function onfinish() {
23438
23368
  debug('onfinish');
23439
23369
  dest.removeListener('close', onclose);
23440
23370
  unpipe();
23441
23371
  }
23442
-
23443
23372
  dest.once('finish', onfinish);
23444
-
23445
23373
  function unpipe() {
23446
23374
  debug('unpipe');
23447
23375
  src.unpipe(dest);
23448
- } // tell the dest that it's being piped to
23449
-
23376
+ }
23450
23377
 
23451
- dest.emit('pipe', src); // start the flow if it hasn't been started already.
23378
+ // tell the dest that it's being piped to
23379
+ dest.emit('pipe', src);
23452
23380
 
23381
+ // start the flow if it hasn't been started already.
23453
23382
  if (!state.flowing) {
23454
23383
  debug('pipe resume');
23455
23384
  src.resume();
23456
23385
  }
23457
-
23458
23386
  return dest;
23459
23387
  };
23460
-
23461
23388
  function pipeOnDrain(src) {
23462
23389
  return function pipeOnDrainFunctionResult() {
23463
23390
  var state = src._readableState;
23464
23391
  debug('pipeOnDrain', state.awaitDrain);
23465
23392
  if (state.awaitDrain) state.awaitDrain--;
23466
-
23467
23393
  if (state.awaitDrain === 0 && EElistenerCount(src, 'data')) {
23468
23394
  state.flowing = true;
23469
23395
  flow(src);
23470
23396
  }
23471
23397
  };
23472
23398
  }
23473
-
23474
23399
  Readable.prototype.unpipe = function (dest) {
23475
23400
  var state = this._readableState;
23476
23401
  var unpipeInfo = {
23477
23402
  hasUnpiped: false
23478
- }; // if we're not piping anywhere, then do nothing.
23403
+ };
23479
23404
 
23480
- if (state.pipesCount === 0) return this; // just one destination. most common case.
23405
+ // if we're not piping anywhere, then do nothing.
23406
+ if (state.pipesCount === 0) return this;
23481
23407
 
23408
+ // just one destination. most common case.
23482
23409
  if (state.pipesCount === 1) {
23483
23410
  // passed in one, but it's not the right one.
23484
23411
  if (dest && dest !== state.pipes) return this;
23485
- if (!dest) dest = state.pipes; // got a match.
23412
+ if (!dest) dest = state.pipes;
23486
23413
 
23414
+ // got a match.
23487
23415
  state.pipes = null;
23488
23416
  state.pipesCount = 0;
23489
23417
  state.flowing = false;
23490
23418
  if (dest) dest.emit('unpipe', this, unpipeInfo);
23491
23419
  return this;
23492
- } // slow case. multiple pipe destinations.
23420
+ }
23493
23421
 
23422
+ // slow case. multiple pipe destinations.
23494
23423
 
23495
23424
  if (!dest) {
23496
23425
  // remove all.
@@ -23499,17 +23428,13 @@ Readable.prototype.unpipe = function (dest) {
23499
23428
  state.pipes = null;
23500
23429
  state.pipesCount = 0;
23501
23430
  state.flowing = false;
23502
-
23503
- for (var i = 0; i < len; i++) {
23504
- dests[i].emit('unpipe', this, {
23505
- hasUnpiped: false
23506
- });
23507
- }
23508
-
23431
+ for (var i = 0; i < len; i++) dests[i].emit('unpipe', this, {
23432
+ hasUnpiped: false
23433
+ });
23509
23434
  return this;
23510
- } // try to find the right one.
23511
-
23435
+ }
23512
23436
 
23437
+ // try to find the right one.
23513
23438
  var index = indexOf(state.pipes, dest);
23514
23439
  if (index === -1) return this;
23515
23440
  state.pipes.splice(index, 1);
@@ -23517,19 +23442,19 @@ Readable.prototype.unpipe = function (dest) {
23517
23442
  if (state.pipesCount === 1) state.pipes = state.pipes[0];
23518
23443
  dest.emit('unpipe', this, unpipeInfo);
23519
23444
  return this;
23520
- }; // set up data events if they are asked for
23521
- // Ensure readable listeners eventually get something
23522
-
23445
+ };
23523
23446
 
23447
+ // set up data events if they are asked for
23448
+ // Ensure readable listeners eventually get something
23524
23449
  Readable.prototype.on = function (ev, fn) {
23525
- var res = Stream.prototype.on.call(this, ev, fn);
23526
- var state = this._readableState;
23527
-
23450
+ const res = Stream.prototype.on.call(this, ev, fn);
23451
+ const state = this._readableState;
23528
23452
  if (ev === 'data') {
23529
23453
  // update readableListening so that resume() may be a no-op
23530
23454
  // a few lines down. This is needed to support once('readable').
23531
- state.readableListening = this.listenerCount('readable') > 0; // Try start flowing on next tick if stream isn't explicitly paused
23455
+ state.readableListening = this.listenerCount('readable') > 0;
23532
23456
 
23457
+ // Try start flowing on next tick if stream isn't explicitly paused
23533
23458
  if (state.flowing !== false) this.resume();
23534
23459
  } else if (ev === 'readable') {
23535
23460
  if (!state.endEmitted && !state.readableListening) {
@@ -23537,7 +23462,6 @@ Readable.prototype.on = function (ev, fn) {
23537
23462
  state.flowing = false;
23538
23463
  state.emittedReadable = false;
23539
23464
  debug('on readable', state.length, state.reading);
23540
-
23541
23465
  if (state.length) {
23542
23466
  emitReadable(this);
23543
23467
  } else if (!state.reading) {
@@ -23545,15 +23469,11 @@ Readable.prototype.on = function (ev, fn) {
23545
23469
  }
23546
23470
  }
23547
23471
  }
23548
-
23549
23472
  return res;
23550
23473
  };
23551
-
23552
23474
  Readable.prototype.addListener = Readable.prototype.on;
23553
-
23554
23475
  Readable.prototype.removeListener = function (ev, fn) {
23555
- var res = Stream.prototype.removeListener.call(this, ev, fn);
23556
-
23476
+ const res = Stream.prototype.removeListener.call(this, ev, fn);
23557
23477
  if (ev === 'readable') {
23558
23478
  // We need to check if there is someone still listening to
23559
23479
  // readable and reset the state. However this needs to happen
@@ -23563,13 +23483,10 @@ Readable.prototype.removeListener = function (ev, fn) {
23563
23483
  // effect.
23564
23484
  process.nextTick(updateReadableListening, this);
23565
23485
  }
23566
-
23567
23486
  return res;
23568
23487
  };
23569
-
23570
23488
  Readable.prototype.removeAllListeners = function (ev) {
23571
- var res = Stream.prototype.removeAllListeners.apply(this, arguments);
23572
-
23489
+ const res = Stream.prototype.removeAllListeners.apply(this, arguments);
23573
23490
  if (ev === 'readable' || ev === undefined) {
23574
23491
  // We need to check if there is someone still listening to
23575
23492
  // readable and reset the state. However this needs to happen
@@ -23579,121 +23496,102 @@ Readable.prototype.removeAllListeners = function (ev) {
23579
23496
  // effect.
23580
23497
  process.nextTick(updateReadableListening, this);
23581
23498
  }
23582
-
23583
23499
  return res;
23584
23500
  };
23585
-
23586
23501
  function updateReadableListening(self) {
23587
- var state = self._readableState;
23502
+ const state = self._readableState;
23588
23503
  state.readableListening = self.listenerCount('readable') > 0;
23589
-
23590
23504
  if (state.resumeScheduled && !state.paused) {
23591
23505
  // flowing needs to be set to true now, otherwise
23592
23506
  // the upcoming resume will not flow.
23593
- state.flowing = true; // crude way to check if we should resume
23507
+ state.flowing = true;
23508
+
23509
+ // crude way to check if we should resume
23594
23510
  } else if (self.listenerCount('data') > 0) {
23595
23511
  self.resume();
23596
23512
  }
23597
23513
  }
23598
-
23599
23514
  function nReadingNextTick(self) {
23600
23515
  debug('readable nexttick read 0');
23601
23516
  self.read(0);
23602
- } // pause() and resume() are remnants of the legacy readable stream API
23603
- // If the user uses them, then switch into old mode.
23604
-
23517
+ }
23605
23518
 
23519
+ // pause() and resume() are remnants of the legacy readable stream API
23520
+ // If the user uses them, then switch into old mode.
23606
23521
  Readable.prototype.resume = function () {
23607
23522
  var state = this._readableState;
23608
-
23609
23523
  if (!state.flowing) {
23610
- debug('resume'); // we flow only if there is no one listening
23524
+ debug('resume');
23525
+ // we flow only if there is no one listening
23611
23526
  // for readable, but we still have to call
23612
23527
  // resume()
23613
-
23614
23528
  state.flowing = !state.readableListening;
23615
23529
  resume(this, state);
23616
23530
  }
23617
-
23618
23531
  state.paused = false;
23619
23532
  return this;
23620
23533
  };
23621
-
23622
23534
  function resume(stream, state) {
23623
23535
  if (!state.resumeScheduled) {
23624
23536
  state.resumeScheduled = true;
23625
23537
  process.nextTick(resume_, stream, state);
23626
23538
  }
23627
23539
  }
23628
-
23629
23540
  function resume_(stream, state) {
23630
23541
  debug('resume', state.reading);
23631
-
23632
23542
  if (!state.reading) {
23633
23543
  stream.read(0);
23634
23544
  }
23635
-
23636
23545
  state.resumeScheduled = false;
23637
23546
  stream.emit('resume');
23638
23547
  flow(stream);
23639
23548
  if (state.flowing && !state.reading) stream.read(0);
23640
23549
  }
23641
-
23642
23550
  Readable.prototype.pause = function () {
23643
23551
  debug('call pause flowing=%j', this._readableState.flowing);
23644
-
23645
23552
  if (this._readableState.flowing !== false) {
23646
23553
  debug('pause');
23647
23554
  this._readableState.flowing = false;
23648
23555
  this.emit('pause');
23649
23556
  }
23650
-
23651
23557
  this._readableState.paused = true;
23652
23558
  return this;
23653
23559
  };
23654
-
23655
23560
  function flow(stream) {
23656
- var state = stream._readableState;
23561
+ const state = stream._readableState;
23657
23562
  debug('flow', state.flowing);
23563
+ while (state.flowing && stream.read() !== null);
23564
+ }
23658
23565
 
23659
- while (state.flowing && stream.read() !== null) {
23660
- ;
23661
- }
23662
- } // wrap an old-style stream as the async data source.
23566
+ // wrap an old-style stream as the async data source.
23663
23567
  // This is *not* part of the readable stream interface.
23664
23568
  // It is an ugly unfortunate mess of history.
23665
-
23666
-
23667
23569
  Readable.prototype.wrap = function (stream) {
23668
- var _this = this;
23669
-
23670
23570
  var state = this._readableState;
23671
23571
  var paused = false;
23672
- stream.on('end', function () {
23572
+ stream.on('end', () => {
23673
23573
  debug('wrapped end');
23674
-
23675
23574
  if (state.decoder && !state.ended) {
23676
23575
  var chunk = state.decoder.end();
23677
- if (chunk && chunk.length) _this.push(chunk);
23576
+ if (chunk && chunk.length) this.push(chunk);
23678
23577
  }
23679
-
23680
- _this.push(null);
23578
+ this.push(null);
23681
23579
  });
23682
- stream.on('data', function (chunk) {
23580
+ stream.on('data', chunk => {
23683
23581
  debug('wrapped data');
23684
- if (state.decoder) chunk = state.decoder.write(chunk); // don't skip over falsy values in objectMode
23582
+ if (state.decoder) chunk = state.decoder.write(chunk);
23685
23583
 
23584
+ // don't skip over falsy values in objectMode
23686
23585
  if (state.objectMode && (chunk === null || chunk === undefined)) return;else if (!state.objectMode && (!chunk || !chunk.length)) return;
23687
-
23688
- var ret = _this.push(chunk);
23689
-
23586
+ var ret = this.push(chunk);
23690
23587
  if (!ret) {
23691
23588
  paused = true;
23692
23589
  stream.pause();
23693
23590
  }
23694
- }); // proxy all the other methods.
23695
- // important when wrapping filters and duplexes.
23591
+ });
23696
23592
 
23593
+ // proxy all the other methods.
23594
+ // important when wrapping filters and duplexes.
23697
23595
  for (var i in stream) {
23698
23596
  if (this[i] === undefined && typeof stream[i] === 'function') {
23699
23597
  this[i] = function methodWrap(method) {
@@ -23702,37 +23600,32 @@ Readable.prototype.wrap = function (stream) {
23702
23600
  };
23703
23601
  }(i);
23704
23602
  }
23705
- } // proxy certain important events.
23706
-
23603
+ }
23707
23604
 
23605
+ // proxy certain important events.
23708
23606
  for (var n = 0; n < kProxyEvents.length; n++) {
23709
23607
  stream.on(kProxyEvents[n], this.emit.bind(this, kProxyEvents[n]));
23710
- } // when we try to consume some more bytes, simply unpause the
23711
- // underlying stream.
23712
-
23608
+ }
23713
23609
 
23714
- this._read = function (n) {
23610
+ // when we try to consume some more bytes, simply unpause the
23611
+ // underlying stream.
23612
+ this._read = n => {
23715
23613
  debug('wrapped _read', n);
23716
-
23717
23614
  if (paused) {
23718
23615
  paused = false;
23719
23616
  stream.resume();
23720
23617
  }
23721
23618
  };
23722
-
23723
23619
  return this;
23724
23620
  };
23725
-
23726
23621
  if (typeof Symbol === 'function') {
23727
23622
  Readable.prototype[Symbol.asyncIterator] = function () {
23728
23623
  if (createReadableStreamAsyncIterator === undefined) {
23729
23624
  createReadableStreamAsyncIterator = require('./internal/streams/async_iterator');
23730
23625
  }
23731
-
23732
23626
  return createReadableStreamAsyncIterator(this);
23733
23627
  };
23734
23628
  }
23735
-
23736
23629
  Object.defineProperty(Readable.prototype, 'readableHighWaterMark', {
23737
23630
  // making it explicit this property is not enumerable
23738
23631
  // because otherwise some prototype manipulation in
@@ -23764,22 +23657,24 @@ Object.defineProperty(Readable.prototype, 'readableFlowing', {
23764
23657
  this._readableState.flowing = state;
23765
23658
  }
23766
23659
  }
23767
- }); // exposed for testing purposes only.
23660
+ });
23768
23661
 
23662
+ // exposed for testing purposes only.
23769
23663
  Readable._fromList = fromList;
23770
23664
  Object.defineProperty(Readable.prototype, 'readableLength', {
23771
23665
  // making it explicit this property is not enumerable
23772
23666
  // because otherwise some prototype manipulation in
23773
23667
  // userland will fail
23774
23668
  enumerable: false,
23775
- get: function get() {
23669
+ get() {
23776
23670
  return this._readableState.length;
23777
23671
  }
23778
- }); // Pluck off n bytes from an array of buffers.
23672
+ });
23673
+
23674
+ // Pluck off n bytes from an array of buffers.
23779
23675
  // Length is the combined lengths of all the buffers in the list.
23780
23676
  // This function is designed to be inlinable, so please take care when making
23781
23677
  // changes to the function body.
23782
-
23783
23678
  function fromList(n, state) {
23784
23679
  // nothing buffered
23785
23680
  if (state.length === 0) return null;
@@ -23794,52 +23689,44 @@ function fromList(n, state) {
23794
23689
  }
23795
23690
  return ret;
23796
23691
  }
23797
-
23798
23692
  function endReadable(stream) {
23799
23693
  var state = stream._readableState;
23800
23694
  debug('endReadable', state.endEmitted);
23801
-
23802
23695
  if (!state.endEmitted) {
23803
23696
  state.ended = true;
23804
23697
  process.nextTick(endReadableNT, state, stream);
23805
23698
  }
23806
23699
  }
23807
-
23808
23700
  function endReadableNT(state, stream) {
23809
- debug('endReadableNT', state.endEmitted, state.length); // Check that we didn't get one last unshift.
23701
+ debug('endReadableNT', state.endEmitted, state.length);
23810
23702
 
23703
+ // Check that we didn't get one last unshift.
23811
23704
  if (!state.endEmitted && state.length === 0) {
23812
23705
  state.endEmitted = true;
23813
23706
  stream.readable = false;
23814
23707
  stream.emit('end');
23815
-
23816
23708
  if (state.autoDestroy) {
23817
23709
  // In case of duplex streams we need a way to detect
23818
23710
  // if the writable side is ready for autoDestroy as well
23819
- var wState = stream._writableState;
23820
-
23711
+ const wState = stream._writableState;
23821
23712
  if (!wState || wState.autoDestroy && wState.finished) {
23822
23713
  stream.destroy();
23823
23714
  }
23824
23715
  }
23825
23716
  }
23826
23717
  }
23827
-
23828
23718
  if (typeof Symbol === 'function') {
23829
23719
  Readable.from = function (iterable, opts) {
23830
23720
  if (from === undefined) {
23831
23721
  from = require('./internal/streams/from');
23832
23722
  }
23833
-
23834
23723
  return from(Readable, iterable, opts);
23835
23724
  };
23836
23725
  }
23837
-
23838
23726
  function indexOf(xs, x) {
23839
23727
  for (var i = 0, l = xs.length; i < l; i++) {
23840
23728
  if (xs[i] === x) return i;
23841
23729
  }
23842
-
23843
23730
  return -1;
23844
23731
  }
23845
23732
  }).call(this)}).call(this,require('_process'),typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
@@ -23864,6 +23751,7 @@ function indexOf(xs, x) {
23864
23751
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
23865
23752
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
23866
23753
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
23754
+
23867
23755
  // a transform stream is a readable/writable stream where you do
23868
23756
  // something with the data. Sometimes it's called a "filter",
23869
23757
  // but that's not a great name for it, since that implies a thing where
@@ -23905,42 +23793,36 @@ function indexOf(xs, x) {
23905
23793
  // However, even in such a pathological case, only a single written chunk
23906
23794
  // would be consumed, and then the rest would wait (un-transformed) until
23907
23795
  // the results of the previous transformed chunk were consumed.
23796
+
23908
23797
  'use strict';
23909
23798
 
23910
23799
  module.exports = Transform;
23911
-
23912
- var _require$codes = require('../errors').codes,
23913
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
23914
- ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
23915
- ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
23916
- ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
23917
-
23918
- var Duplex = require('./_stream_duplex');
23919
-
23800
+ const _require$codes = require('../errors').codes,
23801
+ ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
23802
+ ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
23803
+ ERR_TRANSFORM_ALREADY_TRANSFORMING = _require$codes.ERR_TRANSFORM_ALREADY_TRANSFORMING,
23804
+ ERR_TRANSFORM_WITH_LENGTH_0 = _require$codes.ERR_TRANSFORM_WITH_LENGTH_0;
23805
+ const Duplex = require('./_stream_duplex');
23920
23806
  require('inherits')(Transform, Duplex);
23921
-
23922
23807
  function afterTransform(er, data) {
23923
23808
  var ts = this._transformState;
23924
23809
  ts.transforming = false;
23925
23810
  var cb = ts.writecb;
23926
-
23927
23811
  if (cb === null) {
23928
23812
  return this.emit('error', new ERR_MULTIPLE_CALLBACK());
23929
23813
  }
23930
-
23931
23814
  ts.writechunk = null;
23932
23815
  ts.writecb = null;
23933
- if (data != null) // single equals check for both `null` and `undefined`
23816
+ if (data != null)
23817
+ // single equals check for both `null` and `undefined`
23934
23818
  this.push(data);
23935
23819
  cb(er);
23936
23820
  var rs = this._readableState;
23937
23821
  rs.reading = false;
23938
-
23939
23822
  if (rs.needReadable || rs.length < rs.highWaterMark) {
23940
23823
  this._read(rs.highWaterMark);
23941
23824
  }
23942
23825
  }
23943
-
23944
23826
  function Transform(options) {
23945
23827
  if (!(this instanceof Transform)) return new Transform(options);
23946
23828
  Duplex.call(this, options);
@@ -23951,39 +23833,38 @@ function Transform(options) {
23951
23833
  writecb: null,
23952
23834
  writechunk: null,
23953
23835
  writeencoding: null
23954
- }; // start out asking for a readable event once data is transformed.
23836
+ };
23955
23837
 
23956
- this._readableState.needReadable = true; // we have implemented the _read method, and done the other things
23838
+ // start out asking for a readable event once data is transformed.
23839
+ this._readableState.needReadable = true;
23840
+
23841
+ // we have implemented the _read method, and done the other things
23957
23842
  // that Readable wants before the first _read call, so unset the
23958
23843
  // sync guard flag.
23959
-
23960
23844
  this._readableState.sync = false;
23961
-
23962
23845
  if (options) {
23963
23846
  if (typeof options.transform === 'function') this._transform = options.transform;
23964
23847
  if (typeof options.flush === 'function') this._flush = options.flush;
23965
- } // When the writable side finishes, then flush out anything remaining.
23966
-
23848
+ }
23967
23849
 
23850
+ // When the writable side finishes, then flush out anything remaining.
23968
23851
  this.on('prefinish', prefinish);
23969
23852
  }
23970
-
23971
23853
  function prefinish() {
23972
- var _this = this;
23973
-
23974
23854
  if (typeof this._flush === 'function' && !this._readableState.destroyed) {
23975
- this._flush(function (er, data) {
23976
- done(_this, er, data);
23855
+ this._flush((er, data) => {
23856
+ done(this, er, data);
23977
23857
  });
23978
23858
  } else {
23979
23859
  done(this, null, null);
23980
23860
  }
23981
23861
  }
23982
-
23983
23862
  Transform.prototype.push = function (chunk, encoding) {
23984
23863
  this._transformState.needTransform = false;
23985
23864
  return Duplex.prototype.push.call(this, chunk, encoding);
23986
- }; // This is the part where you do stuff!
23865
+ };
23866
+
23867
+ // This is the part where you do stuff!
23987
23868
  // override this function in implementation classes.
23988
23869
  // 'chunk' is an input chunk.
23989
23870
  //
@@ -23993,33 +23874,27 @@ Transform.prototype.push = function (chunk, encoding) {
23993
23874
  // Call `cb(err)` when you are done with this chunk. If you pass
23994
23875
  // an error, then that'll put the hurt on the whole operation. If you
23995
23876
  // never call cb(), then you'll never get another chunk.
23996
-
23997
-
23998
23877
  Transform.prototype._transform = function (chunk, encoding, cb) {
23999
23878
  cb(new ERR_METHOD_NOT_IMPLEMENTED('_transform()'));
24000
23879
  };
24001
-
24002
23880
  Transform.prototype._write = function (chunk, encoding, cb) {
24003
23881
  var ts = this._transformState;
24004
23882
  ts.writecb = cb;
24005
23883
  ts.writechunk = chunk;
24006
23884
  ts.writeencoding = encoding;
24007
-
24008
23885
  if (!ts.transforming) {
24009
23886
  var rs = this._readableState;
24010
23887
  if (ts.needTransform || rs.needReadable || rs.length < rs.highWaterMark) this._read(rs.highWaterMark);
24011
23888
  }
24012
- }; // Doesn't matter what the args are here.
23889
+ };
23890
+
23891
+ // Doesn't matter what the args are here.
24013
23892
  // _transform does all the work.
24014
23893
  // That we got here means that the readable side wants more data.
24015
-
24016
-
24017
23894
  Transform.prototype._read = function (n) {
24018
23895
  var ts = this._transformState;
24019
-
24020
23896
  if (ts.writechunk !== null && !ts.transforming) {
24021
23897
  ts.transforming = true;
24022
-
24023
23898
  this._transform(ts.writechunk, ts.writeencoding, ts.afterTransform);
24024
23899
  } else {
24025
23900
  // mark that we need a transform, so that any data that comes in
@@ -24027,20 +23902,20 @@ Transform.prototype._read = function (n) {
24027
23902
  ts.needTransform = true;
24028
23903
  }
24029
23904
  };
24030
-
24031
23905
  Transform.prototype._destroy = function (err, cb) {
24032
- Duplex.prototype._destroy.call(this, err, function (err2) {
23906
+ Duplex.prototype._destroy.call(this, err, err2 => {
24033
23907
  cb(err2);
24034
23908
  });
24035
23909
  };
24036
-
24037
23910
  function done(stream, er, data) {
24038
23911
  if (er) return stream.emit('error', er);
24039
- if (data != null) // single equals check for both `null` and `undefined`
24040
- stream.push(data); // TODO(BridgeAR): Write a test for these two error cases
23912
+ if (data != null)
23913
+ // single equals check for both `null` and `undefined`
23914
+ stream.push(data);
23915
+
23916
+ // TODO(BridgeAR): Write a test for these two error cases
24041
23917
  // if there's nothing in the write buffer, then that means
24042
23918
  // that nothing more will ever be provided
24043
-
24044
23919
  if (stream._writableState.length) throw new ERR_TRANSFORM_WITH_LENGTH_0();
24045
23920
  if (stream._transformState.transforming) throw new ERR_TRANSFORM_ALREADY_TRANSFORMING();
24046
23921
  return stream.push(null);
@@ -24067,185 +23942,188 @@ function done(stream, er, data) {
24067
23942
  // DAMAGES OR OTHER LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR
24068
23943
  // OTHERWISE, ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE
24069
23944
  // USE OR OTHER DEALINGS IN THE SOFTWARE.
23945
+
24070
23946
  // A bit simpler than readable streams.
24071
23947
  // Implement an async ._write(chunk, encoding, cb), and it'll handle all
24072
23948
  // the drain event emission and buffering.
23949
+
24073
23950
  'use strict';
24074
23951
 
24075
23952
  module.exports = Writable;
24076
- /* <replacement> */
24077
23953
 
23954
+ /* <replacement> */
24078
23955
  function WriteReq(chunk, encoding, cb) {
24079
23956
  this.chunk = chunk;
24080
23957
  this.encoding = encoding;
24081
23958
  this.callback = cb;
24082
23959
  this.next = null;
24083
- } // It seems a linked list but it is not
24084
- // there will be only 2 of these for each stream
24085
-
23960
+ }
24086
23961
 
23962
+ // It seems a linked list but it is not
23963
+ // there will be only 2 of these for each stream
24087
23964
  function CorkedRequest(state) {
24088
- var _this = this;
24089
-
24090
23965
  this.next = null;
24091
23966
  this.entry = null;
24092
-
24093
- this.finish = function () {
24094
- onCorkedFinish(_this, state);
23967
+ this.finish = () => {
23968
+ onCorkedFinish(this, state);
24095
23969
  };
24096
23970
  }
24097
23971
  /* </replacement> */
24098
23972
 
24099
23973
  /*<replacement>*/
24100
-
24101
-
24102
23974
  var Duplex;
24103
23975
  /*</replacement>*/
24104
23976
 
24105
23977
  Writable.WritableState = WritableState;
24106
- /*<replacement>*/
24107
23978
 
24108
- var internalUtil = {
23979
+ /*<replacement>*/
23980
+ const internalUtil = {
24109
23981
  deprecate: require('util-deprecate')
24110
23982
  };
24111
23983
  /*</replacement>*/
24112
23984
 
24113
23985
  /*<replacement>*/
24114
-
24115
23986
  var Stream = require('./internal/streams/stream');
24116
23987
  /*</replacement>*/
24117
23988
 
24118
-
24119
- var Buffer = require('buffer').Buffer;
24120
-
24121
- var OurUint8Array = global.Uint8Array || function () {};
24122
-
23989
+ const Buffer = require('buffer').Buffer;
23990
+ const OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
24123
23991
  function _uint8ArrayToBuffer(chunk) {
24124
23992
  return Buffer.from(chunk);
24125
23993
  }
24126
-
24127
23994
  function _isUint8Array(obj) {
24128
23995
  return Buffer.isBuffer(obj) || obj instanceof OurUint8Array;
24129
23996
  }
24130
-
24131
- var destroyImpl = require('./internal/streams/destroy');
24132
-
24133
- var _require = require('./internal/streams/state'),
24134
- getHighWaterMark = _require.getHighWaterMark;
24135
-
24136
- var _require$codes = require('../errors').codes,
24137
- ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
24138
- ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
24139
- ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
24140
- ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
24141
- ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
24142
- ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
24143
- ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
24144
- ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
24145
-
24146
- var errorOrDestroy = destroyImpl.errorOrDestroy;
24147
-
23997
+ const destroyImpl = require('./internal/streams/destroy');
23998
+ const _require = require('./internal/streams/state'),
23999
+ getHighWaterMark = _require.getHighWaterMark;
24000
+ const _require$codes = require('../errors').codes,
24001
+ ERR_INVALID_ARG_TYPE = _require$codes.ERR_INVALID_ARG_TYPE,
24002
+ ERR_METHOD_NOT_IMPLEMENTED = _require$codes.ERR_METHOD_NOT_IMPLEMENTED,
24003
+ ERR_MULTIPLE_CALLBACK = _require$codes.ERR_MULTIPLE_CALLBACK,
24004
+ ERR_STREAM_CANNOT_PIPE = _require$codes.ERR_STREAM_CANNOT_PIPE,
24005
+ ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED,
24006
+ ERR_STREAM_NULL_VALUES = _require$codes.ERR_STREAM_NULL_VALUES,
24007
+ ERR_STREAM_WRITE_AFTER_END = _require$codes.ERR_STREAM_WRITE_AFTER_END,
24008
+ ERR_UNKNOWN_ENCODING = _require$codes.ERR_UNKNOWN_ENCODING;
24009
+ const errorOrDestroy = destroyImpl.errorOrDestroy;
24148
24010
  require('inherits')(Writable, Stream);
24149
-
24150
24011
  function nop() {}
24151
-
24152
24012
  function WritableState(options, stream, isDuplex) {
24153
24013
  Duplex = Duplex || require('./_stream_duplex');
24154
- options = options || {}; // Duplex streams are both readable and writable, but share
24014
+ options = options || {};
24015
+
24016
+ // Duplex streams are both readable and writable, but share
24155
24017
  // the same options object.
24156
24018
  // However, some cases require setting options to different
24157
24019
  // values for the readable and the writable sides of the duplex stream,
24158
24020
  // e.g. options.readableObjectMode vs. options.writableObjectMode, etc.
24021
+ if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex;
24159
24022
 
24160
- if (typeof isDuplex !== 'boolean') isDuplex = stream instanceof Duplex; // object stream flag to indicate whether or not this stream
24023
+ // object stream flag to indicate whether or not this stream
24161
24024
  // contains buffers or objects.
24162
-
24163
24025
  this.objectMode = !!options.objectMode;
24164
- if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode; // the point at which write() starts returning false
24026
+ if (isDuplex) this.objectMode = this.objectMode || !!options.writableObjectMode;
24027
+
24028
+ // the point at which write() starts returning false
24165
24029
  // Note: 0 is a valid value, means that we always return false if
24166
24030
  // the entire buffer is not flushed immediately on write()
24031
+ this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex);
24167
24032
 
24168
- this.highWaterMark = getHighWaterMark(this, options, 'writableHighWaterMark', isDuplex); // if _final has been called
24169
-
24170
- this.finalCalled = false; // drain event flag.
24171
-
24172
- this.needDrain = false; // at the start of calling end()
24173
-
24174
- this.ending = false; // when end() has been called, and returned
24033
+ // if _final has been called
24034
+ this.finalCalled = false;
24175
24035
 
24176
- this.ended = false; // when 'finish' is emitted
24036
+ // drain event flag.
24037
+ this.needDrain = false;
24038
+ // at the start of calling end()
24039
+ this.ending = false;
24040
+ // when end() has been called, and returned
24041
+ this.ended = false;
24042
+ // when 'finish' is emitted
24043
+ this.finished = false;
24177
24044
 
24178
- this.finished = false; // has it been destroyed
24045
+ // has it been destroyed
24046
+ this.destroyed = false;
24179
24047
 
24180
- this.destroyed = false; // should we decode strings into buffers before passing to _write?
24048
+ // should we decode strings into buffers before passing to _write?
24181
24049
  // this is here so that some node-core streams can optimize string
24182
24050
  // handling at a lower level.
24183
-
24184
24051
  var noDecode = options.decodeStrings === false;
24185
- this.decodeStrings = !noDecode; // Crypto is kind of old and crusty. Historically, its default string
24052
+ this.decodeStrings = !noDecode;
24053
+
24054
+ // Crypto is kind of old and crusty. Historically, its default string
24186
24055
  // encoding is 'binary' so we have to make this configurable.
24187
24056
  // Everything else in the universe uses 'utf8', though.
24057
+ this.defaultEncoding = options.defaultEncoding || 'utf8';
24188
24058
 
24189
- this.defaultEncoding = options.defaultEncoding || 'utf8'; // not an actual buffer we keep track of, but a measurement
24059
+ // not an actual buffer we keep track of, but a measurement
24190
24060
  // of how much we're waiting to get pushed to some underlying
24191
24061
  // socket or file.
24062
+ this.length = 0;
24192
24063
 
24193
- this.length = 0; // a flag to see when we're in the middle of a write.
24064
+ // a flag to see when we're in the middle of a write.
24065
+ this.writing = false;
24194
24066
 
24195
- this.writing = false; // when true all writes will be buffered until .uncork() call
24067
+ // when true all writes will be buffered until .uncork() call
24068
+ this.corked = 0;
24196
24069
 
24197
- this.corked = 0; // a flag to be able to tell if the onwrite cb is called immediately,
24070
+ // a flag to be able to tell if the onwrite cb is called immediately,
24198
24071
  // or on a later tick. We set this to true at first, because any
24199
24072
  // actions that shouldn't happen until "later" should generally also
24200
24073
  // not happen before the first write call.
24074
+ this.sync = true;
24201
24075
 
24202
- this.sync = true; // a flag to know if we're processing previously buffered items, which
24076
+ // a flag to know if we're processing previously buffered items, which
24203
24077
  // may call the _write() callback in the same tick, so that we don't
24204
24078
  // end up in an overlapped onwrite situation.
24079
+ this.bufferProcessing = false;
24205
24080
 
24206
- this.bufferProcessing = false; // the callback that's passed to _write(chunk,cb)
24207
-
24081
+ // the callback that's passed to _write(chunk,cb)
24208
24082
  this.onwrite = function (er) {
24209
24083
  onwrite(stream, er);
24210
- }; // the callback that the user supplies to write(chunk,encoding,cb)
24211
-
24084
+ };
24212
24085
 
24213
- this.writecb = null; // the amount that is being written when _write is called.
24086
+ // the callback that the user supplies to write(chunk,encoding,cb)
24087
+ this.writecb = null;
24214
24088
 
24089
+ // the amount that is being written when _write is called.
24215
24090
  this.writelen = 0;
24216
24091
  this.bufferedRequest = null;
24217
- this.lastBufferedRequest = null; // number of pending user-supplied write callbacks
24092
+ this.lastBufferedRequest = null;
24093
+
24094
+ // number of pending user-supplied write callbacks
24218
24095
  // this must be 0 before 'finish' can be emitted
24096
+ this.pendingcb = 0;
24219
24097
 
24220
- this.pendingcb = 0; // emit prefinish if the only thing we're waiting for is _write cbs
24098
+ // emit prefinish if the only thing we're waiting for is _write cbs
24221
24099
  // This is relevant for synchronous Transform streams
24100
+ this.prefinished = false;
24222
24101
 
24223
- this.prefinished = false; // True if the error was already emitted and should not be thrown again
24102
+ // True if the error was already emitted and should not be thrown again
24103
+ this.errorEmitted = false;
24224
24104
 
24225
- this.errorEmitted = false; // Should close be emitted on destroy. Defaults to true.
24105
+ // Should close be emitted on destroy. Defaults to true.
24106
+ this.emitClose = options.emitClose !== false;
24226
24107
 
24227
- this.emitClose = options.emitClose !== false; // Should .destroy() be called after 'finish' (and potentially 'end')
24108
+ // Should .destroy() be called after 'finish' (and potentially 'end')
24109
+ this.autoDestroy = !!options.autoDestroy;
24228
24110
 
24229
- this.autoDestroy = !!options.autoDestroy; // count buffered requests
24111
+ // count buffered requests
24112
+ this.bufferedRequestCount = 0;
24230
24113
 
24231
- this.bufferedRequestCount = 0; // allocate the first CorkedRequest, there is always
24114
+ // allocate the first CorkedRequest, there is always
24232
24115
  // one allocated and free to use, and we maintain at most two
24233
-
24234
24116
  this.corkedRequestsFree = new CorkedRequest(this);
24235
24117
  }
24236
-
24237
24118
  WritableState.prototype.getBuffer = function getBuffer() {
24238
24119
  var current = this.bufferedRequest;
24239
24120
  var out = [];
24240
-
24241
24121
  while (current) {
24242
24122
  out.push(current);
24243
24123
  current = current.next;
24244
24124
  }
24245
-
24246
24125
  return out;
24247
24126
  };
24248
-
24249
24127
  (function () {
24250
24128
  try {
24251
24129
  Object.defineProperty(WritableState.prototype, 'buffer', {
@@ -24254,12 +24132,11 @@ WritableState.prototype.getBuffer = function getBuffer() {
24254
24132
  }, '_writableState.buffer is deprecated. Use _writableState.getBuffer ' + 'instead.', 'DEP0003')
24255
24133
  });
24256
24134
  } catch (_) {}
24257
- })(); // Test _writableState for inheritance to account for Duplex streams,
24258
- // whose prototype chain only points to Readable.
24259
-
24135
+ })();
24260
24136
 
24137
+ // Test _writableState for inheritance to account for Duplex streams,
24138
+ // whose prototype chain only points to Readable.
24261
24139
  var realHasInstance;
24262
-
24263
24140
  if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.prototype[Symbol.hasInstance] === 'function') {
24264
24141
  realHasInstance = Function.prototype[Symbol.hasInstance];
24265
24142
  Object.defineProperty(Writable, Symbol.hasInstance, {
@@ -24274,81 +24151,73 @@ if (typeof Symbol === 'function' && Symbol.hasInstance && typeof Function.protot
24274
24151
  return object instanceof this;
24275
24152
  };
24276
24153
  }
24277
-
24278
24154
  function Writable(options) {
24279
- Duplex = Duplex || require('./_stream_duplex'); // Writable ctor is applied to Duplexes, too.
24155
+ Duplex = Duplex || require('./_stream_duplex');
24156
+
24157
+ // Writable ctor is applied to Duplexes, too.
24280
24158
  // `realHasInstance` is necessary because using plain `instanceof`
24281
24159
  // would return false, as no `_writableState` property is attached.
24160
+
24282
24161
  // Trying to use the custom `instanceof` for Writable here will also break the
24283
24162
  // Node.js LazyTransform implementation, which has a non-trivial getter for
24284
24163
  // `_writableState` that would lead to infinite recursion.
24164
+
24285
24165
  // Checking for a Stream.Duplex instance is faster here instead of inside
24286
24166
  // the WritableState constructor, at least with V8 6.5
24287
-
24288
- var isDuplex = this instanceof Duplex;
24167
+ const isDuplex = this instanceof Duplex;
24289
24168
  if (!isDuplex && !realHasInstance.call(Writable, this)) return new Writable(options);
24290
- this._writableState = new WritableState(options, this, isDuplex); // legacy.
24169
+ this._writableState = new WritableState(options, this, isDuplex);
24291
24170
 
24171
+ // legacy.
24292
24172
  this.writable = true;
24293
-
24294
24173
  if (options) {
24295
24174
  if (typeof options.write === 'function') this._write = options.write;
24296
24175
  if (typeof options.writev === 'function') this._writev = options.writev;
24297
24176
  if (typeof options.destroy === 'function') this._destroy = options.destroy;
24298
24177
  if (typeof options.final === 'function') this._final = options.final;
24299
24178
  }
24300
-
24301
24179
  Stream.call(this);
24302
- } // Otherwise people can pipe Writable streams, which is just wrong.
24303
-
24180
+ }
24304
24181
 
24182
+ // Otherwise people can pipe Writable streams, which is just wrong.
24305
24183
  Writable.prototype.pipe = function () {
24306
24184
  errorOrDestroy(this, new ERR_STREAM_CANNOT_PIPE());
24307
24185
  };
24308
-
24309
24186
  function writeAfterEnd(stream, cb) {
24310
- var er = new ERR_STREAM_WRITE_AFTER_END(); // TODO: defer error events consistently everywhere, not just the cb
24311
-
24187
+ var er = new ERR_STREAM_WRITE_AFTER_END();
24188
+ // TODO: defer error events consistently everywhere, not just the cb
24312
24189
  errorOrDestroy(stream, er);
24313
24190
  process.nextTick(cb, er);
24314
- } // Checks that a user-supplied chunk is valid, especially for the particular
24191
+ }
24192
+
24193
+ // Checks that a user-supplied chunk is valid, especially for the particular
24315
24194
  // mode the stream is in. Currently this means that `null` is never accepted
24316
24195
  // and undefined/non-string values are only allowed in object mode.
24317
-
24318
-
24319
24196
  function validChunk(stream, state, chunk, cb) {
24320
24197
  var er;
24321
-
24322
24198
  if (chunk === null) {
24323
24199
  er = new ERR_STREAM_NULL_VALUES();
24324
24200
  } else if (typeof chunk !== 'string' && !state.objectMode) {
24325
24201
  er = new ERR_INVALID_ARG_TYPE('chunk', ['string', 'Buffer'], chunk);
24326
24202
  }
24327
-
24328
24203
  if (er) {
24329
24204
  errorOrDestroy(stream, er);
24330
24205
  process.nextTick(cb, er);
24331
24206
  return false;
24332
24207
  }
24333
-
24334
24208
  return true;
24335
24209
  }
24336
-
24337
24210
  Writable.prototype.write = function (chunk, encoding, cb) {
24338
24211
  var state = this._writableState;
24339
24212
  var ret = false;
24340
-
24341
24213
  var isBuf = !state.objectMode && _isUint8Array(chunk);
24342
-
24343
24214
  if (isBuf && !Buffer.isBuffer(chunk)) {
24344
24215
  chunk = _uint8ArrayToBuffer(chunk);
24345
24216
  }
24346
-
24347
24217
  if (typeof encoding === 'function') {
24348
24218
  cb = encoding;
24349
24219
  encoding = null;
24350
24220
  }
24351
-
24352
24221
  if (isBuf) encoding = 'buffer';else if (!encoding) encoding = state.defaultEncoding;
24353
24222
  if (typeof cb !== 'function') cb = nop;
24354
24223
  if (state.ending) writeAfterEnd(this, cb);else if (isBuf || validChunk(this, state, chunk, cb)) {
@@ -24357,20 +24226,16 @@ Writable.prototype.write = function (chunk, encoding, cb) {
24357
24226
  }
24358
24227
  return ret;
24359
24228
  };
24360
-
24361
24229
  Writable.prototype.cork = function () {
24362
24230
  this._writableState.corked++;
24363
24231
  };
24364
-
24365
24232
  Writable.prototype.uncork = function () {
24366
24233
  var state = this._writableState;
24367
-
24368
24234
  if (state.corked) {
24369
24235
  state.corked--;
24370
24236
  if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
24371
24237
  }
24372
24238
  };
24373
-
24374
24239
  Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
24375
24240
  // node::ParseEncoding() requires lower case.
24376
24241
  if (typeof encoding === 'string') encoding = encoding.toLowerCase();
@@ -24378,7 +24243,6 @@ Writable.prototype.setDefaultEncoding = function setDefaultEncoding(encoding) {
24378
24243
  this._writableState.defaultEncoding = encoding;
24379
24244
  return this;
24380
24245
  };
24381
-
24382
24246
  Object.defineProperty(Writable.prototype, 'writableBuffer', {
24383
24247
  // making it explicit this property is not enumerable
24384
24248
  // because otherwise some prototype manipulation in
@@ -24388,15 +24252,12 @@ Object.defineProperty(Writable.prototype, 'writableBuffer', {
24388
24252
  return this._writableState && this._writableState.getBuffer();
24389
24253
  }
24390
24254
  });
24391
-
24392
24255
  function decodeChunk(state, chunk, encoding) {
24393
24256
  if (!state.objectMode && state.decodeStrings !== false && typeof chunk === 'string') {
24394
24257
  chunk = Buffer.from(chunk, encoding);
24395
24258
  }
24396
-
24397
24259
  return chunk;
24398
24260
  }
24399
-
24400
24261
  Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
24401
24262
  // making it explicit this property is not enumerable
24402
24263
  // because otherwise some prototype manipulation in
@@ -24405,51 +24266,45 @@ Object.defineProperty(Writable.prototype, 'writableHighWaterMark', {
24405
24266
  get: function get() {
24406
24267
  return this._writableState.highWaterMark;
24407
24268
  }
24408
- }); // if we're already writing something, then just put this
24269
+ });
24270
+
24271
+ // if we're already writing something, then just put this
24409
24272
  // in the queue, and wait our turn. Otherwise, call _write
24410
24273
  // If we return false, then we need a drain event, so set that flag.
24411
-
24412
24274
  function writeOrBuffer(stream, state, isBuf, chunk, encoding, cb) {
24413
24275
  if (!isBuf) {
24414
24276
  var newChunk = decodeChunk(state, chunk, encoding);
24415
-
24416
24277
  if (chunk !== newChunk) {
24417
24278
  isBuf = true;
24418
24279
  encoding = 'buffer';
24419
24280
  chunk = newChunk;
24420
24281
  }
24421
24282
  }
24422
-
24423
24283
  var len = state.objectMode ? 1 : chunk.length;
24424
24284
  state.length += len;
24425
- var ret = state.length < state.highWaterMark; // we must ensure that previous needDrain will not be reset to false.
24426
-
24285
+ var ret = state.length < state.highWaterMark;
24286
+ // we must ensure that previous needDrain will not be reset to false.
24427
24287
  if (!ret) state.needDrain = true;
24428
-
24429
24288
  if (state.writing || state.corked) {
24430
24289
  var last = state.lastBufferedRequest;
24431
24290
  state.lastBufferedRequest = {
24432
- chunk: chunk,
24433
- encoding: encoding,
24434
- isBuf: isBuf,
24291
+ chunk,
24292
+ encoding,
24293
+ isBuf,
24435
24294
  callback: cb,
24436
24295
  next: null
24437
24296
  };
24438
-
24439
24297
  if (last) {
24440
24298
  last.next = state.lastBufferedRequest;
24441
24299
  } else {
24442
24300
  state.bufferedRequest = state.lastBufferedRequest;
24443
24301
  }
24444
-
24445
24302
  state.bufferedRequestCount += 1;
24446
24303
  } else {
24447
24304
  doWrite(stream, state, false, len, chunk, encoding, cb);
24448
24305
  }
24449
-
24450
24306
  return ret;
24451
24307
  }
24452
-
24453
24308
  function doWrite(stream, state, writev, len, chunk, encoding, cb) {
24454
24309
  state.writelen = len;
24455
24310
  state.writecb = cb;
@@ -24458,16 +24313,14 @@ function doWrite(stream, state, writev, len, chunk, encoding, cb) {
24458
24313
  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);
24459
24314
  state.sync = false;
24460
24315
  }
24461
-
24462
24316
  function onwriteError(stream, state, sync, er, cb) {
24463
24317
  --state.pendingcb;
24464
-
24465
24318
  if (sync) {
24466
24319
  // defer the callback if we are being called synchronously
24467
24320
  // to avoid piling up things on the stack
24468
- process.nextTick(cb, er); // this can emit finish, and it will always happen
24321
+ process.nextTick(cb, er);
24322
+ // this can emit finish, and it will always happen
24469
24323
  // after error
24470
-
24471
24324
  process.nextTick(finishMaybe, stream, state);
24472
24325
  stream._writableState.errorEmitted = true;
24473
24326
  errorOrDestroy(stream, er);
@@ -24476,20 +24329,18 @@ function onwriteError(stream, state, sync, er, cb) {
24476
24329
  // it is async
24477
24330
  cb(er);
24478
24331
  stream._writableState.errorEmitted = true;
24479
- errorOrDestroy(stream, er); // this can emit finish, but finish must
24332
+ errorOrDestroy(stream, er);
24333
+ // this can emit finish, but finish must
24480
24334
  // always follow error
24481
-
24482
24335
  finishMaybe(stream, state);
24483
24336
  }
24484
24337
  }
24485
-
24486
24338
  function onwriteStateUpdate(state) {
24487
24339
  state.writing = false;
24488
24340
  state.writecb = null;
24489
24341
  state.length -= state.writelen;
24490
24342
  state.writelen = 0;
24491
24343
  }
24492
-
24493
24344
  function onwrite(stream, er) {
24494
24345
  var state = stream._writableState;
24495
24346
  var sync = state.sync;
@@ -24499,11 +24350,9 @@ function onwrite(stream, er) {
24499
24350
  if (er) onwriteError(stream, state, sync, er, cb);else {
24500
24351
  // Check if we're actually ready to finish, but don't emit yet
24501
24352
  var finished = needFinish(state) || stream.destroyed;
24502
-
24503
24353
  if (!finished && !state.corked && !state.bufferProcessing && state.bufferedRequest) {
24504
24354
  clearBuffer(stream, state);
24505
24355
  }
24506
-
24507
24356
  if (sync) {
24508
24357
  process.nextTick(afterWrite, stream, state, finished, cb);
24509
24358
  } else {
@@ -24511,29 +24360,27 @@ function onwrite(stream, er) {
24511
24360
  }
24512
24361
  }
24513
24362
  }
24514
-
24515
24363
  function afterWrite(stream, state, finished, cb) {
24516
24364
  if (!finished) onwriteDrain(stream, state);
24517
24365
  state.pendingcb--;
24518
24366
  cb();
24519
24367
  finishMaybe(stream, state);
24520
- } // Must force callback to be called on nextTick, so that we don't
24368
+ }
24369
+
24370
+ // Must force callback to be called on nextTick, so that we don't
24521
24371
  // emit 'drain' before the write() consumer gets the 'false' return
24522
24372
  // value, and has a chance to attach a 'drain' listener.
24523
-
24524
-
24525
24373
  function onwriteDrain(stream, state) {
24526
24374
  if (state.length === 0 && state.needDrain) {
24527
24375
  state.needDrain = false;
24528
24376
  stream.emit('drain');
24529
24377
  }
24530
- } // if there's something in the buffer waiting, then process it
24531
-
24378
+ }
24532
24379
 
24380
+ // if there's something in the buffer waiting, then process it
24533
24381
  function clearBuffer(stream, state) {
24534
24382
  state.bufferProcessing = true;
24535
24383
  var entry = state.bufferedRequest;
24536
-
24537
24384
  if (stream._writev && entry && entry.next) {
24538
24385
  // Fast case, write everything using _writev()
24539
24386
  var l = state.bufferedRequestCount;
@@ -24542,28 +24389,25 @@ function clearBuffer(stream, state) {
24542
24389
  holder.entry = entry;
24543
24390
  var count = 0;
24544
24391
  var allBuffers = true;
24545
-
24546
24392
  while (entry) {
24547
24393
  buffer[count] = entry;
24548
24394
  if (!entry.isBuf) allBuffers = false;
24549
24395
  entry = entry.next;
24550
24396
  count += 1;
24551
24397
  }
24552
-
24553
24398
  buffer.allBuffers = allBuffers;
24554
- doWrite(stream, state, true, state.length, buffer, '', holder.finish); // doWrite is almost always async, defer these to save a bit of time
24555
- // as the hot path ends with doWrite
24399
+ doWrite(stream, state, true, state.length, buffer, '', holder.finish);
24556
24400
 
24401
+ // doWrite is almost always async, defer these to save a bit of time
24402
+ // as the hot path ends with doWrite
24557
24403
  state.pendingcb++;
24558
24404
  state.lastBufferedRequest = null;
24559
-
24560
24405
  if (holder.next) {
24561
24406
  state.corkedRequestsFree = holder.next;
24562
24407
  holder.next = null;
24563
24408
  } else {
24564
24409
  state.corkedRequestsFree = new CorkedRequest(state);
24565
24410
  }
24566
-
24567
24411
  state.bufferedRequestCount = 0;
24568
24412
  } else {
24569
24413
  // Slow case, write chunks one-by-one
@@ -24574,32 +24418,26 @@ function clearBuffer(stream, state) {
24574
24418
  var len = state.objectMode ? 1 : chunk.length;
24575
24419
  doWrite(stream, state, false, len, chunk, encoding, cb);
24576
24420
  entry = entry.next;
24577
- state.bufferedRequestCount--; // if we didn't call the onwrite immediately, then
24421
+ state.bufferedRequestCount--;
24422
+ // if we didn't call the onwrite immediately, then
24578
24423
  // it means that we need to wait until it does.
24579
24424
  // also, that means that the chunk and cb are currently
24580
24425
  // being processed, so move the buffer counter past them.
24581
-
24582
24426
  if (state.writing) {
24583
24427
  break;
24584
24428
  }
24585
24429
  }
24586
-
24587
24430
  if (entry === null) state.lastBufferedRequest = null;
24588
24431
  }
24589
-
24590
24432
  state.bufferedRequest = entry;
24591
24433
  state.bufferProcessing = false;
24592
24434
  }
24593
-
24594
24435
  Writable.prototype._write = function (chunk, encoding, cb) {
24595
24436
  cb(new ERR_METHOD_NOT_IMPLEMENTED('_write()'));
24596
24437
  };
24597
-
24598
24438
  Writable.prototype._writev = null;
24599
-
24600
24439
  Writable.prototype.end = function (chunk, encoding, cb) {
24601
24440
  var state = this._writableState;
24602
-
24603
24441
  if (typeof chunk === 'function') {
24604
24442
  cb = chunk;
24605
24443
  chunk = null;
@@ -24608,47 +24446,41 @@ Writable.prototype.end = function (chunk, encoding, cb) {
24608
24446
  cb = encoding;
24609
24447
  encoding = null;
24610
24448
  }
24449
+ if (chunk !== null && chunk !== undefined) this.write(chunk, encoding);
24611
24450
 
24612
- if (chunk !== null && chunk !== undefined) this.write(chunk, encoding); // .end() fully uncorks
24613
-
24451
+ // .end() fully uncorks
24614
24452
  if (state.corked) {
24615
24453
  state.corked = 1;
24616
24454
  this.uncork();
24617
- } // ignore unnecessary end() calls.
24618
-
24455
+ }
24619
24456
 
24457
+ // ignore unnecessary end() calls.
24620
24458
  if (!state.ending) endWritable(this, state, cb);
24621
24459
  return this;
24622
24460
  };
24623
-
24624
24461
  Object.defineProperty(Writable.prototype, 'writableLength', {
24625
24462
  // making it explicit this property is not enumerable
24626
24463
  // because otherwise some prototype manipulation in
24627
24464
  // userland will fail
24628
24465
  enumerable: false,
24629
- get: function get() {
24466
+ get() {
24630
24467
  return this._writableState.length;
24631
24468
  }
24632
24469
  });
24633
-
24634
24470
  function needFinish(state) {
24635
24471
  return state.ending && state.length === 0 && state.bufferedRequest === null && !state.finished && !state.writing;
24636
24472
  }
24637
-
24638
24473
  function callFinal(stream, state) {
24639
- stream._final(function (err) {
24474
+ stream._final(err => {
24640
24475
  state.pendingcb--;
24641
-
24642
24476
  if (err) {
24643
24477
  errorOrDestroy(stream, err);
24644
24478
  }
24645
-
24646
24479
  state.prefinished = true;
24647
24480
  stream.emit('prefinish');
24648
24481
  finishMaybe(stream, state);
24649
24482
  });
24650
24483
  }
24651
-
24652
24484
  function prefinish(stream, state) {
24653
24485
  if (!state.prefinished && !state.finalCalled) {
24654
24486
  if (typeof stream._final === 'function' && !state.destroyed) {
@@ -24661,86 +24493,72 @@ function prefinish(stream, state) {
24661
24493
  }
24662
24494
  }
24663
24495
  }
24664
-
24665
24496
  function finishMaybe(stream, state) {
24666
24497
  var need = needFinish(state);
24667
-
24668
24498
  if (need) {
24669
24499
  prefinish(stream, state);
24670
-
24671
24500
  if (state.pendingcb === 0) {
24672
24501
  state.finished = true;
24673
24502
  stream.emit('finish');
24674
-
24675
24503
  if (state.autoDestroy) {
24676
24504
  // In case of duplex streams we need a way to detect
24677
24505
  // if the readable side is ready for autoDestroy as well
24678
- var rState = stream._readableState;
24679
-
24506
+ const rState = stream._readableState;
24680
24507
  if (!rState || rState.autoDestroy && rState.endEmitted) {
24681
24508
  stream.destroy();
24682
24509
  }
24683
24510
  }
24684
24511
  }
24685
24512
  }
24686
-
24687
24513
  return need;
24688
24514
  }
24689
-
24690
24515
  function endWritable(stream, state, cb) {
24691
24516
  state.ending = true;
24692
24517
  finishMaybe(stream, state);
24693
-
24694
24518
  if (cb) {
24695
24519
  if (state.finished) process.nextTick(cb);else stream.once('finish', cb);
24696
24520
  }
24697
-
24698
24521
  state.ended = true;
24699
24522
  stream.writable = false;
24700
24523
  }
24701
-
24702
24524
  function onCorkedFinish(corkReq, state, err) {
24703
24525
  var entry = corkReq.entry;
24704
24526
  corkReq.entry = null;
24705
-
24706
24527
  while (entry) {
24707
24528
  var cb = entry.callback;
24708
24529
  state.pendingcb--;
24709
24530
  cb(err);
24710
24531
  entry = entry.next;
24711
- } // reuse the free corkReq.
24712
-
24532
+ }
24713
24533
 
24534
+ // reuse the free corkReq.
24714
24535
  state.corkedRequestsFree.next = corkReq;
24715
24536
  }
24716
-
24717
24537
  Object.defineProperty(Writable.prototype, 'destroyed', {
24718
24538
  // making it explicit this property is not enumerable
24719
24539
  // because otherwise some prototype manipulation in
24720
24540
  // userland will fail
24721
24541
  enumerable: false,
24722
- get: function get() {
24542
+ get() {
24723
24543
  if (this._writableState === undefined) {
24724
24544
  return false;
24725
24545
  }
24726
-
24727
24546
  return this._writableState.destroyed;
24728
24547
  },
24729
- set: function set(value) {
24548
+ set(value) {
24730
24549
  // we ignore the value if the stream
24731
24550
  // has not been initialized yet
24732
24551
  if (!this._writableState) {
24733
24552
  return;
24734
- } // backward compatibility, the user is explicitly
24735
- // managing destroyed
24736
-
24553
+ }
24737
24554
 
24555
+ // backward compatibility, the user is explicitly
24556
+ // managing destroyed
24738
24557
  this._writableState.destroyed = value;
24739
24558
  }
24740
24559
  });
24741
24560
  Writable.prototype.destroy = destroyImpl.destroy;
24742
24561
  Writable.prototype._undestroy = destroyImpl.undestroy;
24743
-
24744
24562
  Writable.prototype._destroy = function (err, cb) {
24745
24563
  cb(err);
24746
24564
  };
@@ -24749,35 +24567,27 @@ Writable.prototype._destroy = function (err, cb) {
24749
24567
  (function (process){(function (){
24750
24568
  'use strict';
24751
24569
 
24752
- var _Object$setPrototypeO;
24753
-
24754
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24755
-
24756
- var finished = require('./end-of-stream');
24757
-
24758
- var kLastResolve = Symbol('lastResolve');
24759
- var kLastReject = Symbol('lastReject');
24760
- var kError = Symbol('error');
24761
- var kEnded = Symbol('ended');
24762
- var kLastPromise = Symbol('lastPromise');
24763
- var kHandlePromise = Symbol('handlePromise');
24764
- var kStream = Symbol('stream');
24765
-
24570
+ const finished = require('./end-of-stream');
24571
+ const kLastResolve = Symbol('lastResolve');
24572
+ const kLastReject = Symbol('lastReject');
24573
+ const kError = Symbol('error');
24574
+ const kEnded = Symbol('ended');
24575
+ const kLastPromise = Symbol('lastPromise');
24576
+ const kHandlePromise = Symbol('handlePromise');
24577
+ const kStream = Symbol('stream');
24766
24578
  function createIterResult(value, done) {
24767
24579
  return {
24768
- value: value,
24769
- done: done
24580
+ value,
24581
+ done
24770
24582
  };
24771
24583
  }
24772
-
24773
24584
  function readAndResolve(iter) {
24774
- var resolve = iter[kLastResolve];
24775
-
24585
+ const resolve = iter[kLastResolve];
24776
24586
  if (resolve !== null) {
24777
- var data = iter[kStream].read(); // we defer if data is null
24587
+ const data = iter[kStream].read();
24588
+ // we defer if data is null
24778
24589
  // we can be expecting either 'end' or
24779
24590
  // 'error'
24780
-
24781
24591
  if (data !== null) {
24782
24592
  iter[kLastPromise] = null;
24783
24593
  iter[kLastResolve] = null;
@@ -24786,396 +24596,325 @@ function readAndResolve(iter) {
24786
24596
  }
24787
24597
  }
24788
24598
  }
24789
-
24790
24599
  function onReadable(iter) {
24791
24600
  // we wait for the next tick, because it might
24792
24601
  // emit an error with process.nextTick
24793
24602
  process.nextTick(readAndResolve, iter);
24794
24603
  }
24795
-
24796
24604
  function wrapForNext(lastPromise, iter) {
24797
- return function (resolve, reject) {
24798
- lastPromise.then(function () {
24605
+ return (resolve, reject) => {
24606
+ lastPromise.then(() => {
24799
24607
  if (iter[kEnded]) {
24800
24608
  resolve(createIterResult(undefined, true));
24801
24609
  return;
24802
24610
  }
24803
-
24804
24611
  iter[kHandlePromise](resolve, reject);
24805
24612
  }, reject);
24806
24613
  };
24807
24614
  }
24808
-
24809
- var AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
24810
- var ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf((_Object$setPrototypeO = {
24615
+ const AsyncIteratorPrototype = Object.getPrototypeOf(function () {});
24616
+ const ReadableStreamAsyncIteratorPrototype = Object.setPrototypeOf({
24811
24617
  get stream() {
24812
24618
  return this[kStream];
24813
24619
  },
24814
-
24815
- next: function next() {
24816
- var _this = this;
24817
-
24620
+ next() {
24818
24621
  // if we have detected an error in the meanwhile
24819
24622
  // reject straight away
24820
- var error = this[kError];
24821
-
24623
+ const error = this[kError];
24822
24624
  if (error !== null) {
24823
24625
  return Promise.reject(error);
24824
24626
  }
24825
-
24826
24627
  if (this[kEnded]) {
24827
24628
  return Promise.resolve(createIterResult(undefined, true));
24828
24629
  }
24829
-
24830
24630
  if (this[kStream].destroyed) {
24831
24631
  // We need to defer via nextTick because if .destroy(err) is
24832
24632
  // called, the error will be emitted via nextTick, and
24833
24633
  // we cannot guarantee that there is no error lingering around
24834
24634
  // waiting to be emitted.
24835
- return new Promise(function (resolve, reject) {
24836
- process.nextTick(function () {
24837
- if (_this[kError]) {
24838
- reject(_this[kError]);
24635
+ return new Promise((resolve, reject) => {
24636
+ process.nextTick(() => {
24637
+ if (this[kError]) {
24638
+ reject(this[kError]);
24839
24639
  } else {
24840
24640
  resolve(createIterResult(undefined, true));
24841
24641
  }
24842
24642
  });
24843
24643
  });
24844
- } // if we have multiple next() calls
24644
+ }
24645
+
24646
+ // if we have multiple next() calls
24845
24647
  // we will wait for the previous Promise to finish
24846
24648
  // this logic is optimized to support for await loops,
24847
24649
  // where next() is only called once at a time
24848
-
24849
-
24850
- var lastPromise = this[kLastPromise];
24851
- var promise;
24852
-
24650
+ const lastPromise = this[kLastPromise];
24651
+ let promise;
24853
24652
  if (lastPromise) {
24854
24653
  promise = new Promise(wrapForNext(lastPromise, this));
24855
24654
  } else {
24856
24655
  // fast path needed to support multiple this.push()
24857
24656
  // without triggering the next() queue
24858
- var data = this[kStream].read();
24859
-
24657
+ const data = this[kStream].read();
24860
24658
  if (data !== null) {
24861
24659
  return Promise.resolve(createIterResult(data, false));
24862
24660
  }
24863
-
24864
24661
  promise = new Promise(this[kHandlePromise]);
24865
24662
  }
24866
-
24867
24663
  this[kLastPromise] = promise;
24868
24664
  return promise;
24869
- }
24870
- }, _defineProperty(_Object$setPrototypeO, Symbol.asyncIterator, function () {
24871
- return this;
24872
- }), _defineProperty(_Object$setPrototypeO, "return", function _return() {
24873
- var _this2 = this;
24874
-
24875
- // destroy(err, cb) is a private API
24876
- // we can guarantee we have that here, because we control the
24877
- // Readable class this is attached to
24878
- return new Promise(function (resolve, reject) {
24879
- _this2[kStream].destroy(null, function (err) {
24880
- if (err) {
24881
- reject(err);
24882
- return;
24883
- }
24884
-
24885
- resolve(createIterResult(undefined, true));
24665
+ },
24666
+ [Symbol.asyncIterator]() {
24667
+ return this;
24668
+ },
24669
+ return() {
24670
+ // destroy(err, cb) is a private API
24671
+ // we can guarantee we have that here, because we control the
24672
+ // Readable class this is attached to
24673
+ return new Promise((resolve, reject) => {
24674
+ this[kStream].destroy(null, err => {
24675
+ if (err) {
24676
+ reject(err);
24677
+ return;
24678
+ }
24679
+ resolve(createIterResult(undefined, true));
24680
+ });
24886
24681
  });
24887
- });
24888
- }), _Object$setPrototypeO), AsyncIteratorPrototype);
24889
-
24890
- var createReadableStreamAsyncIterator = function createReadableStreamAsyncIterator(stream) {
24891
- var _Object$create;
24892
-
24893
- var iterator = Object.create(ReadableStreamAsyncIteratorPrototype, (_Object$create = {}, _defineProperty(_Object$create, kStream, {
24894
- value: stream,
24895
- writable: true
24896
- }), _defineProperty(_Object$create, kLastResolve, {
24897
- value: null,
24898
- writable: true
24899
- }), _defineProperty(_Object$create, kLastReject, {
24900
- value: null,
24901
- writable: true
24902
- }), _defineProperty(_Object$create, kError, {
24903
- value: null,
24904
- writable: true
24905
- }), _defineProperty(_Object$create, kEnded, {
24906
- value: stream._readableState.endEmitted,
24907
- writable: true
24908
- }), _defineProperty(_Object$create, kHandlePromise, {
24909
- value: function value(resolve, reject) {
24910
- var data = iterator[kStream].read();
24911
-
24912
- if (data) {
24913
- iterator[kLastPromise] = null;
24914
- iterator[kLastResolve] = null;
24915
- iterator[kLastReject] = null;
24916
- resolve(createIterResult(data, false));
24917
- } else {
24918
- iterator[kLastResolve] = resolve;
24919
- iterator[kLastReject] = reject;
24920
- }
24682
+ }
24683
+ }, AsyncIteratorPrototype);
24684
+ const createReadableStreamAsyncIterator = stream => {
24685
+ const iterator = Object.create(ReadableStreamAsyncIteratorPrototype, {
24686
+ [kStream]: {
24687
+ value: stream,
24688
+ writable: true
24689
+ },
24690
+ [kLastResolve]: {
24691
+ value: null,
24692
+ writable: true
24921
24693
  },
24922
- writable: true
24923
- }), _Object$create));
24694
+ [kLastReject]: {
24695
+ value: null,
24696
+ writable: true
24697
+ },
24698
+ [kError]: {
24699
+ value: null,
24700
+ writable: true
24701
+ },
24702
+ [kEnded]: {
24703
+ value: stream._readableState.endEmitted,
24704
+ writable: true
24705
+ },
24706
+ // the function passed to new Promise
24707
+ // is cached so we avoid allocating a new
24708
+ // closure at every run
24709
+ [kHandlePromise]: {
24710
+ value: (resolve, reject) => {
24711
+ const data = iterator[kStream].read();
24712
+ if (data) {
24713
+ iterator[kLastPromise] = null;
24714
+ iterator[kLastResolve] = null;
24715
+ iterator[kLastReject] = null;
24716
+ resolve(createIterResult(data, false));
24717
+ } else {
24718
+ iterator[kLastResolve] = resolve;
24719
+ iterator[kLastReject] = reject;
24720
+ }
24721
+ },
24722
+ writable: true
24723
+ }
24724
+ });
24924
24725
  iterator[kLastPromise] = null;
24925
- finished(stream, function (err) {
24726
+ finished(stream, err => {
24926
24727
  if (err && err.code !== 'ERR_STREAM_PREMATURE_CLOSE') {
24927
- var reject = iterator[kLastReject]; // reject if we are waiting for data in the Promise
24728
+ const reject = iterator[kLastReject];
24729
+ // reject if we are waiting for data in the Promise
24928
24730
  // returned by next() and store the error
24929
-
24930
24731
  if (reject !== null) {
24931
24732
  iterator[kLastPromise] = null;
24932
24733
  iterator[kLastResolve] = null;
24933
24734
  iterator[kLastReject] = null;
24934
24735
  reject(err);
24935
24736
  }
24936
-
24937
24737
  iterator[kError] = err;
24938
24738
  return;
24939
24739
  }
24940
-
24941
- var resolve = iterator[kLastResolve];
24942
-
24740
+ const resolve = iterator[kLastResolve];
24943
24741
  if (resolve !== null) {
24944
24742
  iterator[kLastPromise] = null;
24945
24743
  iterator[kLastResolve] = null;
24946
24744
  iterator[kLastReject] = null;
24947
24745
  resolve(createIterResult(undefined, true));
24948
24746
  }
24949
-
24950
24747
  iterator[kEnded] = true;
24951
24748
  });
24952
24749
  stream.on('readable', onReadable.bind(null, iterator));
24953
24750
  return iterator;
24954
24751
  };
24955
-
24956
24752
  module.exports = createReadableStreamAsyncIterator;
24957
24753
  }).call(this)}).call(this,require('_process'))
24958
24754
  },{"./end-of-stream":216,"_process":335}],214:[function(require,module,exports){
24959
24755
  'use strict';
24960
24756
 
24961
- function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); if (enumerableOnly) symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; }); keys.push.apply(keys, symbols); } return keys; }
24962
-
24963
- function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = arguments[i] != null ? arguments[i] : {}; if (i % 2) { ownKeys(Object(source), true).forEach(function (key) { _defineProperty(target, key, source[key]); }); } else if (Object.getOwnPropertyDescriptors) { Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)); } else { ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } } return target; }
24964
-
24965
- function _defineProperty(obj, key, value) { if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24966
-
24967
- function _classCallCheck(instance, Constructor) { if (!(instance instanceof Constructor)) { throw new TypeError("Cannot call a class as a function"); } }
24968
-
24969
- function _defineProperties(target, props) { for (var i = 0; i < props.length; i++) { var descriptor = props[i]; descriptor.enumerable = descriptor.enumerable || false; descriptor.configurable = true; if ("value" in descriptor) descriptor.writable = true; Object.defineProperty(target, descriptor.key, descriptor); } }
24970
-
24971
- function _createClass(Constructor, protoProps, staticProps) { if (protoProps) _defineProperties(Constructor.prototype, protoProps); if (staticProps) _defineProperties(Constructor, staticProps); return Constructor; }
24972
-
24973
- var _require = require('buffer'),
24974
- Buffer = _require.Buffer;
24975
-
24976
- var _require2 = require('util'),
24977
- inspect = _require2.inspect;
24978
-
24979
- var custom = inspect && inspect.custom || 'inspect';
24980
-
24757
+ function ownKeys(object, enumerableOnly) { var keys = Object.keys(object); if (Object.getOwnPropertySymbols) { var symbols = Object.getOwnPropertySymbols(object); enumerableOnly && (symbols = symbols.filter(function (sym) { return Object.getOwnPropertyDescriptor(object, sym).enumerable; })), keys.push.apply(keys, symbols); } return keys; }
24758
+ function _objectSpread(target) { for (var i = 1; i < arguments.length; i++) { var source = null != arguments[i] ? arguments[i] : {}; i % 2 ? ownKeys(Object(source), !0).forEach(function (key) { _defineProperty(target, key, source[key]); }) : Object.getOwnPropertyDescriptors ? Object.defineProperties(target, Object.getOwnPropertyDescriptors(source)) : ownKeys(Object(source)).forEach(function (key) { Object.defineProperty(target, key, Object.getOwnPropertyDescriptor(source, key)); }); } return target; }
24759
+ function _defineProperty(obj, key, value) { key = _toPropertyKey(key); if (key in obj) { Object.defineProperty(obj, key, { value: value, enumerable: true, configurable: true, writable: true }); } else { obj[key] = value; } return obj; }
24760
+ function _toPropertyKey(arg) { var key = _toPrimitive(arg, "string"); return typeof key === "symbol" ? key : String(key); }
24761
+ function _toPrimitive(input, hint) { if (typeof input !== "object" || input === null) return input; var prim = input[Symbol.toPrimitive]; if (prim !== undefined) { var res = prim.call(input, hint || "default"); if (typeof res !== "object") return res; throw new TypeError("@@toPrimitive must return a primitive value."); } return (hint === "string" ? String : Number)(input); }
24762
+ const _require = require('buffer'),
24763
+ Buffer = _require.Buffer;
24764
+ const _require2 = require('util'),
24765
+ inspect = _require2.inspect;
24766
+ const custom = inspect && inspect.custom || 'inspect';
24981
24767
  function copyBuffer(src, target, offset) {
24982
24768
  Buffer.prototype.copy.call(src, target, offset);
24983
24769
  }
24984
-
24985
- module.exports =
24986
- /*#__PURE__*/
24987
- function () {
24988
- function BufferList() {
24989
- _classCallCheck(this, BufferList);
24990
-
24770
+ module.exports = class BufferList {
24771
+ constructor() {
24991
24772
  this.head = null;
24992
24773
  this.tail = null;
24993
24774
  this.length = 0;
24994
24775
  }
24776
+ push(v) {
24777
+ const entry = {
24778
+ data: v,
24779
+ next: null
24780
+ };
24781
+ if (this.length > 0) this.tail.next = entry;else this.head = entry;
24782
+ this.tail = entry;
24783
+ ++this.length;
24784
+ }
24785
+ unshift(v) {
24786
+ const entry = {
24787
+ data: v,
24788
+ next: this.head
24789
+ };
24790
+ if (this.length === 0) this.tail = entry;
24791
+ this.head = entry;
24792
+ ++this.length;
24793
+ }
24794
+ shift() {
24795
+ if (this.length === 0) return;
24796
+ const ret = this.head.data;
24797
+ if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
24798
+ --this.length;
24799
+ return ret;
24800
+ }
24801
+ clear() {
24802
+ this.head = this.tail = null;
24803
+ this.length = 0;
24804
+ }
24805
+ join(s) {
24806
+ if (this.length === 0) return '';
24807
+ var p = this.head;
24808
+ var ret = '' + p.data;
24809
+ while (p = p.next) ret += s + p.data;
24810
+ return ret;
24811
+ }
24812
+ concat(n) {
24813
+ if (this.length === 0) return Buffer.alloc(0);
24814
+ const ret = Buffer.allocUnsafe(n >>> 0);
24815
+ var p = this.head;
24816
+ var i = 0;
24817
+ while (p) {
24818
+ copyBuffer(p.data, ret, i);
24819
+ i += p.data.length;
24820
+ p = p.next;
24821
+ }
24822
+ return ret;
24823
+ }
24995
24824
 
24996
- _createClass(BufferList, [{
24997
- key: "push",
24998
- value: function push(v) {
24999
- var entry = {
25000
- data: v,
25001
- next: null
25002
- };
25003
- if (this.length > 0) this.tail.next = entry;else this.head = entry;
25004
- this.tail = entry;
25005
- ++this.length;
25006
- }
25007
- }, {
25008
- key: "unshift",
25009
- value: function unshift(v) {
25010
- var entry = {
25011
- data: v,
25012
- next: this.head
25013
- };
25014
- if (this.length === 0) this.tail = entry;
25015
- this.head = entry;
25016
- ++this.length;
25017
- }
25018
- }, {
25019
- key: "shift",
25020
- value: function shift() {
25021
- if (this.length === 0) return;
25022
- var ret = this.head.data;
25023
- if (this.length === 1) this.head = this.tail = null;else this.head = this.head.next;
25024
- --this.length;
25025
- return ret;
25026
- }
25027
- }, {
25028
- key: "clear",
25029
- value: function clear() {
25030
- this.head = this.tail = null;
25031
- this.length = 0;
25032
- }
25033
- }, {
25034
- key: "join",
25035
- value: function join(s) {
25036
- if (this.length === 0) return '';
25037
- var p = this.head;
25038
- var ret = '' + p.data;
25039
-
25040
- while (p = p.next) {
25041
- ret += s + p.data;
25042
- }
25043
-
25044
- return ret;
25045
- }
25046
- }, {
25047
- key: "concat",
25048
- value: function concat(n) {
25049
- if (this.length === 0) return Buffer.alloc(0);
25050
- var ret = Buffer.allocUnsafe(n >>> 0);
25051
- var p = this.head;
25052
- var i = 0;
25053
-
25054
- while (p) {
25055
- copyBuffer(p.data, ret, i);
25056
- i += p.data.length;
25057
- p = p.next;
25058
- }
25059
-
25060
- return ret;
25061
- } // Consumes a specified amount of bytes or characters from the buffered data.
25062
-
25063
- }, {
25064
- key: "consume",
25065
- value: function consume(n, hasStrings) {
25066
- var ret;
25067
-
25068
- if (n < this.head.data.length) {
25069
- // `slice` is the same for buffers and strings.
25070
- ret = this.head.data.slice(0, n);
25071
- this.head.data = this.head.data.slice(n);
25072
- } else if (n === this.head.data.length) {
25073
- // First chunk is a perfect match.
25074
- ret = this.shift();
25075
- } else {
25076
- // Result spans more than one buffer.
25077
- ret = hasStrings ? this._getString(n) : this._getBuffer(n);
25078
- }
25079
-
25080
- return ret;
25081
- }
25082
- }, {
25083
- key: "first",
25084
- value: function first() {
25085
- return this.head.data;
25086
- } // Consumes a specified amount of characters from the buffered data.
25087
-
25088
- }, {
25089
- key: "_getString",
25090
- value: function _getString(n) {
25091
- var p = this.head;
25092
- var c = 1;
25093
- var ret = p.data;
25094
- n -= ret.length;
25095
-
25096
- while (p = p.next) {
25097
- var str = p.data;
25098
- var nb = n > str.length ? str.length : n;
25099
- if (nb === str.length) ret += str;else ret += str.slice(0, n);
25100
- n -= nb;
25101
-
25102
- if (n === 0) {
25103
- if (nb === str.length) {
25104
- ++c;
25105
- if (p.next) this.head = p.next;else this.head = this.tail = null;
25106
- } else {
25107
- this.head = p;
25108
- p.data = str.slice(nb);
25109
- }
24825
+ // Consumes a specified amount of bytes or characters from the buffered data.
24826
+ consume(n, hasStrings) {
24827
+ var ret;
24828
+ if (n < this.head.data.length) {
24829
+ // `slice` is the same for buffers and strings.
24830
+ ret = this.head.data.slice(0, n);
24831
+ this.head.data = this.head.data.slice(n);
24832
+ } else if (n === this.head.data.length) {
24833
+ // First chunk is a perfect match.
24834
+ ret = this.shift();
24835
+ } else {
24836
+ // Result spans more than one buffer.
24837
+ ret = hasStrings ? this._getString(n) : this._getBuffer(n);
24838
+ }
24839
+ return ret;
24840
+ }
24841
+ first() {
24842
+ return this.head.data;
24843
+ }
25110
24844
 
25111
- break;
24845
+ // Consumes a specified amount of characters from the buffered data.
24846
+ _getString(n) {
24847
+ var p = this.head;
24848
+ var c = 1;
24849
+ var ret = p.data;
24850
+ n -= ret.length;
24851
+ while (p = p.next) {
24852
+ const str = p.data;
24853
+ const nb = n > str.length ? str.length : n;
24854
+ if (nb === str.length) ret += str;else ret += str.slice(0, n);
24855
+ n -= nb;
24856
+ if (n === 0) {
24857
+ if (nb === str.length) {
24858
+ ++c;
24859
+ if (p.next) this.head = p.next;else this.head = this.tail = null;
24860
+ } else {
24861
+ this.head = p;
24862
+ p.data = str.slice(nb);
25112
24863
  }
25113
-
25114
- ++c;
24864
+ break;
25115
24865
  }
24866
+ ++c;
24867
+ }
24868
+ this.length -= c;
24869
+ return ret;
24870
+ }
25116
24871
 
25117
- this.length -= c;
25118
- return ret;
25119
- } // Consumes a specified amount of bytes from the buffered data.
25120
-
25121
- }, {
25122
- key: "_getBuffer",
25123
- value: function _getBuffer(n) {
25124
- var ret = Buffer.allocUnsafe(n);
25125
- var p = this.head;
25126
- var c = 1;
25127
- p.data.copy(ret);
25128
- n -= p.data.length;
25129
-
25130
- while (p = p.next) {
25131
- var buf = p.data;
25132
- var nb = n > buf.length ? buf.length : n;
25133
- buf.copy(ret, ret.length - n, 0, nb);
25134
- n -= nb;
25135
-
25136
- if (n === 0) {
25137
- if (nb === buf.length) {
25138
- ++c;
25139
- if (p.next) this.head = p.next;else this.head = this.tail = null;
25140
- } else {
25141
- this.head = p;
25142
- p.data = buf.slice(nb);
25143
- }
25144
-
25145
- break;
24872
+ // Consumes a specified amount of bytes from the buffered data.
24873
+ _getBuffer(n) {
24874
+ const ret = Buffer.allocUnsafe(n);
24875
+ var p = this.head;
24876
+ var c = 1;
24877
+ p.data.copy(ret);
24878
+ n -= p.data.length;
24879
+ while (p = p.next) {
24880
+ const buf = p.data;
24881
+ const nb = n > buf.length ? buf.length : n;
24882
+ buf.copy(ret, ret.length - n, 0, nb);
24883
+ n -= nb;
24884
+ if (n === 0) {
24885
+ if (nb === buf.length) {
24886
+ ++c;
24887
+ if (p.next) this.head = p.next;else this.head = this.tail = null;
24888
+ } else {
24889
+ this.head = p;
24890
+ p.data = buf.slice(nb);
25146
24891
  }
25147
-
25148
- ++c;
24892
+ break;
25149
24893
  }
25150
-
25151
- this.length -= c;
25152
- return ret;
25153
- } // Make sure the linked list only shows the minimal necessary information.
25154
-
25155
- }, {
25156
- key: custom,
25157
- value: function value(_, options) {
25158
- return inspect(this, _objectSpread({}, options, {
25159
- // Only inspect one level.
25160
- depth: 0,
25161
- // It should not recurse.
25162
- customInspect: false
25163
- }));
24894
+ ++c;
25164
24895
  }
25165
- }]);
24896
+ this.length -= c;
24897
+ return ret;
24898
+ }
25166
24899
 
25167
- return BufferList;
25168
- }();
24900
+ // Make sure the linked list only shows the minimal necessary information.
24901
+ [custom](_, options) {
24902
+ return inspect(this, _objectSpread(_objectSpread({}, options), {}, {
24903
+ // Only inspect one level.
24904
+ depth: 0,
24905
+ // It should not recurse.
24906
+ customInspect: false
24907
+ }));
24908
+ }
24909
+ };
25169
24910
  },{"buffer":227,"util":179}],215:[function(require,module,exports){
25170
24911
  (function (process){(function (){
25171
- 'use strict'; // undocumented cb() API, needed for core, not for public API
24912
+ 'use strict';
25172
24913
 
24914
+ // undocumented cb() API, needed for core, not for public API
25173
24915
  function destroy(err, cb) {
25174
- var _this = this;
25175
-
25176
- var readableDestroyed = this._readableState && this._readableState.destroyed;
25177
- var writableDestroyed = this._writableState && this._writableState.destroyed;
25178
-
24916
+ const readableDestroyed = this._readableState && this._readableState.destroyed;
24917
+ const writableDestroyed = this._writableState && this._writableState.destroyed;
25179
24918
  if (readableDestroyed || writableDestroyed) {
25180
24919
  if (cb) {
25181
24920
  cb(err);
@@ -25187,53 +24926,48 @@ function destroy(err, cb) {
25187
24926
  process.nextTick(emitErrorNT, this, err);
25188
24927
  }
25189
24928
  }
25190
-
25191
24929
  return this;
25192
- } // we set destroyed to true before firing error callbacks in order
25193
- // to make it re-entrance safe in case destroy() is called within callbacks
24930
+ }
25194
24931
 
24932
+ // we set destroyed to true before firing error callbacks in order
24933
+ // to make it re-entrance safe in case destroy() is called within callbacks
25195
24934
 
25196
24935
  if (this._readableState) {
25197
24936
  this._readableState.destroyed = true;
25198
- } // if this is a duplex stream mark the writable part as destroyed as well
25199
-
24937
+ }
25200
24938
 
24939
+ // if this is a duplex stream mark the writable part as destroyed as well
25201
24940
  if (this._writableState) {
25202
24941
  this._writableState.destroyed = true;
25203
24942
  }
25204
-
25205
- this._destroy(err || null, function (err) {
24943
+ this._destroy(err || null, err => {
25206
24944
  if (!cb && err) {
25207
- if (!_this._writableState) {
25208
- process.nextTick(emitErrorAndCloseNT, _this, err);
25209
- } else if (!_this._writableState.errorEmitted) {
25210
- _this._writableState.errorEmitted = true;
25211
- process.nextTick(emitErrorAndCloseNT, _this, err);
24945
+ if (!this._writableState) {
24946
+ process.nextTick(emitErrorAndCloseNT, this, err);
24947
+ } else if (!this._writableState.errorEmitted) {
24948
+ this._writableState.errorEmitted = true;
24949
+ process.nextTick(emitErrorAndCloseNT, this, err);
25212
24950
  } else {
25213
- process.nextTick(emitCloseNT, _this);
24951
+ process.nextTick(emitCloseNT, this);
25214
24952
  }
25215
24953
  } else if (cb) {
25216
- process.nextTick(emitCloseNT, _this);
24954
+ process.nextTick(emitCloseNT, this);
25217
24955
  cb(err);
25218
24956
  } else {
25219
- process.nextTick(emitCloseNT, _this);
24957
+ process.nextTick(emitCloseNT, this);
25220
24958
  }
25221
24959
  });
25222
-
25223
24960
  return this;
25224
24961
  }
25225
-
25226
24962
  function emitErrorAndCloseNT(self, err) {
25227
24963
  emitErrorNT(self, err);
25228
24964
  emitCloseNT(self);
25229
24965
  }
25230
-
25231
24966
  function emitCloseNT(self) {
25232
24967
  if (self._writableState && !self._writableState.emitClose) return;
25233
24968
  if (self._readableState && !self._readableState.emitClose) return;
25234
24969
  self.emit('close');
25235
24970
  }
25236
-
25237
24971
  function undestroy() {
25238
24972
  if (this._readableState) {
25239
24973
  this._readableState.destroyed = false;
@@ -25241,7 +24975,6 @@ function undestroy() {
25241
24975
  this._readableState.ended = false;
25242
24976
  this._readableState.endEmitted = false;
25243
24977
  }
25244
-
25245
24978
  if (this._writableState) {
25246
24979
  this._writableState.destroyed = false;
25247
24980
  this._writableState.ended = false;
@@ -25252,104 +24985,86 @@ function undestroy() {
25252
24985
  this._writableState.errorEmitted = false;
25253
24986
  }
25254
24987
  }
25255
-
25256
24988
  function emitErrorNT(self, err) {
25257
24989
  self.emit('error', err);
25258
24990
  }
25259
-
25260
24991
  function errorOrDestroy(stream, err) {
25261
24992
  // We have tests that rely on errors being emitted
25262
24993
  // in the same tick, so changing this is semver major.
25263
24994
  // For now when you opt-in to autoDestroy we allow
25264
24995
  // the error to be emitted nextTick. In a future
25265
24996
  // semver major update we should change the default to this.
25266
- var rState = stream._readableState;
25267
- var wState = stream._writableState;
24997
+
24998
+ const rState = stream._readableState;
24999
+ const wState = stream._writableState;
25268
25000
  if (rState && rState.autoDestroy || wState && wState.autoDestroy) stream.destroy(err);else stream.emit('error', err);
25269
25001
  }
25270
-
25271
25002
  module.exports = {
25272
- destroy: destroy,
25273
- undestroy: undestroy,
25274
- errorOrDestroy: errorOrDestroy
25003
+ destroy,
25004
+ undestroy,
25005
+ errorOrDestroy
25275
25006
  };
25276
25007
  }).call(this)}).call(this,require('_process'))
25277
25008
  },{"_process":335}],216:[function(require,module,exports){
25278
25009
  // Ported from https://github.com/mafintosh/end-of-stream with
25279
25010
  // permission from the author, Mathias Buus (@mafintosh).
25280
- 'use strict';
25281
25011
 
25282
- var ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;
25012
+ 'use strict';
25283
25013
 
25014
+ const ERR_STREAM_PREMATURE_CLOSE = require('../../../errors').codes.ERR_STREAM_PREMATURE_CLOSE;
25284
25015
  function once(callback) {
25285
- var called = false;
25016
+ let called = false;
25286
25017
  return function () {
25287
25018
  if (called) return;
25288
25019
  called = true;
25289
-
25290
25020
  for (var _len = arguments.length, args = new Array(_len), _key = 0; _key < _len; _key++) {
25291
25021
  args[_key] = arguments[_key];
25292
25022
  }
25293
-
25294
25023
  callback.apply(this, args);
25295
25024
  };
25296
25025
  }
25297
-
25298
25026
  function noop() {}
25299
-
25300
25027
  function isRequest(stream) {
25301
25028
  return stream.setHeader && typeof stream.abort === 'function';
25302
25029
  }
25303
-
25304
25030
  function eos(stream, opts, callback) {
25305
25031
  if (typeof opts === 'function') return eos(stream, null, opts);
25306
25032
  if (!opts) opts = {};
25307
25033
  callback = once(callback || noop);
25308
- var readable = opts.readable || opts.readable !== false && stream.readable;
25309
- var writable = opts.writable || opts.writable !== false && stream.writable;
25310
-
25311
- var onlegacyfinish = function onlegacyfinish() {
25034
+ let readable = opts.readable || opts.readable !== false && stream.readable;
25035
+ let writable = opts.writable || opts.writable !== false && stream.writable;
25036
+ const onlegacyfinish = () => {
25312
25037
  if (!stream.writable) onfinish();
25313
25038
  };
25314
-
25315
25039
  var writableEnded = stream._writableState && stream._writableState.finished;
25316
-
25317
- var onfinish = function onfinish() {
25040
+ const onfinish = () => {
25318
25041
  writable = false;
25319
25042
  writableEnded = true;
25320
25043
  if (!readable) callback.call(stream);
25321
25044
  };
25322
-
25323
25045
  var readableEnded = stream._readableState && stream._readableState.endEmitted;
25324
-
25325
- var onend = function onend() {
25046
+ const onend = () => {
25326
25047
  readable = false;
25327
25048
  readableEnded = true;
25328
25049
  if (!writable) callback.call(stream);
25329
25050
  };
25330
-
25331
- var onerror = function onerror(err) {
25051
+ const onerror = err => {
25332
25052
  callback.call(stream, err);
25333
25053
  };
25334
-
25335
- var onclose = function onclose() {
25336
- var err;
25337
-
25054
+ const onclose = () => {
25055
+ let err;
25338
25056
  if (readable && !readableEnded) {
25339
25057
  if (!stream._readableState || !stream._readableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
25340
25058
  return callback.call(stream, err);
25341
25059
  }
25342
-
25343
25060
  if (writable && !writableEnded) {
25344
25061
  if (!stream._writableState || !stream._writableState.ended) err = new ERR_STREAM_PREMATURE_CLOSE();
25345
25062
  return callback.call(stream, err);
25346
25063
  }
25347
25064
  };
25348
-
25349
- var onrequest = function onrequest() {
25065
+ const onrequest = () => {
25350
25066
  stream.req.on('finish', onfinish);
25351
25067
  };
25352
-
25353
25068
  if (isRequest(stream)) {
25354
25069
  stream.on('complete', onfinish);
25355
25070
  stream.on('abort', onclose);
@@ -25359,7 +25074,6 @@ function eos(stream, opts, callback) {
25359
25074
  stream.on('end', onlegacyfinish);
25360
25075
  stream.on('close', onlegacyfinish);
25361
25076
  }
25362
-
25363
25077
  stream.on('end', onend);
25364
25078
  stream.on('finish', onfinish);
25365
25079
  if (opts.error !== false) stream.on('error', onerror);
@@ -25377,7 +25091,6 @@ function eos(stream, opts, callback) {
25377
25091
  stream.removeListener('close', onclose);
25378
25092
  };
25379
25093
  }
25380
-
25381
25094
  module.exports = eos;
25382
25095
  },{"../../../errors":207}],217:[function(require,module,exports){
25383
25096
  module.exports = function () {
@@ -25387,89 +25100,79 @@ module.exports = function () {
25387
25100
  },{}],218:[function(require,module,exports){
25388
25101
  // Ported from https://github.com/mafintosh/pump with
25389
25102
  // permission from the author, Mathias Buus (@mafintosh).
25390
- 'use strict';
25391
25103
 
25392
- var eos;
25104
+ 'use strict';
25393
25105
 
25106
+ let eos;
25394
25107
  function once(callback) {
25395
- var called = false;
25108
+ let called = false;
25396
25109
  return function () {
25397
25110
  if (called) return;
25398
25111
  called = true;
25399
- callback.apply(void 0, arguments);
25112
+ callback(...arguments);
25400
25113
  };
25401
25114
  }
25402
-
25403
- var _require$codes = require('../../../errors').codes,
25404
- ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
25405
- ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
25406
-
25115
+ const _require$codes = require('../../../errors').codes,
25116
+ ERR_MISSING_ARGS = _require$codes.ERR_MISSING_ARGS,
25117
+ ERR_STREAM_DESTROYED = _require$codes.ERR_STREAM_DESTROYED;
25407
25118
  function noop(err) {
25408
25119
  // Rethrow the error if it exists to avoid swallowing it
25409
25120
  if (err) throw err;
25410
25121
  }
25411
-
25412
25122
  function isRequest(stream) {
25413
25123
  return stream.setHeader && typeof stream.abort === 'function';
25414
25124
  }
25415
-
25416
25125
  function destroyer(stream, reading, writing, callback) {
25417
25126
  callback = once(callback);
25418
- var closed = false;
25419
- stream.on('close', function () {
25127
+ let closed = false;
25128
+ stream.on('close', () => {
25420
25129
  closed = true;
25421
25130
  });
25422
25131
  if (eos === undefined) eos = require('./end-of-stream');
25423
25132
  eos(stream, {
25424
25133
  readable: reading,
25425
25134
  writable: writing
25426
- }, function (err) {
25135
+ }, err => {
25427
25136
  if (err) return callback(err);
25428
25137
  closed = true;
25429
25138
  callback();
25430
25139
  });
25431
- var destroyed = false;
25432
- return function (err) {
25140
+ let destroyed = false;
25141
+ return err => {
25433
25142
  if (closed) return;
25434
25143
  if (destroyed) return;
25435
- destroyed = true; // request.destroy just do .end - .abort is what we want
25144
+ destroyed = true;
25436
25145
 
25146
+ // request.destroy just do .end - .abort is what we want
25437
25147
  if (isRequest(stream)) return stream.abort();
25438
25148
  if (typeof stream.destroy === 'function') return stream.destroy();
25439
25149
  callback(err || new ERR_STREAM_DESTROYED('pipe'));
25440
25150
  };
25441
25151
  }
25442
-
25443
25152
  function call(fn) {
25444
25153
  fn();
25445
25154
  }
25446
-
25447
25155
  function pipe(from, to) {
25448
25156
  return from.pipe(to);
25449
25157
  }
25450
-
25451
25158
  function popCallback(streams) {
25452
25159
  if (!streams.length) return noop;
25453
25160
  if (typeof streams[streams.length - 1] !== 'function') return noop;
25454
25161
  return streams.pop();
25455
25162
  }
25456
-
25457
25163
  function pipeline() {
25458
25164
  for (var _len = arguments.length, streams = new Array(_len), _key = 0; _key < _len; _key++) {
25459
25165
  streams[_key] = arguments[_key];
25460
25166
  }
25461
-
25462
- var callback = popCallback(streams);
25167
+ const callback = popCallback(streams);
25463
25168
  if (Array.isArray(streams[0])) streams = streams[0];
25464
-
25465
25169
  if (streams.length < 2) {
25466
25170
  throw new ERR_MISSING_ARGS('streams');
25467
25171
  }
25468
-
25469
- var error;
25470
- var destroys = streams.map(function (stream, i) {
25471
- var reading = i < streams.length - 1;
25472
- var writing = i > 0;
25172
+ let error;
25173
+ const destroys = streams.map(function (stream, i) {
25174
+ const reading = i < streams.length - 1;
25175
+ const writing = i > 0;
25473
25176
  return destroyer(stream, reading, writing, function (err) {
25474
25177
  if (!error) error = err;
25475
25178
  if (err) destroys.forEach(call);
@@ -25480,35 +25183,29 @@ function pipeline() {
25480
25183
  });
25481
25184
  return streams.reduce(pipe);
25482
25185
  }
25483
-
25484
25186
  module.exports = pipeline;
25485
25187
  },{"../../../errors":207,"./end-of-stream":216}],219:[function(require,module,exports){
25486
25188
  'use strict';
25487
25189
 
25488
- var ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;
25489
-
25190
+ const ERR_INVALID_OPT_VALUE = require('../../../errors').codes.ERR_INVALID_OPT_VALUE;
25490
25191
  function highWaterMarkFrom(options, isDuplex, duplexKey) {
25491
25192
  return options.highWaterMark != null ? options.highWaterMark : isDuplex ? options[duplexKey] : null;
25492
25193
  }
25493
-
25494
25194
  function getHighWaterMark(state, options, duplexKey, isDuplex) {
25495
- var hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
25496
-
25195
+ const hwm = highWaterMarkFrom(options, isDuplex, duplexKey);
25497
25196
  if (hwm != null) {
25498
25197
  if (!(isFinite(hwm) && Math.floor(hwm) === hwm) || hwm < 0) {
25499
- var name = isDuplex ? duplexKey : 'highWaterMark';
25198
+ const name = isDuplex ? duplexKey : 'highWaterMark';
25500
25199
  throw new ERR_INVALID_OPT_VALUE(name, hwm);
25501
25200
  }
25502
-
25503
25201
  return Math.floor(hwm);
25504
- } // Default value
25505
-
25202
+ }
25506
25203
 
25204
+ // Default value
25507
25205
  return state.objectMode ? 16 : 16 * 1024;
25508
25206
  }
25509
-
25510
25207
  module.exports = {
25511
- getHighWaterMark: getHighWaterMark
25208
+ getHighWaterMark
25512
25209
  };
25513
25210
  },{"../../../errors":207}],220:[function(require,module,exports){
25514
25211
  module.exports = require('events').EventEmitter;
@@ -34126,7 +33823,7 @@ module.exports={
34126
33823
  "_resolved": "https://registry.npmjs.org/elliptic/-/elliptic-6.5.4.tgz",
34127
33824
  "_shasum": "da37cebd31e79a1367e941b592ed1fbebd58abbb",
34128
33825
  "_spec": "elliptic@^6.5.3",
34129
- "_where": "/var/lib/jenkins/workspace/.OnPremise.Agent.JavaScript_main/browser-agent/node_modules/browserify-sign",
33826
+ "_where": "/var/lib/jenkins/workspace/.OnPremise.Agent.JavaScript_main@2/browser-agent/node_modules/browserify-sign",
34130
33827
  "author": {
34131
33828
  "name": "Fedor Indutny",
34132
33829
  "email": "fedor@indutny.com"
@@ -44796,7 +44493,7 @@ var Stream = require('./internal/streams/stream');
44796
44493
  /*<replacement>*/
44797
44494
 
44798
44495
  var Buffer = require('safe-buffer').Buffer;
44799
- var OurUint8Array = global.Uint8Array || function () {};
44496
+ var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
44800
44497
  function _uint8ArrayToBuffer(chunk) {
44801
44498
  return Buffer.from(chunk);
44802
44499
  }
@@ -45366,8 +45063,8 @@ Readable.prototype.pipe = function (dest, pipeOpts) {
45366
45063
  // also returned false.
45367
45064
  // => Check whether `dest` is still a piping destination.
45368
45065
  if ((state.pipesCount === 1 && state.pipes === dest || state.pipesCount > 1 && indexOf(state.pipes, dest) !== -1) && !cleanedUp) {
45369
- debug('false write response, pause', src._readableState.awaitDrain);
45370
- src._readableState.awaitDrain++;
45066
+ debug('false write response, pause', state.awaitDrain);
45067
+ state.awaitDrain++;
45371
45068
  increasedAwaitDrain = true;
45372
45069
  }
45373
45070
  src.pause();
@@ -45461,7 +45158,7 @@ Readable.prototype.unpipe = function (dest) {
45461
45158
  state.flowing = false;
45462
45159
 
45463
45160
  for (var i = 0; i < len; i++) {
45464
- dests[i].emit('unpipe', this, unpipeInfo);
45161
+ dests[i].emit('unpipe', this, { hasUnpiped: false });
45465
45162
  }return this;
45466
45163
  }
45467
45164
 
@@ -46061,7 +45758,7 @@ var Stream = require('./internal/streams/stream');
46061
45758
  /*<replacement>*/
46062
45759
 
46063
45760
  var Buffer = require('safe-buffer').Buffer;
46064
- var OurUint8Array = global.Uint8Array || function () {};
45761
+ var OurUint8Array = (typeof global !== 'undefined' ? global : typeof window !== 'undefined' ? window : typeof self !== 'undefined' ? self : {}).Uint8Array || function () {};
46065
45762
  function _uint8ArrayToBuffer(chunk) {
46066
45763
  return Buffer.from(chunk);
46067
45764
  }
@@ -46329,7 +46026,7 @@ Writable.prototype.uncork = function () {
46329
46026
  if (state.corked) {
46330
46027
  state.corked--;
46331
46028
 
46332
- if (!state.writing && !state.corked && !state.finished && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
46029
+ if (!state.writing && !state.corked && !state.bufferProcessing && state.bufferedRequest) clearBuffer(this, state);
46333
46030
  }
46334
46031
  };
46335
46032
 
@@ -46571,7 +46268,7 @@ Writable.prototype.end = function (chunk, encoding, cb) {
46571
46268
  }
46572
46269
 
46573
46270
  // ignore unnecessary end() calls.
46574
- if (!state.ending && !state.finished) endWritable(this, state, cb);
46271
+ if (!state.ending) endWritable(this, state, cb);
46575
46272
  };
46576
46273
 
46577
46274
  function needFinish(state) {
@@ -46632,11 +46329,9 @@ function onCorkedFinish(corkReq, state, err) {
46632
46329
  cb(err);
46633
46330
  entry = entry.next;
46634
46331
  }
46635
- if (state.corkedRequestsFree) {
46636
- state.corkedRequestsFree.next = corkReq;
46637
- } else {
46638
- state.corkedRequestsFree = corkReq;
46639
- }
46332
+
46333
+ // reuse the free corkReq.
46334
+ state.corkedRequestsFree.next = corkReq;
46640
46335
  }
46641
46336
 
46642
46337
  Object.defineProperty(Writable.prototype, 'destroyed', {
@@ -46725,7 +46420,6 @@ module.exports = function () {
46725
46420
 
46726
46421
  BufferList.prototype.concat = function concat(n) {
46727
46422
  if (this.length === 0) return Buffer.alloc(0);
46728
- if (this.length === 1) return this.head.data;
46729
46423
  var ret = Buffer.allocUnsafe(n >>> 0);
46730
46424
  var p = this.head;
46731
46425
  var i = 0;
@@ -46764,9 +46458,15 @@ function destroy(err, cb) {
46764
46458
  if (readableDestroyed || writableDestroyed) {
46765
46459
  if (cb) {
46766
46460
  cb(err);
46767
- } else if (err && (!this._writableState || !this._writableState.errorEmitted)) {
46768
- pna.nextTick(emitErrorNT, this, err);
46461
+ } else if (err) {
46462
+ if (!this._writableState) {
46463
+ pna.nextTick(emitErrorNT, this, err);
46464
+ } else if (!this._writableState.errorEmitted) {
46465
+ this._writableState.errorEmitted = true;
46466
+ pna.nextTick(emitErrorNT, this, err);
46467
+ }
46769
46468
  }
46469
+
46770
46470
  return this;
46771
46471
  }
46772
46472
 
@@ -46784,9 +46484,11 @@ function destroy(err, cb) {
46784
46484
 
46785
46485
  this._destroy(err || null, function (err) {
46786
46486
  if (!cb && err) {
46787
- pna.nextTick(emitErrorNT, _this, err);
46788
- if (_this._writableState) {
46487
+ if (!_this._writableState) {
46488
+ pna.nextTick(emitErrorNT, _this, err);
46489
+ } else if (!_this._writableState.errorEmitted) {
46789
46490
  _this._writableState.errorEmitted = true;
46491
+ pna.nextTick(emitErrorNT, _this, err);
46790
46492
  }
46791
46493
  } else if (cb) {
46792
46494
  cb(err);
@@ -46808,6 +46510,8 @@ function undestroy() {
46808
46510
  this._writableState.destroyed = false;
46809
46511
  this._writableState.ended = false;
46810
46512
  this._writableState.ending = false;
46513
+ this._writableState.finalCalled = false;
46514
+ this._writableState.prefinished = false;
46811
46515
  this._writableState.finished = false;
46812
46516
  this._writableState.errorEmitted = false;
46813
46517
  }
@@ -53560,7 +53264,7 @@ function extend() {
53560
53264
  if (window && window.performance && typeof window.performance.now === 'function') {
53561
53265
  return performance.now();
53562
53266
  }
53563
- return system_date_1.getSystemDateValueOf();
53267
+ return (0, system_date_1.getSystemDateValueOf)();
53564
53268
  }
53565
53269
  static createAgentConfiguration(configuration) {
53566
53270
  const configLoader = new config_loader_1.ConfigLoader();
@@ -53895,7 +53599,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
53895
53599
  this.instanceAddedForBsid[configuration.buildSessionId] = true;
53896
53600
  const browserAgent = agent_factory_1.AgentFactory.createBrowserAgent(this.window, this.featureDetection, configuration);
53897
53601
  const { enableOpenTelemetry } = configuration;
53898
- events_bridge_1.registerEventsBridge(this.logger, enableOpenTelemetry);
53602
+ (0, events_bridge_1.registerEventsBridge)(this.logger, enableOpenTelemetry);
53899
53603
  if (browserAgent) {
53900
53604
  browserAgent.start();
53901
53605
  this.instances.push(browserAgent);
@@ -54206,7 +53910,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54206
53910
  "use strict";
54207
53911
  Object.defineProperty(exports, "__esModule", { value: true });
54208
53912
  exports.SL_AGENT_TYPE = exports.SL_AGENT_VERSION = void 0;
54209
- exports.SL_AGENT_VERSION = '6.1.309';
53913
+ exports.SL_AGENT_VERSION = '6.1.319';
54210
53914
  exports.SL_AGENT_TYPE = 'browser';
54211
53915
  });
54212
53916
 
@@ -54588,7 +54292,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54588
54292
  const api = require("@opentelemetry/api");
54589
54293
  const const_1 = require("./const");
54590
54294
  const cockpit_notifier_1 = require("../../../common/agent-events/cockpit-notifier");
54591
- exports.registerEvents = (logger, withOpenTelemetry) => {
54295
+ const registerEvents = (logger, withOpenTelemetry) => {
54592
54296
  try {
54593
54297
  let SlContext;
54594
54298
  window.$Sealights.eventsBridge = {
@@ -54636,6 +54340,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54636
54340
  cockpit_notifier_1.CockpitNotifier.sendError(JSON.stringify(error, Object.getOwnPropertyNames(error)));
54637
54341
  }
54638
54342
  };
54343
+ exports.registerEvents = registerEvents;
54639
54344
  });
54640
54345
 
54641
54346
  },{"../../../common/agent-events/cockpit-notifier":459,"./const":423,"@opentelemetry/api":18}],425:[function(require,module,exports){
@@ -54650,16 +54355,44 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54650
54355
  })(function (require, exports) {
54651
54356
  "use strict";
54652
54357
  Object.defineProperty(exports, "__esModule", { value: true });
54653
- exports.CustomFetchInstrumentation = void 0;
54358
+ exports.CustomFetchInstrumentation = exports.handleAddHeaders = void 0;
54654
54359
  const instrumentation_fetch_1 = require("@opentelemetry/instrumentation-fetch");
54655
54360
  const utils_1 = require("../utils");
54361
+ const setPropagationHeaders = (options, contextPropagationHeaders) => {
54362
+ for (const [key, value] of Object.entries(contextPropagationHeaders)) {
54363
+ if (value) {
54364
+ options.headers.set(key, typeof value === 'string' ? value : String(value));
54365
+ }
54366
+ }
54367
+ };
54368
+ function handleAddHeaders(options, spanUrl) {
54369
+ const origin = window.location.origin;
54370
+ const isMatch = spanUrl === null || spanUrl === void 0 ? void 0 : spanUrl.startsWith(origin);
54371
+ if (!isMatch) {
54372
+ return;
54373
+ }
54374
+ const contextPropagationHeaders = (0, utils_1.constructBaggageHeader)();
54375
+ if (options instanceof Request && contextPropagationHeaders) {
54376
+ setPropagationHeaders(options, contextPropagationHeaders);
54377
+ }
54378
+ else if (options.headers instanceof Headers && contextPropagationHeaders) {
54379
+ setPropagationHeaders(options, contextPropagationHeaders);
54380
+ }
54381
+ else if (typeof options.headers === 'object' && options.headers !== null) {
54382
+ for (const [key, value] of Object.entries(contextPropagationHeaders)) {
54383
+ options.headers[key] = value;
54384
+ }
54385
+ }
54386
+ else {
54387
+ const headers = (0, utils_1.constructBaggageHeader)();
54388
+ options.headers = Object.assign({}, headers, options.headers || {});
54389
+ }
54390
+ }
54391
+ exports.handleAddHeaders = handleAddHeaders;
54656
54392
  class CustomFetchInstrumentation extends instrumentation_fetch_1.FetchInstrumentation {
54657
54393
  constructor(config) {
54658
54394
  super(config);
54659
- this['_addHeaders'] = (options) => {
54660
- const headers = utils_1.constructBaggageHeader();
54661
- options.headers = Object.assign({}, headers, options.headers || {});
54662
- };
54395
+ this['_addHeaders'] = (options, spanUrl) => handleAddHeaders(options, spanUrl);
54663
54396
  }
54664
54397
  }
54665
54398
  exports.CustomFetchInstrumentation = CustomFetchInstrumentation;
@@ -54677,18 +54410,25 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54677
54410
  })(function (require, exports) {
54678
54411
  "use strict";
54679
54412
  Object.defineProperty(exports, "__esModule", { value: true });
54680
- exports.CustomXMLHttpRequestInstrumentation = void 0;
54413
+ exports.CustomXMLHttpRequestInstrumentation = exports.handleAddHeaders = void 0;
54681
54414
  const instrumentation_xml_http_request_1 = require("@opentelemetry/instrumentation-xml-http-request");
54682
54415
  const utils_1 = require("../utils");
54416
+ function handleAddHeaders(xhr, spanUrl) {
54417
+ var _a;
54418
+ const origin = window.location.origin;
54419
+ const isMatch = spanUrl === null || spanUrl === void 0 ? void 0 : spanUrl.startsWith(origin);
54420
+ if (!isMatch) {
54421
+ return;
54422
+ }
54423
+ const headers = (0, utils_1.constructBaggageHeader)();
54424
+ if ((_a = headers === null || headers === void 0 ? void 0 : headers.baggage) === null || _a === void 0 ? void 0 : _a.length)
54425
+ xhr.setRequestHeader('baggage', headers.baggage);
54426
+ }
54427
+ exports.handleAddHeaders = handleAddHeaders;
54683
54428
  class CustomXMLHttpRequestInstrumentation extends instrumentation_xml_http_request_1.XMLHttpRequestInstrumentation {
54684
54429
  constructor(config) {
54685
54430
  super(config);
54686
- this['_addHeaders'] = (xhr) => {
54687
- var _a;
54688
- const headers = utils_1.constructBaggageHeader();
54689
- if ((_a = headers === null || headers === void 0 ? void 0 : headers.baggage) === null || _a === void 0 ? void 0 : _a.length)
54690
- xhr.setRequestHeader('baggage', headers.baggage);
54691
- };
54431
+ this['_addHeaders'] = (xhr, spanUrl) => handleAddHeaders(xhr, spanUrl);
54692
54432
  }
54693
54433
  }
54694
54434
  exports.CustomXMLHttpRequestInstrumentation = CustomXMLHttpRequestInstrumentation;
@@ -54710,14 +54450,20 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54710
54450
  const otel_1 = require("./otel");
54711
54451
  const events_1 = require("./events");
54712
54452
  const const_1 = require("./const");
54713
- exports.registerEventsBridge = (logger, enableOpenTelemetry) => {
54714
- events_1.registerEvents(logger, enableOpenTelemetry);
54715
- if (enableOpenTelemetry) {
54716
- otel_1.registerOpenTelemetry(logger);
54453
+ const registerEventsBridge = (logger, enableOpenTelemetry) => {
54454
+ var _a, _b, _c, _d;
54455
+ const eventsBridgeRegistered = (_b = (_a = window.$Sealights) === null || _a === void 0 ? void 0 : _a.eventsBridge) === null || _b === void 0 ? void 0 : _b.loaded;
54456
+ const otelRegistered = (_d = (_c = window.$Sealights) === null || _c === void 0 ? void 0 : _c.eventsBridge) === null || _d === void 0 ? void 0 : _d.otel;
54457
+ if (!eventsBridgeRegistered) {
54458
+ (0, events_1.registerEvents)(logger, enableOpenTelemetry);
54459
+ }
54460
+ if (enableOpenTelemetry && !otelRegistered) {
54461
+ (0, otel_1.registerOpenTelemetry)(logger);
54717
54462
  }
54718
54463
  const event = new Event(const_1.EVENTS.READY_EVENTS_BRIDGE);
54719
54464
  window.dispatchEvent(event);
54720
54465
  };
54466
+ exports.registerEventsBridge = registerEventsBridge;
54721
54467
  });
54722
54468
 
54723
54469
  },{"./const":423,"./events":424,"./otel":428}],428:[function(require,module,exports){
@@ -54737,9 +54483,9 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54737
54483
  const CustomFetchInstrumentation_1 = require("./implementations/CustomFetchInstrumentation");
54738
54484
  const CustomXMLHttpRequestInstrumentation_1 = require("./implementations/CustomXMLHttpRequestInstrumentation");
54739
54485
  const cockpit_notifier_1 = require("../../../common/agent-events/cockpit-notifier");
54740
- exports.registerOpenTelemetry = (logger) => {
54486
+ const registerOpenTelemetry = (logger) => {
54741
54487
  try {
54742
- instrumentation_1.registerInstrumentations({
54488
+ (0, instrumentation_1.registerInstrumentations)({
54743
54489
  instrumentations: [
54744
54490
  new CustomFetchInstrumentation_1.CustomFetchInstrumentation(),
54745
54491
  new CustomXMLHttpRequestInstrumentation_1.CustomXMLHttpRequestInstrumentation(),
@@ -54752,6 +54498,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54752
54498
  cockpit_notifier_1.CockpitNotifier.sendError(JSON.stringify(error, Object.getOwnPropertyNames(error)));
54753
54499
  }
54754
54500
  };
54501
+ exports.registerOpenTelemetry = registerOpenTelemetry;
54755
54502
  });
54756
54503
 
54757
54504
  },{"../../../common/agent-events/cockpit-notifier":459,"./implementations/CustomFetchInstrumentation":425,"./implementations/CustomXMLHttpRequestInstrumentation":426,"@opentelemetry/instrumentation":98}],429:[function(require,module,exports){
@@ -54767,7 +54514,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54767
54514
  "use strict";
54768
54515
  Object.defineProperty(exports, "__esModule", { value: true });
54769
54516
  exports.constructBaggageHeader = void 0;
54770
- exports.constructBaggageHeader = () => {
54517
+ const constructBaggageHeader = () => {
54771
54518
  var _a, _b;
54772
54519
  const { getBaggage } = ((_a = window.$Sealights) === null || _a === void 0 ? void 0 : _a.eventsBridge) || {};
54773
54520
  const baggage = (_b = getBaggage === null || getBaggage === void 0 ? void 0 : getBaggage()) !== null && _b !== void 0 ? _b : {};
@@ -54782,6 +54529,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
54782
54529
  .join(),
54783
54530
  };
54784
54531
  };
54532
+ exports.constructBaggageHeader = constructBaggageHeader;
54785
54533
  });
54786
54534
 
54787
54535
  },{}],430:[function(require,module,exports){
@@ -55012,10 +54760,10 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
55012
54760
  return request;
55013
54761
  }
55014
54762
  sleep(millis) {
55015
- const start = system_date_1.getSystemDateValueOf();
54763
+ const start = (0, system_date_1.getSystemDateValueOf)();
55016
54764
  let end = null;
55017
54765
  do {
55018
- end = system_date_1.getSystemDateValueOf();
54766
+ end = (0, system_date_1.getSystemDateValueOf)();
55019
54767
  } while (end - start < millis);
55020
54768
  }
55021
54769
  hasApps(request) {
@@ -55069,7 +54817,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
55069
54817
  this.resetState();
55070
54818
  const result = this.createFootprintsFile();
55071
54819
  const app = result.apps[0];
55072
- const localTime = mockTime ? mockTime : system_date_1.getSystemDateValueOf();
54820
+ const localTime = mockTime ? mockTime : (0, system_date_1.getSystemDateValueOf)();
55073
54821
  const test = this.getOrCreateTestData(testName, executionId, localTime, result);
55074
54822
  for (const moduleName in istanbulFootprints) {
55075
54823
  const istanbulModule = istanbulFootprints[moduleName];
@@ -55277,7 +55025,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
55277
55025
  return result;
55278
55026
  }
55279
55027
  formatLoc(loc) {
55280
- return location_formatter_1.formatLocation(loc, this.logger);
55028
+ return (0, location_formatter_1.formatLocation)(loc, this.logger);
55281
55029
  }
55282
55030
  }
55283
55031
  exports.IstanbulToFootprintsConvertorV3 = IstanbulToFootprintsConvertorV3;
@@ -55558,7 +55306,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
55558
55306
  return;
55559
55307
  const logObject = {
55560
55308
  level: logLevel.toUpperCase(),
55561
- ts: system_date_1.getSystemDate().toISOString(),
55309
+ ts: (0, system_date_1.getSystemDate)().toISOString(),
55562
55310
  msg: logMsg ? logMsg.toString() : undefined
55563
55311
  };
55564
55312
  const ctx = this.context;
@@ -55789,7 +55537,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
55789
55537
  return;
55790
55538
  }
55791
55539
  footprintsItem = footprintsItem || new footprints_item_data_1.FootprintsItemData();
55792
- footprintsItem.localTime = system_date_1.getSystemDateValueOf();
55540
+ footprintsItem.localTime = (0, system_date_1.getSystemDateValueOf)();
55793
55541
  this.queue.push(footprintsItem);
55794
55542
  this.queueSize++;
55795
55543
  this.checkQueueSize();
@@ -56018,7 +55766,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56018
55766
  throw new Error('\'delete\' not implemented yet');
56019
55767
  }
56020
55768
  get(urlPath, callback, isNotFoundAcceptable = true, async = false) {
56021
- urlPath = this.serverUrl + urlPath;
55769
+ urlPath = `${this.getBaseUrl()}${urlPath}`;
56022
55770
  const onSuccess = (response) => callback(null, response, response.statusCode);
56023
55771
  const onError = (response) => {
56024
55772
  const error = new Error(response.responseText);
@@ -56030,7 +55778,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56030
55778
  throw new Error('\'delete\' not implemented yet');
56031
55779
  }
56032
55780
  post(requestData, urlPath, callback, async = true, contentType) {
56033
- urlPath = `${this.getBaseUrlForPostRequest()}${urlPath}`;
55781
+ urlPath = `${this.getBaseUrl()}${urlPath}`;
56034
55782
  const onSuccess = (response) => callback(null, response, response.statusCode);
56035
55783
  const onError = (response) => {
56036
55784
  const error = new Error(response.responseText);
@@ -56041,7 +55789,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56041
55789
  postMultipart(requestData, urlPath, callback) {
56042
55790
  throw new Error('\'postMultipart\' not implemented yet');
56043
55791
  }
56044
- getBaseUrlForPostRequest() {
55792
+ getBaseUrl() {
56045
55793
  if (this.collectorUrl) {
56046
55794
  return this.collectorUrl;
56047
55795
  }
@@ -56800,7 +56548,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56800
56548
  }
56801
56549
  submitEvent(code, data) {
56802
56550
  this.submittedEventsMap.set(code, true);
56803
- this._logger.debug(`About to send event with code '${code}', current time: ${system_date_1.getSystemDateValueOf()}`);
56551
+ this._logger.debug(`About to send event with code '${code}', current time: ${(0, system_date_1.getSystemDateValueOf)()}`);
56804
56552
  const event = this.buildEvent(code, data);
56805
56553
  this.submitAgentEventRequest(event).then(() => this._logger.debug(`Event with code '${code}' submitted successfully`));
56806
56554
  }
@@ -56826,7 +56574,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56826
56574
  this.submitAgentEventRequest(events).then(() => this.logger.debug(`'${events.length}' events were submitted successfully`));
56827
56575
  }
56828
56576
  sendMessage(message, code) {
56829
- this.logger.debug(`About to send message '${message}' with code '${code}', current time: ${system_date_1.getSystemDateValueOf()}`);
56577
+ this.logger.debug(`About to send message '${message}' with code '${code}', current time: ${(0, system_date_1.getSystemDateValueOf)()}`);
56830
56578
  const messageEvent = this.buildEvent(code, message);
56831
56579
  this.submitAgentEventRequest(messageEvent).then(() => this.logger.debug('Message submitted successfully'));
56832
56580
  }
@@ -56886,7 +56634,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56886
56634
  buildEvent(type, data) {
56887
56635
  return {
56888
56636
  type: type,
56889
- utcTimestamp_ms: system_date_1.getSystemDateValueOf(),
56637
+ utcTimestamp_ms: (0, system_date_1.getSystemDateValueOf)(),
56890
56638
  data: data
56891
56639
  };
56892
56640
  }
@@ -56922,7 +56670,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
56922
56670
  const cockpit_notifier_1 = require("./cockpit-notifier");
56923
56671
  class AgentEventsGuard {
56924
56672
  static notifyIfNeeded(eventCode, data) {
56925
- const currentTime = system_date_1.getSystemDateValueOf();
56673
+ const currentTime = (0, system_date_1.getSystemDateValueOf)();
56926
56674
  const lastCallTime = AgentEventsGuard.EVENT_CODE_TO_LAST_CALL.get(eventCode);
56927
56675
  if (!lastCallTime || currentTime - lastCallTime >= AgentEventsGuard.DEFAULT_FIVE_MIN_BUFFER) {
56928
56676
  cockpit_notifier_1.CockpitNotifier.sendEvent(eventCode, data);
@@ -57000,7 +56748,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
57000
56748
  const slEnvVars = {};
57001
56749
  Object.keys(process.env).forEach(key => {
57002
56750
  if (key.indexOf(SEALIGHTS_ENV_VAR_PREFIX) === 0 || key === 'NODE_OPTIONS') {
57003
- slEnvVars[key] = sensitive_data_filter_1.isSensitive(key, process.env[key], this.logger) ?
56751
+ slEnvVars[key] = (0, sensitive_data_filter_1.isSensitive)(key, process.env[key], this.logger) ?
57004
56752
  AgentInstanceInfoBuilder.SECRET_VALUE_PLACEHOLDER : process.env[key];
57005
56753
  }
57006
56754
  });
@@ -57225,7 +56973,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
57225
56973
  this.info = {};
57226
56974
  }
57227
56975
  fillData() {
57228
- const currentDate = system_date_1.getSystemDate();
56976
+ const currentDate = (0, system_date_1.getSystemDate)();
57229
56977
  this.info.machineName = os.hostname();
57230
56978
  this.info.arch = os.arch();
57231
56979
  this.info.os = os.platform();
@@ -57443,7 +57191,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
57443
57191
  const packageJsonFilePath = files_utils_1.FilesUtils.findFileUp('package.json', __dirname);
57444
57192
  if (packageJsonFilePath) {
57445
57193
  try {
57446
- const packageJson = fs_1.readFileSync(packageJsonFilePath).toString();
57194
+ const packageJson = (0, fs_1.readFileSync)(packageJsonFilePath).toString();
57447
57195
  const parsed = JSON.parse(packageJson);
57448
57196
  return parsed.version;
57449
57197
  }
@@ -58474,17 +58222,17 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
58474
58222
  const files_utils_1 = require("../utils/files-utils");
58475
58223
  const istanbul_unique_id_converter_1 = require("./istanbul-unique-id-converter");
58476
58224
  function resolveNewId(uniqueIdKey, moduleName, relativePath, coverageObject, logger) {
58477
- moduleName = path_1.normalize(moduleName);
58225
+ moduleName = (0, path_1.normalize)(moduleName);
58478
58226
  const moduleData = resolveModule(coverageObject, moduleName, logger);
58479
58227
  if (!moduleData) {
58480
58228
  return;
58481
58229
  }
58482
58230
  if (!moduleData.uniqueIdsMap) {
58483
58231
  logger.debug(`building uniqueids map for ${moduleData.path}`);
58484
- const before = system_date_1.getSystemDateValueOf();
58232
+ const before = (0, system_date_1.getSystemDateValueOf)();
58485
58233
  logger.debug(`file ${moduleData.path} not contains uniqueIdMaps, trying to reload`);
58486
58234
  createSLMapping(moduleData.path, relativePath, coverageObject, logger);
58487
- const after = system_date_1.getSystemDateValueOf();
58235
+ const after = (0, system_date_1.getSystemDateValueOf)();
58488
58236
  logger.debug('*******************************create unique id map ******************************************');
58489
58237
  logger.debug(after - before);
58490
58238
  logger.debug('*******************************create unique id map ******************************************');
@@ -58958,7 +58706,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
58958
58706
  class EventsCreator {
58959
58707
  static createTestStartedEvent(executionId, framework, testName, duration) {
58960
58708
  const eventBase = this.createEvent(events_contracts_1.EventTypes.TestStart, executionId, framework);
58961
- const startTimeStamp = system_date_1.getSystemDateValueOf() - duration;
58709
+ const startTimeStamp = (0, system_date_1.getSystemDateValueOf)() - duration;
58962
58710
  eventBase.localTime = startTimeStamp;
58963
58711
  return Object.assign(Object.assign({}, eventBase), { testName });
58964
58712
  }
@@ -58973,7 +58721,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
58973
58721
  type,
58974
58722
  executionId,
58975
58723
  framework,
58976
- localTime: system_date_1.getSystemDateValueOf()
58724
+ localTime: (0, system_date_1.getSystemDateValueOf)()
58977
58725
  };
58978
58726
  }
58979
58727
  }
@@ -59028,7 +58776,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59028
58776
  this.init();
59029
58777
  }
59030
58778
  enqueueEvent(evt) {
59031
- evt.localTime = evt.localTime || system_date_1.getSystemDateValueOf();
58779
+ evt.localTime = evt.localTime || (0, system_date_1.getSystemDateValueOf)();
59032
58780
  this._eventsQueue.enqueue(evt);
59033
58781
  if (this.isRunning && this.configuration.sendEvents.value && this.configuration.enabled.value) {
59034
58782
  this.ensureKeepaliveThreadRunning();
@@ -59112,7 +58860,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59112
58860
  events: items,
59113
58861
  meta: {
59114
58862
  sequence: ++this.sequence,
59115
- generated: system_date_1.getSystemDateValueOf(),
58863
+ generated: (0, system_date_1.getSystemDateValueOf)(),
59116
58864
  agentId: this._agentInstanceData.agentId,
59117
58865
  },
59118
58866
  };
@@ -59213,7 +58961,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59213
58961
  return locations[leaveIdx].start || locations[leaveIdx].st;
59214
58962
  }
59215
58963
  formatLoc(loc) {
59216
- return location_formatter_1.formatLocation(loc, this.logger);
58964
+ return (0, location_formatter_1.formatLocation)(loc, this.logger);
59217
58965
  }
59218
58966
  tryGetUniqueIdFromSlMapping(rawUniqueId) {
59219
58967
  rawUniqueId = files_utils_1.FilesUtils.adjustPathSlashes(rawUniqueId);
@@ -59510,7 +59258,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59510
59258
  if (v !== undefined) module.exports = v;
59511
59259
  }
59512
59260
  else if (typeof define === "function" && define.amd) {
59513
- define(["require", "exports", "../constants/sl-env-vars", "../coverage-elements/original-module-loader"], factory);
59261
+ define(["require", "exports", "../constants/sl-env-vars", "../coverage-elements/original-module-loader", "../agent-events/cockpit-notifier"], factory);
59514
59262
  }
59515
59263
  })(function (require, exports) {
59516
59264
  "use strict";
@@ -59518,9 +59266,11 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59518
59266
  exports.HitsCollector = void 0;
59519
59267
  const sl_env_vars_1 = require("../constants/sl-env-vars");
59520
59268
  const original_module_loader_1 = require("../coverage-elements/original-module-loader");
59269
+ const cockpit_notifier_1 = require("../agent-events/cockpit-notifier");
59521
59270
  const GLOBAL_ISTANBUL_CONTAINER_NAMES = ['__coverage__'];
59522
59271
  class HitsCollector {
59523
59272
  constructor(logger, globalCoverageObject) {
59273
+ this.errors = [];
59524
59274
  this.logger = logger;
59525
59275
  this._globalCoverageObject = globalCoverageObject;
59526
59276
  this.latestCoverageSnapshot = {};
@@ -59667,12 +59417,18 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59667
59417
  this._latestCoverageSnapshot[istanbulModule].f[funcId] = f[funcId];
59668
59418
  }
59669
59419
  }
59420
+ sendErrors() {
59421
+ if (this.errors.length > 0) {
59422
+ const data = JSON.stringify(this.errors);
59423
+ cockpit_notifier_1.CockpitNotifier.sendGenericMessage(`Errors during hit collection: ${data}`);
59424
+ }
59425
+ }
59670
59426
  }
59671
59427
  exports.HitsCollector = HitsCollector;
59672
59428
  });
59673
59429
 
59674
59430
  }).call(this)}).call(this,typeof global !== "undefined" ? global : typeof self !== "undefined" ? self : typeof window !== "undefined" ? window : {})
59675
- },{"../constants/sl-env-vars":472,"../coverage-elements/original-module-loader":477}],488:[function(require,module,exports){
59431
+ },{"../agent-events/cockpit-notifier":459,"../constants/sl-env-vars":472,"../coverage-elements/original-module-loader":477}],488:[function(require,module,exports){
59676
59432
  (function (factory) {
59677
59433
  if (typeof module === "object" && typeof module.exports === "object") {
59678
59434
  var v = factory(require, exports);
@@ -59781,7 +59537,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59781
59537
  const idParts = this.resolveIdParts(startLoc, relativePath, absolutePath);
59782
59538
  if (sl_env_vars_1.SlEnvVars.isUseNewUniqueId()) {
59783
59539
  const uniqueIdKey = idParts.relativePath + '@' + this.formatLoc(idParts.start);
59784
- const uniqueId = new_id_resolver_1.resolveNewId(uniqueIdKey, idParts.absolutePath, idParts.relativePath, hits_collector_1.HitsCollector.resolveGlobalCoverageObject(), this.logger);
59540
+ const uniqueId = (0, new_id_resolver_1.resolveNewId)(uniqueIdKey, idParts.absolutePath, idParts.relativePath, hits_collector_1.HitsCollector.resolveGlobalCoverageObject(), this.logger);
59785
59541
  if (uniqueId) {
59786
59542
  return uniqueId;
59787
59543
  }
@@ -59793,7 +59549,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59793
59549
  const parts = this.resolveIdParts(startLoc, relativePath, absolutePath);
59794
59550
  if (sl_env_vars_1.SlEnvVars.isUseNewUniqueId()) {
59795
59551
  const uniqueIdKey = parts.relativePath + '|' + this.formatLoc(parts.start) + '|' + leaveIndex;
59796
- uniqueId = new_id_resolver_1.resolveNewId(uniqueIdKey, parts.absolutePath, parts.relativePath, hits_collector_1.HitsCollector.resolveGlobalCoverageObject(), this.logger);
59552
+ uniqueId = (0, new_id_resolver_1.resolveNewId)(uniqueIdKey, parts.absolutePath, parts.relativePath, hits_collector_1.HitsCollector.resolveGlobalCoverageObject(), this.logger);
59797
59553
  }
59798
59554
  if (!uniqueId) {
59799
59555
  uniqueId = parts.relativePath + HitsConverter.BRANCH_ID_DEL + this.formatLoc(parts.start) + HitsConverter.BRANCH_ID_DEL + leaveIndex;
@@ -59964,6 +59720,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
59964
59720
  stop() {
59965
59721
  return __awaiter(this, void 0, void 0, function* () {
59966
59722
  this.sendToServerWatchdog.stop();
59723
+ this.hitsCollector.sendErrors();
59967
59724
  if (!this.shouldSubmitFootprints()) {
59968
59725
  this.isRunning = false;
59969
59726
  return;
@@ -60203,13 +59960,13 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
60203
59960
  class CollectionInterval {
60204
59961
  constructor(intervalInMS) {
60205
59962
  this.intervalInSeconds = this.toSeconds(intervalInMS);
60206
- this.start = this.toSeconds(system_date_1.getSystemDateValueOf());
59963
+ this.start = this.toSeconds((0, system_date_1.getSystemDateValueOf)());
60207
59964
  }
60208
59965
  next() {
60209
59966
  if (this.end) {
60210
59967
  this.start = this.end;
60211
59968
  }
60212
- this.end = this.toSeconds(system_date_1.getSystemDateValueOf());
59969
+ this.end = this.toSeconds((0, system_date_1.getSystemDateValueOf)());
60213
59970
  if ((this.end - this.start) > this.intervalInSeconds) {
60214
59971
  this.start = this.end - this.intervalInSeconds;
60215
59972
  }
@@ -60620,7 +60377,7 @@ var __awaiter = (this && this.__awaiter) || function (thisArg, _arguments, P, ge
60620
60377
  exports.GetRemoteConfigRequest = GetRemoteConfigRequest;
60621
60378
  class SubmitLogsRequest {
60622
60379
  constructor() {
60623
- this.creationTime = system_date_1.getSystemDateValueOf();
60380
+ this.creationTime = (0, system_date_1.getSystemDateValueOf)();
60624
60381
  }
60625
60382
  }
60626
60383
  exports.SubmitLogsRequest = SubmitLogsRequest;