xlvane 1.2.3 → 1.3.1
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 +37 -5
- package/dist/cli.js +60 -27
- package/dist/index.d.ts +28 -10
- package/dist/index.js +3 -3
- package/dist/{node-files-Bxzv7THG.js → node-files-BkN3L0JT.js} +2 -2
- package/dist/node.d.ts +1 -1
- package/dist/node.js +3 -3
- package/dist/{options-Cw7OraxE.js → options-BD873QNd.js} +7918 -6885
- package/dist/{rows-DnlfBgme.js → rows-BxGneQTL.js} +1017 -378
- package/dist/{stream-write-DWD8Pflj.js → stream-write-BaUo8z8l.js} +52 -12
- package/dist/{stream-write-y52KUDW8.d.ts → stream-write-BbazTExn.d.ts} +387 -13
- package/docs/cli-json/inspect.schema.json +76 -0
- package/docs/errors.md +27 -10
- package/docs/exceljs-compat.md +24 -16
- package/docs/inspect-json.md +4 -0
- package/docs/migrate-from-exceljs.md +131 -0
- package/docs/xlsx-cves.md +88 -0
- package/llms-full.txt +408 -33
- package/package.json +1 -1
- package/skills/xlvane/SKILL.md +14 -1
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { $t as
|
|
1
|
+
import { $t as metricsOf, A as checkSource$1, B as createWorksheetParser, Bt as resolveLimits, Cn as CORE_PROPERTIES_PART, Ct as relationshipsPartName, D as HEAD_BYTES, Dt as checkUniqueName, E as CORRUPT_HINT, Et as checkDefinedName, F as readCentralDirectory, Ht as printNames, I as unsupported, Jt as DRAWING_CONTENT_TYPE, K as SheetRels, L as validateLocalHeaders, Lt as DEFAULT_READ_LIMITS, M as limitExceeded, N as locateCentralDirectory, Nn as clip, O as NotLoaded, Ot as nameScopeKey, Pt as normalizeStyle, Q as createSharedStrings, R as WarningCollector, Rt as checkKeyText, Sn as APP_PROPERTIES_PART, St as openPackage, T as Bytes, Tn as corePropertiesXml, Tt as normalizeTable, Ut as printXml, Wt as sheetProtectionXml, X as cellXml, Xt as MediaParts, Y as buildStyles, Yt as IMAGE_CONTENT_TYPES, Z as contentTypesXml, Zt as drawingParts, _t as FormulaGroups, a as DATE_FORMAT, b as readNotes, bn as partKey, cn as chartPartXml, ct as sheetHead, d as convertCellInput, dt as sheetTail, en as resolveAnchor, f as createWorkbook, g as detectHeader, gn as formatCellRef, gt as workbookXml, hn as columnLetters, ht as workbookRelsXml, i as readOptions, in as classifyRelationship, it as noteParts, j as corrupt, k as TAIL_BYTES, kn as createXmlByteStreamParser, ln as chartSheetNames, lt as sheetRelsPartName, mn as MAX_ROWS, n as oneOfOption, nt as hyperlinksXml, o as DATE_TIME_FORMAT, on as CHART_CONTENT_TYPE, ot as rootRelsXml, p as sortedNotes, pn as MAX_COLUMNS, pt as tableParts, rt as nameTitles, sn as chartPartName, st as rowStart, tn as resolveImage, u as checkBookViews, un as resolveChartSheets, ut as sheetRulesXml, v as isoDate, w as workbookPartsToLoad, wn as appPropertiesXml, wt as TABLE_CONTENT_TYPE, xn as zipNameToPartName, y as analyzeWorkbook, yt as crc32, z as sheetNotFound, zn as XlvError, zt as checkOutputPositions } from "./options-BD873QNd.js";
|
|
2
2
|
import { Deflate, Inflate } from "fflate";
|
|
3
3
|
// src/zip/stream.ts
|
|
4
4
|
/**
|
|
@@ -586,13 +586,19 @@ async function openWorkbookStream(source, options) {
|
|
|
586
586
|
formulaText: limits.maxSharedStringChars
|
|
587
587
|
},
|
|
588
588
|
formatCache
|
|
589
|
-
}, (number, cells, rowInfo, styledCells) =>
|
|
590
|
-
|
|
591
|
-
|
|
592
|
-
|
|
593
|
-
|
|
594
|
-
|
|
595
|
-
|
|
589
|
+
}, (number, cells, rowInfo, styledCells) => {
|
|
590
|
+
const row = {
|
|
591
|
+
number,
|
|
592
|
+
cells: withNotes(cells),
|
|
593
|
+
styledCells,
|
|
594
|
+
height: rowInfo?.height ?? null,
|
|
595
|
+
hidden: rowInfo?.hidden ?? false
|
|
596
|
+
};
|
|
597
|
+
ready.push(rowInfo?.style === void 0 ? row : {
|
|
598
|
+
...row,
|
|
599
|
+
style: rowInfo.style
|
|
600
|
+
});
|
|
601
|
+
});
|
|
596
602
|
const parser = createXmlByteStreamParser(handler, {
|
|
597
603
|
part,
|
|
598
604
|
limits
|
|
@@ -868,12 +874,14 @@ function writeWorkbookStream(options) {
|
|
|
868
874
|
"images",
|
|
869
875
|
"views",
|
|
870
876
|
"calculation",
|
|
871
|
-
"compressionLevel"
|
|
877
|
+
"compressionLevel",
|
|
878
|
+
"defaultFont"
|
|
872
879
|
], "writeWorkbookStream options");
|
|
873
880
|
const dateSystem = o.get("dateSystem");
|
|
874
881
|
const book = createWorkbook({
|
|
875
882
|
...dateSystem === void 0 ? {} : { dateSystem },
|
|
876
|
-
...o.has("properties") ? { properties: o.get("properties") } : {}
|
|
883
|
+
...o.has("properties") ? { properties: o.get("properties") } : {},
|
|
884
|
+
...o.has("defaultFont") ? { defaultFont: o.get("defaultFont") } : {}
|
|
877
885
|
});
|
|
878
886
|
if (o.has("protection")) book.protect(o.get("protection"));
|
|
879
887
|
if (o.has("views")) book.views(o.get("views"));
|
|
@@ -952,6 +960,7 @@ function writeWorkbookStream(options) {
|
|
|
952
960
|
"tables",
|
|
953
961
|
"images",
|
|
954
962
|
"background",
|
|
963
|
+
"charts",
|
|
955
964
|
"rows"
|
|
956
965
|
], `sheets[${String(i)}]`);
|
|
957
966
|
const state = s.get("state");
|
|
@@ -1058,6 +1067,7 @@ function writeWorkbookStream(options) {
|
|
|
1058
1067
|
sheet.addImage(image, anchor, options);
|
|
1059
1068
|
}
|
|
1060
1069
|
if (s.has("background")) sheet.background(s.get("background"));
|
|
1070
|
+
for (const v of listOf("charts", "{ type: \"column\", anchor: \"E2:L18\", series: [{ values: \"Data!B2:B13\" }] }")) sheet.addChart(v);
|
|
1061
1071
|
return {
|
|
1062
1072
|
spec: raw,
|
|
1063
1073
|
sheet,
|
|
@@ -1074,6 +1084,12 @@ function writeWorkbookStream(options) {
|
|
|
1074
1084
|
const prepared = dynamic ? [] : specs.map(prepare);
|
|
1075
1085
|
if (!dynamic && !prepared.some((p) => p.sheet.state === "visible")) throw noVisibleSheet();
|
|
1076
1086
|
if (!dynamic) addNames();
|
|
1087
|
+
if (!dynamic) {
|
|
1088
|
+
const lookup = chartSheetNames(prepared.map((q) => q.sheet.name));
|
|
1089
|
+
for (const p of prepared) for (const c of p.sheet.chartList) resolveChartSheets(c.chart, lookup, p.sheet.name);
|
|
1090
|
+
}
|
|
1091
|
+
/** Charts in workbook order (CH-01); their parts are written once every sheet name is known. */
|
|
1092
|
+
const chartQueue = [];
|
|
1077
1093
|
const strings = shared ? createSharedStrings() : null;
|
|
1078
1094
|
const styleCache = /* @__PURE__ */ new WeakMap();
|
|
1079
1095
|
const dateStyle = /* @__PURE__ */ new Map();
|
|
@@ -1120,6 +1136,7 @@ function writeWorkbookStream(options) {
|
|
|
1120
1136
|
"values",
|
|
1121
1137
|
"style",
|
|
1122
1138
|
"styles",
|
|
1139
|
+
"rowStyle",
|
|
1123
1140
|
"height",
|
|
1124
1141
|
"hidden",
|
|
1125
1142
|
"outlineLevel",
|
|
@@ -1143,6 +1160,7 @@ function writeWorkbookStream(options) {
|
|
|
1143
1160
|
"outlineLevel",
|
|
1144
1161
|
"collapsed"
|
|
1145
1162
|
]) if (ro.get(key) !== void 0) format[key] = ro.get(key);
|
|
1163
|
+
if (ro.get("rowStyle") !== void 0) format.style = ro.get("rowStyle");
|
|
1146
1164
|
if (Object.keys(format).length > 0) {
|
|
1147
1165
|
p.sheet.row(r, format);
|
|
1148
1166
|
info = p.sheet.rowMap.get(r);
|
|
@@ -1228,7 +1246,19 @@ function writeWorkbookStream(options) {
|
|
|
1228
1246
|
conditionalFormats: p.sheet.conditionalList,
|
|
1229
1247
|
dataValidations: p.sheet.validationList
|
|
1230
1248
|
}, n);
|
|
1231
|
-
const
|
|
1249
|
+
const frames = p.sheet.chartList.map((c) => {
|
|
1250
|
+
chartQueue.push({
|
|
1251
|
+
chart: c.chart,
|
|
1252
|
+
sheet: p.sheet.name
|
|
1253
|
+
});
|
|
1254
|
+
return {
|
|
1255
|
+
...resolveAnchor(c.anchor, metricsOf(p.sheet.columnMap, p.sheet.rowMap)),
|
|
1256
|
+
name: c.chart.name,
|
|
1257
|
+
description: c.chart.description,
|
|
1258
|
+
target: `../charts/chart${String(chartQueue.length)}.xml`
|
|
1259
|
+
};
|
|
1260
|
+
});
|
|
1261
|
+
const drawing = drawingParts(p.sheet.imageList.map((i) => resolveImage(i, metricsOf(p.sheet.columnMap, p.sheet.rowMap))), p.sheet.backgroundImage, media, ++drawingCount, p.rels, frames);
|
|
1232
1262
|
if (drawing.part === null) drawingCount--;
|
|
1233
1263
|
p.drawing = drawing.part;
|
|
1234
1264
|
const sheetTables = tableParts(p.sheet.tableList, tableCount + 1, p.rels);
|
|
@@ -1288,7 +1318,7 @@ function writeWorkbookStream(options) {
|
|
|
1288
1318
|
};
|
|
1289
1319
|
yield {
|
|
1290
1320
|
name: "xl/styles.xml",
|
|
1291
|
-
data: encoder.encode(buildStyles(book.styles(), true, book.dxfStyles()).xml)
|
|
1321
|
+
data: encoder.encode(buildStyles(book.styles(), true, book.dxfStyles(), book.fontDefault).xml)
|
|
1292
1322
|
};
|
|
1293
1323
|
if (core !== null) yield {
|
|
1294
1324
|
name: CORE_PROPERTIES_PART,
|
|
@@ -1345,10 +1375,16 @@ function writeWorkbookStream(options) {
|
|
|
1345
1375
|
if (prepared.length === 0) throw new XlvError("XLV_E_INVALID_INPUT", "The workbook has no sheets.", { hint: "Add at least one sheet before closing the stream." });
|
|
1346
1376
|
if (!selected) throw noVisibleSheet();
|
|
1347
1377
|
if (dynamic) addNames();
|
|
1378
|
+
const names = chartSheetNames(prepared.map((p) => p.sheet.name));
|
|
1379
|
+
const chartParts = chartQueue.map((c, k) => ({
|
|
1380
|
+
name: chartPartName(k + 1),
|
|
1381
|
+
xml: chartPartXml(resolveChartSheets(c.chart, names, c.sheet), null)
|
|
1382
|
+
}));
|
|
1348
1383
|
const app = appXml() !== null;
|
|
1349
1384
|
const overrides = [
|
|
1350
1385
|
...tableTypes(),
|
|
1351
1386
|
...prepared.flatMap((p) => p.drawing === null ? [] : [[p.drawing.name, DRAWING_CONTENT_TYPE]]),
|
|
1387
|
+
...chartParts.map((c) => [c.name, CHART_CONTENT_TYPE]),
|
|
1352
1388
|
...media.entries().map((m) => [m.name, IMAGE_CONTENT_TYPES[m.name.slice(m.name.lastIndexOf(".") + 1)]])
|
|
1353
1389
|
];
|
|
1354
1390
|
yield {
|
|
@@ -1360,6 +1396,10 @@ function writeWorkbookStream(options) {
|
|
|
1360
1396
|
data: encoder.encode(rootRelsXml(core !== null, app))
|
|
1361
1397
|
};
|
|
1362
1398
|
yield* media.entries();
|
|
1399
|
+
for (const c of chartParts) yield {
|
|
1400
|
+
name: c.name,
|
|
1401
|
+
data: encoder.encode(c.xml)
|
|
1402
|
+
};
|
|
1363
1403
|
yield* closingParts();
|
|
1364
1404
|
}
|
|
1365
1405
|
return createZipStream(entries(), level);
|