document-cli 1.12.7 → 1.13.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,9 +1,9 @@
|
|
|
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-CNpUdKwi.js";
|
|
3
3
|
import { Command, CommanderError, InvalidArgumentError } from "commander";
|
|
4
4
|
import { writeFile } from "node:fs/promises";
|
|
5
|
+
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
5
6
|
import { HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, OdbNoEmbeddedDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdmUnresolvedSectionError, PdfEncryptedError, PdfParseError, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, buildDocumentBytes, createLocalDocumentConverter, decodeOdbPackage, decodePackage, documentFromJson, documentPackageWithSchema, evaluateSelect, extractSourceFontsForFormat, hsqldbCellDisplayText, layoutDocumentWithSchema, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
6
|
-
import { basename, dirname, extname, join } from "node:path";
|
|
7
7
|
import { existsSync, readFileSync } from "node:fs";
|
|
8
8
|
//#region src/runtime/abort.ts
|
|
9
9
|
function combineSignals(a, b) {
|
|
@@ -120,6 +120,18 @@ function mapErrorToExit(error, abortReason) {
|
|
|
120
120
|
return 1;
|
|
121
121
|
}
|
|
122
122
|
//#endregion
|
|
123
|
+
//#region src/runtime/markdown-images.ts
|
|
124
|
+
function createFilesystemMarkdownImageResolver(baseDir) {
|
|
125
|
+
return (destination) => {
|
|
126
|
+
if (destination.length === 0 || /^data:/i.test(destination) || /^[a-z][a-z0-9+.-]*:\/\//i.test(destination)) return;
|
|
127
|
+
try {
|
|
128
|
+
return { bytes: new Uint8Array(readFileSync(resolve(baseDir, destination))) };
|
|
129
|
+
} catch {
|
|
130
|
+
return;
|
|
131
|
+
}
|
|
132
|
+
};
|
|
133
|
+
}
|
|
134
|
+
//#endregion
|
|
123
135
|
//#region src/commands/shared.ts
|
|
124
136
|
const KNOWN_DOCUMENT_FORMATS = "docx, pptx, xlsx, odt, odp, ods, odg, odf, markdown, pdf";
|
|
125
137
|
function resolveTargetFormat(output, out, to) {
|
|
@@ -163,7 +175,8 @@ function buildConversionAction(source, target) {
|
|
|
163
175
|
json: options.json,
|
|
164
176
|
quiet: options.quiet,
|
|
165
177
|
command
|
|
166
|
-
}) : void 0
|
|
178
|
+
}) : void 0,
|
|
179
|
+
images: createFilesystemMarkdownImageResolver(input === "-" ? "." : dirname(resolve(input)))
|
|
167
180
|
});
|
|
168
181
|
await writeOutput(resolvedOutput, result.document.bytes);
|
|
169
182
|
const reporter = createDiagnosticReporter({
|
|
@@ -1046,7 +1059,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1046
1059
|
}
|
|
1047
1060
|
//#endregion
|
|
1048
1061
|
//#region package.json
|
|
1049
|
-
var version = "1.
|
|
1062
|
+
var version = "1.13.0";
|
|
1050
1063
|
//#endregion
|
|
1051
1064
|
//#region src/program.ts
|
|
1052
1065
|
function createProgram() {
|
|
@@ -1073,7 +1086,7 @@ function createProgram() {
|
|
|
1073
1086
|
//#region src/cli.ts
|
|
1074
1087
|
async function launchTui(startPath, signal) {
|
|
1075
1088
|
try {
|
|
1076
|
-
const { runTui } = await import("./tui-
|
|
1089
|
+
const { runTui } = await import("./tui-h7lEAPtd.js");
|
|
1077
1090
|
await runTui({
|
|
1078
1091
|
startPath,
|
|
1079
1092
|
signal
|
package/dist/index.cjs
CHANGED
|
@@ -1,10 +1,10 @@
|
|
|
1
1
|
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
2
|
let node_fs_promises = require("node:fs/promises");
|
|
3
|
+
let node_path = require("node:path");
|
|
3
4
|
let documents_js = require("documents.js");
|
|
4
5
|
let pdf_codec = require("pdf-codec");
|
|
5
|
-
let node_path = require("node:path");
|
|
6
|
-
let commander = require("commander");
|
|
7
6
|
let node_fs = require("node:fs");
|
|
7
|
+
let commander = require("commander");
|
|
8
8
|
//#region src/format.ts
|
|
9
9
|
const EXTENSION_TO_FORMAT = {
|
|
10
10
|
docx: "docx",
|
|
@@ -196,6 +196,18 @@ async function loadProvidedFonts(paths, options) {
|
|
|
196
196
|
return fonts;
|
|
197
197
|
}
|
|
198
198
|
//#endregion
|
|
199
|
+
//#region src/runtime/markdown-images.ts
|
|
200
|
+
function createFilesystemMarkdownImageResolver(baseDir) {
|
|
201
|
+
return (destination) => {
|
|
202
|
+
if (destination.length === 0 || /^data:/i.test(destination) || /^[a-z][a-z0-9+.-]*:\/\//i.test(destination)) return;
|
|
203
|
+
try {
|
|
204
|
+
return { bytes: new Uint8Array((0, node_fs.readFileSync)((0, node_path.resolve)(baseDir, destination))) };
|
|
205
|
+
} catch {
|
|
206
|
+
return;
|
|
207
|
+
}
|
|
208
|
+
};
|
|
209
|
+
}
|
|
210
|
+
//#endregion
|
|
199
211
|
//#region src/runtime/io.ts
|
|
200
212
|
function isUint8Array(value) {
|
|
201
213
|
return value instanceof Uint8Array;
|
|
@@ -278,7 +290,8 @@ function buildConversionAction(source, target) {
|
|
|
278
290
|
json: options.json,
|
|
279
291
|
quiet: options.quiet,
|
|
280
292
|
command
|
|
281
|
-
}) : void 0
|
|
293
|
+
}) : void 0,
|
|
294
|
+
images: createFilesystemMarkdownImageResolver(input === "-" ? "." : (0, node_path.dirname)((0, node_path.resolve)(input)))
|
|
282
295
|
});
|
|
283
296
|
await writeOutput(resolvedOutput, result.document.bytes);
|
|
284
297
|
const reporter = createDiagnosticReporter({
|
|
@@ -1375,7 +1388,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1375
1388
|
}
|
|
1376
1389
|
//#endregion
|
|
1377
1390
|
//#region package.json
|
|
1378
|
-
var version = "1.
|
|
1391
|
+
var version = "1.13.0";
|
|
1379
1392
|
//#endregion
|
|
1380
1393
|
//#region src/program.ts
|
|
1381
1394
|
function createProgram() {
|
package/dist/index.js
CHANGED
|
@@ -1,9 +1,9 @@
|
|
|
1
1
|
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, extname, join, resolve } from "node:path";
|
|
2
3
|
import { HsqldbSqlEvaluationError, HsqldbSqlParseError, HsqldbSqlUnsupportedError, OdbNoEmbeddedDataSourceError, OdbReportNotSpecifiedError, OdbTableNotFoundError, OdbTableNotSpecifiedError, OdbUnsupportedFormatError, OdmUnresolvedSectionError, PdfEncryptedError, PdfParseError, UnrecognizedDocumentSchemaError, UnsupportedFontSourceFormatError, buildDocumentBytes, createLocalDocumentConverter, decodeOdbPackage, decodePackage, documentFromJson, documentPackageWithSchema, evaluateSelect, extractSourceFontsForFormat, hsqldbCellDisplayText, layoutDocumentWithSchema, odbReportToDocx, odbReportToOdt, odbReportToPdf, odbToCsv, odbToXlsx, odmToPdf, parseSelect, readDocumentMetadata, readDocxExtras, readOdbForms, readOdbInventory, readOdbReportContent, readOdbReports, readOdbTables, readPdf, setDocumentMetadata } from "documents.js";
|
|
3
4
|
import { readFontFace } from "pdf-codec";
|
|
4
|
-
import { basename, dirname, extname, join } from "node:path";
|
|
5
|
-
import { Command, InvalidArgumentError } from "commander";
|
|
6
5
|
import { existsSync, readFileSync } from "node:fs";
|
|
6
|
+
import { Command, InvalidArgumentError } from "commander";
|
|
7
7
|
//#region src/format.ts
|
|
8
8
|
const EXTENSION_TO_FORMAT = {
|
|
9
9
|
docx: "docx",
|
|
@@ -195,6 +195,18 @@ async function loadProvidedFonts(paths, options) {
|
|
|
195
195
|
return fonts;
|
|
196
196
|
}
|
|
197
197
|
//#endregion
|
|
198
|
+
//#region src/runtime/markdown-images.ts
|
|
199
|
+
function createFilesystemMarkdownImageResolver(baseDir) {
|
|
200
|
+
return (destination) => {
|
|
201
|
+
if (destination.length === 0 || /^data:/i.test(destination) || /^[a-z][a-z0-9+.-]*:\/\//i.test(destination)) return;
|
|
202
|
+
try {
|
|
203
|
+
return { bytes: new Uint8Array(readFileSync(resolve(baseDir, destination))) };
|
|
204
|
+
} catch {
|
|
205
|
+
return;
|
|
206
|
+
}
|
|
207
|
+
};
|
|
208
|
+
}
|
|
209
|
+
//#endregion
|
|
198
210
|
//#region src/runtime/io.ts
|
|
199
211
|
function isUint8Array(value) {
|
|
200
212
|
return value instanceof Uint8Array;
|
|
@@ -277,7 +289,8 @@ function buildConversionAction(source, target) {
|
|
|
277
289
|
json: options.json,
|
|
278
290
|
quiet: options.quiet,
|
|
279
291
|
command
|
|
280
|
-
}) : void 0
|
|
292
|
+
}) : void 0,
|
|
293
|
+
images: createFilesystemMarkdownImageResolver(input === "-" ? "." : dirname(resolve(input)))
|
|
281
294
|
});
|
|
282
295
|
await writeOutput(resolvedOutput, result.document.bytes);
|
|
283
296
|
const reporter = createDiagnosticReporter({
|
|
@@ -1374,7 +1387,7 @@ function registerSetMetadataCommand(program) {
|
|
|
1374
1387
|
}
|
|
1375
1388
|
//#endregion
|
|
1376
1389
|
//#region package.json
|
|
1377
|
-
var version = "1.
|
|
1390
|
+
var version = "1.13.0";
|
|
1378
1391
|
//#endregion
|
|
1379
1392
|
//#region src/program.ts
|
|
1380
1393
|
function createProgram() {
|
|
@@ -1,7 +1,7 @@
|
|
|
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-CNpUdKwi.js";
|
|
2
2
|
import { readFile, writeFile } from "node:fs/promises";
|
|
3
|
-
import { bytesToBase64, createDocx, createOdg, createOdp, createOds, createOdt, createPdf, createPptx, 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, xlsxToPdf } from "documents.js";
|
|
4
3
|
import { basename, dirname, extname, join } from "node:path";
|
|
4
|
+
import { bytesToBase64, createDocx, createOdg, createOdp, createOds, createOdt, createPdf, createPptx, 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, xlsxToPdf } from "documents.js";
|
|
5
5
|
import { readdirSync } from "node:fs";
|
|
6
6
|
import { Box, Text, render, useApp, useInput, useWindowSize } from "ink";
|
|
7
7
|
import { createContext, useContext, useEffect, useReducer, useState } from "react";
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "document-cli",
|
|
3
|
-
"version": "1.
|
|
3
|
+
"version": "1.13.0",
|
|
4
4
|
"description": "CLI and interactive Ink TUI for documents.js: every docx/pptx/odt/odp/ods/odg/odf/pdf/odm/odb/xlsx/markdown conversion, bridge, and editor as a scriptable command or a terminal app.",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"repository": {
|
|
@@ -72,7 +72,7 @@
|
|
|
72
72
|
"packageManager": "pnpm@11.6.0",
|
|
73
73
|
"dependencies": {
|
|
74
74
|
"commander": "^15.0.0",
|
|
75
|
-
"documents.js": "^1.
|
|
75
|
+
"documents.js": "^1.90.0",
|
|
76
76
|
"ink": "^7.1.1",
|
|
77
77
|
"ink-text-input": "^6.0.0",
|
|
78
78
|
"odf.js": "^2.4.1",
|
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
import { readFile, writeFile } from "node:fs/promises";
|
|
2
|
+
import { basename, dirname, extname, join } from "node:path";
|
|
2
3
|
import "documents.js";
|
|
3
4
|
import { readFontFace } from "pdf-codec";
|
|
4
|
-
import { basename, dirname, extname, join } from "node:path";
|
|
5
5
|
//#region src/format.ts
|
|
6
6
|
const EXTENSION_TO_FORMAT = {
|
|
7
7
|
docx: "docx",
|