javascript-excel 2.3.0 → 2.5.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 (58) hide show
  1. package/README.md +5 -3
  2. package/dist/{address-DUn7-5OS.js → address-BGH42dEg.js} +1 -1
  3. package/dist/{address-DZBHchLv.cjs → address-DKd_3EGf.cjs} +1 -1
  4. package/dist/{csv-Bck8eW_D.js → csv-5jVhfM5l.js} +204 -33
  5. package/dist/{csv-f4P3fGs-.cjs → csv-BkVmMYQq.cjs} +204 -33
  6. package/dist/csv.cjs +1 -1
  7. package/dist/csv.d.cts +50 -3
  8. package/dist/csv.d.ts +50 -3
  9. package/dist/csv.js +1 -1
  10. package/dist/{dataset-DzoMeOG1.cjs → dataset-B4-SEdCn.cjs} +49 -5
  11. package/dist/{dataset-BLo9CwB-.js → dataset-Dh598YSG.js} +49 -5
  12. package/dist/{dates-BXcSWf9_.js → dates-CIL1z9EY.js} +1 -1
  13. package/dist/{dates-CA1dCizp.cjs → dates-DcdgnJto.cjs} +1 -1
  14. package/dist/dom.cjs +2 -2
  15. package/dist/dom.d.cts +1 -1
  16. package/dist/dom.d.ts +1 -1
  17. package/dist/dom.js +2 -2
  18. package/dist/{dos-time-BsH7f0ef.js → dos-time-BEAyK3U8.js} +1 -1
  19. package/dist/{dos-time-CxEs--rI.cjs → dos-time-BUWyklco.cjs} +1 -1
  20. package/dist/{errors-CvGlfw0E.js → errors-BQE62PFo.js} +1 -1
  21. package/dist/{errors-DOPrrGS4.cjs → errors-CKYdpCoB.cjs} +1 -1
  22. package/dist/format.cjs +1 -1
  23. package/dist/format.js +1 -1
  24. package/dist/import.cjs +1 -1
  25. package/dist/import.d.cts +2 -2
  26. package/dist/import.d.ts +2 -2
  27. package/dist/import.js +1 -1
  28. package/dist/index.cjs +7 -7
  29. package/dist/index.d.cts +5 -5
  30. package/dist/index.d.ts +5 -5
  31. package/dist/index.js +7 -7
  32. package/dist/{infer-BniOucP6.cjs → infer-B950M3-F.cjs} +27 -0
  33. package/dist/{infer-DcUyZ1T-.js → infer-DuSahY5i.js} +16 -1
  34. package/dist/{pipeline-2dgQM9E9.js → pipeline-1AVJbbqT.js} +39 -12
  35. package/dist/{pipeline-LCTU0Eg_.cjs → pipeline-C9zhwGAV.cjs} +39 -12
  36. package/dist/{pipeline-D1eAhqJu.d.cts → pipeline-CJWE3NWg.d.cts} +12 -5
  37. package/dist/{pipeline-Bh7FUyzW.d.ts → pipeline-DVgO1aGC.d.ts} +12 -5
  38. package/dist/{read-BnXzPjGc.js → read-B6tY0ooT.js} +2479 -869
  39. package/dist/{read-BYI7EVMo.cjs → read-Dgw9kMzh.cjs} +2489 -861
  40. package/dist/read.cjs +2 -1
  41. package/dist/read.d.cts +73 -3
  42. package/dist/read.d.ts +73 -3
  43. package/dist/read.js +2 -2
  44. package/dist/render.cjs +2 -2
  45. package/dist/render.js +2 -2
  46. package/dist/{sheet-names-DDY64-dt.cjs → sheet-names-D8sYcjSd.cjs} +2 -2
  47. package/dist/{sheet-names-BLrwcn33.js → sheet-names-RoFkpk_R.js} +2 -2
  48. package/dist/{warnings-DhonqJ7A.d.ts → warnings-DEsTp6rd.d.cts} +13 -2
  49. package/dist/{warnings-DhonqJ7A.d.cts → warnings-DEsTp6rd.d.ts} +13 -2
  50. package/dist/worker.cjs +5 -5
  51. package/dist/worker.d.cts +4 -4
  52. package/dist/worker.d.ts +4 -4
  53. package/dist/worker.js +5 -5
  54. package/dist/{write-DKXhuvKR.cjs → write-Bgl_QfA8.cjs} +5 -5
  55. package/dist/{write-BaMv1Z7W.d.ts → write-BylKqAmD.d.ts} +1 -1
  56. package/dist/{write-BVXB2_2C.js → write-DFz-h8gz.js} +5 -5
  57. package/dist/{write-Izl2NG0Y.d.cts → write-JvXRv63d.d.cts} +1 -1
  58. package/package.json +1 -1
package/dist/read.cjs CHANGED
@@ -1,8 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_warnings = require("./warnings-CJPiDqei.cjs");
3
- const require_read = require("./read-BYI7EVMo.cjs");
3
+ const require_read = require("./read-Dgw9kMzh.cjs");
4
4
  exports.DEFAULT_READ_LIMITS = require_read.DEFAULT_READ_LIMITS;
5
5
  exports.detectFormat = require_read.detectFormat;
