@deepseek-ai/libreoffice-kit 0.1.2 → 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.
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.2",
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.2",
46
- "@deepseek-ai/libreoffice-kit-wasm": "0.1.1",
47
- "@deepseek-ai/libreoffice-kit-win32-x64": "0.1.2"
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
  }