xlvane 1.2.1 → 1.2.3
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 +3 -3
- package/dist/cli.js +71 -24
- package/dist/index.d.ts +6 -2
- package/dist/index.js +3 -3
- package/dist/{node-files-CDb6TyZb.js → node-files-Bxzv7THG.js} +1 -1
- package/dist/node.d.ts +1 -1
- package/dist/node.js +3 -3
- package/dist/{options-Ba1iWD-Z.js → options-Cw7OraxE.js} +274 -71
- package/dist/{rows-IWKIxHt9.js → rows-DnlfBgme.js} +104 -23
- package/dist/{stream-write-BGuUjlXo.js → stream-write-DWD8Pflj.js} +81 -15
- package/dist/{stream-write-BVaFkgwO.d.ts → stream-write-y52KUDW8.d.ts} +34 -3
- package/docs/errors.md +6 -2
- package/docs/exceljs-compat.md +2 -2
- package/llms-full.txt +12 -8
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -330,7 +330,7 @@ const stream = writeWorkbookStream({ sheets: [{ name: 'Data', rows: rows() }] })
|
|
|
330
330
|
- Memory stays constant: the test suite reads and writes 50 000 and 400 000 rows and checks that the retained heap does not grow. It measured under 1 MB in both cases.
|
|
331
331
|
- Streamed text is stored in the cells (inline strings) by default. Pass `sharedStrings: true` for a shared string table, which is smaller when values repeat but kept in memory until the end.
|
|
332
332
|
- Rows come in file order. A shared formula whose master cell comes later in the file cannot be translated while streaming.
|
|
333
|
-
- `maxCells` does not apply when streaming; single parts may decompress to 4 GiB (`STREAM_LIMIT_DEFAULTS`). All other limits apply.
|
|
333
|
+
- `maxCells` does not apply when streaming, except that one `<row>` element may hold at most 16 384 cells; single parts may decompress to 4 GiB (`STREAM_LIMIT_DEFAULTS`). All other limits apply.
|
|
334
334
|
- `readTableStream` differs from `readTable` in what it can see in advance: it detects the header row among the first rows it reads and fixes the columns there (the columns of the header row, or of the first rows without one), so a column that first appears further down is not part of the objects. `readTable` takes the columns of the whole sheet. For files that fit in memory, `readTable` gives the complete table.
|
|
335
335
|
|
|
336
336
|
## Benchmark
|
|
@@ -387,8 +387,8 @@ Limits can be changed per call, for example `readWorkbook(bytes, { limits: { max
|
|
|
387
387
|
| `maxXmlNameLength` | 1 024 | huge element or attribute names |
|
|
388
388
|
| `maxXmlTextLength` | 8 Mi characters | huge text nodes, attribute values, comments or processing instructions |
|
|
389
389
|
| `maxXmlTreeElements` | 1 000 000 | huge workbook, styles or relationship parts (elements plus attributes) |
|
|
390
|
-
| `maxCells` | 5 000 000 | workbooks too large to hold in memory (measured: about 180 bytes per numeric cell, Node.js 26); also bounds the output of `toCSV`, `readTable`, `toJSON` and `readTableStream` to `max(maxCells, 16 × cells read)` positions |
|
|
391
|
-
| `maxSharedStringChars` | 512 Mi characters | many cells pointing at one huge shared string (a few MB that become many GB when values are copied); counted separately, the same for cells sharing one huge formula |
|
|
390
|
+
| `maxCells` | 5 000 000 | workbooks too large to hold in memory (measured: about 180 bytes per numeric cell, Node.js 26); also bounds the output of `toCSV`, `readTable`, `toJSON` and `readTableStream` to `max(maxCells, 16 × cells read)` positions, and of `fromCSV`, `fromJSON` and `writeTable` to `max(maxCells, 16 × cells written)` |
|
|
391
|
+
| `maxSharedStringChars` | 512 Mi characters | many cells pointing at one huge shared string (a few MB that become many GB when values are copied); counted separately, the same for cells sharing one huge formula and for header names repeated in every row object of `readTable` and `toJSON` |
|
|
392
392
|
|
|
393
393
|
## Package size
|
|
394
394
|
|
package/dist/cli.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import {
|
|
3
|
-
import { a as appendRows, c as fromCSV, d as fromJSON, f as pickSheet, h as toJSON, l as inferValue, n as insertRows, o as editCells, p as readTable, s as diff, t as deleteRows, u as toCSV } from "./rows-
|
|
4
|
-
import { i as readInput } from "./node-files-
|
|
2
|
+
import { Ut as suggest, _ as isoDate, b as readWorkbook, g as inspect, jn as XlvError, pn as parseRange } from "./options-Cw7OraxE.js";
|
|
3
|
+
import { a as appendRows, c as fromCSV, d as fromJSON, f as pickSheet, h as toJSON, l as inferValue, n as insertRows, o as editCells, p as readTable, s as diff, t as deleteRows, u as toCSV } from "./rows-DnlfBgme.js";
|
|
4
|
+
import { i as readInput } from "./node-files-Bxzv7THG.js";
|
|
5
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
|
-
import {
|
|
6
|
+
import { lstat, open, readFile, readdir, rename, rm, stat, writeFile } from "node:fs/promises";
|
|
7
7
|
import process from "node:process";
|
|
8
8
|
import { createRequire } from "node:module";
|
|
9
9
|
import { basename, dirname, extname, isAbsolute, join, relative, resolve } from "node:path";
|
|
@@ -649,6 +649,18 @@ function quoteArg(arg) {
|
|
|
649
649
|
if (/^[\w@%+=:,./-]+$/.test(arg)) return arg;
|
|
650
650
|
return `'${arg.replace(/'/g, `'\\''`)}'`;
|
|
651
651
|
}
|
|
652
|
+
/**
|
|
653
|
+
* `args` with `options` added before the first "--", after which every argument is positional
|
|
654
|
+
* (or at the end when there is none).
|
|
655
|
+
*/
|
|
656
|
+
function withOptions(args, ...options) {
|
|
657
|
+
const at = args.indexOf("--");
|
|
658
|
+
return at === -1 ? [...args, ...options] : [
|
|
659
|
+
...args.slice(0, at),
|
|
660
|
+
...options,
|
|
661
|
+
...args.slice(at)
|
|
662
|
+
];
|
|
663
|
+
}
|
|
652
664
|
/** A command line as text. */
|
|
653
665
|
function commandLine(args) {
|
|
654
666
|
return ["xlvane", ...args].map(quoteArg).join(" ");
|
|
@@ -846,7 +858,7 @@ async function writeOutput(ctx, path, data, options) {
|
|
|
846
858
|
try {
|
|
847
859
|
const info = await stat(target);
|
|
848
860
|
exists = true;
|
|
849
|
-
mode = info.mode &
|
|
861
|
+
mode = info.mode & 511;
|
|
850
862
|
if (!info.isFile()) throw new XlvError("XLV_E_FILE_WRITE", `"${path}" is a directory.`, {
|
|
851
863
|
hint: "Give a file name for the output.",
|
|
852
864
|
details: {
|
|
@@ -869,13 +881,21 @@ async function writeOutput(ctx, path, data, options) {
|
|
|
869
881
|
};
|
|
870
882
|
try {
|
|
871
883
|
if (exists) {
|
|
872
|
-
const
|
|
884
|
+
const random = Array.from(globalThis.crypto.getRandomValues(/* @__PURE__ */ new Uint8Array(8)), (b) => b.toString(16).padStart(2, "0")).join("");
|
|
885
|
+
const temp = join(dirname(target), `.${basename(target)}.xlvane-${random}.tmp`);
|
|
886
|
+
let created = false;
|
|
873
887
|
try {
|
|
874
|
-
await
|
|
875
|
-
|
|
888
|
+
const handle = await open(temp, "wx", 384);
|
|
889
|
+
created = true;
|
|
890
|
+
try {
|
|
891
|
+
await handle.writeFile(bytes);
|
|
892
|
+
if (mode !== null) await handle.chmod(mode);
|
|
893
|
+
} finally {
|
|
894
|
+
await handle.close();
|
|
895
|
+
}
|
|
876
896
|
await rename(temp, target);
|
|
877
897
|
} catch (error) {
|
|
878
|
-
await rm(temp, { force: true });
|
|
898
|
+
if (created) await rm(temp, { force: true });
|
|
879
899
|
throw error;
|
|
880
900
|
}
|
|
881
901
|
} else await writeFile(target, bytes, { flag: "wx" });
|
|
@@ -1068,6 +1088,23 @@ function formatOf(command, path, role) {
|
|
|
1068
1088
|
[role]: path
|
|
1069
1089
|
});
|
|
1070
1090
|
}
|
|
1091
|
+
/**
|
|
1092
|
+
* The rows as indented JSON text. Every row repeats the header names, so a small file can ask for
|
|
1093
|
+
* more text than a JavaScript string can hold; that ends as a limit error, not an internal one
|
|
1094
|
+
* (D-J01).
|
|
1095
|
+
*/
|
|
1096
|
+
function jsonText(rows) {
|
|
1097
|
+
try {
|
|
1098
|
+
return `${JSON.stringify(rows, null, 2)}\n`;
|
|
1099
|
+
} catch (error) {
|
|
1100
|
+
if (!(error instanceof RangeError)) throw error;
|
|
1101
|
+
throw new XlvError("XLV_E_LIMIT_EXCEEDED", "The JSON text would be longer than a JavaScript string can be.", {
|
|
1102
|
+
hint: "Convert part of the sheet with --range, or convert to CSV, which does not repeat the header in every row.",
|
|
1103
|
+
details: { limit: "maxSharedStringChars" },
|
|
1104
|
+
cause: error
|
|
1105
|
+
});
|
|
1106
|
+
}
|
|
1107
|
+
}
|
|
1071
1108
|
/** The delimiter option: one character, or "tab". */
|
|
1072
1109
|
function delimiterOf(ctx, command, format) {
|
|
1073
1110
|
const d = str(ctx.args, "delimiter");
|
|
@@ -1091,12 +1128,7 @@ function delimiterNote(ctx, command, text, input) {
|
|
|
1091
1128
|
const other = first.includes(";") ? ";" : first.includes(" ") ? "tab" : null;
|
|
1092
1129
|
if (other === null) return;
|
|
1093
1130
|
const args = ctx.argv.filter((a) => a !== "--json");
|
|
1094
|
-
ctx.note(`note: the first line of ${input} has no "," but has ${other === "tab" ? "tabs" : "\";\""}; every line became one column. Try: ${commandLine([
|
|
1095
|
-
command,
|
|
1096
|
-
...args,
|
|
1097
|
-
"--delimiter",
|
|
1098
|
-
other
|
|
1099
|
-
])}`);
|
|
1131
|
+
ctx.note(`note: the first line of ${input} has no "," but has ${other === "tab" ? "tabs" : "\";\""}; every line became one column. Try: ${commandLine(withOptions([command, ...args], "--delimiter", other))}`);
|
|
1100
1132
|
}
|
|
1101
1133
|
/** What to do with a JSON file that holds something other than an array of rows. */
|
|
1102
1134
|
/**
|
|
@@ -1253,10 +1285,10 @@ const convertCommand = {
|
|
|
1253
1285
|
...sheet !== void 0 ? { sheet } : {},
|
|
1254
1286
|
...range !== void 0 ? { range } : {}
|
|
1255
1287
|
};
|
|
1256
|
-
if (to === "json") data =
|
|
1288
|
+
if (to === "json") data = jsonText(toJSON(workbook, {
|
|
1257
1289
|
...where,
|
|
1258
1290
|
header: headerOption(ctx.args, "convert")
|
|
1259
|
-
}).rows
|
|
1291
|
+
}).rows);
|
|
1260
1292
|
else data = toCSV(workbook, {
|
|
1261
1293
|
...where,
|
|
1262
1294
|
delimiter: delimiterOf(ctx, "convert", to),
|
|
@@ -1865,7 +1897,7 @@ const OWN_OPTIONS = /* @__PURE__ */ new Set([
|
|
|
1865
1897
|
const mcpCommand = {
|
|
1866
1898
|
name: "mcp",
|
|
1867
1899
|
summary: "Start the MCP server for AI agents",
|
|
1868
|
-
description: "Starts the Model Context Protocol server from the separate package @xlvane/mcp over stdin and stdout, so that an AI agent can inspect, read, convert and compare spreadsheets through tools instead of code. The arguments after \"mcp\" are passed to the server: --root <dir> (required, repeatable) names a directory the tools may use, --allow-write adds the tools that write files, and --max-file-size <bytes>, --max-rows <n
|
|
1900
|
+
description: "Starts the Model Context Protocol server from the separate package @xlvane/mcp over stdin and stdout, so that an AI agent can inspect, read, convert and compare spreadsheets through tools instead of code. The arguments after \"mcp\" are passed to the server: --root <dir> (required, repeatable) names a directory the tools may use, --allow-write adds the tools that write files, and --max-file-size <bytes>, --max-rows <n>, --max-response-chars <n> and --max-cells <n> set its limits. --json is not available, because stdout carries the protocol. If @xlvane/mcp is not installed, the command prints how to install it. The exit code is the server's: 0 when the client closed the connection, 2 for wrong arguments, 3 for a directory that cannot be used.",
|
|
1869
1901
|
usage: "[server options]",
|
|
1870
1902
|
positionals: {
|
|
1871
1903
|
min: 0,
|
|
@@ -2066,9 +2098,23 @@ function jsonError(path, cause) {
|
|
|
2066
2098
|
cause
|
|
2067
2099
|
});
|
|
2068
2100
|
}
|
|
2101
|
+
async function isLink(path) {
|
|
2102
|
+
try {
|
|
2103
|
+
return (await lstat(path)).isSymbolicLink();
|
|
2104
|
+
} catch {
|
|
2105
|
+
return false;
|
|
2106
|
+
}
|
|
2107
|
+
}
|
|
2069
2108
|
async function run$1(ctx) {
|
|
2070
2109
|
const dir = ctx.args.positionals[0] ?? ".";
|
|
2071
2110
|
const pkgPath = join(dir, "package.json");
|
|
2111
|
+
if (await isLink(resolvePath(ctx, pkgPath))) throw new XlvError("XLV_E_FILE_READ", `"${pkgPath}" is a symbolic link; migrate does not follow links.`, {
|
|
2112
|
+
hint: "Run migrate in the directory that holds the real package.json.",
|
|
2113
|
+
details: {
|
|
2114
|
+
path: pkgPath,
|
|
2115
|
+
code: "ELOOP"
|
|
2116
|
+
}
|
|
2117
|
+
});
|
|
2072
2118
|
const text = await readText(ctx, pkgPath);
|
|
2073
2119
|
let pkg;
|
|
2074
2120
|
try {
|
|
@@ -2148,7 +2194,12 @@ async function run$1(ctx) {
|
|
|
2148
2194
|
lines.push(" Details: docs/exceljs-compat.md. Unsupported calls throw XLV_E_NOT_SUPPORTED at run time.");
|
|
2149
2195
|
lines.push("");
|
|
2150
2196
|
if (write) lines.push(wroteLine(write));
|
|
2151
|
-
else if (changes.length > 0) lines.push(`Nothing was written. Run "${commandLine([
|
|
2197
|
+
else if (changes.length > 0) lines.push(`Nothing was written. Run "${commandLine(dir.startsWith("-") ? [
|
|
2198
|
+
"migrate",
|
|
2199
|
+
"--force",
|
|
2200
|
+
"--",
|
|
2201
|
+
dir
|
|
2202
|
+
] : [
|
|
2152
2203
|
"migrate",
|
|
2153
2204
|
...dir === "." ? [] : [dir],
|
|
2154
2205
|
"--force"
|
|
@@ -2658,11 +2709,7 @@ function suggestCommand(error, first, rest, spec) {
|
|
|
2658
2709
|
}
|
|
2659
2710
|
}
|
|
2660
2711
|
if (spec === void 0) return null;
|
|
2661
|
-
if (error.code === "XLV_E_FILE_EXISTS") return commandLine([
|
|
2662
|
-
spec.name,
|
|
2663
|
-
...rest,
|
|
2664
|
-
"--force"
|
|
2665
|
-
]);
|
|
2712
|
+
if (error.code === "XLV_E_FILE_EXISTS") return commandLine(withOptions([spec.name, ...rest], "--force"));
|
|
2666
2713
|
if (error.code === "XLV_E_SHEET_NOT_FOUND" && Array.isArray(d["available"]) && typeof error.location.sheet === "string") {
|
|
2667
2714
|
const close = suggest(error.location.sheet, d["available"], 1);
|
|
2668
2715
|
const fixed = close.length > 0 ? withSheetName(rest, error.location.sheet, close[0]) : null;
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as InspectOptions, $n as verifyPassword, $t as DataValidationOperator, A as toJSON, An as Hyperlink, At as Workbook, B as FormulaResult, Bn as PrintErrors, Bt as CfValue, C as TableRow, Cn as ImageAnchorInput, Ct as Sheet, D as fromJSON, Dn as SheetImage, Dt as SheetState, E as WriteTableOptions, En as ImagePositionInput, Et as SheetProperties, F as CellInput, Fn as PageOrder, Ft as TableDefinitionColumn, G as SheetPropertiesOptions, Gn as SheetProtectionOptions, Gt as ConditionalFormatRule, H as NewSheet, Hn as PrintTitles, Ht as CfValueType, I as ColumnOptions, In as PageOrientation, It as TableInput, J as WriteWorkbookOptions, Jn as HashPasswordOptions, Jt as DataBarAxisPosition, K as SheetViewOptions, Kn as WorkbookProtection, Kt as ConditionalFormatRuleInput, L as CreateWorkbookOptions, Ln as PageSetup, Lt as TableStyleOptions, M as StandardSchemaV1, Mn as HeaderFooter, Mt as WorkbookView, N as AddSheetOptions, Nn as PageBreaks, Nt as TableColumnInput, O as readTable, On as WorkbookImage, Ot as SheetView, P as CalculationOptions, Pn as PageMargins, Pt as TableDefinition, Q as InspectDefinedName, Qn as legacyPasswordHash, Qt as DataValidationImeMode, R as ERROR_VALUES, Rn as PageSetupOptions, Rt as TotalsRowFunction, S as TableResult, Sn as ImageAnchor, St as RowInfo, T as ToJSONOptions, Tn as ImageOptions, Tt as SheetLayout, U as NewWorkbook, Un as SheetProtection, Ut as ConditionalFormat, V as FreezeOptions, Vn as PrintOptions, Vt as CfValueInput, W as RowOptions, Wn as SheetProtectionFlags, Wt as ConditionalFormatOperator, X as writeWorkbook, Xn as PasswordVerifier, Xt as DataValidation, Y as createWorkbook, Yn as PasswordHash, Yt as DataBarDirection, Z as InspectColumn, Zn as hashPassword, Zt as DataValidationErrorStyle, _ as JsonTable, _n as ReadingOrder, _r as DefinedNameOptions, _t as DateSystem, a as WriteWorkbookStreamOptions, an as BorderEdge, ar as XlvDetails, at as ReadOptions, b as TableColumnSpec, bn as VerticalAlignment, bt as FrozenPanes, c as OpenWorkbookStreamOptions, cn as CellStyle, cr as XlvErrorInit, ct as NoteBox, d as StreamRow, dn as FontScheme, dr as XlvWarning, dt as NoteMargins, en as DataValidationRule, er as ShaAlgorithm, et as InspectReport, f as StreamSheetInfo, fn as FontStyle, fr as XlvWarningCode, ft as Cell, g as readTableStream, gn as ProtectionStyle, gr as DefinedName, gt as Conformance, h as openWorkbookStream, hn as PatternType, hr as ReadLimits, ht as ColumnInfo, i as WriteTableStreamOptions, in as AlignmentStyle, ir as XlvDetailValue, it as inspect, j as writeTable, jn as HyperlinkTarget, jt as WorkbookFormat, k as readTableAsync, kn as imageFormat, kt as SplitPanes, l as ReadTableStreamOptions, ln as Color, lr as XlvErrorJSON, lt as NoteBoxInput, m as WorkbookStream, mn as HorizontalAlignment, mr as DEFAULT_READ_LIMITS, mt as CellValue, n as StreamRowInput, nn as IconSetType, nr as ERROR_CODES, nt as InspectTypeCounts, o as writeTableStream, on as BorderLineStyle, or as XlvError, ot as readWorkbook, p as TableStreamItem, pn as GradientFill, pr as isXlvError, pt as CellType, q as WorkbookViewOptions, qn as WorkbookProtectionOptions, qt as ConditionalFormatType, r as StreamSheetSpec, rn as TimePeriod, rr as WARNING_CODES, rt as InspectValue, s as writeWorkbookStream, sn as BorderStyle, sr as XlvErrorCode, st as Note, t as StreamDefinedName, tn as DataValidationType, tr as WorkbookProperties, tt as InspectSheet, u as STREAM_LIMIT_DEFAULTS, un as FillStyle, ur as XlvLocation, ut as NoteInput, v as ReadTableOptions, vn as UnderlineStyle, vt as Formula, w as TableValue, wn as ImageFormat, wt as SheetKind, x as TableIssue, xn as AnchorMarker, xt as RichTextRun, y as TableColumn, yn as VerticalAlignRun, yt as FormulaKind, z as ErrorValue, zn as PrintCellComments, zt as CfIcon } from "./stream-write-
|
|
1
|
+
import { $ as InspectOptions, $n as verifyPassword, $t as DataValidationOperator, A as toJSON, An as Hyperlink, At as Workbook, B as FormulaResult, Bn as PrintErrors, Bt as CfValue, C as TableRow, Cn as ImageAnchorInput, Ct as Sheet, D as fromJSON, Dn as SheetImage, Dt as SheetState, E as WriteTableOptions, En as ImagePositionInput, Et as SheetProperties, F as CellInput, Fn as PageOrder, Ft as TableDefinitionColumn, G as SheetPropertiesOptions, Gn as SheetProtectionOptions, Gt as ConditionalFormatRule, H as NewSheet, Hn as PrintTitles, Ht as CfValueType, I as ColumnOptions, In as PageOrientation, It as TableInput, J as WriteWorkbookOptions, Jn as HashPasswordOptions, Jt as DataBarAxisPosition, K as SheetViewOptions, Kn as WorkbookProtection, Kt as ConditionalFormatRuleInput, L as CreateWorkbookOptions, Ln as PageSetup, Lt as TableStyleOptions, M as StandardSchemaV1, Mn as HeaderFooter, Mt as WorkbookView, N as AddSheetOptions, Nn as PageBreaks, Nt as TableColumnInput, O as readTable, On as WorkbookImage, Ot as SheetView, P as CalculationOptions, Pn as PageMargins, Pt as TableDefinition, Q as InspectDefinedName, Qn as legacyPasswordHash, Qt as DataValidationImeMode, R as ERROR_VALUES, Rn as PageSetupOptions, Rt as TotalsRowFunction, S as TableResult, Sn as ImageAnchor, St as RowInfo, T as ToJSONOptions, Tn as ImageOptions, Tt as SheetLayout, U as NewWorkbook, Un as SheetProtection, Ut as ConditionalFormat, V as FreezeOptions, Vn as PrintOptions, Vt as CfValueInput, W as RowOptions, Wn as SheetProtectionFlags, Wt as ConditionalFormatOperator, X as writeWorkbook, Xn as PasswordVerifier, Xt as DataValidation, Y as createWorkbook, Yn as PasswordHash, Yt as DataBarDirection, Z as InspectColumn, Zn as hashPassword, Zt as DataValidationErrorStyle, _ as JsonTable, _n as ReadingOrder, _r as DefinedNameOptions, _t as DateSystem, a as WriteWorkbookStreamOptions, an as BorderEdge, ar as XlvDetails, at as ReadOptions, b as TableColumnSpec, bn as VerticalAlignment, bt as FrozenPanes, c as OpenWorkbookStreamOptions, cn as CellStyle, cr as XlvErrorInit, ct as NoteBox, d as StreamRow, dn as FontScheme, dr as XlvWarning, dt as NoteMargins, en as DataValidationRule, er as ShaAlgorithm, et as InspectReport, f as StreamSheetInfo, fn as FontStyle, fr as XlvWarningCode, ft as Cell, g as readTableStream, gn as ProtectionStyle, gr as DefinedName, gt as Conformance, h as openWorkbookStream, hn as PatternType, hr as ReadLimits, ht as ColumnInfo, i as WriteTableStreamOptions, in as AlignmentStyle, ir as XlvDetailValue, it as inspect, j as writeTable, jn as HyperlinkTarget, jt as WorkbookFormat, k as readTableAsync, kn as imageFormat, kt as SplitPanes, l as ReadTableStreamOptions, ln as Color, lr as XlvErrorJSON, lt as NoteBoxInput, m as WorkbookStream, mn as HorizontalAlignment, mr as DEFAULT_READ_LIMITS, mt as CellValue, n as StreamRowInput, nn as IconSetType, nr as ERROR_CODES, nt as InspectTypeCounts, o as writeTableStream, on as BorderLineStyle, or as XlvError, ot as readWorkbook, p as TableStreamItem, pn as GradientFill, pr as isXlvError, pt as CellType, q as WorkbookViewOptions, qn as WorkbookProtectionOptions, qt as ConditionalFormatType, r as StreamSheetSpec, rn as TimePeriod, rr as WARNING_CODES, rt as InspectValue, s as writeWorkbookStream, sn as BorderStyle, sr as XlvErrorCode, st as Note, t as StreamDefinedName, tn as DataValidationType, tr as WorkbookProperties, tt as InspectSheet, u as STREAM_LIMIT_DEFAULTS, un as FillStyle, ur as XlvLocation, ut as NoteInput, v as ReadTableOptions, vn as UnderlineStyle, vt as Formula, w as TableValue, wn as ImageFormat, wt as SheetKind, x as TableIssue, xn as AnchorMarker, xt as RichTextRun, y as TableColumn, yn as VerticalAlignRun, yt as FormulaKind, z as ErrorValue, zn as PrintCellComments, zt as CfIcon } from "./stream-write-y52KUDW8.js";
|
|
2
2
|
/**
|
|
3
3
|
* Options for {@link toCSV}.
|
|
4
4
|
*
|
|
@@ -14,7 +14,11 @@ interface ToCSVOptions {
|
|
|
14
14
|
readonly sheet?: string;
|
|
15
15
|
/** Only this range, for example `"A1:D100"`. Default: from A1 to the last used row and column. */
|
|
16
16
|
readonly range?: string;
|
|
17
|
-
/**
|
|
17
|
+
/**
|
|
18
|
+
* Field separator: one character other than `"`, CR or LF. Default `","`. While formulas are
|
|
19
|
+
* escaped (`formulaInjection: "escape"`), `=`, `+`, `-`, `@` and their full-width and small forms
|
|
20
|
+
* are refused, because a line whose first field is empty would start with them.
|
|
21
|
+
*/
|
|
18
22
|
readonly delimiter?: string;
|
|
19
23
|
/** Line ending. Default `"\r\n"` (RFC 4180). */
|
|
20
24
|
readonly newline?: "\r\n" | "\n";
|
package/dist/index.js
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { a as appendRows, c as fromCSV, d as fromJSON, g as writeTable, h as toJSON, i as adjustRange, m as readTableAsync, n as insertRows, o as editCells, p as readTable, r as adjustFormula, s as diff, t as deleteRows, u as toCSV } from "./rows-
|
|
3
|
-
import { a as readTableStream, i as openWorkbookStream, n as writeWorkbookStream, r as STREAM_LIMIT_DEFAULTS, t as writeTableStream } from "./stream-write-
|
|
1
|
+
import { An as WARNING_CODES, Jt as legacyPasswordHash, Mn as isXlvError, Yt as verifyPassword, b as readWorkbook, c as NewSheet, en as imageFormat, f as createWorkbook, g as inspect, jn as XlvError, kn as ERROR_CODES, l as NewWorkbook, m as writeWorkbook, qt as hashPassword, s as ERROR_VALUES, z as shiftFormula, zt as DEFAULT_READ_LIMITS } from "./options-Cw7OraxE.js";
|
|
2
|
+
import { a as appendRows, c as fromCSV, d as fromJSON, g as writeTable, h as toJSON, i as adjustRange, m as readTableAsync, n as insertRows, o as editCells, p as readTable, r as adjustFormula, s as diff, t as deleteRows, u as toCSV } from "./rows-DnlfBgme.js";
|
|
3
|
+
import { a as readTableStream, i as openWorkbookStream, n as writeWorkbookStream, r as STREAM_LIMIT_DEFAULTS, t as writeTableStream } from "./stream-write-DWD8Pflj.js";
|
|
4
4
|
export { DEFAULT_READ_LIMITS, ERROR_CODES, ERROR_VALUES, NewSheet, NewWorkbook, STREAM_LIMIT_DEFAULTS, WARNING_CODES, XlvError, adjustFormula, adjustRange, appendRows, createWorkbook, deleteRows, diff, editCells, fromCSV, fromJSON, hashPassword, imageFormat, insertRows, inspect, isXlvError, legacyPasswordHash, openWorkbookStream, readTable, readTableAsync, readTableStream, readWorkbook, shiftFormula, toCSV, toJSON, verifyPassword, writeTable, writeTableStream, writeWorkbook, writeWorkbookStream };
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import {
|
|
1
|
+
import { Ht as resolveLimits, jn as XlvError } from "./options-Cw7OraxE.js";
|
|
2
2
|
import { readFile, stat } from "node:fs/promises";
|
|
3
3
|
// src/util/node-files.ts
|
|
4
4
|
/** The path as shown in messages. */
|
package/dist/node.d.ts
CHANGED
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $ as InspectOptions, At as Workbook, J as WriteWorkbookOptions, U as NewWorkbook, a as WriteWorkbookStreamOptions, at as ReadOptions, c as OpenWorkbookStreamOptions, et as InspectReport, m as WorkbookStream } from "./stream-write-
|
|
1
|
+
import { $ as InspectOptions, At as Workbook, J as WriteWorkbookOptions, U as NewWorkbook, a as WriteWorkbookStreamOptions, at as ReadOptions, c as OpenWorkbookStreamOptions, et as InspectReport, m as WorkbookStream } from "./stream-write-y52KUDW8.js";
|
|
2
2
|
/**
|
|
3
3
|
* Reads an XLSX file from disk. Node.js only; in other runtimes pass the bytes to
|
|
4
4
|
* `readWorkbook` from `xlvane`. The file size is checked against `limits.maxInputBytes`
|
package/dist/node.js
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import {
|
|
2
|
-
import { i as readInput, n as describePath, r as fileError, t as checkFile } from "./node-files-
|
|
3
|
-
import { i as openWorkbookStream, n as writeWorkbookStream, r as STREAM_LIMIT_DEFAULTS } from "./stream-write-
|
|
1
|
+
import { Ht as resolveLimits, b as readWorkbook, g as inspect, jn as XlvError, m as writeWorkbook } from "./options-Cw7OraxE.js";
|
|
2
|
+
import { i as readInput, n as describePath, r as fileError, t as checkFile } from "./node-files-Bxzv7THG.js";
|
|
3
|
+
import { i as openWorkbookStream, n as writeWorkbookStream, r as STREAM_LIMIT_DEFAULTS } from "./stream-write-DWD8Pflj.js";
|
|
4
4
|
import { openAsBlob } from "node:fs";
|
|
5
5
|
import { open, unlink, writeFile } from "node:fs/promises";
|
|
6
6
|
// src/node.ts
|