document-cli 3.2.14 → 4.0.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/dist/cli.js
CHANGED
|
@@ -1,5 +1,5 @@
|
|
|
1
1
|
#!/usr/bin/env node
|
|
2
|
-
import { a as odbFormSummary, c as formatDocxExtrasLines, d as writeOutput, f as loadProvidedFonts, h as isDocumentFormat, i as formatOdbReportLines, l as readInput, m as inferFormatFromExtension, n as describeOdbReport, o as formatMetadataLines, r as formatOdbFormLines, s as presentMetadataEntries, t as describeOdbForm, u as resolveDefaultOutputPath } from "./odb-structure-
|
|
2
|
+
import { a as odbFormSummary, c as formatDocxExtrasLines, d as writeOutput, f as loadProvidedFonts, h as isDocumentFormat, i as formatOdbReportLines, l as readInput, m as inferFormatFromExtension, n as describeOdbReport, o as formatMetadataLines, r as formatOdbFormLines, s as presentMetadataEntries, t as describeOdbForm, u as resolveDefaultOutputPath } from "./odb-structure-CrwHiiuS.js";
|
|
3
3
|
import { Command, CommanderError, InvalidArgumentError } from "commander";
|
|
4
4
|
import { writeFile } from "node:fs/promises";
|
|
5
5
|
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
@@ -1204,7 +1204,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1204
1204
|
}
|
|
1205
1205
|
//#endregion
|
|
1206
1206
|
//#region package.json
|
|
1207
|
-
var version = "
|
|
1207
|
+
var version = "4.0.0";
|
|
1208
1208
|
//#endregion
|
|
1209
1209
|
//#region src/program.ts
|
|
1210
1210
|
function createProgram() {
|
|
@@ -1232,7 +1232,7 @@ function createProgram() {
|
|
|
1232
1232
|
//#region src/cli.ts
|
|
1233
1233
|
async function launchTui(startPath, signal) {
|
|
1234
1234
|
try {
|
|
1235
|
-
const { runTui } = await import("./tui-
|
|
1235
|
+
const { runTui } = await import("./tui-B85Sb2t2.js");
|
|
1236
1236
|
await runTui({
|
|
1237
1237
|
startPath,
|
|
1238
1238
|
signal
|
package/dist/index.cjs
CHANGED
|
@@ -457,9 +457,15 @@ function footnotesSection(footnotes) {
|
|
|
457
457
|
if (footnotes.length === 0) return [];
|
|
458
458
|
return ["footnotes", ...footnotes.map((footnote, index) => footnoteLine(footnote, index + 1))];
|
|
459
459
|
}
|
|
460
|
-
function
|
|
461
|
-
|
|
462
|
-
|
|
460
|
+
function partText(blocks) {
|
|
461
|
+
let text = "";
|
|
462
|
+
for (const block of blocks) if (block.kind === "paragraph") text += block.runs.map((run) => run.text).join("");
|
|
463
|
+
else if (block.kind === "table") for (const row of block.rows) for (const cell of row.cells) text += partText(cell.blocks);
|
|
464
|
+
return text;
|
|
465
|
+
}
|
|
466
|
+
function headerOrFooterSection(label, parts) {
|
|
467
|
+
if (parts.length === 0) return [];
|
|
468
|
+
return [label, ...parts.map((part, index) => `${indent$1(1)}[${index + 1}] ${partText(part.blocks)}`)];
|
|
463
469
|
}
|
|
464
470
|
function numberingLevelLine(ilvl, level) {
|
|
465
471
|
const restartSuffix = level.restart === void 0 ? "" : `, restarts at level ${level.restart}`;
|
|
@@ -486,8 +492,8 @@ function formatDocxExtrasLines(extras) {
|
|
|
486
492
|
const nonEmptySections = [
|
|
487
493
|
commentsSection(extras.comments),
|
|
488
494
|
footnotesSection(extras.footnotes),
|
|
489
|
-
headerOrFooterSection("headers", extras.
|
|
490
|
-
headerOrFooterSection("footers", extras.
|
|
495
|
+
headerOrFooterSection("headers", extras.headerFooterParts.filter((part) => part.kind === "header")),
|
|
496
|
+
headerOrFooterSection("footers", extras.headerFooterParts.filter((part) => part.kind === "footer")),
|
|
491
497
|
numberingSection(extras.numbering)
|
|
492
498
|
].filter((section) => section.length > 0);
|
|
493
499
|
if (nonEmptySections.length === 0) return ["This document carries no comments, footnotes, headers, footers, or numbering definitions."];
|
|
@@ -1536,7 +1542,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1536
1542
|
}
|
|
1537
1543
|
//#endregion
|
|
1538
1544
|
//#region package.json
|
|
1539
|
-
var version = "
|
|
1545
|
+
var version = "4.0.0";
|
|
1540
1546
|
//#endregion
|
|
1541
1547
|
//#region src/program.ts
|
|
1542
1548
|
function createProgram() {
|
package/dist/index.js
CHANGED
|
@@ -456,9 +456,15 @@ function footnotesSection(footnotes) {
|
|
|
456
456
|
if (footnotes.length === 0) return [];
|
|
457
457
|
return ["footnotes", ...footnotes.map((footnote, index) => footnoteLine(footnote, index + 1))];
|
|
458
458
|
}
|
|
459
|
-
function
|
|
460
|
-
|
|
461
|
-
|
|
459
|
+
function partText(blocks) {
|
|
460
|
+
let text = "";
|
|
461
|
+
for (const block of blocks) if (block.kind === "paragraph") text += block.runs.map((run) => run.text).join("");
|
|
462
|
+
else if (block.kind === "table") for (const row of block.rows) for (const cell of row.cells) text += partText(cell.blocks);
|
|
463
|
+
return text;
|
|
464
|
+
}
|
|
465
|
+
function headerOrFooterSection(label, parts) {
|
|
466
|
+
if (parts.length === 0) return [];
|
|
467
|
+
return [label, ...parts.map((part, index) => `${indent$1(1)}[${index + 1}] ${partText(part.blocks)}`)];
|
|
462
468
|
}
|
|
463
469
|
function numberingLevelLine(ilvl, level) {
|
|
464
470
|
const restartSuffix = level.restart === void 0 ? "" : `, restarts at level ${level.restart}`;
|
|
@@ -485,8 +491,8 @@ function formatDocxExtrasLines(extras) {
|
|
|
485
491
|
const nonEmptySections = [
|
|
486
492
|
commentsSection(extras.comments),
|
|
487
493
|
footnotesSection(extras.footnotes),
|
|
488
|
-
headerOrFooterSection("headers", extras.
|
|
489
|
-
headerOrFooterSection("footers", extras.
|
|
494
|
+
headerOrFooterSection("headers", extras.headerFooterParts.filter((part) => part.kind === "header")),
|
|
495
|
+
headerOrFooterSection("footers", extras.headerFooterParts.filter((part) => part.kind === "footer")),
|
|
490
496
|
numberingSection(extras.numbering)
|
|
491
497
|
].filter((section) => section.length > 0);
|
|
492
498
|
if (nonEmptySections.length === 0) return ["This document carries no comments, footnotes, headers, footers, or numbering definitions."];
|
|
@@ -1535,7 +1541,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1535
1541
|
}
|
|
1536
1542
|
//#endregion
|
|
1537
1543
|
//#region package.json
|
|
1538
|
-
var version = "
|
|
1544
|
+
var version = "4.0.0";
|
|
1539
1545
|
//#endregion
|
|
1540
1546
|
//#region src/program.ts
|
|
1541
1547
|
function createProgram() {
|
|
@@ -133,9 +133,15 @@ function footnotesSection(footnotes) {
|
|
|
133
133
|
if (footnotes.length === 0) return [];
|
|
134
134
|
return ["footnotes", ...footnotes.map((footnote, index) => footnoteLine(footnote, index + 1))];
|
|
135
135
|
}
|
|
136
|
-
function
|
|
137
|
-
|
|
138
|
-
|
|
136
|
+
function partText(blocks) {
|
|
137
|
+
let text = "";
|
|
138
|
+
for (const block of blocks) if (block.kind === "paragraph") text += block.runs.map((run) => run.text).join("");
|
|
139
|
+
else if (block.kind === "table") for (const row of block.rows) for (const cell of row.cells) text += partText(cell.blocks);
|
|
140
|
+
return text;
|
|
141
|
+
}
|
|
142
|
+
function headerOrFooterSection(label, parts) {
|
|
143
|
+
if (parts.length === 0) return [];
|
|
144
|
+
return [label, ...parts.map((part, index) => `${indent$1(1)}[${index + 1}] ${partText(part.blocks)}`)];
|
|
139
145
|
}
|
|
140
146
|
function numberingLevelLine(ilvl, level) {
|
|
141
147
|
const restartSuffix = level.restart === void 0 ? "" : `, restarts at level ${level.restart}`;
|
|
@@ -162,8 +168,8 @@ function formatDocxExtrasLines(extras) {
|
|
|
162
168
|
const nonEmptySections = [
|
|
163
169
|
commentsSection(extras.comments),
|
|
164
170
|
footnotesSection(extras.footnotes),
|
|
165
|
-
headerOrFooterSection("headers", extras.
|
|
166
|
-
headerOrFooterSection("footers", extras.
|
|
171
|
+
headerOrFooterSection("headers", extras.headerFooterParts.filter((part) => part.kind === "header")),
|
|
172
|
+
headerOrFooterSection("footers", extras.headerFooterParts.filter((part) => part.kind === "footer")),
|
|
167
173
|
numberingSection(extras.numbering)
|
|
168
174
|
].filter((section) => section.length > 0);
|
|
169
175
|
if (nonEmptySections.length === 0) return ["This document carries no comments, footnotes, headers, footers, or numbering definitions."];
|
|
@@ -1,4 +1,4 @@
|
|
|
1
|
-
import { c as formatDocxExtrasLines, f as loadProvidedFonts, i as formatOdbReportLines, l as readInput, m as inferFormatFromExtension, n as describeOdbReport, o as formatMetadataLines, p as formatToExtension, r as formatOdbFormLines, t as describeOdbForm } from "./odb-structure-
|
|
1
|
+
import { c as formatDocxExtrasLines, f as loadProvidedFonts, i as formatOdbReportLines, l as readInput, m as inferFormatFromExtension, n as describeOdbReport, o as formatMetadataLines, p as formatToExtension, r as formatOdbFormLines, t as describeOdbForm } from "./odb-structure-CrwHiiuS.js";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
3
|
import { basename, dirname, extname, join } from "node:path";
|
|
4
4
|
import { bytesToBase64, cellReference, columnIndexToLetters, createDocx, createOdg, createOdp, createOds, createOdt, createPdf, createPptx, csvToPdf, decodeMarkdownText, decodeOdbPackage, docxToPdf, encodeMarkdownText, hsqldbCellDisplayText, markdownToPdf, odbReportToDocx, odbReportToOdt, odbReportToPdf, odgToPdf, odpToPdf, odsToPdf, odtToPdf, openDocx, openMarkdown, openOdg, openOdp, openOds, openOdt, openPdf, openPptx, parseXml, pptxToPdf, readDocxContent, readDocxExtras, readMarkdownContent, readOdbForms, readOdbReportContent, readOdbReports, readOdbTables, readOdgContent, readOdpContent, readOdsContent, readOdtContent, readPdf, readPptxContent, rgbHexToColor, svgToPdf, xlsxToPdf } from "documents.js";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-cli",
|
|
3
|
-
"version": "
|
|
3
|
+
"version": "4.0.0",
|
|
4
4
|
"description": "CLI and interactive Ink TUI for documents.js: every docx/pptx/odt/odp/ods/odg/odf/pdf/odm/odb/xlsx/csv/svg/markdown conversion, bridge, and editor as a scriptable command or a terminal app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -90,9 +90,9 @@
|
|
|
90
90
|
"packageManager": "pnpm@11.6.0",
|
|
91
91
|
"dependencies": {
|
|
92
92
|
"commander": "^15.0.0",
|
|
93
|
-
"document-outline.js": "^
|
|
93
|
+
"document-outline.js": "^2.0.0",
|
|
94
94
|
"document-schema.js": "^4.9.0",
|
|
95
|
-
"documents.js": "^
|
|
95
|
+
"documents.js": "^5.0.0",
|
|
96
96
|
"ink": "^7.1.1",
|
|
97
97
|
"ink-text-input": "^6.0.0",
|
|
98
98
|
"react": "^19.2.8"
|