javascript-excel 2.1.0 → 2.3.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/dist/read.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_warnings = require("./warnings-CJPiDqei.cjs");
3
- const require_read = require("./read-DYDDLxUE.cjs");
3
+ const require_read = require("./read-BYI7EVMo.cjs");
4
4
  exports.DEFAULT_READ_LIMITS = require_read.DEFAULT_READ_LIMITS;
5
5
  exports.detectFormat = require_read.detectFormat;
6
6
  exports.isDataLossWarning = require_warnings.isDataLossWarning;
package/dist/read.d.cts CHANGED
@@ -59,7 +59,11 @@ export interface ReadOptions {
59
59
  /** Called as warnings occur, in addition to `ReadResult.warnings`. */
60
60
  onWarning?: ((w: ExcelWarning) => void) | undefined;
61
61
  }
62
- /** Limits for untrusted input. Exceeding one throws `LimitError` (`LIMIT_EXCEEDED`, `details.limit` names it). */
62
+ /**
63
+ * Limits for untrusted input. Exceeding one throws `LimitError` (`LIMIT_EXCEEDED`, `details.limit` names it).
64
+ * New optional members may be added in minor releases, so do not write `Required<ReadLimits>` literals;
65
+ * spread `DEFAULT_READ_LIMITS` instead.
66
+ */
63
67
  export interface ReadLimits {
64
68
  maxInputBytes: number;
65
69
  maxEntries: number;
@@ -73,8 +77,9 @@ export interface ReadLimits {
73
77
  /**
74
78
  * Characters (UTF-16 code units, as `string.length` counts them) in one XML
75
79
  * tag with its attributes, comment, CDATA section or processing instruction.
76
- * Checked while the token is read, so it is never buffered past this. Text
77
- * between tags is streamed and not limited by it. On a `LimitError`,
80
+ * Checked while the token is read, so it is never buffered past this. It does
81
+ * not limit text between tags: cell values, shared and inline strings and
82
+ * formulas are text, and `maxCellTextLength` limits those. On a `LimitError`,
78
83
  * `details.value` is `max + 1` ("more than max"): the token's full length is
79
84
  * not read. Default 16 Mi (`DEFAULT_READ_LIMITS`).
80
85
  *
@@ -82,9 +87,56 @@ export interface ReadLimits {
82
87
  * still compiles; when it is left out the default applies.
83
88
  */
84
89
  maxXmlTokenLength?: number;
90
+ /**
91
+ * Sheet entries (`<sheet>` elements, worksheets or not) that `xl/workbook.xml`
92
+ * may declare. Checked while that part is parsed, before any sheet is read;
93
+ * `readSheetNames` applies it too. Default 10,000 (`DEFAULT_READ_LIMITS`).
94
+ * It bounds the sheet list and the bookkeeping per entry. It does not bound
95
+ * memory on its own: several entries can name the same part, which is then
96
+ * read once per entry; memory is bounded by `maxCells`, `maxItems` and
97
+ * `maxTotalBytes`, which count what every sheet builds and every read of a
98
+ * part. On a `LimitError`, `details.value` is `max + 1` and
99
+ * `details.part` names the workbook part.
100
+ *
101
+ * Optional only so that a complete `ReadLimits` object written for 2.0 or
102
+ * 2.1 still compiles; when it is left out the default applies.
103
+ */
104
+ maxSheets?: number;
85
105
  /** All sheets together. */
86
106
  maxCells: number;
107
+ /**
108
+ * Items other than cells that a read builds, all sheets together (added in
109
+ * 2.2): one per column object of a `<col>` range, row-property object,
110
+ * merge, hyperlink (with the empty cell it may create), selection, defined
111
+ * name, kept style record (number format, cell format, indexed colour, and
112
+ * with `styles` on: font, fill, gradient stop, border), custom document
113
+ * property, and rich-text run after the first of a string. Each is counted
114
+ * before it is built. `readSheetNames` counts defined names. Default
115
+ * 10,000,000 (`DEFAULT_READ_LIMITS`). On a `LimitError`, `details.value` is
116
+ * `max + 1`.
117
+ *
118
+ * Optional only so that a complete `ReadLimits` object written for 2.0 or
119
+ * 2.1 still compiles; when it is left out the default applies.
120
+ */
121
+ maxItems?: number;
87
122
  maxSharedStrings: number;
123
+ /**
124
+ * Characters (UTF-16 code units) of one cell's text, as the cell will hold
125
+ * it (entities and `_xHHHH_` escapes decoded, rich-text runs together): a
126
+ * shared string, an inline string, the text of a `<v>` and of a formula
127
+ * (added in 2.3). Counted while the text streams in, so a longer one is
128
+ * refused before it is held whole. Default 1,048,576 (1 Mi,
129
+ * `DEFAULT_READ_LIMITS`), 32 times Excel's own limit of 32,767 characters
130
+ * per cell. On a `LimitError`, `details.value` is `max + 1` ("more than
131
+ * max"), `details.part` names the part and, for a sheet cell, `details.ref`
132
+ * the cell. The same limit bounds header and footer text, defined-name
133
+ * formulas and document property values, counted as written;
134
+ * `readSheetNames` applies it to defined names.
135
+ *
136
+ * Optional only so that a complete `ReadLimits` object written for 2.0 to
137
+ * 2.2 still compiles; when it is left out the default applies.
138
+ */
139
+ maxCellTextLength?: number;
88
140
  /**
89
141
  * Warnings kept before the cap applies. Past it, informational warnings are dropped and
90
142
  * counted in one `WARNINGS_TRUNCATED` (added where the first one is dropped); data-loss
package/dist/read.d.ts CHANGED
@@ -59,7 +59,11 @@ export interface ReadOptions {
59
59
  /** Called as warnings occur, in addition to `ReadResult.warnings`. */
60
60
  onWarning?: ((w: ExcelWarning) => void) | undefined;
61
61
  }
62
- /** Limits for untrusted input. Exceeding one throws `LimitError` (`LIMIT_EXCEEDED`, `details.limit` names it). */
62
+ /**
63
+ * Limits for untrusted input. Exceeding one throws `LimitError` (`LIMIT_EXCEEDED`, `details.limit` names it).
64
+ * New optional members may be added in minor releases, so do not write `Required<ReadLimits>` literals;
65
+ * spread `DEFAULT_READ_LIMITS` instead.
66
+ */
63
67
  export interface ReadLimits {
64
68
  maxInputBytes: number;
65
69
  maxEntries: number;
@@ -73,8 +77,9 @@ export interface ReadLimits {
73
77
  /**
74
78
  * Characters (UTF-16 code units, as `string.length` counts them) in one XML
75
79
  * tag with its attributes, comment, CDATA section or processing instruction.
76
- * Checked while the token is read, so it is never buffered past this. Text
77
- * between tags is streamed and not limited by it. On a `LimitError`,
80
+ * Checked while the token is read, so it is never buffered past this. It does
81
+ * not limit text between tags: cell values, shared and inline strings and
82
+ * formulas are text, and `maxCellTextLength` limits those. On a `LimitError`,
78
83
  * `details.value` is `max + 1` ("more than max"): the token's full length is
79
84
  * not read. Default 16 Mi (`DEFAULT_READ_LIMITS`).
80
85
  *
@@ -82,9 +87,56 @@ export interface ReadLimits {
82
87
  * still compiles; when it is left out the default applies.
83
88
  */
84
89
  maxXmlTokenLength?: number;
90
+ /**
91
+ * Sheet entries (`<sheet>` elements, worksheets or not) that `xl/workbook.xml`
92
+ * may declare. Checked while that part is parsed, before any sheet is read;
93
+ * `readSheetNames` applies it too. Default 10,000 (`DEFAULT_READ_LIMITS`).
94
+ * It bounds the sheet list and the bookkeeping per entry. It does not bound
95
+ * memory on its own: several entries can name the same part, which is then
96
+ * read once per entry; memory is bounded by `maxCells`, `maxItems` and
97
+ * `maxTotalBytes`, which count what every sheet builds and every read of a
98
+ * part. On a `LimitError`, `details.value` is `max + 1` and
99
+ * `details.part` names the workbook part.
100
+ *
101
+ * Optional only so that a complete `ReadLimits` object written for 2.0 or
102
+ * 2.1 still compiles; when it is left out the default applies.
103
+ */
104
+ maxSheets?: number;
85
105
  /** All sheets together. */
86
106
  maxCells: number;
107
+ /**
108
+ * Items other than cells that a read builds, all sheets together (added in
109
+ * 2.2): one per column object of a `<col>` range, row-property object,
110
+ * merge, hyperlink (with the empty cell it may create), selection, defined
111
+ * name, kept style record (number format, cell format, indexed colour, and
112
+ * with `styles` on: font, fill, gradient stop, border), custom document
113
+ * property, and rich-text run after the first of a string. Each is counted
114
+ * before it is built. `readSheetNames` counts defined names. Default
115
+ * 10,000,000 (`DEFAULT_READ_LIMITS`). On a `LimitError`, `details.value` is
116
+ * `max + 1`.
117
+ *
118
+ * Optional only so that a complete `ReadLimits` object written for 2.0 or
119
+ * 2.1 still compiles; when it is left out the default applies.
120
+ */
121
+ maxItems?: number;
87
122
  maxSharedStrings: number;
123
+ /**
124
+ * Characters (UTF-16 code units) of one cell's text, as the cell will hold
125
+ * it (entities and `_xHHHH_` escapes decoded, rich-text runs together): a
126
+ * shared string, an inline string, the text of a `<v>` and of a formula
127
+ * (added in 2.3). Counted while the text streams in, so a longer one is
128
+ * refused before it is held whole. Default 1,048,576 (1 Mi,
129
+ * `DEFAULT_READ_LIMITS`), 32 times Excel's own limit of 32,767 characters
130
+ * per cell. On a `LimitError`, `details.value` is `max + 1` ("more than
131
+ * max"), `details.part` names the part and, for a sheet cell, `details.ref`
132
+ * the cell. The same limit bounds header and footer text, defined-name
133
+ * formulas and document property values, counted as written;
134
+ * `readSheetNames` applies it to defined names.
135
+ *
136
+ * Optional only so that a complete `ReadLimits` object written for 2.0 to
137
+ * 2.2 still compiles; when it is left out the default applies.
138
+ */
139
+ maxCellTextLength?: number;
88
140
  /**
89
141
  * Warnings kept before the cap applies. Past it, informational warnings are dropped and
90
142
  * counted in one `WARNINGS_TRUNCATED` (added where the first one is dropped); data-loss
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-CFQ09LlL.js";
2
+ import { i as readSheetNames, n as detectFormat, r as read, t as DEFAULT_READ_LIMITS } from "./read-BnXzPjGc.js";
3
3
  export { DEFAULT_READ_LIMITS, detectFormat, isDataLossWarning, read, readSheetNames };
package/dist/worker.cjs CHANGED
@@ -1,8 +1,8 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_csv = require("./csv-DzGOFyHs.cjs");
2
+ const require_csv = require("./csv-f4P3fGs-.cjs");
3
3
  const require_errors = require("./errors-DOPrrGS4.cjs");
4
- const require_read = require("./read-DYDDLxUE.cjs");
5
- const require_pipeline = require("./pipeline-Dc15gn1t.cjs");
4
+ const require_read = require("./read-BYI7EVMo.cjs");
5
+ const require_pipeline = require("./pipeline-LCTU0Eg_.cjs");
6
6
  const require_write = require("./write-DKXhuvKR.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. */
package/dist/worker.d.cts CHANGED
@@ -25,7 +25,7 @@ import { o as BinaryInput } from "./warnings-DhonqJ7A.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 ImportDatasetResult, t as ImportDatasetOptions } from "./pipeline-C63qD7Ym.cjs";
28
+ import { n as ImportDatasetOptions, r as ImportDatasetResult } from "./pipeline-D1eAhqJu.cjs";
29
29
  import { n as WriteOptions, t as Progress } from "./write-Izl2NG0Y.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`. */
package/dist/worker.d.ts CHANGED
@@ -25,7 +25,7 @@ import { o as BinaryInput } from "./warnings-DhonqJ7A.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 ImportDatasetResult, t as ImportDatasetOptions } from "./pipeline-6PmlmH1-.js";
28
+ import { n as ImportDatasetOptions, r as ImportDatasetResult } from "./pipeline-Bh7FUyzW.js";
29
29
  import { n as WriteOptions, t as Progress } from "./write-BaMv1Z7W.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`. */
package/dist/worker.js CHANGED
@@ -1,7 +1,7 @@
1
- import { i as toCsv, r as readCsv } from "./csv-CrWF7JS1.js";
1
+ import { i as toCsv, r as readCsv } from "./csv-Bck8eW_D.js";
2
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-CFQ09LlL.js";
4
- import { t as importDataset } from "./pipeline-CMealW1i.js";
3
+ import { r as read } from "./read-BnXzPjGc.js";
4
+ import { t as importDataset } from "./pipeline-2dgQM9E9.js";
5
5
  import { r as toUint8Array } from "./write-BVXB2_2C.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. */
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "javascript-excel",
3
- "version": "2.1.0",
3
+ "version": "2.3.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": [