@file-viewer/renderer-wordperfect 2.3.0
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/LICENSE +7 -0
- package/README.en.md +5 -0
- package/README.md +5 -0
- package/THIRD_PARTY_NOTICES.md +7 -0
- package/dist/index.d.ts +8 -0
- package/dist/index.js +16 -0
- package/dist/libwpd.d.ts +2 -0
- package/dist/libwpd.js +302 -0
- package/dist/libwpd.mjs +2 -0
- package/dist/libwpd.wasm +0 -0
- package/dist/parser.d.ts +42 -0
- package/dist/parser.js +69 -0
- package/dist/wordperfect.d.ts +2 -0
- package/dist/wordperfect.js +98 -0
- package/dist/wordperfect.worker.d.ts +1 -0
- package/dist/wordperfect.worker.js +5 -0
- package/dist/workerClient.d.ts +3 -0
- package/dist/workerClient.js +41 -0
- package/package.json +74 -0
- package/vendor/libwpd-src/LICENSE.boost-BSL-1.0.txt +23 -0
- package/vendor/libwpd-src/LICENSE.xberg-shim-MIT.txt +21 -0
- package/vendor/libwpd-src/PROVENANCE.md +16 -0
- package/vendor/libwpd-src/boost-subset.tar.gz +0 -0
- package/vendor/libwpd-src/librevenge-0.0.6.tar.gz +0 -0
- package/vendor/libwpd-src/libwpd-0.10.3.tar.gz +0 -0
- package/vendor/libwpd-src/shim.cpp +1047 -0
|
@@ -0,0 +1,41 @@
|
|
|
1
|
+
import { resolveFileViewerWordPerfectWorkerUrl, resolveFileViewerWordPerfectWasmUrl, } from '@file-viewer/core';
|
|
2
|
+
import { parseWordPerfectDocument } from './parser.js';
|
|
3
|
+
let requestId = 0;
|
|
4
|
+
export const parseWordPerfectWithWorker = (buffer, options, signal) => {
|
|
5
|
+
var _a;
|
|
6
|
+
if ((options === null || options === void 0 ? void 0 : options.useWorker) === false || typeof Worker === 'undefined') {
|
|
7
|
+
return Promise.resolve(parseWordPerfectDocument(buffer));
|
|
8
|
+
}
|
|
9
|
+
const workerUrl = resolveFileViewerWordPerfectWorkerUrl(options, typeof document === 'undefined' ? undefined : document.baseURI);
|
|
10
|
+
const wasmUrl = resolveFileViewerWordPerfectWasmUrl(options, typeof document === 'undefined' ? undefined : document.baseURI);
|
|
11
|
+
const worker = new Worker(workerUrl, { type: 'module', name: 'file-viewer-wordperfect' });
|
|
12
|
+
const id = ++requestId;
|
|
13
|
+
const timeoutMs = Math.max(1000, (_a = options === null || options === void 0 ? void 0 : options.workerTimeoutMs) !== null && _a !== void 0 ? _a : 60000);
|
|
14
|
+
return new Promise((resolve, reject) => {
|
|
15
|
+
let settled = false;
|
|
16
|
+
const finish = (callback) => {
|
|
17
|
+
if (settled)
|
|
18
|
+
return;
|
|
19
|
+
settled = true;
|
|
20
|
+
clearTimeout(timer);
|
|
21
|
+
signal === null || signal === void 0 ? void 0 : signal.removeEventListener('abort', onAbort);
|
|
22
|
+
worker.terminate();
|
|
23
|
+
callback();
|
|
24
|
+
};
|
|
25
|
+
const onAbort = () => finish(() => reject(new DOMException('WordPerfect parsing was aborted.', 'AbortError')));
|
|
26
|
+
const timer = setTimeout(() => finish(() => reject(new Error(`WordPerfect parsing exceeded ${timeoutMs}ms.`))), timeoutMs);
|
|
27
|
+
worker.addEventListener('message', (event) => {
|
|
28
|
+
if (event.data.id !== id)
|
|
29
|
+
return;
|
|
30
|
+
finish(() => event.data.ok && event.data.document
|
|
31
|
+
? resolve(event.data.document)
|
|
32
|
+
: reject(new Error(event.data.error || 'WordPerfect Worker failed.')));
|
|
33
|
+
});
|
|
34
|
+
worker.addEventListener('error', event => finish(() => reject(new Error(event.message || 'WordPerfect Worker failed to load.'))));
|
|
35
|
+
signal === null || signal === void 0 ? void 0 : signal.addEventListener('abort', onAbort, { once: true });
|
|
36
|
+
if (signal === null || signal === void 0 ? void 0 : signal.aborted)
|
|
37
|
+
return onAbort();
|
|
38
|
+
const transferable = buffer.slice(0);
|
|
39
|
+
worker.postMessage({ id, buffer: transferable, wasmUrl }, [transferable]);
|
|
40
|
+
});
|
|
41
|
+
};
|
package/package.json
ADDED
|
@@ -0,0 +1,74 @@
|
|
|
1
|
+
{
|
|
2
|
+
"name": "@file-viewer/renderer-wordperfect",
|
|
3
|
+
"version": "2.3.0",
|
|
4
|
+
"private": false,
|
|
5
|
+
"type": "module",
|
|
6
|
+
"description": "Signature-routed WordPerfect renderer plugin for File Viewer with a libwpd WASM integration boundary.",
|
|
7
|
+
"keywords": [
|
|
8
|
+
"file-viewer",
|
|
9
|
+
"renderer",
|
|
10
|
+
"wordperfect",
|
|
11
|
+
"wpd",
|
|
12
|
+
"wp5",
|
|
13
|
+
"wp6",
|
|
14
|
+
"libwpd",
|
|
15
|
+
"wasm",
|
|
16
|
+
"self-hosted"
|
|
17
|
+
],
|
|
18
|
+
"publishConfig": {
|
|
19
|
+
"access": "public",
|
|
20
|
+
"registry": "https://registry.npmjs.org/"
|
|
21
|
+
},
|
|
22
|
+
"author": {
|
|
23
|
+
"name": "Yu Wang",
|
|
24
|
+
"email": "admin@flyfish.dev"
|
|
25
|
+
},
|
|
26
|
+
"repository": {
|
|
27
|
+
"type": "git",
|
|
28
|
+
"url": "git+https://github.com/flyfish-dev/file-viewer.git",
|
|
29
|
+
"directory": "packages/renderers/wordperfect"
|
|
30
|
+
},
|
|
31
|
+
"homepage": "https://doc.file-viewer.app/guide/on-demand-renderers",
|
|
32
|
+
"bugs": {
|
|
33
|
+
"url": "https://github.com/flyfish-dev/file-viewer/issues"
|
|
34
|
+
},
|
|
35
|
+
"funding": {
|
|
36
|
+
"type": "individual",
|
|
37
|
+
"url": "https://dev.flyfish.group/donate?source=npm"
|
|
38
|
+
},
|
|
39
|
+
"main": "./dist/index.js",
|
|
40
|
+
"module": "./dist/index.js",
|
|
41
|
+
"types": "./dist/index.d.ts",
|
|
42
|
+
"exports": {
|
|
43
|
+
".": {
|
|
44
|
+
"types": "./dist/index.d.ts",
|
|
45
|
+
"import": "./dist/index.js",
|
|
46
|
+
"default": "./dist/index.js"
|
|
47
|
+
},
|
|
48
|
+
"./worker/wordperfect.worker.js": "./dist/wordperfect.worker.js",
|
|
49
|
+
"./worker/libwpd.mjs": "./dist/libwpd.mjs",
|
|
50
|
+
"./worker/libwpd.wasm": "./dist/libwpd.wasm",
|
|
51
|
+
"./package.json": "./package.json"
|
|
52
|
+
},
|
|
53
|
+
"files": [
|
|
54
|
+
"dist",
|
|
55
|
+
"vendor/libwpd-src",
|
|
56
|
+
"README.md",
|
|
57
|
+
"README.en.md",
|
|
58
|
+
"LICENSE",
|
|
59
|
+
"THIRD_PARTY_NOTICES.md"
|
|
60
|
+
],
|
|
61
|
+
"dependencies": {
|
|
62
|
+
"@file-viewer/core": "2.3.0"
|
|
63
|
+
},
|
|
64
|
+
"devDependencies": {
|
|
65
|
+
"esbuild": "^0.28.1",
|
|
66
|
+
"typescript": "^6.0.3"
|
|
67
|
+
},
|
|
68
|
+
"license": "Apache-2.0",
|
|
69
|
+
"scripts": {
|
|
70
|
+
"build": "tsc -b tsconfig.json --force && node scripts/build-worker.mjs",
|
|
71
|
+
"build:wasm": "node scripts/build-libwpd-wasm.mjs",
|
|
72
|
+
"type-check": "tsc -b tsconfig.json"
|
|
73
|
+
}
|
|
74
|
+
}
|
|
@@ -0,0 +1,23 @@
|
|
|
1
|
+
Boost Software License - Version 1.0 - August 17th, 2003
|
|
2
|
+
|
|
3
|
+
Permission is hereby granted, free of charge, to any person or organization
|
|
4
|
+
obtaining a copy of the software and accompanying documentation covered by
|
|
5
|
+
this license (the "Software") to use, reproduce, display, distribute,
|
|
6
|
+
execute, and transmit the Software, and to prepare derivative works of the
|
|
7
|
+
Software, and to permit third-parties to whom the Software is furnished to
|
|
8
|
+
do so, all subject to the following:
|
|
9
|
+
|
|
10
|
+
The copyright notices in the Software and this entire statement, including
|
|
11
|
+
the above license grant, this restriction and the following disclaimer,
|
|
12
|
+
must be included in all copies of the Software, in whole or in part, and
|
|
13
|
+
all derivative works of the Software, unless such copies or derivative
|
|
14
|
+
works are solely in the form of machine-executable object code generated by
|
|
15
|
+
a source language processor.
|
|
16
|
+
|
|
17
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
18
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
19
|
+
FITNESS FOR A PARTICULAR PURPOSE, TITLE AND NON-INFRINGEMENT. IN NO EVENT
|
|
20
|
+
SHALL THE COPYRIGHT HOLDERS OR ANYONE DISTRIBUTING THE SOFTWARE BE LIABLE
|
|
21
|
+
FOR ANY DAMAGES OR OTHER LIABILITY, WHETHER IN CONTRACT, TORT OR OTHERWISE,
|
|
22
|
+
ARISING FROM, OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER
|
|
23
|
+
DEALINGS IN THE SOFTWARE.
|
|
@@ -0,0 +1,21 @@
|
|
|
1
|
+
MIT License
|
|
2
|
+
|
|
3
|
+
Copyright (c) 2025-2026 Kreuzberg, Inc.
|
|
4
|
+
|
|
5
|
+
Permission is hereby granted, free of charge, to any person obtaining a copy
|
|
6
|
+
of this software and associated documentation files (the "Software"), to deal
|
|
7
|
+
in the Software without restriction, including without limitation the rights
|
|
8
|
+
to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
|
|
9
|
+
copies of the Software, and to permit persons to whom the Software is
|
|
10
|
+
furnished to do so, subject to the following conditions:
|
|
11
|
+
|
|
12
|
+
The above copyright notice and this permission notice shall be included in all
|
|
13
|
+
copies or substantial portions of the Software.
|
|
14
|
+
|
|
15
|
+
THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
|
|
16
|
+
IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
|
|
17
|
+
FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
|
|
18
|
+
AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
|
|
19
|
+
LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
|
|
20
|
+
OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
|
|
21
|
+
SOFTWARE.
|
|
@@ -0,0 +1,16 @@
|
|
|
1
|
+
# libwpd WebAssembly provenance
|
|
2
|
+
|
|
3
|
+
The WordPerfect Worker builds the following sources under their documented license arms:
|
|
4
|
+
|
|
5
|
+
- `libwpd-0.10.3.tar.gz` — checksum-pinned, pruned source archive derived from upstream `libwpd` 0.10.3 by Xberg (public headers, implementation sources and license files retained), MPL-2.0 OR LGPL-2.1-or-later; this build selects MPL-2.0. SHA-256 `ca3575282acff8c952c12160433ad7e73e803ff3f070b8442c7ffa1f3a19f9ae`.
|
|
6
|
+
- `librevenge-0.0.6.tar.gz` — checksum-pinned, pruned source archive derived from upstream `librevenge` 0.0.6 by Xberg (public headers, implementation sources and license files retained), MPL-2.0 OR LGPL-2.1-or-later; this build selects MPL-2.0. SHA-256 `686cc36be3196a0a808761cfd3951a46ff809cb0e028b0902c787261a1389d0f`.
|
|
7
|
+
- `boost-subset.tar.gz` — the header-only Boost 1.90 dependency closure generated with `bcp`, BSL-1.0. SHA-256 `802ee17c5e380efbcbb696468ee3c7090aa409db89c2063b4c9b8d3e3aff1e08`.
|
|
8
|
+
- `shim.cpp` — the callback-to-structured-event bridge derived from `xberg-libwpd`, MIT. Its license is included as `LICENSE.xberg-shim-MIT.txt`.
|
|
9
|
+
|
|
10
|
+
The source archives are checksum-verified by `scripts/build-libwpd-wasm.mjs` before each build. The generated `dist/libwpd.mjs` and `dist/libwpd.wasm` are lazy-loaded only by the WordPerfect Worker. Current generated SHA-256 values are `be29b0bac887007ca9adc012c3122bb84964de2dd11d9500e8e9b03feb8939f2` (`libwpd.mjs`) and `51db45b3bec05b72b2f6ff82c5ed3e715916e61a7a2f153df0644e10d75e6b8c` (`libwpd.wasm`).
|
|
11
|
+
|
|
12
|
+
Sources:
|
|
13
|
+
|
|
14
|
+
- https://downloads.sourceforge.net/project/libwpd/libwpd/libwpd-0.10.3/libwpd-0.10.3.tar.gz
|
|
15
|
+
- https://downloads.sourceforge.net/project/libwpd/librevenge/librevenge-0.0.6/librevenge-0.0.6.tar.gz
|
|
16
|
+
- https://github.com/xberg-io/xberg/tree/main/crates/xberg-libwpd
|
|
Binary file
|
|
Binary file
|
|
Binary file
|