@deepseek-ai/libreoffice-kit 0.1.1 → 0.1.2
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 -1
- package/README.zh.md +3 -1
- package/lib/cli.js +14 -7
- package/lib/index.js +15 -8
- package/lib/types/engine.d.ts +4 -5
- package/lib/types/index.d.ts +1 -1
- package/lib/types/runtime.d.ts +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -6,12 +6,14 @@ Convert, recalculate, and directly render local Office documents with prebuilt L
|
|
|
6
6
|
|
|
7
7
|
Binary `.doc`, `.xls`, and `.ppt` inputs must be OLE compound documents, such as Office 97–2003 files. Renamed RTF/HTML and `.wps` inputs are unsupported. `missingFonts` is empty for binary inputs because their font tables are interpreted by LibreOffice rather than the OOXML inspector.
|
|
8
8
|
|
|
9
|
+
The Node API version is independent of its platform engine versions. Version 0.1.2 uses Windows engines 0.1.2 and retains macOS/WASM engines 0.1.1. `ENGINE_VERSION` and `discoverRuntime().version` identify the Node API; `ENGINE_VERSIONS` lists the exact compatible engine versions.
|
|
10
|
+
|
|
9
11
|
## Installation and usage
|
|
10
12
|
|
|
11
13
|
Install with Node.js 22.19.0 or newer:
|
|
12
14
|
|
|
13
15
|
```sh
|
|
14
|
-
npm install @deepseek-ai/libreoffice-kit@0.1.
|
|
16
|
+
npm install @deepseek-ai/libreoffice-kit@0.1.2
|
|
15
17
|
```
|
|
16
18
|
|
|
17
19
|
npm installs the matching native engine on macOS/Windows ARM64 or x64, and the shared WASM engine on Linux. macOS and Windows require their native package; a missing or invalid package rejects `createConverter` with `unavailable`, without switching to WASM. Linux uses WASM unless a compatible development native package was installed explicitly. Conversion failures never switch engines.
|
package/README.zh.md
CHANGED
|
@@ -6,12 +6,14 @@
|
|
|
6
6
|
|
|
7
7
|
二进制 `.doc`、`.xls`、`.ppt` 输入必须是 OLE 复合文档,例如 Office 97–2003 文件。不支持改后缀的 RTF/HTML 和 `.wps`。二进制输入的 `missingFonts` 为空,因为其字体表由 LibreOffice 读取,而不是由 OOXML 检查器读取。
|
|
8
8
|
|
|
9
|
+
Node API 与各平台引擎独立指定版本。0.1.2 使用 Windows 引擎 0.1.2,保留 macOS/WASM 引擎 0.1.1。`ENGINE_VERSION` 和 `discoverRuntime().version` 表示 Node API 版本;`ENGINE_VERSIONS` 列出各平台兼容的精确引擎版本。
|
|
10
|
+
|
|
9
11
|
## 安装与使用
|
|
10
12
|
|
|
11
13
|
使用 Node.js 22.19.0 或更新版本安装:
|
|
12
14
|
|
|
13
15
|
```sh
|
|
14
|
-
npm install @deepseek-ai/libreoffice-kit@0.1.
|
|
16
|
+
npm install @deepseek-ai/libreoffice-kit@0.1.2
|
|
15
17
|
```
|
|
16
18
|
|
|
17
19
|
npm 在 macOS/Windows ARM64 或 x64 上安装匹配的原生引擎,在 Linux 上安装共享 WASM 引擎。macOS 和 Windows 必须具有对应原生包;包缺失或无效时,`createConverter` 以 `unavailable` 拒绝,不会切换到 WASM。Linux 使用 WASM,除非显式安装了兼容的原生开发包。转换失败不会切换引擎。
|
package/lib/cli.js
CHANGED
|
@@ -1211,11 +1211,18 @@ function resolveOptions(input = {}) {
|
|
|
1211
1211
|
//#region lib/types/engine.js
|
|
1212
1212
|
/** Resolve installed, version-matched engine packages without downloads or compilation. */
|
|
1213
1213
|
const require = createRequire(import.meta.url);
|
|
1214
|
-
/**
|
|
1215
|
-
|
|
1216
|
-
|
|
1217
|
-
|
|
1218
|
-
|
|
1214
|
+
/** Node API release version returned by runtime discovery. */
|
|
1215
|
+
const ENGINE_VERSION = "0.1.2";
|
|
1216
|
+
/** Exact compatible engine versions; unchanged platforms retain their published packages. */
|
|
1217
|
+
const ENGINE_VERSIONS = Object.freeze({
|
|
1218
|
+
"darwin-arm64": "0.1.1",
|
|
1219
|
+
"darwin-x64": "0.1.1",
|
|
1220
|
+
"linux-arm64-glibc": "0.1.1",
|
|
1221
|
+
"linux-x64-glibc": "0.1.1",
|
|
1222
|
+
"win32-arm64": "0.1.2",
|
|
1223
|
+
"win32-x64": "0.1.2",
|
|
1224
|
+
wasm: "0.1.1"
|
|
1225
|
+
});
|
|
1219
1226
|
/** npm scope and name prefix shared by the engine packages this adapter installs. */
|
|
1220
1227
|
const ENGINE_PREFIX = "@deepseek-ai/libreoffice-kit";
|
|
1221
1228
|
/**
|
|
@@ -1294,7 +1301,7 @@ async function readEngine(packageFile, backend, target) {
|
|
|
1294
1301
|
const root = dirname(packageFile);
|
|
1295
1302
|
const [pkg, manifest] = await Promise.all([readFile(packageFile, "utf8").then((text) => JSON.parse(text)), readFile(resolve(root, "prebuilds.json"), "utf8").then((text) => JSON.parse(text))]);
|
|
1296
1303
|
const engine = manifest.engine;
|
|
1297
|
-
if (pkg.name !== `${ENGINE_PREFIX}-${target}` || pkg.version !==
|
|
1304
|
+
if (pkg.name !== `${ENGINE_PREFIX}-${target}` || pkg.version !== ENGINE_VERSIONS[target] || manifest.version !== pkg.version || manifest.schemaVersion !== 1 || manifest.status !== "built" || engine === void 0 || engine.kind !== backend || manifest.platform !== target) throw new Error(`Installed LibreOfficeKit ${backend} package has an incompatible or incomplete manifest.`);
|
|
1298
1305
|
const minimum = engine.glibcMinimum;
|
|
1299
1306
|
if (minimum !== void 0 && (!target.endsWith("-glibc") || !glibcVersion(minimum))) throw new Error("Installed LibreOfficeKit engine has an invalid glibcMinimum.");
|
|
1300
1307
|
const glibcFloor = minimum === void 0 ? {} : { glibcMinimum: minimum };
|
|
@@ -1412,7 +1419,7 @@ function validateOutput(bytes, format) {
|
|
|
1412
1419
|
/** Offline discovery of the installed engine and public entry points. */
|
|
1413
1420
|
/**
|
|
1414
1421
|
* Inspect installed engine metadata without starting, downloading, or building an engine.
|
|
1415
|
-
* @returns Public entry paths,
|
|
1422
|
+
* @returns Public entry paths, Node API version, and selected backend.
|
|
1416
1423
|
* @throws ConversionError when the installed engine is unavailable or invalid.
|
|
1417
1424
|
*/
|
|
1418
1425
|
async function discoverRuntime() {
|
package/lib/index.js
CHANGED
|
@@ -1209,11 +1209,18 @@ function resolveOptions(input = {}) {
|
|
|
1209
1209
|
//#region lib/types/engine.js
|
|
1210
1210
|
/** Resolve installed, version-matched engine packages without downloads or compilation. */
|
|
1211
1211
|
const require = createRequire(import.meta.url);
|
|
1212
|
-
/**
|
|
1213
|
-
|
|
1214
|
-
|
|
1215
|
-
|
|
1216
|
-
|
|
1212
|
+
/** Node API release version returned by runtime discovery. */
|
|
1213
|
+
const ENGINE_VERSION = "0.1.2";
|
|
1214
|
+
/** Exact compatible engine versions; unchanged platforms retain their published packages. */
|
|
1215
|
+
const ENGINE_VERSIONS = Object.freeze({
|
|
1216
|
+
"darwin-arm64": "0.1.1",
|
|
1217
|
+
"darwin-x64": "0.1.1",
|
|
1218
|
+
"linux-arm64-glibc": "0.1.1",
|
|
1219
|
+
"linux-x64-glibc": "0.1.1",
|
|
1220
|
+
"win32-arm64": "0.1.2",
|
|
1221
|
+
"win32-x64": "0.1.2",
|
|
1222
|
+
wasm: "0.1.1"
|
|
1223
|
+
});
|
|
1217
1224
|
/** npm scope and name prefix shared by the engine packages this adapter installs. */
|
|
1218
1225
|
const ENGINE_PREFIX = "@deepseek-ai/libreoffice-kit";
|
|
1219
1226
|
/**
|
|
@@ -1292,7 +1299,7 @@ async function readEngine(packageFile, backend, target) {
|
|
|
1292
1299
|
const root = dirname(packageFile);
|
|
1293
1300
|
const [pkg, manifest] = await Promise.all([readFile(packageFile, "utf8").then((text) => JSON.parse(text)), readFile(resolve(root, "prebuilds.json"), "utf8").then((text) => JSON.parse(text))]);
|
|
1294
1301
|
const engine = manifest.engine;
|
|
1295
|
-
if (pkg.name !== `${ENGINE_PREFIX}-${target}` || pkg.version !==
|
|
1302
|
+
if (pkg.name !== `${ENGINE_PREFIX}-${target}` || pkg.version !== ENGINE_VERSIONS[target] || manifest.version !== pkg.version || manifest.schemaVersion !== 1 || manifest.status !== "built" || engine === void 0 || engine.kind !== backend || manifest.platform !== target) throw new Error(`Installed LibreOfficeKit ${backend} package has an incompatible or incomplete manifest.`);
|
|
1296
1303
|
const minimum = engine.glibcMinimum;
|
|
1297
1304
|
if (minimum !== void 0 && (!target.endsWith("-glibc") || !glibcVersion(minimum))) throw new Error("Installed LibreOfficeKit engine has an invalid glibcMinimum.");
|
|
1298
1305
|
const glibcFloor = minimum === void 0 ? {} : { glibcMinimum: minimum };
|
|
@@ -1410,7 +1417,7 @@ function validateOutput(bytes, format) {
|
|
|
1410
1417
|
/** Offline discovery of the installed engine and public entry points. */
|
|
1411
1418
|
/**
|
|
1412
1419
|
* Inspect installed engine metadata without starting, downloading, or building an engine.
|
|
1413
|
-
* @returns Public entry paths,
|
|
1420
|
+
* @returns Public entry paths, Node API version, and selected backend.
|
|
1414
1421
|
* @throws ConversionError when the installed engine is unavailable or invalid.
|
|
1415
1422
|
*/
|
|
1416
1423
|
async function discoverRuntime() {
|
|
@@ -1919,4 +1926,4 @@ async function createConverter(options) {
|
|
|
1919
1926
|
return createConverterWith(resolvedOptions, engine, defaultSharedState(resolvedOptions, engine));
|
|
1920
1927
|
}
|
|
1921
1928
|
//#endregion
|
|
1922
|
-
export { CONVERSION_FORMATS, ConversionError, ENGINE_VERSION, IMAGE_FORMATS, createConverter, createConverterFactory, discoverRuntime };
|
|
1929
|
+
export { CONVERSION_FORMATS, ConversionError, ENGINE_VERSION, ENGINE_VERSIONS, IMAGE_FORMATS, createConverter, createConverterFactory, discoverRuntime };
|
package/lib/types/engine.d.ts
CHANGED
|
@@ -1,8 +1,7 @@
|
|
|
1
|
-
/**
|
|
2
|
-
|
|
3
|
-
|
|
4
|
-
|
|
5
|
-
export declare const ENGINE_VERSION = "0.1.1";
|
|
1
|
+
/** Node API release version returned by runtime discovery. */
|
|
2
|
+
export declare const ENGINE_VERSION = "0.1.2";
|
|
3
|
+
/** Exact compatible engine versions; unchanged platforms retain their published packages. */
|
|
4
|
+
export declare const ENGINE_VERSIONS: Readonly<Record<string, string>>;
|
|
6
5
|
/** Host diagnostic fields used to identify the runtime glibc version. */
|
|
7
6
|
export interface EngineHostReport {
|
|
8
7
|
readonly header?: {
|
package/lib/types/index.d.ts
CHANGED
|
@@ -8,7 +8,7 @@ export { discoverRuntime } from './runtime.ts';
|
|
|
8
8
|
export type { RuntimeInfo } from './runtime.ts';
|
|
9
9
|
export { ConversionError } from './errors.ts';
|
|
10
10
|
export type { ConversionErrorCode } from './errors.ts';
|
|
11
|
-
export { ENGINE_VERSION } from './engine.ts';
|
|
11
|
+
export { ENGINE_VERSION, ENGINE_VERSIONS } from './engine.ts';
|
|
12
12
|
/** Host limits used by both native and Node WASM conversions. All byte limits are positive safe integers. */
|
|
13
13
|
export interface ConverterOptions {
|
|
14
14
|
/** User-local font metadata cache directory. Defaults to the platform cache directory; false disables disk reuse. */
|
package/lib/types/runtime.d.ts
CHANGED
|
@@ -7,7 +7,7 @@ export interface RuntimeInfo {
|
|
|
7
7
|
}
|
|
8
8
|
/**
|
|
9
9
|
* Inspect installed engine metadata without starting, downloading, or building an engine.
|
|
10
|
-
* @returns Public entry paths,
|
|
10
|
+
* @returns Public entry paths, Node API version, and selected backend.
|
|
11
11
|
* @throws ConversionError when the installed engine is unavailable or invalid.
|
|
12
12
|
*/
|
|
13
13
|
export declare function discoverRuntime(): Promise<RuntimeInfo>;
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@deepseek-ai/libreoffice-kit",
|
|
3
3
|
"description": "Convert, recalculate, and render Office documents with prebuilt LibreOffice",
|
|
4
|
-
"version": "0.1.
|
|
4
|
+
"version": "0.1.2",
|
|
5
5
|
"publishConfig": {
|
|
6
6
|
"access": "public"
|
|
7
7
|
},
|
|
@@ -42,9 +42,9 @@
|
|
|
42
42
|
"optionalDependencies": {
|
|
43
43
|
"@deepseek-ai/libreoffice-kit-darwin-arm64": "0.1.1",
|
|
44
44
|
"@deepseek-ai/libreoffice-kit-darwin-x64": "0.1.1",
|
|
45
|
-
"@deepseek-ai/libreoffice-kit-win32-arm64": "0.1.
|
|
45
|
+
"@deepseek-ai/libreoffice-kit-win32-arm64": "0.1.2",
|
|
46
46
|
"@deepseek-ai/libreoffice-kit-wasm": "0.1.1",
|
|
47
|
-
"@deepseek-ai/libreoffice-kit-win32-x64": "0.1.
|
|
47
|
+
"@deepseek-ai/libreoffice-kit-win32-x64": "0.1.2"
|
|
48
48
|
},
|
|
49
49
|
"bin": {
|
|
50
50
|
"libreoffice-kit": "./lib/cli.js"
|