javascript-excel 2.0.0-beta.1 → 2.1.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 (51) hide show
  1. package/README.md +11 -3
  2. package/dist/{auto-width-DRHsPKNk.d.cts → auto-width-DZvQSucm.d.cts} +1 -1
  3. package/dist/{csv-pXfaputs.js → csv-CrWF7JS1.js} +57 -13
  4. package/dist/{csv-DyVH9y7S.cjs → csv-DzGOFyHs.cjs} +57 -13
  5. package/dist/csv.cjs +3 -1
  6. package/dist/csv.d.cts +23 -5
  7. package/dist/csv.d.ts +23 -5
  8. package/dist/csv.js +3 -1
  9. package/dist/dom.cjs +2 -0
  10. package/dist/dom.d.cts +4 -4
  11. package/dist/dom.d.ts +3 -3
  12. package/dist/dom.js +2 -1
  13. package/dist/format.d.cts +1 -1
  14. package/dist/format.d.ts +1 -1
  15. package/dist/import.cjs +3 -1
  16. package/dist/import.d.cts +3 -3
  17. package/dist/import.d.ts +3 -3
  18. package/dist/import.js +3 -1
  19. package/dist/index.cjs +3 -1
  20. package/dist/index.d.cts +6 -6
  21. package/dist/index.d.ts +5 -5
  22. package/dist/index.js +3 -2
  23. package/dist/{infer-D9EC9vJ-.cjs → infer-BniOucP6.cjs} +65 -0
  24. package/dist/{infer-BR-J9BZa.js → infer-DcUyZ1T-.js} +54 -1
  25. package/dist/{model-0JikLfuM.d.cts → model-BUNp7B0Z.d.cts} +6 -0
  26. package/dist/{model-0JikLfuM.d.ts → model-BUNp7B0Z.d.ts} +6 -0
  27. package/dist/{pipeline-BuG_nn_S.d.ts → pipeline-6PmlmH1-.d.ts} +5 -2
  28. package/dist/{pipeline-DM7n0aRI.d.cts → pipeline-C63qD7Ym.d.cts} +5 -2
  29. package/dist/{pipeline-2dw9aehe.js → pipeline-CMealW1i.js} +6 -3
  30. package/dist/{pipeline-DMskqxiU.cjs → pipeline-Dc15gn1t.cjs} +6 -3
  31. package/dist/{read-ClszMDAE.js → read-CFQ09LlL.js} +253 -70
  32. package/dist/{read-ByceXfiL.cjs → read-DYDDLxUE.cjs} +253 -70
  33. package/dist/read.cjs +3 -1
  34. package/dist/read.d.cts +34 -6
  35. package/dist/read.d.ts +34 -6
  36. package/dist/read.js +3 -1
  37. package/dist/render.d.cts +1 -1
  38. package/dist/render.d.ts +1 -1
  39. package/dist/warnings-BPz1Ia3s.js +42 -0
  40. package/dist/warnings-CJPiDqei.cjs +47 -0
  41. package/dist/warnings-DhonqJ7A.d.cts +79 -0
  42. package/dist/warnings-DhonqJ7A.d.ts +79 -0
  43. package/dist/worker.cjs +3 -3
  44. package/dist/worker.d.cts +4 -4
  45. package/dist/worker.d.ts +4 -4
  46. package/dist/worker.js +3 -3
  47. package/dist/{write-DM6ieuQY.d.ts → write-BaMv1Z7W.d.ts} +2 -2
  48. package/dist/{write-DtjfdIFm.d.cts → write-Izl2NG0Y.d.cts} +2 -2
  49. package/package.json +1 -1
  50. package/dist/warnings-B1v58nCZ.d.cts +0 -41
  51. package/dist/warnings-B1v58nCZ.d.ts +0 -41
package/dist/index.cjs CHANGED
@@ -1,6 +1,7 @@
1
1
  Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
2
2
  const require_errors = require("./errors-DOPrrGS4.cjs");
3
3
  const require_write = require("./write-DKXhuvKR.cjs");
4
+ const require_warnings = require("./warnings-CJPiDqei.cjs");
4
5
  const require_dates = require("./dates-CA1dCizp.cjs");
