@deepseek-ai/libreoffice-kit 0.1.1 → 0.1.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.
@@ -7,8 +7,8 @@ export interface FontFace {
7
7
  readonly size: number;
8
8
  readonly mtimeMs: number;
9
9
  readonly ctimeMs: number;
10
- readonly dev: number;
11
- readonly ino: number;
10
+ readonly dev: string;
11
+ readonly ino: string;
12
12
  readonly faceIndex: number;
13
13
  readonly family: string;
14
14
  readonly style: string;
@@ -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. */
@@ -19,6 +19,14 @@ export declare function prepareNativeFontProfile(profile: string, substitutions:
19
19
  * @returns the environment the helper starts with.
20
20
  */
21
21
  export declare function nativeEnvironment(profile: string, programDirectory: string, source?: NodeJS.ProcessEnv, platform?: string): Record<string, string>;
22
+ /**
23
+ * Keep Windows engine resources reachable through a short profile-owned path until the helper exits.
24
+ * @param engine - Verified engine installation; its resources remain in place.
25
+ * @param profile - Private operation directory that owns the temporary executable and junction.
26
+ * @param run - Operation that settles only after its helper closes.
27
+ * @returns The operation result after removing the resource junction.
28
+ */
29
+ export declare function withNativeEngine<T>(engine: NativeEngine, profile: string, run: (engine: NativeEngine) => Promise<T>): Promise<T>;
22
30
  /**
23
31
  * Run one native conversion and await bounded result transport.
24
32
  * @param engine - Resolved native engine installation.
@@ -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, engine version, and selected backend.
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/lib/worker.js CHANGED
@@ -43,6 +43,29 @@ function failureCode(error) {
43
43
  return typeof code === "string" && CODES.has(code) ? code : "failed";
44
44
  }
45
45
  //#endregion
46
+ //#region lib/types/font-file-identity.js
47
+ /** Preserve 64-bit device and inode values without JavaScript integer rounding. */
48
+ function fontFileIdentity(status) {
49
+ return {
50
+ dev: status.dev.toString(),
51
+ ino: status.ino.toString(),
52
+ size: Number(status.size),
53
+ mtimeMs: Number(status.mtimeNs) / 1e6,
54
+ ctimeMs: Number(status.ctimeNs) / 1e6
55
+ };
56
+ }
57
+ /** Compare a source descriptor's exact identity with its indexed font metadata. */
58
+ function matchesFontFile(status, expected) {
59
+ const current = fontFileIdentity(status);
60
+ return [
61
+ "dev",
62
+ "ino",
63
+ "size",
64
+ "mtimeMs",
65
+ "ctimeMs"
66
+ ].every((key) => current[key] === expected[key]);
67
+ }
68
+ //#endregion
46
69
  //#region lib/types/fonts.js
47
70
  /** Host font metadata snapshots and conversion-local glyph matching over original files. */
48
71
  const VCL_WEIGHTS = [
@@ -67,14 +90,6 @@ const GENERIC_FAMILIES = /* @__PURE__ */ new Set([
67
90
  "systemui",
68
91
  "symbol"
69
92
  ]);
70
- /** File identity read from the descriptor, before and after, to detect concurrent replacement. */
71
- const STAT_KEYS = [
72
- "dev",
73
- "ino",
74
- "size",
75
- "mtimeMs",
76
- "ctimeMs"
77
- ];
78
93
  /**
79
94
  * Case- and separator-insensitive family key used to compare names across sources.
80
95
  * @param value - Family, style, or postscript name as recorded by a document or font.
@@ -218,16 +233,15 @@ var SystemFontCatalog = class {
218
233
  function readFont(face) {
219
234
  const fd = openSync(face.path, constants.O_RDONLY | constants.O_NONBLOCK | constants.O_NOFOLLOW);
220
235
  try {
221
- const before = fstatSync(fd);
222
- if (!before.isFile() || STAT_KEYS.some((key) => before[key] !== face[key])) throw new Error("An indexed font changed; recreate the converter.");
236
+ const before = fstatSync(fd, { bigint: true });
237
+ if (!before.isFile() || !matchesFontFile(before, face)) throw new Error("An indexed font changed; recreate the converter.");
223
238
  const bytes = Buffer.alloc(face.size);
224
239
  for (let offset = 0; offset < bytes.length;) {
225
240
  const count = readSync(fd, bytes, offset, bytes.length - offset, offset);
226
241
  if (!count) throw new Error("An indexed font was truncated.");
227
242
  offset += count;
228
243
  }
229
- const after = fstatSync(fd);
230
- if (STAT_KEYS.some((key) => after[key] !== face[key])) throw new Error("An indexed font changed while reading.");
244
+ if (!matchesFontFile(fstatSync(fd, { bigint: true }), face)) throw new Error("An indexed font changed while reading.");
231
245
  return bytes;
232
246
  } finally {
233
247
  closeSync(fd);
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.1",
4
+ "version": "0.1.3",
5
5
  "publishConfig": {
6
6
  "access": "public"
7
7
  },
@@ -40,13 +40,13 @@
40
40
  "saxes": "6.0.0"
41
41
  },
42
42
  "optionalDependencies": {
43
- "@deepseek-ai/libreoffice-kit-darwin-arm64": "0.1.1",
44
- "@deepseek-ai/libreoffice-kit-darwin-x64": "0.1.1",
45
- "@deepseek-ai/libreoffice-kit-win32-arm64": "0.1.1",
46
- "@deepseek-ai/libreoffice-kit-wasm": "0.1.1",
47
- "@deepseek-ai/libreoffice-kit-win32-x64": "0.1.1"
43
+ "@deepseek-ai/libreoffice-kit-darwin-arm64": "0.1.3",
44
+ "@deepseek-ai/libreoffice-kit-win32-x64": "0.1.3",
45
+ "@deepseek-ai/libreoffice-kit-wasm": "0.1.3",
46
+ "@deepseek-ai/libreoffice-kit-darwin-x64": "0.1.3",
47
+ "@deepseek-ai/libreoffice-kit-win32-arm64": "0.1.3"
48
48
  },
49
49
  "bin": {
50
- "libreoffice-kit": "./lib/cli.js"
50
+ "dsoffice": "./lib/cli.js"
51
51
  }
52
52
  }