@cj-tech-master/excelts 1.6.3 → 2.0.0-canary.20251228013952.4f2c3c6

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 (400) hide show
  1. package/README.md +139 -24
  2. package/README_zh.md +140 -26
  3. package/dist/browser/excelts.esm.js +18468 -0
  4. package/dist/browser/excelts.esm.js.map +1 -0
  5. package/dist/browser/excelts.esm.min.js +125 -0
  6. package/dist/browser/excelts.iife.js +13107 -47146
  7. package/dist/browser/excelts.iife.js.map +1 -1
  8. package/dist/browser/excelts.iife.min.js +24 -106
  9. package/dist/cjs/csv/csv-core.js +701 -0
  10. package/dist/cjs/csv/csv-stream.js +646 -0
  11. package/dist/cjs/csv/csv.base.js +137 -0
  12. package/dist/cjs/csv/csv.browser.js +68 -0
  13. package/dist/cjs/csv/csv.js +218 -162
  14. package/dist/cjs/doc/anchor.js +2 -2
  15. package/dist/cjs/doc/cell.js +22 -22
  16. package/dist/cjs/doc/column.js +28 -7
  17. package/dist/cjs/doc/data-validations.js +3 -3
  18. package/dist/cjs/doc/defined-names.js +13 -13
  19. package/dist/cjs/doc/image.js +7 -7
  20. package/dist/cjs/doc/modelcontainer.js +2 -2
  21. package/dist/cjs/doc/note.js +2 -2
  22. package/dist/cjs/doc/pivot-table.js +5 -5
  23. package/dist/cjs/doc/range.js +11 -11
  24. package/dist/cjs/doc/row.js +16 -16
  25. package/dist/cjs/doc/table.js +5 -5
  26. package/dist/cjs/doc/workbook.base.js +211 -0
  27. package/dist/cjs/doc/workbook.browser.js +62 -0
  28. package/dist/cjs/doc/workbook.js +68 -179
  29. package/dist/cjs/doc/worksheet.js +45 -41
  30. package/dist/cjs/index.js +49 -32
  31. package/dist/cjs/stream/xlsx/hyperlink-reader.js +6 -6
  32. package/dist/cjs/stream/xlsx/sheet-comments-writer.js +12 -12
  33. package/dist/cjs/stream/xlsx/sheet-rels-writer.js +4 -4
  34. package/dist/cjs/stream/xlsx/workbook-reader.js +22 -22
  35. package/dist/cjs/stream/xlsx/workbook-writer.js +38 -38
  36. package/dist/cjs/stream/xlsx/worksheet-reader.js +17 -17
  37. package/dist/cjs/stream/xlsx/worksheet-writer.js +67 -60
  38. package/dist/cjs/utils/browser-buffer.js +75 -0
  39. package/dist/cjs/utils/cell-format.js +2 -2
  40. package/dist/cjs/utils/cell-matrix.js +5 -5
  41. package/dist/cjs/utils/datetime.js +499 -0
  42. package/dist/cjs/utils/encryptor.browser.js +240 -0
  43. package/dist/cjs/utils/parse-sax.js +1191 -13
  44. package/dist/cjs/utils/shared-formula.js +5 -5
  45. package/dist/cjs/utils/sheet-utils.js +13 -13
  46. package/dist/cjs/utils/stream-buf.browser.js +355 -0
  47. package/dist/cjs/utils/stream-buf.js +5 -5
  48. package/dist/cjs/utils/unzip/extract.js +11 -11
  49. package/dist/cjs/utils/unzip/index.js +21 -21
  50. package/dist/cjs/utils/unzip/parse-extra-field.js +3 -3
  51. package/dist/cjs/utils/unzip/parse.js +16 -16
  52. package/dist/cjs/utils/unzip/zip-parser.js +14 -3
  53. package/dist/cjs/utils/utils.base.js +161 -0
  54. package/dist/cjs/utils/utils.browser.js +89 -0
  55. package/dist/cjs/utils/utils.js +46 -154
  56. package/dist/cjs/utils/xml-stream.js +3 -3
  57. package/dist/cjs/utils/zip/compress.base.js +88 -0
  58. package/dist/cjs/utils/zip/compress.browser.js +127 -0
  59. package/dist/cjs/utils/zip/compress.js +18 -198
  60. package/dist/cjs/utils/zip/crc32.browser.js +88 -0
  61. package/dist/cjs/utils/zip/deflate-fallback.js +575 -0
  62. package/dist/cjs/utils/zip/index.js +17 -17
  63. package/dist/cjs/utils/zip/streaming-zip.js +264 -0
  64. package/dist/cjs/utils/zip/zip-builder.js +10 -10
  65. package/dist/cjs/utils/zip-stream.browser.js +135 -0
  66. package/dist/cjs/utils/zip-stream.js +4 -4
  67. package/dist/cjs/xlsx/xform/base-xform.js +4 -4
  68. package/dist/cjs/xlsx/xform/book/defined-name-xform.js +4 -4
  69. package/dist/cjs/xlsx/xform/book/sheet-xform.js +4 -4
  70. package/dist/cjs/xlsx/xform/book/workbook-calc-properties-xform.js +2 -2
  71. package/dist/cjs/xlsx/xform/book/workbook-pivot-cache-xform.js +2 -2
  72. package/dist/cjs/xlsx/xform/book/workbook-properties-xform.js +2 -2
  73. package/dist/cjs/xlsx/xform/book/workbook-view-xform.js +2 -2
  74. package/dist/cjs/xlsx/xform/book/workbook-xform.js +24 -24
  75. package/dist/cjs/xlsx/xform/comment/comment-xform.js +4 -4
  76. package/dist/cjs/xlsx/xform/comment/comments-xform.js +6 -6
  77. package/dist/cjs/xlsx/xform/comment/style/vml-position-xform.js +2 -2
  78. package/dist/cjs/xlsx/xform/comment/style/vml-protection-xform.js +2 -2
  79. package/dist/cjs/xlsx/xform/comment/vml-anchor-xform.js +2 -2
  80. package/dist/cjs/xlsx/xform/comment/vml-client-data-xform.js +10 -10
  81. package/dist/cjs/xlsx/xform/comment/vml-notes-xform.js +6 -6
  82. package/dist/cjs/xlsx/xform/comment/vml-shape-xform.js +6 -6
  83. package/dist/cjs/xlsx/xform/comment/vml-textbox-xform.js +2 -2
  84. package/dist/cjs/xlsx/xform/composite-xform.js +2 -2
  85. package/dist/cjs/xlsx/xform/core/app-heading-pairs-xform.js +2 -2
  86. package/dist/cjs/xlsx/xform/core/app-titles-of-parts-xform.js +2 -2
  87. package/dist/cjs/xlsx/xform/core/app-xform.js +11 -11
  88. package/dist/cjs/xlsx/xform/core/content-types-xform.js +4 -4
  89. package/dist/cjs/xlsx/xform/core/core-xform.js +23 -23
  90. package/dist/cjs/xlsx/xform/core/relationship-xform.js +2 -2
  91. package/dist/cjs/xlsx/xform/core/relationships-xform.js +6 -6
  92. package/dist/cjs/xlsx/xform/drawing/base-cell-anchor-xform.js +2 -2
  93. package/dist/cjs/xlsx/xform/drawing/blip-fill-xform.js +4 -4
  94. package/dist/cjs/xlsx/xform/drawing/blip-xform.js +2 -2
  95. package/dist/cjs/xlsx/xform/drawing/c-nv-pic-pr-xform.js +2 -2
  96. package/dist/cjs/xlsx/xform/drawing/c-nv-pr-xform.js +6 -6
  97. package/dist/cjs/xlsx/xform/drawing/cell-position-xform.js +7 -7
  98. package/dist/cjs/xlsx/xform/drawing/drawing-xform.js +10 -10
  99. package/dist/cjs/xlsx/xform/drawing/ext-lst-xform.js +2 -2
  100. package/dist/cjs/xlsx/xform/drawing/ext-xform.js +2 -2
  101. package/dist/cjs/xlsx/xform/drawing/hlink-click-xform.js +2 -2
  102. package/dist/cjs/xlsx/xform/drawing/nv-pic-pr-xform.js +6 -6
  103. package/dist/cjs/xlsx/xform/drawing/one-cell-anchor-xform.js +10 -10
  104. package/dist/cjs/xlsx/xform/drawing/pic-xform.js +9 -9
  105. package/dist/cjs/xlsx/xform/drawing/two-cell-anchor-xform.js +9 -9
  106. package/dist/cjs/xlsx/xform/list-xform.js +2 -2
  107. package/dist/cjs/xlsx/xform/pivot-table/cache-field-xform.js +5 -5
  108. package/dist/cjs/xlsx/xform/pivot-table/cache-field.js +3 -3
  109. package/dist/cjs/xlsx/xform/pivot-table/pivot-cache-definition-xform.js +10 -10
  110. package/dist/cjs/xlsx/xform/pivot-table/pivot-cache-records-xform.js +9 -9
  111. package/dist/cjs/xlsx/xform/pivot-table/pivot-table-xform.js +10 -11
  112. package/dist/cjs/xlsx/xform/sheet/auto-filter-xform.js +4 -4
  113. package/dist/cjs/xlsx/xform/sheet/cell-xform.js +65 -65
  114. package/dist/cjs/xlsx/xform/sheet/cf/cf-rule-xform.js +27 -27
  115. package/dist/cjs/xlsx/xform/sheet/cf/cfvo-xform.js +3 -3
  116. package/dist/cjs/xlsx/xform/sheet/cf/color-scale-xform.js +6 -6
  117. package/dist/cjs/xlsx/xform/sheet/cf/conditional-formatting-xform.js +6 -6
  118. package/dist/cjs/xlsx/xform/sheet/cf/conditional-formattings-xform.js +4 -4
  119. package/dist/cjs/xlsx/xform/sheet/cf/databar-xform.js +6 -6
  120. package/dist/cjs/xlsx/xform/sheet/cf/ext-lst-ref-xform.js +5 -5
  121. package/dist/cjs/xlsx/xform/sheet/cf/formula-xform.js +2 -2
  122. package/dist/cjs/xlsx/xform/sheet/cf/icon-set-xform.js +11 -11
  123. package/dist/cjs/xlsx/xform/sheet/cf-ext/cf-icon-ext-xform.js +3 -3
  124. package/dist/cjs/xlsx/xform/sheet/cf-ext/cf-rule-ext-xform.js +11 -12
  125. package/dist/cjs/xlsx/xform/sheet/cf-ext/cfvo-ext-xform.js +4 -4
  126. package/dist/cjs/xlsx/xform/sheet/cf-ext/conditional-formatting-ext-xform.js +8 -8
  127. package/dist/cjs/xlsx/xform/sheet/cf-ext/conditional-formattings-ext-xform.js +6 -6
  128. package/dist/cjs/xlsx/xform/sheet/cf-ext/databar-ext-xform.js +26 -26
  129. package/dist/cjs/xlsx/xform/sheet/cf-ext/f-ext-xform.js +2 -2
  130. package/dist/cjs/xlsx/xform/sheet/cf-ext/icon-set-ext-xform.js +14 -14
  131. package/dist/cjs/xlsx/xform/sheet/cf-ext/sqref-ext-xform.js +2 -2
  132. package/dist/cjs/xlsx/xform/sheet/col-breaks-xform.js +38 -0
  133. package/dist/cjs/xlsx/xform/sheet/col-xform.js +6 -6
  134. package/dist/cjs/xlsx/xform/sheet/data-validations-xform.js +18 -18
  135. package/dist/cjs/xlsx/xform/sheet/dimension-xform.js +2 -2
  136. package/dist/cjs/xlsx/xform/sheet/drawing-xform.js +2 -2
  137. package/dist/cjs/xlsx/xform/sheet/ext-lst-xform.js +5 -5
  138. package/dist/cjs/xlsx/xform/sheet/header-footer-xform.js +2 -2
  139. package/dist/cjs/xlsx/xform/sheet/hyperlink-xform.js +2 -2
  140. package/dist/cjs/xlsx/xform/sheet/merge-cell-xform.js +2 -2
  141. package/dist/cjs/xlsx/xform/sheet/merges.js +8 -8
  142. package/dist/cjs/xlsx/xform/sheet/outline-properties-xform.js +2 -2
  143. package/dist/cjs/xlsx/xform/sheet/page-breaks-xform.js +15 -3
  144. package/dist/cjs/xlsx/xform/sheet/page-margins-xform.js +2 -2
  145. package/dist/cjs/xlsx/xform/sheet/page-setup-properties-xform.js +2 -2
  146. package/dist/cjs/xlsx/xform/sheet/page-setup-xform.js +2 -2
  147. package/dist/cjs/xlsx/xform/sheet/picture-xform.js +2 -2
  148. package/dist/cjs/xlsx/xform/sheet/print-options-xform.js +2 -2
  149. package/dist/cjs/xlsx/xform/sheet/row-breaks-xform.js +15 -17
  150. package/dist/cjs/xlsx/xform/sheet/row-xform.js +11 -11
  151. package/dist/cjs/xlsx/xform/sheet/sheet-format-properties-xform.js +2 -2
  152. package/dist/cjs/xlsx/xform/sheet/sheet-properties-xform.js +8 -8
  153. package/dist/cjs/xlsx/xform/sheet/sheet-protection-xform.js +2 -2
  154. package/dist/cjs/xlsx/xform/sheet/sheet-view-xform.js +4 -4
  155. package/dist/cjs/xlsx/xform/sheet/table-part-xform.js +2 -2
  156. package/dist/cjs/xlsx/xform/sheet/worksheet-xform.js +75 -70
  157. package/dist/cjs/xlsx/xform/simple/boolean-xform.js +2 -2
  158. package/dist/cjs/xlsx/xform/simple/date-xform.js +2 -2
  159. package/dist/cjs/xlsx/xform/simple/float-xform.js +2 -2
  160. package/dist/cjs/xlsx/xform/simple/integer-xform.js +2 -2
  161. package/dist/cjs/xlsx/xform/simple/string-xform.js +2 -2
  162. package/dist/cjs/xlsx/xform/static-xform.js +4 -4
  163. package/dist/cjs/xlsx/xform/strings/phonetic-text-xform.js +6 -6
  164. package/dist/cjs/xlsx/xform/strings/rich-text-xform.js +6 -6
  165. package/dist/cjs/xlsx/xform/strings/shared-string-xform.js +8 -8
  166. package/dist/cjs/xlsx/xform/strings/shared-strings-xform.js +6 -6
  167. package/dist/cjs/xlsx/xform/strings/text-xform.js +2 -2
  168. package/dist/cjs/xlsx/xform/style/alignment-xform.js +8 -8
  169. package/dist/cjs/xlsx/xform/style/border-xform.js +8 -8
  170. package/dist/cjs/xlsx/xform/style/color-xform.js +2 -2
  171. package/dist/cjs/xlsx/xform/style/dxf-xform.js +14 -14
  172. package/dist/cjs/xlsx/xform/style/fill-xform.js +9 -9
  173. package/dist/cjs/xlsx/xform/style/font-xform.js +22 -22
  174. package/dist/cjs/xlsx/xform/style/numfmt-xform.js +5 -5
  175. package/dist/cjs/xlsx/xform/style/protection-xform.js +2 -2
  176. package/dist/cjs/xlsx/xform/style/style-xform.js +6 -6
  177. package/dist/cjs/xlsx/xform/style/styles-xform.js +39 -39
  178. package/dist/cjs/xlsx/xform/style/underline-xform.js +2 -2
  179. package/dist/cjs/xlsx/xform/table/auto-filter-xform.js +4 -4
  180. package/dist/cjs/xlsx/xform/table/custom-filter-xform.js +2 -2
  181. package/dist/cjs/xlsx/xform/table/filter-column-xform.js +9 -9
  182. package/dist/cjs/xlsx/xform/table/filter-xform.js +2 -2
  183. package/dist/cjs/xlsx/xform/table/table-column-xform.js +2 -2
  184. package/dist/cjs/xlsx/xform/table/table-style-info-xform.js +2 -2
  185. package/dist/cjs/xlsx/xform/table/table-xform.js +12 -12
  186. package/dist/cjs/xlsx/xlsx.base.js +742 -0
  187. package/dist/cjs/xlsx/xlsx.browser.js +162 -0
  188. package/dist/cjs/xlsx/xlsx.js +118 -892
  189. package/dist/esm/csv/csv-core.js +694 -0
  190. package/dist/esm/csv/csv-stream.js +638 -0
  191. package/dist/esm/csv/csv.base.js +127 -0
  192. package/dist/esm/csv/csv.browser.js +65 -0
  193. package/dist/esm/csv/csv.js +181 -159
  194. package/dist/esm/doc/column.js +21 -0
  195. package/dist/esm/doc/workbook.base.js +207 -0
  196. package/dist/esm/doc/workbook.browser.js +59 -0
  197. package/dist/esm/doc/workbook.js +64 -175
  198. package/dist/esm/doc/worksheet.js +4 -0
  199. package/dist/esm/index.browser.js +33 -1
  200. package/dist/esm/index.js +23 -8
  201. package/dist/esm/local.js +0 -1
  202. package/dist/esm/stream/xlsx/workbook-writer.js +1 -1
  203. package/dist/esm/stream/xlsx/worksheet-writer.js +8 -1
  204. package/dist/esm/utils/browser-buffer.js +67 -0
  205. package/dist/esm/utils/datetime.js +493 -0
  206. package/dist/esm/utils/encryptor.browser.js +237 -0
  207. package/dist/esm/utils/parse-sax.js +1188 -12
  208. package/dist/esm/utils/stream-buf.browser.js +352 -0
  209. package/dist/esm/utils/unzip/zip-parser.js +11 -0
  210. package/dist/esm/utils/utils.base.js +142 -0
  211. package/dist/esm/utils/utils.browser.js +68 -0
  212. package/dist/esm/utils/utils.js +15 -123
  213. package/dist/esm/utils/zip/compress.base.js +83 -0
  214. package/dist/esm/utils/zip/compress.browser.js +121 -0
  215. package/dist/esm/utils/zip/compress.js +16 -164
  216. package/dist/esm/utils/zip/crc32.browser.js +82 -0
  217. package/dist/esm/utils/zip/deflate-fallback.js +570 -0
  218. package/dist/esm/utils/zip/streaming-zip.js +259 -0
  219. package/dist/esm/utils/zip-stream.browser.js +132 -0
  220. package/dist/esm/xlsx/xform/pivot-table/pivot-table-xform.js +2 -3
  221. package/dist/esm/xlsx/xform/sheet/cf-ext/cf-rule-ext-xform.js +2 -3
  222. package/dist/esm/xlsx/xform/sheet/col-breaks-xform.js +35 -0
  223. package/dist/esm/xlsx/xform/sheet/page-breaks-xform.js +13 -1
  224. package/dist/esm/xlsx/xform/sheet/row-breaks-xform.js +11 -13
  225. package/dist/esm/xlsx/xform/sheet/worksheet-xform.js +7 -2
  226. package/dist/esm/xlsx/xlsx.base.js +739 -0
  227. package/dist/esm/xlsx/xlsx.browser.js +159 -0
  228. package/dist/esm/xlsx/xlsx.js +114 -888
  229. package/dist/types/csv/csv-core.d.ts +207 -0
  230. package/dist/types/csv/csv-stream.d.ts +114 -0
  231. package/dist/types/csv/csv.base.d.ts +62 -0
  232. package/dist/types/csv/csv.browser.d.ts +33 -0
  233. package/dist/types/csv/csv.d.ts +97 -71
  234. package/dist/types/doc/anchor.d.ts +1 -1
  235. package/dist/types/doc/cell.d.ts +7 -7
  236. package/dist/types/doc/column.d.ts +9 -3
  237. package/dist/types/doc/defined-names.d.ts +4 -4
  238. package/dist/types/doc/image.d.ts +2 -2
  239. package/dist/types/doc/modelcontainer.d.ts +1 -1
  240. package/dist/types/doc/pivot-table.d.ts +1 -1
  241. package/dist/types/doc/range.d.ts +1 -1
  242. package/dist/types/doc/row.d.ts +3 -3
  243. package/dist/types/doc/table.d.ts +2 -2
  244. package/dist/types/doc/workbook.base.d.ts +111 -0
  245. package/dist/types/doc/workbook.browser.d.ts +38 -0
  246. package/dist/types/doc/workbook.d.ts +62 -92
  247. package/dist/types/doc/worksheet.d.ts +12 -10
  248. package/dist/types/index.browser.d.ts +19 -5
  249. package/dist/types/index.d.ts +24 -23
  250. package/dist/types/local.d.ts +0 -1
  251. package/dist/types/stream/xlsx/hyperlink-reader.d.ts +1 -1
  252. package/dist/types/stream/xlsx/workbook-reader.d.ts +4 -4
  253. package/dist/types/stream/xlsx/workbook-writer.d.ts +7 -7
  254. package/dist/types/stream/xlsx/worksheet-reader.d.ts +5 -5
  255. package/dist/types/stream/xlsx/worksheet-writer.d.ts +11 -9
  256. package/dist/types/types.d.ts +6 -0
  257. package/dist/types/utils/browser-buffer.d.ts +28 -0
  258. package/dist/types/utils/col-cache.d.ts +1 -1
  259. package/dist/types/utils/datetime.d.ts +56 -0
  260. package/dist/types/utils/encryptor.browser.d.ts +28 -0
  261. package/dist/types/utils/parse-sax.d.ts +108 -1
  262. package/dist/types/utils/sheet-utils.d.ts +3 -3
  263. package/dist/types/utils/stream-buf.browser.d.ts +41 -0
  264. package/dist/types/utils/unzip/extract.d.ts +6 -6
  265. package/dist/types/utils/unzip/index.d.ts +8 -8
  266. package/dist/types/utils/unzip/parse.d.ts +3 -3
  267. package/dist/types/utils/unzip/zip-parser.d.ts +5 -0
  268. package/dist/types/utils/utils.base.d.ts +29 -0
  269. package/dist/types/utils/utils.browser.d.ts +29 -0
  270. package/dist/types/utils/utils.d.ts +6 -25
  271. package/dist/types/utils/zip/compress.base.d.ts +45 -0
  272. package/dist/types/utils/zip/compress.browser.d.ts +63 -0
  273. package/dist/types/utils/zip/compress.d.ts +13 -45
  274. package/dist/types/utils/zip/crc32.browser.d.ts +52 -0
  275. package/dist/types/utils/zip/deflate-fallback.d.ts +39 -0
  276. package/dist/types/utils/zip/index.d.ts +5 -5
  277. package/dist/types/utils/zip/streaming-zip.d.ts +96 -0
  278. package/dist/types/utils/zip/zip-builder.d.ts +1 -1
  279. package/dist/types/utils/zip-stream.browser.d.ts +39 -0
  280. package/dist/types/xlsx/xform/base-xform.d.ts +1 -1
  281. package/dist/types/xlsx/xform/book/defined-name-xform.d.ts +1 -1
  282. package/dist/types/xlsx/xform/book/sheet-xform.d.ts +1 -1
  283. package/dist/types/xlsx/xform/book/workbook-calc-properties-xform.d.ts +1 -1
  284. package/dist/types/xlsx/xform/book/workbook-pivot-cache-xform.d.ts +1 -1
  285. package/dist/types/xlsx/xform/book/workbook-properties-xform.d.ts +1 -1
  286. package/dist/types/xlsx/xform/book/workbook-view-xform.d.ts +1 -1
  287. package/dist/types/xlsx/xform/book/workbook-xform.d.ts +2 -2
  288. package/dist/types/xlsx/xform/comment/comment-xform.d.ts +2 -2
  289. package/dist/types/xlsx/xform/comment/comments-xform.d.ts +2 -2
  290. package/dist/types/xlsx/xform/comment/style/vml-position-xform.d.ts +1 -1
  291. package/dist/types/xlsx/xform/comment/style/vml-protection-xform.d.ts +1 -1
  292. package/dist/types/xlsx/xform/comment/vml-anchor-xform.d.ts +1 -1
  293. package/dist/types/xlsx/xform/comment/vml-client-data-xform.d.ts +1 -1
  294. package/dist/types/xlsx/xform/comment/vml-notes-xform.d.ts +1 -1
  295. package/dist/types/xlsx/xform/comment/vml-shape-xform.d.ts +1 -1
  296. package/dist/types/xlsx/xform/comment/vml-textbox-xform.d.ts +1 -1
  297. package/dist/types/xlsx/xform/composite-xform.d.ts +1 -1
  298. package/dist/types/xlsx/xform/core/app-heading-pairs-xform.d.ts +1 -1
  299. package/dist/types/xlsx/xform/core/app-titles-of-parts-xform.d.ts +1 -1
  300. package/dist/types/xlsx/xform/core/app-xform.d.ts +1 -1
  301. package/dist/types/xlsx/xform/core/content-types-xform.d.ts +1 -1
  302. package/dist/types/xlsx/xform/core/core-xform.d.ts +1 -1
  303. package/dist/types/xlsx/xform/core/relationship-xform.d.ts +1 -1
  304. package/dist/types/xlsx/xform/core/relationships-xform.d.ts +1 -1
  305. package/dist/types/xlsx/xform/drawing/base-cell-anchor-xform.d.ts +1 -1
  306. package/dist/types/xlsx/xform/drawing/blip-fill-xform.d.ts +2 -2
  307. package/dist/types/xlsx/xform/drawing/blip-xform.d.ts +1 -1
  308. package/dist/types/xlsx/xform/drawing/c-nv-pic-pr-xform.d.ts +1 -1
  309. package/dist/types/xlsx/xform/drawing/c-nv-pr-xform.d.ts +1 -1
  310. package/dist/types/xlsx/xform/drawing/cell-position-xform.d.ts +2 -2
  311. package/dist/types/xlsx/xform/drawing/drawing-xform.d.ts +1 -1
  312. package/dist/types/xlsx/xform/drawing/ext-lst-xform.d.ts +1 -1
  313. package/dist/types/xlsx/xform/drawing/ext-xform.d.ts +1 -1
  314. package/dist/types/xlsx/xform/drawing/hlink-click-xform.d.ts +1 -1
  315. package/dist/types/xlsx/xform/drawing/nv-pic-pr-xform.d.ts +1 -1
  316. package/dist/types/xlsx/xform/drawing/one-cell-anchor-xform.d.ts +1 -1
  317. package/dist/types/xlsx/xform/drawing/pic-xform.d.ts +1 -1
  318. package/dist/types/xlsx/xform/drawing/two-cell-anchor-xform.d.ts +1 -1
  319. package/dist/types/xlsx/xform/list-xform.d.ts +1 -1
  320. package/dist/types/xlsx/xform/pivot-table/cache-field-xform.d.ts +1 -1
  321. package/dist/types/xlsx/xform/pivot-table/pivot-cache-definition-xform.d.ts +3 -3
  322. package/dist/types/xlsx/xform/pivot-table/pivot-cache-records-xform.d.ts +2 -2
  323. package/dist/types/xlsx/xform/pivot-table/pivot-table-xform.d.ts +1 -1
  324. package/dist/types/xlsx/xform/sheet/auto-filter-xform.d.ts +1 -1
  325. package/dist/types/xlsx/xform/sheet/cell-xform.d.ts +1 -1
  326. package/dist/types/xlsx/xform/sheet/cf/cf-rule-xform.d.ts +6 -6
  327. package/dist/types/xlsx/xform/sheet/cf/cfvo-xform.d.ts +1 -1
  328. package/dist/types/xlsx/xform/sheet/cf/color-scale-xform.d.ts +3 -3
  329. package/dist/types/xlsx/xform/sheet/cf/conditional-formatting-xform.d.ts +1 -1
  330. package/dist/types/xlsx/xform/sheet/cf/conditional-formattings-xform.d.ts +2 -2
  331. package/dist/types/xlsx/xform/sheet/cf/databar-xform.d.ts +3 -3
  332. package/dist/types/xlsx/xform/sheet/cf/ext-lst-ref-xform.d.ts +1 -1
  333. package/dist/types/xlsx/xform/sheet/cf/formula-xform.d.ts +1 -1
  334. package/dist/types/xlsx/xform/sheet/cf/icon-set-xform.d.ts +2 -2
  335. package/dist/types/xlsx/xform/sheet/cf-ext/cf-icon-ext-xform.d.ts +1 -1
  336. package/dist/types/xlsx/xform/sheet/cf-ext/cf-rule-ext-xform.d.ts +3 -3
  337. package/dist/types/xlsx/xform/sheet/cf-ext/cfvo-ext-xform.d.ts +2 -2
  338. package/dist/types/xlsx/xform/sheet/cf-ext/conditional-formatting-ext-xform.d.ts +3 -3
  339. package/dist/types/xlsx/xform/sheet/cf-ext/conditional-formattings-ext-xform.d.ts +2 -2
  340. package/dist/types/xlsx/xform/sheet/cf-ext/databar-ext-xform.d.ts +3 -3
  341. package/dist/types/xlsx/xform/sheet/cf-ext/f-ext-xform.d.ts +1 -1
  342. package/dist/types/xlsx/xform/sheet/cf-ext/icon-set-ext-xform.d.ts +3 -3
  343. package/dist/types/xlsx/xform/sheet/cf-ext/sqref-ext-xform.d.ts +1 -1
  344. package/dist/types/xlsx/xform/sheet/col-breaks-xform.d.ts +16 -0
  345. package/dist/types/xlsx/xform/sheet/col-xform.d.ts +1 -1
  346. package/dist/types/xlsx/xform/sheet/data-validations-xform.d.ts +1 -1
  347. package/dist/types/xlsx/xform/sheet/dimension-xform.d.ts +1 -1
  348. package/dist/types/xlsx/xform/sheet/drawing-xform.d.ts +1 -1
  349. package/dist/types/xlsx/xform/sheet/ext-lst-xform.d.ts +1 -1
  350. package/dist/types/xlsx/xform/sheet/header-footer-xform.d.ts +1 -1
  351. package/dist/types/xlsx/xform/sheet/hyperlink-xform.d.ts +1 -1
  352. package/dist/types/xlsx/xform/sheet/merge-cell-xform.d.ts +1 -1
  353. package/dist/types/xlsx/xform/sheet/outline-properties-xform.d.ts +1 -1
  354. package/dist/types/xlsx/xform/sheet/page-breaks-xform.d.ts +5 -1
  355. package/dist/types/xlsx/xform/sheet/page-margins-xform.d.ts +1 -1
  356. package/dist/types/xlsx/xform/sheet/page-setup-properties-xform.d.ts +1 -1
  357. package/dist/types/xlsx/xform/sheet/page-setup-xform.d.ts +1 -1
  358. package/dist/types/xlsx/xform/sheet/picture-xform.d.ts +1 -1
  359. package/dist/types/xlsx/xform/sheet/print-options-xform.d.ts +1 -1
  360. package/dist/types/xlsx/xform/sheet/row-breaks-xform.d.ts +5 -1
  361. package/dist/types/xlsx/xform/sheet/row-xform.d.ts +1 -1
  362. package/dist/types/xlsx/xform/sheet/sheet-format-properties-xform.d.ts +1 -1
  363. package/dist/types/xlsx/xform/sheet/sheet-properties-xform.d.ts +1 -1
  364. package/dist/types/xlsx/xform/sheet/sheet-protection-xform.d.ts +1 -1
  365. package/dist/types/xlsx/xform/sheet/sheet-view-xform.d.ts +1 -1
  366. package/dist/types/xlsx/xform/sheet/table-part-xform.d.ts +1 -1
  367. package/dist/types/xlsx/xform/sheet/worksheet-xform.d.ts +1 -1
  368. package/dist/types/xlsx/xform/simple/boolean-xform.d.ts +1 -1
  369. package/dist/types/xlsx/xform/simple/date-xform.d.ts +1 -1
  370. package/dist/types/xlsx/xform/simple/float-xform.d.ts +1 -1
  371. package/dist/types/xlsx/xform/simple/integer-xform.d.ts +1 -1
  372. package/dist/types/xlsx/xform/simple/string-xform.d.ts +1 -1
  373. package/dist/types/xlsx/xform/static-xform.d.ts +1 -1
  374. package/dist/types/xlsx/xform/strings/phonetic-text-xform.d.ts +1 -1
  375. package/dist/types/xlsx/xform/strings/rich-text-xform.d.ts +3 -3
  376. package/dist/types/xlsx/xform/strings/shared-string-xform.d.ts +1 -1
  377. package/dist/types/xlsx/xform/strings/shared-strings-xform.d.ts +2 -2
  378. package/dist/types/xlsx/xform/strings/text-xform.d.ts +1 -1
  379. package/dist/types/xlsx/xform/style/alignment-xform.d.ts +1 -1
  380. package/dist/types/xlsx/xform/style/border-xform.d.ts +2 -2
  381. package/dist/types/xlsx/xform/style/color-xform.d.ts +1 -1
  382. package/dist/types/xlsx/xform/style/dxf-xform.d.ts +1 -1
  383. package/dist/types/xlsx/xform/style/fill-xform.d.ts +2 -2
  384. package/dist/types/xlsx/xform/style/font-xform.d.ts +1 -1
  385. package/dist/types/xlsx/xform/style/numfmt-xform.d.ts +1 -1
  386. package/dist/types/xlsx/xform/style/protection-xform.d.ts +1 -1
  387. package/dist/types/xlsx/xform/style/style-xform.d.ts +3 -3
  388. package/dist/types/xlsx/xform/style/styles-xform.d.ts +2 -2
  389. package/dist/types/xlsx/xform/style/underline-xform.d.ts +1 -1
  390. package/dist/types/xlsx/xform/table/auto-filter-xform.d.ts +2 -2
  391. package/dist/types/xlsx/xform/table/custom-filter-xform.d.ts +1 -1
  392. package/dist/types/xlsx/xform/table/filter-column-xform.d.ts +2 -2
  393. package/dist/types/xlsx/xform/table/filter-xform.d.ts +1 -1
  394. package/dist/types/xlsx/xform/table/table-column-xform.d.ts +1 -1
  395. package/dist/types/xlsx/xform/table/table-style-info-xform.d.ts +1 -1
  396. package/dist/types/xlsx/xform/table/table-xform.d.ts +1 -1
  397. package/dist/types/xlsx/xlsx.base.d.ts +134 -0
  398. package/dist/types/xlsx/xlsx.browser.d.ts +31 -0
  399. package/dist/types/xlsx/xlsx.d.ts +20 -80
  400. package/package.json +16 -39
