javascript-excel 2.2.0 → 2.4.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-D5Gz4ph8.cjs");
3
+ const require_read = require("./read-DmUPztqh.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
@@ -77,8 +77,9 @@ export interface ReadLimits {
77
77
  /**
78
78
  * Characters (UTF-16 code units, as `string.length` counts them) in one XML
79
79
  * tag with its attributes, comment, CDATA section or processing instruction.
80
- * Checked while the token is read, so it is never buffered past this. Text
81
- * 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`,
82
83
  * `details.value` is `max + 1` ("more than max"): the token's full length is
83
84
  * not read. Default 16 Mi (`DEFAULT_READ_LIMITS`).
84
85
  *
@@ -101,7 +102,10 @@ export interface ReadLimits {
101
102
  * 2.1 still compiles; when it is left out the default applies.
102
103
  */
103
104
  maxSheets?: number;
104
- /** 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
+ */
105
109
  maxCells: number;
106
110
  /**
107
111
  * Items other than cells that a read builds, all sheets together (added in
@@ -119,6 +123,43 @@ export interface ReadLimits {
119
123
  */
120
124
  maxItems?: number;
121
125
  maxSharedStrings: number;
126
+ /**
127
+ * Characters (UTF-16 code units) of one cell's text, as the cell will hold
128
+ * it (entities and `_xHHHH_` escapes decoded, rich-text runs together): a
129
+ * shared string, an inline string, the text of a `<v>` and of a formula
130
+ * (added in 2.3). Counted while the text streams in, so a longer one is
131
+ * refused before it is held whole. Default 1,048,576 (1 Mi,
132
+ * `DEFAULT_READ_LIMITS`), 32 times Excel's own limit of 32,767 characters
133
+ * per cell. On a `LimitError`, `details.value` is `max + 1` ("more than
134
+ * max"), `details.part` names the part and, for a sheet cell, `details.ref`
135
+ * the cell. The same limit bounds header and footer text, defined-name
136
+ * formulas and document property values, counted as written;
137
+ * `readSheetNames` applies it to defined names.
138
+ *
139
+ * Optional only so that a complete `ReadLimits` object written for 2.0 to
140
+ * 2.2 still compiles; when it is left out the default applies.
141
+ */
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;
122
163
  /**
123
164
  * Warnings kept before the cap applies. Past it, informational warnings are dropped and
124
165
  * counted in one `WARNINGS_TRUNCATED` (added where the first one is dropped); data-loss
package/dist/read.d.ts CHANGED
@@ -77,8 +77,9 @@ export interface ReadLimits {
77
77
  /**
78
78
  * Characters (UTF-16 code units, as `string.length` counts them) in one XML
79
79
  * tag with its attributes, comment, CDATA section or processing instruction.
80
- * Checked while the token is read, so it is never buffered past this. Text
81
- * 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`,
82
83
  * `details.value` is `max + 1` ("more than max"): the token's full length is
83
84
  * not read. Default 16 Mi (`DEFAULT_READ_LIMITS`).
84
85
  *
@@ -101,7 +102,10 @@ export interface ReadLimits {
101
102
  * 2.1 still compiles; when it is left out the default applies.
102
103
  */
103
104
  maxSheets?: number;
104
- /** 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
+ */
105
109
  maxCells: number;
106
110
  /**
107
111
  * Items other than cells that a read builds, all sheets together (added in
@@ -119,6 +123,43 @@ export interface ReadLimits {
119
123
  */
120
124
  maxItems?: number;
121
125
  maxSharedStrings: number;
126
+ /**
127
+ * Characters (UTF-16 code units) of one cell's text, as the cell will hold
128
+ * it (entities and `_xHHHH_` escapes decoded, rich-text runs together): a
129
+ * shared string, an inline string, the text of a `<v>` and of a formula
130
+ * (added in 2.3). Counted while the text streams in, so a longer one is
131
+ * refused before it is held whole. Default 1,048,576 (1 Mi,
132
+ * `DEFAULT_READ_LIMITS`), 32 times Excel's own limit of 32,767 characters
133
+ * per cell. On a `LimitError`, `details.value` is `max + 1` ("more than
134
+ * max"), `details.part` names the part and, for a sheet cell, `details.ref`
135
+ * the cell. The same limit bounds header and footer text, defined-name
136
+ * formulas and document property values, counted as written;
137
+ * `readSheetNames` applies it to defined names.
138
+ *
139
+ * Optional only so that a complete `ReadLimits` object written for 2.0 to
140
+ * 2.2 still compiles; when it is left out the default applies.
141
+ */
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;
122
163
  /**
123
164
  * Warnings kept before the cap applies. Past it, informational warnings are dropped and
124
165
  * 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-CFmZioBG.js";
2
+ import { i as readSheetNames, n as detectFormat, r as read, t as DEFAULT_READ_LIMITS } from "./read-cvxu6O-H.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-DZ241Y5F.cjs");
3
3
  const require_errors = require("./errors-DOPrrGS4.cjs");
4
- const require_read = require("./read-D5Gz4ph8.cjs");
5
- const require_pipeline = require("./pipeline-DLYtAkPU.cjs");
4
+ const require_read = require("./read-DmUPztqh.cjs");
5
+ const require_pipeline = require("./pipeline-BwkRpV5Z.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-4U7Xnuc1.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-BegSPu8X.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-Dn4MIESx.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-CFmZioBG.js";
4
- import { t as importDataset } from "./pipeline-BNhGRJcx.js";
3
+ import { r as read } from "./read-cvxu6O-H.js";
4
+ import { t as importDataset } from "./pipeline-C8F9lecW.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.2.0",
3
+ "version": "2.4.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": [