@shbernal/ts-xlsx 1.0.0 → 1.0.3

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 (105) hide show
  1. package/README.md +6 -0
  2. package/dist/core/autofilter.js +2 -2
  3. package/dist/core/cell.js +4 -4
  4. package/dist/core/color-resolution.js +1 -1
  5. package/dist/core/column.js +2 -2
  6. package/dist/core/conditional-formatting-overlay.js +1 -1
  7. package/dist/core/data-validation-overlay.js +2 -2
  8. package/dist/core/formula.js +2 -2
  9. package/dist/core/grid-edits.js +5 -5
  10. package/dist/core/merge.js +1 -1
  11. package/dist/core/pivot-table.js +3 -3
  12. package/dist/core/range.js +8 -4
  13. package/dist/core/row.js +2 -2
  14. package/dist/core/table-style.d.ts +2 -2
  15. package/dist/core/table-style.js +2 -2
  16. package/dist/core/table.js +2 -2
  17. package/dist/core/theme.d.ts +1 -1
  18. package/dist/core/theme.js +1 -1
  19. package/dist/core/value.d.ts +10 -10
  20. package/dist/core/workbook-protection.d.ts +1 -1
  21. package/dist/core/workbook.d.ts +11 -11
  22. package/dist/core/workbook.js +22 -22
  23. package/dist/core/worksheet-model.d.ts +1 -1
  24. package/dist/core/worksheet-model.js +5 -5
  25. package/dist/core/worksheet.d.ts +2 -2
  26. package/dist/core/worksheet.js +21 -21
  27. package/dist/customui/errors.js +1 -1
  28. package/dist/customui/index.js +2 -2
  29. package/dist/customui/ribbon.d.ts +1 -1
  30. package/dist/customui/ribbon.js +3 -3
  31. package/dist/entries/core.js +14 -14
  32. package/dist/entries/csv.js +2 -2
  33. package/dist/entries/customui.js +1 -1
  34. package/dist/entries/errors.js +7 -7
  35. package/dist/entries/vba.js +2 -2
  36. package/dist/entries/xlsb.js +1 -1
  37. package/dist/entries/xlsx.js +5 -5
  38. package/dist/index.js +7 -7
  39. package/dist/io/csv/read.js +2 -2
  40. package/dist/io/csv/write.js +2 -2
  41. package/dist/io/opc/errors.js +1 -1
  42. package/dist/io/opc/inflate.d.ts +1 -1
  43. package/dist/io/opc/inflate.js +2 -2
  44. package/dist/io/opc/read-opc.js +2 -2
  45. package/dist/io/opc/rels.js +2 -2
  46. package/dist/io/opc/sniff-format.js +2 -2
  47. package/dist/io/style/xf-style.js +2 -2
  48. package/dist/io/xlsb/errors.js +1 -1
  49. package/dist/io/xlsb/formula.js +4 -4
  50. package/dist/io/xlsb/primitives.js +2 -2
  51. package/dist/io/xlsb/read-shared-strings.js +3 -3
  52. package/dist/io/xlsb/read-styles.js +5 -5
  53. package/dist/io/xlsb/read-worksheet.js +9 -9
  54. package/dist/io/xlsb/read.d.ts +1 -1
  55. package/dist/io/xlsb/read.js +15 -15
  56. package/dist/io/xlsb/record-stream.js +1 -1
  57. package/dist/io/xlsx/cell-accumulator.js +6 -6
  58. package/dist/io/xlsx/cell-value.js +4 -4
  59. package/dist/io/xlsx/comments.js +4 -4
  60. package/dist/io/xlsx/conditional-formatting.js +5 -5
  61. package/dist/io/xlsx/data-validation.js +4 -4
  62. package/dist/io/xlsx/edit-vba.js +4 -4
  63. package/dist/io/xlsx/errors.js +1 -1
  64. package/dist/io/xlsx/hyperlinks.js +4 -4
  65. package/dist/io/xlsx/images.js +6 -6
  66. package/dist/io/xlsx/package-plan.js +3 -3
  67. package/dist/io/xlsx/pivot-read.js +2 -2
  68. package/dist/io/xlsx/pivot.js +4 -4
  69. package/dist/io/xlsx/read-rows.d.ts +3 -3
  70. package/dist/io/xlsx/read-rows.js +12 -12
  71. package/dist/io/xlsx/read-styles.js +4 -4
  72. package/dist/io/xlsx/read-worksheet.js +8 -8
  73. package/dist/io/xlsx/read.d.ts +1 -1
  74. package/dist/io/xlsx/read.js +28 -28
  75. package/dist/io/xlsx/relationships.d.ts +6 -6
  76. package/dist/io/xlsx/relationships.js +2 -2
  77. package/dist/io/xlsx/rich-runs.js +1 -1
  78. package/dist/io/xlsx/rich-text.js +2 -2
  79. package/dist/io/xlsx/shared-formulas.js +3 -3
  80. package/dist/io/xlsx/shared-strings-read.js +2 -2
  81. package/dist/io/xlsx/shared-strings.js +3 -3
  82. package/dist/io/xlsx/sheet-properties.js +4 -4
  83. package/dist/io/xlsx/styles.js +6 -6
  84. package/dist/io/xlsx/tables.js +5 -5
  85. package/dist/io/xlsx/threaded-comments.js +5 -5
  86. package/dist/io/xlsx/workbook-xml.js +9 -9
  87. package/dist/io/xlsx/worksheet-xml.js +18 -18
  88. package/dist/io/xlsx/write-stream.d.ts +1 -1
  89. package/dist/io/xlsx/write-stream.js +7 -7
  90. package/dist/io/xlsx/write.d.ts +3 -3
  91. package/dist/io/xlsx/write.js +20 -20
  92. package/dist/io/xlsx/x14-ext.js +1 -1
  93. package/dist/vba/cfb-writer.js +1 -1
  94. package/dist/vba/cfb.js +1 -1
  95. package/dist/vba/codepage.js +1 -1
  96. package/dist/vba/errors.js +1 -1
  97. package/dist/vba/index.js +5 -5
  98. package/dist/vba/ms-ovba.js +1 -1
  99. package/dist/vba/project-editor.js +7 -7
  100. package/dist/vba/project.js +4 -4
  101. package/dist/vba/vba-encoding.js +1 -1
  102. package/dist/xml/errors.js +1 -1
  103. package/dist/xml/xml-read.js +1 -1
  104. package/dist/xml/xml.js +1 -1
  105. package/package.json +3 -2
