@cj-tech-master/excelts 4.2.0 → 4.2.1-canary.20260112134913.a3cecdd

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 (317) hide show
  1. package/THIRD_PARTY_NOTICES.md +0 -31
  2. package/dist/browser/index.browser.d.ts +1 -0
  3. package/dist/browser/index.browser.js +12 -0
  4. package/dist/{types/modules/archive → browser/modules/archive/compression}/compress.base.d.ts +1 -0
  5. package/dist/browser/modules/archive/{compress.base.js → compression/compress.base.js} +2 -1
  6. package/dist/{types/modules/archive → browser/modules/archive/compression}/compress.browser.d.ts +10 -8
  7. package/dist/{esm/modules/archive → browser/modules/archive/compression}/compress.browser.js +18 -19
  8. package/dist/browser/modules/archive/{compress.d.ts → compression/compress.d.ts} +2 -2
  9. package/dist/browser/modules/archive/{compress.js → compression/compress.js} +1 -1
  10. package/dist/browser/modules/archive/{crc32.browser.d.ts → compression/crc32.browser.d.ts} +1 -1
  11. package/dist/browser/modules/archive/{crc32.d.ts → compression/crc32.d.ts} +1 -1
  12. package/dist/browser/modules/archive/{crc32.js → compression/crc32.js} +1 -1
  13. package/dist/browser/modules/archive/{deflate-fallback.js → compression/deflate-fallback.js} +1 -1
  14. package/dist/browser/modules/archive/{streaming-compress.browser.d.ts → compression/streaming-compress.browser.d.ts} +2 -2
  15. package/dist/browser/modules/archive/{streaming-compress.browser.js → compression/streaming-compress.browser.js} +3 -3
  16. package/dist/browser/modules/archive/{streaming-compress.d.ts → compression/streaming-compress.d.ts} +2 -2
  17. package/dist/browser/modules/archive/{streaming-compress.js → compression/streaming-compress.js} +2 -2
  18. package/dist/browser/modules/archive/defaults.d.ts +1 -0
  19. package/dist/browser/modules/archive/defaults.js +6 -3
  20. package/dist/browser/modules/archive/index.base.d.ts +4 -4
  21. package/dist/browser/modules/archive/index.base.js +3 -6
  22. package/dist/browser/modules/archive/index.browser.d.ts +3 -4
  23. package/dist/browser/modules/archive/index.browser.js +3 -7
  24. package/dist/browser/modules/archive/index.d.ts +3 -4
  25. package/dist/browser/modules/archive/index.js +3 -5
  26. package/dist/browser/modules/archive/internal/byte-queue.d.ts +33 -0
  27. package/dist/browser/modules/archive/internal/byte-queue.js +407 -0
  28. package/dist/browser/modules/archive/io/archive-sink.d.ts +8 -0
  29. package/dist/browser/modules/archive/io/archive-sink.js +45 -0
  30. package/dist/browser/modules/archive/io/archive-source.d.ts +6 -0
  31. package/dist/browser/modules/archive/io/archive-source.js +100 -0
  32. package/dist/browser/modules/archive/{extract.d.ts → unzip/extract.d.ts} +2 -2
  33. package/dist/browser/modules/archive/unzip/index.d.ts +40 -0
  34. package/dist/browser/modules/archive/unzip/index.js +164 -0
  35. package/dist/browser/modules/archive/{parse.base.d.ts → unzip/stream.base.d.ts} +58 -3
  36. package/dist/browser/modules/archive/unzip/stream.base.js +1022 -0
  37. package/dist/browser/modules/archive/{parse.browser.d.ts → unzip/stream.browser.d.ts} +1 -1
  38. package/dist/browser/modules/archive/{parse.browser.js → unzip/stream.browser.js} +376 -110
  39. package/dist/browser/modules/archive/{parse.d.ts → unzip/stream.d.ts} +2 -2
  40. package/dist/{esm/modules/archive/parse.js → browser/modules/archive/unzip/stream.js} +7 -6
  41. package/dist/{types/modules/archive → browser/modules/archive/unzip}/zip-parser.d.ts +1 -1
  42. package/dist/{esm/modules/archive → browser/modules/archive/unzip}/zip-parser.js +38 -24
  43. package/dist/browser/modules/archive/utils/async-queue.d.ts +7 -0
  44. package/dist/browser/modules/archive/utils/async-queue.js +103 -0
  45. package/dist/browser/modules/archive/utils/bytes.js +16 -16
  46. package/dist/browser/modules/archive/utils/compressibility.d.ts +10 -0
  47. package/dist/browser/modules/archive/utils/compressibility.js +57 -0
  48. package/dist/browser/modules/archive/utils/parse-buffer.js +21 -23
  49. package/dist/browser/modules/archive/utils/pattern-scanner.d.ts +21 -0
  50. package/dist/browser/modules/archive/utils/pattern-scanner.js +27 -0
  51. package/dist/browser/modules/archive/utils/timestamps.js +62 -1
  52. package/dist/browser/modules/archive/utils/zip-extra-fields.d.ts +1 -1
  53. package/dist/browser/modules/archive/utils/zip-extra-fields.js +26 -14
  54. package/dist/browser/modules/archive/zip/index.d.ts +42 -0
  55. package/dist/browser/modules/archive/zip/index.js +157 -0
  56. package/dist/browser/modules/archive/{streaming-zip.d.ts → zip/stream.d.ts} +28 -5
  57. package/dist/browser/modules/archive/{streaming-zip.js → zip/stream.js} +192 -48
  58. package/dist/browser/modules/archive/zip/zip-bytes.d.ts +73 -0
  59. package/dist/browser/modules/archive/zip/zip-bytes.js +239 -0
  60. package/dist/{esm/modules/archive → browser/modules/archive/zip}/zip-entry-metadata.js +3 -3
  61. package/dist/browser/modules/archive/{zip-records.d.ts → zip-spec/zip-records.d.ts} +20 -0
  62. package/dist/browser/modules/archive/zip-spec/zip-records.js +126 -0
  63. package/dist/browser/modules/excel/form-control.d.ts +2 -0
  64. package/dist/browser/modules/excel/form-control.js +54 -16
  65. package/dist/browser/modules/excel/stream/workbook-reader.browser.js +1 -1
  66. package/dist/browser/modules/excel/stream/workbook-writer.browser.d.ts +1 -1
  67. package/dist/browser/modules/excel/stream/workbook-writer.browser.js +1 -1
  68. package/dist/browser/modules/excel/utils/ooxml-validator.d.ts +48 -0
  69. package/dist/browser/modules/excel/utils/ooxml-validator.js +469 -0
  70. package/dist/browser/modules/excel/worksheet.js +5 -2
  71. package/dist/browser/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.d.ts +1 -0
  72. package/dist/browser/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +13 -1
  73. package/dist/browser/modules/excel/xlsx/xform/drawing/sp-xform.d.ts +18 -0
  74. package/dist/browser/modules/excel/xlsx/xform/drawing/sp-xform.js +112 -0
  75. package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +6 -1
  76. package/dist/browser/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +30 -2
  77. package/dist/browser/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +11 -0
  78. package/dist/browser/modules/excel/xlsx/xform/sheet/page-setup-xform.d.ts +1 -0
  79. package/dist/browser/modules/excel/xlsx/xform/sheet/page-setup-xform.js +16 -2
  80. package/dist/browser/modules/excel/xlsx/xform/sheet/worksheet-xform.js +117 -5
  81. package/dist/browser/modules/excel/xlsx/xlsx.browser.js +3 -6
  82. package/dist/browser/modules/excel/xlsx/xlsx.js +1 -1
  83. package/dist/browser/modules/stream/base-transform.d.ts +3 -0
  84. package/dist/browser/modules/stream/base-transform.js +34 -20
  85. package/dist/browser/modules/stream/buffered-stream.d.ts +2 -12
  86. package/dist/browser/modules/stream/chunked-builder.js +4 -4
  87. package/dist/browser/modules/stream/index.browser.d.ts +13 -19
  88. package/dist/browser/modules/stream/index.browser.js +10 -22
  89. package/dist/browser/modules/stream/index.d.ts +18 -41
  90. package/dist/browser/modules/stream/index.js +15 -44
  91. package/dist/browser/modules/stream/internal/event-utils.d.ts +17 -0
  92. package/dist/browser/modules/stream/internal/event-utils.js +40 -0
  93. package/dist/browser/modules/stream/internal/type-guards.d.ts +9 -0
  94. package/dist/browser/modules/stream/internal/type-guards.js +24 -0
  95. package/dist/browser/modules/stream/pull-stream.d.ts +5 -6
  96. package/dist/browser/modules/stream/pull-stream.js +107 -43
  97. package/dist/browser/modules/stream/shared.d.ts +1 -1
  98. package/dist/browser/modules/stream/shared.js +7 -4
  99. package/dist/browser/modules/stream/streams.browser.d.ts +32 -42
  100. package/dist/browser/modules/stream/streams.browser.js +941 -823
  101. package/dist/browser/modules/stream/streams.d.ts +4 -20
  102. package/dist/browser/modules/stream/streams.js +146 -95
  103. package/dist/browser/modules/stream/utils.js +5 -38
  104. package/dist/cjs/modules/archive/{compress.base.js → compression/compress.base.js} +2 -1
  105. package/dist/cjs/modules/archive/{compress.browser.js → compression/compress.browser.js} +18 -19
  106. package/dist/cjs/modules/archive/{compress.js → compression/compress.js} +1 -1
  107. package/dist/cjs/modules/archive/{crc32.js → compression/crc32.js} +1 -1
  108. package/dist/cjs/modules/archive/{deflate-fallback.js → compression/deflate-fallback.js} +1 -1
  109. package/dist/cjs/modules/archive/{streaming-compress.browser.js → compression/streaming-compress.browser.js} +3 -3
  110. package/dist/cjs/modules/archive/{streaming-compress.js → compression/streaming-compress.js} +2 -2
  111. package/dist/cjs/modules/archive/defaults.js +7 -4
  112. package/dist/cjs/modules/archive/index.base.js +9 -19
  113. package/dist/cjs/modules/archive/index.browser.js +4 -10
  114. package/dist/cjs/modules/archive/index.js +4 -8
  115. package/dist/cjs/modules/archive/internal/byte-queue.js +411 -0
  116. package/dist/cjs/modules/archive/io/archive-sink.js +49 -0
  117. package/dist/cjs/modules/archive/io/archive-source.js +105 -0
  118. package/dist/cjs/modules/archive/unzip/index.js +170 -0
  119. package/dist/cjs/modules/archive/unzip/stream.base.js +1044 -0
  120. package/dist/cjs/modules/archive/{parse.browser.js → unzip/stream.browser.js} +377 -111
  121. package/dist/cjs/modules/archive/{parse.js → unzip/stream.js} +9 -8
  122. package/dist/cjs/modules/archive/{zip-parser.js → unzip/zip-parser.js} +47 -33
  123. package/dist/cjs/modules/archive/utils/async-queue.js +106 -0
  124. package/dist/cjs/modules/archive/utils/bytes.js +16 -16
  125. package/dist/cjs/modules/archive/utils/compressibility.js +60 -0
  126. package/dist/cjs/modules/archive/utils/parse-buffer.js +21 -23
  127. package/dist/cjs/modules/archive/utils/pattern-scanner.js +31 -0
  128. package/dist/cjs/modules/archive/utils/timestamps.js +64 -3
  129. package/dist/cjs/modules/archive/utils/zip-extra-fields.js +26 -14
  130. package/dist/cjs/modules/archive/zip/index.js +162 -0
  131. package/dist/cjs/modules/archive/{streaming-zip.js → zip/stream.js} +194 -50
  132. package/dist/cjs/modules/archive/zip/zip-bytes.js +242 -0
  133. package/dist/cjs/modules/archive/{zip-entry-metadata.js → zip/zip-entry-metadata.js} +5 -5
  134. package/dist/cjs/modules/archive/zip-spec/zip-records.js +136 -0
  135. package/dist/cjs/modules/excel/form-control.js +54 -16
  136. package/dist/cjs/modules/excel/stream/workbook-reader.browser.js +2 -2
  137. package/dist/cjs/modules/excel/stream/workbook-writer.browser.js +4 -4
  138. package/dist/cjs/modules/excel/utils/ooxml-validator.js +475 -0
  139. package/dist/cjs/modules/excel/worksheet.js +5 -2
  140. package/dist/cjs/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +13 -1
  141. package/dist/cjs/modules/excel/xlsx/xform/drawing/sp-xform.js +115 -0
  142. package/dist/cjs/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +30 -2
  143. package/dist/cjs/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +11 -0
  144. package/dist/cjs/modules/excel/xlsx/xform/sheet/page-setup-xform.js +16 -2
  145. package/dist/cjs/modules/excel/xlsx/xform/sheet/worksheet-xform.js +117 -5
  146. package/dist/cjs/modules/excel/xlsx/xlsx.browser.js +6 -9
  147. package/dist/cjs/modules/excel/xlsx/xlsx.js +2 -2
  148. package/dist/cjs/modules/stream/base-transform.js +34 -20
  149. package/dist/cjs/modules/stream/chunked-builder.js +4 -4
  150. package/dist/cjs/modules/stream/index.browser.js +10 -17
  151. package/dist/cjs/modules/stream/index.js +15 -39
  152. package/dist/cjs/modules/stream/internal/event-utils.js +43 -0
  153. package/dist/cjs/modules/stream/internal/type-guards.js +30 -0
  154. package/dist/cjs/modules/stream/pull-stream.js +107 -43
  155. package/dist/cjs/modules/stream/shared.js +7 -4
  156. package/dist/cjs/modules/stream/streams.browser.js +947 -834
  157. package/dist/cjs/modules/stream/streams.js +156 -107
  158. package/dist/cjs/modules/stream/utils.js +3 -36
  159. package/dist/esm/index.browser.js +12 -0
  160. package/dist/esm/modules/archive/{compress.base.js → compression/compress.base.js} +2 -1
  161. package/dist/{browser/modules/archive → esm/modules/archive/compression}/compress.browser.js +18 -19
  162. package/dist/esm/modules/archive/{compress.js → compression/compress.js} +1 -1
  163. package/dist/esm/modules/archive/{crc32.js → compression/crc32.js} +1 -1
  164. package/dist/esm/modules/archive/{deflate-fallback.js → compression/deflate-fallback.js} +1 -1
  165. package/dist/esm/modules/archive/{streaming-compress.browser.js → compression/streaming-compress.browser.js} +3 -3
  166. package/dist/esm/modules/archive/{streaming-compress.js → compression/streaming-compress.js} +2 -2
  167. package/dist/esm/modules/archive/defaults.js +6 -3
  168. package/dist/esm/modules/archive/index.base.js +3 -6
  169. package/dist/esm/modules/archive/index.browser.js +3 -7
  170. package/dist/esm/modules/archive/index.js +3 -5
  171. package/dist/esm/modules/archive/internal/byte-queue.js +407 -0
  172. package/dist/esm/modules/archive/io/archive-sink.js +45 -0
  173. package/dist/esm/modules/archive/io/archive-source.js +100 -0
  174. package/dist/esm/modules/archive/unzip/index.js +164 -0
  175. package/dist/esm/modules/archive/unzip/stream.base.js +1022 -0
  176. package/dist/esm/modules/archive/{parse.browser.js → unzip/stream.browser.js} +376 -110
  177. package/dist/{browser/modules/archive/parse.js → esm/modules/archive/unzip/stream.js} +7 -6
  178. package/dist/{browser/modules/archive → esm/modules/archive/unzip}/zip-parser.js +38 -24
  179. package/dist/esm/modules/archive/utils/async-queue.js +103 -0
  180. package/dist/esm/modules/archive/utils/bytes.js +16 -16
  181. package/dist/esm/modules/archive/utils/compressibility.js +57 -0
  182. package/dist/esm/modules/archive/utils/parse-buffer.js +21 -23
  183. package/dist/esm/modules/archive/utils/pattern-scanner.js +27 -0
  184. package/dist/esm/modules/archive/utils/timestamps.js +62 -1
  185. package/dist/esm/modules/archive/utils/zip-extra-fields.js +26 -14
  186. package/dist/esm/modules/archive/zip/index.js +157 -0
  187. package/dist/esm/modules/archive/{streaming-zip.js → zip/stream.js} +192 -48
  188. package/dist/esm/modules/archive/zip/zip-bytes.js +239 -0
  189. package/dist/{browser/modules/archive → esm/modules/archive/zip}/zip-entry-metadata.js +3 -3
  190. package/dist/esm/modules/archive/zip-spec/zip-records.js +126 -0
  191. package/dist/esm/modules/excel/form-control.js +54 -16
  192. package/dist/esm/modules/excel/stream/workbook-reader.browser.js +1 -1
  193. package/dist/esm/modules/excel/stream/workbook-writer.browser.js +1 -1
  194. package/dist/esm/modules/excel/utils/ooxml-validator.js +469 -0
  195. package/dist/esm/modules/excel/worksheet.js +5 -2
  196. package/dist/esm/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.js +13 -1
  197. package/dist/esm/modules/excel/xlsx/xform/drawing/sp-xform.js +112 -0
  198. package/dist/esm/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.js +30 -2
  199. package/dist/esm/modules/excel/xlsx/xform/drawing/vml-drawing-xform.js +11 -0
  200. package/dist/esm/modules/excel/xlsx/xform/sheet/page-setup-xform.js +16 -2
  201. package/dist/esm/modules/excel/xlsx/xform/sheet/worksheet-xform.js +117 -5
  202. package/dist/esm/modules/excel/xlsx/xlsx.browser.js +3 -6
  203. package/dist/esm/modules/excel/xlsx/xlsx.js +1 -1
  204. package/dist/esm/modules/stream/base-transform.js +34 -20
  205. package/dist/esm/modules/stream/chunked-builder.js +4 -4
  206. package/dist/esm/modules/stream/index.browser.js +10 -22
  207. package/dist/esm/modules/stream/index.js +15 -44
  208. package/dist/esm/modules/stream/internal/event-utils.js +40 -0
  209. package/dist/esm/modules/stream/internal/type-guards.js +24 -0
  210. package/dist/esm/modules/stream/pull-stream.js +107 -43
  211. package/dist/esm/modules/stream/shared.js +7 -4
  212. package/dist/esm/modules/stream/streams.browser.js +941 -823
  213. package/dist/esm/modules/stream/streams.js +146 -95
  214. package/dist/esm/modules/stream/utils.js +5 -38
  215. package/dist/iife/THIRD_PARTY_NOTICES.md +81 -0
  216. package/dist/iife/excelts.iife.js +4979 -2800
  217. package/dist/iife/excelts.iife.js.map +1 -1
  218. package/dist/iife/excelts.iife.min.js +103 -31
  219. package/dist/types/index.browser.d.ts +1 -0
  220. package/dist/{browser/modules/archive → types/modules/archive/compression}/compress.base.d.ts +1 -0
  221. package/dist/{browser/modules/archive → types/modules/archive/compression}/compress.browser.d.ts +10 -8
  222. package/dist/types/modules/archive/{streaming-compress.browser.d.ts → compression/streaming-compress.browser.d.ts} +1 -1
  223. package/dist/types/modules/archive/defaults.d.ts +1 -0
  224. package/dist/types/modules/archive/index.base.d.ts +4 -4
  225. package/dist/types/modules/archive/index.browser.d.ts +3 -4
  226. package/dist/types/modules/archive/index.d.ts +3 -4
  227. package/dist/types/modules/archive/internal/byte-queue.d.ts +33 -0
  228. package/dist/types/modules/archive/io/archive-sink.d.ts +8 -0
  229. package/dist/types/modules/archive/io/archive-source.d.ts +6 -0
  230. package/dist/types/modules/archive/unzip/index.d.ts +40 -0
  231. package/dist/types/modules/archive/{parse.base.d.ts → unzip/stream.base.d.ts} +60 -5
  232. package/dist/types/modules/archive/{parse.browser.d.ts → unzip/stream.browser.d.ts} +2 -2
  233. package/dist/types/modules/archive/{parse.d.ts → unzip/stream.d.ts} +3 -3
  234. package/dist/{browser/modules/archive → types/modules/archive/unzip}/zip-parser.d.ts +1 -1
  235. package/dist/types/modules/archive/utils/async-queue.d.ts +7 -0
  236. package/dist/types/modules/archive/utils/compressibility.d.ts +10 -0
  237. package/dist/types/modules/archive/utils/pattern-scanner.d.ts +21 -0
  238. package/dist/types/modules/archive/utils/zip-extra-fields.d.ts +1 -1
  239. package/dist/types/modules/archive/zip/index.d.ts +42 -0
  240. package/dist/types/modules/archive/{streaming-zip.d.ts → zip/stream.d.ts} +29 -6
  241. package/dist/types/modules/archive/zip/zip-bytes.d.ts +73 -0
  242. package/dist/types/modules/archive/{zip-entry-metadata.d.ts → zip/zip-entry-metadata.d.ts} +1 -1
  243. package/dist/types/modules/archive/{zip-records.d.ts → zip-spec/zip-records.d.ts} +20 -0
  244. package/dist/types/modules/excel/form-control.d.ts +2 -0
  245. package/dist/types/modules/excel/stream/workbook-writer.browser.d.ts +1 -1
  246. package/dist/types/modules/excel/utils/ooxml-validator.d.ts +48 -0
  247. package/dist/types/modules/excel/xlsx/xform/drawing/ctrl-prop-xform.d.ts +1 -0
  248. package/dist/types/modules/excel/xlsx/xform/drawing/sp-xform.d.ts +18 -0
  249. package/dist/types/modules/excel/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +6 -1
  250. package/dist/types/modules/excel/xlsx/xform/sheet/page-setup-xform.d.ts +1 -0
  251. package/dist/types/modules/stream/base-transform.d.ts +3 -0
  252. package/dist/types/modules/stream/buffered-stream.d.ts +2 -12
  253. package/dist/types/modules/stream/index.browser.d.ts +13 -19
  254. package/dist/types/modules/stream/index.d.ts +18 -41
  255. package/dist/types/modules/stream/internal/event-utils.d.ts +17 -0
  256. package/dist/types/modules/stream/internal/type-guards.d.ts +9 -0
  257. package/dist/types/modules/stream/pull-stream.d.ts +5 -6
  258. package/dist/types/modules/stream/shared.d.ts +1 -1
  259. package/dist/types/modules/stream/streams.browser.d.ts +32 -42
  260. package/dist/types/modules/stream/streams.d.ts +4 -20
  261. package/package.json +19 -15
  262. package/dist/browser/modules/archive/byte-queue.d.ts +0 -18
  263. package/dist/browser/modules/archive/byte-queue.js +0 -125
  264. package/dist/browser/modules/archive/parse.base.js +0 -610
  265. package/dist/browser/modules/archive/utils/zip-extra.d.ts +0 -18
  266. package/dist/browser/modules/archive/utils/zip-extra.js +0 -68
  267. package/dist/browser/modules/archive/zip-builder.d.ts +0 -117
  268. package/dist/browser/modules/archive/zip-builder.js +0 -292
  269. package/dist/browser/modules/archive/zip-constants.d.ts +0 -18
  270. package/dist/browser/modules/archive/zip-constants.js +0 -23
  271. package/dist/browser/modules/archive/zip-records.js +0 -84
  272. package/dist/cjs/modules/archive/byte-queue.js +0 -129
  273. package/dist/cjs/modules/archive/parse.base.js +0 -632
  274. package/dist/cjs/modules/archive/utils/zip-extra.js +0 -74
  275. package/dist/cjs/modules/archive/zip-builder.js +0 -297
  276. package/dist/cjs/modules/archive/zip-constants.js +0 -26
  277. package/dist/cjs/modules/archive/zip-records.js +0 -90
  278. package/dist/esm/modules/archive/byte-queue.js +0 -125
  279. package/dist/esm/modules/archive/parse.base.js +0 -610
  280. package/dist/esm/modules/archive/utils/zip-extra.js +0 -68
  281. package/dist/esm/modules/archive/zip-builder.js +0 -292
  282. package/dist/esm/modules/archive/zip-constants.js +0 -23
  283. package/dist/esm/modules/archive/zip-records.js +0 -84
  284. package/dist/types/modules/archive/byte-queue.d.ts +0 -18
  285. package/dist/types/modules/archive/utils/zip-extra.d.ts +0 -18
  286. package/dist/types/modules/archive/zip-builder.d.ts +0 -117
  287. package/dist/types/modules/archive/zip-constants.d.ts +0 -18
  288. /package/dist/browser/modules/archive/{crc32.base.d.ts → compression/crc32.base.d.ts} +0 -0
  289. /package/dist/browser/modules/archive/{crc32.base.js → compression/crc32.base.js} +0 -0
  290. /package/dist/browser/modules/archive/{crc32.browser.js → compression/crc32.browser.js} +0 -0
  291. /package/dist/browser/modules/archive/{deflate-fallback.d.ts → compression/deflate-fallback.d.ts} +0 -0
  292. /package/dist/browser/modules/archive/{streaming-compress.base.d.ts → compression/streaming-compress.base.d.ts} +0 -0
  293. /package/dist/browser/modules/archive/{streaming-compress.base.js → compression/streaming-compress.base.js} +0 -0
  294. /package/dist/browser/modules/archive/{extract.js → unzip/extract.js} +0 -0
  295. /package/dist/browser/modules/archive/{zip-entry-metadata.d.ts → zip/zip-entry-metadata.d.ts} +0 -0
  296. /package/dist/browser/modules/archive/{zip-entry-info.d.ts → zip-spec/zip-entry-info.d.ts} +0 -0
  297. /package/dist/browser/modules/archive/{zip-entry-info.js → zip-spec/zip-entry-info.js} +0 -0
  298. /package/dist/cjs/modules/archive/{crc32.base.js → compression/crc32.base.js} +0 -0
  299. /package/dist/cjs/modules/archive/{crc32.browser.js → compression/crc32.browser.js} +0 -0
  300. /package/dist/cjs/modules/archive/{streaming-compress.base.js → compression/streaming-compress.base.js} +0 -0
  301. /package/dist/cjs/modules/archive/{extract.js → unzip/extract.js} +0 -0
  302. /package/dist/cjs/modules/archive/{zip-entry-info.js → zip-spec/zip-entry-info.js} +0 -0
  303. /package/dist/esm/modules/archive/{crc32.base.js → compression/crc32.base.js} +0 -0
  304. /package/dist/esm/modules/archive/{crc32.browser.js → compression/crc32.browser.js} +0 -0
  305. /package/dist/esm/modules/archive/{streaming-compress.base.js → compression/streaming-compress.base.js} +0 -0
  306. /package/dist/esm/modules/archive/{extract.js → unzip/extract.js} +0 -0
  307. /package/dist/esm/modules/archive/{zip-entry-info.js → zip-spec/zip-entry-info.js} +0 -0
  308. /package/dist/{LICENSE → iife/LICENSE} +0 -0
  309. /package/dist/types/modules/archive/{compress.d.ts → compression/compress.d.ts} +0 -0
  310. /package/dist/types/modules/archive/{crc32.base.d.ts → compression/crc32.base.d.ts} +0 -0
  311. /package/dist/types/modules/archive/{crc32.browser.d.ts → compression/crc32.browser.d.ts} +0 -0
  312. /package/dist/types/modules/archive/{crc32.d.ts → compression/crc32.d.ts} +0 -0
  313. /package/dist/types/modules/archive/{deflate-fallback.d.ts → compression/deflate-fallback.d.ts} +0 -0
  314. /package/dist/types/modules/archive/{streaming-compress.base.d.ts → compression/streaming-compress.base.d.ts} +0 -0
  315. /package/dist/types/modules/archive/{streaming-compress.d.ts → compression/streaming-compress.d.ts} +0 -0
  316. /package/dist/types/modules/archive/{extract.d.ts → unzip/extract.d.ts} +0 -0
  317. /package/dist/types/modules/archive/{zip-entry-info.d.ts → zip-spec/zip-entry-info.d.ts} +0 -0
