document-outline.js 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/dist/index.js ADDED
@@ -0,0 +1,542 @@
1
+ import { applyParagraphStyleProperties, applyRunStyleProperties, isHeadingGroupNode, isListGroupNode, isPackageLeaf, isSectionConstructGroupNode, isShapeConstructGroupNode, isShapeGroupNode, resolveStyleChain } from "document-schema.js";
2
+ import { z } from "zod";
3
+ //#region src/outline/build.ts
4
+ function buildOutline(pkg) {
5
+ switch (pkg.kind) {
6
+ case "wordprocessing": return wordprocessingOutline(pkg.children);
7
+ case "presentation": return presentationOutline(pkg.children);
8
+ case "spreadsheet": return spreadsheetOutline(pkg.children);
9
+ case "drawing": return drawingOutline(pkg.children);
10
+ case "formula": return formulaOutline(pkg.children[0]);
11
+ }
12
+ }
13
+ function freshSectionFlowScope() {
14
+ return {
15
+ root: [],
16
+ headingStack: [],
17
+ listStack: []
18
+ };
19
+ }
20
+ function headingScopeOf(scope) {
21
+ return scope.headingStack.at(-1)?.children ?? scope.root;
22
+ }
23
+ function walkSectionFlow(scope, children) {
24
+ for (const child of children) if (isHeadingGroupNode(child)) {
25
+ scope.listStack.length = 0;
26
+ const level = child.node.headingLevel;
27
+ for (let top = scope.headingStack.at(-1); top !== void 0 && top.level >= level; top = scope.headingStack.at(-1)) scope.headingStack.pop();
28
+ const node = {
29
+ text: paragraphText(child.node),
30
+ level,
31
+ children: []
32
+ };
33
+ const parent = scope.headingStack.at(-1);
34
+ (parent !== void 0 ? parent.children : scope.root).push(node);
35
+ scope.headingStack.push(node);
36
+ walkSectionFlow(scope, child.children);
37
+ } else if (isListGroupNode(child)) {
38
+ openListGroup(scope.listStack, headingScopeOf(scope), paragraphText(child.node), child.node.list.level);
39
+ walkSectionFlow(scope, child.children);
40
+ } else if (isSectionConstructGroupNode(child)) {
41
+ const parent = scope.listStack.at(-1);
42
+ (parent !== void 0 ? parent.children : headingScopeOf(scope)).push(...projectSectionFlow(child.children));
43
+ } else if (child.kind === "paragraph") {
44
+ scope.listStack.length = 0;
45
+ headingScopeOf(scope).push(child);
46
+ } else {
47
+ const parent = scope.listStack.at(-1);
48
+ (parent !== void 0 ? parent.children : headingScopeOf(scope)).push(child);
49
+ }
50
+ }
51
+ function projectSectionFlow(children) {
52
+ const scope = freshSectionFlowScope();
53
+ walkSectionFlow(scope, children);
54
+ return scope.root;
55
+ }
56
+ function wordprocessingOutline(sections) {
57
+ const scope = freshSectionFlowScope();
58
+ for (const section of sections) walkSectionFlow(scope, section.children);
59
+ return scope.root;
60
+ }
61
+ function walkShapeFlow(listStack, scope, children) {
62
+ for (const child of children) if (isListGroupNode(child)) {
63
+ openListGroup(listStack, scope, paragraphText(child.node), child.node.list.level);
64
+ walkShapeFlow(listStack, scope, child.children);
65
+ } else if (isShapeConstructGroupNode(child)) {
66
+ const parent = listStack.at(-1);
67
+ (parent !== void 0 ? parent.children : scope).push(...projectShapeFlow(child.children));
68
+ } else if (child.kind === "paragraph") {
69
+ listStack.length = 0;
70
+ scope.push(child);
71
+ } else {
72
+ const parent = listStack.at(-1);
73
+ (parent !== void 0 ? parent.children : scope).push(child);
74
+ }
75
+ }
76
+ function projectShapeFlow(children) {
77
+ const scope = [];
78
+ walkShapeFlow([], scope, children);
79
+ return scope;
80
+ }
81
+ function presentationOutline(slides) {
82
+ return slides.map((slide, index) => {
83
+ const group = {
84
+ text: `Slide ${String(index + 1)}`,
85
+ level: 1,
86
+ children: []
87
+ };
88
+ const listStack = [];
89
+ for (const shape of slide.children) walkShapeFlow(listStack, group.children, shape.children);
90
+ return group;
91
+ });
92
+ }
93
+ function spreadsheetOutline(sheets) {
94
+ return sheets.map((sheet) => ({
95
+ text: sheet.node.name,
96
+ level: 1,
97
+ children: [...sheet.children]
98
+ }));
99
+ }
100
+ function drawingOutline(pages) {
101
+ return pages.map((page, index) => ({
102
+ text: `Page ${String(index + 1)}`,
103
+ level: 1,
104
+ children: page.children.flatMap((child) => isShapeGroupNode(child) ? flattenShapeChildren(child) : [child])
105
+ }));
106
+ }
107
+ function flattenShapeChildren(group) {
108
+ return flattenListFlow(group.children);
109
+ }
110
+ function flattenListFlow(children) {
111
+ const leaves = [];
112
+ for (const child of children) if (isListGroupNode(child)) leaves.push(child.node, ...flattenListFlow(child.children));
113
+ else if (isShapeConstructGroupNode(child)) leaves.push(...flattenListFlow(child.children));
114
+ else leaves.push(child);
115
+ return leaves;
116
+ }
117
+ function formulaOutline(formula) {
118
+ return [{
119
+ text: formula.presentation?.latex ?? "",
120
+ level: 1,
121
+ children: [formula]
122
+ }];
123
+ }
124
+ function openListGroup(listStack, scopeChildren, text, level) {
125
+ for (let top = listStack.at(-1); top !== void 0 && top.level >= level; top = listStack.at(-1)) listStack.pop();
126
+ const node = {
127
+ text,
128
+ level,
129
+ children: []
130
+ };
131
+ const parent = listStack.at(-1);
132
+ (parent !== void 0 ? parent.children : scopeChildren).push(node);
133
+ listStack.push(node);
134
+ }
135
+ function paragraphText(paragraph) {
136
+ return paragraph.runs.map((run) => run.text).join("");
137
+ }
138
+ //#endregion
139
+ //#region src/outline/effective.ts
140
+ function effectivePackage(pkg) {
141
+ const styles = pkg.styles;
142
+ if (styles === void 0) return pkg;
143
+ switch (pkg.kind) {
144
+ case "wordprocessing": return withoutStyles({
145
+ ...pkg,
146
+ children: pkg.children.map((group) => resolveSectionGroup(styles, [], group))
147
+ });
148
+ case "presentation": return withoutStyles({
149
+ ...pkg,
150
+ children: pkg.children.map((group) => resolveSlideGroup(styles, [], group))
151
+ });
152
+ case "spreadsheet": return withoutStyles({
153
+ ...pkg,
154
+ children: pkg.children.map(resolveSheetGroup)
155
+ });
156
+ case "drawing": return withoutStyles({
157
+ ...pkg,
158
+ children: pkg.children.map((group) => resolveDrawPageGroup(styles, [], group))
159
+ });
160
+ case "formula": return withoutStyles({ ...pkg });
161
+ }
162
+ }
163
+ function withoutStyles(pkg) {
164
+ const copy = { ...pkg };
165
+ delete copy.styles;
166
+ return copy;
167
+ }
168
+ function chainWithRef(chain, group) {
169
+ return group.style === void 0 ? chain : [...chain, group.style];
170
+ }
171
+ function resolveSectionGroup(styles, chain, group) {
172
+ const children = resolveSectionChildren(styles, chainWithRef(chain, group), group.children);
173
+ if (group.style === void 0 && children === group.children) return group;
174
+ return {
175
+ node: group.node,
176
+ children
177
+ };
178
+ }
179
+ function resolveSlideGroup(styles, chain, group) {
180
+ const own = chainWithRef(chain, group);
181
+ let changed = group.style !== void 0;
182
+ const children = [];
183
+ for (const shape of group.children) {
184
+ const resolved = resolveShapeGroup(styles, own, shape);
185
+ changed ||= resolved !== shape;
186
+ children.push(resolved);
187
+ }
188
+ if (!changed) return group;
189
+ return {
190
+ node: group.node,
191
+ children
192
+ };
193
+ }
194
+ function resolveSheetGroup(group) {
195
+ return group.style === void 0 ? group : {
196
+ node: group.node,
197
+ children: group.children
198
+ };
199
+ }
200
+ function resolveDrawPageGroup(styles, chain, group) {
201
+ const own = chainWithRef(chain, group);
202
+ let changed = group.style !== void 0;
203
+ const children = [];
204
+ for (const child of group.children) {
205
+ const resolved = isShapeGroup(child) ? resolveShapeGroup(styles, own, child) : child;
206
+ changed ||= resolved !== child;
207
+ children.push(resolved);
208
+ }
209
+ if (!changed) return group;
210
+ return {
211
+ node: group.node,
212
+ children
213
+ };
214
+ }
215
+ function resolveShapeGroup(styles, chain, group) {
216
+ const children = resolveListChildren(styles, chainWithRef(chain, group), group.children);
217
+ if (group.style === void 0 && children === group.children) return group;
218
+ return {
219
+ node: group.node,
220
+ children
221
+ };
222
+ }
223
+ function resolveSectionConstructGroup(styles, chain, group) {
224
+ const children = resolveSectionChildren(styles, chainWithRef(chain, group), group.children);
225
+ if (group.style === void 0 && children === group.children) return group;
226
+ return {
227
+ node: group.node,
228
+ children
229
+ };
230
+ }
231
+ function resolveShapeConstructGroup(styles, chain, group) {
232
+ const children = resolveListChildren(styles, chainWithRef(chain, group), group.children);
233
+ if (group.style === void 0 && children === group.children) return group;
234
+ return {
235
+ node: group.node,
236
+ children
237
+ };
238
+ }
239
+ function resolveHeadingGroup(styles, chain, group) {
240
+ const own = chainWithRef(chain, group);
241
+ const entry = own.length > 0 ? resolveStyleChain(styles, own) : void 0;
242
+ let anchor = group.node;
243
+ if (entry !== void 0) {
244
+ const applied = applyEntry(entry, group.node);
245
+ assertResolvedHeadingAnchor(applied);
246
+ anchor = applied;
247
+ }
248
+ const children = resolveSectionChildren(styles, own, group.children);
249
+ if (group.style === void 0 && anchor === group.node && children === group.children) return group;
250
+ return {
251
+ node: anchor,
252
+ children
253
+ };
254
+ }
255
+ function resolveListGroup(styles, chain, group) {
256
+ const own = chainWithRef(chain, group);
257
+ const entry = own.length > 0 ? resolveStyleChain(styles, own) : void 0;
258
+ let anchor = group.node;
259
+ if (entry !== void 0) {
260
+ const applied = applyEntry(entry, group.node);
261
+ assertResolvedListAnchor(applied);
262
+ anchor = applied;
263
+ }
264
+ const children = resolveListChildren(styles, own, group.children);
265
+ if (group.style === void 0 && anchor === group.node && children === group.children) return group;
266
+ return {
267
+ node: anchor,
268
+ children
269
+ };
270
+ }
271
+ function assertResolvedHeadingAnchor(paragraph) {
272
+ if (paragraph.headingLevel === void 0) throw new Error("effectivePackage: resolution dropped a heading anchor's headingLevel");
273
+ }
274
+ function assertResolvedListAnchor(paragraph) {
275
+ if (paragraph.list === void 0) throw new Error("effectivePackage: resolution dropped a list anchor's list membership");
276
+ }
277
+ function resolveSectionChildren(styles, chain, children) {
278
+ let changed = false;
279
+ const out = [];
280
+ for (const child of children) {
281
+ let resolved;
282
+ if (isHeadingGroupNode(child)) resolved = resolveHeadingGroup(styles, chain, child);
283
+ else if (isListGroupNode(child)) resolved = resolveListGroup(styles, chain, child);
284
+ else if (isSectionConstructGroupNode(child)) resolved = resolveSectionConstructGroup(styles, chain, child);
285
+ else if (child.kind === "paragraph") resolved = resolveParagraphLeaf(styles, chain, child);
286
+ else resolved = child;
287
+ changed ||= resolved !== child;
288
+ out.push(resolved);
289
+ }
290
+ return changed ? out : children;
291
+ }
292
+ function resolveListChildren(styles, chain, children) {
293
+ let changed = false;
294
+ const out = [];
295
+ for (const child of children) {
296
+ let resolved;
297
+ if (isListGroupNode(child)) resolved = resolveListGroup(styles, chain, child);
298
+ else if (isShapeConstructGroupNode(child)) resolved = resolveShapeConstructGroup(styles, chain, child);
299
+ else if (child.kind === "paragraph") resolved = resolveParagraphLeaf(styles, chain, child);
300
+ else resolved = child;
301
+ changed ||= resolved !== child;
302
+ out.push(resolved);
303
+ }
304
+ return changed ? out : children;
305
+ }
306
+ function resolveParagraphLeaf(styles, chain, leaf) {
307
+ if (chain.length === 0) return leaf;
308
+ return applyEntry(resolveStyleChain(styles, chain), leaf);
309
+ }
310
+ function applyEntry(entry, paragraph) {
311
+ const withParagraph = applyParagraphStyleProperties(entry.paragraph, paragraph);
312
+ const runProperties = entry.run;
313
+ if (runProperties === void 0) return withParagraph;
314
+ return {
315
+ ...withParagraph,
316
+ runs: withParagraph.runs.map((run) => applyRunStyleProperties(runProperties, run))
317
+ };
318
+ }
319
+ function isShapeGroup(child) {
320
+ return "node" in child;
321
+ }
322
+ //#endregion
323
+ //#region src/outline/node.ts
324
+ function isOutlineLeaf(value) {
325
+ return isPackageLeaf(value);
326
+ }
327
+ function isOutlineChild(value) {
328
+ return isOutlineNode(value) || isOutlineLeaf(value);
329
+ }
330
+ function isOutlineNode(value) {
331
+ if (typeof value !== "object" || value === null || Array.isArray(value)) return false;
332
+ if (!("text" in value) || typeof value.text !== "string") return false;
333
+ if (!("level" in value) || typeof value.level !== "number" || !Number.isFinite(value.level)) return false;
334
+ if (!("children" in value) || !Array.isArray(value.children)) return false;
335
+ return value.children.every(isOutlineChild);
336
+ }
337
+ const OutlineNodeSchema = z.custom(isOutlineNode);
338
+ //#endregion
339
+ //#region src/outline/hash.ts
340
+ function stableContentHash(value) {
341
+ return sha256Hex(new TextEncoder().encode(JSON.stringify(canonicalise(stripSchemaKeys(value)))));
342
+ }
343
+ function isRecord(value) {
344
+ return typeof value === "object" && value !== null && !Array.isArray(value);
345
+ }
346
+ function stripSchemaKeys(value) {
347
+ if (Array.isArray(value)) return value.map(stripSchemaKeys);
348
+ if (isRecord(value)) {
349
+ const stripped = {};
350
+ for (const [key, entry] of Object.entries(value)) {
351
+ if (key === "$schema") continue;
352
+ stripped[key] = stripSchemaKeys(entry);
353
+ }
354
+ return stripped;
355
+ }
356
+ return value;
357
+ }
358
+ function canonicalise(value) {
359
+ if (Array.isArray(value)) return value.map(canonicalise);
360
+ if (isRecord(value)) {
361
+ const sorted = {};
362
+ for (const key of Object.keys(value).sort()) sorted[key] = canonicalise(value[key]);
363
+ return sorted;
364
+ }
365
+ return value;
366
+ }
367
+ function sha256Hex(bytes) {
368
+ const digest = sha256(bytes);
369
+ let hex = "";
370
+ for (const byte of digest) hex += byte.toString(16).padStart(2, "0");
371
+ return hex;
372
+ }
373
+ const K = [
374
+ 1116352408,
375
+ 1899447441,
376
+ 3049323471,
377
+ 3921009573,
378
+ 961987163,
379
+ 1508970993,
380
+ 2453635748,
381
+ 2870763221,
382
+ 3624381080,
383
+ 310598401,
384
+ 607225278,
385
+ 1426881987,
386
+ 1925078388,
387
+ 2162078206,
388
+ 2614888103,
389
+ 3248222580,
390
+ 3835390401,
391
+ 4022224774,
392
+ 264347078,
393
+ 604807628,
394
+ 770255983,
395
+ 1249150122,
396
+ 1555081692,
397
+ 1996064986,
398
+ 2554220882,
399
+ 2821834349,
400
+ 2952996808,
401
+ 3210313671,
402
+ 3336571891,
403
+ 3584528711,
404
+ 113926993,
405
+ 338241895,
406
+ 666307205,
407
+ 773529912,
408
+ 1294757372,
409
+ 1396182291,
410
+ 1695183700,
411
+ 1986661051,
412
+ 2177026350,
413
+ 2456956037,
414
+ 2730485921,
415
+ 2820302411,
416
+ 3259730800,
417
+ 3345764771,
418
+ 3516065817,
419
+ 3600352804,
420
+ 4094571909,
421
+ 275423344,
422
+ 430227734,
423
+ 506948616,
424
+ 659060556,
425
+ 883997877,
426
+ 958139571,
427
+ 1322822218,
428
+ 1537002063,
429
+ 1747873779,
430
+ 1955562222,
431
+ 2024104815,
432
+ 2227730452,
433
+ 2361852424,
434
+ 2428436474,
435
+ 2756734187,
436
+ 3204031479,
437
+ 3329325298
438
+ ];
439
+ function rotr(x, n) {
440
+ return (x >>> n | x << 32 - n) >>> 0;
441
+ }
442
+ function sha256(bytes) {
443
+ const bitLength = bytes.length * 8;
444
+ const paddedLength = (bytes.length + 8 >> 6) + 1 << 6;
445
+ const padded = new Uint8Array(paddedLength);
446
+ padded.set(bytes);
447
+ padded[bytes.length] = 128;
448
+ const view = new DataView(padded.buffer);
449
+ view.setUint32(paddedLength - 8, Math.floor(bitLength / 4294967296));
450
+ view.setUint32(paddedLength - 4, bitLength >>> 0);
451
+ let h0 = 1779033703;
452
+ let h1 = 3144134277;
453
+ let h2 = 1013904242;
454
+ let h3 = 2773480762;
455
+ let h4 = 1359893119;
456
+ let h5 = 2600822924;
457
+ let h6 = 528734635;
458
+ let h7 = 1541459225;
459
+ const w = /* @__PURE__ */ new Uint32Array(64);
460
+ for (let offset = 0; offset < paddedLength; offset += 64) {
461
+ for (let i = 0; i < 16; i++) w[i] = view.getUint32(offset + i * 4);
462
+ for (let i = 16; i < 64; i++) {
463
+ const w15 = w[i - 15];
464
+ const w2 = w[i - 2];
465
+ const s0 = rotr(w15, 7) ^ rotr(w15, 18) ^ w15 >>> 3;
466
+ const s1 = rotr(w2, 17) ^ rotr(w2, 19) ^ w2 >>> 10;
467
+ w[i] = w[i - 16] + s0 + w[i - 7] + s1 >>> 0;
468
+ }
469
+ let a = h0;
470
+ let b = h1;
471
+ let c = h2;
472
+ let d = h3;
473
+ let e = h4;
474
+ let f = h5;
475
+ let g = h6;
476
+ let h = h7;
477
+ for (let i = 0; i < 64; i++) {
478
+ const s1 = rotr(e, 6) ^ rotr(e, 11) ^ rotr(e, 25);
479
+ const ch = e & f ^ ~e & g;
480
+ const temp1 = h + s1 + ch + K[i] + w[i] >>> 0;
481
+ const temp2 = (rotr(a, 2) ^ rotr(a, 13) ^ rotr(a, 22)) + (a & b ^ a & c ^ b & c) >>> 0;
482
+ h = g;
483
+ g = f;
484
+ f = e;
485
+ e = d + temp1 >>> 0;
486
+ d = c;
487
+ c = b;
488
+ b = a;
489
+ a = temp1 + temp2 >>> 0;
490
+ }
491
+ h0 = h0 + a >>> 0;
492
+ h1 = h1 + b >>> 0;
493
+ h2 = h2 + c >>> 0;
494
+ h3 = h3 + d >>> 0;
495
+ h4 = h4 + e >>> 0;
496
+ h5 = h5 + f >>> 0;
497
+ h6 = h6 + g >>> 0;
498
+ h7 = h7 + h >>> 0;
499
+ }
500
+ const digest = /* @__PURE__ */ new Uint8Array(32);
501
+ const out = new DataView(digest.buffer);
502
+ out.setUint32(0, h0);
503
+ out.setUint32(4, h1);
504
+ out.setUint32(8, h2);
505
+ out.setUint32(12, h3);
506
+ out.setUint32(16, h4);
507
+ out.setUint32(20, h5);
508
+ out.setUint32(24, h6);
509
+ out.setUint32(28, h7);
510
+ return digest;
511
+ }
512
+ //#endregion
513
+ //#region src/outline/helpers.ts
514
+ function flattenOutline(children) {
515
+ const leaves = [];
516
+ const walk = (subtree) => {
517
+ for (const child of subtree) if (isOutlineNode(child)) walk(child.children);
518
+ else leaves.push(child);
519
+ };
520
+ walk(children);
521
+ return leaves;
522
+ }
523
+ function outlineLeafText(leaf) {
524
+ if ("runs" in leaf) return leaf.runs.map((run) => run.text).join("");
525
+ if ("rows" in leaf) return leaf.rows.map((row) => row.cells.map((cell) => blockTexts(cell.blocks).join(" ")).join(" ")).join("\n");
526
+ if ("base64" in leaf) return leaf.altText ?? "";
527
+ if ("mathml" in leaf) return leaf.presentation?.latex ?? "";
528
+ return "";
529
+ }
530
+ function blockTexts(blocks) {
531
+ const parts = [];
532
+ for (const block of blocks) {
533
+ if (block.kind === "paragraph") parts.push(block.runs.map((run) => run.text).join(""));
534
+ if (block.kind === "table") parts.push(...block.rows.flatMap((row) => row.cells.map((cell) => blockTexts(cell.blocks).join(" "))));
535
+ }
536
+ return parts;
537
+ }
538
+ function leafContentHash(leaf) {
539
+ return stableContentHash(leaf);
540
+ }
541
+ //#endregion
542
+ export { OutlineNodeSchema, buildOutline, effectivePackage, flattenOutline, isOutlineChild, isOutlineLeaf, isOutlineNode, leafContentHash, outlineLeafText };
package/package.json CHANGED
@@ -1,5 +1,94 @@
1
1
  {
2
2
  "name": "document-outline.js",
3
- "version": "0.0.0",
4
- "private": false
3
+ "version": "1.0.1",
4
+ "description": "Utilities for consumers holding a tree-form DocumentPackage - the TOC outline projection, effective-property resolution, and flatten/leaf-text/stable-hash helpers, the outline package for the documents.js family.",
5
+ "type": "module",
6
+ "repository": {
7
+ "type": "git",
8
+ "url": "git+https://github.com/ExaDev/documents.js.git",
9
+ "directory": "packages/document-outline.js"
10
+ },
11
+ "homepage": "https://github.com/ExaDev/document-outline.js#readme",
12
+ "bugs": {
13
+ "url": "https://github.com/ExaDev/document-outline.js/issues"
14
+ },
15
+ "license": "MIT",
16
+ "exports": {
17
+ ".": {
18
+ "types": {
19
+ "import": "./dist/index.d.ts",
20
+ "require": "./dist/index.d.cts"
21
+ },
22
+ "import": "./dist/index.js",
23
+ "require": "./dist/index.cjs"
24
+ },
25
+ "./*": {
26
+ "types": {
27
+ "import": "./dist/*.d.ts",
28
+ "require": "./dist/*.d.cts"
29
+ },
30
+ "import": "./dist/*.js",
31
+ "require": "./dist/*.cjs"
32
+ }
33
+ },
34
+ "main": "./dist/index.cjs",
35
+ "module": "./dist/index.js",
36
+ "types": "./dist/index.d.ts",
37
+ "files": [
38
+ "dist"
39
+ ],
40
+ "publishConfig": {
41
+ "access": "public",
42
+ "provenance": true,
43
+ "registry": "https://registry.npmjs.org/"
44
+ },
45
+ "sideEffects": false,
46
+ "engines": {
47
+ "node": ">=20"
48
+ },
49
+ "scripts": {
50
+ "build": "turbo run _build",
51
+ "_build": "tsdown",
52
+ "prepublishOnly": "pnpm run lint && pnpm run typecheck && tsdown && publint && attw --pack",
53
+ "lint": "turbo run _lint",
54
+ "_lint": "eslint . --fix --cache --max-warnings 0",
55
+ "lint:check": "eslint . --max-warnings 0",
56
+ "typecheck": "turbo run _typecheck",
57
+ "_typecheck": "tsc -p tsconfig.json && tsc -p tsconfig.node.json",
58
+ "test": "turbo run _test",
59
+ "_test": "vitest run",
60
+ "test:watch": "vitest",
61
+ "test:workers": "turbo run _test:workers",
62
+ "_test:workers": "vitest run --config vitest.workers.config.ts",
63
+ "prepare": "husky"
64
+ },
65
+ "packageManager": "pnpm@11.6.0",
66
+ "dependencies": {
67
+ "document-schema.js": "^4.3.4",
68
+ "zod": "^4.4.3"
69
+ },
70
+ "devDependencies": {
71
+ "@arethetypeswrong/cli": "^0.18.5",
72
+ "@cloudflare/vitest-pool-workers": "^0.20.1",
73
+ "@commitlint/cli": "^21.2.1",
74
+ "@commitlint/config-conventional": "^21.2.0",
75
+ "@eslint/js": "^10.0.1",
76
+ "@semantic-release/changelog": "^7.0.0",
77
+ "@semantic-release/git": "^11.0.1",
78
+ "@types/node": "^26.1.2",
79
+ "eslint": "^10.8.0",
80
+ "globals": "^17.8.0",
81
+ "husky": "^9.1.7",
82
+ "lint-staged": "^17.2.0",
83
+ "publint": "^0.3.21",
84
+ "semantic-release": "^25.0.8",
85
+ "tsdown": "^0.22.13",
86
+ "turbo": "^2.10.8",
87
+ "typescript": "^6.0.3",
88
+ "typescript-eslint": "^8.65.0",
89
+ "vitest": "^4.1.10"
90
+ },
91
+ "lint-staged": {
92
+ "*.ts": "eslint --fix"
93
+ }
5
94
  }