@@ -1,4 +1,4 @@
1
- import { XlsxError } from "../errors.js";
1
+ import { XlsxError } from '../errors.js';
2
2
  /**
3
3
  * Thrown when a `customUI` ribbon-customisation part (`customUI/customUI.xml` or
4
4
  * `customUI/customUI14.xml`) is present but cannot be parsed into a {@link CustomUiDocument} — malformed
@@ -3,5 +3,5 @@
3
3
  // Those parts are preserved byte-for-byte on round-trip (see `src/core/preserved.ts`); this is a
4
4
  // projection over them, the same posture as the VBA read view (`src/vba`). Authoring/editing the ribbon
5
5
  // is out of scope — round-trip fidelity already comes from verbatim preservation.
6
- export { CustomUiParseError } from "./errors.js";
7
- export { CUSTOMUI_2006_NAMESPACE, CUSTOMUI_2007_REL_TYPE, CUSTOMUI_2009_NAMESPACE, CUSTOMUI_2010_REL_TYPE, isCustomUiRelType, parseCustomUi, } from "./ribbon.js";
6
+ export { CustomUiParseError } from './errors.js';
7
+ export { CUSTOMUI_2006_NAMESPACE, CUSTOMUI_2007_REL_TYPE, CUSTOMUI_2009_NAMESPACE, CUSTOMUI_2010_REL_TYPE, isCustomUiRelType, parseCustomUi, } from './ribbon.js';
@@ -80,7 +80,7 @@ export interface CustomUiDocument {
80
80
  /**
81
81
  * Parse a `customUI` part (raw UTF-8 bytes or its decoded text) into a {@link CustomUiDocument}.
82
82
  *
83
- * @throws {@link CustomUiParseError} if the XML is malformed, the root is not a `<customUI>` element in
83
+ * @throws {CustomUiParseError} if the XML is malformed, the root is not a `<customUI>` element in
84
84
  * a recognised namespace, or the tree nests beyond {@link MAX_DEPTH}.
85
85
  */
86
86
  export declare function parseCustomUi(input: string | Uint8Array): CustomUiDocument;
@@ -16,8 +16,8 @@
16
16
  // with {@link CustomUiParseError} on any malformed or unrecognised structure rather than returning a
17
17
  // half-built tree.
18
18
  import { strFromU8 } from 'fflate';
19
- import { boolStrict, localName, xmlEvents } from "../xml/xml-read.js";
20
- import { CustomUiParseError } from "./errors.js";
19
+ import { boolStrict, localName, xmlEvents } from '../xml/xml-read.js';
20
+ import { CustomUiParseError } from './errors.js';
21
21
  /** The `customUI` root namespaces, one per {@link RibbonDialect}. */
22
22
  export const CUSTOMUI_2006_NAMESPACE = 'http://schemas.microsoft.com/office/2006/01/customui';
23
23
  export const CUSTOMUI_2009_NAMESPACE = 'http://schemas.microsoft.com/office/2009/07/customui';