@@ -5,9 +5,9 @@
5
5
  * Provides Readable, Writable, Transform, Duplex, and PassThrough streams.
6
6
  */
7
7
  import { Readable, Writable as NodeWritable, Transform, Duplex, PassThrough } from "stream";
8
- import type { TransformStreamOptions, ReadableStreamOptions, WritableStreamOptions, DuplexStreamOptions, PullStreamOptions, BufferedStreamOptions, DataChunk, ICollector, IDuplex, IEventEmitter, IPassThrough, IReadable, ITransform, IWritable, PipelineStreamLike, ReadableLike, WritableLike } from "@stream/types";
9
- import { BufferedStream as StandaloneBufferedStream, StringChunk as StandaloneStringChunk, BufferChunk as StandaloneBufferChunk } from "@stream/buffered-stream";
10
- import { PullStream as StandalonePullStream } from "@stream/pull-stream";
8
+ import type { TransformStreamOptions, ReadableStreamOptions, WritableStreamOptions, DuplexStreamOptions, PullStreamOptions, BufferedStreamOptions, ICollector, IDuplex, IEventEmitter, IPassThrough, IReadable, ITransform, IWritable, PipelineStreamLike, ReadableLike, WritableLike } from "@stream/types";
9
+ import { BufferedStream, BufferChunk, StringChunk } from "@stream/buffered-stream";
10
+ import { PullStream } from "@stream/pull-stream";
11
11
  /**
12
12
  * Extended Writable options that match browser API
13
13
  * Supports wrapping an existing Node.js stream
@@ -30,6 +30,7 @@ export declare class Writable<T = Uint8Array> extends NodeWritable {
30
30
  constructor(options?: WritableOptions<T>);
31
31
  }
32
32
  export { Readable, Transform, Duplex, PassThrough };
33
+ export { PullStream, BufferedStream, StringChunk, BufferChunk };
33
34
  /**
34
35
  * Normalize a user-provided writable into a Node.js-compatible Writable.
35
36
  *
@@ -130,27 +131,10 @@ export declare class Collector<T = Uint8Array> extends Writable {
130
131
  * Create a collector stream
131
132
  */
