Skip to content

chore(deps): update dependency officeparser to v6.1.0 - #9482

Merged
eliandoran merged 4 commits into
mainfrom
renovate/officeparser-6.x
Apr 19, 2026
Merged

chore(deps): update dependency officeparser to v6.1.0#9482
eliandoran merged 4 commits into
mainfrom
renovate/officeparser-6.x

Conversation

@renovate

@renovate renovate Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor

This PR contains the following updates:

Package Change Age Confidence
officeparser (source) 6.0.76.1.0 age confidence

Release Notes

harshankur/officeParser (officeparser)

v6.1.0

Compare Source

Added
  • OCR Scheduler: Intelligent worker pool that optimizes Tesseract lifecycle across parallel requests.
  • Custom Properties: Support for extracting document metadata across OOXML, ODF, and PDF formats.
  • Sponsorship: Integrated funding.json manifest and GitHub Sponsors support.
  • Governance: Added .editorconfig, .gitattributes, and SUPPORT.md.
Changed
  • Core Engine: Replaced legacy zip extraction with fflate for significant performance gains and robust browser/edge compatibility.
  • Module System: Full native ESM support with Node16 resolution and verified browser bundles (Vite/Angular compatible).
  • Format Refinements: Hierarchical PDF coordinate alignment and ODT/RTF list parsing stability.

Configuration

📅 Schedule: (UTC)

  • Branch creation
    • "before 3am"
  • Automerge
    • At any time (no schedule defined)

🚦 Automerge: Disabled by config. Please merge this manually once you are satisfied.

Rebasing: Whenever PR becomes conflicted, or you tick the rebase/retry checkbox.

🔕 Ignore: Close this PR and you won't be reminded about this update again.


  • If you want to rebase/retry this PR, check this box

This PR was generated by Mend Renovate. View the repository job log.

@renovate renovate Bot added dependencies PRs or issues relating to dependencies renovate labels Apr 18, 2026
@eliandoran

Copy link
Copy Markdown
Contributor

@claude , have a look at the changes introduced by this version update and adapt the office parser accordingly.

@claude

claude Bot commented Apr 18, 2026

Copy link
Copy Markdown

Claude finished @eliandoran's task in 2m 48s —— View job


Adapting officeparser to v6.1.0

Work in progress...

Tasks:

  • Gather context on officeparser usage in the codebase
  • Analyze v6.1.0 breaking changes (especially ESM module system changes)
  • Adapt the code as needed
  • Verify changes compile correctly
  • Push changes

@dosubot dosubot Bot added the size:XS This PR changes 0-9 lines, ignoring generated files. label Apr 18, 2026
@eliandoran

Copy link
Copy Markdown
Contributor

@claude , please resume the previous work of adapting to this version.

@renovate

renovate Bot commented Apr 18, 2026

Copy link
Copy Markdown
Contributor Author

Edited/Blocked Notification

Renovate will not automatically rebase this PR, because it does not recognize the last commit author and assumes somebody else may have edited the PR.

You can manually request rebase by checking the rebase/retry box above.

⚠️ Warning: custom changes will be lost.

@claude

claude Bot commented Apr 18, 2026

Copy link
Copy Markdown

Claude finished @eliandoran's task in 8m 14s —— View job


Adapting officeparser to v6.1.0

Root cause: officeparser v6.1.0 added native ESM support with Node16 resolution and a strict exports field in package.json. This broke the deep subpath imports like officeparser/dist/parsers/ExcelParser.js that TypeScript (moduleResolution: "bundler") no longer accepts.

Fix: Replaced the five deep imports (one per format: Word, Excel, PowerPoint, OpenOffice, types) with a single import from the main officeparser entry point. Now uses parseOfficeAsync(buffer, config) which accepts a Buffer directly and auto-detects the format via magic bytes (using file-type internally).

Tasks:

  • Gather context on officeparser usage in the codebase
  • Analyze v6.1.0 breaking changes — strict exports field makes deep imports fail TS typecheck
  • Adapted office_processor.ts to use officeparser's main entry API
  • Verify changes compile correctly (waiting for CI)
  • Push changes — commit b2bcccb
    | Branch

