javascript-excel 2.4.0 → 2.6.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/README.md +4 -2
- package/dist/{address-DUn7-5OS.js → address-BGH42dEg.js} +1 -1
- package/dist/{address-DZBHchLv.cjs → address-DKd_3EGf.cjs} +1 -1
- package/dist/{csv-Dn4MIESx.js → csv-5jVhfM5l.js} +180 -33
- package/dist/{csv-DZ241Y5F.cjs → csv-BkVmMYQq.cjs} +180 -33
- package/dist/csv.cjs +1 -1
- package/dist/csv.d.cts +42 -3
- package/dist/csv.d.ts +42 -3
- package/dist/csv.js +1 -1
- package/dist/{dataset-CbZnEWXu.cjs → dataset-B4-SEdCn.cjs} +4 -4
- package/dist/{dataset-CyEHVht4.js → dataset-Dh598YSG.js} +4 -4
- package/dist/{dates-BXcSWf9_.js → dates-CIL1z9EY.js} +1 -1
- package/dist/{dates-CA1dCizp.cjs → dates-DcdgnJto.cjs} +1 -1
- package/dist/dom.cjs +2 -2
- package/dist/dom.d.cts +1 -1
- package/dist/dom.d.ts +1 -1
- package/dist/dom.js +2 -2
- package/dist/{dos-time-BsH7f0ef.js → dos-time-BEAyK3U8.js} +1 -1
- package/dist/{dos-time-CxEs--rI.cjs → dos-time-BUWyklco.cjs} +1 -1
- package/dist/{errors-CvGlfw0E.js → errors-BQE62PFo.js} +1 -1
- package/dist/{errors-DOPrrGS4.cjs → errors-CKYdpCoB.cjs} +1 -1
- package/dist/format.cjs +1 -1
- package/dist/format.js +1 -1
- package/dist/import.cjs +1 -1
- package/dist/import.d.cts +2 -2
- package/dist/import.d.ts +2 -2
- package/dist/import.js +1 -1
- package/dist/index.cjs +7 -7
- package/dist/index.d.cts +5 -5
- package/dist/index.d.ts +5 -5
- package/dist/index.js +7 -7
- package/dist/{infer-BniOucP6.cjs → infer-B950M3-F.cjs} +27 -0
- package/dist/{infer-DcUyZ1T-.js → infer-DuSahY5i.js} +16 -1
- package/dist/{pipeline-C8F9lecW.js → pipeline-BRzRd5v3.js} +12 -7
- package/dist/{pipeline-BegSPu8X.d.ts → pipeline-BY-SiQWW.d.ts} +7 -3
- package/dist/{pipeline-BwkRpV5Z.cjs → pipeline-C13EIWHJ.cjs} +12 -7
- package/dist/{pipeline-4U7Xnuc1.d.cts → pipeline-C7R86kQg.d.cts} +7 -3
- package/dist/{read-cvxu6O-H.js → read-CrI550TK.js} +2269 -784
- package/dist/{read-DmUPztqh.cjs → read-X1KxggZ7.cjs} +2284 -793
- package/dist/read.cjs +2 -1
- package/dist/read.d.cts +49 -2
- package/dist/read.d.ts +49 -2
- package/dist/read.js +2 -2
- package/dist/render.cjs +2 -2
- package/dist/render.js +2 -2
- package/dist/{sheet-names-DDY64-dt.cjs → sheet-names-D8sYcjSd.cjs} +2 -2
- package/dist/{sheet-names-BLrwcn33.js → sheet-names-RoFkpk_R.js} +2 -2
- package/dist/{warnings-DhonqJ7A.d.ts → warnings-Bphby2c7.d.cts} +28 -2
- package/dist/{warnings-DhonqJ7A.d.cts → warnings-Bphby2c7.d.ts} +28 -2
- package/dist/worker.cjs +5 -5
- package/dist/worker.d.cts +4 -4
- package/dist/worker.d.ts +4 -4
- package/dist/worker.js +5 -5
- package/dist/{write-Izl2NG0Y.d.cts → write-BbV7BlbS.d.cts} +1 -1
- package/dist/{write-DKXhuvKR.cjs → write-Bgl_QfA8.cjs} +5 -5
- package/dist/{write-BVXB2_2C.js → write-DFz-h8gz.js} +5 -5
- package/dist/{write-BaMv1Z7W.d.ts → write-DryxCc2Q.d.ts} +1 -1
- package/package.json +1 -1
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-
|
|
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-
|
|
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-BY-SiQWW.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-Bphby2c7.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-
|
|
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-BRzRd5v3.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-
|
|
3
|
-
const require_write = require("./write-
|
|
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-
|
|
6
|
-
const require_sheet_names = require("./sheet-names-
|
|
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-
|
|
9
|
+
const require_dataset = require("./dataset-B4-SEdCn.cjs");
|
|
10
10
|
const require_numfmt = require("./numfmt-DwsnhZKe.cjs");
|
|
11
|
-
const require_address = require("./address-
|
|
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.
|
|
14
|
+
const VERSION = "2.6.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-
|
|
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-
|
|
11
|
+
import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-BbV7BlbS.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-Bphby2c7.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.
|
|
296
|
+
export declare const VERSION = "2.6.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-
|
|
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-
|
|
11
|
+
import { a as toUint8Array, i as toBlob, n as WriteOptions, r as XLSX_MIME, t as Progress } from "./write-DryxCc2Q.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-Bphby2c7.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.
|
|
296
|
+
export declare const VERSION = "2.6.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-
|
|
2
|
-
import { n as toBlob, r as toUint8Array, t as XLSX_MIME } from "./write-
|
|
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-
|
|
5
|
-
import { m as mergeStyles, n as validateSheetName, t as sanitizeSheetName } from "./sheet-names-
|
|
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-
|
|
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-
|
|
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.
|
|
13
|
+
const VERSION = "2.6.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 {
|
|
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-
|
|
2
|
-
import { i as toDatasetDetailed } from "./dataset-
|
|
3
|
-
import { a as LimitError, i as FormatError, o as ValidationError } from "./errors-
|
|
4
|
-
import { a as
|
|
5
|
-
import { a as
|
|
6
|
-
import { a as decodeRange } from "./address-
|
|
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-CrI550TK.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
|
/**
|
|
@@ -1023,6 +1023,8 @@ async function importDataset(input, options = {}) {
|
|
|
1023
1023
|
if (o.maxIssues !== Number.POSITIVE_INFINITY) checkCount("maxIssues", o.maxIssues, 1);
|
|
1024
1024
|
const maxText = o.limits?.maxCellTextLength;
|
|
1025
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");
|
|
1026
1028
|
const maxColumns = o.limits?.maxColumns;
|
|
1027
1029
|
if (maxColumns !== void 0 && (typeof maxColumns !== "number" || !(maxColumns > 0))) throw new TypeError("limits.maxColumns must be a positive number");
|
|
1028
1030
|
if (typeof o.header === "object" && o.header !== null) {
|
|
@@ -1051,6 +1053,7 @@ async function importDataset(input, options = {}) {
|
|
|
1051
1053
|
let format;
|
|
1052
1054
|
if (typeof input === "string") format = "csv";
|
|
1053
1055
|
else {
|
|
1056
|
+
if (maxInputBytes !== void 0) checkBlobSize(input, maxInputBytes);
|
|
1054
1057
|
bytes = await toBytes(input, "importDataset", "a string, ");
|
|
1055
1058
|
if (o.format === "csv") format = "csv";
|
|
1056
1059
|
else if (o.format === "xlsx") format = "xlsx";
|
|
@@ -1075,6 +1078,8 @@ async function importDataset(input, options = {}) {
|
|
|
1075
1078
|
delimiter: o.delimiter ?? "auto",
|
|
1076
1079
|
delimiterCandidates: o.delimiterCandidates,
|
|
1077
1080
|
encoding: o.encoding,
|
|
1081
|
+
rejectBinary: o.rejectBinary,
|
|
1082
|
+
maxInputBytes,
|
|
1078
1083
|
maxRows: cap,
|
|
1079
1084
|
maxWarnings: o.limits?.maxWarnings,
|
|
1080
1085
|
maxCellTextLength: maxText,
|
|
@@ -1093,7 +1098,7 @@ async function importDataset(input, options = {}) {
|
|
|
1093
1098
|
};
|
|
1094
1099
|
meta.delimiter = r.delimiter;
|
|
1095
1100
|
meta.bom = r.bom;
|
|
1096
|
-
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();
|
|
1097
1102
|
} else {
|
|
1098
1103
|
const sheets = await readSheetNames(bytes, {
|
|
1099
1104
|
limits: o.limits,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as BinaryInput, r as ExcelWarning } from "./warnings-
|
|
1
|
+
import { o as BinaryInput, r as ExcelWarning } from "./warnings-Bphby2c7.js";
|
|
2
2
|
import { ReadLimits, SheetInfo } from "./read.js";
|
|
3
3
|
import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
|
|
4
4
|
import { D as Sheet, s as CellInput } from "./model-BUNp7B0Z.js";
|
|
@@ -161,7 +161,10 @@ interface ImportDatasetOptions {
|
|
|
161
161
|
delimiter?: string | undefined;
|
|
162
162
|
/** CSV: the delimiters `'auto'` chooses from, in order of preference (see `CsvParseOptions`). */
|
|
163
163
|
delimiterCandidates?: readonly string[] | undefined;
|
|
164
|
-
|
|
164
|
+
/** CSV without a BOM: any `TextDecoder` label, or `'auto'` (UTF-8, then Windows-1252; see `CsvReadOptions`). Default `'utf-8'`. */
|
|
165
|
+
encoding?: string | "auto" | undefined;
|
|
166
|
+
/** CSV: refuse text with control characters text files do not contain (`CSV_BINARY_INPUT`; see `CsvReadOptions`). Default false. */
|
|
167
|
+
rejectBinary?: boolean | undefined;
|
|
165
168
|
skipTotals?: "auto" | boolean | undefined;
|
|
166
169
|
errorCells?: "null" | "keep" | undefined;
|
|
167
170
|
dates?: "date" | "serial" | undefined;
|
|
@@ -178,7 +181,8 @@ interface ImportDatasetOptions {
|
|
|
178
181
|
*/
|
|
179
182
|
maxIssues?: number | undefined;
|
|
180
183
|
/**
|
|
181
|
-
* Reader limits for xlsx. For a CSV file, `
|
|
184
|
+
* Reader limits for xlsx. For a CSV file, `maxInputBytes` (when given) limits its bytes,
|
|
185
|
+
* `maxWarnings` caps its warnings,
|
|
182
186
|
* `maxCellTextLength` limits its fields (raising CSV's 1 MiB `maxFieldBytes` to match)
|
|
183
187
|
* and `maxColumns` the fields of one record. For both formats, `maxCells` also bounds
|
|
184
188
|
* the empty fields the dataset pads short rows with (since 2.4; docs/api.md §5.6).
|
|
@@ -1,9 +1,9 @@
|
|
|
1
|
-
const require_csv = require("./csv-
|
|
2
|
-
const require_dataset = require("./dataset-
|
|
3
|
-
const require_errors = require("./errors-
|
|
4
|
-
const require_read = require("./read-
|
|
5
|
-
const require_infer = require("./infer-
|
|
6
|
-
const require_address = require("./address-
|
|
1
|
+
const require_csv = require("./csv-BkVmMYQq.cjs");
|
|
2
|
+
const require_dataset = require("./dataset-B4-SEdCn.cjs");
|
|
3
|
+
const require_errors = require("./errors-CKYdpCoB.cjs");
|
|
4
|
+
const require_read = require("./read-X1KxggZ7.cjs");
|
|
5
|
+
const require_infer = require("./infer-B950M3-F.cjs");
|
|
6
|
+
const require_address = require("./address-DKd_3EGf.cjs");
|
|
7
7
|
const require_iso_date = require("./iso-date-3TY1OlGd.cjs");
|
|
8
8
|
// src/internal/import/parse.ts
|
|
9
9
|
/**
|
|
@@ -1023,6 +1023,8 @@ async function importDataset(input, options = {}) {
|
|
|
1023
1023
|
if (o.maxIssues !== Number.POSITIVE_INFINITY) checkCount("maxIssues", o.maxIssues, 1);
|
|
1024
1024
|
const maxText = o.limits?.maxCellTextLength;
|
|
1025
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");
|
|
1026
1028
|
const maxColumns = o.limits?.maxColumns;
|
|
1027
1029
|
if (maxColumns !== void 0 && (typeof maxColumns !== "number" || !(maxColumns > 0))) throw new TypeError("limits.maxColumns must be a positive number");
|
|
1028
1030
|
if (typeof o.header === "object" && o.header !== null) {
|
|
@@ -1051,6 +1053,7 @@ async function importDataset(input, options = {}) {
|
|
|
1051
1053
|
let format;
|
|
1052
1054
|
if (typeof input === "string") format = "csv";
|
|
1053
1055
|
else {
|
|
1056
|
+
if (maxInputBytes !== void 0) require_infer.checkBlobSize(input, maxInputBytes);
|
|
1054
1057
|
bytes = await require_infer.toBytes(input, "importDataset", "a string, ");
|
|
1055
1058
|
if (o.format === "csv") format = "csv";
|
|
1056
1059
|
else if (o.format === "xlsx") format = "xlsx";
|
|
@@ -1075,6 +1078,8 @@ async function importDataset(input, options = {}) {
|
|
|
1075
1078
|
delimiter: o.delimiter ?? "auto",
|
|
1076
1079
|
delimiterCandidates: o.delimiterCandidates,
|
|
1077
1080
|
encoding: o.encoding,
|
|
1081
|
+
rejectBinary: o.rejectBinary,
|
|
1082
|
+
maxInputBytes,
|
|
1078
1083
|
maxRows: cap,
|
|
1079
1084
|
maxWarnings: o.limits?.maxWarnings,
|
|
1080
1085
|
maxCellTextLength: maxText,
|
|
@@ -1093,7 +1098,7 @@ async function importDataset(input, options = {}) {
|
|
|
1093
1098
|
};
|
|
1094
1099
|
meta.delimiter = r.delimiter;
|
|
1095
1100
|
meta.bom = r.bom;
|
|
1096
|
-
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();
|
|
1097
1102
|
} else {
|
|
1098
1103
|
const sheets = await require_read.readSheetNames(bytes, {
|
|
1099
1104
|
limits: o.limits,
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { o as BinaryInput, r as ExcelWarning } from "./warnings-
|
|
1
|
+
import { o as BinaryInput, r as ExcelWarning } from "./warnings-Bphby2c7.cjs";
|
|
2
2
|
import { ReadLimits, SheetInfo } from "./read.cjs";
|
|
3
3
|
import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
|
|
4
4
|
import { D as Sheet, s as CellInput } from "./model-BUNp7B0Z.cjs";
|
|
@@ -161,7 +161,10 @@ interface ImportDatasetOptions {
|
|
|
161
161
|
delimiter?: string | undefined;
|
|
162
162
|
/** CSV: the delimiters `'auto'` chooses from, in order of preference (see `CsvParseOptions`). */
|
|
163
163
|
delimiterCandidates?: readonly string[] | undefined;
|
|
164
|
-
|
|
164
|
+
/** CSV without a BOM: any `TextDecoder` label, or `'auto'` (UTF-8, then Windows-1252; see `CsvReadOptions`). Default `'utf-8'`. */
|
|
165
|
+
encoding?: string | "auto" | undefined;
|
|
166
|
+
/** CSV: refuse text with control characters text files do not contain (`CSV_BINARY_INPUT`; see `CsvReadOptions`). Default false. */
|
|
167
|
+
rejectBinary?: boolean | undefined;
|
|
165
168
|
skipTotals?: "auto" | boolean | undefined;
|
|
166
169
|
errorCells?: "null" | "keep" | undefined;
|
|
167
170
|
dates?: "date" | "serial" | undefined;
|
|
@@ -178,7 +181,8 @@ interface ImportDatasetOptions {
|
|
|
178
181
|
*/
|
|
179
182
|
maxIssues?: number | undefined;
|
|
180
183
|
/**
|
|
181
|
-
* Reader limits for xlsx. For a CSV file, `
|
|
184
|
+
* Reader limits for xlsx. For a CSV file, `maxInputBytes` (when given) limits its bytes,
|
|
185
|
+
* `maxWarnings` caps its warnings,
|
|
182
186
|
* `maxCellTextLength` limits its fields (raising CSV's 1 MiB `maxFieldBytes` to match)
|
|
183
187
|
* and `maxColumns` the fields of one record. For both formats, `maxCells` also bounds
|
|
184
188
|
* the empty fields the dataset pads short rows with (since 2.4; docs/api.md §5.6).
|