132
133
  export declare function createCollector<T = Uint8Array>(options?: WritableStreamOptions): ICollector<T>;
133
- export declare class PullStream extends StandalonePullStream {
134
- }
135
134
  /**
136
135
  * Create a pull stream
137
136
  */
138
137
  export declare function createPullStream(options?: PullStreamOptions): PullStream;
139
- /**
140
- * String chunk implementation
141
- */
142
- export declare class StringChunk extends StandaloneStringChunk implements DataChunk {
143
- }
144
- /**
145
- * Buffer chunk implementation
146
- */
147
- export declare class BufferChunk extends StandaloneBufferChunk implements DataChunk {
148
- }
149
- /**
150
- * Buffered stream with efficient chunk management
151
- */
152
- export declare class BufferedStream extends StandaloneBufferedStream {
153
- }
154
138
  /**
155
139
  * Create a buffered stream
156
140
  */
@@ -5,8 +5,9 @@
5
5
  * Provides Readable, Writable, Transform, Duplex, and PassThrough streams.
6
6
  */
7
7
  import { Readable, Writable as NodeWritable, Transform, Duplex, PassThrough, pipeline as nodePipeline, finished as nodeFinished } from "stream";
8
- import { BufferedStream as StandaloneBufferedStream, StringChunk as StandaloneStringChunk, BufferChunk as StandaloneBufferChunk } from "./buffered-stream.js";
9
- import { PullStream as StandalonePullStream } from "./pull-stream.js";
8
+ import { BufferedStream, BufferChunk, StringChunk } from "./buffered-stream.js";
9
+ import { PullStream } from "./pull-stream.js";
10
+ import { isAsyncIterable, isReadableStream, isTransformStream, isWritableStream } from "./internal/type-guards.js";
10
11
  /**
11
12
  * Unified Writable class - wraps Node.js Writable with browser-compatible API
12
13
  *
@@ -16,20 +17,34 @@ export class Writable extends NodeWritable {
16
17
  constructor(options) {
17
18
  // If wrapping an existing stream, proxy to it
18
19
  if (options?.stream) {
20
+ const underlying = options.stream;
19
21
  // Create a pass-through wrapper that proxies to the underlying stream
20
22
  super({
21
23
  highWaterMark: options?.highWaterMark,
22
24
  objectMode: options?.objectMode,
23
25
  write(chunk, encoding, callback) {
24
- options.stream.write(chunk, encoding, callback);
26
+ underlying.write(chunk, encoding, callback);
25
27
  },
26
28
  final(callback) {
27
- options.stream.end(callback);
29
+ underlying.end(callback);
28
30
  }
29
31
  });
30
- // Proxy events from underlying stream
31
- options.stream.on("error", err => this.emit("error", err));
32
- options.stream.on("close", () => this.emit("close"));
32
+ // Proxy events from underlying stream, but ensure we clean up listeners so
33
+ // the underlying stream cannot retain this wrapper longer than necessary.
34
+ const onUnderlyingError = (err) => {
35
+ this.emit("error", err);
36
+ };
37
+ const onUnderlyingClose = () => {
38
+ this.emit("close");
39
+ };
40
+ const cleanup = () => {
41
+ underlying.off("error", onUnderlyingError);
42
+ underlying.off("close", onUnderlyingClose);
43
+ };
44
+ underlying.on("error", onUnderlyingError);
45
+ underlying.on("close", onUnderlyingClose);
46
+ this.once("close", cleanup);
47
+ this.once("finish", cleanup);
33
48
  }
34
49
  else {
35
50
  super({
@@ -45,6 +60,8 @@ export class Writable extends NodeWritable {
45
60
  // Re-export native classes with our interfaces
46
61
  // =============================================================================
47
62
  export { Readable, Transform, Duplex, PassThrough };
63
+ // Standalone cross-platform helpers
64
+ export { PullStream, BufferedStream, StringChunk, BufferChunk };
48
65
  // =============================================================================
49
66
  // Cross-environment stream normalization
50
67
  // =============================================================================
@@ -57,43 +74,25 @@ export function normalizeWritable(stream) {
57
74
  if (stream instanceof Writable) {
58
75
  return stream;
59
76
  }
60
- // Node.js Writable: accept structurally even if typed as unknown.
77
+ // Node.js Writable: already compatible, avoid extra wrapper allocation.
61
78
  if (stream instanceof NodeWritable) {
62
- return new Writable({ stream: stream });
79
+ return stream;
63
80
  }
64
81
  // Web WritableStream: detect by getWriter() (avoid relying on global WritableStream).
65
82
  if (stream?.getWriter) {
66
- const nodeWritable = NodeWritable.fromWeb(stream);
67
- return new Writable({ stream: nodeWritable });
83
+ return NodeWritable.fromWeb(stream);
68
84
  }
69
- // Assume it structurally matches Node's Writable; wrap for consistent API.
70
- return new Writable({ stream: stream });
85
+ // Assume it structurally matches Node's Writable.
86
+ return stream;
71
87
  }
72
88
  // Import for internal use
73
89
  import { textDecoder } from "./shared.js";
74
- const isReadableStream = (value) => !!value && typeof value === "object" && typeof value.getReader === "function";
75
- const isAsyncIterable = (value) => {
76
- if (!value || (typeof value !== "object" && typeof value !== "function")) {
77
- return false;
78
- }
79
- return typeof value[Symbol.asyncIterator] === "function";
80
- };
81
- const isWritableStream = (value) => !!value && typeof value === "object" && typeof value.getWriter === "function";
82
- const isTransformStream = (value) => !!value &&
83
- typeof value === "object" &&
84
- !!value.readable &&
85
- !!value.writable &&
86
- isReadableStream(value.readable) &&
87
- isWritableStream(value.writable);
88
90
  const isPipelineOptions = (value) => {
89
91
  if (!value || typeof value !== "object") {
90
92
  return false;
91
93
  }
92
- // IMPORTANT:
93
- // Do NOT use `"end" in obj` here because streams have `.end()` and would be
94
- // misclassified as options, breaking argument parsing and potentially hanging.
94
+ // Avoid treating streams as options objects.
95
95
  if (typeof value.pipe === "function" ||
96
- typeof value.write === "function" ||
97
96
  typeof value.end === "function" ||
98
97
  typeof value.getReader === "function" ||
99
98
  typeof value.getWriter === "function") {
@@ -180,12 +179,13 @@ export function finished(stream, optionsOrCallback, callback) {
180
179
  const promise = new Promise((resolve, reject) => {
181
180
  const normalizedStream = toNodePipelineStream(stream);
182
181
  nodeFinished(normalizedStream, options, (err) => {
183
- if (err && !(options && options.error)) {
182
+ // Node.js semantics: options.error defaults to true (report errors).
183
+ // If options.error === false, ignore errors and resolve.
184
+ if (err && options?.error !== false) {
184
185
  reject(err);
186
+ return;
185
187
  }
186
- else {
187
- resolve();
188
- }
188
+ resolve();
189
189
  });
190
190
  });
191
191
  if (cb) {
@@ -411,8 +411,6 @@ export function createCollector(options) {
411
411
  // =============================================================================
412
412
  // Pull Stream - Read data on demand with pattern matching
413
413
  // =============================================================================
414
- export class PullStream extends StandalonePullStream {
415
- }
416
414
  /**
417
415
  * Create a pull stream
418
416
  */