6
+ exports.inspect = require_read.inspect;
6
7
  exports.isDataLossWarning = require_warnings.isDataLossWarning;
7
8
  exports.read = require_read.read;
8
9
  exports.readSheetNames = require_read.readSheetNames;
package/dist/read.d.cts CHANGED
@@ -10,10 +10,10 @@
10
10
  *
11
11
  * @module javascript-excel/read
12
12
  */
13
- import { a as isDataLossWarning, c as BlobType, i as ExcelWarningCode, n as ExcelPartKind, o as BinaryInput, r as ExcelWarning, s as BlobLike, t as DroppedWarnings } from "./warnings-DhonqJ7A.cjs";
13
+ import { a as isDataLossWarning, c as BlobType, i as ExcelWarningCode, n as ExcelPartKind, o as BinaryInput, r as ExcelWarning, s as BlobLike, t as DroppedWarnings } from "./warnings-DEsTp6rd.cjs";
14
14
  import { A as Theme, C as PrintSetup, D as Sheet, E as RowProps, O as SheetView, S as PatternType, T as RichTextRun, _ as Font, a as Cell, b as NumFmt, c as CellType, d as ColumnProps, f as ColumnWidth, g as Fill, h as ErrorCode, i as BorderStyle, j as Workbook, k as Style, l as CellValue, m as DocProperties, n as Border, o as CellErrorValue, p as DefinedName, r as BorderSide, s as CellInput, t as Alignment, u as Color, v as GradientFill, w as RichText, x as PatternFill, y as Hyperlink } from "./model-BUNp7B0Z.cjs";
15
15
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
16
- import { t as Progress } from "./write-Izl2NG0Y.cjs";
16
+ import { t as Progress } from "./write-JvXRv63d.cjs";
17
17
  /** Result of `read`. */
