javascript-excel 2.0.0 → 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.
- package/README.md +9 -1
- package/dist/{auto-width-DRHsPKNk.d.cts → auto-width-DZvQSucm.d.cts} +1 -1
- package/dist/{csv-pXfaputs.js → csv-CrWF7JS1.js} +57 -13
- package/dist/{csv-DyVH9y7S.cjs → csv-DzGOFyHs.cjs} +57 -13
- package/dist/csv.cjs +3 -1
- package/dist/csv.d.cts +23 -5
- package/dist/csv.d.ts +23 -5
- package/dist/csv.js +3 -1
- package/dist/dom.cjs +2 -0
- package/dist/dom.d.cts +4 -4
- package/dist/dom.d.ts +3 -3
- package/dist/dom.js +2 -1
- package/dist/format.d.cts +1 -1
- package/dist/format.d.ts +1 -1
- package/dist/import.cjs +3 -1
- package/dist/import.d.cts +3 -3
- package/dist/import.d.ts +3 -3
- package/dist/import.js +3 -1
- package/dist/index.cjs +3 -1
- package/dist/index.d.cts +6 -6
- package/dist/index.d.ts +5 -5
- package/dist/index.js +3 -2
- package/dist/{infer-D9EC9vJ-.cjs → infer-BniOucP6.cjs} +65 -0
- package/dist/{infer-BR-J9BZa.js → infer-DcUyZ1T-.js} +54 -1
- package/dist/{model-0JikLfuM.d.cts → model-BUNp7B0Z.d.cts} +6 -0
- package/dist/{model-0JikLfuM.d.ts → model-BUNp7B0Z.d.ts} +6 -0
- package/dist/{pipeline-BuG_nn_S.d.ts → pipeline-6PmlmH1-.d.ts} +5 -2
- package/dist/{pipeline-DM7n0aRI.d.cts → pipeline-C63qD7Ym.d.cts} +5 -2
- package/dist/{pipeline-2dw9aehe.js → pipeline-CMealW1i.js} +6 -3
- package/dist/{pipeline-DMskqxiU.cjs → pipeline-Dc15gn1t.cjs} +6 -3
- package/dist/{read-ClszMDAE.js → read-CFQ09LlL.js} +253 -70
- package/dist/{read-ByceXfiL.cjs → read-DYDDLxUE.cjs} +253 -70
- package/dist/read.cjs +3 -1
- package/dist/read.d.cts +34 -6
- package/dist/read.d.ts +34 -6
- package/dist/read.js +3 -1
- package/dist/render.d.cts +1 -1
- package/dist/render.d.ts +1 -1
- package/dist/warnings-BPz1Ia3s.js +42 -0
- package/dist/warnings-CJPiDqei.cjs +47 -0
- package/dist/warnings-DhonqJ7A.d.cts +79 -0
- package/dist/warnings-DhonqJ7A.d.ts +79 -0
- package/dist/worker.cjs +3 -3
- package/dist/worker.d.cts +4 -4
- package/dist/worker.d.ts +4 -4
- package/dist/worker.js +3 -3
- package/dist/{write-DM6ieuQY.d.ts → write-BaMv1Z7W.d.ts} +2 -2
- package/dist/{write-DtjfdIFm.d.cts → write-Izl2NG0Y.d.cts} +2 -2
- package/package.json +1 -1
- package/dist/warnings-B1v58nCZ.d.cts +0 -41
- package/dist/warnings-B1v58nCZ.d.ts +0 -41
package/README.md
CHANGED
|
@@ -84,8 +84,15 @@ const { workbook, warnings } = await read(file);
|
|
|
84
84
|
for (const sheet of workbook.sheets) {
|
|
85
85
|
console.log(sheet.name, sheet.dimension, sheet.rows[0]?.map((cell) => cell?.value));
|
|
86
86
|
}
|
|
87
|
+
|
|
88
|
+
// Opt in to the text stored for number and ISO-date cells, e.g. to keep "50.30" as written.
|
|
89
|
+
const exact = await read(file, { rawText: true });
|
|
90
|
+
const cell = exact.workbook.sheets[0]?.rows[0]?.[0];
|
|
91
|
+
console.log(cell?.type, cell?.value, cell?.rawText); // "number" 50.3 "50.30"
|
|
87
92
|
```
|
|
88
93
|
|
|
94
|
+
Damage the reader can recover from comes back as `warnings`. `isDataLossWarning(w)` tells the ones where data was lost (a cell skipped, rows cut, a part missing, comments or charts not read; `partKind` names the part) from informational ones; the warning cap (`limits.maxWarnings`, default 1,000) drops only informational warnings, so filtering `warnings` with it is enough to refuse a damaged file.
|
|
95
|
+
|
|
89
96
|
## CSV
|
|
90
97
|
|
|
91
98
|
<!-- example: examples/snippets/src/csv.ts -->
|
|
@@ -96,6 +103,7 @@ const text = toCsv([["name", "amount"], ["Ada", 1250.5], ["=1+1", -5]]); // "=1+
|
|
|
96
103
|
const blob = toCsvBlob([["name"], ["Ada"]]); // UTF-8 with a BOM, so Excel opens it correctly
|
|
97
104
|
|
|
98
105
|
const { rows, delimiter } = parseCsv("name;amount\nAda;1250,50\n"); // detects ";"
|
|
106
|
+
const amounts = parseCsv("Betrag\n1,5\n2,5\n", { delimiterCandidates: [";", ",", "\t"] }); // one column: ";" preferred, "|" never tried
|
|
99
107
|
declare const upload: Blob;
|
|
100
108
|
const typed = await readCsv(upload, { inferTypes: true }); // numbers, TRUE/FALSE and ISO dates typed
|
|
101
109
|
```
|
|
@@ -171,7 +179,7 @@ const bytes = await excel.write(workbook, { signal: controller.signal, onProgres
|
|
|
171
179
|
- **Reader:** `.xlsx`, `.xlsm`, `.xltx` and `.xltm`, including ISO 29500 Strict files.
|
|
172
180
|
- Reads values, shared, inline and rich strings, and formula text with cached values (shared formulas expanded).
|
|
173
181
|
- Styles come back as shared frozen objects. Merges, column widths and row heights, views and panes, print setup, hyperlinks, defined names and document properties are read too.
|
|
174
|
-
- **Untrusted files:** bounded by limits on size, zip entries, compression ratio, XML depth, cells and shared strings. A `DOCTYPE` is rejected, nothing is ever fetched or executed, and file content never becomes an object key.
|
|
182
|
+
- **Untrusted files:** bounded by limits on size, zip entries, compression ratio, XML depth and token length, cells and shared strings. A `DOCTYPE` is rejected, nothing is ever fetched or executed, and file content never becomes an object key.
|
|
175
183
|
- **Rejected formats:** `.xls`, `.xlsb`, `.ods` and encrypted files throw `UNSUPPORTED_FORMAT`.
|
|
176
184
|
- **CSV:** RFC 4180 parsing with delimiter detection, BOM and CRLF/LF/CR handling, lenient or strict modes, and optional type inference. `readCsv` decodes bytes in any `TextDecoder` encoding. Serializing gives you quoting, a BOM for Excel, ISO dates and a formula-injection guard, which is on by default.
|
|
177
185
|
- **Datasets:** `fromDataset` and `fromDatasets` support `key`, `path` and function accessors, grouped headers, number formats, widths and a totals row. `toDataset` reads a sheet back into `{ columns, data }`.
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
import { a as LimitError, n as EnvironmentError, o as ValidationError, t as CsvError } from "./errors-CvGlfw0E.js";
|
|
2
|
-
import {
|
|
2
|
+
import { a as toBytes, i as checkMaxWarnings, r as WarningCap, t as inferValue } from "./infer-DcUyZ1T-.js";
|
|
3
3
|
import { t as isoDate } from "./iso-date-CXnn-9mT.js";
|
|
4
4
|
// src/internal/csv/decode.ts
|
|
5
5
|
/**
|
|
@@ -66,7 +66,7 @@ function cellRef(row, col) {
|
|
|
66
66
|
}
|
|
67
67
|
return `${name}${row + 1}`;
|
|
68
68
|
}
|
|
69
|
-
/**
|
|
69
|
+
/** Default `maxWarnings`: warnings kept per parse before the cap (internal/warning-cap.ts) applies. */
|
|
70
70
|
const MAX_WARNINGS = 1e3;
|
|
71
71
|
const CANDIDATES = [
|
|
72
72
|
",",
|
|
@@ -81,7 +81,7 @@ const CR = 13;
|
|
|
81
81
|
/** The resumable state of one parse. */
|
|
82
82
|
var CsvParser = class {
|
|
83
83
|
rows = [];
|
|
84
|
-
warnings
|
|
84
|
+
warnings;
|
|
85
85
|
delimiter;
|
|
86
86
|
bom;
|
|
87
87
|
newline;
|
|
@@ -93,14 +93,16 @@ var CsvParser = class {
|
|
|
93
93
|
pos;
|
|
94
94
|
line = 1;
|
|
95
95
|
expectedFields = -1;
|
|
96
|
-
|
|
96
|
+
cap;
|
|
97
97
|
constructor(text, cfg) {
|
|
98
98
|
validateConfig(cfg);
|
|
99
99
|
this.bom = text.charCodeAt(0) === 65279;
|
|
100
100
|
this.text = text;
|
|
101
101
|
this.pos = this.bom ? 1 : 0;
|
|
102
102
|
this.cfg = cfg;
|
|
103
|
-
this.
|
|
103
|
+
this.cap = new WarningCap(cfg.maxWarnings);
|
|
104
|
+
this.warnings = this.cap.warnings;
|
|
105
|
+
this.delimiter = cfg.delimiter !== "auto" ? cfg.delimiter : cfg.delimiterCandidates === void 0 ? detectDelimiter(text, this.pos, cfg.quote) : detectFromCandidates(text, this.pos, cfg.quote, cfg.delimiterCandidates);
|
|
104
106
|
this.delimCode = this.delimiter.charCodeAt(0);
|
|
105
107
|
this.quoteCode = cfg.quote.charCodeAt(0);
|
|
106
108
|
}
|
|
@@ -134,9 +136,11 @@ var CsvParser = class {
|
|
|
134
136
|
}
|
|
135
137
|
finish() {
|
|
136
138
|
this.done = true;
|
|
137
|
-
|
|
139
|
+
const dropped = this.cap.dropped;
|
|
140
|
+
if (dropped) this.warnings.push({
|
|
138
141
|
code: "WARNINGS_TRUNCATED",
|
|
139
|
-
message: `${
|
|
142
|
+
message: `${dropped.total} more warning(s) were not recorded (limit ${this.cfg.maxWarnings}).`,
|
|
143
|
+
dropped
|
|
140
144
|
});
|
|
141
145
|
}
|
|
142
146
|
/** Reads one record starting at `pos`. A blank line gives zero fields. */
|
|
@@ -282,11 +286,7 @@ var CsvParser = class {
|
|
|
282
286
|
...ref === void 0 ? {} : { ref },
|
|
283
287
|
line: this.line
|
|
284
288
|
} });
|
|
285
|
-
|
|
286
|
-
this.dropped++;
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
this.warnings.push(ref === void 0 ? {
|
|
289
|
+
this.cap.add(ref === void 0 ? {
|
|
290
290
|
code,
|
|
291
291
|
message
|
|
292
292
|
} : {
|
|
@@ -314,14 +314,56 @@ function validateConfig(cfg) {
|
|
|
314
314
|
if (cfg.delimiter !== "auto") checkSeparator("delimiter", cfg.delimiter);
|
|
315
315
|
checkSeparator("quote", cfg.quote);
|
|
316
316
|
if (cfg.delimiter === cfg.quote) throw new TypeError("delimiter and quote must differ");
|
|
317
|
+
if (cfg.delimiterCandidates !== void 0) checkCandidates(cfg.delimiterCandidates, cfg.quote);
|
|
317
318
|
if (!(cfg.maxRows >= 0)) throw new TypeError("maxRows must be a non-negative number");
|
|
318
319
|
if (!(cfg.maxFieldBytes > 0)) throw new TypeError("maxFieldBytes must be a positive number");
|
|
320
|
+
checkMaxWarnings("maxWarnings", cfg.maxWarnings);
|
|
319
321
|
}
|
|
320
322
|
/** A delimiter or quote: exactly one UTF-16 code unit, not CR or LF. */
|
|
321
323
|
function checkSeparator(name, value) {
|
|
322
324
|
if (typeof value !== "string" || value.length !== 1 || value === "\r" || value === "\n") throw new TypeError(`${name} must be a single character other than CR or LF, got ${JSON.stringify(value)}`);
|
|
323
325
|
}
|
|
324
326
|
/**
|
|
327
|
+
* `delimiterCandidates`: a non-empty array of distinct single characters,
|
|
328
|
+
* none of them CR, LF or the quote.
|
|
329
|
+
*/
|
|
330
|
+
function checkCandidates(list, quote) {
|
|
331
|
+
if (!Array.isArray(list) || list.length === 0) throw new TypeError(`delimiterCandidates must be a non-empty array of single characters, got ${JSON.stringify(list)}`);
|
|
332
|
+
const seen = /* @__PURE__ */ new Set();
|
|
333
|
+
for (let i = 0; i < list.length; i++) {
|
|
334
|
+
const d = list[i];
|
|
335
|
+
checkSeparator(`delimiterCandidates[${i}]`, d);
|
|
336
|
+
const c = d;
|
|
337
|
+
if (c === quote) throw new TypeError(`delimiterCandidates[${i}] must differ from the quote character`);
|
|
338
|
+
if (seen.has(c)) throw new TypeError(`delimiterCandidates has a duplicate: ${JSON.stringify(c)}`);
|
|
339
|
+
seen.add(c);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Picks the delimiter from caller-given candidates. A candidate scores the
|
|
344
|
+
* number of sampled records that have as many fields as the first record,
|
|
345
|
+
* or 0 when it does not split the first record. The highest score wins;
|
|
346
|
+
* equal scores (including all 0, or no records) go to the earlier candidate.
|
|
347
|
+
*/
|
|
348
|
+
function detectFromCandidates(text, start, quote, candidates) {
|
|
349
|
+
const sample = text.slice(start, start + SNIFF_CHARS);
|
|
350
|
+
let best = candidates[0];
|
|
351
|
+
let bestScore = 0;
|
|
352
|
+
for (const d of candidates) {
|
|
353
|
+
const counts = sniffCounts(sample, d, quote.charCodeAt(0));
|
|
354
|
+
const width = counts[0] ?? 0;
|
|
355
|
+
let score = 0;
|
|
356
|
+
if (width > 1) {
|
|
357
|
+
for (const n of counts) if (n === width) score++;
|
|
358
|
+
}
|
|
359
|
+
if (score > bestScore) {
|
|
360
|
+
best = d;
|
|
361
|
+
bestScore = score;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return best;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
325
367
|
* Picks the delimiter from `, ; TAB |` by field-count consistency over the
|
|
326
368
|
* first records: the candidate whose most common field count (> 1) covers the
|
|
327
369
|
* most records wins; ties go to the earlier candidate. Falls back to ','.
|
|
@@ -502,13 +544,15 @@ function parseConfig(options) {
|
|
|
502
544
|
const o = options ?? {};
|
|
503
545
|
return {
|
|
504
546
|
delimiter: o.delimiter ?? "auto",
|
|
547
|
+
delimiterCandidates: o.delimiterCandidates,
|
|
505
548
|
quote: o.quote ?? "\"",
|
|
506
549
|
inferTypes: o.inferTypes ?? false,
|
|
507
550
|
skipEmptyLines: o.skipEmptyLines ?? false,
|
|
508
551
|
strict: (o.mode ?? "lenient") === "strict",
|
|
509
552
|
maxRows: o.maxRows ?? Number.POSITIVE_INFINITY,
|
|
510
553
|
maxFieldBytes: o.maxFieldBytes ?? 1048576,
|
|
511
|
-
dateZone: o.dateZone ?? "local"
|
|
554
|
+
dateZone: o.dateZone ?? "local",
|
|
555
|
+
maxWarnings: o.maxWarnings === void 0 ? MAX_WARNINGS : o.maxWarnings
|
|
512
556
|
};
|
|
513
557
|
}
|
|
514
558
|
function checkMode(options) {
|
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
const require_errors = require("./errors-DOPrrGS4.cjs");
|
|
2
|
-
const require_infer = require("./infer-
|
|
2
|
+
const require_infer = require("./infer-BniOucP6.cjs");
|
|
3
3
|
const require_iso_date = require("./iso-date-3TY1OlGd.cjs");
|
|
4
4
|
// src/internal/csv/decode.ts
|
|
5
5
|
/**
|
|
@@ -66,7 +66,7 @@ function cellRef(row, col) {
|
|
|
66
66
|
}
|
|
67
67
|
return `${name}${row + 1}`;
|
|
68
68
|
}
|
|
69
|
-
/**
|
|
69
|
+
/** Default `maxWarnings`: warnings kept per parse before the cap (internal/warning-cap.ts) applies. */
|
|
70
70
|
const MAX_WARNINGS = 1e3;
|
|
71
71
|
const CANDIDATES = [
|
|
72
72
|
",",
|
|
@@ -81,7 +81,7 @@ const CR = 13;
|
|
|
81
81
|
/** The resumable state of one parse. */
|
|
82
82
|
var CsvParser = class {
|
|
83
83
|
rows = [];
|
|
84
|
-
warnings
|
|
84
|
+
warnings;
|
|
85
85
|
delimiter;
|
|
86
86
|
bom;
|
|
87
87
|
newline;
|
|
@@ -93,14 +93,16 @@ var CsvParser = class {
|
|
|
93
93
|
pos;
|
|
94
94
|
line = 1;
|
|
95
95
|
expectedFields = -1;
|
|
96
|
-
|
|
96
|
+
cap;
|
|
97
97
|
constructor(text, cfg) {
|
|
98
98
|
validateConfig(cfg);
|
|
99
99
|
this.bom = text.charCodeAt(0) === 65279;
|
|
100
100
|
this.text = text;
|
|
101
101
|
this.pos = this.bom ? 1 : 0;
|
|
102
102
|
this.cfg = cfg;
|
|
103
|
-
this.
|
|
103
|
+
this.cap = new require_infer.WarningCap(cfg.maxWarnings);
|
|
104
|
+
this.warnings = this.cap.warnings;
|
|
105
|
+
this.delimiter = cfg.delimiter !== "auto" ? cfg.delimiter : cfg.delimiterCandidates === void 0 ? detectDelimiter(text, this.pos, cfg.quote) : detectFromCandidates(text, this.pos, cfg.quote, cfg.delimiterCandidates);
|
|
104
106
|
this.delimCode = this.delimiter.charCodeAt(0);
|
|
105
107
|
this.quoteCode = cfg.quote.charCodeAt(0);
|
|
106
108
|
}
|
|
@@ -134,9 +136,11 @@ var CsvParser = class {
|
|
|
134
136
|
}
|
|
135
137
|
finish() {
|
|
136
138
|
this.done = true;
|
|
137
|
-
|
|
139
|
+
const dropped = this.cap.dropped;
|
|
140
|
+
if (dropped) this.warnings.push({
|
|
138
141
|
code: "WARNINGS_TRUNCATED",
|
|
139
|
-
message: `${
|
|
142
|
+
message: `${dropped.total} more warning(s) were not recorded (limit ${this.cfg.maxWarnings}).`,
|
|
143
|
+
dropped
|
|
140
144
|
});
|
|
141
145
|
}
|
|
142
146
|
/** Reads one record starting at `pos`. A blank line gives zero fields. */
|
|
@@ -282,11 +286,7 @@ var CsvParser = class {
|
|
|
282
286
|
...ref === void 0 ? {} : { ref },
|
|
283
287
|
line: this.line
|
|
284
288
|
} });
|
|
285
|
-
|
|
286
|
-
this.dropped++;
|
|
287
|
-
return;
|
|
288
|
-
}
|
|
289
|
-
this.warnings.push(ref === void 0 ? {
|
|
289
|
+
this.cap.add(ref === void 0 ? {
|
|
290
290
|
code,
|
|
291
291
|
message
|
|
292
292
|
} : {
|
|
@@ -314,14 +314,56 @@ function validateConfig(cfg) {
|
|
|
314
314
|
if (cfg.delimiter !== "auto") checkSeparator("delimiter", cfg.delimiter);
|
|
315
315
|
checkSeparator("quote", cfg.quote);
|
|
316
316
|
if (cfg.delimiter === cfg.quote) throw new TypeError("delimiter and quote must differ");
|
|
317
|
+
if (cfg.delimiterCandidates !== void 0) checkCandidates(cfg.delimiterCandidates, cfg.quote);
|
|
317
318
|
if (!(cfg.maxRows >= 0)) throw new TypeError("maxRows must be a non-negative number");
|
|
318
319
|
if (!(cfg.maxFieldBytes > 0)) throw new TypeError("maxFieldBytes must be a positive number");
|
|
320
|
+
require_infer.checkMaxWarnings("maxWarnings", cfg.maxWarnings);
|
|
319
321
|
}
|
|
320
322
|
/** A delimiter or quote: exactly one UTF-16 code unit, not CR or LF. */
|
|
321
323
|
function checkSeparator(name, value) {
|
|
322
324
|
if (typeof value !== "string" || value.length !== 1 || value === "\r" || value === "\n") throw new TypeError(`${name} must be a single character other than CR or LF, got ${JSON.stringify(value)}`);
|
|
323
325
|
}
|
|
324
326
|
/**
|
|
327
|
+
* `delimiterCandidates`: a non-empty array of distinct single characters,
|
|
328
|
+
* none of them CR, LF or the quote.
|
|
329
|
+
*/
|
|
330
|
+
function checkCandidates(list, quote) {
|
|
331
|
+
if (!Array.isArray(list) || list.length === 0) throw new TypeError(`delimiterCandidates must be a non-empty array of single characters, got ${JSON.stringify(list)}`);
|
|
332
|
+
const seen = /* @__PURE__ */ new Set();
|
|
333
|
+
for (let i = 0; i < list.length; i++) {
|
|
334
|
+
const d = list[i];
|
|
335
|
+
checkSeparator(`delimiterCandidates[${i}]`, d);
|
|
336
|
+
const c = d;
|
|
337
|
+
if (c === quote) throw new TypeError(`delimiterCandidates[${i}] must differ from the quote character`);
|
|
338
|
+
if (seen.has(c)) throw new TypeError(`delimiterCandidates has a duplicate: ${JSON.stringify(c)}`);
|
|
339
|
+
seen.add(c);
|
|
340
|
+
}
|
|
341
|
+
}
|
|
342
|
+
/**
|
|
343
|
+
* Picks the delimiter from caller-given candidates. A candidate scores the
|
|
344
|
+
* number of sampled records that have as many fields as the first record,
|
|
345
|
+
* or 0 when it does not split the first record. The highest score wins;
|
|
346
|
+
* equal scores (including all 0, or no records) go to the earlier candidate.
|
|
347
|
+
*/
|
|
348
|
+
function detectFromCandidates(text, start, quote, candidates) {
|
|
349
|
+
const sample = text.slice(start, start + SNIFF_CHARS);
|
|
350
|
+
let best = candidates[0];
|
|
351
|
+
let bestScore = 0;
|
|
352
|
+
for (const d of candidates) {
|
|
353
|
+
const counts = sniffCounts(sample, d, quote.charCodeAt(0));
|
|
354
|
+
const width = counts[0] ?? 0;
|
|
355
|
+
let score = 0;
|
|
356
|
+
if (width > 1) {
|
|
357
|
+
for (const n of counts) if (n === width) score++;
|
|
358
|
+
}
|
|
359
|
+
if (score > bestScore) {
|
|
360
|
+
best = d;
|
|
361
|
+
bestScore = score;
|
|
362
|
+
}
|
|
363
|
+
}
|
|
364
|
+
return best;
|
|
365
|
+
}
|
|
366
|
+
/**
|
|
325
367
|
* Picks the delimiter from `, ; TAB |` by field-count consistency over the
|
|
326
368
|
* first records: the candidate whose most common field count (> 1) covers the
|
|
327
369
|
* most records wins; ties go to the earlier candidate. Falls back to ','.
|
|
@@ -502,13 +544,15 @@ function parseConfig(options) {
|
|
|
502
544
|
const o = options ?? {};
|
|
503
545
|
return {
|
|
504
546
|
delimiter: o.delimiter ?? "auto",
|
|
547
|
+
delimiterCandidates: o.delimiterCandidates,
|
|
505
548
|
quote: o.quote ?? "\"",
|
|
506
549
|
inferTypes: o.inferTypes ?? false,
|
|
507
550
|
skipEmptyLines: o.skipEmptyLines ?? false,
|
|
508
551
|
strict: (o.mode ?? "lenient") === "strict",
|
|
509
552
|
maxRows: o.maxRows ?? Number.POSITIVE_INFINITY,
|
|
510
553
|
maxFieldBytes: o.maxFieldBytes ?? 1048576,
|
|
511
|
-
dateZone: o.dateZone ?? "local"
|
|
554
|
+
dateZone: o.dateZone ?? "local",
|
|
555
|
+
maxWarnings: o.maxWarnings === void 0 ? MAX_WARNINGS : o.maxWarnings
|
|
512
556
|
};
|
|
513
557
|
}
|
|
514
558
|
function checkMode(options) {
|
package/dist/csv.cjs
CHANGED
|
@@ -1,6 +1,8 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const
|
|
2
|
+
const require_warnings = require("./warnings-CJPiDqei.cjs");
|
|
3
|
+
const require_csv = require("./csv-DzGOFyHs.cjs");
|
|
3
4
|
exports.CSV_MIME = require_csv.CSV_MIME;
|
|
5
|
+
exports.isDataLossWarning = require_warnings.isDataLossWarning;
|
|
4
6
|
exports.parseCsv = require_csv.parseCsv;
|
|
5
7
|
exports.readCsv = require_csv.readCsv;
|
|
6
8
|
exports.toCsv = require_csv.toCsv;
|
package/dist/csv.d.cts
CHANGED
|
@@ -8,13 +8,24 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module javascript-excel/csv
|
|
10
10
|
*/
|
|
11
|
-
import { a as BlobType, i as
|
|
12
|
-
import { D as Sheet, T as RichTextRun, a as Cell, c as CellType, h as ErrorCode, j as Workbook, l as CellValue, o as CellErrorValue, s as CellInput, w as RichText } from "./model-
|
|
11
|
+
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";
|
|
12
|
+
import { D as Sheet, T as RichTextRun, a as Cell, c as CellType, h as ErrorCode, j as Workbook, l as CellValue, o as CellErrorValue, s as CellInput, w as RichText } from "./model-BUNp7B0Z.cjs";
|
|
13
13
|
import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
|
|
14
14
|
/** Options for `parseCsv` and `readCsv`. */
|
|
15
15
|
export interface CsvParseOptions {
|
|
16
|
-
/** A single character, or `'auto'` (default): picks from `, ; TAB |` by field-count consistency over the first records. */
|
|
16
|
+
/** A single character, or `'auto'` (default): picks from `, ; TAB |` (or `delimiterCandidates`) by field-count consistency over the first records. */
|
|
17
17
|
delimiter?: string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The delimiters `'auto'` chooses from, in order of preference, e.g. `[';', ',', '\t']`. Default: `, ; TAB |`
|
|
20
|
+
* with the built-in detection. With a list, only those characters are considered: a candidate scores the
|
|
21
|
+
* number of the first 20 records that have as many fields as the first record (0 when it does not split the
|
|
22
|
+
* first record), and the highest score wins; an equal score, or no evidence at all, goes to the earlier candidate.
|
|
23
|
+
* The first record decides: a title line above the header is taken as the header, so later records cannot
|
|
24
|
+
* outvote it. Each entry is one character (one UTF-16 code unit, as for `delimiter`) other than CR, LF and
|
|
25
|
+
* the quote, with no duplicates. Ignored (but still
|
|
26
|
+
* validated) when `delimiter` is a character.
|
|
27
|
+
*/
|
|
28
|
+
delimiterCandidates?: readonly string[] | undefined;
|
|
18
29
|
/** Default `'"'`. A quote inside a quoted field is doubled (RFC 4180). */
|
|
19
30
|
quote?: string | undefined;
|
|
20
31
|
/**
|
|
@@ -33,6 +44,13 @@ export interface CsvParseOptions {
|
|
|
33
44
|
maxRows?: number | undefined;
|
|
34
45
|
/** Largest field, in UTF-8 bytes; a bigger one throws `LimitError` (`LIMIT_EXCEEDED`). Default 1,048,576 (1 MiB). */
|
|
35
46
|
maxFieldBytes?: number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Warnings kept before the cap applies (as `ReadLimits.maxWarnings` for `read`). Past it,
|
|
49
|
+
* informational warnings are dropped and counted in one `WARNINGS_TRUNCATED` at the end;
|
|
50
|
+
* data-loss warnings (`isDataLossWarning`) are still kept, up to the first 100 of each code.
|
|
51
|
+
* A positive number; default 1,000.
|
|
52
|
+
*/
|
|
53
|
+
maxWarnings?: number | undefined;
|
|
36
54
|
}
|
|
37
55
|
/** Options for `readCsv`. */
|
|
38
56
|
export interface CsvReadOptions extends CsvParseOptions {
|
|
@@ -51,7 +69,7 @@ export interface CsvParseResult {
|
|
|
51
69
|
newline: "\r\n" | "\n" | "\r";
|
|
52
70
|
/** The input started with a BOM (removed from the data). */
|
|
53
71
|
bom: boolean;
|
|
54
|
-
/** `CSV_UNTERMINATED_QUOTE`, `CSV_STRAY_QUOTE`, `CSV_FIELD_COUNT`, `CSV_INVALID_ENCODING`, `CSV_ROWS_TRUNCATED
|
|
72
|
+
/** `CSV_UNTERMINATED_QUOTE`, `CSV_STRAY_QUOTE`, `CSV_FIELD_COUNT`, `CSV_INVALID_ENCODING`, `CSV_ROWS_TRUNCATED`, then `WARNINGS_TRUNCATED` if the cap dropped any (see `maxWarnings`). */
|
|
55
73
|
warnings: ExcelWarning[];
|
|
56
74
|
}
|
|
57
75
|
/** Options for `toCsv` and `toCsvBlob`. */
|
|
@@ -89,4 +107,4 @@ export declare function readCsv(input: string | BinaryInput, options?: CsvReadOp
|
|
|
89
107
|
export declare function toCsv(source: Sheet | CellInput[][], options?: CsvWriteOptions): string;
|
|
90
108
|
/** Like `toCsv`, as a `Blob` of type `text/csv;charset=utf-8`, with a BOM unless `bom: false`. */
|
|
91
109
|
export declare function toCsvBlob(source: Sheet | CellInput[][], options?: CsvWriteOptions): BlobType;
|
|
92
|
-
export type
|
|
110
|
+
export { type AbortSignalLike, type BinaryInput, type BlobLike, type BlobType, type Cell, type CellErrorValue, type CellInput, type CellType, type CellValue, type DroppedWarnings, type ErrorCode, type ExcelPartKind, type ExcelWarning, type ExcelWarningCode, type RichText, type RichTextRun, type Sheet, type Workbook, isDataLossWarning };
|
package/dist/csv.d.ts
CHANGED
|
@@ -8,13 +8,24 @@
|
|
|
8
8
|
*
|
|
9
9
|
* @module javascript-excel/csv
|
|
10
10
|
*/
|
|
11
|
-
import { a as BlobType, i as
|
|
12
|
-
import { D as Sheet, T as RichTextRun, a as Cell, c as CellType, h as ErrorCode, j as Workbook, l as CellValue, o as CellErrorValue, s as CellInput, w as RichText } from "./model-
|
|
11
|
+
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";
|
|
12
|
+
import { D as Sheet, T as RichTextRun, a as Cell, c as CellType, h as ErrorCode, j as Workbook, l as CellValue, o as CellErrorValue, s as CellInput, w as RichText } from "./model-BUNp7B0Z.js";
|
|
13
13
|
import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
|
|
14
14
|
/** Options for `parseCsv` and `readCsv`. */
|
|
15
15
|
export interface CsvParseOptions {
|
|
16
|
-
/** A single character, or `'auto'` (default): picks from `, ; TAB |` by field-count consistency over the first records. */
|
|
16
|
+
/** A single character, or `'auto'` (default): picks from `, ; TAB |` (or `delimiterCandidates`) by field-count consistency over the first records. */
|
|
17
17
|
delimiter?: string | undefined;
|
|
18
|
+
/**
|
|
19
|
+
* The delimiters `'auto'` chooses from, in order of preference, e.g. `[';', ',', '\t']`. Default: `, ; TAB |`
|
|
20
|
+
* with the built-in detection. With a list, only those characters are considered: a candidate scores the
|
|
21
|
+
* number of the first 20 records that have as many fields as the first record (0 when it does not split the
|
|
22
|
+
* first record), and the highest score wins; an equal score, or no evidence at all, goes to the earlier candidate.
|
|
23
|
+
* The first record decides: a title line above the header is taken as the header, so later records cannot
|
|
24
|
+
* outvote it. Each entry is one character (one UTF-16 code unit, as for `delimiter`) other than CR, LF and
|
|
25
|
+
* the quote, with no duplicates. Ignored (but still
|
|
26
|
+
* validated) when `delimiter` is a character.
|
|
27
|
+
*/
|
|
28
|
+
delimiterCandidates?: readonly string[] | undefined;
|
|
18
29
|
/** Default `'"'`. A quote inside a quoted field is doubled (RFC 4180). */
|
|
19
30
|
quote?: string | undefined;
|
|
20
31
|
/**
|
|
@@ -33,6 +44,13 @@ export interface CsvParseOptions {
|
|
|
33
44
|
maxRows?: number | undefined;
|
|
34
45
|
/** Largest field, in UTF-8 bytes; a bigger one throws `LimitError` (`LIMIT_EXCEEDED`). Default 1,048,576 (1 MiB). */
|
|
35
46
|
maxFieldBytes?: number | undefined;
|
|
47
|
+
/**
|
|
48
|
+
* Warnings kept before the cap applies (as `ReadLimits.maxWarnings` for `read`). Past it,
|
|
49
|
+
* informational warnings are dropped and counted in one `WARNINGS_TRUNCATED` at the end;
|
|
50
|
+
* data-loss warnings (`isDataLossWarning`) are still kept, up to the first 100 of each code.
|
|
51
|
+
* A positive number; default 1,000.
|
|
52
|
+
*/
|
|
53
|
+
maxWarnings?: number | undefined;
|
|
36
54
|
}
|
|
37
55
|
/** Options for `readCsv`. */
|
|
38
56
|
export interface CsvReadOptions extends CsvParseOptions {
|
|
@@ -51,7 +69,7 @@ export interface CsvParseResult {
|
|
|
51
69
|
newline: "\r\n" | "\n" | "\r";
|
|
52
70
|
/** The input started with a BOM (removed from the data). */
|
|
53
71
|
bom: boolean;
|
|
54
|
-
/** `CSV_UNTERMINATED_QUOTE`, `CSV_STRAY_QUOTE`, `CSV_FIELD_COUNT`, `CSV_INVALID_ENCODING`, `CSV_ROWS_TRUNCATED
|
|
72
|
+
/** `CSV_UNTERMINATED_QUOTE`, `CSV_STRAY_QUOTE`, `CSV_FIELD_COUNT`, `CSV_INVALID_ENCODING`, `CSV_ROWS_TRUNCATED`, then `WARNINGS_TRUNCATED` if the cap dropped any (see `maxWarnings`). */
|
|
55
73
|
warnings: ExcelWarning[];
|
|
56
74
|
}
|
|
57
75
|
/** Options for `toCsv` and `toCsvBlob`. */
|
|
@@ -89,4 +107,4 @@ export declare function readCsv(input: string | BinaryInput, options?: CsvReadOp
|
|
|
89
107
|
export declare function toCsv(source: Sheet | CellInput[][], options?: CsvWriteOptions): string;
|
|
90
108
|
/** Like `toCsv`, as a `Blob` of type `text/csv;charset=utf-8`, with a BOM unless `bom: false`. */
|
|
91
109
|
export declare function toCsvBlob(source: Sheet | CellInput[][], options?: CsvWriteOptions): BlobType;
|
|
92
|
-
export type
|
|
110
|
+
export { type AbortSignalLike, type BinaryInput, type BlobLike, type BlobType, type Cell, type CellErrorValue, type CellInput, type CellType, type CellValue, type DroppedWarnings, type ErrorCode, type ExcelPartKind, type ExcelWarning, type ExcelWarningCode, type RichText, type RichTextRun, type Sheet, type Workbook, isDataLossWarning };
|
package/dist/csv.js
CHANGED
|
@@ -1 +1,3 @@
|
|
|
1
|
-
|
|
1
|
+
import { t as isDataLossWarning } from "./warnings-BPz1Ia3s.js";
|
|
2
|
+
import { a as toCsvBlob, i as toCsv, n as parseCsv, r as readCsv, t as CSV_MIME } from "./csv-CrWF7JS1.js";
|
|
3
|
+
export { CSV_MIME, isDataLossWarning, parseCsv, readCsv, toCsv, toCsvBlob };
|
package/dist/dom.cjs
CHANGED
|
@@ -3,6 +3,7 @@ const require_cells = require("./cells-CPXU722t.cjs");
|
|
|
3
3
|
const require_sheet_names = require("./sheet-names-DDY64-dt.cjs");
|
|
4
4
|
const require_errors = require("./errors-DOPrrGS4.cjs");
|
|
5
5
|
const require_iso_date = require("./iso-date-3TY1OlGd.cjs");
|
|
6
|
+
const require_warnings = require("./warnings-CJPiDqei.cjs");
|
|
6
7
|
// src/auto-width.ts
|
|
7
8
|
/**
|
|
8
9
|
* Auto column widths for builders (docs/api.md §4.3, §5.4).
|
|
@@ -824,3 +825,4 @@ function colName(c) {
|
|
|
824
825
|
exports.DOWNLOAD_REVOKE_DELAY_MS = DOWNLOAD_REVOKE_DELAY_MS;
|
|
825
826
|
exports.download = download;
|
|
826
827
|
exports.fromTable = fromTable;
|
|
828
|
+
exports.isDataLossWarning = require_warnings.isDataLossWarning;
|
package/dist/dom.d.cts
CHANGED
|
@@ -7,9 +7,9 @@
|
|
|
7
7
|
*
|
|
8
8
|
* @module javascript-excel/dom
|
|
9
9
|
*/
|
|
10
|
-
import { t as AutoWidthOptions } from "./auto-width-
|
|
11
|
-
import { a as BlobType,
|
|
12
|
-
import { D as Sheet, k as Style, s as CellInput } from "./model-
|
|
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";
|
|
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 {
|
|
15
15
|
HTMLTableElement: {
|
|
@@ -78,4 +78,4 @@ export declare const DOWNLOAD_REVOKE_DELAY_MS = 4e4;
|
|
|
78
78
|
export declare function download(data: Uint8Array | BlobType | string, filename: string, options?: DownloadOptions): void;
|
|
79
79
|
/** Reads an HTML table into a Sheet: values, merges from colspan/rowspan, hints, links and (optionally) styles. */
|
|
80
80
|
export declare function fromTable(table: TableElement, options?: FromTableOptions): Sheet;
|
|
81
|
-
export type
|
|
81
|
+
export { type AutoWidthOptions, type BlobType, type CellInput, type DroppedWarnings, type ExcelPartKind, type ExcelWarning, type ExcelWarningCode, type Sheet, type Style, isDataLossWarning };
|
package/dist/dom.d.ts
CHANGED
|
@@ -8,8 +8,8 @@
|
|
|
8
8
|
* @module javascript-excel/dom
|
|
9
9
|
*/
|
|
10
10
|
import { t as AutoWidthOptions } from "./auto-width-CT-BihTW.js";
|
|
11
|
-
import { a as BlobType,
|
|
12
|
-
import { D as Sheet, k as Style, s as CellInput } from "./model-
|
|
11
|
+
import { a as isDataLossWarning, c as BlobType, i as ExcelWarningCode, n as ExcelPartKind, r as ExcelWarning, t as DroppedWarnings } from "./warnings-DhonqJ7A.js";
|
|
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 {
|
|
15
15
|
HTMLTableElement: {
|
|
@@ -78,4 +78,4 @@ export declare const DOWNLOAD_REVOKE_DELAY_MS = 4e4;
|
|
|
78
78
|
export declare function download(data: Uint8Array | BlobType | string, filename: string, options?: DownloadOptions): void;
|
|
79
79
|
/** Reads an HTML table into a Sheet: values, merges from colspan/rowspan, hints, links and (optionally) styles. */
|
|
80
80
|
export declare function fromTable(table: TableElement, options?: FromTableOptions): Sheet;
|
|
81
|
-
export type
|
|
81
|
+
export { type AutoWidthOptions, type BlobType, type CellInput, type DroppedWarnings, type ExcelPartKind, type ExcelWarning, type ExcelWarningCode, type Sheet, type Style, isDataLossWarning };
|
package/dist/dom.js
CHANGED
|
@@ -2,6 +2,7 @@ import { t as cellText } from "./cells-CrMF8h_t.js";
|
|
|
2
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
3
|
import { n as EnvironmentError, o as ValidationError } from "./errors-CvGlfw0E.js";
|
|
4
4
|
import { n as parseIsoDate } from "./iso-date-CXnn-9mT.js";
|
|
5
|
+
import { t as isDataLossWarning } from "./warnings-BPz1Ia3s.js";
|
|
5
6
|
// src/auto-width.ts
|
|
6
7
|
/**
|
|
7
8
|
* Auto column widths for builders (docs/api.md §4.3, §5.4).
|
|
@@ -820,4 +821,4 @@ function colName(c) {
|
|
|
820
821
|
for (let n = c + 1; n > 0; n = Math.floor((n - 1) / 26)) s = String.fromCharCode(65 + (n - 1) % 26) + s;
|
|
821
822
|
return s;
|
|
822
823
|
}
|
|
823
|
-
export { DOWNLOAD_REVOKE_DELAY_MS, download, fromTable };
|
|
824
|
+
export { DOWNLOAD_REVOKE_DELAY_MS, download, fromTable, isDataLossWarning };
|
package/dist/format.d.cts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module javascript-excel/format
|
|
11
11
|
*/
|
|
12
|
-
import { a as Cell, b as NumFmt, o as CellErrorValue, s as CellInput, w as RichText } from "./model-
|
|
12
|
+
import { a as Cell, b as NumFmt, o as CellErrorValue, s as CellInput, w as RichText } from "./model-BUNp7B0Z.cjs";
|
|
13
13
|
/** What `formatValue` accepts: a cell's value. A Date is converted to a serial first (`dateZone`, `date1904`). */
|
|
14
14
|
export type FormatInput = number | string | boolean | Date | CellErrorValue | RichText | null | undefined;
|
|
15
15
|
/** Options for `formatValue` and `formatCell`. */
|
package/dist/format.d.ts
CHANGED
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
*
|
|
10
10
|
* @module javascript-excel/format
|
|
11
11
|
*/
|
|
12
|
-
import { a as Cell, b as NumFmt, o as CellErrorValue, s as CellInput, w as RichText } from "./model-
|
|
12
|
+
import { a as Cell, b as NumFmt, o as CellErrorValue, s as CellInput, w as RichText } from "./model-BUNp7B0Z.js";
|
|
13
13
|
/** What `formatValue` accepts: a cell's value. A Date is converted to a serial first (`dateZone`, `date1904`). */
|
|
14
14
|
export type FormatInput = number | string | boolean | Date | CellErrorValue | RichText | null | undefined;
|
|
15
15
|
/** Options for `formatValue` and `formatCell`. */
|
package/dist/import.cjs
CHANGED
|
@@ -1,10 +1,12 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
-
const require_pipeline = require("./pipeline-
|
|
2
|
+
const require_pipeline = require("./pipeline-Dc15gn1t.cjs");
|
|
3
|
+
const require_warnings = require("./warnings-CJPiDqei.cjs");
|
|
3
4
|
exports.applyMapping = require_pipeline.applyMapping;
|
|
4
5
|
exports.coerceColumns = require_pipeline.coerceColumns;
|
|
5
6
|
exports.detectHeader = require_pipeline.detectHeader;
|
|
6
7
|
exports.importDataset = require_pipeline.importDataset;
|
|
7
8
|
exports.inferColumnTypes = require_pipeline.inferColumnTypes;
|
|
9
|
+
exports.isDataLossWarning = require_warnings.isDataLossWarning;
|
|
8
10
|
exports.mapColumns = require_pipeline.mapColumns;
|
|
9
11
|
exports.parseDate = require_pipeline.parseDate;
|
|
10
12
|
exports.parseNumber = require_pipeline.parseNumber;
|
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 parseDate, C as inferColumnTypes, D as detectHeader, E as ImportLocale, O as DateOrder, S as coerceColumns, T as HeaderDetection, _ as DatasetLike, a as importDataset, b as InferredColumn, c as ImportSchema, d as MappedDataset, f as MappingResult, g as ColumnType, h as CoerceResult, i as ImportProgress, j as parseNumber, k as NumberGroup, l as ImportedColumn, m as mapColumns, n as ImportDatasetResult, o as ColumnMapping, p as applyMapping, r as ImportMeta, s as FieldSpec, t as ImportDatasetOptions, u as MappableDataset, v as ImportIssue, w as DetectHeaderOptions, x as TypeOptions, y as ImportIssueCode } from "./pipeline-
|
|
7
|
-
import { a as BlobType, i as
|
|
6
|
+
import { A as parseDate, C as inferColumnTypes, D as detectHeader, E as ImportLocale, O as DateOrder, S as coerceColumns, T as HeaderDetection, _ as DatasetLike, a as importDataset, b as InferredColumn, c as ImportSchema, d as MappedDataset, f as MappingResult, g as ColumnType, h as CoerceResult, i as ImportProgress, j as parseNumber, k as NumberGroup, l as ImportedColumn, m as mapColumns, n as ImportDatasetResult, o as ColumnMapping, p as applyMapping, r as ImportMeta, s as FieldSpec, t as ImportDatasetOptions, u as MappableDataset, v as ImportIssue, w as DetectHeaderOptions, x as TypeOptions, y as ImportIssueCode } from "./pipeline-C63qD7Ym.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";
|
|
8
8
|
import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.cjs";
|
|
9
9
|
import { ReadLimits, SheetInfo } from "./read.cjs";
|
|
10
|
-
export { type AbortSignalLike, type BinaryInput, type BlobLike, type BlobType, type CoerceResult, type ColumnMapping, type ColumnType, type DatasetLike, type DateOrder, type DetectHeaderOptions, 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, mapColumns, parseDate, parseNumber };
|
|
10
|
+
export { type AbortSignalLike, type BinaryInput, type BlobLike, type BlobType, type CoerceResult, type ColumnMapping, type ColumnType, type DatasetLike, type DateOrder, type DetectHeaderOptions, 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 parseDate, C as inferColumnTypes, D as detectHeader, E as ImportLocale, O as DateOrder, S as coerceColumns, T as HeaderDetection, _ as DatasetLike, a as importDataset, b as InferredColumn, c as ImportSchema, d as MappedDataset, f as MappingResult, g as ColumnType, h as CoerceResult, i as ImportProgress, j as parseNumber, k as NumberGroup, l as ImportedColumn, m as mapColumns, n as ImportDatasetResult, o as ColumnMapping, p as applyMapping, r as ImportMeta, s as FieldSpec, t as ImportDatasetOptions, u as MappableDataset, v as ImportIssue, w as DetectHeaderOptions, x as TypeOptions, y as ImportIssueCode } from "./pipeline-
|
|
7
|
-
import { a as BlobType, i as
|
|
6
|
+
import { A as parseDate, C as inferColumnTypes, D as detectHeader, E as ImportLocale, O as DateOrder, S as coerceColumns, T as HeaderDetection, _ as DatasetLike, a as importDataset, b as InferredColumn, c as ImportSchema, d as MappedDataset, f as MappingResult, g as ColumnType, h as CoerceResult, i as ImportProgress, j as parseNumber, k as NumberGroup, l as ImportedColumn, m as mapColumns, n as ImportDatasetResult, o as ColumnMapping, p as applyMapping, r as ImportMeta, s as FieldSpec, t as ImportDatasetOptions, u as MappableDataset, v as ImportIssue, w as DetectHeaderOptions, x as TypeOptions, y as ImportIssueCode } from "./pipeline-6PmlmH1-.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";
|
|
8
8
|
import { t as AbortSignalLike } from "./signal-Dz0ZYe6d.js";
|
|
9
9
|
import { ReadLimits, SheetInfo } from "./read.js";
|
|
10
|
-
export { type AbortSignalLike, type BinaryInput, type BlobLike, type BlobType, type CoerceResult, type ColumnMapping, type ColumnType, type DatasetLike, type DateOrder, type DetectHeaderOptions, 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, mapColumns, parseDate, parseNumber };
|
|
10
|
+
export { type AbortSignalLike, type BinaryInput, type BlobLike, type BlobType, type CoerceResult, type ColumnMapping, type ColumnType, type DatasetLike, type DateOrder, type DetectHeaderOptions, 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 +1,3 @@
|
|
|
1
|
-
|
|
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-CMealW1i.js";
|
|
2
|
+
import { t as isDataLossWarning } from "./warnings-BPz1Ia3s.js";
|
|
3
|
+
export { applyMapping, coerceColumns, detectHeader, importDataset, inferColumnTypes, isDataLossWarning, mapColumns, parseDate, parseNumber };
|
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.
|
|
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;
|