@@ -422,21 +420,6 @@ export function createPullStream(options) {
422
420
  // =============================================================================
423
421
  // Buffered Stream - Efficient chunk management
424
422
  // =============================================================================
425
- /**
426
- * String chunk implementation
427
- */
428
- export class StringChunk extends StandaloneStringChunk {
429
- }
430
- /**
431
- * Buffer chunk implementation
432
- */
433
- export class BufferChunk extends StandaloneBufferChunk {
434
- }
435
- /**
436
- * Buffered stream with efficient chunk management
437
- */
438
- export class BufferedStream extends StandaloneBufferedStream {
439
- }
440
423
  /**
441
424
  * Create a buffered stream
442
425
  */
@@ -533,13 +516,28 @@ export function addAbortSignal(signal, stream) {
533
516
  stream.destroy(new Error("Aborted"));
534
517
  return stream;
535
518
  }
519
+ const cleanup = () => {
520
+ signal.removeEventListener("abort", onAbort);
521
+ stream.off?.("close", onDone);
522
+ stream.off?.("end", onDone);
523
+ stream.off?.("finish", onDone);
524
+ stream.off?.("error", onError);
525
+ };
536
526
  const onAbort = () => {
527
+ cleanup();
537
528
  stream.destroy(new Error("Aborted"));
538
529
  };
530
+ const onDone = () => {
531
+ cleanup();
532
+ };
533
+ const onError = () => {
534
+ cleanup();
535
+ };
539
536
  signal.addEventListener("abort", onAbort, { once: true });
540
- stream.on("close", () => {
541
- signal.removeEventListener("abort", onAbort);
542
- });
537
+ stream.once?.("close", onDone);
538
+ stream.once?.("end", onDone);
539
+ stream.once?.("finish", onDone);
540
+ stream.once?.("error", onError);
543
541
  return stream;
544
542
  }