@@ -0,0 +1,207 @@
1
+ /**
2
+ * CSV Parser and Formatter - RFC 4180 compliant
3
+ *
4
+ * A lightweight, cross-platform CSV implementation that works in both
5
+ * Node.js and Browser environments with zero dependencies.
6
+ *
7
+ * High-performance RFC 4180 compliant CSV parser and formatter.
8
+ *
9
+ * @see https://tools.ietf.org/html/rfc4180
10
+ */
11
+ /** Header array type (can include undefined to skip columns) */
12
+ export type HeaderArray = (string | undefined | null)[];
13
+ /** Header transform function */
14
+ export type HeaderTransformFunction = (headers: string[]) => HeaderArray;
15
+ /** Row types */
16
+ export type RowArray = string[];
17
+ export type RowMap = Record<string, string>;
18
+ export type Row = RowArray | RowMap;
19
+ /** Row transform callback */
20
+ export type RowTransformCallback<T> = (error?: Error | null, row?: T | null) => void;
21
+ /** Row transform function - sync or async */
22
+ export type RowTransformFunction<I = Row, O = Row> = ((row: I) => O | null) | ((row: I, callback: RowTransformCallback<O>) => void);
23
+ /** Row validate callback */
24
+ export type RowValidateCallback = (error?: Error | null, isValid?: boolean, reason?: string) => void;
25
+ /** Row validate function - sync or async */
26
+ export type RowValidateFunction<T = Row> = ((row: T) => boolean) | ((row: T, callback: RowValidateCallback) => void);
27
+ /** Validation result */
28
+ export interface RowValidationResult<T = Row> {
29
+ row: T | null;
30
+ isValid: boolean;
31
+ reason?: string;
32
+ }
33
+ /**
34
+ * CSV parsing options
35
+ */
36
+ export interface CsvParseOptions {
37
+ /** Field delimiter (default: ",") */
38
+ delimiter?: string;
39
+ /** Quote character (default: '"'), set to false or null to disable quoting */
40
+ quote?: string | false | null;
41
+ /** Escape character for quotes (default: '"'), set to false or null to disable */
42
+ escape?: string | false | null;
43
+ /** Skip empty lines (default: false) */
44
+ skipEmptyLines?: boolean;
45
+ /** Alias for skipEmptyLines */
46
+ ignoreEmpty?: boolean;
47
+ /** Trim whitespace from both sides of fields (default: false) */
48
+ trim?: boolean;
49
+ /** Left trim whitespace from fields (default: false) */
50
+ ltrim?: boolean;
51
+ /** Right trim whitespace from fields (default: false) */
52
+ rtrim?: boolean;
53
+ /**
54
+ * Header handling:
55
+ * - true: first row is headers, return objects
56
+ * - false: no headers, return arrays
57
+ * - string[]: use these as headers
58
+ * - function: transform first row headers
59
+ */
60
+ headers?: boolean | HeaderArray | HeaderTransformFunction;
61
+ /**
62
+ * If true and headers is string[], discard first row and use provided headers
63
+ */
64
+ renameHeaders?: boolean;
65
+ /** Comment character - lines starting with this are ignored */
66
+ comment?: string;
67
+ /** Maximum number of data rows to parse (excluding header) */
68
+ maxRows?: number;
69
+ /** Number of lines to skip at the beginning (before header detection) */
70
+ skipLines?: number;
71
+ /** Number of data rows to skip (after header detection) */
72
+ skipRows?: number;
73
+ /**
74
+ * Strict column handling:
75
+ * - If true, rows with column count mismatch emit 'data-invalid' event
76
+ * - If false (default), throws error on mismatch (unless discardUnmappedColumns)
77
+ */
78
+ strictColumnHandling?: boolean;
79
+ /**
80
+ * If true, discard columns that exceed header count
81
+ * Only valid when headers are specified
82
+ */
83
+ discardUnmappedColumns?: boolean;
84
+ /**
85
+ * Enable object mode (default: true for Node.js streams)
86
+ * - true: push row objects/arrays
87
+ * - false: push JSON strings
88
+ */
89
+ objectMode?: boolean;
90
+ /**
91
+ * Character encoding for input (default: "utf8")
92
+ * Only used in Node.js streaming context
93
+ */
94
+ encoding?: BufferEncoding;
95
+ /**
96
+ * Synchronous transform function to apply to each row after parsing
97
+ * Return null/undefined to skip the row
98
+ * Works in both Node.js and Browser environments
99
+ *
100
+ * @example
101
+ * // With headers (row is Record<string, string>)
102
+ * transform: (row) => ({ ...row, name: row.name.toUpperCase() })
103
+ *
104
+ * // Without headers (row is string[])
105
+ * transform: (row) => [row[0].toUpperCase(), row[1]]
106
+ */
107
+ transform?: (row: Row) => Row | null | undefined;
108
+ /**
109
+ * Synchronous validate function to check each row
110
+ * Return false to mark row as invalid (will be in invalidRows)
111
+ * Can also return { isValid: boolean, reason?: string }
112
+ * Works in both Node.js and Browser environments
113
+ *
114
+ * @example
115
+ * // With headers
116
+ * validate: (row) => row.name !== ''
117
+ *
118
+ * // With custom reason
119
+ * validate: (row) => ({ isValid: row.age >= 18, reason: 'Must be adult' })
120
+ */
121
+ validate?: (row: Row) => boolean | {
122
+ isValid: boolean;
123
+ reason?: string;
124
+ };
125
+ }
126
+ /**
127
+ * CSV formatting options
128
+ */
129
+ export interface CsvFormatOptions {
130
+ /** Field delimiter (default: ",") */
131
+ delimiter?: string;
132
+ /** Quote character (default: '"'), set to false or null to disable quoting */
133
+ quote?: string | false | null;
134
+ /** Escape character (default: same as quote) */
135
+ escape?: string | false | null;
136
+ /** Row delimiter (default: "\n") */
137
+ rowDelimiter?: string;
138
+ /** Always quote all fields (default: false, only quote when necessary) */
139
+ alwaysQuote?: boolean;
140
+ /** Quote specific columns by name or index */
141
+ quoteColumns?: boolean | boolean[] | Record<string, boolean>;
142
+ /** Quote header fields */
143
+ quoteHeaders?: boolean | boolean[] | Record<string, boolean>;
144
+ /**
145
+ * Header handling:
146
+ * - true: auto-detect headers from first object
147
+ * - false/null: no headers
148
+ * - string[]: use these as headers
149
+ */
150
+ headers?: string[] | boolean | null;
151
+ /**
152
+ * Whether to write headers (default: true when headers is provided)
153
+ * Set to false to suppress header row output
154
+ */
155
+ writeHeaders?: boolean;
156
+ /** Include BOM for UTF-8 (default: false) */
157
+ writeBOM?: boolean;
158
+ /** Include final row delimiter (default: true) */
159
+ includeEndRowDelimiter?: boolean;
160
+ /** Write headers even when there's no data (default: false) */
161
+ alwaysWriteHeaders?: boolean;
162
+ /**
163
+ * Transform function to apply to each row before formatting
164
+ * Can be sync (returns row) or async (calls callback)
165
+ */
166
+ transform?: RowTransformFunction<Row, Row>;
167
+ /**
168
+ * Enable object mode (default: true for Node.js streams)
169
+ * - true: accept row objects/arrays directly
170
+ * - false: accept JSON strings
171
+ */
172
+ objectMode?: boolean;
173
+ }
174
+ /**
175
+ * Parsed CSV result with headers
176
+ */
177
+ export interface CsvParseResult<T = string[]> {
178
+ /** Header row (if headers option was true) */
179
+ headers?: string[];
180
+ /** Data rows */
181
+ rows: T[];
182
+ /** Invalid rows (when strictColumnHandling is true) */
183
+ invalidRows?: {
184
+ row: string[];
185
+ reason: string;
186
+ }[];
187
+ }
188
+ /**
189
+ * Check if a transform function is synchronous (1 argument) vs async (2 arguments)
190
+ */
191
+ export declare function isSyncTransform<I, O>(transform: RowTransformFunction<I, O>): transform is (row: I) => O | null;
192
+ /**
193
+ * Check if a validate function is synchronous (1 argument) vs async (2 arguments)
194
+ */
195
+ export declare function isSyncValidate<T>(validate: RowValidateFunction<T>): validate is (row: T) => boolean;
196
+ /**
197
+ * Parse a CSV string into rows of fields
198
+ */
199
+ export declare function parseCsv(input: string, options?: CsvParseOptions): string[][] | CsvParseResult<Record<string, string>>;
200
+ /**
201
+ * Format data as a CSV string
202
+ */
203
+ export declare function formatCsv(data: (string | number | boolean | null | undefined)[][] | Record<string, any>[], options?: CsvFormatOptions): string;
204
+ /**
205
+ * Async CSV parser that yields rows one at a time
206
+ */
207
+ export declare function parseCsvStream(input: string | AsyncIterable<string>, options?: CsvParseOptions): AsyncGenerator<string[] | Record<string, string>, void, unknown>;
@@ -0,0 +1,114 @@
1
+ /**
2
+ * CSV Streaming Support for Node.js
3
+ *
4
+ * Provides true streaming CSV parsing and formatting using Node.js streams.
5
+ * This enables processing of large CSV files without loading them entirely into memory.
6
+ */
7
+ import { Transform, type Readable, type TransformCallback } from "stream";
8
+ import type { CsvParseOptions, CsvFormatOptions, RowTransformFunction, RowValidateFunction, Row } from "./csv-core";
9
+ /**
10
+ * Transform stream that parses CSV data row by row
11
+ *
12
+ * @example
13
+ * ```ts
14
+ * const parser = new CsvParserStream({ headers: true });
15
+ * fs.createReadStream('data.csv')
16
+ * .pipe(parser)
17
+ * .on('data', (row) => console.log(row));
18
+ * ```
19
+ */
20
+ export declare class CsvParserStream extends Transform {
21
+ private options;
22
+ private buffer;
23
+ private currentRow;
24
+ private currentField;
25
+ private inQuotes;
26
+ private lineNumber;
27
+ private rowCount;
28
+ private skippedDataRows;
29
+ private headerRow;
30
+ private headersEmitted;
31
+ private delimiter;
32
+ private quote;
33
+ private escape;
34
+ private quoteEnabled;
35
+ private _rowTransform;
36
+ private _rowValidator;
37
+ private encoding;
38
+ constructor(options?: CsvParseOptions);
39
+ /**
40
+ * Set a transform function to modify rows before emitting
41
+ * Supports both sync and async transforms
42
+ */
43
+ transform<I extends Row = Row, O extends Row = Row>(transformFunction: RowTransformFunction<I, O>): this;
44
+ /**
45
+ * Set a validate function to filter rows
46
+ * Invalid rows emit 'data-invalid' event
47
+ */
48
+ validate<T extends Row = Row>(validateFunction: RowValidateFunction<T>): this;
49
+ _transform(chunk: Buffer | string, encoding: BufferEncoding, callback: TransformCallback): void;
50
+ _flush(callback: TransformCallback): void;
51
+ private applyTrim;
52
+ private processBuffer;
53
+ private buildRow;
54
+ private processPendingRows;
55
+ private transformAndValidateRow;
56
+ private validateRow;
57
+ private emitRow;
58
+ }
59
+ /**
60
+ * Options for CSV formatter stream
61
+ */
62
+ export interface CsvFormatterStreamOptions extends CsvFormatOptions {
63
+ /** Whether input is objects (vs arrays) */
64
+ objectMode?: boolean;
65
+ }
66
+ /**
67
+ * Transform stream that formats rows to CSV
68
+ *
69
+ * @example
70
+ * ```ts
71
+ * const formatter = new CsvFormatterStream({ headers: ['name', 'age'] });
72
+ * formatter.pipe(fs.createWriteStream('output.csv'));
73
+ * formatter.write(['Alice', 30]);
74
+ * formatter.write(['Bob', 25]);
75
+ * formatter.end();
76
+ * ```
77
+ */
78
+ export declare class CsvFormatterStream extends Transform {
79
+ private options;
80
+ private delimiter;
81
+ private quote;
82
+ private escape;
83
+ private rowDelimiter;
84
+ private quoteEnabled;
85
+ private alwaysQuote;
86
+ private headerWritten;
87
+ private headers;
88
+ private shouldWriteHeaders;
89
+ private rowCount;
90
+ private _rowTransform;
91
+ constructor(options?: CsvFormatterStreamOptions);
92
+ /**
93
+ * Set a transform function to modify rows before formatting
94
+ */
95
+ transform<I extends Row = Row, O extends Row = Row>(transformFunction: RowTransformFunction<I, O>): this;
96
+ _transform(chunk: any, encoding: BufferEncoding, callback: TransformCallback): void;
97
+ _flush(callback: TransformCallback): void;
98
+ private formatAndPush;
99
+ private formatRow;
100
+ private shouldQuoteField;
101
+ private formatField;
102
+ }
103
+ /**
104
+ * Create a readable stream from an array of rows
105
+ */
106
+ export declare function createCsvReadableStream(rows: any[][], options?: CsvFormatOptions): Readable;
107
+ /**
108
+ * Create parser stream factory
109
+ */
110
+ export declare function createCsvParserStream(options?: CsvParseOptions): CsvParserStream;
111
+ /**
112
+ * Create formatter stream factory
113
+ */
114
+ export declare function createCsvFormatterStream(options?: CsvFormatterStreamOptions): CsvFormatterStream;
@@ -0,0 +1,62 @@
1
+ /**
2
+ * CSV Base class - Shared functionality for Node.js and Browser
3
+ *
4
+ * Uses native CSV parser (RFC 4180 compliant) with zero external dependencies.
5
+ * Date parsing uses native high-performance datetime utilities.
6
+ */
7
+ import { type DateFormat } from "../utils/datetime";
8
+ import { type CsvParseOptions, type CsvFormatOptions } from "./csv-core";
9
+ import type { Workbook } from "../doc/workbook";
10
+ import type { Worksheet } from "../doc/worksheet";
11
+ /**
12
+ * CSV read options
13
+ */
14
+ export interface CsvReadOptions {
15
+ /** Date format strings to try when parsing (default: ISO formats) */
16
+ dateFormats?: readonly DateFormat[];
17
+ /** Custom value mapper function */
18
+ map?(value: any, index: number): any;
19
+ /** Worksheet name to create (default: "Sheet1") */
20
+ sheetName?: string;
21
+ /** CSV parsing options */
22
+ parserOptions?: Partial<CsvParseOptions>;
23
+ }
24
+ /**
25
+ * CSV write options
26
+ */
27
+ export interface CsvWriteOptions {
28
+ /** Date format for output (default: ISO format) */
29
+ dateFormat?: string;
30
+ /** Use UTC for dates (default: false) */
31
+ dateUTC?: boolean;
32
+ /** Worksheet name or ID to export */
33
+ sheetName?: string;
34
+ /** Worksheet ID to export */
35
+ sheetId?: number;
36
+ /** Output encoding (default: "utf8") */
37
+ encoding?: string;
38
+ /** Custom value mapper function */
39
+ map?(value: any, index: number): any;
40
+ /** Include empty rows (default: true) */
41
+ includeEmptyRows?: boolean;
42
+ /** CSV formatting options */
43
+ formatterOptions?: Partial<CsvFormatOptions>;
44
+ }
45
+ /**
46
+ * Create the default value mapper for CSV parsing
47
+ */
48
+ export declare function createDefaultValueMapper(dateFormats: readonly DateFormat[]): (datum: any) => any;
49
+ /**
50
+ * Create the default value mapper for CSV writing
51
+ */
52
+ export declare function createDefaultWriteMapper(dateFormat?: string, dateUTC?: boolean): (value: any) => any;
53
+ /**
54
+ * Parse CSV content into a worksheet
55
+ */
56
+ export declare function parseCsvToWorksheet(content: string, workbook: Workbook, options?: CsvReadOptions): Worksheet;
57
+ /**
58
+ * Format worksheet as CSV string
59
+ */
60
+ export declare function formatWorksheetToCsv(worksheet: Worksheet | undefined, options?: CsvWriteOptions): string;
61
+ export { parseCsv, formatCsv, parseCsvStream } from "./csv-core";
62
+ export type { CsvParseOptions, CsvFormatOptions, CsvParseResult } from "./csv-core";
@@ -0,0 +1,33 @@
1
+ /**
2
+ * CSV class for Browser - No file system dependencies
3
+ *
4
+ * Provides:
5
+ * - load: Load from string or ArrayBuffer
6
+ * - writeString: Write to string
7
+ * - writeBuffer: Write to Uint8Array
8
+ */
9
+ import { type CsvReadOptions, type CsvWriteOptions } from "./csv.base";
10
+ import type { Workbook } from "../doc/workbook.browser";
11
+ import type { Worksheet } from "../doc/worksheet";
12
+ declare class CSV {
13
+ workbook: Workbook;
14
+ constructor(workbook: Workbook);
15
+ /**
16
+ * Load CSV from string or ArrayBuffer
17
+ */
18
+ load(data: string | ArrayBuffer | Uint8Array, options?: CsvReadOptions): Worksheet;
19
+ /**
20
+ * Write CSV to string
21
+ */
22
+ writeString(options?: CsvWriteOptions): string;
23
+ /**
24
+ * Write CSV to Uint8Array buffer
25
+ */
26
+ writeBuffer(options?: CsvWriteOptions): Uint8Array;
27
+ readFile(_filename: string, _options?: CsvReadOptions): Promise<never>;
28
+ read(_stream: any, _options?: CsvReadOptions): Promise<never>;
29
+ writeFile(_filename: string, _options?: CsvWriteOptions): Promise<never>;
30
+ write(_stream: any, _options?: CsvWriteOptions): Promise<never>;
31
+ }
32
+ export { CSV };
33
+ export type { CsvReadOptions, CsvWriteOptions } from "./csv.base";
@@ -1,79 +1,105 @@
1
- import type { Workbook } from "../doc/workbook.js";
2
- import type { Worksheet } from "../doc/worksheet.js";
3
- type HeaderArray = (string | undefined | null)[];
4
- type HeaderTransformFunction = (headers: HeaderArray) => HeaderArray;
5
- export interface FastCsvParserOptionsArgs {
6
- objectMode?: boolean;
7
- delimiter?: string;
8
- quote?: string | null;
9
- escape?: string;
10
- headers?: boolean | HeaderTransformFunction | HeaderArray;
11
- renameHeaders?: boolean;
12
- ignoreEmpty?: boolean;
13
- comment?: string;
14
- strictColumnHandling?: boolean;
15
- discardUnmappedColumns?: boolean;
16
- trim?: boolean;
17
- ltrim?: boolean;
18
- rtrim?: boolean;
19
- encoding?: string;
20
- maxRows?: number;
21
- skipLines?: number;
22
- skipRows?: number;
1
+ /**
2
+ * CSV class for Node.js - Full streaming and file system support
3
+ *
4
+ * Features:
5
+ * - readFile: Read from file path (streaming)
6
+ * - writeFile: Write to file path (streaming)
7
+ * - read: Read from Node.js stream
8
+ * - write: Write to Node.js stream
9
+ * - createReadStream: Create a readable stream from worksheet
10
+ * - createWriteStream: Create a writable stream that writes to worksheet
11
+ */
12
+ import { type Readable, type Writable } from "stream";
13
+ import { type CsvReadOptions, type CsvWriteOptions } from "./csv.base";
14
+ import type { Workbook } from "../doc/workbook";
15
+ import type { Worksheet } from "../doc/worksheet";
16
+ /**
17
+ * Extended read options for streaming
18
+ */
19
+ export interface CsvStreamReadOptions extends CsvReadOptions {
20
+ /** High water mark for stream (default: 64KB) */
21
+ highWaterMark?: number;
23
22
  }
24
- interface QuoteColumnMap {
25
- [s: string]: boolean;
26
- }
27
- type QuoteColumns = boolean | boolean[] | QuoteColumnMap;
28
- interface RowMap {
29
- [key: string]: any;
30
- }
31
- type RowHashArray = [string, any][];
32
- type RowArray = string[];
33
- type Rows = RowArray | RowMap | RowHashArray;
34
- type RowTransformCallback = (error?: Error | null, row?: Rows) => void;
35
- interface RowTransformFunction {
36
- (row: Rows, callback: RowTransformCallback): void;
37
- (row: Rows): Rows;
38
- }
39
- export interface FastCsvFormatterOptionsArgs {
40
- objectMode?: boolean;
41
- delimiter?: string;
42
- rowDelimiter?: string;
43
- quote?: string | boolean;
44
- escape?: string;
45
- quoteColumns?: QuoteColumns;
46
- quoteHeaders?: QuoteColumns;
47
- headers?: null | boolean | string[];
48
- includeEndRowDelimiter?: boolean;
49
- writeBOM?: boolean;
50
- transform?: RowTransformFunction;
51
- alwaysWriteHeaders?: boolean;
52
- }
53
- export interface CsvReadOptions {
54
- dateFormats?: string[];
55
- map?(value: any, index: number): any;
56
- sheetName?: string;
57
- parserOptions?: Partial<FastCsvParserOptionsArgs>;
58
- }
59
- export interface CsvWriteOptions {
60
- dateFormat?: string;
61
- dateUTC?: boolean;
62
- sheetName?: string;
63
- sheetId?: number;
64
- encoding?: string;
65
- map?(value: any, index: number): any;
66
- includeEmptyRows?: boolean;
67
- formatterOptions?: Partial<FastCsvFormatterOptionsArgs>;
23
+ /**
24
+ * Extended write options for streaming
25
+ */
26
+ export interface CsvStreamWriteOptions extends CsvWriteOptions {
27
+ /** High water mark for stream (default: 64KB) */
28
+ highWaterMark?: number;
68
29
  }
69
30
  declare class CSV {
70
31
  workbook: Workbook;
71
- worksheet: Worksheet;
72
32
  constructor(workbook: Workbook);
73
- readFile(filename: string, options?: CsvReadOptions): Promise<Worksheet>;
74
- read(stream: any, options?: CsvReadOptions): Promise<Worksheet>;
75
- write(stream: any, options?: CsvWriteOptions): Promise<void>;
76
- writeFile(filename: string, options?: CsvWriteOptions): Promise<void>;
33
+ /**
34
+ * Read CSV from file using streaming
35
+ *
36
+ * @example
37
+ * ```ts
38
+ * const worksheet = await workbook.csv.readFile('data.csv');
39
+ * ```
40
+ */
41
+ readFile(filename: string, options?: CsvStreamReadOptions): Promise<Worksheet>;
42
+ /**
43
+ * Read CSV from Node.js readable stream
44
+ *
45
+ * Uses true streaming - processes data row by row without loading entire file into memory.
46
+ *
47
+ * @example
48
+ * ```ts
49
+ * const stream = fs.createReadStream('data.csv');
50
+ * const worksheet = await workbook.csv.read(stream);
51
+ * ```
52
+ */
53
+ read(stream: Readable, options?: CsvReadOptions): Promise<Worksheet>;
54
+ /**
55
+ * Write CSV to file using streaming
56
+ *
57
+ * @example
58
+ * ```ts
59
+ * await workbook.csv.writeFile('output.csv');
60
+ * ```
61
+ */
62
+ writeFile(filename: string, options?: CsvStreamWriteOptions): Promise<void>;
63
+ /**
64
+ * Write CSV to Node.js writable stream
65
+ *
66
+ * Uses true streaming - writes data row by row.
67
+ *
68
+ * @example
69
+ * ```ts
70
+ * const stream = fs.createWriteStream('output.csv');
71
+ * await workbook.csv.write(stream);
72
+ * ```
73
+ */
74
+ write(stream: Writable, options?: CsvWriteOptions): Promise<void>;
75
+ /**
76
+ * Write CSV to buffer
77
+ *
78
+ * Note: This loads the entire CSV into memory. For large files, use write() with a stream.
79
+ */
77
80
  writeBuffer(options?: CsvWriteOptions): Promise<Buffer>;
81
+ /**
82
+ * Create a readable stream that outputs CSV rows from the worksheet
83
+ *
84
+ * @example
85
+ * ```ts
86
+ * const csvStream = workbook.csv.createReadStream();
87
+ * csvStream.pipe(fs.createWriteStream('output.csv'));
88
+ * ```
89
+ */
90
+ createReadStream(options?: CsvWriteOptions): Readable;
91
+ /**
92
+ * Create a writable stream that parses CSV and adds rows to a worksheet
93
+ *
94
+ * @example
95
+ * ```ts
96
+ * const csvWriter = workbook.csv.createWriteStream({ sheetName: 'Data' });
97
+ * fs.createReadStream('input.csv').pipe(csvWriter);
98
+ * await new Promise(resolve => csvWriter.on('finish', resolve));
99
+ * ```
100
+ */
101
+ createWriteStream(options?: CsvReadOptions): Writable;
78
102
  }
79
103
  export { CSV };
104
+ export type { CsvReadOptions, CsvWriteOptions } from "./csv.base";
105
+ export { CsvParserStream, CsvFormatterStream } from "./csv-stream";
@@ -1,4 +1,4 @@
1
- import type { Worksheet } from "./worksheet.js";
1
+ import type { Worksheet } from "./worksheet";
2
2
  interface AnchorModel {
3
3
  nativeCol: number;
4
4
  nativeRow: number;
@@ -1,9 +1,9 @@
1
- import { Note } from "./note.js";
2
- import type { Row } from "./row.js";
3
- import type { Column } from "./column.js";
4
- import type { Worksheet } from "./worksheet.js";
5
- import type { Workbook } from "./workbook.js";
6
- import type { Style, NumFmt, Font, Alignment, Protection, Borders, Fill, CellRichTextValue, CellErrorValue, DataValidation, CellValue, CellHyperlinkValue } from "../types.js";
1
+ import { Note } from "./note";
2
+ import type { Row } from "./row";
3
+ import type { Column } from "./column";
4
+ import type { Worksheet } from "./worksheet";
5
+ import type { Workbook } from "./workbook";
6
+ import type { Style, NumFmt, Font, Alignment, Protection, Borders, Fill, CellRichTextValue, CellErrorValue, DataValidation, CellValue, CellHyperlinkValue } from "../types";
7
7
  export type HyperlinkValueData = CellHyperlinkValue;
8
8
  export type FormulaResult = string | number | boolean | Date | CellErrorValue;
9
9
  export interface FormulaValueData {
@@ -68,7 +68,7 @@ export interface CellModel {
68
68
  }
69
69
  export type CellValueType = CellValue;
70
70
  declare class Cell {
71
- static Types: typeof import("./enums.js").ValueType;
71
+ static Types: typeof import("./enums").ValueType;
72
72
  private _row;
73
73
  private _column;
74
74
  private _address;
@@ -1,6 +1,6 @@
1
- import type { Cell, CellValueType } from "./cell.js";
2
- import type { Worksheet } from "./worksheet.js";
3
- import type { Style, NumFmt, Font, Alignment, Protection, Borders, Fill, CellValue } from "../types.js";
1
+ import type { Cell, CellValueType } from "./cell";
2
+ import type { Worksheet } from "./worksheet";
3
+ import type { Style, NumFmt, Font, Alignment, Protection, Borders, Fill, CellValue } from "../types";
4
4
  /** Header value type - can be a single value or array for multi-row headers */
5
5
  export type ColumnHeaderValue = CellValue | CellValue[];
6
6
  export interface ColumnDefn {
@@ -97,6 +97,12 @@ declare class Column {
97
97
  */
98
98
  get values(): CellValueType[];
99
99
  set values(v: CellValueType[]);
100
+ /**
101
+ * Add a page break after this column.
102
+ * @param top - Optional top row limit for the page break (1-indexed)
103
+ * @param bottom - Optional bottom row limit for the page break (1-indexed)
104
+ */
105
+ addPageBreak(top?: number, bottom?: number): void;
100
106
  get numFmt(): string | NumFmt | undefined;
101
107
  set numFmt(value: string | undefined);
102
108
  get font(): Partial<Font> | undefined;
@@ -1,7 +1,7 @@
1
- import { type DecodedRange } from "../utils/col-cache.js";
2
- import { CellMatrix } from "../utils/cell-matrix.js";
3
- import { Range } from "./range.js";
4
- import type { Address } from "../types.js";
1
+ import { type DecodedRange } from "../utils/col-cache";
2
+ import { CellMatrix } from "../utils/cell-matrix";
3
+ import { Range } from "./range";
4
+ import type { Address } from "../types";
5
5
  interface DefinedNameCell {
6
6
  sheetName?: string;
7
7
  address: string;
@@ -1,5 +1,5 @@
1
- import { Anchor, type AnchorModel } from "./anchor.js";
2
- import type { Worksheet } from "./worksheet.js";
1
+ import { Anchor, type AnchorModel } from "./anchor";
2
+ import type { Worksheet } from "./worksheet";
3
3
  interface ImageHyperlinks {
4
4
  hyperlink?: string;
5
5
  tooltip?: string;
@@ -1,4 +1,4 @@
1
- import { XLSX } from "../xlsx/xlsx.js";
1
+ import { XLSX } from "../xlsx/xlsx";
2
2
  declare class ModelContainer {
3
3
  model: any;
4
4
  private _xlsx?;