@@ -59,7 +59,7 @@ const KNOWN_KINDS = new Set([
59
59
  /**
60
60
  * Parse a `customUI` part (raw UTF-8 bytes or its decoded text) into a {@link CustomUiDocument}.
61
61
  *
62
- * @throws {@link CustomUiParseError} if the XML is malformed, the root is not a `<customUI>` element in
62
+ * @throws {CustomUiParseError} if the XML is malformed, the root is not a `<customUI>` element in
63
63
  * a recognised namespace, or the tree nests beyond {@link MAX_DEPTH}.
64
64
  */
65
65
  export function parseCustomUi(input) {
@@ -4,17 +4,17 @@
4
4
  // property shapes, and the value vocabulary. It pulls in no ZIP, no XML writer and no BIFF12
5
5
  // decoder. Errors are not here — the whole failure taxonomy lives behind `/errors`, so that a
6
6
  // caller who only needs to branch on a failure never loads a codec to get the class.
7
- export { columnToNumber, decodeAddress, decodeRange, encodeAddress, MAX_COLUMN, MAX_ROW, numberToColumn, } from "../core/address.js";
8
- export { Cell } from "../core/cell.js";
9
- export { applyTint, DEFAULT_INDEXED_COLORS, resolveColor, SYSTEM_INDEXED_COLORS, } from "../core/color-resolution.js";
10
- export { Column } from "../core/column.js";
11
- export { isOneCellAnchor, PX_TO_EMU, } from "../core/image.js";
12
- export { PivotTable, } from "../core/pivot-table.js";
13
- export { Range } from "../core/range.js";
14
- export { Row } from "../core/row.js";
15
- export { Table, } from "../core/table.js";
16
- export { isTableStyleElementType, STRIPE_ELEMENT_TYPES, TABLE_STYLE_ELEMENT_TYPES, } from "../core/table-style.js";
17
- export { DEFAULT_THEME_COLOR_SCHEME, DEFAULT_THEME_FONTS, parseThemeColorScheme, THEME_COLOR_SLOTS, } from "../core/theme.js";
18
- export { coerceCellValue, detectValueType, ERROR_CODES, isErrorCode, richTextToPlain, ValueType, } from "../core/value.js";
19
- export { DEFAULT_WORKBOOK_VIEW, Workbook, } from "../core/workbook.js";
20
- export { Worksheet, } from "../core/worksheet.js";
7
+ export { columnToNumber, decodeAddress, decodeRange, encodeAddress, MAX_COLUMN, MAX_ROW, numberToColumn, } from '../core/address.js';
8
+ export { Cell } from '../core/cell.js';
9
+ export { applyTint, DEFAULT_INDEXED_COLORS, resolveColor, SYSTEM_INDEXED_COLORS, } from '../core/color-resolution.js';
10
+ export { Column } from '../core/column.js';
11
+ export { isOneCellAnchor, PX_TO_EMU, } from '../core/image.js';
12
+ export { PivotTable, } from '../core/pivot-table.js';
13
+ export { Range } from '../core/range.js';
14
+ export { Row } from '../core/row.js';
15
+ export { Table, } from '../core/table.js';
16
+ export { isTableStyleElementType, STRIPE_ELEMENT_TYPES, TABLE_STYLE_ELEMENT_TYPES, } from '../core/table-style.js';
17
+ export { DEFAULT_THEME_COLOR_SCHEME, DEFAULT_THEME_FONTS, parseThemeColorScheme, THEME_COLOR_SLOTS, } from '../core/theme.js';
18
+ export { coerceCellValue, detectValueType, ERROR_CODES, isErrorCode, richTextToPlain, ValueType, } from '../core/value.js';
19
+ export { DEFAULT_WORKBOOK_VIEW, Workbook, } from '../core/workbook.js';
20
+ export { Worksheet, } from '../core/worksheet.js';
@@ -2,5 +2,5 @@
2
2
  //
3
3
  // The two directions are asymmetric in what they cost: writing needs only a worksheet and the
4
4
  // value vocabulary, while reading builds a `Workbook` and therefore pulls the model in whole.
5
- export { readCsv } from "../io/csv/read.js";
6
- export { writeCsv, writeCsvText } from "../io/csv/write.js";
5
+ export { readCsv } from '../io/csv/read.js';
6
+ export { writeCsv, writeCsvText } from '../io/csv/write.js';
@@ -1,3 +1,3 @@
1
1
  // Entry barrel for `@shbernal/ts-xlsx/customui` — the read-only ribbon view over a macro
2
2
  // workbook's preserved `customUI` parts.
3
- export { CUSTOMUI_2006_NAMESPACE, CUSTOMUI_2007_REL_TYPE, CUSTOMUI_2009_NAMESPACE, CUSTOMUI_2010_REL_TYPE, isCustomUiRelType, parseCustomUi, } from "../customui/ribbon.js";
3
+ export { CUSTOMUI_2006_NAMESPACE, CUSTOMUI_2007_REL_TYPE, CUSTOMUI_2009_NAMESPACE, CUSTOMUI_2010_REL_TYPE, isCustomUiRelType, parseCustomUi, } from '../customui/ribbon.js';
@@ -11,10 +11,10 @@
11
11
  //
12
12
  // `XlsxError` is the one-line answer to "was that us?"; `XlsxErrorCode` is the kind of failure,
13
13
  // shared across classes on purpose (see `src/errors.ts`).
14
- export { CustomUiParseError } from "../customui/errors.js";
15
- export { AuthoringError, InternalError, XlsxError } from "../errors.js";
16
- export { PackageReadError, UnsupportedFormatError, } from "../io/opc/errors.js";
17
- export { XlsbParseError } from "../io/xlsb/errors.js";
18
- export { XlsxParseError } from "../io/xlsx/errors.js";
19
- export { VbaAuthorError, VbaParseError } from "../vba/errors.js";
20
- export { XmlParseError } from "../xml/errors.js";
14
+ export { CustomUiParseError } from '../customui/errors.js';
15
+ export { AuthoringError, InternalError, XlsxError } from '../errors.js';
16
+ export { PackageReadError, UnsupportedFormatError, } from '../io/opc/errors.js';
17
+ export { XlsbParseError } from '../io/xlsb/errors.js';
18
+ export { XlsxParseError } from '../io/xlsx/errors.js';
19
+ export { VbaAuthorError, VbaParseError } from '../vba/errors.js';
20
+ export { XmlParseError } from '../xml/errors.js';
@@ -3,5 +3,5 @@
3
3
  // A deliberately narrower face than `src/vba/index.ts`, which is the *internal* barrel and also
4
4
  // carries the CFB writer, the MS-OVBA container primitives and the part-path constants that
5
5
  // `Workbook` and the codecs need. Those are implementation, not API.
6
- export { parseVbaProject, } from "../vba/project.js";
7
- export { addVbaReference, removeVbaModule, } from "../vba/project-editor.js";
6
+ export { parseVbaProject, } from '../vba/project.js';
7
+ export { addVbaReference, removeVbaModule, } from '../vba/project-editor.js';
@@ -4,4 +4,4 @@
4
4
  // public for the caller that holds bytes it already knows to be `.xlsb` and wants to say so. That
5
5
  // dispatch also means this entry is not the way to *avoid* the BIFF12 codec — importing
6
6
  // `/xlsx` loads it either way (see the per-entry budgets in `scripts/size-budget.ts`).
7
- export { readXlsb } from "../io/xlsb/read.js";
7
+ export { readXlsb } from '../io/xlsb/read.js';
@@ -11,8 +11,8 @@
11
11
  // Streaming is not its own entry point. Measured, `read-rows` + `write-stream` reach every module
12
12
  // `read` + `write` do plus three — an entry that costs what the codec costs is an alias, not a
13
13
  // packaging boundary.
14
- export { editXlsxVbaAddReference, editXlsxVbaRemoveModule } from "../io/xlsx/edit-vba.js";
15
- export { readXlsx } from "../io/xlsx/read.js";
16
- export { readSheetRows, readWorkbookStream, } from "../io/xlsx/read-rows.js";
17
- export { writeXlsx, writeXlsxAsync } from "../io/xlsx/write.js";
18
- export { StreamedRow, WorkbookStreamWriter, WorksheetStreamWriter, } from "../io/xlsx/write-stream.js";
14
+ export { editXlsxVbaAddReference, editXlsxVbaRemoveModule } from '../io/xlsx/edit-vba.js';
15
+ export { readXlsx } from '../io/xlsx/read.js';
16
+ export { readSheetRows, readWorkbookStream, } from '../io/xlsx/read-rows.js';
17
+ export { writeXlsx, writeXlsxAsync } from '../io/xlsx/write.js';
18
+ export { StreamedRow, WorkbookStreamWriter, WorksheetStreamWriter, } from '../io/xlsx/write-stream.js';
package/dist/index.js CHANGED
@@ -10,10 +10,10 @@
10
10
  // `sideEffects: false` lets an unused module be dropped whole. Reach for a subpath when the
11
11
  // consumer has no bundler to do that for it, or when you want the module graph itself to say
12
12
  // which half of the library a service depends on.
13
- export * from "./entries/core.js";
14
- export * from "./entries/csv.js";
15
- export * from "./entries/customui.js";
16
- export * from "./entries/errors.js";
17
- export * from "./entries/vba.js";
18
- export * from "./entries/xlsb.js";
19
- export * from "./entries/xlsx.js";
13
+ export * from './entries/core.js';
14
+ export * from './entries/csv.js';
15
+ export * from './entries/customui.js';
16
+ export * from './entries/errors.js';
17
+ export * from './entries/vba.js';
18
+ export * from './entries/xlsb.js';
19
+ export * from './entries/xlsx.js';
@@ -11,8 +11,8 @@
11
11
  // and dash-codes such as `2020-00001` or `1-3` stay strings.
12
12
  // A caller can override coercion wholesale with `map` (e.g. the identity function to keep every
13
13
  // field a raw string, preserving leading zeros).
14
- import { Workbook } from "../../core/workbook.js";
15
- import { AuthoringError } from "../../errors.js";
14
+ import { Workbook } from '../../core/workbook.js';
15
+ import { AuthoringError } from '../../errors.js';
16
16
  /** Parse CSV text (or UTF-8 bytes) into a workbook holding a single worksheet. */
17
17
  export function readCsv(input, options = {}) {
18
18
  const text = stripBom(typeof input === 'string' ? input : Buffer.from(input).toString('utf8'));
@@ -9,8 +9,8 @@
9
9
  // `writeCsvText` yields the logical text; `writeCsv` encodes it to bytes and — for UTF-8, the
10
10
  // default — prepends a byte-order mark so a consumer such as Excel detects the encoding and does
11
11
  // not mangle non-ASCII on open. The BOM is a byte-level marker, not part of the logical text.
12
- import { isErrorValue, isFormulaValue, isHyperlinkValue, isRichTextValue, isSharedFormulaValue, richTextToPlain, } from "../../core/value.js";
13
- import { AuthoringError } from "../../errors.js";
12
+ import { isErrorValue, isFormulaValue, isHyperlinkValue, isRichTextValue, isSharedFormulaValue, richTextToPlain, } from '../../core/value.js';
13
+ import { AuthoringError } from '../../errors.js';
14
14
  const UTF8_BOM = Uint8Array.of(0xef, 0xbb, 0xbf);
15
15
  /** The logical CSV text of one worksheet — no BOM, no byte encoding. */
16
16
  export function writeCsvText(workbook, options = {}) {
@@ -3,7 +3,7 @@
3
3
  // programmatically-branchable signal — not a raw zip-internals string (which is opaque, and can leak an
4
4
  // absolute filesystem path from the layer below). See the spec
5
5
  // `docs/knowledge/specs/unsupported-input-format-typed-error.md`.
6
- import { XlsxError } from "../../errors.js";
6
+ import { XlsxError } from '../../errors.js';
7
7
  const DEFAULT_MESSAGE = {
8
8
  xls: 'the legacy .xls binary format (BIFF/OLE2 compound file) is not supported; only OOXML .xlsx is read',
9
9
  xlsb: 'this entry point does not read the binary .xlsb format (BIFF12)',
@@ -6,7 +6,7 @@
6
6
  * @param cap Maximum total uncompressed output, in bytes, across all parts. Enforced
7
7
  * against bytes actually produced, never against the archive's declared sizes.
8
8
  * @returns A map of part path to inflated bytes.
9
- * @throws {@link PackageReadError} if inflation would exceed `cap` — a probable zip bomb.
9
+ * @throws {PackageReadError} if inflation would exceed `cap` — a probable zip bomb.
10
10
  * @throws {Error} raised by the zip layer if the archive is malformed or a part uses an unsupported
11
11
  * compression method. Callers reach this through {@link inflateSpreadsheetPackage}, which is where
12
12
  * those are classified; the raw error is deliberately not re-typed here, because its text is the
@@ -13,7 +13,7 @@
13
13
  // compressed bytes before each counter check bounds the worst-case overshoot past the cap
14
14
  // to one slice's expansion — not the whole (possibly enormous) stream.
15
15
  import { Unzip, UnzipInflate } from 'fflate';
16
- import { PackageReadError } from "./errors.js";
16
+ import { PackageReadError } from './errors.js';
17
17
  // Compressed input is pushed in slices this size so decompressed output arrives in
18
18
  // increments the running counter can check. Small enough that the worst-case overshoot
19
19
  // (slice × DEFLATE's ~1032:1 ceiling ≈ 16 MiB) is negligible against a sane cap; large
@@ -27,7 +27,7 @@ const INPUT_SLICE = 1 << 14;
27
27
  * @param cap Maximum total uncompressed output, in bytes, across all parts. Enforced
28
28
  * against bytes actually produced, never against the archive's declared sizes.
29
29
  * @returns A map of part path to inflated bytes.
30
- * @throws {@link PackageReadError} if inflation would exceed `cap` — a probable zip bomb.
30
+ * @throws {PackageReadError} if inflation would exceed `cap` — a probable zip bomb.
31
31
  * @throws {Error} raised by the zip layer if the archive is malformed or a part uses an unsupported
32
32
  * compression method. Callers reach this through {@link inflateSpreadsheetPackage}, which is where
33
33
  * those are classified; the raw error is deliberately not re-typed here, because its text is the
@@ -3,8 +3,8 @@
3
3
  // closure of parts a preserved reference reaches. Every helper here is pure over the inflated package —
4
4
  // it takes part text/bytes accessors and returns paths or records, touching no Workbook model.
5
5
  import { strFromU8 } from 'fflate';
6
- import { openElements } from "../../xml/xml-read.js";
7
- import { extensionOf, relsPathFor } from "./part-paths.js";
6
+ import { openElements } from '../../xml/xml-read.js';
7
+ import { extensionOf, relsPathFor } from './part-paths.js';
8
8
  // Bind the part-lookup accessors over an inflated package (a part-path → bytes map).
9
9
  export function packageAccessors(files) {
10
10
  return {
@@ -3,8 +3,8 @@
3
3
  // it wires together are spelled in, so this is stated once here rather than inside a codec.
4
4
  //
5
5
  // The reader's half of the same graph (resolving targets, walking a part closure) is in `read-opc.ts`.
6
- import { escapeAttr, XML_DECLARATION } from "../../xml/xml.js";
7
- import { PKG_RELS_NS } from "./namespaces.js";
6
+ import { escapeAttr, XML_DECLARATION } from '../../xml/xml.js';
7
+ import { PKG_RELS_NS } from './namespaces.js';
8
8
  // A single `<Relationship>`. An `external` target lives outside the package (a hyperlink URL), so the
9
9
  // element carries `TargetMode="External"`; a package-internal target (the default) omits it. The caller
10
10
  // escapes the target when it is not a writer-controlled package path.
@@ -15,8 +15,8 @@
15
15
  //
16
16
  // The `.xlsx` and `.xlsb` serialisations share this whole layer — same container, same bound, same
17
17
  // rejections — so it is stated once here and neither reader owns it.
18
- import { PackageReadError, UnsupportedFormatError } from "./errors.js";
19
- import { inflatePackage } from "./inflate.js";
18
+ import { PackageReadError, UnsupportedFormatError } from './errors.js';
19
+ import { inflatePackage } from './inflate.js';
20
20
  // The OLE2 / Compound File Binary signature ([MS-CFB] 2.2) that opens every legacy `.xls` (and the
21
21
  // `.doc`/`.ppt` siblings). `src/vba/cfb.ts` reads this same magic for `vbaProject.bin`; here we need
22
22
  // only recognise it, not parse the container.
@@ -6,8 +6,8 @@
6
6
  // state the same model in XML and BIFF12 records — so it is stated once here, above both codecs. The
7
7
  // XML parsing lives in `../xlsx/read-styles.ts`, the record parsing in `../xlsb/read-styles.ts`, and
8
8
  // each hands back the same {@link StyleTable}.
9
- import { applyCellStyle } from "../../core/cell.js";
10
- import { NAMED_STYLE_ID } from "../../core/internal.js";
9
+ import { applyCellStyle } from '../../core/cell.js';
10
+ import { NAMED_STYLE_ID } from '../../core/internal.js';
11
11
  // ECMA-376 reserves numFmt ids below 164 for formats every consumer knows implicitly, so a
12
12
  // foreign file may name one with no <numFmt> entry. This maps the standard ids to their
13
13
  // codes; id 0 (General) and any unknown id resolve to no format. The writer never emits
@@ -1,4 +1,4 @@
1
- import { XlsxError } from "../../errors.js";
1
+ import { XlsxError } from '../../errors.js';
2
2
  /**
3
3
  * Thrown when an `.xlsb` package's binary BIFF12 content cannot be parsed — a record whose declared
4
4
  * size runs past the end of its part, a truncated record header, or a structure that does not conform
@@ -21,10 +21,10 @@
21
21
  // desynchronise the parse and produce confident nonsense. Instead the decoder returns `undefined` and
22
22
  // its caller keeps what it can still trust — the cached result Excel stored beside the formula. The
23
23
  // gaps that reach that path are listed in `docs/knowledge/specs/xlsb-binary-format-output.md`.
24
- import { MAX_COLUMN, numberToColumn } from "../../core/address.js";
25
- import { quoteSheetName } from "../../core/formula.js";
26
- import { errorCodeFor, RecordReader } from "./primitives.js";
27
- import { FTAB_USER_DEFINED, fixedArityFor, functionNameFor } from "./ptg-functions.js";
24
+ import { MAX_COLUMN, numberToColumn } from '../../core/address.js';
25
+ import { quoteSheetName } from '../../core/formula.js';
26
+ import { errorCodeFor, RecordReader } from './primitives.js';
27
+ import { FTAB_USER_DEFINED, fixedArityFor, functionNameFor } from './ptg-functions.js';
28
28
  /**
29
29
  * Decode a `CellParsedFormula`'s token stream into formula text, in the same on-disk spelling the XML
30
30
  * form writes into `<f>` — `_xlfn.`-prefixed function names included, so the caller applies the same
@@ -9,8 +9,8 @@
9
9
  //
10
10
  // Structures decoded here — RkNumber, XLWideString, BrtColor, Cell, UncheckedRfX, BErr — are shared
11
11
  // across the workbook, worksheet, styles, and shared-string parsers; nothing part-specific lives here.
12
- import { isErrorCode } from "../../core/value.js";
13
- import { XlsbParseError } from "./errors.js";
12
+ import { isErrorCode } from '../../core/value.js';
13
+ import { XlsbParseError } from './errors.js';
14
14
  // A length-prefixed string is decoded in code-unit batches rather than one `String.fromCharCode` call
15
15
  // per character (quadratic concatenation) or one spread of every unit (which blows the argument limit
16
16
  // on a long string). 4096 is comfortably under every engine's limit and makes the batching invisible.
@@ -4,9 +4,9 @@
4
4
  // `RichStr`. Only the text is taken: a pooled string's per-run formatting is not modelled in this cut,
5
5
  // so the runs are left unread rather than half-decoded (see `primitives.ts`). Reading stops at the
6
6
  // closing record, so trailing future-record blocks are never framed.
7
- import { RecordReader } from "./primitives.js";
8
- import { readRecords } from "./record-stream.js";
9
- import { BRT } from "./record-types.js";
7
+ import { RecordReader } from './primitives.js';
8
+ import { readRecords } from './record-stream.js';
9
+ import { BRT } from './record-types.js';
10
10
  /** Parse `xl/sharedStrings.bin` into the pool, in index order. An absent part is an empty pool. */
11
11
  export function parseSharedStrings(part) {
12
12
  if (part === undefined)
@@ -9,11 +9,11 @@
9
9
  // workbook the same model rather than two similar ones — a bottom vertical alignment, a locked cell,
10
10
  // or a General number format is written explicitly in BIFF12 and omitted in XML, so the binary side
11
11
  // has to drop exactly what the XML side never had.
12
- import { assignStyleFacets } from "../../core/style.js";
13
- import { numFmtCodeFor } from "../style/xf-style.js";
14
- import { RecordReader } from "./primitives.js";
15
- import { readRecords } from "./record-stream.js";
16
- import { BRT } from "./record-types.js";
12
+ import { assignStyleFacets } from '../../core/style.js';
13
+ import { numFmtCodeFor } from '../style/xf-style.js';
14
+ import { RecordReader } from './primitives.js';
15
+ import { readRecords } from './record-stream.js';
16
+ import { BRT } from './record-types.js';
17
17
  const COLLECTION_STARTS = new Map([
18
18
  [BRT.BeginFmts, 'fmts'],
19
19
  [BRT.BeginFonts, 'fonts'],
@@ -16,15 +16,15 @@
16
16
  // pointing at the group's top-left, and the `BrtArrFmla` record carrying the group's actual formula
17
17
  // comes *after* those cells in the stream. Those cells are therefore parked and resolved once the
18
18
  // whole part has been read.
19
- import { encodeAddress, MAX_COLUMN } from "../../core/address.js";
20
- import { isDateFormat, serialToDate } from "../../core/date.js";
21
- import { unmangleFunctions } from "../../core/formula.js";
22
- import { assignStyleFacets } from "../../core/style.js";
23
- import { applyXfToCell } from "../style/xf-style.js";
24
- import { decodeFormula, formulaAnchor } from "./formula.js";
25
- import { errorCodeFor, RecordReader } from "./primitives.js";
26
- import { readRecords } from "./record-stream.js";
27
- import { BRT } from "./record-types.js";
19
+ import { encodeAddress, MAX_COLUMN } from '../../core/address.js';
20
+ import { isDateFormat, serialToDate } from '../../core/date.js';
21
+ import { unmangleFunctions } from '../../core/formula.js';
22
+ import { assignStyleFacets } from '../../core/style.js';
23
+ import { applyXfToCell } from '../style/xf-style.js';
24
+ import { decodeFormula, formulaAnchor } from './formula.js';
25
+ import { errorCodeFor, RecordReader } from './primitives.js';
26
+ import { readRecords } from './record-stream.js';
27
+ import { BRT } from './record-types.js';
28
28
  // Every record that carries a plain cell — one whose payload is a value and nothing else. Membership
29
29
  // drives the dispatch below, so a record type absent from both this set and {@link FORMULA_RECORDS}
30
30
  // is skipped whole rather than being mistaken for a cell and consuming the reader.
@@ -8,7 +8,7 @@ export declare const XLSB_WORKBOOK_PART = "xl/workbook.bin";
8
8
  * @throws {UnsupportedFormatError} if the input is not an `.xlsb` package — a legacy `.xls`
9
9
  * (`.format === 'xls'`), an XML `.xlsx` or unrecognised blob (`'unknown'`).
10
10
  * @throws {XlsbParseError} if a binary part is malformed.
11
- * @throws {@link PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
11
+ * @throws {PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
12
12
  * truncated archive, or one exceeding the inflate bound (a probable zip bomb).
13
13
  */
14
14
  export declare function readXlsb(data: Uint8Array, options?: ReadXlsxOptions): Workbook;
@@ -13,20 +13,20 @@
13
13
  //
14
14
  // Not yet decoded (each its own slice of work, none silently wrong): rich-text runs, tables, pivots,
15
15
  // and conditional formatting.
16
- import { unmangleFunctions } from "../../core/formula.js";
17
- import { INTERNAL } from "../../core/internal.js";
18
- import { Workbook } from "../../core/workbook.js";
19
- import { UnsupportedFormatError } from "../opc/errors.js";
20
- import { packageAccessors, parseRelationships, resolveWorkbookPart } from "../opc/read-opc.js";
21
- import { DEFAULT_MAX_UNCOMPRESSED } from "../opc/read-options.js";
22
- import { inflateSpreadsheetPackage } from "../opc/sniff-format.js";
23
- import { decodeFormula } from "./formula.js";
24
- import { RecordReader } from "./primitives.js";
25
- import { parseSharedStrings } from "./read-shared-strings.js";
26
- import { parseStyleTable } from "./read-styles.js";
27
- import { parseWorksheet } from "./read-worksheet.js";
28
- import { readRecords } from "./record-stream.js";
29
- import { BRT } from "./record-types.js";
16
+ import { unmangleFunctions } from '../../core/formula.js';
17
+ import { INTERNAL } from '../../core/internal.js';
18
+ import { Workbook } from '../../core/workbook.js';
19
+ import { UnsupportedFormatError } from '../opc/errors.js';
20
+ import { packageAccessors, parseRelationships, resolveWorkbookPart } from '../opc/read-opc.js';
21
+ import { DEFAULT_MAX_UNCOMPRESSED } from '../opc/read-options.js';
22
+ import { inflateSpreadsheetPackage } from '../opc/sniff-format.js';
23
+ import { decodeFormula } from './formula.js';
24
+ import { RecordReader } from './primitives.js';
25
+ import { parseSharedStrings } from './read-shared-strings.js';
26
+ import { parseStyleTable } from './read-styles.js';
27
+ import { parseWorksheet } from './read-worksheet.js';
28
+ import { readRecords } from './record-stream.js';
29
+ import { BRT } from './record-types.js';
30
30
  /** The office-document part every `.xlsb` package is entered through. */
31
31
  export const XLSB_WORKBOOK_PART = 'xl/workbook.bin';
32
32
  /**
@@ -35,7 +35,7 @@ export const XLSB_WORKBOOK_PART = 'xl/workbook.bin';
35
35
  * @throws {UnsupportedFormatError} if the input is not an `.xlsb` package — a legacy `.xls`
36
36
  * (`.format === 'xls'`), an XML `.xlsx` or unrecognised blob (`'unknown'`).
37
37
  * @throws {XlsbParseError} if a binary part is malformed.
38
- * @throws {@link PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
38
+ * @throws {PackageReadError} if the input is a ZIP that cannot be unpacked — a corrupt or
39
39
  * truncated archive, or one exceeding the inflate bound (a probable zip bomb).
40
40
  */
41
41
  export function readXlsb(data, options = {}) {
@@ -10,7 +10,7 @@
10
10
  // the part the inflate bound already materialised and capped, and a size that would run past the end
11
11
  // of the part is rejected outright rather than clamped. A lying length therefore costs nothing and
12
12
  // fails closed, and the whole stream's memory is exactly the part's own bytes.
13
- import { XlsbParseError } from "./errors.js";
13
+ import { XlsbParseError } from './errors.js';
14
14
  /**
15
15
  * Decode a `.bin` part into its record sequence, in order.
16
16
  *
@@ -4,12 +4,12 @@
4
4
  // the per-cell state on {@link beginCell} and commits it on {@link finalize}, so this class is the
5
5
  // single owner of "what has this cell gathered so far" — to a cell what {@link RunAccumulator} is to a
6
6
  // rich string. Value *decoding* stays in `cell-value.ts`; this class only gathers the raw pieces.
7
- import { decodeAddress, encodeAddress } from "../../core/address.js";
8
- import { translateFormula, unmangleFunctions } from "../../core/formula.js";
9
- import { boolPresent } from "../../xml/xml-read.js";
10
- import { applyXfToCell } from "../style/xf-style.js";
11
- import { decodeCellContent, decodeFormulaResult, } from "./cell-value.js";
12
- import { RunAccumulator } from "./rich-runs.js";
7
+ import { decodeAddress, encodeAddress } from '../../core/address.js';
8
+ import { translateFormula, unmangleFunctions } from '../../core/formula.js';
9
+ import { boolPresent } from '../../xml/xml-read.js';
10
+ import { applyXfToCell } from '../style/xf-style.js';
11
+ import { decodeCellContent, decodeFormulaResult, } from './cell-value.js';
12
+ import { RunAccumulator } from './rich-runs.js';
13
13
  export class CellAccumulator {
14
14
  #ref = '';
15
15
  #type = '';
@@ -4,10 +4,10 @@
4
4
  // (`./read.ts`) and the streaming row reader (`./read-rows.ts`). Keeping it in one place is
5
5
  // what guarantees a cell read one row at a time decodes identically to the same cell read as
6
6
  // part of a whole workbook — a divergence here would be a silent data bug in exactly one path.
7
- import { isDateFormat, serialToDate } from "../../core/date.js";
8
- import { unmangleFunctions } from "../../core/formula.js";
9
- import { isErrorCode, } from "../../core/value.js";
10
- import { boolStrict } from "../../xml/xml-read.js";
7
+ import { isDateFormat, serialToDate } from '../../core/date.js';
8
+ import { unmangleFunctions } from '../../core/formula.js';
9
+ import { isErrorCode, } from '../../core/value.js';
10
+ import { boolStrict } from '../../xml/xml-read.js';
11
11
  /**
12
12
  * Decode a gathered cell into its model value. A formula cell becomes a `{formula, result?}`
13
13
  * object (the on-disk `_xlfn.`/`_xlpm.` mangling stripped back to the readable name); a plain
@@ -18,10 +18,10 @@
18
18
  // relationships and content types all survive intact still reads back as ordinary notes with zero
19
19
  // threads once those two are lost. So the fallback is *derived from the thread model* on write and
20
20
  // *suppressed on read*, rather than round-tripped as a plain note.
21
- import { decodeAddress } from "../../core/address.js";
22
- import { escapeAttr, escapeText, textElement, XML_DECLARATION } from "../../xml/xml.js";
23
- import { localName, parseXml } from "../../xml/xml-read.js";
24
- import { MARKUP_COMPATIBILITY_NS, REVISION_NS, SPREADSHEETML_NS } from "./namespaces.js";
21
+ import { decodeAddress } from '../../core/address.js';
22
+ import { escapeAttr, escapeText, textElement, XML_DECLARATION } from '../../xml/xml.js';
23
+ import { localName, parseXml } from '../../xml/xml-read.js';
24
+ import { MARKUP_COMPATIBILITY_NS, REVISION_NS, SPREADSHEETML_NS } from './namespaces.js';
25
25
  /**
26
26
  * Gather every comment a sheet must write: its cells' notes, plus one legacy fallback per conversation
27
27
  * in `threads`. A comment anchors to its cell regardless of the cell's value, so a note (or a thread) on
@@ -12,15 +12,15 @@
12
12
  // colour, understood by every consumer) plus an `<x14:dataBar>` in the worksheet `<extLst>` carrying
13
13
  // the extras, the two linked by a shared id. The reader folds the extension back onto the classic
14
14
  // rule, so the gradient flag and the two extra colours survive a round-trip rather than being dropped.
15
- import { boolAttr, escapeAttr, escapeText, stripFormulaEquals } from "../../xml/xml.js";
16
- import { boolStrict, coerceNumericLiteral, localName, parseXml } from "../../xml/xml-read.js";
15
+ import { boolAttr, escapeAttr, escapeText, stripFormulaEquals } from '../../xml/xml.js';
16
+ import { boolStrict, coerceNumericLiteral, localName, parseXml } from '../../xml/xml-read.js';
17
17
  // The x14/xm extension namespaces and ext-URI GUIDs are declared inline on the `<ext>` elements
18
18
  // exactly as Excel writes them, so no worksheet-root xmlns is needed. `CF_EXT_URI` scopes the
19
19
  // worksheet's x14 conditional formattings; `DATABAR_LINK_EXT_URI` scopes the `<x14:id>` link a
20
20
  // classic cfRule carries to name its extension.
21
- import { CF_EXT_URI, DATABAR_LINK_EXT_URI, XM_NS } from "./namespaces.js";
22
- import { colorAttrs, parseColor } from "./styles.js";
23
- import { x14Ext } from "./x14-ext.js";
21
+ import { CF_EXT_URI, DATABAR_LINK_EXT_URI, XM_NS } from './namespaces.js';
22
+ import { colorAttrs, parseColor } from './styles.js';
23
+ import { x14Ext } from './x14-ext.js';
24
24
  // Excel's default data bar when the author supplies none: a min/max anchor pair and its standard blue.
25
25
  const DEFAULT_DATABAR_CFVO = [{ type: 'min' }, { type: 'max' }];
26
26
  const DEFAULT_DATABAR_COLOR = { argb: 'FF638EC6' };
@@ -13,13 +13,13 @@
13
13
  // wraps each operand in an `<xm:f>` under `<x14:formula1>`/`<x14:formula2>`. A rule read from that
14
14
  // form is tagged `extended` so it is written back there; the two forms are parsed and serialised by
15
15
  // prefix so neither reader mistakes one for the other.
16
- import { escapeAttr, escapeText, stripFormulaEquals } from "../../xml/xml.js";
17
- import { boolStrict, coerceNumericLiteral, localName, parseXml } from "../../xml/xml-read.js";
16
+ import { escapeAttr, escapeText, stripFormulaEquals } from '../../xml/xml.js';
17
+ import { boolStrict, coerceNumericLiteral, localName, parseXml } from '../../xml/xml-read.js';
18
18
  // The x14/xm extension namespaces and `DATA_VALIDATION_EXT_URI` are declared inline on the elements
19
19
  // that need them, exactly as Excel writes them, so the block is self-contained and the worksheet root
20
20
  // needs no extra namespace declaration.
21
- import { DATA_VALIDATION_EXT_URI, XM_NS } from "./namespaces.js";
22
- import { x14Ext } from "./x14-ext.js";
21
+ import { DATA_VALIDATION_EXT_URI, XM_NS } from './namespaces.js';
22
+ import { x14Ext } from './x14-ext.js';
23
23
  // The typed validations whose literal operands are numbers; `list`/`custom` operands stay strings.
24
24
  const TYPED = new Set(['whole', 'decimal', 'date', 'time', 'textLength']);
25
25
  /** The standard `<dataValidations>` element for the rules stored in the legacy form, or '' when the
@@ -14,10 +14,10 @@
14
14
  // so that needs the offline `tools/vba-compiler` (VBIDE), which can produce a whole edited `.xlsm`
15
15
  // directly (ADR 0019).
16
16
  import { strFromU8, strToU8, unzipSync, zipSync } from 'fflate';
17
- import { VbaAuthorError } from "../../vba/errors.js";
18
- import { addVbaReference, removeVbaModule, } from "../../vba/project-editor.js";
19
- import { relsPathFor } from "../opc/part-paths.js";
20
- import { parseRelationshipRecords, relationshipTargetByType, resolveRelativePart, resolveWorkbookPart, } from "../opc/read-opc.js";
17
+ import { VbaAuthorError } from '../../vba/errors.js';
18
+ import { addVbaReference, removeVbaModule, } from '../../vba/project-editor.js';
19
+ import { relsPathFor } from '../opc/part-paths.js';
20
+ import { parseRelationshipRecords, relationshipTargetByType, resolveRelativePart, resolveWorkbookPart, } from '../opc/read-opc.js';
21
21
  const OFFICE_DOCUMENT_REL = 'officeDocument';
22
22
  const VBA_PROJECT_REL = 'vbaProject';
23
23
  // Every signature flavour Excel writes over a VBA project (legacy, agile, V3) shares this local-name
@@ -1,4 +1,4 @@
1
- import { XlsxError } from "../../errors.js";
1
+ import { XlsxError } from '../../errors.js';
2
2
  /**
3
3
  * Thrown when an `.xlsx` package's XML content is well-formed but does not describe a workbook this
4
4
  * library can act on — a `xl/workbook.xml` that declares no worksheets, say.
@@ -9,10 +9,10 @@
9
9
  // is held directly in a `location` attribute with NO relationship — emitting an internal target as an
10
10
  // external relationship makes a strict consumer resolve both the rel and the location and render the
11
11
  // destination doubled.
12
- import { decodeRange } from "../../core/address.js";
13
- import { isHyperlinkValue, isRichTextValue } from "../../core/value.js";
14
- import { escapeAttr } from "../../xml/xml.js";
15
- import { localName, parseXml } from "../../xml/xml-read.js";
12
+ import { decodeRange } from '../../core/address.js';
13
+ import { isHyperlinkValue, isRichTextValue } from '../../core/value.js';
14
+ import { escapeAttr } from '../../xml/xml.js';
15
+ import { localName, parseXml } from '../../xml/xml-read.js';
16
16
  /** Gather every hyperlink cell on a sheet, in row-major order. */
17
17
  export function collectHyperlinks(sheet) {
18
18
  const links = [];