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
@@ -1,9 +1,9 @@
1
- import { a as decodeRange, c as encodeRange, o as encodeCell, r as decodeCell, s as encodeCol, t as MAX_COLS } from "./address-DUn7-5OS.js";
1
+ import { a as decodeRange, c as encodeRange, o as encodeCell, r as decodeCell, s as encodeCol, t as MAX_COLS } from "./address-BGH42dEg.js";
2
2
  import { t as cellText } from "./cells-CrMF8h_t.js";
3
- import { t as dateToSerial } from "./dates-BXcSWf9_.js";
4
- import { o as ValidationError } from "./errors-CvGlfw0E.js";
3
+ import { t as dateToSerial } from "./dates-CIL1z9EY.js";
4
+ import { a as LimitError, o as ValidationError } from "./errors-BQE62PFo.js";
5
5
  import { n as parseIsoDate, t as isoDate } from "./iso-date-CXnn-9mT.js";
6
- import { l as textWidth, m as mergeStyles, n as validateSheetName, r as AUTO_WIDTH } from "./sheet-names-BLrwcn33.js";
6
+ import { l as textWidth, m as mergeStyles, n as validateSheetName, r as AUTO_WIDTH } from "./sheet-names-RoFkpk_R.js";
7
7
  // src/dataset.ts
8
8
  /**
9
9
  * Dataset builders (docs/api.md §4.3): `{ columns, data }` ↔ Sheet.
@@ -594,8 +594,51 @@ function toDataset(sheet, options = {}) {
594
594
  data
595
595
  };
596
596
  }
597
+ /**
598
+ * Every data row gets a key for every column, null where the row has no cell
599
+ * (the contract of toDataset). A wide header over short rows therefore costs
600
+ * rows × columns, far beyond the cells the sheet holds: 16,384 titles over
601
+ * 10,000 three-cell rows are 164 million fields. This counts those empty
602
+ * fields, row by row in the order they would be built, and refuses at the
603
+ * first row that passes `max`, before any row is built (JSE-68). A cell with
604
+ * neither value nor formula (only a hyperlink, which the reader charges to
605
+ * maxItems, or a style) is an empty field too. Work is
606
+ * bounded by the cells visited plus `max`: a row costs at most its stored
607
+ * cells plus its empty fields.
608
+ */
609
+ function checkPadding(s, rng, firstData, max) {
610
+ const width = rng.end.col - rng.start.col + 1;
611
+ const height = rng.end.row - firstData + 1;
612
+ if (height <= 0 || width * height <= max) return;
613
+ let padding = 0;
614
+ let rows = 0;
615
+ for (let r = firstData; r <= rng.end.row; r++) {
616
+ const row = s.rows[r];
617
+ if (!row) continue;
618
+ const end = Math.min(rng.end.col, row.length - 1);
619
+ let any = false;
620
+ let present = 0;
621
+ for (let c = rng.start.col; c <= end; c++) {
622
+ const v = row[c];
623
+ if (v === void 0 || v === null) continue;
624
+ if (isCellObject(v) && (v.value === void 0 || v.value === null) && !v.formula) continue;
625
+ present++;
626
+ any = true;
627
+ }
628
+ if (!any) continue;
629
+ rows++;
630
+ padding += width - present;
631
+ if (padding > max) throw new LimitError("LIMIT_EXCEEDED", `The dataset needs more than maxCells (${max}) empty fields: ${rows} data rows × ${width} columns hold few cells. Read a narrower range or set maxColumns.`, { details: {
632
+ limit: "maxCells",
633
+ value: padding,
634
+ max,
635
+ rows,
636
+ columns: width
637
+ } });
638
+ }
639
+ }
597
640
  /** @internal */