545
543
  /**
@@ -582,56 +580,109 @@ export function compose(...transforms) {
582
580
  if (len === 1 && isNativeTransform(transforms[0])) {
583
581
  return transforms[0];
584
582
  }
585
- // Chain all transforms together
583
+ // Chain all transforms together once.
586
584
  for (let i = 0; i < len - 1; i++) {
587
585
  transforms[i].pipe(transforms[i + 1]);
588
586
  }
589
- // Create a Duplex that writes to first and reads from last
590
587
  const first = transforms[0];
591
588
  const last = transforms[len - 1];
592
- // Create a PassThrough as the composed stream
593
- const composed = new PassThrough({ objectMode: first.readableObjectMode });
594
- // Store original methods for forwarding
595
- const passthroughWrite = composed.write.bind(composed);
596
- const passthroughEnd = composed.end.bind(composed);
597
- // Override write to write to first transform
598
- composed.write = function (chunk, encodingOrCallback, callback) {
599
- if (typeof encodingOrCallback === "function") {
600
- return first.write(chunk, encodingOrCallback);
601
- }
602
- return first.write(chunk, encodingOrCallback, callback);
603
- };
604
- // Override end to end first transform
605
- composed.end = function (chunkOrCallback, encodingOrCallback, callback) {
606
- if (typeof chunkOrCallback === "function") {
607
- first.end(chunkOrCallback);
589
+ // Use a private output stream so we don't have to monkey-patch `write()` on the
590
+ // public composed stream (which would break piping into it).
591
+ const output = new PassThrough({ objectMode: last.readableObjectMode ?? true });
592
+ last.pipe(output);
593
+ let outputEnded = false;
594
+ const pumpOutput = (target) => {
595
+ if (outputEnded) {
596
+ return;
608
597
  }
609
- else if (typeof encodingOrCallback === "function") {
610
- first.end(chunkOrCallback, encodingOrCallback);
598
+ while (true) {
599
+ const chunk = output.read();
600
+ if (chunk === null) {
601
+ break;
602
+ }
603
+ if (!target.push(chunk)) {
604
+ break;
605
+ }
611
606
  }
612
- else {
613
- first.end(chunkOrCallback, encodingOrCallback, callback);
607
+ };
608
+ const composed = new Transform({
609
+ readableObjectMode: last.readableObjectMode,
610
+ writableObjectMode: first.writableObjectMode,
611
+ transform(chunk, encoding, callback) {
612
+ try {
613
+ // Forward writes into the head of the chain.
614
+ first.write(chunk, encoding, callback);
615
+ }
616
+ catch (err) {
617
+ callback(err);
618
+ }
619
+ },
620
+ flush(callback) {
621
+ // End the head of the chain; readable completion is driven by `output` ending.
622
+ const onFinish = () => {
623
+ cleanupFlush();
624
+ callback();
625
+ };
626
+ const onError = (err) => {
627
+ cleanupFlush();
628
+ callback(err);
629
+ };
630
+ const cleanupFlush = () => {
631
+ first.off?.("finish", onFinish);
632
+ first.off?.("error", onError);
633
+ };
634
+ first.once?.("finish", onFinish);
635
+ first.once?.("error", onError);
636
+ first.end();
637
+ },
638
+ read() {
639
+ pumpOutput(this);
640
+ },
641
+ destroy(err, callback) {
642
+ try {
643
+ output.destroy(err ?? undefined);
644
+ for (const t of transforms) {
645
+ t.destroy?.(err ?? undefined);
646
+ }
647
+ }
648
+ finally {
649
+ callback(err);
650
+ }
614
651
  }
615
- return composed;
652
+ });
653
+ const onOutputReadable = () => {
654
+ pumpOutput(composed);
616
655
  };
617
- // Override pipe to pipe from last transform
618
- composed.pipe = function (dest) {
619
- return last.pipe(dest);
656
+ const onOutputEnd = () => {
657
+ cleanupListeners();
658
+ outputEnded = true;
659
+ composed.push(null);
620
660
  };
621
- // Forward data from last to composed
622
- last.on("data", (chunk) => {
623
- passthroughWrite(chunk);
624
- });
625
- // Forward end from last
626
- last.on("end", () => {
627
- passthroughEnd();
661
+ const onAnyError = (err) => {
662
+ cleanupListeners();
663
+ composed.destroy(err);
664
+ };
665
+ const transformErrorListeners = [];
666
+ const cleanupListeners = () => {
667
+ output.off("readable", onOutputReadable);
668
+ output.off("end", onOutputEnd);
669
+ output.off("error", onAnyError);
670
+ for (const { t, fn } of transformErrorListeners) {
671
+ t.off?.("error", fn);
672
+ }
673
+ transformErrorListeners.length = 0;
674
+ };
675
+ output.on("readable", onOutputReadable);
676
+ output.once("end", onOutputEnd);
677
+ output.once("error", onAnyError);
678
+ for (const t of transforms) {
679
+ const tt = t;
680
+ tt.once?.("error", onAnyError);
681
+ transformErrorListeners.push({ t: tt, fn: onAnyError });
682
+ }
683
+ composed.once("close", () => {
684
+ cleanupListeners();
628
685
  });
629
- // Forward errors from any transform
630
- for (const transform of transforms) {
631
- transform.on("error", (err) => {
632
- composed.emit("error", err);
633
- });
634
- }
635
686
  return composed;
636
687
  }
637
688
  /**
@@ -712,7 +763,7 @@ export function once(emitter, event, options) {
712
763
  onAbort();
713
764
  return;
714
765
  }
715
- options.signal.addEventListener("abort", onAbort);
766
+ options.signal.addEventListener("abort", onAbort, { once: true });
716
767
  }
717
768
  });
718
769
  }
@@ -4,8 +4,8 @@
4
4
  * Small, cross-platform helpers built on top of the platform stream
5
5
  * implementation selected by `./streams` (Node.js or browser).
6
6
  */
