@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.
- package/README.md +34 -24
- package/dist/bytes.d.ts +10 -2
- package/dist/bytes.js +22 -0
- package/dist/core/address.d.ts +96 -2
- package/dist/core/address.js +87 -33
- package/dist/core/array-formula-ranges.d.ts +33 -0
- package/dist/core/array-formula-ranges.js +62 -0
- package/dist/core/autofilter.d.ts +4 -3
- package/dist/core/autofilter.js +31 -30
- package/dist/core/axis-handle.d.ts +2 -0
- package/dist/core/axis-handle.js +5 -2
- package/dist/core/cell.d.ts +4 -3
- package/dist/core/cell.js +4 -6
- package/dist/core/clone.d.ts +29 -0
- package/dist/core/clone.js +24 -0
- package/dist/core/color-resolution.js +4 -6
- package/dist/core/column.d.ts +1 -0
- package/dist/core/column.js +6 -2
- package/dist/core/comment-thread.d.ts +7 -3
- package/dist/core/comment-thread.js +2 -1
- package/dist/core/conditional-formatting-overlay.d.ts +11 -1
- package/dist/core/conditional-formatting-overlay.js +30 -3
- package/dist/core/conditional-formatting.d.ts +107 -11
- package/dist/core/conditional-formatting.js +76 -19
- package/dist/core/containers.d.ts +12 -0
- package/dist/core/containers.js +5 -0
- package/dist/core/data-validation-overlay.d.ts +7 -1
- package/dist/core/data-validation-overlay.js +19 -4
- package/dist/core/data-validation.d.ts +22 -0
- package/dist/core/data-validation.js +30 -4
- package/dist/core/date-format.d.ts +20 -0
- package/dist/core/date-format.js +170 -0
- package/dist/core/date.d.ts +43 -8
- package/dist/core/date.js +19 -3
- package/dist/core/formula-references.d.ts +26 -0
- package/dist/core/formula-references.js +173 -0
- package/dist/core/formula-scan.d.ts +2 -0
- package/dist/core/formula-scan.js +58 -0
- package/dist/core/formula.d.ts +76 -17
- package/dist/core/formula.js +87 -80
- package/dist/core/function-values.d.ts +4 -0
- package/dist/core/function-values.js +58 -0
- package/dist/core/future-functions.d.ts +3 -0
- package/dist/core/{modern-functions.js → future-functions.js} +119 -88
- package/dist/core/grid-edits.d.ts +30 -3
- package/dist/core/grid-edits.js +248 -81
- package/dist/core/grid-shift.d.ts +58 -9
- package/dist/core/grid-shift.js +26 -4
- package/dist/core/hyperlink.d.ts +39 -0
- package/dist/core/hyperlink.js +88 -0
- package/dist/core/image.d.ts +49 -14
- package/dist/core/image.js +16 -5
- package/dist/core/internal.d.ts +10 -2
- package/dist/core/limits.d.ts +25 -0
- package/dist/core/limits.js +4 -0
- package/dist/core/merge.d.ts +18 -4
- package/dist/core/merge.js +33 -20
- package/dist/core/page-setup.d.ts +26 -11
- package/dist/core/pivot-table.d.ts +49 -10
- package/dist/core/pivot-table.js +112 -60
- package/dist/core/protection.d.ts +66 -4
- package/dist/core/protection.js +6 -11
- package/dist/core/range.js +34 -30
- package/dist/core/row-input.js +2 -2
- package/dist/core/row.d.ts +1 -0
- package/dist/core/row.js +6 -2
- package/dist/core/structured-reference.d.ts +7 -0
- package/dist/core/structured-reference.js +7 -0
- package/dist/core/style.d.ts +85 -70
- package/dist/core/style.js +92 -28
- package/dist/core/table-style.d.ts +1 -1
- package/dist/core/table-style.js +4 -4
- package/dist/core/table.d.ts +64 -16
- package/dist/core/table.js +87 -40
- package/dist/core/theme.d.ts +2 -0
- package/dist/core/theme.js +9 -5
- package/dist/core/value.d.ts +60 -28
- package/dist/core/value.js +48 -43
- package/dist/core/workbook-media.d.ts +34 -0
- package/dist/core/workbook-media.js +44 -0
- package/dist/core/workbook-styles.d.ts +83 -1
- package/dist/core/workbook-styles.js +4 -0
- package/dist/core/workbook-theme.js +5 -3
- package/dist/core/workbook-vba.js +3 -2
- package/dist/core/workbook.d.ts +41 -3
- package/dist/core/workbook.js +46 -41
- package/dist/core/worksheet-comments.d.ts +2 -1
- package/dist/core/worksheet-comments.js +20 -13
- package/dist/core/worksheet-merges.d.ts +49 -0
- package/dist/core/worksheet-merges.js +65 -0
- package/dist/core/worksheet-model.d.ts +10 -2
- package/dist/core/worksheet-model.js +28 -9
- package/dist/core/worksheet-pictures.d.ts +3 -3
- package/dist/core/worksheet-pictures.js +7 -6
- package/dist/core/worksheet.d.ts +165 -27
- package/dist/core/worksheet.js +206 -89
- package/dist/customui/ribbon.js +2 -1
- package/dist/entries/core.d.ts +21 -14
- package/dist/entries/core.js +14 -7
- package/dist/entries/errors.d.ts +1 -0
- package/dist/entries/errors.js +1 -0
- package/dist/entries/xlsx.d.ts +1 -1
- package/dist/errors.d.ts +64 -0
- package/dist/errors.js +22 -0
- package/dist/hex.d.ts +8 -0
- package/dist/hex.js +3 -0
- package/dist/io/cell-metadata/metadata.d.ts +42 -0
- package/dist/io/cell-metadata/metadata.js +35 -0
- package/dist/io/cell-metadata/rich-values.d.ts +11 -0
- package/dist/io/cell-metadata/rich-values.js +80 -0
- package/dist/io/csv/delimiter.d.ts +21 -0
- package/dist/io/csv/delimiter.js +18 -0
- package/dist/io/csv/errors.d.ts +14 -0
- package/dist/io/csv/errors.js +5 -0
- package/dist/io/csv/read.d.ts +6 -1
- package/dist/io/csv/read.js +51 -22
- package/dist/io/csv/write.d.ts +19 -5
- package/dist/io/csv/write.js +24 -44
- package/dist/io/opc/inflate.js +14 -0
- package/dist/io/opc/namespaces.d.ts +16 -0
- package/dist/io/opc/namespaces.js +4 -0
- package/dist/io/opc/part-paths.d.ts +9 -0
- package/dist/io/opc/part-paths.js +5 -5
- package/dist/io/opc/read-opc.d.ts +58 -14
- package/dist/io/opc/read-opc.js +49 -21
- package/dist/io/opc/read-options.d.ts +5 -1
- package/dist/io/opc/sniff-format.d.ts +3 -3
- package/dist/io/opc/sniff-format.js +2 -2
- package/dist/io/opc/strict-relationships.d.ts +2 -0
- package/dist/io/opc/strict-relationships.js +12 -0
- package/dist/io/read-policy/column-budget.d.ts +26 -0
- package/dist/io/read-policy/column-budget.js +18 -0
- package/dist/io/read-policy/read-repair.d.ts +74 -0
- package/dist/io/read-policy/read-repair.js +119 -0
- package/dist/io/style/cell-style-resolution.d.ts +25 -0
- package/dist/io/style/cell-style-resolution.js +30 -0
- package/dist/io/style/xf-style.d.ts +23 -1
- package/dist/io/style/xf-style.js +8 -0
- package/dist/io/xlsb/formula.d.ts +2 -2
- package/dist/io/xlsb/formula.js +52 -35
- package/dist/io/xlsb/primitives.js +8 -14
- package/dist/io/xlsb/ptg-functions.d.ts +19 -10
- package/dist/io/xlsb/ptg-functions.js +495 -596
- package/dist/io/xlsb/read-metadata.d.ts +7 -0
- package/dist/io/xlsb/read-metadata.js +69 -0
- package/dist/io/xlsb/read-styles.js +45 -81
- package/dist/io/xlsb/read-worksheet.d.ts +26 -1
- package/dist/io/xlsb/read-worksheet.js +148 -106
- package/dist/io/xlsb/read.d.ts +6 -3
- package/dist/io/xlsb/read.js +70 -31
- package/dist/io/xlsb/record-stream.d.ts +30 -0
- package/dist/io/xlsb/record-stream.js +20 -0
- package/dist/io/xlsb/record-types.d.ts +14 -5
- package/dist/io/xlsb/record-types.js +14 -5
- package/dist/io/xlsb/sheet-protection.d.ts +20 -0
- package/dist/io/xlsb/sheet-protection.js +60 -0
- package/dist/io/xlsx/cell-accumulator.d.ts +24 -9
- package/dist/io/xlsx/cell-accumulator.js +74 -21
- package/dist/io/xlsx/cell-metadata.d.ts +39 -0
- package/dist/io/xlsx/cell-metadata.js +162 -0
- package/dist/io/xlsx/cell-value.d.ts +19 -5
- package/dist/io/xlsx/cell-value.js +45 -30
- package/dist/io/xlsx/color-xml.js +3 -2
- package/dist/io/xlsx/column-span.d.ts +11 -0
- package/dist/io/xlsx/column-span.js +9 -0
- package/dist/io/xlsx/comments.d.ts +9 -30
- package/dist/io/xlsx/comments.js +25 -83
- package/dist/io/xlsx/conditional-formatting.d.ts +43 -23
- package/dist/io/xlsx/conditional-formatting.js +437 -138
- package/dist/io/xlsx/data-validation.d.ts +12 -7
- package/dist/io/xlsx/data-validation.js +67 -53
- package/dist/io/xlsx/edit-vba.d.ts +7 -2
- package/dist/io/xlsx/edit-vba.js +52 -52
- package/dist/io/xlsx/font-xml.d.ts +7 -0
- package/dist/io/xlsx/font-xml.js +104 -0
- package/dist/io/xlsx/hyperlinks.d.ts +19 -21
- package/dist/io/xlsx/hyperlinks.js +12 -32
- package/dist/io/xlsx/images.d.ts +49 -16
- package/dist/io/xlsx/images.js +149 -50
- package/dist/io/xlsx/namespaces.d.ts +24 -0
- package/dist/io/xlsx/namespaces.js +11 -0
- package/dist/io/xlsx/package-plan.d.ts +60 -15
- package/dist/io/xlsx/package-plan.js +83 -18
- package/dist/io/xlsx/part-names.d.ts +6 -8
- package/dist/io/xlsx/part-names.js +3 -7
- package/dist/io/xlsx/pivot.d.ts +5 -5
- package/dist/io/xlsx/pivot.js +26 -24
- package/dist/io/xlsx/preserved-splices.d.ts +6 -0
- package/dist/io/xlsx/preserved-splices.js +74 -0
- package/dist/io/xlsx/read-comments.d.ts +29 -0
- package/dist/io/xlsx/read-comments.js +75 -0
- package/dist/io/xlsx/read-parts.d.ts +59 -0
- package/dist/io/xlsx/read-parts.js +259 -0
- package/dist/io/xlsx/read-pivot.js +11 -4
- package/dist/io/xlsx/{rich-runs.d.ts → read-rich-runs.d.ts} +8 -5
- package/dist/io/xlsx/{rich-runs.js → read-rich-runs.js} +24 -4
- package/dist/io/xlsx/read-rows.d.ts +35 -11
- package/dist/io/xlsx/read-rows.js +73 -49
- package/dist/io/xlsx/read-shared-strings.js +3 -2
- package/dist/io/xlsx/read-styles.d.ts +0 -30
- package/dist/io/xlsx/read-styles.js +45 -105
- package/dist/io/xlsx/read-workbook-xml.d.ts +42 -0
- package/dist/io/xlsx/read-workbook-xml.js +175 -0
- package/dist/io/xlsx/read-worksheet.d.ts +9 -3
- package/dist/io/xlsx/read-worksheet.js +70 -177
- package/dist/io/xlsx/read.d.ts +3 -14
- package/dist/io/xlsx/read.js +74 -411
- package/dist/io/xlsx/relationships.d.ts +3 -0
- package/dist/io/xlsx/relationships.js +4 -0
- package/dist/io/xlsx/rich-text.js +1 -1
- package/dist/io/xlsx/row-position.d.ts +20 -0
- package/dist/io/xlsx/row-position.js +11 -0
- package/dist/io/xlsx/row-xml.d.ts +139 -0
- package/dist/io/xlsx/row-xml.js +222 -0
- package/dist/io/xlsx/shared-formulas.js +2 -2
- package/dist/io/xlsx/sheet-properties.d.ts +10 -1
- package/dist/io/xlsx/sheet-properties.js +182 -20
- package/dist/io/xlsx/strict-parts.d.ts +7 -0
- package/dist/io/xlsx/strict-parts.js +171 -0
- package/dist/io/xlsx/style-elements.d.ts +41 -0
- package/dist/io/xlsx/style-elements.js +136 -0
- package/dist/io/xlsx/styles.d.ts +17 -3
- package/dist/io/xlsx/styles.js +13 -209
- package/dist/io/xlsx/tables.d.ts +10 -2
- package/dist/io/xlsx/tables.js +55 -52
- package/dist/io/xlsx/theme-xml.d.ts +32 -4
- package/dist/io/xlsx/theme-xml.js +106 -71
- package/dist/io/xlsx/threaded-comments.d.ts +14 -11
- package/dist/io/xlsx/threaded-comments.js +16 -8
- package/dist/io/xlsx/workbook-xml.d.ts +45 -6
- package/dist/io/xlsx/workbook-xml.js +62 -54
- package/dist/io/xlsx/worksheet-xml.d.ts +26 -70
- package/dist/io/xlsx/worksheet-xml.js +69 -282
- package/dist/io/xlsx/write-stream.d.ts +90 -19
- package/dist/io/xlsx/write-stream.js +80 -25
- package/dist/io/xlsx/write.d.ts +12 -6
- package/dist/io/xlsx/write.js +226 -123
- package/dist/rel-type.d.ts +25 -0
- package/dist/rel-type.js +9 -0
- package/dist/token-set.d.ts +13 -0
- package/dist/token-set.js +4 -1
- package/dist/vba/bytes.d.ts +16 -5
- package/dist/vba/bytes.js +27 -6
- package/dist/vba/cfb-format.d.ts +55 -0
- package/dist/vba/cfb-format.js +35 -0
- package/dist/vba/cfb-writer.d.ts +8 -0
- package/dist/vba/cfb-writer.js +40 -40
- package/dist/vba/cfb.d.ts +21 -4
- package/dist/vba/cfb.js +124 -90
- package/dist/vba/codepage.js +2 -1
- package/dist/vba/dir-records.d.ts +6 -0
- package/dist/vba/dir-records.js +10 -2
- package/dist/vba/errors.d.ts +11 -4
- package/dist/vba/index.d.ts +0 -2
- package/dist/vba/index.js +0 -2
- package/dist/vba/ms-ovba.d.ts +6 -2
- package/dist/vba/ms-ovba.js +66 -22
- package/dist/vba/project-editor.js +129 -119
- package/dist/vba/project.d.ts +15 -1
- package/dist/vba/project.js +38 -13
- package/dist/vba/vba-encoding.d.ts +4 -10
- package/dist/vba/vba-encoding.js +3 -17
- package/dist/xml/xml-attrs.d.ts +37 -0
- package/dist/xml/xml-attrs.js +30 -0
- package/dist/xml/xml-chars.d.ts +40 -0
- package/dist/xml/xml-chars.js +12 -0
- package/dist/xml/xml-namespaces.d.ts +31 -0
- package/dist/xml/xml-namespaces.js +50 -0
- package/dist/xml/xml-read.d.ts +101 -11
- package/dist/xml/xml-read.js +150 -18
- package/dist/xml/xml-scan.d.ts +25 -34
- package/dist/xml/xml-scan.js +69 -46
- package/dist/xml/xml.d.ts +59 -26
- package/dist/xml/xml.js +45 -23
- package/package.json +15 -9
- package/skills/ts-xlsx-upstream/SKILL.md +21 -13
- 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
|
'<': '<',
|
|
@@ -14,18 +15,12 @@ const ATTR_ESCAPES = {
|
|
|
14
15
|
'\r': ' ',
|
|
15
16
|
'\t': '	',
|
|
16
17
|
};
|
|
17
|
-
const
|
|
18
|
-
|
|
19
|
-
function
|
|
20
|
-
|
|
21
|
-
|
|
22
|
-
|
|
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(
|
|
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
|
|
51
|
-
|
|
52
|
-
|
|
53
|
-
|
|
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
|
|
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
|
|
71
|
-
if (
|
|
72
|
-
return;
|
|
73
|
-
|
|
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.
|
|
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
|
|
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
|
|
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.
|
|
129
|
+
"charcheck": "^0.4.0",
|
|
124
130
|
"jszip": "^3.10.1",
|
|
125
|
-
"lefthook": "^2.1.
|
|
131
|
+
"lefthook": "^2.1.12",
|
|
126
132
|
"ooxml-validate": "^0.0.3",
|
|
127
|
-
"oxfmt": "^0.
|
|
128
|
-
"oxlint": "^1.
|
|
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.
|
|
139
|
+
"vue": "^3.5.42"
|
|
134
140
|
},
|
|
135
141
|
"engines": {
|
|
136
142
|
"node": ">=24"
|
|
137
143
|
},
|
|
138
|
-
"packageManager": "pnpm@
|
|
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
|
|
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`
|
|
24
|
-
|
|
|
25
|
-
| `internal`
|
|
26
|
-
| `unsupported-format`
|
|
27
|
-
| `malformed-input`
|
|
28
|
-
| `authoring`
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
|
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
|
-
|
|
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>;
|