598
- function toDatasetDetailed(sheet, options = {}) {
641
+ function toDatasetDetailed(sheet, options = {}, budget) {
599
642
  const s = sheet;
600
643
  const rng = options.range ? decodeRange(options.range) : s.dimension ? decodeRange(s.dimension) : usedRange(s);
601
644
  if (!rng) return {
@@ -631,6 +674,7 @@ function toDatasetDetailed(sheet, options = {}) {
631
674
  const rowNumbers = [];
632
675
  let lastRaw;
633
676
  const firstData = headerRow === false ? rng.start.row : Math.max(rng.start.row, headerRow + headerRows);
677
+ if (budget) checkPadding(s, rng, firstData, budget.maxCells);
634
678
  for (let r = firstData; r <= rng.end.row; r++) {
635
679
  const row = s.rows[r];
636
680
  if (!row) continue;
@@ -1,4 +1,4 @@
1
- import { o as ValidationError } from "./errors-CvGlfw0E.js";
1
+ import { o as ValidationError } from "./errors-BQE62PFo.js";
2
2
  // src/dates.ts
3
3
  /**
4
4
  * Date ↔ serial conversion (docs/api.md §3.4.1, §4.5).
@@ -1,4 +1,4 @@
1
- const require_errors = require("./errors-DOPrrGS4.cjs");
1
+ const require_errors = require("./errors-CKYdpCoB.cjs");
2
2
  // src/dates.ts
3
3
  /**
4
4
  * Date ↔ serial conversion (docs/api.md §3.4.1, §4.5).
package/dist/dom.cjs CHANGED
@@ -1,7 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_cells = require("./cells-CPXU722t.cjs");
3
- const require_sheet_names = require("./sheet-names-DDY64-dt.cjs");
4
- const require_errors = require("./errors-DOPrrGS4.cjs");
3
+ const require_sheet_names = require("./sheet-names-D8sYcjSd.cjs");
4
+ const require_errors = require("./errors-CKYdpCoB.cjs");
5
5
  const require_iso_date = require("./iso-date-3TY1OlGd.cjs");
6
6
  const require_warnings = require("./warnings-CJPiDqei.cjs");
7
7
  // src/auto-width.ts
package/dist/dom.d.cts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @module javascript-excel/dom
9
9
  */
10
10
  import { t as AutoWidthOptions } from "./auto-width-DZvQSucm.cjs";
11
- import { a as isDataLossWarning, c as BlobType, i as ExcelWarningCode, n as ExcelPartKind, r as ExcelWarning, t as DroppedWarnings } from "./warnings-DhonqJ7A.cjs";
11
+ import { a as isDataLossWarning, c as BlobType, i as ExcelWarningCode, n as ExcelPartKind, r as ExcelWarning, t as DroppedWarnings } from "./warnings-DEsTp6rd.cjs";
12
12
  import { D as Sheet, k as Style, s as CellInput } from "./model-BUNp7B0Z.cjs";
13
13
  /** `HTMLTableElement` when the consumer has DOM types, else `object`. */
14
14
  export type TableElement = typeof globalThis extends {
package/dist/dom.d.ts CHANGED
@@ -8,7 +8,7 @@
8
8
  * @module javascript-excel/dom
9
9
  */
10
10
  import { t as AutoWidthOptions } from "./auto-width-CT-BihTW.js";
11
- import { a as isDataLossWarning, c as BlobType, i as ExcelWarningCode, n as ExcelPartKind, r as ExcelWarning, t as DroppedWarnings } from "./warnings-DhonqJ7A.js";
11
+ import { a as isDataLossWarning, c as BlobType, i as ExcelWarningCode, n as ExcelPartKind, r as ExcelWarning, t as DroppedWarnings } from "./warnings-DEsTp6rd.js";
12
12
  import { D as Sheet, k as Style, s as CellInput } from "./model-BUNp7B0Z.js";
13
13
  /** `HTMLTableElement` when the consumer has DOM types, else `object`. */
14
14
  export type TableElement = typeof globalThis extends {
package/dist/dom.js CHANGED
@@ -1,6 +1,6 @@
1
1
  import { t as cellText } from "./cells-CrMF8h_t.js";
2
- import { c as hyperlinkSchemes, i as DEFAULT_HYPERLINK_SCHEMES, l as textWidth, m as mergeStyles, n as validateSheetName, r as AUTO_WIDTH } from "./sheet-names-BLrwcn33.js";
3
- import { n as EnvironmentError, o as ValidationError } from "./errors-CvGlfw0E.js";
2
+ import { c as hyperlinkSchemes, i as DEFAULT_HYPERLINK_SCHEMES, l as textWidth, m as mergeStyles, n as validateSheetName, r as AUTO_WIDTH } from "./sheet-names-RoFkpk_R.js";
3
+ import { n as EnvironmentError, o as ValidationError } from "./errors-BQE62PFo.js";
4
4
  import { n as parseIsoDate } from "./iso-date-CXnn-9mT.js";
5
5
  import { t as isDataLossWarning } from "./warnings-BPz1Ia3s.js";
6
6
  // src/auto-width.ts
@@ -1,4 +1,4 @@
1
- import { a as LimitError, i as FormatError, n as EnvironmentError } from "./errors-CvGlfw0E.js";
1
+ import { a as LimitError, i as FormatError, n as EnvironmentError } from "./errors-BQE62PFo.js";
2
2
  // src/internal/zip/bytes.ts
3
3
  /** Rejects with `signal.reason`, the same as fetch. */
4
4
  function throwIfAborted(signal) {
@@ -1,4 +1,4 @@
1
- const require_errors = require("./errors-DOPrrGS4.cjs");
1
+ const require_errors = require("./errors-CKYdpCoB.cjs");
2
2
  // src/internal/zip/bytes.ts
3
3
  /** Rejects with `signal.reason`, the same as fetch. */
4
4
  function throwIfAborted(signal) {
@@ -13,7 +13,7 @@ var ExcelError = class extends Error {
13
13
  };
14
14
  /** The model or options cannot be written. */
15
15
  var ValidationError = class extends ExcelError {};
16
- /** The input is not a readable xlsx or zip file. */
16
+ /** The input is not a readable xlsx or zip file, or (readCsv) not text. */
17
17
  var FormatError = class extends ExcelError {};
18
18
  /** A read limit was exceeded; `details.limit` names it. */
19
19
  var LimitError = class extends ExcelError {};
@@ -13,7 +13,7 @@ var ExcelError = class extends Error {
13
13
  };
14
14
  /** The model or options cannot be written. */
15
15
  var ValidationError = class extends ExcelError {};
16
- /** The input is not a readable xlsx or zip file. */
16
+ /** The input is not a readable xlsx or zip file, or (readCsv) not text. */
17
17
  var FormatError = class extends ExcelError {};
18
18
  /** A read limit was exceeded; `details.limit` names it. */
19
19
  var LimitError = class extends ExcelError {};
package/dist/format.cjs CHANGED
@@ -1,6 +1,6 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_cells = require("./cells-CPXU722t.cjs");
3
- const require_dates = require("./dates-CA1dCizp.cjs");
3
+ const require_dates = require("./dates-DcdgnJto.cjs");
4
4
  const require_numfmt = require("./numfmt-DwsnhZKe.cjs");
5
5
  // src/internal/format/parse.ts
6
6
  const COLOR_NAMES = /* @__PURE__ */ new Set([
package/dist/format.js CHANGED
@@ -1,5 +1,5 @@
1
1
  import { t as cellText } from "./cells-CrMF8h_t.js";
2
- import { t as dateToSerial } from "./dates-BXcSWf9_.js";
2
+ import { t as dateToSerial } from "./dates-CIL1z9EY.js";
3
3
  import { t as BUILTIN_NUM_FMTS } from "./numfmt-Ci_oW11p.js";
4
4
  // src/internal/format/parse.ts
5
5
  const COLOR_NAMES = /* @__PURE__ */ new Set([
package/dist/import.cjs CHANGED
@@ -1,5 +1,5 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_pipeline = require("./pipeline-LCTU0Eg_.cjs");
2
+ const require_pipeline = require("./pipeline-C9zhwGAV.cjs");
3
3
  const require_warnings = require("./warnings-CJPiDqei.cjs");
4
4
  exports.applyMapping = require_pipeline.applyMapping;
5
5
  exports.coerceColumns = require_pipeline.coerceColumns;
package/dist/import.d.cts CHANGED
@@ -3,8 +3,8 @@
3
3
  * (docs/api.md §5.6). Header detection, type inference, locale-aware
4
4
  * parsing and column mapping, plus the `importDataset` pipeline.
5
5
  */
6
- import { A as NumberGroup, C as coerceColumns, D as ImportLocale, E as HeaderDetection, M as parseNumber, O as detectHeader, S as TypeOptions, T as DetectHeaderOptions, _ as ColumnType, a as ImportProgress, b as ImportIssueCode, c as FieldSpec, d as MappableDataset, f as MappedDataset, g as CoerceResult, h as mapColumns, i as ImportMeta, j as parseDate, k as DateOrder, l as ImportSchema, m as applyMapping, n as ImportDatasetOptions, o as importDataset, p as MappingResult, r as ImportDatasetResult, s as ColumnMapping, t as DroppedIssues, u as ImportedColumn, v as DatasetLike, w as inferColumnTypes, x as InferredColumn, y as ImportIssue } from "./pipeline-D1eAhqJu.cjs";
7
- 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";
6
+ import { A as NumberGroup, C as coerceColumns, D as ImportLocale, E as HeaderDetection, M as parseNumber, O as detectHeader, S as TypeOptions, T as DetectHeaderOptions, _ as ColumnType, a as ImportProgress, b as ImportIssueCode, c as FieldSpec, d as MappableDataset, f as MappedDataset, g as CoerceResult, h as mapColumns, i as ImportMeta, j as parseDate, k as DateOrder, l as ImportSchema, m as applyMapping, n as ImportDatasetOptions, o as importDataset, p as MappingResult, r as ImportDatasetResult, s as ColumnMapping, t as DroppedIssues, u as ImportedColumn, v as DatasetLike, w as inferColumnTypes, x as InferredColumn, y as ImportIssue } from "./pipeline-CJWE3NWg.cjs";
7
+ 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";
8
8
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
9
9
  import { ReadLimits, SheetInfo } from "./read.cjs";
10
10
  export { type AbortSignalLike, type BinaryInput, type BlobLike, type BlobType, type CoerceResult, type ColumnMapping, type ColumnType, type DatasetLike, type DateOrder, type DetectHeaderOptions, type DroppedIssues, type DroppedWarnings, type ExcelPartKind, type ExcelWarning, type ExcelWarningCode, type FieldSpec, type HeaderDetection, type ImportDatasetOptions, type ImportDatasetResult, type ImportIssue, type ImportIssueCode, type ImportLocale, type ImportMeta, type ImportProgress, type ImportSchema, type ImportedColumn, type InferredColumn, type MappableDataset, type MappedDataset, type MappingResult, type NumberGroup, type ReadLimits, type SheetInfo, type TypeOptions, applyMapping, coerceColumns, detectHeader, importDataset, inferColumnTypes, isDataLossWarning, mapColumns, parseDate, parseNumber };
package/dist/import.d.ts CHANGED
@@ -3,8 +3,8 @@
3
3
  * (docs/api.md §5.6). Header detection, type inference, locale-aware
4
4
  * parsing and column mapping, plus the `importDataset` pipeline.
5
5
  */
6
- import { A as NumberGroup, C as coerceColumns, D as ImportLocale, E as HeaderDetection, M as parseNumber, O as detectHeader, S as TypeOptions, T as DetectHeaderOptions, _ as ColumnType, a as ImportProgress, b as ImportIssueCode, c as FieldSpec, d as MappableDataset, f as MappedDataset, g as CoerceResult, h as mapColumns, i as ImportMeta, j as parseDate, k as DateOrder, l as ImportSchema, m as applyMapping, n as ImportDatasetOptions, o as importDataset, p as MappingResult, r as ImportDatasetResult, s as ColumnMapping, t as DroppedIssues, u as ImportedColumn, v as DatasetLike, w as inferColumnTypes, x as InferredColumn, y as ImportIssue } from "./pipeline-Bh7FUyzW.js";
7
- 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";
6
+ import { A as NumberGroup, C as coerceColumns, D as ImportLocale, E as HeaderDetection, M as parseNumber, O as detectHeader, S as TypeOptions, T as DetectHeaderOptions, _ as ColumnType, a as ImportProgress, b as ImportIssueCode, c as FieldSpec, d as MappableDataset, f as MappedDataset, g as CoerceResult, h as mapColumns, i as ImportMeta, j as parseDate, k as DateOrder, l as ImportSchema, m as applyMapping, n as ImportDatasetOptions, o as importDataset, p as MappingResult, r as ImportDatasetResult, s as ColumnMapping, t as DroppedIssues, u as ImportedColumn, v as DatasetLike, w as inferColumnTypes, x as InferredColumn, y as ImportIssue } from "./pipeline-DVgO1aGC.js";
7
+ 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";
8
8
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
9
9
  import { ReadLimits, SheetInfo } from "./read.js";
10
10
  export { type AbortSignalLike, type BinaryInput, type BlobLike, type BlobType, type CoerceResult, type ColumnMapping, type ColumnType, type DatasetLike, type DateOrder, type DetectHeaderOptions, type DroppedIssues, type DroppedWarnings, type ExcelPartKind, type ExcelWarning, type ExcelWarningCode, type FieldSpec, type HeaderDetection, type ImportDatasetOptions, type ImportDatasetResult, type ImportIssue, type ImportIssueCode, type ImportLocale, type ImportMeta, type ImportProgress, type ImportSchema, type ImportedColumn, type InferredColumn, type MappableDataset, type MappedDataset, type MappingResult, type NumberGroup, type ReadLimits, type SheetInfo, type TypeOptions, applyMapping, coerceColumns, detectHeader, importDataset, inferColumnTypes, isDataLossWarning, mapColumns, parseDate, parseNumber };
package/dist/import.js CHANGED
@@ -1,3 +1,3 @@
1
- import { a as mapColumns, c as parseNumber, i as applyMapping, n as coerceColumns, o as detectHeader, r as inferColumnTypes, s as parseDate, t as importDataset } from "./pipeline-2dgQM9E9.js";
1
+ import { a as mapColumns, c as parseNumber, i as applyMapping, n as coerceColumns, o as detectHeader, r as inferColumnTypes, s as parseDate, t as importDataset } from "./pipeline-1AVJbbqT.js";
2
2
  import { t as isDataLossWarning } from "./warnings-BPz1Ia3s.js";
3
3
  export { applyMapping, coerceColumns, detectHeader, importDataset, inferColumnTypes, isDataLossWarning, mapColumns, parseDate, parseNumber };
package/dist/index.cjs CHANGED
@@ -1,17 +1,17 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
- const require_errors = require("./errors-DOPrrGS4.cjs");
3
- const require_write = require("./write-DKXhuvKR.cjs");
2
+ const require_errors = require("./errors-CKYdpCoB.cjs");
3
+ const require_write = require("./write-Bgl_QfA8.cjs");
4
4
  const require_warnings = require("./warnings-CJPiDqei.cjs");
5
- const require_dates = require("./dates-CA1dCizp.cjs");
6
- const require_sheet_names = require("./sheet-names-DDY64-dt.cjs");
5
+ const require_dates = require("./dates-DcdgnJto.cjs");
6
+ const require_sheet_names = require("./sheet-names-D8sYcjSd.cjs");
7
7
  const require_colors = require("./colors-oBpjx97l.cjs");
8
8
  const require_cells = require("./cells-CPXU722t.cjs");
9
- const require_dataset = require("./dataset-DzoMeOG1.cjs");
9
+ const require_dataset = require("./dataset-B4-SEdCn.cjs");
10
10
  const require_numfmt = require("./numfmt-DwsnhZKe.cjs");
11
- const require_address = require("./address-DZBHchLv.cjs");
11
+ const require_address = require("./address-DKd_3EGf.cjs");
12
12
  // src/index.ts
13
13
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
14
- const VERSION = "2.3.0";
14
+ const VERSION = "2.5.0";
15
15
  exports.BUILTIN_NUM_FMTS = require_numfmt.BUILTIN_NUM_FMTS;
16
16
  exports.CsvError = require_errors.CsvError;
17
17
  exports.EnvironmentError = require_errors.EnvironmentError;
package/dist/index.d.cts CHANGED
@@ -8,8 +8,8 @@
8
8
  * @module javascript-excel
9
9
  */
10
10
  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";
11
- import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-Izl2NG0Y.cjs";
12
- 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";
11
+ import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-JvXRv63d.cjs";
12
+ 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";
13
13
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
14
14
  import { t as AutoWidthOptions } from "./auto-width-DZvQSucm.cjs";
15
15
  /**
@@ -19,7 +19,7 @@ import { t as AutoWidthOptions } from "./auto-width-DZvQSucm.cjs";
19
19
  * app ends up with both the ESM and the CJS build, each has its own classes.
20
20
  */
21
21
  /** Every error code the library throws. */
22
- type ExcelErrorCode = "NO_SHEETS" | "INVALID_SHEET_NAME" | "DUPLICATE_SHEET_NAME" | "INVALID_ACTIVE_SHEET" | "INVALID_REF" | "OUT_OF_BOUNDS" | "INVALID_CELL" | "INVALID_NUMBER" | "INVALID_DATE" | "STRING_TOO_LONG" | "INVALID_STYLE" | "INVALID_NUMFMT" | "INVALID_HYPERLINK" | "OVERLAPPING_MERGE" | "INVALID_COLUMN" | "TOO_MANY_STYLES" | "ZIP64_REQUIRED" | "INVALID_PROPERTY" | "INVALID_SHEET_PROPERTY" | "INVALID_DEFINED_NAME" | "SHEET_NOT_FOUND" | "VALIDATION_FAILED" | "UNSUPPORTED_FORMAT" | "NOT_XLSX" | "ZIP_INVALID" | "ZIP_UNSUPPORTED_METHOD" | "ZIP_ENCRYPTED" | "ZIP_CRC_MISMATCH" | "XML_MALFORMED" | "XML_DTD_FORBIDDEN" | "LIMIT_EXCEEDED" | "CSV_MALFORMED" | "ENVIRONMENT_UNSUPPORTED";
22
+ type ExcelErrorCode = "NO_SHEETS" | "INVALID_SHEET_NAME" | "DUPLICATE_SHEET_NAME" | "INVALID_ACTIVE_SHEET" | "INVALID_REF" | "OUT_OF_BOUNDS" | "INVALID_CELL" | "INVALID_NUMBER" | "INVALID_DATE" | "STRING_TOO_LONG" | "INVALID_STYLE" | "INVALID_NUMFMT" | "INVALID_HYPERLINK" | "OVERLAPPING_MERGE" | "INVALID_COLUMN" | "TOO_MANY_STYLES" | "ZIP64_REQUIRED" | "INVALID_PROPERTY" | "INVALID_SHEET_PROPERTY" | "INVALID_DEFINED_NAME" | "SHEET_NOT_FOUND" | "VALIDATION_FAILED" | "UNSUPPORTED_FORMAT" | "NOT_XLSX" | "ZIP_INVALID" | "ZIP_UNSUPPORTED_METHOD" | "ZIP_ENCRYPTED" | "ZIP_CRC_MISMATCH" | "XML_MALFORMED" | "XML_DTD_FORBIDDEN" | "CSV_BINARY_INPUT" | "CSV_INVALID_ENCODING" | "LIMIT_EXCEEDED" | "CSV_MALFORMED" | "ENVIRONMENT_UNSUPPORTED";
23
23
  /** Options accepted by every error constructor. */
24
24
  interface ExcelErrorOptions {
25
25
  cause?: unknown;
@@ -33,7 +33,7 @@ export declare class ExcelError extends Error {
33
33
  }
34
34
  /** The model or options cannot be written. */
35
35
  export declare class ValidationError extends ExcelError {}
36
- /** The input is not a readable xlsx or zip file. */
36
+ /** The input is not a readable xlsx or zip file, or (readCsv) not text. */
37
37
  export declare class FormatError extends ExcelError {}
38
38
  /** A read limit was exceeded; `details.limit` names it. */
39
39
  export declare class LimitError extends ExcelError {}
@@ -293,5 +293,5 @@ export declare function encodeRange(r: RangeAddress): string;
293
293
  /** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
294
294
  export declare function decodeRange(ref: string): RangeAddress;
295
295
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
296
- export declare const VERSION = "2.3.0";
296
+ export declare const VERSION = "2.5.0";
297
297
  export { type AbortSignalLike, type Alignment, type AutoWidthOptions, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellAddress, type CellErrorValue, type CellInput, type CellTextOptions, type CellType, type CellValue, type Color, type ColorContext, type ColumnDef, type ColumnProps, type ColumnTotal, type ColumnWidth, type Dataset, type DatasetBlock, type DatasetOptions, type DatasetResult, type DateOptions, type DefinedName, type DocProperties, type DroppedWarnings, type ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, type ExcelPartKind, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type GroupColumn, type Hyperlink, type LeafColumn, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RangeAddress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetNameProblem, type SheetView, type Style, type Theme, type ToDatasetOptions, type Workbook, type WriteOptions, XLSX_MIME, isDataLossWarning, toBlob, toUint8Array };
package/dist/index.d.ts CHANGED
@@ -8,8 +8,8 @@
8
8
  * @module javascript-excel
9
9
  */
10
10
  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";
11
- import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-BaMv1Z7W.js";
12
- 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";
11
+ import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-BylKqAmD.js";
12
+ 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";
13
13
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
14
14
  import { t as AutoWidthOptions } from "./auto-width-CT-BihTW.js";
15
15
  /**
@@ -19,7 +19,7 @@ import { t as AutoWidthOptions } from "./auto-width-CT-BihTW.js";
19
19
  * app ends up with both the ESM and the CJS build, each has its own classes.
20
20
  */
21
21
  /** Every error code the library throws. */
22
- type ExcelErrorCode = "NO_SHEETS" | "INVALID_SHEET_NAME" | "DUPLICATE_SHEET_NAME" | "INVALID_ACTIVE_SHEET" | "INVALID_REF" | "OUT_OF_BOUNDS" | "INVALID_CELL" | "INVALID_NUMBER" | "INVALID_DATE" | "STRING_TOO_LONG" | "INVALID_STYLE" | "INVALID_NUMFMT" | "INVALID_HYPERLINK" | "OVERLAPPING_MERGE" | "INVALID_COLUMN" | "TOO_MANY_STYLES" | "ZIP64_REQUIRED" | "INVALID_PROPERTY" | "INVALID_SHEET_PROPERTY" | "INVALID_DEFINED_NAME" | "SHEET_NOT_FOUND" | "VALIDATION_FAILED" | "UNSUPPORTED_FORMAT" | "NOT_XLSX" | "ZIP_INVALID" | "ZIP_UNSUPPORTED_METHOD" | "ZIP_ENCRYPTED" | "ZIP_CRC_MISMATCH" | "XML_MALFORMED" | "XML_DTD_FORBIDDEN" | "LIMIT_EXCEEDED" | "CSV_MALFORMED" | "ENVIRONMENT_UNSUPPORTED";
22
+ type ExcelErrorCode = "NO_SHEETS" | "INVALID_SHEET_NAME" | "DUPLICATE_SHEET_NAME" | "INVALID_ACTIVE_SHEET" | "INVALID_REF" | "OUT_OF_BOUNDS" | "INVALID_CELL" | "INVALID_NUMBER" | "INVALID_DATE" | "STRING_TOO_LONG" | "INVALID_STYLE" | "INVALID_NUMFMT" | "INVALID_HYPERLINK" | "OVERLAPPING_MERGE" | "INVALID_COLUMN" | "TOO_MANY_STYLES" | "ZIP64_REQUIRED" | "INVALID_PROPERTY" | "INVALID_SHEET_PROPERTY" | "INVALID_DEFINED_NAME" | "SHEET_NOT_FOUND" | "VALIDATION_FAILED" | "UNSUPPORTED_FORMAT" | "NOT_XLSX" | "ZIP_INVALID" | "ZIP_UNSUPPORTED_METHOD" | "ZIP_ENCRYPTED" | "ZIP_CRC_MISMATCH" | "XML_MALFORMED" | "XML_DTD_FORBIDDEN" | "CSV_BINARY_INPUT" | "CSV_INVALID_ENCODING" | "LIMIT_EXCEEDED" | "CSV_MALFORMED" | "ENVIRONMENT_UNSUPPORTED";
23
23
  /** Options accepted by every error constructor. */
24
24
  interface ExcelErrorOptions {
25
25
  cause?: unknown;
@@ -33,7 +33,7 @@ export declare class ExcelError extends Error {
33
33
  }
34
34
  /** The model or options cannot be written. */
35
35
  export declare class ValidationError extends ExcelError {}
36
- /** The input is not a readable xlsx or zip file. */
36
+ /** The input is not a readable xlsx or zip file, or (readCsv) not text. */
37
37
  export declare class FormatError extends ExcelError {}
38
38
  /** A read limit was exceeded; `details.limit` names it. */
39
39
  export declare class LimitError extends ExcelError {}
@@ -293,5 +293,5 @@ export declare function encodeRange(r: RangeAddress): string;
293
293
  /** 'A1:C3' or 'A1' → range, normalised so start is top-left. */
294
294
  export declare function decodeRange(ref: string): RangeAddress;
295
295
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
296
- export declare const VERSION = "2.3.0";
296
+ export declare const VERSION = "2.5.0";
297
297
  export { type AbortSignalLike, type Alignment, type AutoWidthOptions, type BinaryInput, type BlobLike, type BlobType, type Border, type BorderSide, type BorderStyle, type Cell, type CellAddress, type CellErrorValue, type CellInput, type CellTextOptions, type CellType, type CellValue, type Color, type ColorContext, type ColumnDef, type ColumnProps, type ColumnTotal, type ColumnWidth, type Dataset, type DatasetBlock, type DatasetOptions, type DatasetResult, type DateOptions, type DefinedName, type DocProperties, type DroppedWarnings, type ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, type ExcelPartKind, type ExcelWarning, type ExcelWarningCode, type Fill, type Font, type GradientFill, type GroupColumn, type Hyperlink, type LeafColumn, type NumFmt, type PatternFill, type PatternType, type PrintSetup, type Progress, type RangeAddress, type RichText, type RichTextRun, type RowProps, type Sheet, type SheetNameProblem, type SheetView, type Style, type Theme, type ToDatasetOptions, type Workbook, type WriteOptions, XLSX_MIME, isDataLossWarning, toBlob, toUint8Array };
package/dist/index.js CHANGED
@@ -1,14 +1,14 @@
1
- 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";
2
- import { n as toBlob, r as toUint8Array, t as XLSX_MIME } from "./write-BVXB2_2C.js";
1
+ 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";
2
+ import { n as toBlob, r as toUint8Array, t as XLSX_MIME } from "./write-DFz-h8gz.js";
3
3
  import { t as isDataLossWarning } from "./warnings-BPz1Ia3s.js";
4
- import { n as serialToDate, t as dateToSerial } from "./dates-BXcSWf9_.js";
5
- import { m as mergeStyles, n as validateSheetName, t as sanitizeSheetName } from "./sheet-names-BLrwcn33.js";
4
+ import { n as serialToDate, t as dateToSerial } from "./dates-CIL1z9EY.js";
5
+ import { m as mergeStyles, n as validateSheetName, t as sanitizeSheetName } from "./sheet-names-RoFkpk_R.js";
6
6
  import { t as resolveColor } from "./colors-B8Nf_xTx.js";
7
7
  import { t as cellText } from "./cells-CrMF8h_t.js";
8
- import { n as fromDatasets, r as toDataset, t as fromDataset } from "./dataset-BLo9CwB-.js";
8
+ import { n as fromDatasets, r as toDataset, t as fromDataset } from "./dataset-Dh598YSG.js";
9
9
  import { n as isDateFormat, t as BUILTIN_NUM_FMTS } from "./numfmt-Ci_oW11p.js";
10
- import { a as decodeRange, c as encodeRange, 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";
10
+ import { a as decodeRange, c as encodeRange, i as decodeCol, n as MAX_ROWS, o as encodeCell, r as decodeCell, s as encodeCol, t as MAX_COLS } from "./address-BGH42dEg.js";
11
11
  // src/index.ts
12
12
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
13
- const VERSION = "2.3.0";
13
+ const VERSION = "2.5.0";
14
14
  export { BUILTIN_NUM_FMTS, CsvError, EnvironmentError, ExcelError, FormatError, LimitError, MAX_COLS, MAX_ROWS, VERSION, ValidationError, XLSX_MIME, cellText, dateToSerial, decodeCell, decodeCol, decodeRange, encodeCell, encodeCol, encodeRange, fromDataset, fromDatasets, isDataLossWarning, isDateFormat, isExcelError, mergeStyles, resolveColor, sanitizeSheetName, serialToDate, toBlob, toDataset, toUint8Array, validateSheetName };
@@ -1,5 +1,20 @@
1
+ const require_errors = require("./errors-CKYdpCoB.cjs");
1
2
  const require_warnings = require("./warnings-CJPiDqei.cjs");
2
3
  // src/internal/input.ts
4
+ /** The maxInputBytes error, as the zip reader words it (JSE-73). */
5
+ function inputTooLarge(value, max) {
6
+ return new require_errors.LimitError("LIMIT_EXCEEDED", `Input size exceeds the maxInputBytes limit (${max}).`, { details: {
7
+ limit: "maxInputBytes",
8
+ value,
9
+ max
10
+ } });
11
+ }
12
+ /** A Blob (anything with a numeric `size` that is not a buffer) larger than `max` is refused before it is read. */
13
+ function checkBlobSize(input, max) {
14
+ if (input instanceof ArrayBuffer || ArrayBuffer.isView(input) || typeof input !== "object" || input === null) return;
15
+ const size = input.size;
16
+ if (typeof size === "number" && size > max) throw inputTooLarge(size, max);
17
+ }
3
18
  /** Uint8Array (Node Buffer included), ArrayBuffer, any ArrayBufferView, or a Blob -> Uint8Array. */
4
19
  async function toBytes(input, fn, also = "") {
5
20
  if (input instanceof Uint8Array) return input;
@@ -144,6 +159,12 @@ Object.defineProperty(exports, "WarningCap", {
144
159
  return WarningCap;
145
160
  }
146
161
  });
162
+ Object.defineProperty(exports, "checkBlobSize", {
163
+ enumerable: true,
164
+ get: function() {
165
+ return checkBlobSize;
166
+ }
167
+ });
147
168
  Object.defineProperty(exports, "checkMaxWarnings", {
148
169
  enumerable: true,
149
170
  get: function() {
@@ -156,6 +177,12 @@ Object.defineProperty(exports, "inferValue", {
156
177
  return inferValue;
157
178
  }
158
179
  });
180
+ Object.defineProperty(exports, "inputTooLarge", {
181
+ enumerable: true,
182
+ get: function() {
183
+ return inputTooLarge;
184
+ }
185
+ });
159
186
  Object.defineProperty(exports, "parseIsoDate", {
160
187
  enumerable: true,
161
188
  get: function() {
@@ -1,5 +1,20 @@
1
+ import { a as LimitError } from "./errors-BQE62PFo.js";
1
2
  import { t as isDataLossWarning } from "./warnings-BPz1Ia3s.js";
2
3
  // src/internal/input.ts
4
+ /** The maxInputBytes error, as the zip reader words it (JSE-73). */
5
+ function inputTooLarge(value, max) {
6
+ return new LimitError("LIMIT_EXCEEDED", `Input size exceeds the maxInputBytes limit (${max}).`, { details: {
7
+ limit: "maxInputBytes",
8
+ value,
9
+ max
10
+ } });
11
+ }
12
+ /** A Blob (anything with a numeric `size` that is not a buffer) larger than `max` is refused before it is read. */
13
+ function checkBlobSize(input, max) {
14
+ if (input instanceof ArrayBuffer || ArrayBuffer.isView(input) || typeof input !== "object" || input === null) return;
15
+ const size = input.size;
16
+ if (typeof size === "number" && size > max) throw inputTooLarge(size, max);
17
+ }
3
18
  /** Uint8Array (Node Buffer included), ArrayBuffer, any ArrayBufferView, or a Blob -> Uint8Array. */
4
19
  async function toBytes(input, fn, also = "") {
5
20
  if (input instanceof Uint8Array) return input;
@@ -138,4 +153,4 @@ function daysInMonth(y, m) {
138
153
  if (m === 2) return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0 ? 29 : 28;
139
154
  return m === 4 || m === 6 || m === 9 || m === 11 ? 30 : 31;
140
155
  }
141
- export { toBytes as a, checkMaxWarnings as i, parseIsoDate as n, WarningCap as r, inferValue as t };
156
+ export { checkBlobSize as a, checkMaxWarnings as i, parseIsoDate as n, inputTooLarge as o, WarningCap as r, toBytes as s, inferValue as t };
@@ -1,9 +1,9 @@
1
- import { r as readCsv } from "./csv-Bck8eW_D.js";
2
- import { i as toDatasetDetailed } from "./dataset-BLo9CwB-.js";
3
- import { a as LimitError, i as FormatError, o as ValidationError } from "./errors-CvGlfw0E.js";
4
- import { a as excerpt, i as readSheetNames, n as detectFormat, o as quoted, r as read } from "./read-BnXzPjGc.js";
5
- import { a as toBytes, i as checkMaxWarnings, n as parseIsoDate } from "./infer-DcUyZ1T-.js";
6
- import { a as decodeRange } from "./address-DUn7-5OS.js";
1
+ import { r as readCsv } from "./csv-5jVhfM5l.js";
2
+ import { i as toDatasetDetailed } from "./dataset-Dh598YSG.js";
3
+ import { a as LimitError, i as FormatError, o as ValidationError } from "./errors-BQE62PFo.js";
4
+ import { a as readSheetNames, c as quoted, l as DEFAULT_LIMITS, n as detectFormat, o as readImpl, s as excerpt } from "./read-B6tY0ooT.js";
5
+ import { a as checkBlobSize, i as checkMaxWarnings, n as parseIsoDate, s as toBytes } from "./infer-DuSahY5i.js";
6
+ import { a as decodeRange } from "./address-BGH42dEg.js";
7
7
  import { t as isoDate } from "./iso-date-CXnn-9mT.js";
8
8
  // src/internal/import/parse.ts
9
9
  /**
@@ -612,6 +612,20 @@ function startOfDay(d, zone) {
612
612
  function isExcelDayZero(d, zone) {
613
613
  return zone === "utc" ? d.getUTCFullYear() === 1899 && d.getUTCMonth() === 11 && d.getUTCDate() === 31 : d.getFullYear() === 1899 && d.getMonth() === 11 && d.getDate() === 31;
614
614
  }
615
+ /**
616
+ * For 'day' (JSE-69): ISO text with an explicit offset or `Z` names its day in
617
+ * its date part, so that day, at 00:00 in `zone`; the offset does not move it.
618
+ * Undefined for anything else, including text the ISO parser refuses (an
619
+ * invalid date, time or offset), which then goes the usual way.
620
+ */
621
+ function isoDayAsWritten(text, zone) {
622
+ const s = text.trim();
623
+ if (s.length <= 16 || s.charCodeAt(4) !== 45 || parseIsoDate(s, zone) === void 0) return void 0;
624
+ for (let i = 11; i < s.length; i++) {
625
+ const c = s.charCodeAt(i);
626
+ if (c === 90 || c === 43 || c === 45) return parseIsoDate(s.slice(0, 10), zone);
627
+ }
628
+ }
615
629
  function textOf(v) {
616
630
  if (typeof v === "string") return v;
617
631
  if (v && typeof v === "object" && "richText" in v) return v.richText.map((r) => r.text).join("");
@@ -825,8 +839,11 @@ function convert(v, col, locale, zone) {
825
839
  let d;
826
840
  if (v instanceof Date) d = v;
827
841
  else if (t !== void 0) {
828
- const order = col.dateOrder ?? (locale.dateOrder && locale.dateOrder !== "auto" ? locale.dateOrder : void 0);
829
- d = order ? textToDate(t, order, zone, locale.twoDigitYearPivot) : parseDate(t, { zone });
842
+ if (col.type === "day") d = isoDayAsWritten(t, zone);
843
+ if (d === void 0) {
844
+ const order = col.dateOrder ?? (locale.dateOrder && locale.dateOrder !== "auto" ? locale.dateOrder : void 0);
845
+ d = order ? textToDate(t, order, zone, locale.twoDigitYearPivot) : parseDate(t, { zone });
846
+ }
830
847
  }
831
848
  if (d === void 0) return { ok: false };
832
849
  if (col.type !== "day") return {
@@ -1006,6 +1023,10 @@ async function importDataset(input, options = {}) {
1006
1023
  if (o.maxIssues !== Number.POSITIVE_INFINITY) checkCount("maxIssues", o.maxIssues, 1);
1007
1024
  const maxText = o.limits?.maxCellTextLength;
1008
1025
  if (maxText !== void 0 && (typeof maxText !== "number" || !(maxText > 0))) throw new TypeError("limits.maxCellTextLength must be a positive number");
1026
+ const maxInputBytes = o.limits?.maxInputBytes;
1027
+ if (maxInputBytes !== void 0 && (typeof maxInputBytes !== "number" || !(maxInputBytes > 0))) throw new TypeError("limits.maxInputBytes must be a positive number");
1028
+ const maxColumns = o.limits?.maxColumns;
1029
+ if (maxColumns !== void 0 && (typeof maxColumns !== "number" || !(maxColumns > 0))) throw new TypeError("limits.maxColumns must be a positive number");
1009
1030
  if (typeof o.header === "object" && o.header !== null) {
1010
1031
  checkCount("header.rows", o.header.rows, 1);
1011
1032
  checkCount("header.row", o.header.row, 0);
@@ -1032,6 +1053,7 @@ async function importDataset(input, options = {}) {
1032
1053
  let format;
1033
1054
  if (typeof input === "string") format = "csv";
1034
1055
  else {
1056
+ if (maxInputBytes !== void 0) checkBlobSize(input, maxInputBytes);
1035
1057
  bytes = await toBytes(input, "importDataset", "a string, ");
1036
1058
  if (o.format === "csv") format = "csv";
1037
1059
  else if (o.format === "xlsx") format = "xlsx";
@@ -1056,9 +1078,12 @@ async function importDataset(input, options = {}) {
1056
1078
  delimiter: o.delimiter ?? "auto",
1057
1079
  delimiterCandidates: o.delimiterCandidates,
1058
1080
  encoding: o.encoding,
1081
+ rejectBinary: o.rejectBinary,
1082
+ maxInputBytes,
1059
1083
  maxRows: cap,
1060
1084
  maxWarnings: o.limits?.maxWarnings,
1061
1085
  maxCellTextLength: maxText,
1086
+ maxColumns,
1062
1087
  maxFieldBytes: maxText !== void 0 && maxText > 1048576 ? 3 * maxText : void 0,
1063
1088
  signal: o.signal,
1064
1089
  inferTypes: false
@@ -1073,7 +1098,7 @@ async function importDataset(input, options = {}) {
1073
1098
  };
1074
1099
  meta.delimiter = r.delimiter;
1075
1100
  meta.bom = r.bom;
1076
- if (bytes) meta.encoding = bomEncoding(bytes) ?? (o.encoding ?? "utf-8").toLowerCase();
1101
+ if (bytes) meta.encoding = o.encoding === "auto" ? r.encoding : bomEncoding(bytes) ?? (o.encoding ?? "utf-8").toLowerCase();
1077
1102
  } else {
1078
1103
  const sheets = await readSheetNames(bytes, {
1079
1104
  limits: o.limits,
@@ -1085,7 +1110,7 @@ async function importDataset(input, options = {}) {
1085
1110
  sheet: want,
1086
1111
  sheets: sheets.map((s) => s.name)
1087
1112
  } });
1088
- const { workbook } = await read(bytes, {
1113
+ const { workbook } = await readImpl(bytes, {
1089
1114
  sheets: [info.index],
1090
1115
  styles: false,
1091
1116
  richText: "plain",
@@ -1100,7 +1125,7 @@ async function importDataset(input, options = {}) {
1100
1125
  if (w.code === "ROWS_TRUNCATED") truncatedRead = true;
1101
1126
  warn(w);
1102
1127
  }
1103
- });
1128
+ }, { sharedFormulaText: "master" });
1104
1129
  sheet = workbook.sheets[info.index];
1105
1130
  meta.sheet = {
1106
1131
  name: info.name,
@@ -1139,13 +1164,15 @@ async function importDataset(input, options = {}) {
1139
1164
  headerRows = Array.from({ length: header.rows }, (_, i) => start + i);
1140
1165
  join = header.join;
1141
1166
  }
1167
+ const maxCells = o.limits?.maxCells;
1168
+ if (maxCells !== void 0 && (typeof maxCells !== "number" || !(maxCells > 0))) throw new TypeError("limits.maxCells must be a positive number");
1142
1169
  const ds = toDatasetDetailed(sheet, {
1143
1170
  headerRow: headerRows.length ? headerRows[0] : false,
1144
1171
  headerRows: Math.max(1, headerRows.length),
1145
1172
  join,
1146
1173
  range: o.range,
1147
1174
  skipTotals: o.skipTotals ?? "auto"
1148
- });
1175
+ }, { maxCells: maxCells ?? DEFAULT_LIMITS.maxCells });
1149
1176
  const issueCap = new IssueCap(o.maxIssues ?? 1e5);
1150
1177
  const issues = issueCap.issues;
1151
1178
  const base = {