7
- import { createReadableFromArray, createTransform } from "./streams.browser.js";
8
- import { stringToUint8Array as _stringToUint8Array, uint8ArrayToString as _uint8ArrayToString } from "./shared.js";
7
+ import { consumers, createReadableFromArray, createTransform } from "./streams.browser.js";
8
+ import { stringToUint8Array as _stringToUint8Array } from "./shared.js";
9
9
  // =============================================================================
10
10
  // High-Level Stream Consumers
11
11
  // =============================================================================
@@ -17,46 +17,13 @@ export async function collect(stream) {
17
17
  return result;
18
18
  }
19
19
  export async function text(stream) {
20
- const chunks = [];
21
- let totalLength = 0;
22
- for await (const chunk of stream) {
23
- chunks.push(chunk);
24
- totalLength += chunk.length;
25
- }
26
- if (chunks.length === 1) {
27
- return _uint8ArrayToString(chunks[0]);
28
- }
29
- const result = new Uint8Array(totalLength);
30
- let offset = 0;
31
- for (let i = 0, len = chunks.length; i < len; i++) {
32
- const c = chunks[i];
33
- result.set(c, offset);
34
- offset += c.length;
35
- }
36
- return _uint8ArrayToString(result);
20
+ return consumers.text(stream);
37
21
  }