v6.1.0 added native ESM with Node16 resolution and a strict exports
field, breaking deep subpath imports like
officeparser/dist/parsers/ExcelParser.js. Switch to the main package
entry and use parseOfficeAsync(), which accepts a Buffer and
auto-detects the format via magic bytes.

Co-authored-by: Elian Doran <eliandoran@users.noreply.github.com>
@dosubot dosubot Bot added size:M This PR changes 30-99 lines, ignoring generated files. and removed size:XS This PR changes 0-9 lines, ignoring generated files. labels Apr 18, 2026
@eliandoran

Copy link
Copy Markdown
Contributor

@claude , can you make sure that PDF.js is not pulled through the main import, as it was in the past? Explain your findings.

@claude

claude Bot commented Apr 18, 2026

Copy link
Copy Markdown

Claude finished @eliandoran's task in 8m 7s —— View job


Investigating PDF.js in officeparser main import

Tasks:

  • Understand the request
  • Read current office_processor.ts implementation
  • Check esbuild config for pdfjs-dist handling
  • Analyze officeparser's dependency on pdfjs-dist
  • Report findings

Findings

1. pdfjs-dist is already externalized in the server build

In scripts/build-utils.ts:54, pdfjs-dist is explicitly listed in esbuild's external array:

external: [
    "electron",
    "@electron/remote",
    "better-sqlite3",
    "pdfjs-dist",          // <-- already external
    "./xhr-sync-worker.js",
    "vite",
    "tesseract.js"
],

This means pdfjs-dist will never be inlined into the server's bundled .cjs file, regardless of how officeparser imports it. The bundler leaves any require('pdfjs-dist') calls in the output as-is, resolved at runtime from node_modules.

2. officeparser v6.1.0 depends on pdfjs-dist@5.6.205

Confirmed in pnpm-lock.yaml:

officeparser@6.1.0(encoding@0.1.13):
  dependencies:
    '@xmldom/xmldom': 0.9.9
    fflate: 0.8.2
    file-type: 22.0.1
    pdfjs-dist: 5.6.205       # <-- direct dep
    tesseract.js: 7.0.0

Trilium's own packages/pdfjs-viewer also uses pdfjs-dist: 5.6.205 (as a devDependency). Both use the same version, so pnpm deduplicates them — only one copy exists on disk. No size bloat in node_modules.

3. The remaining risk: runtime loading

The external flag solves the bundle size concern. However, there is a secondary concern: if officeparser's index.js uses a static top-level import of pdfjs-dist (e.g. import * as pdfjs from 'pdfjs-dist'), then pdfjs-dist will be loaded into memory at server startup whenever OfficeProcessor (and by extension officeparser) is first required — even though the processor only handles DOCX/XLSX/PPTX/ODT files and never touches PDFs.

This was exactly why the previous implementation used deep subpath imports like officeparser/dist/parsers/ExcelParser.js — to import only the Word/Excel/PowerPoint/ODT parsers, avoiding the PDF parser and its pdfjs-dist load entirely.

I was unable to directly inspect officeparser's index.js source in this run (network access is restricted in this CI context). To verify whether pdfjs-dist is statically or dynamically imported in the officeparser entry, one can check: https://github.com/harshankur/officeParser/blob/v6.1.0/index.js

Summary

Concern Status
pdfjs-dist inlined into server .cjs bundle ✅ Not a problem — already in external list
Duplicate pdfjs-dist in node_modules ✅ Not a problem — same version, pnpm deduplicates
pdfjs-dist loaded at runtime on module init (static import in officeparser) ⚠️ Uncertain — depends on officeparser's import style; unverifiable in this run

If a static import is confirmed, a pnpm patch on officeparser to convert its PDF-parser import to a dynamic import() would fix the runtime concern while keeping the v6.1.0 upgrade.
| Branch

v6.1.0 renamed parseOfficeAsync to OfficeParser.parseOffice (static
method) and returns an AST object with toText() instead of a plain
string.

Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
@eliandoran eliandoran added this to the v0.103.0 milestone Apr 19, 2026
@eliandoran
eliandoran merged commit ae6f5fa into main Apr 19, 2026
12 checks passed
@eliandoran
eliandoran deleted the renovate/officeparser-6.x branch April 19, 2026 09:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

dependencies PRs or issues relating to dependencies renovate size:M This PR changes 30-99 lines, ignoring generated files.

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant