wpd-codec 0.0.0 → 1.0.1
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 +21 -0
- package/README.md +182 -0
- package/dist/bytes/view.cjs +23 -0
- package/dist/bytes/view.d.cts +7 -0
- package/dist/bytes/view.d.ts +7 -0
- package/dist/bytes/view.js +19 -0
- package/dist/codec.cjs +23 -0
- package/dist/codec.d.cts +8 -0
- package/dist/codec.d.ts +8 -0
- package/dist/codec.js +21 -0
- package/dist/container/container.cjs +53 -0
- package/dist/container/container.d.cts +16 -0
- package/dist/container/container.d.ts +16 -0
- package/dist/container/container.js +50 -0
- package/dist/container/header.cjs +49 -0
- package/dist/container/header.d.cts +16 -0
- package/dist/container/header.d.ts +16 -0
- package/dist/container/header.js +45 -0
- package/dist/container/prefix.cjs +66 -0
- package/dist/container/prefix.d.cts +18 -0
- package/dist/container/prefix.d.ts +18 -0
- package/dist/container/prefix.js +61 -0
- package/dist/diagnostics-Cp0HKphg.d.cts +15 -0
- package/dist/diagnostics-Cp0HKphg.d.ts +15 -0
- package/dist/diagnostics.cjs +12 -0
- package/dist/diagnostics.d.cts +2 -0
- package/dist/diagnostics.d.ts +2 -0
- package/dist/diagnostics.js +10 -0
- package/dist/errors.cjs +31 -0
- package/dist/errors.d.cts +15 -0
- package/dist/errors.d.ts +15 -0
- package/dist/errors.js +27 -0
- package/dist/format.cjs +7 -0
- package/dist/format.d.cts +5 -0
- package/dist/format.d.ts +5 -0
- package/dist/format.js +5 -0
- package/dist/index.cjs +58 -0
- package/dist/index.d.cts +13 -0
- package/dist/index.d.ts +13 -0
- package/dist/index.js +13 -0
- package/dist/read.cjs +296 -0
- package/dist/read.d.cts +10 -0
- package/dist/read.d.ts +10 -0
- package/dist/read.js +294 -0
- package/dist/stream/attributes.cjs +46 -0
- package/dist/stream/attributes.d.cts +37 -0
- package/dist/stream/attributes.d.ts +37 -0
- package/dist/stream/attributes.js +41 -0
- package/dist/stream/characters.cjs +205 -0
- package/dist/stream/characters.d.cts +12 -0
- package/dist/stream/characters.d.ts +12 -0
- package/dist/stream/characters.js +199 -0
- package/dist/stream/eol.cjs +52 -0
- package/dist/stream/eol.d.cts +10 -0
- package/dist/stream/eol.d.ts +10 -0
- package/dist/stream/eol.js +46 -0
- package/dist/stream/tokenise.cjs +125 -0
- package/dist/stream/tokenise.d.cts +30 -0
- package/dist/stream/tokenise.d.ts +30 -0
- package/dist/stream/tokenise.js +121 -0
- package/package.json +96 -2
|
@@ -0,0 +1,125 @@
|
|
|
1
|
+
Object.defineProperty(exports, Symbol.toStringTag, { value: "Module" });
|
|
2
|
+
const require_errors = require("../errors.cjs");
|
|
3
|
+
const require_bytes_view = require("../bytes/view.cjs");
|
|
4
|
+
//#region src/stream/tokenise.ts
|
|
5
|
+
const FIRST_SINGLE_BYTE_FUNCTION = 128;
|
|
6
|
+
const FIRST_VARIABLE_FUNCTION = 208;
|
|
7
|
+
const FIRST_FIXED_FUNCTION = 240;
|
|
8
|
+
const FIXED_FUNCTION_SIZES = [
|
|
9
|
+
4,
|
|
10
|
+
5,
|
|
11
|
+
3,
|
|
12
|
+
3,
|
|
13
|
+
3,
|
|
14
|
+
3,
|
|
15
|
+
4,
|
|
16
|
+
4,
|
|
17
|
+
4,
|
|
18
|
+
5,
|
|
19
|
+
5,
|
|
20
|
+
6,
|
|
21
|
+
6,
|
|
22
|
+
8,
|
|
23
|
+
8
|
|
24
|
+
];
|
|
25
|
+
const MIN_VARIABLE_FUNCTION_SIZE = 10;
|
|
26
|
+
const VARIABLE_FUNCTION_TRAILER_SIZE = 3;
|
|
27
|
+
function readVariableFunction(bytes, offset, limit) {
|
|
28
|
+
const group = require_bytes_view.byteAt(bytes, offset);
|
|
29
|
+
const subgroup = require_bytes_view.byteAt(bytes, offset + 1);
|
|
30
|
+
const size = require_bytes_view.uint16At(bytes, offset + 2);
|
|
31
|
+
const flags = require_bytes_view.byteAt(bytes, offset + 4);
|
|
32
|
+
if (size < MIN_VARIABLE_FUNCTION_SIZE) throw new require_errors.WpdFormatError(`The variable-length function 0x${group.toString(16).toUpperCase()} at offset ${offset} declares a size of ${size}, below the ${MIN_VARIABLE_FUNCTION_SIZE} bytes its own gates and fields occupy.`);
|
|
33
|
+
const end = offset + size;
|
|
34
|
+
if (end > limit) throw new require_errors.WpdFormatError(`The variable-length function 0x${group.toString(16).toUpperCase()} at offset ${offset} declares a size of ${size}, which runs past the end of the document area at offset ${limit}.`);
|
|
35
|
+
let cursor = offset + 5;
|
|
36
|
+
const prefixIds = [];
|
|
37
|
+
if ((flags & 128) !== 0) {
|
|
38
|
+
const prefixIdCount = require_bytes_view.byteAt(bytes, cursor);
|
|
39
|
+
cursor += 1;
|
|
40
|
+
for (let index = 0; index < prefixIdCount; index += 1) {
|
|
41
|
+
prefixIds.push(require_bytes_view.uint16At(bytes, cursor));
|
|
42
|
+
cursor += 2;
|
|
43
|
+
}
|
|
44
|
+
}
|
|
45
|
+
const nonDeletableSize = require_bytes_view.uint16At(bytes, cursor);
|
|
46
|
+
cursor += 2;
|
|
47
|
+
const availableForData = end - VARIABLE_FUNCTION_TRAILER_SIZE - cursor;
|
|
48
|
+
if (nonDeletableSize > availableForData) throw new require_errors.WpdFormatError(`The variable-length function 0x${group.toString(16).toUpperCase()} subgroup ${subgroup} at offset ${offset} declares ${nonDeletableSize} bytes of non-deletable data, but only ${availableForData} remain inside its own ${size}-byte extent.`);
|
|
49
|
+
const nonDeletable = require_bytes_view.sliceAt(bytes, cursor, nonDeletableSize);
|
|
50
|
+
const trailingSize = require_bytes_view.uint16At(bytes, end - 3);
|
|
51
|
+
if (trailingSize !== size) throw new require_errors.WpdFormatError(`The variable-length function 0x${group.toString(16).toUpperCase()} at offset ${offset} opens with size ${size} but closes with size ${trailingSize}.`);
|
|
52
|
+
const endGate = require_bytes_view.byteAt(bytes, end - 1);
|
|
53
|
+
if (endGate !== group) throw new require_errors.WpdFormatError(`The variable-length function at offset ${offset} opens with gate 0x${group.toString(16).toUpperCase()} but closes with 0x${endGate.toString(16).toUpperCase()}.`);
|
|
54
|
+
return {
|
|
55
|
+
token: {
|
|
56
|
+
kind: "variableFunction",
|
|
57
|
+
group,
|
|
58
|
+
subgroup,
|
|
59
|
+
size,
|
|
60
|
+
flags,
|
|
61
|
+
prefixIds,
|
|
62
|
+
nonDeletable
|
|
63
|
+
},
|
|
64
|
+
nextOffset: end
|
|
65
|
+
};
|
|
66
|
+
}
|
|
67
|
+
function readFixedFunction(bytes, offset, limit) {
|
|
68
|
+
const code = require_bytes_view.byteAt(bytes, offset);
|
|
69
|
+
const size = FIXED_FUNCTION_SIZES[code - 240];
|
|
70
|
+
if (size === void 0) throw new require_errors.WpdFormatError(`Function code 0x${code.toString(16).toUpperCase()} at offset ${offset} cannot appear in a document: -1 is reserved and has no assigned size.`);
|
|
71
|
+
const end = offset + size;
|
|
72
|
+
if (end > limit) throw new require_errors.WpdFormatError(`The ${size}-byte fixed-length function 0x${code.toString(16).toUpperCase()} at offset ${offset} runs past the end of the document area at offset ${limit}.`);
|
|
73
|
+
const endGate = require_bytes_view.byteAt(bytes, end - 1);
|
|
74
|
+
if (endGate !== code) throw new require_errors.WpdFormatError(`The fixed-length function at offset ${offset} opens with gate 0x${code.toString(16).toUpperCase()} but closes with 0x${endGate.toString(16).toUpperCase()}.`);
|
|
75
|
+
return {
|
|
76
|
+
token: {
|
|
77
|
+
kind: "fixedFunction",
|
|
78
|
+
code,
|
|
79
|
+
data: require_bytes_view.sliceAt(bytes, offset + 1, size - 2)
|
|
80
|
+
},
|
|
81
|
+
nextOffset: end
|
|
82
|
+
};
|
|
83
|
+
}
|
|
84
|
+
function tokeniseDocumentArea(bytes, offset, limit = bytes.length) {
|
|
85
|
+
const tokens = [];
|
|
86
|
+
let cursor = offset;
|
|
87
|
+
while (cursor < limit) {
|
|
88
|
+
const byte = require_bytes_view.byteAt(bytes, cursor);
|
|
89
|
+
if (byte === 0) {
|
|
90
|
+
cursor += 1;
|
|
91
|
+
continue;
|
|
92
|
+
}
|
|
93
|
+
if (byte < 128) {
|
|
94
|
+
tokens.push({
|
|
95
|
+
kind: "character",
|
|
96
|
+
byte
|
|
97
|
+
});
|
|
98
|
+
cursor += 1;
|
|
99
|
+
continue;
|
|
100
|
+
}
|
|
101
|
+
if (byte < 208) {
|
|
102
|
+
tokens.push({
|
|
103
|
+
kind: "singleByteFunction",
|
|
104
|
+
code: byte
|
|
105
|
+
});
|
|
106
|
+
cursor += 1;
|
|
107
|
+
continue;
|
|
108
|
+
}
|
|
109
|
+
if (byte < 240) {
|
|
110
|
+
const { token, nextOffset } = readVariableFunction(bytes, cursor, limit);
|
|
111
|
+
tokens.push(token);
|
|
112
|
+
cursor = nextOffset;
|
|
113
|
+
continue;
|
|
114
|
+
}
|
|
115
|
+
const { token, nextOffset } = readFixedFunction(bytes, cursor, limit);
|
|
116
|
+
tokens.push(token);
|
|
117
|
+
cursor = nextOffset;
|
|
118
|
+
}
|
|
119
|
+
return tokens;
|
|
120
|
+
}
|
|
121
|
+
//#endregion
|
|
122
|
+
exports.FIRST_FIXED_FUNCTION = FIRST_FIXED_FUNCTION;
|
|
123
|
+
exports.FIRST_SINGLE_BYTE_FUNCTION = FIRST_SINGLE_BYTE_FUNCTION;
|
|
124
|
+
exports.FIRST_VARIABLE_FUNCTION = FIRST_VARIABLE_FUNCTION;
|
|
125
|
+
exports.tokeniseDocumentArea = tokeniseDocumentArea;
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/stream/tokenise.d.ts
|
|
2
|
+
interface WpdCharacterToken {
|
|
3
|
+
readonly kind: "character";
|
|
4
|
+
readonly byte: number;
|
|
5
|
+
}
|
|
6
|
+
interface WpdSingleByteFunctionToken {
|
|
7
|
+
readonly kind: "singleByteFunction";
|
|
8
|
+
readonly code: number;
|
|
9
|
+
}
|
|
10
|
+
interface WpdVariableFunctionToken {
|
|
11
|
+
readonly kind: "variableFunction";
|
|
12
|
+
readonly group: number;
|
|
13
|
+
readonly subgroup: number;
|
|
14
|
+
readonly size: number;
|
|
15
|
+
readonly flags: number;
|
|
16
|
+
readonly prefixIds: readonly number[];
|
|
17
|
+
readonly nonDeletable: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
interface WpdFixedFunctionToken {
|
|
20
|
+
readonly kind: "fixedFunction";
|
|
21
|
+
readonly code: number;
|
|
22
|
+
readonly data: Uint8Array;
|
|
23
|
+
}
|
|
24
|
+
type WpdToken = WpdCharacterToken | WpdSingleByteFunctionToken | WpdVariableFunctionToken | WpdFixedFunctionToken;
|
|
25
|
+
declare const FIRST_SINGLE_BYTE_FUNCTION = 128;
|
|
26
|
+
declare const FIRST_VARIABLE_FUNCTION = 208;
|
|
27
|
+
declare const FIRST_FIXED_FUNCTION = 240;
|
|
28
|
+
declare function tokeniseDocumentArea(bytes: Uint8Array, offset: number, limit?: number): WpdToken[];
|
|
29
|
+
//#endregion
|
|
30
|
+
export { FIRST_FIXED_FUNCTION, FIRST_SINGLE_BYTE_FUNCTION, FIRST_VARIABLE_FUNCTION, WpdCharacterToken, WpdFixedFunctionToken, WpdSingleByteFunctionToken, WpdToken, WpdVariableFunctionToken, tokeniseDocumentArea };
|
|
@@ -0,0 +1,30 @@
|
|
|
1
|
+
//#region src/stream/tokenise.d.ts
|
|
2
|
+
interface WpdCharacterToken {
|
|
3
|
+
readonly kind: "character";
|
|
4
|
+
readonly byte: number;
|
|
5
|
+
}
|
|
6
|
+
interface WpdSingleByteFunctionToken {
|
|
7
|
+
readonly kind: "singleByteFunction";
|
|
8
|
+
readonly code: number;
|
|
9
|
+
}
|
|
10
|
+
interface WpdVariableFunctionToken {
|
|
11
|
+
readonly kind: "variableFunction";
|
|
12
|
+
readonly group: number;
|
|
13
|
+
readonly subgroup: number;
|
|
14
|
+
readonly size: number;
|
|
15
|
+
readonly flags: number;
|
|
16
|
+
readonly prefixIds: readonly number[];
|
|
17
|
+
readonly nonDeletable: Uint8Array;
|
|
18
|
+
}
|
|
19
|
+
interface WpdFixedFunctionToken {
|
|
20
|
+
readonly kind: "fixedFunction";
|
|
21
|
+
readonly code: number;
|
|
22
|
+
readonly data: Uint8Array;
|
|
23
|
+
}
|
|
24
|
+
type WpdToken = WpdCharacterToken | WpdSingleByteFunctionToken | WpdVariableFunctionToken | WpdFixedFunctionToken;
|
|
25
|
+
declare const FIRST_SINGLE_BYTE_FUNCTION = 128;
|
|
26
|
+
declare const FIRST_VARIABLE_FUNCTION = 208;
|
|
27
|
+
declare const FIRST_FIXED_FUNCTION = 240;
|
|
28
|
+
declare function tokeniseDocumentArea(bytes: Uint8Array, offset: number, limit?: number): WpdToken[];
|
|
29
|
+
//#endregion
|
|
30
|
+
export { FIRST_FIXED_FUNCTION, FIRST_SINGLE_BYTE_FUNCTION, FIRST_VARIABLE_FUNCTION, WpdCharacterToken, WpdFixedFunctionToken, WpdSingleByteFunctionToken, WpdToken, WpdVariableFunctionToken, tokeniseDocumentArea };
|
|
@@ -0,0 +1,121 @@
|
|
|
1
|
+
import { WpdFormatError } from "../errors.js";
|
|
2
|
+
import { byteAt, sliceAt, uint16At } from "../bytes/view.js";
|
|
3
|
+
//#region src/stream/tokenise.ts
|
|
4
|
+
const FIRST_SINGLE_BYTE_FUNCTION = 128;
|
|
5
|
+
const FIRST_VARIABLE_FUNCTION = 208;
|
|
6
|
+
const FIRST_FIXED_FUNCTION = 240;
|
|
7
|
+
const FIXED_FUNCTION_SIZES = [
|
|
8
|
+
4,
|
|
9
|
+
5,
|
|
10
|
+
3,
|
|
11
|
+
3,
|
|
12
|
+
3,
|
|
13
|
+
3,
|
|
14
|
+
4,
|
|
15
|
+
4,
|
|
16
|
+
4,
|
|
17
|
+
5,
|
|
18
|
+
5,
|
|
19
|
+
6,
|
|
20
|
+
6,
|
|
21
|
+
8,
|
|
22
|
+
8
|
|
23
|
+
];
|
|
24
|
+
const MIN_VARIABLE_FUNCTION_SIZE = 10;
|
|
25
|
+
const VARIABLE_FUNCTION_TRAILER_SIZE = 3;
|
|
26
|
+
function readVariableFunction(bytes, offset, limit) {
|
|
27
|
+
const group = byteAt(bytes, offset);
|
|
28
|
+
const subgroup = byteAt(bytes, offset + 1);
|
|
29
|
+
const size = uint16At(bytes, offset + 2);
|
|
30
|
+
const flags = byteAt(bytes, offset + 4);
|
|
31
|
+
if (size < MIN_VARIABLE_FUNCTION_SIZE) throw new WpdFormatError(`The variable-length function 0x${group.toString(16).toUpperCase()} at offset ${offset} declares a size of ${size}, below the ${MIN_VARIABLE_FUNCTION_SIZE} bytes its own gates and fields occupy.`);
|
|
32
|
+
const end = offset + size;
|
|
33
|
+
if (end > limit) throw new WpdFormatError(`The variable-length function 0x${group.toString(16).toUpperCase()} at offset ${offset} declares a size of ${size}, which runs past the end of the document area at offset ${limit}.`);
|
|
34
|
+
let cursor = offset + 5;
|
|
35
|
+
const prefixIds = [];
|
|
36
|
+
if ((flags & 128) !== 0) {
|
|
37
|
+
const prefixIdCount = byteAt(bytes, cursor);
|
|
38
|
+
cursor += 1;
|
|
39
|
+
for (let index = 0; index < prefixIdCount; index += 1) {
|
|
40
|
+
prefixIds.push(uint16At(bytes, cursor));
|
|
41
|
+
cursor += 2;
|
|
42
|
+
}
|
|
43
|
+
}
|
|
44
|
+
const nonDeletableSize = uint16At(bytes, cursor);
|
|
45
|
+
cursor += 2;
|
|
46
|
+
const availableForData = end - VARIABLE_FUNCTION_TRAILER_SIZE - cursor;
|
|
47
|
+
if (nonDeletableSize > availableForData) throw new WpdFormatError(`The variable-length function 0x${group.toString(16).toUpperCase()} subgroup ${subgroup} at offset ${offset} declares ${nonDeletableSize} bytes of non-deletable data, but only ${availableForData} remain inside its own ${size}-byte extent.`);
|
|
48
|
+
const nonDeletable = sliceAt(bytes, cursor, nonDeletableSize);
|
|
49
|
+
const trailingSize = uint16At(bytes, end - 3);
|
|
50
|
+
if (trailingSize !== size) throw new WpdFormatError(`The variable-length function 0x${group.toString(16).toUpperCase()} at offset ${offset} opens with size ${size} but closes with size ${trailingSize}.`);
|
|
51
|
+
const endGate = byteAt(bytes, end - 1);
|
|
52
|
+
if (endGate !== group) throw new WpdFormatError(`The variable-length function at offset ${offset} opens with gate 0x${group.toString(16).toUpperCase()} but closes with 0x${endGate.toString(16).toUpperCase()}.`);
|
|
53
|
+
return {
|
|
54
|
+
token: {
|
|
55
|
+
kind: "variableFunction",
|
|
56
|
+
group,
|
|
57
|
+
subgroup,
|
|
58
|
+
size,
|
|
59
|
+
flags,
|
|
60
|
+
prefixIds,
|
|
61
|
+
nonDeletable
|
|
62
|
+
},
|
|
63
|
+
nextOffset: end
|
|
64
|
+
};
|
|
65
|
+
}
|
|
66
|
+
function readFixedFunction(bytes, offset, limit) {
|
|
67
|
+
const code = byteAt(bytes, offset);
|
|
68
|
+
const size = FIXED_FUNCTION_SIZES[code - 240];
|
|
69
|
+
if (size === void 0) throw new WpdFormatError(`Function code 0x${code.toString(16).toUpperCase()} at offset ${offset} cannot appear in a document: -1 is reserved and has no assigned size.`);
|
|
70
|
+
const end = offset + size;
|
|
71
|
+
if (end > limit) throw new WpdFormatError(`The ${size}-byte fixed-length function 0x${code.toString(16).toUpperCase()} at offset ${offset} runs past the end of the document area at offset ${limit}.`);
|
|
72
|
+
const endGate = byteAt(bytes, end - 1);
|
|
73
|
+
if (endGate !== code) throw new WpdFormatError(`The fixed-length function at offset ${offset} opens with gate 0x${code.toString(16).toUpperCase()} but closes with 0x${endGate.toString(16).toUpperCase()}.`);
|
|
74
|
+
return {
|
|
75
|
+
token: {
|
|
76
|
+
kind: "fixedFunction",
|
|
77
|
+
code,
|
|
78
|
+
data: sliceAt(bytes, offset + 1, size - 2)
|
|
79
|
+
},
|
|
80
|
+
nextOffset: end
|
|
81
|
+
};
|
|
82
|
+
}
|
|
83
|
+
function tokeniseDocumentArea(bytes, offset, limit = bytes.length) {
|
|
84
|
+
const tokens = [];
|
|
85
|
+
let cursor = offset;
|
|
86
|
+
while (cursor < limit) {
|
|
87
|
+
const byte = byteAt(bytes, cursor);
|
|
88
|
+
if (byte === 0) {
|
|
89
|
+
cursor += 1;
|
|
90
|
+
continue;
|
|
91
|
+
}
|
|
92
|
+
if (byte < 128) {
|
|
93
|
+
tokens.push({
|
|
94
|
+
kind: "character",
|
|
95
|
+
byte
|
|
96
|
+
});
|
|
97
|
+
cursor += 1;
|
|
98
|
+
continue;
|
|
99
|
+
}
|
|
100
|
+
if (byte < 208) {
|
|
101
|
+
tokens.push({
|
|
102
|
+
kind: "singleByteFunction",
|
|
103
|
+
code: byte
|
|
104
|
+
});
|
|
105
|
+
cursor += 1;
|
|
106
|
+
continue;
|
|
107
|
+
}
|
|
108
|
+
if (byte < 240) {
|
|
109
|
+
const { token, nextOffset } = readVariableFunction(bytes, cursor, limit);
|
|
110
|
+
tokens.push(token);
|
|
111
|
+
cursor = nextOffset;
|
|
112
|
+
continue;
|
|
113
|
+
}
|
|
114
|
+
const { token, nextOffset } = readFixedFunction(bytes, cursor, limit);
|
|
115
|
+
tokens.push(token);
|
|
116
|
+
cursor = nextOffset;
|
|
117
|
+
}
|
|
118
|
+
return tokens;
|
|
119
|
+
}
|
|
120
|
+
//#endregion
|
|
121
|
+
export { FIRST_FIXED_FUNCTION, FIRST_SINGLE_BYTE_FUNCTION, FIRST_VARIABLE_FUNCTION, tokeniseDocumentArea };
|
package/package.json
CHANGED
|
@@ -1,5 +1,99 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "wpd-codec",
|
|
3
|
-
"version": "
|
|
4
|
-
"
|
|
3
|
+
"version": "1.0.1",
|
|
4
|
+
"description": "Hand-written read-only WordPerfect 6.x-X6 (.wpd) reader over document-schema.js's ContentDocument",
|
|
5
|
+
"type": "module",
|
|
6
|
+
"repository": {
|
|
7
|
+
"type": "git",
|
|
8
|
+
"url": "git+https://github.com/ExaDev/documents.js.git",
|
|
9
|
+
"directory": "packages/wpd-codec"
|
|
10
|
+
},
|
|
11
|
+
"homepage": "https://github.com/ExaDev/documents.js/tree/main/packages/wpd-codec",
|
|
12
|
+
"bugs": {
|
|
13
|
+
"url": "https://github.com/ExaDev/documents.js/issues"
|
|
14
|
+
},
|
|
15
|
+
"exports": {
|
|
16
|
+
".": {
|
|
17
|
+
"types": {
|
|
18
|
+
"import": "./dist/index.d.ts",
|
|
19
|
+
"require": "./dist/index.d.cts"
|
|
20
|
+
},
|
|
21
|
+
"import": "./dist/index.js",
|
|
22
|
+
"require": "./dist/index.cjs"
|
|
23
|
+
},
|
|
24
|
+
"./*": {
|
|
25
|
+
"types": {
|
|
26
|
+
"import": "./dist/*.d.ts",
|
|
27
|
+
"require": "./dist/*.d.cts"
|
|
28
|
+
},
|
|
29
|
+
"import": "./dist/*.js",
|
|
30
|
+
"require": "./dist/*.cjs"
|
|
31
|
+
}
|
|
32
|
+
},
|
|
33
|
+
"main": "./dist/index.cjs",
|
|
34
|
+
"module": "./dist/index.js",
|
|
35
|
+
"types": "./dist/index.d.ts",
|
|
36
|
+
"files": [
|
|
37
|
+
"dist"
|
|
38
|
+
],
|
|
39
|
+
"publishConfig": {
|
|
40
|
+
"access": "public",
|
|
41
|
+
"provenance": true,
|
|
42
|
+
"registry": "https://registry.npmjs.org/"
|
|
43
|
+
},
|
|
44
|
+
"sideEffects": false,
|
|
45
|
+
"engines": {
|
|
46
|
+
"node": ">=20"
|
|
47
|
+
},
|
|
48
|
+
"scripts": {
|
|
49
|
+
"build": "turbo run _build",
|
|
50
|
+
"_build": "tsdown",
|
|
51
|
+
"prepublishOnly": "pnpm run lint && pnpm run typecheck && tsdown && publint && attw --pack",
|
|
52
|
+
"lint": "turbo run _lint",
|
|
53
|
+
"_lint": "eslint . --fix --cache --max-warnings 0",
|
|
54
|
+
"typecheck": "turbo run _typecheck _typecheck:node _typecheck:attw",
|
|
55
|
+
"_typecheck": "tsc -p tsconfig.json",
|
|
56
|
+
"_typecheck:node": "tsc -p tsconfig.node.json",
|
|
57
|
+
"_typecheck:attw": "attw --pack",
|
|
58
|
+
"test": "turbo run _test",
|
|
59
|
+
"_test": "vitest run --project unit",
|
|
60
|
+
"test:workers": "turbo run _test:workers",
|
|
61
|
+
"_test:workers": "vitest run --config vitest.workers.config.ts",
|
|
62
|
+
"test:watch": "vitest --project unit",
|
|
63
|
+
"test:coverage": "turbo run _test:coverage",
|
|
64
|
+
"_test:coverage": "vitest run --project unit --coverage",
|
|
65
|
+
"test:smoke": "turbo run _test:smoke",
|
|
66
|
+
"_test:smoke": "vitest run --project smoke",
|
|
67
|
+
"prepare": "husky",
|
|
68
|
+
"release": "semantic-release"
|
|
69
|
+
},
|
|
70
|
+
"keywords": [
|
|
71
|
+
"wordperfect",
|
|
72
|
+
"wpd",
|
|
73
|
+
"codec",
|
|
74
|
+
"legacy",
|
|
75
|
+
"document",
|
|
76
|
+
"zod"
|
|
77
|
+
],
|
|
78
|
+
"license": "MIT",
|
|
79
|
+
"packageManager": "pnpm@11.6.0",
|
|
80
|
+
"dependencies": {
|
|
81
|
+
"archive-codec": "^1.3.0",
|
|
82
|
+
"document-schema.js": "^5.4.0",
|
|
83
|
+
"zod": "^4.4.3"
|
|
84
|
+
},
|
|
85
|
+
"devDependencies": {
|
|
86
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
87
|
+
"@cloudflare/vitest-pool-workers": "^0.21.2",
|
|
88
|
+
"@types/node": "^26.1.1",
|
|
89
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
90
|
+
"eslint": "^10.8.0",
|
|
91
|
+
"husky": "^9.1.7",
|
|
92
|
+
"publint": "^0.3.21",
|
|
93
|
+
"semantic-release": "^25.0.8",
|
|
94
|
+
"tsdown": "^0.22.13",
|
|
95
|
+
"turbo": "^2.10.8",
|
|
96
|
+
"typescript": "^6.0.3",
|
|
97
|
+
"vitest": "^4.1.10"
|
|
98
|
+
}
|
|
5
99
|
}
|