38
22
  export async function json(stream) {
39
- const str = await text(stream);
40
- return JSON.parse(str);
23
+ return consumers.json(stream);
41
24
  }
42
25
  export async function bytes(stream) {
43
- const chunks = [];
44
- let totalLength = 0;
45
- for await (const chunk of stream) {
46
- chunks.push(chunk);
47
- totalLength += chunk.length;
48
- }
49
- if (chunks.length === 1) {
50
- return chunks[0];
51
- }
52
- const result = new Uint8Array(totalLength);
53
- let offset = 0;
54
- for (let i = 0, len = chunks.length; i < len; i++) {
55
- const c = chunks[i];
56
- result.set(c, offset);
57
- offset += c.length;
58
- }
59
- return result;
26
+ return consumers.buffer(stream);
60
27
  }
61
28
  // =============================================================================
62
29
  // Stream Factory Helpers
@@ -21,11 +21,12 @@ exports.hasDeflateRawDecompressionStream = hasDeflateRawDecompressionStream;
21
21
  exports.hasDeflateRawWebStreams = hasDeflateRawWebStreams;
22
22
  exports.compressWithStream = compressWithStream;
23
23
  exports.decompressWithStream = decompressWithStream;
24
- const byte_queue_1 = require("./byte-queue.js");
24
+ const byte_queue_1 = require("../internal/byte-queue.js");
25
25
  /**
26
26
  * Default threshold (in bytes) to choose the lower-overhead path.
27
27
  *
28
28
  * This is a performance knob, not a correctness requirement.
29
+ * Default: 8MB.
29
30
  */
30
31
  exports.DEFAULT_COMPRESS_THRESHOLD_BYTES = 8 * 1024 * 1024;
31
32
  /**
@@ -12,26 +12,21 @@
12
12
  * - Edge >= 89
13
13
  */
14
14
  Object.defineProperty(exports, "__esModule", { value: true });
15
- exports.hasCompressionStream = hasCompressionStream;
15
+ exports.hasCompressionStream = void 0;
16
16
  exports.compress = compress;
17
17
  exports.compressSync = compressSync;
18
18
  exports.decompress = decompress;
19
19
  exports.decompressSync = decompressSync;
20
20
  const compress_base_1 = require("./compress.base.js");
21
+ Object.defineProperty(exports, "hasCompressionStream", { enumerable: true, get: function () { return compress_base_1.hasCompressionStream; } });
21
22
  const deflate_fallback_1 = require("./deflate-fallback.js");
22
- const defaults_1 = require("./defaults.js");
23
- /**
24
- * Check if CompressionStream is available in this environment.
25
- *
26
- * Note: Some environments may expose CompressionStream but not support
27
- * the "deflate-raw" format that ZIP requires.
28
- */
29
- function hasCompressionStream() {
30
- return typeof CompressionStream !== "undefined";
31
- }
23
+ const defaults_1 = require("../defaults.js");
32
24
  /**
33
25
  * Compress data using browser's native CompressionStream or JS fallback
34
26
  *
27
+ * Note: We always prefer native CompressionStream when available because
28
+ * it's significantly faster than pure JS implementation.
29
+ *
35
30
  * @param data - Data to compress
36
31
  * @param options - Compression options
37
32
  * @returns Compressed data
@@ -44,16 +39,15 @@ function hasCompressionStream() {
44
39
  */