18
18
  export interface ReadResult {
19
19
  workbook: Workbook<Cell>;
@@ -102,7 +102,10 @@ export interface ReadLimits {
102
102
  * 2.1 still compiles; when it is left out the default applies.
103
103
  */
104
104
  maxSheets?: number;
105
- /** All sheets together. */
105
+ /**
106
+ * All sheets together. `importDataset` also counts against it, separately, the
107
+ * empty fields its dataset pads short rows with (since 2.4).
108
+ */
106
109
  maxCells: number;
107
110
  /**
108
111
  * Items other than cells that a read builds, all sheets together (added in
@@ -137,6 +140,26 @@ export interface ReadLimits {
137
140
  * 2.2 still compiles; when it is left out the default applies.
138
141
  */
139
142
  maxCellTextLength?: number;
143
+ /**
144
+ * Columns a sheet may use: the highest column of any cell a read keeps, on
145
+ * each sheet read (added in 2.4). Checked as each cell is kept, while the
146
+ * sheet streams in, so a wider sheet is refused at its first cell past the
147
+ * limit; `<dimension>` is not trusted. Cells beyond Excel's own width (XFD,
148
+ * 16,384) are skipped with `CELL_OUT_OF_BOUNDS` as before. Default 16,384
149
+ * (`DEFAULT_READ_LIMITS`), so no sheet Excel can write is refused; a server
150
+ * or browser reading untrusted files should set it to the widest sheet it
151
+ * accepts (for example 256). A wide header over short rows costs little to
152
+ * read but a value per column in every row of a dataset (`importDataset`
153
+ * also bounds that, against `maxCells`). On a `LimitError`, `details.value`
154
+ * is the offending cell's column number (1-based), `details.part` names the
155
+ * sheet part and `details.ref` the cell. `readSheetNames` reads no cells; it
156
+ * accepts and checks the member like any other. For CSV the same name
157
+ * limits the fields of one record (`CsvParseOptions.maxColumns`).
158
+ *
159
+ * Optional only so that a complete `ReadLimits` object written for 2.0 to
160
+ * 2.3 still compiles; when it is left out the default applies.
161
+ */
162
+ maxColumns?: number;
140
163
  /**
141
164
  * Warnings kept before the cap applies. Past it, informational warnings are dropped and
142
165
  * counted in one `WARNINGS_TRUNCATED` (added where the first one is dropped); data-loss
@@ -166,4 +189,51 @@ export declare function readSheetNames(input: BinaryInput, options?: {
166
189
  }): Promise<SheetInfo[]>;
167
190
  /** Reads an .xlsx, .xlsm, .xltx or .xltm file into the model. */
168
191
  export declare function read(input: BinaryInput, options?: ReadOptions): Promise<ReadResult>;
192
+ /** Options for `inspect`: the limits and the signal, as for `read`. */
193
+ export interface InspectOptions {
194
+ limits?: Partial<ReadLimits> | undefined;
195
+ /** Rejects with `signal.reason` when aborted. */
196
+ signal?: AbortSignalLike | undefined;
197
+ }
198
+ /** The formats `inspect` (like `read`) accepts. */
199
+ export type InspectFormat = "xlsx" | "xlsm" | "xltx" | "xltm";
200
+ /** A worksheet as `inspect` found it. */
201
+ export interface InspectedSheet {
202
+ name: string;
203
+ /** Position among the worksheets, as in `readSheetNames` and `read`'s `workbook.sheets`. */
204
+ index: number;
205
+ state: "visible" | "hidden" | "veryHidden";
206
+ /** The sheet's part; left out when the part is missing (`read` gives an empty sheet). */
207
+ part?: string;
208
+ /** Cells as `maxCells` counts them: each `<c>` kept with a value, formula or style (a cell written twice counts twice; hyperlink-only cells are not counted). */
209
+ cells: number;
210
+ /** The used range of those cells, as `read` sets `sheet.dimension`; left out for a sheet without cells. */
211
+ dimension?: string;
212
+ }
213
+ /** Result of `inspect`. */
214
+ export interface InspectResult {
215
+ format: InspectFormat;
216
+ /** The worksheets in book order (chart, dialog and macro sheets are part kinds, not worksheets). */
217
+ sheets: InspectedSheet[];
218
+ /** The kinds of the `warnings`, each once, in the order found. */
219
+ partKinds: ExcelPartKind[];
220
+ /** The `UNSUPPORTED_PART` warnings `read` gives for this file, the same objects (no other warnings, and not capped by `maxWarnings`). */
221
+ warnings: ExcelWarning[];
222
+ /** Parts in the package (zip entries that are not folders). */
223
+ parts: number;
224
+ /** Bytes inflated, counted as `maxTotalBytes` counts them (a part read twice counts twice). */
225
+ inflatedBytes: number;
226
+ /** Cells of all worksheets together, as `maxCells` counts them (the sum of `sheets[].cells`). */
227
+ cells: number;
228
+ /** Items in the shared strings table. */
229
+ sharedStrings: number;
230
+ }
231
+ /**
232
+ * Checks an .xlsx, .xlsm, .xltx or .xltm file part by part without building
233
+ * its cells: every part `read` parses is parsed with the same checks and
234
+ * limits (every sheet to its end), every other part is inflated and its
235
+ * bytes searched for a DOCTYPE, and XML parts must be UTF-8 or UTF-16. Throws what `read` throws for any file
236
+ * `read` refuses under the same limits (docs/api.md §5.2.1).
237
+ */
238
+ export declare function inspect(input: BinaryInput, options?: InspectOptions): Promise<InspectResult>;
169
239
  export { type AbortSignalLike, type Alignment, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellErrorValue, type CellInput, type CellType, type CellValue, type Color, type ColumnProps, type ColumnWidth, type DefinedName, type DocProperties, type DroppedWarnings, type ErrorCode, type ExcelPartKind, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type Hyperlink, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetView, type Style, type Theme, type Workbook, isDataLossWarning };
package/dist/read.d.ts CHANGED
@@ -10,10 +10,10 @@
10
10
  *
11
11
  * @module javascript-excel/read
12
12
  */
13
- import { a as isDataLossWarning, c as BlobType, i as ExcelWarningCode, n as ExcelPartKind, o as BinaryInput, r as ExcelWarning, s as BlobLike, t as DroppedWarnings } from "./warnings-DhonqJ7A.js";
13
+ import { a as isDataLossWarning, c as BlobType, i as ExcelWarningCode, n as ExcelPartKind, o as BinaryInput, r as ExcelWarning, s as BlobLike, t as DroppedWarnings } from "./warnings-DEsTp6rd.js";
14
14
  import { A as Theme, C as PrintSetup, D as Sheet, E as RowProps, O as SheetView, S as PatternType, T as RichTextRun, _ as Font, a as Cell, b as NumFmt, c as CellType, d as ColumnProps, f as ColumnWidth, g as Fill, h as ErrorCode, i as BorderStyle, j as Workbook, k as Style, l as CellValue, m as DocProperties, n as Border, o as CellErrorValue, p as DefinedName, r as BorderSide, s as CellInput, t as Alignment, u as Color, v as GradientFill, w as RichText, x as PatternFill, y as Hyperlink } from "./model-BUNp7B0Z.js";
15
15
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
16
- import { t as Progress } from "./write-BaMv1Z7W.js";
16
+ import { t as Progress } from "./write-BylKqAmD.js";
17
17
  /** Result of `read`. */
18
18
  export interface ReadResult {
19
19
  workbook: Workbook<Cell>;
@@ -102,7 +102,10 @@ export interface ReadLimits {
102
102
  * 2.1 still compiles; when it is left out the default applies.
103
103
  */
104
104
  maxSheets?: number;
105
- /** All sheets together. */
105
+ /**
106
+ * All sheets together. `importDataset` also counts against it, separately, the
107
+ * empty fields its dataset pads short rows with (since 2.4).
108
+ */
106
109
  maxCells: number;
107
110
  /**
108
111
  * Items other than cells that a read builds, all sheets together (added in
@@ -137,6 +140,26 @@ export interface ReadLimits {
137
140
  * 2.2 still compiles; when it is left out the default applies.
138
141
  */
139
142
  maxCellTextLength?: number;
143
+ /**
144
+ * Columns a sheet may use: the highest column of any cell a read keeps, on
145
+ * each sheet read (added in 2.4). Checked as each cell is kept, while the
146
+ * sheet streams in, so a wider sheet is refused at its first cell past the
147
+ * limit; `<dimension>` is not trusted. Cells beyond Excel's own width (XFD,
148
+ * 16,384) are skipped with `CELL_OUT_OF_BOUNDS` as before. Default 16,384
149
+ * (`DEFAULT_READ_LIMITS`), so no sheet Excel can write is refused; a server
150
+ * or browser reading untrusted files should set it to the widest sheet it
151
+ * accepts (for example 256). A wide header over short rows costs little to
152
+ * read but a value per column in every row of a dataset (`importDataset`
153
+ * also bounds that, against `maxCells`). On a `LimitError`, `details.value`
154
+ * is the offending cell's column number (1-based), `details.part` names the
155
+ * sheet part and `details.ref` the cell. `readSheetNames` reads no cells; it
156
+ * accepts and checks the member like any other. For CSV the same name
157
+ * limits the fields of one record (`CsvParseOptions.maxColumns`).
158
+ *
159
+ * Optional only so that a complete `ReadLimits` object written for 2.0 to
160
+ * 2.3 still compiles; when it is left out the default applies.
161
+ */
162
+ maxColumns?: number;
140
163
  /**
141
164
  * Warnings kept before the cap applies. Past it, informational warnings are dropped and
142
165
  * counted in one `WARNINGS_TRUNCATED` (added where the first one is dropped); data-loss
@@ -166,4 +189,51 @@ export declare function readSheetNames(input: BinaryInput, options?: {
166
189
  }): Promise<SheetInfo[]>;
167
190
  /** Reads an .xlsx, .xlsm, .xltx or .xltm file into the model. */
168
191
  export declare function read(input: BinaryInput, options?: ReadOptions): Promise<ReadResult>;
192
+ /** Options for `inspect`: the limits and the signal, as for `read`. */
193
+ export interface InspectOptions {
194
+ limits?: Partial<ReadLimits> | undefined;
195
+ /** Rejects with `signal.reason` when aborted. */
196
+ signal?: AbortSignalLike | undefined;
197
+ }
198
+ /** The formats `inspect` (like `read`) accepts. */
199
+ export type InspectFormat = "xlsx" | "xlsm" | "xltx" | "xltm";
200
+ /** A worksheet as `inspect` found it. */
201
+ export interface InspectedSheet {
202
+ name: string;
203
+ /** Position among the worksheets, as in `readSheetNames` and `read`'s `workbook.sheets`. */
204
+ index: number;
205
+ state: "visible" | "hidden" | "veryHidden";
206
+ /** The sheet's part; left out when the part is missing (`read` gives an empty sheet). */
207
+ part?: string;
208
+ /** Cells as `maxCells` counts them: each `<c>` kept with a value, formula or style (a cell written twice counts twice; hyperlink-only cells are not counted). */
209
+ cells: number;
210
+ /** The used range of those cells, as `read` sets `sheet.dimension`; left out for a sheet without cells. */
211
+ dimension?: string;
212
+ }
213
+ /** Result of `inspect`. */
214
+ export interface InspectResult {
215
+ format: InspectFormat;
216
+ /** The worksheets in book order (chart, dialog and macro sheets are part kinds, not worksheets). */
217
+ sheets: InspectedSheet[];
218
+ /** The kinds of the `warnings`, each once, in the order found. */
219
+ partKinds: ExcelPartKind[];
220
+ /** The `UNSUPPORTED_PART` warnings `read` gives for this file, the same objects (no other warnings, and not capped by `maxWarnings`). */
221
+ warnings: ExcelWarning[];
222
+ /** Parts in the package (zip entries that are not folders). */
223
+ parts: number;
224
+ /** Bytes inflated, counted as `maxTotalBytes` counts them (a part read twice counts twice). */
225
+ inflatedBytes: number;
226
+ /** Cells of all worksheets together, as `maxCells` counts them (the sum of `sheets[].cells`). */
227
+ cells: number;
228
+ /** Items in the shared strings table. */
229
+ sharedStrings: number;
230
+ }
231
+ /**
232
+ * Checks an .xlsx, .xlsm, .xltx or .xltm file part by part without building
233
+ * its cells: every part `read` parses is parsed with the same checks and
234
+ * limits (every sheet to its end), every other part is inflated and its
235
+ * bytes searched for a DOCTYPE, and XML parts must be UTF-8 or UTF-16. Throws what `read` throws for any file
236
+ * `read` refuses under the same limits (docs/api.md §5.2.1).
237
+ */
238
+ export declare function inspect(input: BinaryInput, options?: InspectOptions): Promise<InspectResult>;
169
239
  export { type AbortSignalLike, type Alignment, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellErrorValue, type CellInput, type CellType, type CellValue, type Color, type ColumnProps, type ColumnWidth, type DefinedName, type DocProperties, type DroppedWarnings, type ErrorCode, type ExcelPartKind, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type Hyperlink, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetView, type Style, type Theme, type Workbook, isDataLossWarning };
package/dist/read.js CHANGED
@@ -1,3 +1,3 @@
1
1
  import { t as isDataLossWarning } from "./warnings-BPz1Ia3s.js";
2
- import { i as readSheetNames, n as detectFormat, r as read, t as DEFAULT_READ_LIMITS } from "./read-BnXzPjGc.js";
3
- export { DEFAULT_READ_LIMITS, detectFormat, isDataLossWarning, read, readSheetNames };
2
+ import { a as readSheetNames, i as read, n as detectFormat, r as inspect, t as DEFAULT_READ_LIMITS } from "./read-B6tY0ooT.js";
3
+ export { DEFAULT_READ_LIMITS, detectFormat, inspect, isDataLossWarning, read, readSheetNames };
package/dist/render.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_address = require("./address-DZBHchLv.cjs");
2
+ const require_address = require("./address-DKd_3EGf.cjs");
3
3
  const require_cells = require("./cells-CPXU722t.cjs");
4
4
  const require_colors = require("./colors-oBpjx97l.cjs");
5
- const require_dates = require("./dates-CA1dCizp.cjs");
5
+ const require_dates = require("./dates-DcdgnJto.cjs");
6
6
  // src/render.ts
7
7
  const states = /* @__PURE__ */ new WeakMap();
8
8
  const BUCKET = 64;
package/dist/render.js CHANGED
@@ -1,7 +1,7 @@
1
- import { a as decodeRange, n as MAX_ROWS, r as decodeCell, t as MAX_COLS } from "./address-DUn7-5OS.js";
1
+ import { a as decodeRange, n as MAX_ROWS, r as decodeCell, t as MAX_COLS } from "./address-BGH42dEg.js";
2
2
  import { t as cellText } from "./cells-CrMF8h_t.js";
3
3
  import { t as resolveColor } from "./colors-B8Nf_xTx.js";
4
- import { t as dateToSerial } from "./dates-BXcSWf9_.js";
4
+ import { t as dateToSerial } from "./dates-CIL1z9EY.js";
5
5
  // src/render.ts
6
6
  const states = /* @__PURE__ */ new WeakMap();
7
7
  const BUCKET = 64;
@@ -1,5 +1,5 @@
1
- const require_errors = require("./errors-DOPrrGS4.cjs");
2
- const require_address = require("./address-DZBHchLv.cjs");
1
+ const require_errors = require("./errors-CKYdpCoB.cjs");
2
+ const require_address = require("./address-DKd_3EGf.cjs");
3
3
  // src/internal/xml.ts
4
4
  /**
5
5
  * XML text helpers for the writer.
@@ -1,5 +1,5 @@
1
- import { o as ValidationError } from "./errors-CvGlfw0E.js";
2
- import { a as decodeRange, i as decodeCol, n as MAX_ROWS, o as encodeCell, r as decodeCell, s as encodeCol, t as MAX_COLS } from "./address-DUn7-5OS.js";
1
+ import { o as ValidationError } from "./errors-BQE62PFo.js";
2
+ import { a as decodeRange, i as decodeCol, n as MAX_ROWS, o as encodeCell, r as decodeCell, s as encodeCol, t as MAX_COLS } from "./address-BGH42dEg.js";
3
3
  // src/internal/xml.ts
4
4
  /**
5
5
  * XML text helpers for the writer.
@@ -32,10 +32,14 @@ type ExcelWarningCode = "UNSUPPORTED_PART" | "INVALID_STYLE_INDEX" | "INVALID_SH
32
32
  * The kind of package part a `MISSING_PART`, `BROKEN_OPTIONAL_PART` or
33
33
  * `UNSUPPORTED_PART` warning is about. The names are the last segment of the
34
34
  * OOXML relationship type (`.../relationships/worksheet` is `'worksheet'`),
35
- * in camelCase for the document-property parts. Kinds may be added in a minor
35
+ * in camelCase for the document-property parts. The kinds the package scan
36
+ * adds are named for what they are: `'activeX'` (ActiveX controls),
37
+ * `'embeddedPackage'` (embedded files), `'customUI'` (ribbon customisation),
38
+ * `'webExtension'` (Office web add-ins), `'invalidPartName'` (a part name,
39
+ * relationship target, Override PartName or relationship OPC forbids) and `'unreferencedPart'` (a part no relationship reaches). Kinds may be added in a minor
36
40
  * release, so a `switch` over it needs a `default` branch.
37
41
  */
38
- type ExcelPartKind = "worksheet" | "sharedStrings" | "styles" | "theme" | "coreProperties" | "extendedProperties" | "customProperties" | "drawing" | "vmlDrawing" | "comments" | "threadedComment" | "pivotTable" | "pivotCacheDefinition" | "table" | "oleObject" | "ctrlProp" | "image" | "vbaProject" | "externalLink" | "connections" | "queryTable" | "slicer" | "slicerCache" | "timeline" | "chartsheet" | "dialogsheet" | "macrosheet";
42
+ type ExcelPartKind = "worksheet" | "sharedStrings" | "styles" | "theme" | "coreProperties" | "extendedProperties" | "customProperties" | "drawing" | "vmlDrawing" | "comments" | "threadedComment" | "pivotTable" | "pivotCacheDefinition" | "table" | "oleObject" | "ctrlProp" | "image" | "vbaProject" | "externalLink" | "connections" | "queryTable" | "slicer" | "slicerCache" | "timeline" | "chartsheet" | "dialogsheet" | "macrosheet" | "activeX" | "embeddedPackage" | "customUI" | "webExtension" | "invalidPartName" | "unreferencedPart";
39
43
  /** What the warning cap left out; on `WARNINGS_TRUNCATED` only. */
40
44
  interface DroppedWarnings {
41
45
  /** Warnings not recorded, in total. */
@@ -60,6 +64,13 @@ interface ExcelWarning {
60
64
  ref?: string | undefined;
61
65
  /** On `MISSING_PART`, `BROKEN_OPTIONAL_PART` and `UNSUPPORTED_PART`: the kind of part. */
62
66
  partKind?: ExcelPartKind | undefined;
67
+ /**
68
+ * On `UNSUPPORTED_PART` with `partKind` `'unreferencedPart'` or
69
+ * `'invalidPartName'` (since 2.5): every such name, in the order found
70
+ * (`part` is the first). Each is a zip entry name, at most once, so the
71
+ * list is bounded by `maxEntries`.
72
+ */
73
+ parts?: string[] | undefined;
63
74
  /**
64
75
  * On `WARNINGS_TRUNCATED`: counts of the warnings that were not recorded. The
65
76
  * counts are final in the returned `warnings` only. `read` calls `onWarning`
@@ -32,10 +32,14 @@ type ExcelWarningCode = "UNSUPPORTED_PART" | "INVALID_STYLE_INDEX" | "INVALID_SH
32
32
  * The kind of package part a `MISSING_PART`, `BROKEN_OPTIONAL_PART` or
33
33
  * `UNSUPPORTED_PART` warning is about. The names are the last segment of the
34
34
  * OOXML relationship type (`.../relationships/worksheet` is `'worksheet'`),
35
- * in camelCase for the document-property parts. Kinds may be added in a minor
35
+ * in camelCase for the document-property parts. The kinds the package scan
36
+ * adds are named for what they are: `'activeX'` (ActiveX controls),
37
+ * `'embeddedPackage'` (embedded files), `'customUI'` (ribbon customisation),
38
+ * `'webExtension'` (Office web add-ins), `'invalidPartName'` (a part name,
39
+ * relationship target, Override PartName or relationship OPC forbids) and `'unreferencedPart'` (a part no relationship reaches). Kinds may be added in a minor
36
40
  * release, so a `switch` over it needs a `default` branch.
37
41
  */
38
- type ExcelPartKind = "worksheet" | "sharedStrings" | "styles" | "theme" | "coreProperties" | "extendedProperties" | "customProperties" | "drawing" | "vmlDrawing" | "comments" | "threadedComment" | "pivotTable" | "pivotCacheDefinition" | "table" | "oleObject" | "ctrlProp" | "image" | "vbaProject" | "externalLink" | "connections" | "queryTable" | "slicer" | "slicerCache" | "timeline" | "chartsheet" | "dialogsheet" | "macrosheet";
42
+ type ExcelPartKind = "worksheet" | "sharedStrings" | "styles" | "theme" | "coreProperties" | "extendedProperties" | "customProperties" | "drawing" | "vmlDrawing" | "comments" | "threadedComment" | "pivotTable" | "pivotCacheDefinition" | "table" | "oleObject" | "ctrlProp" | "image" | "vbaProject" | "externalLink" | "connections" | "queryTable" | "slicer" | "slicerCache" | "timeline" | "chartsheet" | "dialogsheet" | "macrosheet" | "activeX" | "embeddedPackage" | "customUI" | "webExtension" | "invalidPartName" | "unreferencedPart";
39
43
  /** What the warning cap left out; on `WARNINGS_TRUNCATED` only. */
40
44
  interface DroppedWarnings {
41
45
  /** Warnings not recorded, in total. */
@@ -60,6 +64,13 @@ interface ExcelWarning {
60
64
  ref?: string | undefined;
61
65
  /** On `MISSING_PART`, `BROKEN_OPTIONAL_PART` and `UNSUPPORTED_PART`: the kind of part. */
62
66
  partKind?: ExcelPartKind | undefined;
67
+ /**
68
+ * On `UNSUPPORTED_PART` with `partKind` `'unreferencedPart'` or
69
+ * `'invalidPartName'` (since 2.5): every such name, in the order found
70
+ * (`part` is the first). Each is a zip entry name, at most once, so the
71
+ * list is bounded by `maxEntries`.
72
+ */
73
+ parts?: string[] | undefined;
63
74
  /**
64
75
  * On `WARNINGS_TRUNCATED`: counts of the warnings that were not recorded. The
65
76
  * counts are final in the returned `warnings` only. `read` calls `onWarning`
package/dist/worker.cjs CHANGED
@@ -1,9 +1,9 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_csv = require("./csv-f4P3fGs-.cjs");
3
- const require_errors = require("./errors-DOPrrGS4.cjs");
4
- const require_read = require("./read-BYI7EVMo.cjs");
5
- const require_pipeline = require("./pipeline-LCTU0Eg_.cjs");
6
- const require_write = require("./write-DKXhuvKR.cjs");
2
+ const require_csv = require("./csv-BkVmMYQq.cjs");
3
+ const require_errors = require("./errors-CKYdpCoB.cjs");
4
+ const require_read = require("./read-Dgw9kMzh.cjs");
5
+ const require_pipeline = require("./pipeline-C9zhwGAV.cjs");
6
+ const require_write = require("./write-Bgl_QfA8.cjs");
7
7
  // src/worker.ts
8
8
  /** Marks the library's messages, so an app can use the same worker for its own messages too. */
9
9
  const TAG = "javascript-excel/worker@1";
package/dist/worker.d.cts CHANGED
@@ -21,12 +21,12 @@
21
21
  *
22
22
  * @module javascript-excel/worker
23
23
  */
24
- import { o as BinaryInput } from "./warnings-DhonqJ7A.cjs";
24
+ import { o as BinaryInput } from "./warnings-DEsTp6rd.cjs";
25
25
  import { CsvParseOptions, CsvParseResult, CsvReadOptions, CsvWriteOptions } from "./csv.cjs";
26
26
  import { D as Sheet, j as Workbook, s as CellInput } from "./model-BUNp7B0Z.cjs";
27
27
  import { ReadOptions, ReadResult } from "./read.cjs";
28
- import { n as ImportDatasetOptions, r as ImportDatasetResult } from "./pipeline-D1eAhqJu.cjs";
29
- import { n as WriteOptions, t as Progress } from "./write-Izl2NG0Y.cjs";
28
+ import { n as ImportDatasetOptions, r as ImportDatasetResult } from "./pipeline-CJWE3NWg.cjs";
29
+ import { n as WriteOptions, t as Progress } from "./write-JvXRv63d.cjs";
30
30
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
31
31
  /** The side of a message channel the library uses: a `Worker`, the worker's `self`, or a `MessagePort`. */
32
32
  export interface MessageEndpoint {
@@ -55,7 +55,7 @@ export interface WorkerClient {
55
55
  write(wb: Workbook, options?: WriteOptions & TransferOption): Promise<Uint8Array>;
56
56
  read(input: BinaryInput, options?: ReadOptions & TransferOption): Promise<ReadResult>;
57
57
  toCsv(source: Sheet | CellInput[][], options?: CsvWriteOptions): Promise<string>;
58
- parseCsv(input: string | BinaryInput, options?: (CsvParseOptions & Pick<CsvReadOptions, "encoding" | "signal">) & TransferOption): Promise<CsvParseResult>;
58
+ parseCsv(input: string | BinaryInput, options?: (CsvParseOptions & Pick<CsvReadOptions, "encoding" | "signal" | "rejectBinary" | "maxInputBytes">) & TransferOption): Promise<CsvParseResult>;
59
59
  /** Runs javascript-excel/import's `importDataset` in the worker (docs/api.md §5.6). */
60
60
  importDataset(input: string | BinaryInput, options?: ImportDatasetOptions & TransferOption): Promise<ImportDatasetResult>;
61
61
  /** Terminates the worker. Calls still in flight reject with an `AbortError`. */
package/dist/worker.d.ts CHANGED
@@ -21,12 +21,12 @@
21
21
  *
22
22
  * @module javascript-excel/worker
23
23
  */
24
- import { o as BinaryInput } from "./warnings-DhonqJ7A.js";
24
+ import { o as BinaryInput } from "./warnings-DEsTp6rd.js";
25
25
  import { CsvParseOptions, CsvParseResult, CsvReadOptions, CsvWriteOptions } from "./csv.js";
26
26
  import { D as Sheet, j as Workbook, s as CellInput } from "./model-BUNp7B0Z.js";
27
27
  import { ReadOptions, ReadResult } from "./read.js";
28
- import { n as ImportDatasetOptions, r as ImportDatasetResult } from "./pipeline-Bh7FUyzW.js";
29
- import { n as WriteOptions, t as Progress } from "./write-BaMv1Z7W.js";
28
+ import { n as ImportDatasetOptions, r as ImportDatasetResult } from "./pipeline-DVgO1aGC.js";
29
+ import { n as WriteOptions, t as Progress } from "./write-BylKqAmD.js";
30
30
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
31
31
  /** The side of a message channel the library uses: a `Worker`, the worker's `self`, or a `MessagePort`. */
32
32
  export interface MessageEndpoint {
@@ -55,7 +55,7 @@ export interface WorkerClient {
55
55
  write(wb: Workbook, options?: WriteOptions & TransferOption): Promise<Uint8Array>;
56
56
  read(input: BinaryInput, options?: ReadOptions & TransferOption): Promise<ReadResult>;
57
57
  toCsv(source: Sheet | CellInput[][], options?: CsvWriteOptions): Promise<string>;
58
- parseCsv(input: string | BinaryInput, options?: (CsvParseOptions & Pick<CsvReadOptions, "encoding" | "signal">) & TransferOption): Promise<CsvParseResult>;
58
+ parseCsv(input: string | BinaryInput, options?: (CsvParseOptions & Pick<CsvReadOptions, "encoding" | "signal" | "rejectBinary" | "maxInputBytes">) & TransferOption): Promise<CsvParseResult>;
59
59
  /** Runs javascript-excel/import's `importDataset` in the worker (docs/api.md §5.6). */
60
60
  importDataset(input: string | BinaryInput, options?: ImportDatasetOptions & TransferOption): Promise<ImportDatasetResult>;
61
61
  /** Terminates the worker. Calls still in flight reject with an `AbortError`. */
package/dist/worker.js CHANGED
@@ -1,8 +1,8 @@
1
- import { i as toCsv, r as readCsv } from "./csv-Bck8eW_D.js";
2
- import { a as LimitError, i as FormatError, n as EnvironmentError, o as ValidationError, r as ExcelError, s as isExcelError, t as CsvError } from "./errors-CvGlfw0E.js";
3
- import { r as read } from "./read-BnXzPjGc.js";
4
- import { t as importDataset } from "./pipeline-2dgQM9E9.js";
5
- import { r as toUint8Array } from "./write-BVXB2_2C.js";
1
+ import { i as toCsv, r as readCsv } from "./csv-5jVhfM5l.js";
2
+ import { a as LimitError, i as FormatError, n as EnvironmentError, o as ValidationError, r as ExcelError, s as isExcelError, t as CsvError } from "./errors-BQE62PFo.js";
3
+ import { i as read } from "./read-B6tY0ooT.js";
4
+ import { t as importDataset } from "./pipeline-1AVJbbqT.js";
5
+ import { r as toUint8Array } from "./write-DFz-h8gz.js";
6
6
  // src/worker.ts
7
7
  /** Marks the library's messages, so an app can use the same worker for its own messages too. */
8
8
  const TAG = "javascript-excel/worker@1";
@@ -1,8 +1,8 @@
1
- const require_errors = require("./errors-DOPrrGS4.cjs");
2
- const require_dos_time = require("./dos-time-CxEs--rI.cjs");
3
- const require_sheet_names = require("./sheet-names-DDY64-dt.cjs");
4
- const require_address = require("./address-DZBHchLv.cjs");
5
- const require_dates = require("./dates-CA1dCizp.cjs");
1
+ const require_errors = require("./errors-CKYdpCoB.cjs");
2
+ const require_dos_time = require("./dos-time-BUWyklco.cjs");
3
+ const require_sheet_names = require("./sheet-names-D8sYcjSd.cjs");
4
+ const require_address = require("./address-DKd_3EGf.cjs");
5
+ const require_dates = require("./dates-DcdgnJto.cjs");
6
6
  const require_cells = require("./cells-CPXU722t.cjs");
7
7
  const SIG_LOCAL = 67324752;
8
8
  const SIG_CENTRAL = 33639248;
@@ -1,4 +1,4 @@
1
- import { c as BlobType } from "./warnings-DhonqJ7A.js";
1
+ import { c as BlobType } from "./warnings-DEsTp6rd.js";
2
2
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
3
3
  import { j as Workbook } from "./model-BUNp7B0Z.js";
4
4
  /** MIME type of an .xlsx file. */
@@ -1,8 +1,8 @@
1
- import { n as EnvironmentError, o as ValidationError } from "./errors-CvGlfw0E.js";
2
- import { c as throttleProgress, d as throwIfAborted, i as nativeCodec, l as ByteWriter, n as toDosDateTime, o as encodeUtf8, r as crc32, s as createYielder, u as concatBytes } from "./dos-time-BsH7f0ef.js";
3
- import { _ as num, a as SheetFeatures, b as xstring, c as hyperlinkSchemes, d as PackageParts, f as REL_TYPE, g as needsPreserve, h as XML_DECL, m as mergeStyles, n as validateSheetName, o as SheetLinks, p as Rels, s as hyperlinkOf, u as CONTENT_TYPE, v as xmlAttr, y as xmlText } from "./sheet-names-BLrwcn33.js";
4
- import { a as decodeRange, n as MAX_ROWS, s as encodeCol } from "./address-DUn7-5OS.js";
5
- import { t as dateToSerial } from "./dates-BXcSWf9_.js";
1
+ import { n as EnvironmentError, o as ValidationError } from "./errors-BQE62PFo.js";
2
+ import { c as throttleProgress, d as throwIfAborted, i as nativeCodec, l as ByteWriter, n as toDosDateTime, o as encodeUtf8, r as crc32, s as createYielder, u as concatBytes } from "./dos-time-BEAyK3U8.js";
3
+ import { _ as num, a as SheetFeatures, b as xstring, c as hyperlinkSchemes, d as PackageParts, f as REL_TYPE, g as needsPreserve, h as XML_DECL, m as mergeStyles, n as validateSheetName, o as SheetLinks, p as Rels, s as hyperlinkOf, u as CONTENT_TYPE, v as xmlAttr, y as xmlText } from "./sheet-names-RoFkpk_R.js";
4
+ import { a as decodeRange, n as MAX_ROWS, s as encodeCol } from "./address-BGH42dEg.js";
5
+ import { t as dateToSerial } from "./dates-CIL1z9EY.js";
6
6
  import { t as cellText } from "./cells-CrMF8h_t.js";
7
7
  const SIG_LOCAL = 67324752;
8
8
  const SIG_CENTRAL = 33639248;
@@ -1,4 +1,4 @@
1
- import { c as BlobType } from "./warnings-DhonqJ7A.cjs";
1
+ import { c as BlobType } from "./warnings-DEsTp6rd.cjs";
2
2
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
3
3
  import { j as Workbook } from "./model-BUNp7B0Z.cjs";
4
4
  /** MIME type of an .xlsx file. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-excel",
3
- "version": "2.3.0",
3
+ "version": "2.5.0",
4
4
  "private": false,
5
5
  "description": "Read and write .xlsx and .csv files in browsers, Web Workers and Node. 2.0 is a from-scratch rewrite in progress.",
6
6
  "keywords": [