@shbernal/ts-xlsx 3.0.0 → 3.2.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (277) hide show
  1. package/README.md +34 -24
  2. package/dist/bytes.d.ts +10 -2
  3. package/dist/bytes.js +22 -0
  4. package/dist/core/address.d.ts +96 -2
  5. package/dist/core/address.js +87 -33
  6. package/dist/core/array-formula-ranges.d.ts +33 -0
  7. package/dist/core/array-formula-ranges.js +62 -0
  8. package/dist/core/autofilter.d.ts +4 -3
  9. package/dist/core/autofilter.js +31 -30
  10. package/dist/core/axis-handle.d.ts +2 -0
  11. package/dist/core/axis-handle.js +5 -2
  12. package/dist/core/cell.d.ts +4 -3
  13. package/dist/core/cell.js +4 -6
  14. package/dist/core/clone.d.ts +29 -0
  15. package/dist/core/clone.js +24 -0
  16. package/dist/core/color-resolution.js +4 -6
  17. package/dist/core/column.d.ts +1 -0
  18. package/dist/core/column.js +6 -2
  19. package/dist/core/comment-thread.d.ts +7 -3
  20. package/dist/core/comment-thread.js +2 -1
  21. package/dist/core/conditional-formatting-overlay.d.ts +11 -1
  22. package/dist/core/conditional-formatting-overlay.js +30 -3
  23. package/dist/core/conditional-formatting.d.ts +107 -11
  24. package/dist/core/conditional-formatting.js +76 -19
  25. package/dist/core/containers.d.ts +12 -0
  26. package/dist/core/containers.js +5 -0
  27. package/dist/core/data-validation-overlay.d.ts +7 -1
  28. package/dist/core/data-validation-overlay.js +19 -4
  29. package/dist/core/data-validation.d.ts +22 -0
  30. package/dist/core/data-validation.js +30 -4
  31. package/dist/core/date-format.d.ts +20 -0
  32. package/dist/core/date-format.js +170 -0
  33. package/dist/core/date.d.ts +43 -8
  34. package/dist/core/date.js +19 -3
  35. package/dist/core/formula-references.d.ts +26 -0
  36. package/dist/core/formula-references.js +173 -0
  37. package/dist/core/formula-scan.d.ts +2 -0
  38. package/dist/core/formula-scan.js +58 -0
  39. package/dist/core/formula.d.ts +76 -17
  40. package/dist/core/formula.js +87 -80
  41. package/dist/core/function-values.d.ts +4 -0
  42. package/dist/core/function-values.js +58 -0
  43. package/dist/core/future-functions.d.ts +3 -0
  44. package/dist/core/{modern-functions.js → future-functions.js} +119 -88
  45. package/dist/core/grid-edits.d.ts +30 -3
  46. package/dist/core/grid-edits.js +248 -81
  47. package/dist/core/grid-shift.d.ts +58 -9
  48. package/dist/core/grid-shift.js +26 -4
  49. package/dist/core/hyperlink.d.ts +39 -0
  50. package/dist/core/hyperlink.js +88 -0
  51. package/dist/core/image.d.ts +49 -14
  52. package/dist/core/image.js +16 -5
  53. package/dist/core/internal.d.ts +10 -2
  54. package/dist/core/limits.d.ts +25 -0
  55. package/dist/core/limits.js +4 -0
  56. package/dist/core/merge.d.ts +18 -4
  57. package/dist/core/merge.js +33 -20
  58. package/dist/core/page-setup.d.ts +26 -11
  59. package/dist/core/pivot-table.d.ts +49 -10
  60. package/dist/core/pivot-table.js +112 -60
  61. package/dist/core/protection.d.ts +66 -4
  62. package/dist/core/protection.js +6 -11
  63. package/dist/core/range.js +34 -30
  64. package/dist/core/row-input.js +2 -2
  65. package/dist/core/row.d.ts +1 -0
  66. package/dist/core/row.js +6 -2
  67. package/dist/core/structured-reference.d.ts +7 -0
  68. package/dist/core/structured-reference.js +7 -0
  69. package/dist/core/style.d.ts +85 -70
  70. package/dist/core/style.js +92 -28
  71. package/dist/core/table-style.d.ts +1 -1
  72. package/dist/core/table-style.js +4 -4
  73. package/dist/core/table.d.ts +64 -16
  74. package/dist/core/table.js +87 -40
  75. package/dist/core/theme.d.ts +2 -0
  76. package/dist/core/theme.js +9 -5
  77. package/dist/core/value.d.ts +60 -28
  78. package/dist/core/value.js +48 -43
  79. package/dist/core/workbook-media.d.ts +34 -0
  80. package/dist/core/workbook-media.js +44 -0
  81. package/dist/core/workbook-styles.d.ts +83 -1
  82. package/dist/core/workbook-styles.js +4 -0
  83. package/dist/core/workbook-theme.js +5 -3
  84. package/dist/core/workbook-vba.js +3 -2
  85. package/dist/core/workbook.d.ts +41 -3
  86. package/dist/core/workbook.js +46 -41
  87. package/dist/core/worksheet-comments.d.ts +2 -1
  88. package/dist/core/worksheet-comments.js +20 -13
  89. package/dist/core/worksheet-merges.d.ts +49 -0
  90. package/dist/core/worksheet-merges.js +65 -0
  91. package/dist/core/worksheet-model.d.ts +10 -2
  92. package/dist/core/worksheet-model.js +28 -9
  93. package/dist/core/worksheet-pictures.d.ts +3 -3
  94. package/dist/core/worksheet-pictures.js +7 -6
  95. package/dist/core/worksheet.d.ts +165 -27
  96. package/dist/core/worksheet.js +206 -89
  97. package/dist/customui/ribbon.js +2 -1
  98. package/dist/entries/core.d.ts +21 -14
  99. package/dist/entries/core.js +14 -7
  100. package/dist/entries/errors.d.ts +1 -0
  101. package/dist/entries/errors.js +1 -0
  102. package/dist/entries/xlsx.d.ts +1 -1
  103. package/dist/errors.d.ts +64 -0
  104. package/dist/errors.js +22 -0
  105. package/dist/hex.d.ts +8 -0
  106. package/dist/hex.js +3 -0
  107. package/dist/io/cell-metadata/metadata.d.ts +42 -0
  108. package/dist/io/cell-metadata/metadata.js +35 -0
  109. package/dist/io/cell-metadata/rich-values.d.ts +11 -0
  110. package/dist/io/cell-metadata/rich-values.js +80 -0
  111. package/dist/io/csv/delimiter.d.ts +21 -0
  112. package/dist/io/csv/delimiter.js +18 -0
  113. package/dist/io/csv/errors.d.ts +14 -0
  114. package/dist/io/csv/errors.js +5 -0
  115. package/dist/io/csv/read.d.ts +6 -1
  116. package/dist/io/csv/read.js +51 -22
  117. package/dist/io/csv/write.d.ts +19 -5
  118. package/dist/io/csv/write.js +24 -44
  119. package/dist/io/opc/inflate.js +14 -0
  120. package/dist/io/opc/namespaces.d.ts +16 -0
  121. package/dist/io/opc/namespaces.js +4 -0
  122. package/dist/io/opc/part-paths.d.ts +9 -0
  123. package/dist/io/opc/part-paths.js +5 -5
  124. package/dist/io/opc/read-opc.d.ts +58 -14
  125. package/dist/io/opc/read-opc.js +49 -21
  126. package/dist/io/opc/read-options.d.ts +5 -1
  127. package/dist/io/opc/sniff-format.d.ts +3 -3
  128. package/dist/io/opc/sniff-format.js +2 -2
  129. package/dist/io/opc/strict-relationships.d.ts +2 -0
  130. package/dist/io/opc/strict-relationships.js +12 -0
  131. package/dist/io/read-policy/column-budget.d.ts +26 -0
  132. package/dist/io/read-policy/column-budget.js +18 -0
  133. package/dist/io/read-policy/read-repair.d.ts +74 -0
  134. package/dist/io/read-policy/read-repair.js +119 -0
  135. package/dist/io/style/cell-style-resolution.d.ts +25 -0
  136. package/dist/io/style/cell-style-resolution.js +30 -0
  137. package/dist/io/style/xf-style.d.ts +23 -1
  138. package/dist/io/style/xf-style.js +8 -0
  139. package/dist/io/xlsb/formula.d.ts +2 -2
  140. package/dist/io/xlsb/formula.js +52 -35
  141. package/dist/io/xlsb/primitives.js +8 -14
  142. package/dist/io/xlsb/ptg-functions.d.ts +19 -10
  143. package/dist/io/xlsb/ptg-functions.js +495 -596
  144. package/dist/io/xlsb/read-metadata.d.ts +7 -0
  145. package/dist/io/xlsb/read-metadata.js +69 -0
  146. package/dist/io/xlsb/read-styles.js +45 -81
  147. package/dist/io/xlsb/read-worksheet.d.ts +26 -1
  148. package/dist/io/xlsb/read-worksheet.js +148 -106
  149. package/dist/io/xlsb/read.d.ts +6 -3
  150. package/dist/io/xlsb/read.js +70 -31
  151. package/dist/io/xlsb/record-stream.d.ts +30 -0
  152. package/dist/io/xlsb/record-stream.js +20 -0
  153. package/dist/io/xlsb/record-types.d.ts +14 -5
  154. package/dist/io/xlsb/record-types.js +14 -5
  155. package/dist/io/xlsb/sheet-protection.d.ts +20 -0
  156. package/dist/io/xlsb/sheet-protection.js +60 -0
  157. package/dist/io/xlsx/cell-accumulator.d.ts +24 -9
  158. package/dist/io/xlsx/cell-accumulator.js +74 -21
  159. package/dist/io/xlsx/cell-metadata.d.ts +39 -0
  160. package/dist/io/xlsx/cell-metadata.js +162 -0
  161. package/dist/io/xlsx/cell-value.d.ts +19 -5
  162. package/dist/io/xlsx/cell-value.js +45 -30
  163. package/dist/io/xlsx/color-xml.js +3 -2
  164. package/dist/io/xlsx/column-span.d.ts +11 -0
  165. package/dist/io/xlsx/column-span.js +9 -0
  166. package/dist/io/xlsx/comments.d.ts +9 -30
  167. package/dist/io/xlsx/comments.js +25 -83
  168. package/dist/io/xlsx/conditional-formatting.d.ts +43 -23
  169. package/dist/io/xlsx/conditional-formatting.js +437 -138
  170. package/dist/io/xlsx/data-validation.d.ts +12 -7
  171. package/dist/io/xlsx/data-validation.js +67 -53
  172. package/dist/io/xlsx/edit-vba.d.ts +7 -2
  173. package/dist/io/xlsx/edit-vba.js +52 -52
  174. package/dist/io/xlsx/font-xml.d.ts +7 -0
  175. package/dist/io/xlsx/font-xml.js +104 -0
  176. package/dist/io/xlsx/hyperlinks.d.ts +19 -21
  177. package/dist/io/xlsx/hyperlinks.js +12 -32
  178. package/dist/io/xlsx/images.d.ts +49 -16
  179. package/dist/io/xlsx/images.js +149 -50
  180. package/dist/io/xlsx/namespaces.d.ts +24 -0
  181. package/dist/io/xlsx/namespaces.js +11 -0
  182. package/dist/io/xlsx/package-plan.d.ts +60 -15
  183. package/dist/io/xlsx/package-plan.js +83 -18
  184. package/dist/io/xlsx/part-names.d.ts +6 -8
  185. package/dist/io/xlsx/part-names.js +3 -7
  186. package/dist/io/xlsx/pivot.d.ts +5 -5
  187. package/dist/io/xlsx/pivot.js +26 -24
  188. package/dist/io/xlsx/preserved-splices.d.ts +6 -0
  189. package/dist/io/xlsx/preserved-splices.js +74 -0
  190. package/dist/io/xlsx/read-comments.d.ts +29 -0
  191. package/dist/io/xlsx/read-comments.js +75 -0
  192. package/dist/io/xlsx/read-parts.d.ts +59 -0
  193. package/dist/io/xlsx/read-parts.js +259 -0
  194. package/dist/io/xlsx/read-pivot.js +11 -4
  195. package/dist/io/xlsx/{rich-runs.d.ts → read-rich-runs.d.ts} +8 -5
  196. package/dist/io/xlsx/{rich-runs.js → read-rich-runs.js} +24 -4
  197. package/dist/io/xlsx/read-rows.d.ts +35 -11
  198. package/dist/io/xlsx/read-rows.js +73 -49
  199. package/dist/io/xlsx/read-shared-strings.js +3 -2
  200. package/dist/io/xlsx/read-styles.d.ts +0 -30
  201. package/dist/io/xlsx/read-styles.js +45 -105
  202. package/dist/io/xlsx/read-workbook-xml.d.ts +42 -0
  203. package/dist/io/xlsx/read-workbook-xml.js +175 -0
  204. package/dist/io/xlsx/read-worksheet.d.ts +9 -3
  205. package/dist/io/xlsx/read-worksheet.js +70 -177
  206. package/dist/io/xlsx/read.d.ts +3 -14
  207. package/dist/io/xlsx/read.js +74 -411
  208. package/dist/io/xlsx/relationships.d.ts +3 -0
  209. package/dist/io/xlsx/relationships.js +4 -0
  210. package/dist/io/xlsx/rich-text.js +1 -1
  211. package/dist/io/xlsx/row-position.d.ts +20 -0
  212. package/dist/io/xlsx/row-position.js +11 -0
  213. package/dist/io/xlsx/row-xml.d.ts +139 -0
  214. package/dist/io/xlsx/row-xml.js +222 -0
  215. package/dist/io/xlsx/shared-formulas.js +2 -2
  216. package/dist/io/xlsx/sheet-properties.d.ts +10 -1
  217. package/dist/io/xlsx/sheet-properties.js +182 -20
  218. package/dist/io/xlsx/strict-parts.d.ts +7 -0
  219. package/dist/io/xlsx/strict-parts.js +171 -0
  220. package/dist/io/xlsx/style-elements.d.ts +41 -0
  221. package/dist/io/xlsx/style-elements.js +136 -0
  222. package/dist/io/xlsx/styles.d.ts +17 -3
  223. package/dist/io/xlsx/styles.js +13 -209
  224. package/dist/io/xlsx/tables.d.ts +10 -2
  225. package/dist/io/xlsx/tables.js +55 -52
  226. package/dist/io/xlsx/theme-xml.d.ts +32 -4
  227. package/dist/io/xlsx/theme-xml.js +106 -71
  228. package/dist/io/xlsx/threaded-comments.d.ts +14 -11
  229. package/dist/io/xlsx/threaded-comments.js +16 -8
  230. package/dist/io/xlsx/workbook-xml.d.ts +45 -6
  231. package/dist/io/xlsx/workbook-xml.js +62 -54
  232. package/dist/io/xlsx/worksheet-xml.d.ts +26 -70
  233. package/dist/io/xlsx/worksheet-xml.js +69 -282
  234. package/dist/io/xlsx/write-stream.d.ts +90 -19
  235. package/dist/io/xlsx/write-stream.js +80 -25
  236. package/dist/io/xlsx/write.d.ts +12 -6
  237. package/dist/io/xlsx/write.js +226 -123
  238. package/dist/rel-type.d.ts +25 -0
  239. package/dist/rel-type.js +9 -0
  240. package/dist/token-set.d.ts +13 -0
  241. package/dist/token-set.js +4 -1
  242. package/dist/vba/bytes.d.ts +16 -5
  243. package/dist/vba/bytes.js +27 -6
  244. package/dist/vba/cfb-format.d.ts +55 -0
  245. package/dist/vba/cfb-format.js +35 -0
  246. package/dist/vba/cfb-writer.d.ts +8 -0
  247. package/dist/vba/cfb-writer.js +40 -40
  248. package/dist/vba/cfb.d.ts +21 -4
  249. package/dist/vba/cfb.js +124 -90
  250. package/dist/vba/codepage.js +2 -1
  251. package/dist/vba/dir-records.d.ts +6 -0
  252. package/dist/vba/dir-records.js +10 -2
  253. package/dist/vba/errors.d.ts +11 -4
  254. package/dist/vba/index.d.ts +0 -2
  255. package/dist/vba/index.js +0 -2
  256. package/dist/vba/ms-ovba.d.ts +6 -2
  257. package/dist/vba/ms-ovba.js +66 -22
  258. package/dist/vba/project-editor.js +129 -119
  259. package/dist/vba/project.d.ts +15 -1
  260. package/dist/vba/project.js +38 -13
  261. package/dist/vba/vba-encoding.d.ts +4 -10
  262. package/dist/vba/vba-encoding.js +3 -17
  263. package/dist/xml/xml-attrs.d.ts +37 -0
  264. package/dist/xml/xml-attrs.js +30 -0
  265. package/dist/xml/xml-chars.d.ts +40 -0
  266. package/dist/xml/xml-chars.js +12 -0
  267. package/dist/xml/xml-namespaces.d.ts +31 -0
  268. package/dist/xml/xml-namespaces.js +50 -0
  269. package/dist/xml/xml-read.d.ts +101 -11
  270. package/dist/xml/xml-read.js +150 -18
  271. package/dist/xml/xml-scan.d.ts +25 -34
  272. package/dist/xml/xml-scan.js +69 -46
  273. package/dist/xml/xml.d.ts +59 -26
  274. package/dist/xml/xml.js +45 -23
  275. package/package.json +15 -9
  276. package/skills/ts-xlsx-upstream/SKILL.md +21 -13
  277. package/dist/core/modern-functions.d.ts +0 -1
package/dist/xml/xml.js CHANGED
@@ -1,4 +1,5 @@
1
- import { AuthoringError } from '../errors.js';
1
+ import { assertWritableNumber, AuthoringError, codePointHex, invalidToken, unrepresentable, } from '../errors.js';
2
+ import { XML_UNREPRESENTABLE, XML_UNREPRESENTABLE_GLOBAL } from './xml-chars.js';
2
3
  const TEXT_ESCAPES = {
3
4
  '&': '&',
4
5
  '<': '&lt;',
@@ -14,18 +15,12 @@ const ATTR_ESCAPES = {
14
15
  '\r': '&#13;',
15
16
  '\t': '&#9;',
16
17
  };
17
- const UNREPRESENTABLE = /[\u{0}-\u{8}\u{B}\u{C}\u{E}-\u{1F}\u{FFFE}\u{FFFF}\u{D800}-\u{DFFF}]/u;
18
- const UNREPRESENTABLE_GLOBAL = new RegExp(UNREPRESENTABLE.source, 'gu');
19
- function codePointHex(codePoint) {
20
- return codePoint.toString(16).toUpperCase().padStart(4, '0');
21
- }
22
- export function assertRepresentable(value) {
23
- const found = UNREPRESENTABLE.exec(value);
24
- if (found === null)
25
- return;
26
- throw new AuthoringError(`cannot write U+${codePointHex(value.codePointAt(found.index))} at offset ${found.index}: ` +
27
- 'XML 1.0 has no representation for it, and the _xHHHH_ escape that would carry it is a ' +
28
- 'convention of cell values only');
18
+ const XML_REFUSAL = 'XML 1.0 has no representation for it, and the _xHHHH_ escape that would carry it is a ' +
19
+ 'convention of cell values only';
20
+ function assertRepresentable(value) {
21
+ const error = unrepresentable(value, XML_UNREPRESENTABLE, XML_REFUSAL);
22
+ if (error !== undefined)
23
+ throw error;
29
24
  }
30
25
  export function escapeText(value) {
31
26
  assertRepresentable(value);
@@ -35,10 +30,14 @@ export function escapeAttr(value) {
35
30
  assertRepresentable(value);
36
31
  return value.replace(/[&<>"'\n\r\t]/g, (ch) => ATTR_ESCAPES[ch]);
37
32
  }
33
+ export function escapeFormatCode(code) {
34
+ assertRepresentable(code);
35
+ return code.replace(/[&<>"\n\r\t]/g, (ch) => ATTR_ESCAPES[ch]);
36
+ }
38
37
  export function escapeSpreadsheetText(value) {
39
38
  return escapeText(value
40
39
  .replace(/_(x[0-9A-Fa-f]{4}_)/g, '_x005F_$1')
41
- .replace(UNREPRESENTABLE_GLOBAL, (ch) => `_x${codePointHex(ch.codePointAt(0))}_`));
40
+ .replace(XML_UNREPRESENTABLE_GLOBAL, (ch) => `_x${codePointHex(ch.codePointAt(0))}_`));
42
41
  }
43
42
  function needsSpacePreserve(value) {
44
43
  return value.length > 0 && (value !== value.trim() || /[\n\r\t]/.test(value));
@@ -47,10 +46,11 @@ export function textElement(value) {
47
46
  const space = needsSpacePreserve(value) ? ' xml:space="preserve"' : '';
48
47
  return `<t${space}>${escapeSpreadsheetText(value)}</t>`;
49
48
  }
50
- export function stripFormulaEquals(value) {
51
- if (typeof value === 'number')
52
- return String(value);
53
- return value.startsWith('=') ? value.slice(1) : value;
49
+ export function startTag(name, attrs, selfClosing) {
50
+ let out = `<${name}`;
51
+ for (const key in attrs)
52
+ out += ` ${key}="${escapeAttr(attrs[key] ?? '')}"`;
53
+ return `${out}${selfClosing ? '/>' : '>'}`;
54
54
  }
55
55
  export function boolAttr(name, value) {
56
56
  return value === undefined ? '' : ` ${name}="${value ? 1 : 0}"`;
@@ -60,17 +60,39 @@ export function textAttr(name, value) {
60
60
  }
61
61
  export function checkedToken(value, isValid, kind) {
62
62
  if (!isValid(value)) {
63
- throw new AuthoringError(`Invalid ${kind} ${JSON.stringify(value)}: not a value the OOXML enumeration allows`);
63
+ throw invalidToken(kind, value);
64
64
  }
65
65
  return value;
66
66
  }
67
67
  export function numAttr(name, value) {
68
68
  return value === undefined ? '' : ` ${name}="${numberText(value)}"`;
69
69
  }
70
- export function assertWritableNumber(value) {
71
- if (Number.isFinite(value))
72
- return;
73
- throw new AuthoringError(`cannot write a non-finite number (${value}): it has no OOXML representation`);
70
+ export function intAttr(name, value, min = -Number.MAX_SAFE_INTEGER) {
71
+ if (value === undefined)
72
+ return '';
73
+ assertWritableNumber(value);
74
+ if (!Number.isSafeInteger(value) || value < min) {
75
+ const floor = min === -Number.MAX_SAFE_INTEGER ? '' : ` of at least ${min}`;
76
+ throw new AuthoringError(`cannot write ${name}="${value}": expected an integer${floor}`);
77
+ }
78
+ return ` ${name}="${value}"`;
79
+ }
80
+ export function nonDefaultNumAttr(name, value, defaultValue) {
81
+ if (value === undefined)
82
+ return '';
83
+ const text = numberText(value);
84
+ return value === defaultValue ? '' : ` ${name}="${text}"`;
85
+ }
86
+ export function assertWritableDate(date, property) {
87
+ const time = date.getTime();
88
+ if (Number.isNaN(time)) {
89
+ throw new AuthoringError(`cannot write ${property}: it is an Invalid Date`);
90
+ }
91
+ const year = date.getUTCFullYear();
92
+ if (year < 0 || year > 9999) {
93
+ throw new AuthoringError(`cannot write ${property}: the year ${year} is outside the 0000-9999 range a W3CDTF ` +
94
+ 'timestamp can spell');
95
+ }
74
96
  }
75
97
  export function numberText(value) {
76
98
  assertWritableNumber(value);
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@shbernal/ts-xlsx",
3
- "version": "3.0.0",
3
+ "version": "3.2.0",
4
4
  "description": "A TypeScript-first library for reading and writing xlsx (OOXML) spreadsheets.",
5
5
  "keywords": [
6
6
  "csv",
@@ -90,11 +90,16 @@
90
90
  "docs:check": "node scripts/gen-docs.ts && git add --intent-to-add -- docs/api && git diff --exit-code -- docs/api",
91
91
  "constitution:check": "node scripts/check-constitution.ts",
92
92
  "layering:check": "node scripts/check-layering.ts",
93
+ "corpus-blind:check": "node scripts/check-corpus-blind.ts",
93
94
  "entries:check": "node scripts/check-entries.ts",
95
+ "public-types:check": "node scripts/check-public-types.ts",
96
+ "facet-register:check": "node scripts/check-facet-register.ts",
97
+ "tsconfig-coverage:check": "node scripts/check-tsconfig-coverage.ts",
94
98
  "browser:check": "node scripts/check-browser-safe.ts",
95
99
  "source-text:check": "node scripts/check-source-text.ts",
100
+ "error-messages:check": "node scripts/check-error-messages.ts",
96
101
  "chars:check": "charcheck",
97
- "lint": "node node_modules/oxlint/bin/oxlint src scripts test tools www charcheck.config.ts --type-aware --deny-warnings --report-unused-disable-directives",
102
+ "lint": "node scripts/lint.ts",
98
103
  "lint:fix": "pnpm run lint --fix",
99
104
  "format": "node scripts/format.ts --write",
100
105
  "format:check": "node scripts/format.ts --check",
@@ -103,7 +108,8 @@
103
108
  "typecheck:test": "tsc --noEmit -p tsconfig.test.json",
104
109
  "typecheck:dist": "tsc --noEmit -p tsconfig.dist.json",
105
110
  "typecheck:site": "tsc --noEmit -p www/tsconfig.json",
106
- "test:src": "node --test \"src/**/*.test.ts\"",
111
+ "test:src": "node scripts/test-src.ts",
112
+ "test:harness": "node --test \"scripts/**/*.test.ts\"",
107
113
  "test:site": "node --test \"www/**/*.test.ts\"",
108
114
  "coverage": "node scripts/coverage.ts",
109
115
  "corpus": "node test/corpus/run.ts",
@@ -120,20 +126,20 @@
120
126
  },
121
127
  "devDependencies": {
122
128
  "@types/node": "^24.13.3",
123
- "charcheck": "^0.3.0",
129
+ "charcheck": "^0.4.0",
124
130
  "jszip": "^3.10.1",
125
- "lefthook": "^2.1.10",
131
+ "lefthook": "^2.1.12",
126
132
  "ooxml-validate": "^0.0.3",
127
- "oxfmt": "^0.64.0",
128
- "oxlint": "^1.80.0",
133
+ "oxfmt": "^0.67.0",
134
+ "oxlint": "^1.82.0",
129
135
  "oxlint-tsgolint": "7.0.2001",
130
136
  "shiki": "^4.4.3",
131
137
  "typescript": "^7.0.2",
132
138
  "vitepress": "^1.6.4",
133
- "vue": "^3.5.41"
139
+ "vue": "^3.5.42"
134
140
  },
135
141
  "engines": {
136
142
  "node": ">=24"
137
143
  },
138
- "packageManager": "pnpm@11.11.0"
144
+ "packageManager": "pnpm@12.3.4"
139
145
  }
@@ -5,7 +5,7 @@ description: Report a ts-xlsx (@shbernal/ts-xlsx) bug, gap, or wrong output to i
5
5
 
6
6
  # Reporting a ts-xlsx problem upstream
7
7
 
8
- You are in a project that *uses* `@shbernal/ts-xlsx`, not the project that builds it.
8
+ You are in a project that _uses_ `@shbernal/ts-xlsx`, not the project that builds it.
9
9
  This skill is how a defect you hit here becomes a permanent regression test there.
10
10
 
11
11
  The library's maintainers turn reports with a minimal reproduction into corpus cases,
@@ -20,12 +20,12 @@ builds its own input.** Everything below is in service of that.
20
20
  Catch the error and read `code` — the taxonomy is deliberately coarse and each answer
21
21
  means something different about whose bug it is.
22
22
 
23
- | `error.code` | Whose bug | Report it? |
24
- | --------------------- | ---------------- | -------------------------------------------------------------- |
25
- | `internal` | **ts-xlsx** | Always. The library says so itself in the message. |
26
- | `unsupported-format` | usually the file | Only if the file opens **cleanly in Excel**. Then it's our gap. |
27
- | `malformed-input` | usually the file | Same test: clean in Excel but rejected here means it's ours. |
28
- | `authoring` | usually you | Only if the document it refused is one Excel can express. |
23
+ | `error.code` | Whose bug | Report it? |
24
+ | -------------------- | ---------------- | --------------------------------------------------------------- |
25
+ | `internal` | **ts-xlsx** | Always. The library says so itself in the message. |
26
+ | `unsupported-format` | usually the file | Only if the file opens **cleanly in Excel**. Then it's our gap. |
27
+ | `malformed-input` | usually the file | Same test: clean in Excel but rejected here means it's ours. |
28
+ | `authoring` | usually you | Only if the document it refused is one Excel can express. |
29
29
 
30
30
  Not every defect throws. These are ours too, and are worth reporting:
31
31
 
@@ -34,7 +34,7 @@ Not every defect throws. These are ours too, and are worth reporting:
34
34
  - Types that make correct code fail to compile, or admit code that throws at runtime.
35
35
  - Documented behaviour that does not match observed behaviour.
36
36
 
37
- If the problem is that ts-xlsx does not *have* a feature, that is still worth filing —
37
+ If the problem is that ts-xlsx does not _have_ a feature, that is still worth filing —
38
38
  as a feature request rather than a bug.
39
39
 
40
40
  ## 2. Collect the facts
@@ -54,7 +54,7 @@ salaries, customer lists, and unreleased numbers. Treat every file in this repo
54
54
  confidential unless the user tells you otherwise, and never upload one to a public
55
55
  tracker — including "just a screenshot of the sheet".
56
56
 
57
- Instead, write a self-contained script that *constructs* its input and fails:
57
+ Instead, write a self-contained script that _constructs_ its input and fails:
58
58
 
59
59
  ```ts
60
60
  import {Workbook, writeXlsx, readXlsx} from '@shbernal/ts-xlsx';
@@ -72,13 +72,13 @@ Then cut it down: remove rows, styles, sheets, and options one at a time, re-run
72
72
  after each cut, until removing anything more makes the failure disappear. What is left
73
73
  is the report.
74
74
 
75
- If the failure only reproduces with a *specific file* you cannot share, do not ask for
75
+ If the failure only reproduces with a _specific file_ you cannot share, do not ask for
76
76
  permission to share it — file without the file. Say exactly that in the report and describe
77
77
  the structural feature you believe is responsible (a shared formula, a pivot cache, an
78
78
  inline string, a particular namespace prefix). A maintainer can usually synthesize a file
79
79
  from that description; they can never unsee an attachment.
80
80
 
81
- If you need a file attached, build one: reproduce the *structure* you suspect in a workbook
81
+ If you need a file attached, build one: reproduce the _structure_ you suspect in a workbook
82
82
  you generate, with invented values. A synthesized file is always safe to attach. A redacted
83
83
  one is not yours to judge — redaction fails quietly, and a public tracker is permanent.
84
84
 
@@ -105,7 +105,7 @@ file from this project is attached. When you cannot manage a self-contained repr
105
105
  the answer is a thinner report — the prose description from step 3 — not a question and not
106
106
  an attachment.
107
107
 
108
- `gh` defaults to the *current* repository — which here is the consumer's, not ts-xlsx's.
108
+ `gh` defaults to the _current_ repository — which here is the consumer's, not ts-xlsx's.
109
109
  Always pass `--repo shbernal/ts-xlsx` explicitly, or you will file the bug into the wrong
110
110
  tracker.
111
111
 
@@ -121,31 +121,39 @@ issue forms, so mirror its sections in the body file so both routes land the sam
121
121
 
122
122
  ````markdown
123
123
  ### ts-xlsx version
124
+
124
125
  <x.y.z>
125
126
 
126
127
  ### Node version
128
+
127
129
  <vXX.Y.Z>
128
130
 
129
131
  ### Error code and class
130
- <code> / <ClassName> (or: no error thrown — wrong output)
132
+
133
+ <code> / <ClassName> (or: no error thrown — wrong output)
131
134
 
132
135
  ### What happened
136
+
133
137
  <observed>
134
138
 
135
139
  ### What should have happened
140
+
136
141
  <expected, and why you believe that — a spec clause, Excel's own behaviour, or the docs>
137
142
 
138
143
  ### Minimal reproduction
144
+
139
145
  ```ts
140
146
  <the script from step 3>
141
147
  ```
142
148
 
143
149
  ### Error output
150
+
144
151
  ```
145
152
  <verbatim message and stack>
146
153
  ```
147
154
 
148
155
  ### Attached file
156
+
149
157
  <none / synthesized — describe how it was generated>
150
158
  ````
151
159
 
@@ -1 +0,0 @@
1
- export declare const MODERN_FUNCTIONS: ReadonlySet<string>;