45
40
  async function compress(data, options = {}) {
46
41
  const level = options.level ?? defaults_1.DEFAULT_COMPRESS_LEVEL;
47
- const thresholdBytes = (0, compress_base_1.resolveCompressThresholdBytes)(options);
48
42
  // Level 0 means no compression
49
43
  if (level === 0) {
50
44
  return data;
51
45
  }
52
- // Use native CompressionStream only for larger inputs.
53
- if ((0, compress_base_1.hasDeflateRawCompressionStream)() && data.byteLength > thresholdBytes) {
46
+ // Always use native CompressionStream when available - it's much faster than JS
47
+ if ((0, compress_base_1.hasDeflateRawCompressionStream)()) {
54
48
  return (0, compress_base_1.compressWithStream)(data);
55
49
  }
56
- // Fallback to pure JS implementation
50
+ // Fallback to pure JS implementation only when native is unavailable
57
51
  return (0, deflate_fallback_1.deflateRawCompressed)(data);
58
52
  }
59
53
  /**
@@ -75,16 +69,21 @@ function compressSync(data, options = {}) {
75
69
  /**
76
70
  * Decompress data using browser's native DecompressionStream or JS fallback
77
71
  *
72
+ * Note: We always prefer native DecompressionStream when available because
73
+ * it's significantly faster than pure JS implementation, regardless of data size.
74
+ * The threshold is only useful for compression where the overhead matters more.
75
+ *
78
76
  * @param data - Compressed data (deflate-raw format)
77
+ * @param options - Decompression options (kept for API parity; currently unused in browser)
79
78
  * @returns Decompressed data
80
79
  */
81
80
  async function decompress(data, options = {}) {
82
- const thresholdBytes = (0, compress_base_1.resolveCompressThresholdBytes)(options);
83
- // Use native DecompressionStream only for larger inputs.
84
- if ((0, compress_base_1.hasDeflateRawDecompressionStream)() && data.byteLength > thresholdBytes) {
81
+ void options;
82
+ // Always use native DecompressionStream when available - it's much faster than JS
83
+ if ((0, compress_base_1.hasDeflateRawDecompressionStream)()) {
85
84
  return (0, compress_base_1.decompressWithStream)(data);
86
85
  }
87
- // Fallback to pure JS implementation
86
+ // Fallback to pure JS implementation only when native is unavailable
88
87
  return (0, deflate_fallback_1.inflateRaw)(data);
89
88
  }
90
89
  /**
@@ -46,7 +46,7 @@ exports.decompress = decompress;
46
46
  exports.decompressSync = decompressSync;
47
47
  const util_1 = require("util");
48
48
  const zlib = __importStar(require("zlib"));
49
- const defaults_1 = require("./defaults.js");
49
+ const defaults_1 = require("../defaults.js");
50
50
  // Re-export shared types and utilities
51
51
  var compress_base_1 = require("./compress.base.js");
52
52
  Object.defineProperty(exports, "hasCompressionStream", { enumerable: true, get: function () { return compress_base_1.hasCompressionStream; } });
@@ -47,7 +47,7 @@ exports.crc32Finalize = void 0;
47
47
  exports.crc32 = crc32;
48
48
  exports.ensureCrc32 = ensureCrc32;
49
49
  exports.crc32Update = crc32Update;
50
- const env_1 = require("../../utils/env.js");
50
+ const env_1 = require("../../../utils/env.js");
51
51
  const crc32_base_1 = require("./crc32.base.js");
52
52
  Object.defineProperty(exports, "crc32Finalize", { enumerable: true, get: function () { return crc32_base_1.crc32Finalize; } });
53
53
  // Lazy-loaded zlib module for Node.js
@@ -15,7 +15,7 @@ Object.defineProperty(exports, "__esModule", { value: true });
15
15
  exports.inflateRaw = inflateRaw;
16
16
  exports.deflateRawStore = deflateRawStore;
17
17
  exports.deflateRawCompressed = deflateRawCompressed;
18
- const bytes_1 = require("./utils/bytes.js");
18
+ const bytes_1 = require("../utils/bytes.js");
19
19
  // ============================================================================
20
20
  // DEFLATE Decompression (Full implementation)
21
21
  // ============================================================================
@@ -11,11 +11,11 @@ Object.defineProperty(exports, "__esModule", { value: true });
11
11
  exports.hasDeflateRaw = hasDeflateRaw;
12
12
  exports.createDeflateStream = createDeflateStream;
13
13
  exports.createInflateStream = createInflateStream;
14
- const _stream_1 = require("../stream/index.js");
14
+ const _stream_1 = require("../../stream/index.js");
15
15
  const deflate_fallback_1 = require("./deflate-fallback.js");
16
16
  const compress_base_1 = require("./compress.base.js");
17
- const bytes_1 = require("./utils/bytes.js");
18
- const defaults_1 = require("./defaults.js");
17
+ const bytes_1 = require("../utils/bytes.js");
18
+ const defaults_1 = require("../defaults.js");
19
19
  const streaming_compress_base_1 = require("./streaming-compress.base.js");
20
20
  /**
21
21
  * Check if deflate-raw streaming compression is supported by this library.
@@ -10,8 +10,8 @@ exports.createDeflateStream = createDeflateStream;
10
10
  exports.createInflateStream = createInflateStream;
11
11
  exports.hasDeflateRaw = hasDeflateRaw;
12
12
  const zlib_1 = require("zlib");
13
- const _stream_1 = require("../stream/index.js");
14
- const defaults_1 = require("./defaults.js");
13
+ const _stream_1 = require("../../stream/index.js");
14
+ const defaults_1 = require("../defaults.js");
15
15
  /**
16
16
  * Wrapper around zlib DeflateRaw that flushes after every write
17
17
  * This ensures true streaming behavior - data is emitted immediately, not buffered
@@ -1,6 +1,9 @@
1
1
  "use strict";
2
2
  Object.defineProperty(exports, "__esModule", { value: true });
3
- exports.DEFAULT_ZIP_TIMESTAMPS = exports.DEFAULT_ZIP_LEVEL = exports.DEFAULT_COMPRESS_LEVEL = void 0;
4
- exports.DEFAULT_COMPRESS_LEVEL = 6;
5
- exports.DEFAULT_ZIP_LEVEL = 6;
6
- exports.DEFAULT_ZIP_TIMESTAMPS = "dos+utc";
3
+ exports.DEFAULT_ZIP_TIMESTAMPS = exports.DEFAULT_ZIP_LEVEL = exports.DEFAULT_COMPRESS_LEVEL = exports.DEFAULT_DEFLATE_LEVEL = void 0;
4
+ exports.DEFAULT_DEFLATE_LEVEL = 6;
5
+ // Backward-compatible aliases (avoid default drift across modules).
6
+ exports.DEFAULT_COMPRESS_LEVEL = exports.DEFAULT_DEFLATE_LEVEL;
7
+ exports.DEFAULT_ZIP_LEVEL = exports.DEFAULT_DEFLATE_LEVEL;
8
+ // Prefer reproducible output by default: omit the Info-ZIP UTC mtime extra field.
9
+ exports.DEFAULT_ZIP_TIMESTAMPS = "dos";
@@ -7,22 +7,12 @@
7
7
  * from this file and then layer their platform-specific bindings.
8
8
  */
9
9
  Object.defineProperty(exports, "__esModule", { value: true });
10
- exports.ZipParser = exports.forEachEntry = exports.listFiles = exports.extractFile = exports.extractAll = exports.ZipDeflate = exports.Zip = exports.ZipDeflateFile = exports.StreamingZip = exports.ZipBuilder = exports.createZipSync = exports.createZip = void 0;
11
- // ZIP builders
12
- var zip_builder_1 = require("./zip-builder.js");
13
- Object.defineProperty(exports, "createZip", { enumerable: true, get: function () { return zip_builder_1.createZip; } });
14
- Object.defineProperty(exports, "createZipSync", { enumerable: true, get: function () { return zip_builder_1.createZipSync; } });
15
- Object.defineProperty(exports, "ZipBuilder", { enumerable: true, get: function () { return zip_builder_1.ZipBuilder; } });
16
- // Streaming ZIP (fflate-like API)
17
- var streaming_zip_1 = require("./streaming-zip.js");
18
- Object.defineProperty(exports, "StreamingZip", { enumerable: true, get: function () { return streaming_zip_1.StreamingZip; } });
19
- Object.defineProperty(exports, "ZipDeflateFile", { enumerable: true, get: function () { return streaming_zip_1.ZipDeflateFile; } });
20
- Object.defineProperty(exports, "Zip", { enumerable: true, get: function () { return streaming_zip_1.Zip; } });
21
- Object.defineProperty(exports, "ZipDeflate", { enumerable: true, get: function () { return streaming_zip_1.ZipDeflate; } });
22
- // Buffer-based unzip API (cross-platform)
23
- var extract_1 = require("./extract.js");
24
- Object.defineProperty(exports, "extractAll", { enumerable: true, get: function () { return extract_1.extractAll; } });
25
- Object.defineProperty(exports, "extractFile", { enumerable: true, get: function () { return extract_1.extractFile; } });
26
- Object.defineProperty(exports, "listFiles", { enumerable: true, get: function () { return extract_1.listFiles; } });
27
- Object.defineProperty(exports, "forEachEntry", { enumerable: true, get: function () { return extract_1.forEachEntry; } });
28
- Object.defineProperty(exports, "ZipParser", { enumerable: true, get: function () { return extract_1.ZipParser; } });
10
+ exports.UnzipEntry = exports.ZipReader = exports.unzip = exports.ZipArchive = exports.zip = void 0;
11
+ // High-level APIs
12
+ var zip_1 = require("./zip/index.js");
13
+ Object.defineProperty(exports, "zip", { enumerable: true, get: function () { return zip_1.zip; } });
14
+ Object.defineProperty(exports, "ZipArchive", { enumerable: true, get: function () { return zip_1.ZipArchive; } });
15
+ var unzip_1 = require("./unzip/index.js");
16
+ Object.defineProperty(exports, "unzip", { enumerable: true, get: function () { return unzip_1.unzip; } });
17
+ Object.defineProperty(exports, "ZipReader", { enumerable: true, get: function () { return unzip_1.ZipReader; } });
18
+ Object.defineProperty(exports, "UnzipEntry", { enumerable: true, get: function () { return unzip_1.UnzipEntry; } });