mirror of
https://github.com/mozilla/pdf.js.git
synced 2026-04-09 14:54:04 +02:00
Currently we have no less than three different, but very similar, factories for reading built-in CMap files, standard font files, and wasm files on the main-thread.[1] These factories were added at different points in time, since I cannot imagine that we'd add essentially three copies of the same code otherwise. Nowadays these factories are often not even used[2], since worker-thread fetching is used whenever possible to improve performance. In particular, they will *only* be used when either: - The PDF.js library runs in Node.js environments. - The user manually sets `useWorkerFetch = false` when calling `getDocument`. - The user provides custom `CMapReaderFactory`, `StandardFontDataFactory`, and/or `WasmFactory` instances when calling `getDocument`. By replacing these factories with *a single* new `BinaryDataFactory` factory/option the number of `getDocument` options are thus reduced, which cannot hurt. This also reduces the total bundle-size of the Firefox PDF Viewer a little bit, and it slightly reduces the number of import maps that need to be maintained. *Please note:* For users that provide custom `CMapReaderFactory`, `StandardFontDataFactory`, and `WasmFactory` instances when calling `getDocument` this will be a breaking change, however it's unlikely that (many) such users exist. (The *internal* format data-format of `CMapReaderFactory` was changed in PR 18951, and there hasn't been a single question/complaint about it in well over a year.) --- [1] Any new functionality could easily lead to more such factories being added in the future, which wouldn't be great. [2] Note that the Firefox PDF Viewer no longer use these factories, since it "forcibly" sets `useWorkerFetch = true` during building.
25 lines
863 B
JSON
25 lines
863 B
JSON
{
|
|
"compilerOptions": {
|
|
"target": "ES2022",
|
|
"allowJs": true,
|
|
"declaration": true,
|
|
"strict": true,
|
|
"emitDeclarationOnly": true,
|
|
"esModuleInterop": true,
|
|
"forceConsistentCasingInFileNames": true,
|
|
"moduleResolution": "node",
|
|
"paths": {
|
|
"pdfjs-lib": ["./src/pdf"],
|
|
"display-binary_data_factory": ["./src/display/binary_data_factory"],
|
|
"display-fetch_stream": ["./src/display/fetch_stream"],
|
|
"display-network": ["./src/display/network"],
|
|
"display-node_stream": ["./src/display/node_stream"],
|
|
"display-node_utils": ["./src/display/node_utils"],
|
|
"fluent-bundle": ["./node_modules/@fluent/bundle/esm/index.js"],
|
|
"fluent-dom": ["./node_modules/@fluent/dom/esm/index.js"],
|
|
"web-null_l10n": ["./web/genericl10n"]
|
|
}
|
|
},
|
|
"files": ["src/pdf.js", "web/pdf_viewer.component.js"]
|
|
}
|