5
6
  const require_sheet_names = require("./sheet-names-DDY64-dt.cjs");
6
7
  const require_colors = require("./colors-oBpjx97l.cjs");
@@ -10,7 +11,7 @@ const require_numfmt = require("./numfmt-DwsnhZKe.cjs");
10
11
  const require_address = require("./address-DZBHchLv.cjs");
11
12
  // src/index.ts
12
13
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
13
- const VERSION = "2.0.0-beta.1";
14
+ const VERSION = "2.1.0";
14
15
  exports.BUILTIN_NUM_FMTS = require_numfmt.BUILTIN_NUM_FMTS;
15
16
  exports.CsvError = require_errors.CsvError;
16
17
  exports.EnvironmentError = require_errors.EnvironmentError;
@@ -32,6 +33,7 @@ exports.encodeCol = require_address.encodeCol;
32
33
  exports.encodeRange = require_address.encodeRange;
33
34
  exports.fromDataset = require_dataset.fromDataset;
34
35
  exports.fromDatasets = require_dataset.fromDatasets;
36
+ exports.isDataLossWarning = require_warnings.isDataLossWarning;
35
37
  exports.isDateFormat = require_numfmt.isDateFormat;
36
38
  exports.isExcelError = require_errors.isExcelError;
37
39
  exports.mergeStyles = require_sheet_names.mergeStyles;
package/dist/index.d.cts CHANGED
@@ -7,11 +7,11 @@
7
7
  *
8
8
  * @module javascript-excel
9
9
  */
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-0JikLfuM.cjs";
11
- import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-DtjfdIFm.cjs";
12
- import { a as BlobType, i as BlobLike, n as ExcelWarningCode, r as BinaryInput, t as ExcelWarning } from "./warnings-B1v58nCZ.cjs";
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";
13
13
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
14
- import { t as AutoWidthOptions } from "./auto-width-DRHsPKNk.cjs";
14
+ import { t as AutoWidthOptions } from "./auto-width-DZvQSucm.cjs";
15
15
  /**
16
16
  * Typed errors (docs/api.md §7).
17
17
  *
@@ -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.0.0-beta.1";
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 ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, 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, toBlob, toUint8Array };
296
+ export declare const VERSION = "2.1.0";
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
@@ -7,9 +7,9 @@
7
7
  *
8
8
  * @module javascript-excel
9
9
  */
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-0JikLfuM.js";
11
- import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-DM6ieuQY.js";
12
- import { a as BlobType, i as BlobLike, n as ExcelWarningCode, r as BinaryInput, t as ExcelWarning } from "./warnings-B1v58nCZ.js";
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";
13
13
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
14
14
  import { t as AutoWidthOptions } from "./auto-width-CT-BihTW.js";
15
15
  /**
@@ -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.0.0-beta.1";
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 ErrorCode, type ExcelErrorCode, type ExcelErrorOptions, 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, toBlob, toUint8Array };
296
+ export declare const VERSION = "2.1.0";
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,5 +1,6 @@
1
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
2
  import { n as toBlob, r as toUint8Array, t as XLSX_MIME } from "./write-BVXB2_2C.js";
3
+ import { t as isDataLossWarning } from "./warnings-BPz1Ia3s.js";
3
4
  import { n as serialToDate, t as dateToSerial } from "./dates-BXcSWf9_.js";
4
5
  import { m as mergeStyles, n as validateSheetName, t as sanitizeSheetName } from "./sheet-names-BLrwcn33.js";
5
6
  import { t as resolveColor } from "./colors-B8Nf_xTx.js";
@@ -9,5 +10,5 @@ import { n as isDateFormat, t as BUILTIN_NUM_FMTS } from "./numfmt-Ci_oW11p.js";
9
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
11
  // src/index.ts
11
12
  /** Package version. Set from package.json by `npm run version-packages` (scripts/sync-version.mjs); a unit test checks it. */
12
- const VERSION = "2.0.0-beta.1";
13
- 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, isDateFormat, isExcelError, mergeStyles, resolveColor, sanitizeSheetName, serialToDate, toBlob, toDataset, toUint8Array, validateSheetName };
13
+ const VERSION = "2.1.0";
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,3 +1,4 @@
1
+ const require_warnings = require("./warnings-CJPiDqei.cjs");
1
2
  // src/internal/input.ts
2
3
  /** Uint8Array (Node Buffer included), ArrayBuffer, any ArrayBufferView, or a Blob -> Uint8Array. */
3
4
  async function toBytes(input, fn, also = "") {
@@ -10,6 +11,58 @@ async function toBytes(input, fn, also = "") {
10
11
  }
11
12
  throw new TypeError(`${fn}: input must be ${also}a Uint8Array, ArrayBuffer or Blob`);
12
13
  }
14
+ // src/internal/warning-cap.ts
15
+ /**
16
+ * The warning cap shared by the xlsx reader and the CSV parser (docs/api.md
17
+ * §7.3). Internal.
18
+ *
19
+ * Until `max` warnings are kept, every warning is kept, as in 2.0.0. After
20
+ * that, informational warnings are dropped, and a data-loss warning is still
21
+ * kept while fewer than DATA_LOSS_PER_CODE of its code have been kept since
22
+ * the start. So the list stays bounded (at most `max`, plus one
23
+ * WARNINGS_TRUNCATED, plus DATA_LOSS_PER_CODE per data-loss code), and every
24
+ * kind of data loss that occurred is in it.
25
+ */
26
+ var WarningCap = class {
27
+ max;
28
+ warnings = [];
29
+ /** Null until the first drop. */
30
+ dropped = null;
31
+ full = false;
32
+ kept = /* @__PURE__ */ new Map();
33
+ constructor(max) {
34
+ this.max = max;
35
+ }
36
+ /**
37
+ * Keeps or counts `w`. Returns true when it was kept; `firstDrop` is called
38
+ * once, at the first warning that is not.
39
+ */
40
+ add(w, firstDrop) {
41
+ const loss = require_warnings.isDataLossWarning(w.code);
42
+ if (!this.full && this.warnings.length >= this.max) this.full = true;
43
+ const n = loss ? this.kept.get(w.code) ?? 0 : 0;
44
+ if (this.full && (!loss || n >= 100)) {
45
+ const first = this.dropped === null;
46
+ const d = this.dropped ??= {
47
+ total: 0,
48
+ dataLoss: 0,
49
+ byCode: {}
50
+ };
51
+ d.total++;
52
+ if (loss) d.dataLoss++;
53
+ d.byCode[w.code] = (d.byCode[w.code] ?? 0) + 1;
54
+ if (first) firstDrop?.(d);
55
+ return false;
56
+ }
57
+ if (loss) this.kept.set(w.code, n + 1);
58
+ this.warnings.push(w);
59
+ return true;
60
+ }
61
+ };
62
+ /** Validates a `maxWarnings` value as `read` does for `limits.maxWarnings`. */
63
+ function checkMaxWarnings(name, v) {
64
+ if (typeof v !== "number" || !(v > 0)) throw new TypeError(`${name} must be a positive number`);
65
+ }
13
66
  // src/internal/csv/infer.ts
14
67
  const NUMBER = /^[+-]?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
15
68
  const FRACTION = /^[+-]?\.\d+(?:[eE][+-]?\d+)?$/;
@@ -85,6 +138,18 @@ function daysInMonth(y, m) {
85
138
  if (m === 2) return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0 ? 29 : 28;
86
139
  return m === 4 || m === 6 || m === 9 || m === 11 ? 30 : 31;
87
140
  }
141
+ Object.defineProperty(exports, "WarningCap", {
142
+ enumerable: true,
143
+ get: function() {
144
+ return WarningCap;
145
+ }
146
+ });
147
+ Object.defineProperty(exports, "checkMaxWarnings", {
148
+ enumerable: true,
149
+ get: function() {
150
+ return checkMaxWarnings;
151
+ }
152
+ });
88
153
  Object.defineProperty(exports, "inferValue", {
89
154
  enumerable: true,
90
155
  get: function() {
@@ -1,3 +1,4 @@
1
+ import { t as isDataLossWarning } from "./warnings-BPz1Ia3s.js";
1
2
  // src/internal/input.ts
2
3
  /** Uint8Array (Node Buffer included), ArrayBuffer, any ArrayBufferView, or a Blob -> Uint8Array. */
3
4
  async function toBytes(input, fn, also = "") {
@@ -10,6 +11,58 @@ async function toBytes(input, fn, also = "") {
10
11
  }
11
12
  throw new TypeError(`${fn}: input must be ${also}a Uint8Array, ArrayBuffer or Blob`);
12
13
  }
14
+ // src/internal/warning-cap.ts
15
+ /**
16
+ * The warning cap shared by the xlsx reader and the CSV parser (docs/api.md
17
+ * §7.3). Internal.
18
+ *
19
+ * Until `max` warnings are kept, every warning is kept, as in 2.0.0. After
20
+ * that, informational warnings are dropped, and a data-loss warning is still
21
+ * kept while fewer than DATA_LOSS_PER_CODE of its code have been kept since
22
+ * the start. So the list stays bounded (at most `max`, plus one
23
+ * WARNINGS_TRUNCATED, plus DATA_LOSS_PER_CODE per data-loss code), and every
24
+ * kind of data loss that occurred is in it.
25
+ */
26
+ var WarningCap = class {
27
+ max;
28
+ warnings = [];
29
+ /** Null until the first drop. */
30
+ dropped = null;
31
+ full = false;
32
+ kept = /* @__PURE__ */ new Map();
33
+ constructor(max) {
34
+ this.max = max;
35
+ }
36
+ /**
37
+ * Keeps or counts `w`. Returns true when it was kept; `firstDrop` is called
38
+ * once, at the first warning that is not.
39
+ */
40
+ add(w, firstDrop) {
41
+ const loss = isDataLossWarning(w.code);
42
+ if (!this.full && this.warnings.length >= this.max) this.full = true;
43
+ const n = loss ? this.kept.get(w.code) ?? 0 : 0;
44
+ if (this.full && (!loss || n >= 100)) {
45
+ const first = this.dropped === null;
46
+ const d = this.dropped ??= {
47
+ total: 0,
48
+ dataLoss: 0,
49
+ byCode: {}
50
+ };
51
+ d.total++;
52
+ if (loss) d.dataLoss++;
53
+ d.byCode[w.code] = (d.byCode[w.code] ?? 0) + 1;
54
+ if (first) firstDrop?.(d);
55
+ return false;
56
+ }
57
+ if (loss) this.kept.set(w.code, n + 1);
58
+ this.warnings.push(w);
59
+ return true;
60
+ }
61
+ };
62
+ /** Validates a `maxWarnings` value as `read` does for `limits.maxWarnings`. */
63
+ function checkMaxWarnings(name, v) {
64
+ if (typeof v !== "number" || !(v > 0)) throw new TypeError(`${name} must be a positive number`);
65
+ }
13
66
  // src/internal/csv/infer.ts
14
67
  const NUMBER = /^[+-]?(?:0|[1-9]\d*)(?:\.\d+)?(?:[eE][+-]?\d+)?$/;
15
68
  const FRACTION = /^[+-]?\.\d+(?:[eE][+-]?\d+)?$/;
@@ -85,4 +138,4 @@ function daysInMonth(y, m) {
85
138
  if (m === 2) return y % 4 === 0 && y % 100 !== 0 || y % 400 === 0 ? 29 : 28;
86
139
  return m === 4 || m === 6 || m === 9 || m === 11 ? 30 : 31;
87
140
  }
88
- export { parseIsoDate as n, toBytes as r, inferValue as t };
141
+ export { toBytes as a, checkMaxWarnings as i, parseIsoDate as n, WarningCap as r, inferValue as t };
@@ -222,6 +222,12 @@ interface Cell {
222
222
  * Writer: optional. If set, it must match `value` (`INVALID_CELL` otherwise). It is a check, not a coercion.
223
223
  */
224
224
  type?: CellType | undefined;
225
+ /**
226
+ * Reader output with `ReadOptions.rawText` only: the `<v>` text of a number
227
+ * or ISO-date cell exactly as stored in the file, e.g. `'50.30'` for
228
+ * `value` 50.3. Ignored by the writer, which writes `value`.
229
+ */
230
+ rawText?: string | undefined;
225
231
  style?: Style | undefined;
226
232
  hyperlink?: Hyperlink | undefined;
227
233
  }
@@ -222,6 +222,12 @@ interface Cell {
222
222
  * Writer: optional. If set, it must match `value` (`INVALID_CELL` otherwise). It is a check, not a coercion.
223
223
  */
224
224
  type?: CellType | undefined;
225
+ /**
226
+ * Reader output with `ReadOptions.rawText` only: the `<v>` text of a number
227
+ * or ISO-date cell exactly as stored in the file, e.g. `'50.30'` for
228
+ * `value` 50.3. Ignored by the writer, which writes `value`.
229
+ */
230
+ rawText?: string | undefined;
225
231
  style?: Style | undefined;
226
232
  hyperlink?: Hyperlink | undefined;
227
233
  }
@@ -1,7 +1,7 @@
1
- import { r as BinaryInput, t as ExcelWarning } from "./warnings-B1v58nCZ.js";
1
+ import { o as BinaryInput, r as ExcelWarning } from "./warnings-DhonqJ7A.js";
2
2
  import { ReadLimits, SheetInfo } from "./read.js";
3
3
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
4
- import { D as Sheet, s as CellInput } from "./model-0JikLfuM.js";
4
+ import { D as Sheet, s as CellInput } from "./model-BUNp7B0Z.js";
5
5
  type NumberGroup = "," | "." | " " | "'" | "";
6
6
  /**
7
7
  * Parses `text` as a number written with `decimal` and `group` separators.
@@ -141,6 +141,8 @@ interface ImportDatasetOptions {
141
141
  types?: "infer" | "none" | Record<string, ColumnType> | undefined;
142
142
  locale?: ImportLocale | undefined;
143
143
  delimiter?: string | undefined;
144
+ /** CSV: the delimiters `'auto'` chooses from, in order of preference (see `CsvParseOptions`). */
145
+ delimiterCandidates?: readonly string[] | undefined;
144
146
  encoding?: string | undefined;
145
147
  skipTotals?: "auto" | boolean | undefined;
146
148
  errorCells?: "null" | "keep" | undefined;
@@ -150,6 +152,7 @@ interface ImportDatasetOptions {
150
152
  mapping?: ColumnMapping | undefined;
151
153
  maxRows?: number | undefined;
152
154
  preview?: number | undefined;
155
+ /** Reader limits for xlsx; `maxWarnings` also caps the warnings of a CSV file. */
153
156
  limits?: Partial<ReadLimits> | undefined;
154
157
  signal?: AbortSignalLike | undefined;
155
158
  onProgress?: ((p: ImportProgress) => void) | undefined;
@@ -1,7 +1,7 @@
1
- import { r as BinaryInput, t as ExcelWarning } from "./warnings-B1v58nCZ.cjs";
1
+ import { o as BinaryInput, r as ExcelWarning } from "./warnings-DhonqJ7A.cjs";
2
2
  import { ReadLimits, SheetInfo } from "./read.cjs";
3
3
  import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
4
- import { D as Sheet, s as CellInput } from "./model-0JikLfuM.cjs";
4
+ import { D as Sheet, s as CellInput } from "./model-BUNp7B0Z.cjs";
5
5
  type NumberGroup = "," | "." | " " | "'" | "";
6
6
  /**
7
7
  * Parses `text` as a number written with `decimal` and `group` separators.
@@ -141,6 +141,8 @@ interface ImportDatasetOptions {
141
141
  types?: "infer" | "none" | Record<string, ColumnType> | undefined;
142
142
  locale?: ImportLocale | undefined;
143
143
  delimiter?: string | undefined;
144
+ /** CSV: the delimiters `'auto'` chooses from, in order of preference (see `CsvParseOptions`). */
145
+ delimiterCandidates?: readonly string[] | undefined;
144
146
  encoding?: string | undefined;
145
147
  skipTotals?: "auto" | boolean | undefined;
146
148
  errorCells?: "null" | "keep" | undefined;
@@ -150,6 +152,7 @@ interface ImportDatasetOptions {
150
152
  mapping?: ColumnMapping | undefined;
151
153
  maxRows?: number | undefined;
152
154
  preview?: number | undefined;
155
+ /** Reader limits for xlsx; `maxWarnings` also caps the warnings of a CSV file. */
153
156
  limits?: Partial<ReadLimits> | undefined;
154
157
  signal?: AbortSignalLike | undefined;
155
158
  onProgress?: ((p: ImportProgress) => void) | undefined;
@@ -1,8 +1,8 @@
1
- import { r as readCsv } from "./csv-pXfaputs.js";
1
+ import { r as readCsv } from "./csv-CrWF7JS1.js";
2
2
  import { i as toDatasetDetailed } from "./dataset-BLo9CwB-.js";
3
3
  import { a as LimitError, i as FormatError, o as ValidationError } from "./errors-CvGlfw0E.js";
4
- import { i as readSheetNames, n as detectFormat, r as read } from "./read-ClszMDAE.js";
5
- import { n as parseIsoDate, r as toBytes } from "./infer-BR-J9BZa.js";
4
+ import { i as readSheetNames, n as detectFormat, r as read } from "./read-CFQ09LlL.js";
5
+ import { a as toBytes, i as checkMaxWarnings, n as parseIsoDate } from "./infer-DcUyZ1T-.js";
6
6
  import { a as decodeRange } from "./address-DUn7-5OS.js";
7
7
  import { t as isoDate } from "./iso-date-CXnn-9mT.js";
8
8
  // src/internal/import/parse.ts
@@ -874,6 +874,7 @@ async function importDataset(input, options = {}) {
874
874
  "MDY"
875
875
  ]);
876
876
  checkCount("maxRows", o.maxRows, 0);
877
+ if (o.limits?.maxWarnings !== void 0) checkMaxWarnings("limits.maxWarnings", o.limits.maxWarnings);
877
878
  checkCount("preview", o.preview, 0);
878
879
  if (typeof o.header === "object" && o.header !== null) {
879
880
  checkCount("header.rows", o.header.rows, 1);
@@ -923,8 +924,10 @@ async function importDataset(input, options = {}) {
923
924
  if (format === "csv") {
924
925
  const r = await readCsv(typeof input === "string" ? input : bytes, {
925
926
  delimiter: o.delimiter ?? "auto",
927
+ delimiterCandidates: o.delimiterCandidates,
926
928
  encoding: o.encoding,
927
929
  maxRows: cap,
930
+ maxWarnings: o.limits?.maxWarnings,
928
931
  signal: o.signal,
929
932
  inferTypes: false
930
933
  });
@@ -1,8 +1,8 @@
1
- const require_csv = require("./csv-DyVH9y7S.cjs");
1
+ const require_csv = require("./csv-DzGOFyHs.cjs");
2
2
  const require_dataset = require("./dataset-DzoMeOG1.cjs");
3
3
  const require_errors = require("./errors-DOPrrGS4.cjs");
4
- const require_read = require("./read-ByceXfiL.cjs");
5
- const require_infer = require("./infer-D9EC9vJ-.cjs");
4
+ const require_read = require("./read-DYDDLxUE.cjs");
5
+ const require_infer = require("./infer-BniOucP6.cjs");
6
6
  const require_address = require("./address-DZBHchLv.cjs");
7
7
  const require_iso_date = require("./iso-date-3TY1OlGd.cjs");
8
8
  // src/internal/import/parse.ts
@@ -874,6 +874,7 @@ async function importDataset(input, options = {}) {
874
874
  "MDY"
875
875
  ]);
876
876
  checkCount("maxRows", o.maxRows, 0);
877
+ if (o.limits?.maxWarnings !== void 0) require_infer.checkMaxWarnings("limits.maxWarnings", o.limits.maxWarnings);
877
878
  checkCount("preview", o.preview, 0);
878
879
  if (typeof o.header === "object" && o.header !== null) {
879
880
  checkCount("header.rows", o.header.rows, 1);
@@ -923,8 +924,10 @@ async function importDataset(input, options = {}) {
923
924
  if (format === "csv") {
924
925
  const r = await require_csv.readCsv(typeof input === "string" ? input : bytes, {
925
926
  delimiter: o.delimiter ?? "auto",
927
+ delimiterCandidates: o.delimiterCandidates,
926
928
  encoding: o.encoding,
927
929
  maxRows: cap,
930
+ maxWarnings: o.limits?.maxWarnings,
928
931
  signal: o.signal,
929
932
  inferTypes: false
930
933
  });