@happyvertical/spreadsheets 0.0.0-stage → 0.112.3

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/io.d.ts ADDED
@@ -0,0 +1,4 @@
1
+ import { type SpreadsheetLimits } from './errors.js';
2
+ import { type Workbook } from './model.js';
3
+ export declare function validateWorkbook(workbook: Workbook, limits: SpreadsheetLimits): void;
4
+ //# sourceMappingURL=io.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"io.d.ts","sourceRoot":"","sources":["../src/io.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,aAAa,CAAC;AACrB,OAAO,EAAmC,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE5E,wBAAgB,gBAAgB,CAC9B,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,iBAAiB,GACxB,IAAI,CAwHN"}
@@ -0,0 +1,104 @@
1
+ /** Coordinates are one-based throughout the public model. */
2
+ export interface Point {
3
+ row: number;
4
+ col: number;
5
+ }
6
+ export interface Range {
7
+ start: Point;
8
+ end: Point;
9
+ }
10
+ export interface Reference {
11
+ sheet?: string;
12
+ range: Range;
13
+ absolute: {
14
+ startRow: boolean;
15
+ startCol: boolean;
16
+ endRow: boolean;
17
+ endCol: boolean;
18
+ };
19
+ name?: string;
20
+ }
21
+ export interface Formula {
22
+ /** Formula text without a leading equals sign. No evaluation is performed. */
23
+ text: string;
24
+ dialect: 'excel-a1';
25
+ references: Reference[];
26
+ functions: string[];
27
+ arrayRange?: Range;
28
+ }
29
+ export type CellType = 'text' | 'number' | 'boolean' | 'date' | 'error' | 'empty';
30
+ export type FormatKind = 'general' | 'number' | 'currency' | 'percent' | 'date' | 'time' | 'datetime' | 'text';
31
+ export interface Cell {
32
+ value: string | number | boolean | Date | null;
33
+ type: CellType;
34
+ raw?: number;
35
+ /** Original lexical field for CSV. */
36
+ originalText?: string;
37
+ error?: string;
38
+ formula?: Formula;
39
+ numberFormat?: string;
40
+ formatKind?: FormatKind;
41
+ }
42
+ export interface Table {
43
+ name: string;
44
+ range: Range;
45
+ headerRow: boolean;
46
+ totalsRow: boolean;
47
+ columns: string[];
48
+ }
49
+ export interface DataValidation {
50
+ ranges: Range[];
51
+ kind: 'list' | 'whole' | 'decimal' | 'date' | 'textLength' | 'custom';
52
+ values?: string[];
53
+ source?: Reference;
54
+ formula?: string;
55
+ }
56
+ export interface DefinedName {
57
+ name: string;
58
+ scope?: string;
59
+ reference?: Reference;
60
+ text: string;
61
+ }
62
+ export interface Sheet {
63
+ name: string;
64
+ state: 'visible' | 'hidden' | 'veryHidden';
65
+ dimension?: Range;
66
+ cells: SparseCells;
67
+ merges: Range[];
68
+ tables: Table[];
69
+ validations: DataValidation[];
70
+ frozen?: {
71
+ rows: number;
72
+ cols: number;
73
+ };
74
+ columnWidths?: Record<number, number>;
75
+ }
76
+ export interface Workbook {
77
+ sheets: Sheet[];
78
+ definedNames: DefinedName[];
79
+ dateSystem: 1900 | 1904;
80
+ source: {
81
+ format: string;
82
+ };
83
+ }
84
+ export declare function columnName(col: number): string;
85
+ export declare function address(point: Point): string;
86
+ export declare function point(a1: string): Point;
87
+ export declare function range(a1: string): Range;
88
+ export declare function rangeAddress(value: Range): string;
89
+ export declare function contains(value: Range, p: Point): boolean;
90
+ /** Sparse storage; iteration and rows are ordered numerically, never by dimension. */
91
+ export declare class SparseCells implements Iterable<[Point, Cell]> {
92
+ private readonly data;
93
+ private count;
94
+ get size(): number;
95
+ get(a1: string): Cell | undefined;
96
+ get(row: number, col: number): Cell | undefined;
97
+ set(a1: string, cell: Cell): this;
98
+ set(row: number, col: number, cell: Cell): this;
99
+ rows(): IterableIterator<[number, ReadonlyMap<number, Cell>]>;
100
+ [Symbol.iterator](): IterableIterator<[Point, Cell]>;
101
+ }
102
+ export declare function createSheet(name: string): Sheet;
103
+ export declare function createWorkbook(sheets?: Sheet[]): Workbook;
104
+ //# sourceMappingUR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BAAgB,CAAC,CAAC,KAAK,EAAE,IAAI,CAAC,CAAC;CAItD;AACD,wBAAgB,WAAW,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAS/C;AACD,wBAAgB,cAAc,CAAC,MAAM,GAAE,KAAK,EAAO,GAAG,QAAQ,CAO7D"}
@@ -0,0 +1,77 @@
1
+ import { type SpreadsheetLimits } from './errors.js';
2
+ import { type Cell, type CellType, type FormatKind, type Range, type Workbook } from './model.js';
3
+ export interface ProfileOptions extends Partial<SpreadsheetLimits> {
4
+ maxProfileWork?: number;
5
+ overlapThreshold?: number;
6
+ sampleSize?: number;
7
+ maxProfileCells?: number;
8
+ maxColumnPairs?: number;
9
+ maxDependencyChecks?: number;
10
+ }
11
+ export interface ColumnProfile {
12
+ id: string;
13
+ column: number;
14
+ header?: string;
15
+ typeCounts: Record<CellType, number>;
16
+ blankCount: number;
17
+ distinctCount: number;
18
+ /** Distinct nonblank values divided by nonblank cells. */
19
+ uniqueness: number;
20
+ min?: Cell['value'];
21
+ max?: Cell['value'];
22
+ samples: Cell['value'][];
23
+ dominantFormatKind?: FormatKind;
24
+ formulaDriven: boolean;
25
+ formulaPatterns: {
26
+ pattern: string;
27
+ count: number;
28
+ }[];
29
+ }
30
+ export interface RegionProfile {
31
+ id: string;
32
+ sheet: string;
33
+ range: Range;
34
+ headerRowCandidates: number[];
35
+ totalsRows: number[];
36
+ columns: ColumnProfile[];
37
+ }
38
+ export interface ColumnLink {
39
+ region: string;
40
+ column: number;
41
+ }
42
+ export interface LookupEvidence {
43
+ cell: string;
44
+ sheet: string;
45
+ function: string;
46
+ keyColumn?: ColumnLink;
47
+ targetRegion?: string;
48
+ returnedColumn?: ColumnLink;
49
+ }
50
+ export interface AggregateEvidence {
51
+ cell: string;
52
+ sheet: string;
53
+ function: string;
54
+ criteriaColumns: ColumnLink[];
55
+ measureColumn?: ColumnLink;
56
+ }
57
+ export interface WorkbookProfile {
58
+ sheets: {
59
+ name: string;
60
+ regions: RegionProfile[];
61
+ }[];
62
+ /** Edges run from the formula column to the columns it reads. */
63
+ dependencies: {
64
+ from: ColumnLink;
65
+ to: ColumnLink;
66
+ }[];
67
+ lookups: LookupEvidence[];
68
+ aggregates: AggregateEvidence[];
69
+ overlaps: {
70
+ from: ColumnLink;
71
+ to: ColumnLink;
72
+ sharedDistinct: number;
73
+ share: number;
74
+ }[];
75
+ }
76
+ export declare function profileWorkbook(workbook: Workbook, options?: ProfileOptions): WorkbookProfile;
77
+ //# sourceMappingURL=profile.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"profile.d.ts","sourceRoot":"","sources":["../src/profile.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,aAAa,CAAC;AAMrB,OAAO,EAEL,KAAK,IAAI,EACT,KAAK,QAAQ,EAEb,KAAK,UAAU,EAEf,KAAK,KAAK,EAEV,KAAK,QAAQ,EACd,MAAM,YAAY,CAAC;AAGpB,MAAM,WAAW,cAAe,SAAQ,OAAO,CAAC,iBAAiB,CAAC;IAChE,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,gBAAgB,CAAC,EAAE,MAAM,CAAC;IAC1B,UAAU,CAAC,EAAE,MAAM,CAAC;IACpB,eAAe,CAAC,EAAE,MAAM,CAAC;IACzB,cAAc,CAAC,EAAE,MAAM,CAAC;IACxB,mBAAmB,CAAC,EAAE,MAAM,CAAC;CAC9B;AACD,MAAM,WAAW,aAAa;IAC5B,EAAE,EAAE,MAAM,CAAC;IACX,MAAM,EAAE,MAAM,CAAC;IACf,MAAM,CAAC,EAAE,MAAM,CAAC;IAChB,UAAU,EAAE,MAAM,CAAC,QAAQ,EAAE,MAAM,CAAC,CAAC;IACrC,UAAU,EAAE,MAAM,CAAC;IACnB,aAAa,EAAE,MAAM,CAAC;IACtB,0DAA0D;IAC1D,UAAU,EAAE,MAAM,CAAC;IACnB,GAAG,CAAC,EAAE,IAAI,CAAC,OAAO,CAAC,CAAC;IACpB,GAAG,C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EAAE,CAAC;IACrD,OAAO,EAAE,cAAc,EAAE,CAAC;IAC1B,UAAU,EAAE,iBAAiB,EAAE,CAAC;IAChC,QAAQ,EAAE;QACR,IAAI,EAAE,UAAU,CAAC;QACjB,EAAE,EAAE,UAAU,CAAC;QACf,cAAc,EAAE,MAAM,CAAC;QACvB,KAAK,EAAE,MAAM,CAAC;KACf,EAAE,CAAC;CACL;AA+DD,wBAAgB,eAAe,CAC7B,QAAQ,EAAE,QAAQ,EAClB,OAAO,GAAE,cAAmB,GAC3B,eAAe,CA4ajB"}
@@ -0,0 +1,17 @@
1
+ import { type SpreadsheetLimits } from './errors.js';
2
+ import { type FormulaScanner } from './formula.js';
3
+ import type { Point, Reference, Workbook } from './model.js';
4
+ /** Built once per read/profile. All per-reference lookups use maps or binary search. */
5
+ export declare class WorkbookIndex {
6
+ private readonly spend;
7
+ private readonly globals;
8
+ private readonly locals;
9
+ private readonly tables;
10
+ private readonly contextual;
11
+ private readonly selectors;
12
+ constructor(workbook: Workbook, limits: SpreadsheetLimits, scanner: FormulaScanner, spend: (n?: number) => void);
13
+ resolve(reference: Reference, sheet: string, origin: Point): Reference | undefined;
14
+ private at;
15
+ private selector;
16
+ }
17
+ //# sourceMappingURL=reference-index.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"reference-index.d.ts","sourceRoot":"","sources":["../src/reference-index.ts"],"names":[],"mappings":"AAAA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAC1E,OAAO,EAAmB,KAAK,cAAc,EAAE,MAAM,cAAc,CAAC;AACpE,OAAO,KAAK,EAEV,KAAK,EACL,SAAS,EAET,QAAQ,EACT,MAAM,YAAY,CAAC;AAoBpB,wFAAwF;AACxF,qBAAa,aAAa;IAUtB,OAAO,CAAC,QAAQ,CAAC,KAAK;IATxB,OAAO,CAAC,QAAQ,CAAC,OAAO,CAAkC;IAC1D,OAAO,CAAC,QAAQ,CAAC,MAAM,CAA+C;IACtE,OAAO,CAAC,QAAQ,CAAC,MAAM,CAAmC;IAC1D,OAAO,CAAC,QAAQ,CAAC,UAAU,CAAmD;IAC9E,OAAO,CAAC,QAAQ,CAAC,SAAS,CAA2C;gBAEnE,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,cAAc,EACN,KAAK,EAAE,CAAC,CAAC,CAAC,EAAE,MAAM,KAAK,IAAI;IA2F9C,OAAO,CACL,SAAS,EAAE,SAAS,EACpB,KAAK,EAAE,MAAM,EACb,MAAM,EAAE,KAAK,GACZ,SAAS,GAAG,SAAS;IAuExB,OAAO,CAAC,EAAE;IAeV,OAAO,CAAC,QAAQ;CAuCjB"}
@@ -0,0 +1,24 @@
1
+ import type { SpreadsheetLimits } from './errors.js';
2
+ import type { Workbook } from './model.js';
3
+ export interface ReadOptions extends Partial<SpreadsheetLimits> {
4
+ delimiter?: string;
5
+ sheetName?: string;
6
+ }
7
+ export interface WriteOptions extends ReadOptions {
8
+ boldHeaderRow?: boolean;
9
+ columnWidths?: number[];
10
+ bom?: boolean;
11
+ }
12
+ export type SpreadsheetOptions = ({
13
+ type: 'xlsx';
14
+ } & Partial<SpreadsheetLimits>) | ({
15
+ type: 'csv';
16
+ delimiter?: string;
17
+ sheetName?: string;
18
+ } & Partial<SpreadsheetLimits>);
19
+ export interface SpreadsheetAdapter {
20
+ readonly type: 'xlsx' | 'csv';
21
+ read(input: Uint8Array | ArrayBuffer, options?: ReadOptions): Promise<Workbook>;
22
+ write(workbook: Workbook, options?: WriteOptions): Promise<Uint8Array>;
23
+ }
24
+ //# sourceMappingURL=types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA,OAAO,KAAK,EAAE,iBAAiB,EAAE,MAAM,aAAa,CAAC;AACrD,OAAO,KAAK,EAAE,QAAQ,EAAE,MAAM,YAAY,CAAC;AAE3C,MAAM,WAAW,WAAY,SAAQ,OAAO,CAAC,iBAAiB,CAAC;IAC7D,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB;AACD,MAAM,WAAW,YAAa,SAAQ,WAAW;IAC/C,aAAa,CAAC,EAAE,OAAO,CAAC;IACxB,YAAY,CAAC,EAAE,MAAM,EAAE,CAAC;IACxB,GAAG,CAAC,EAAE,OAAO,CAAC;CACf;AACD,MAAM,MAAM,kBAAkB,GAC1B,CAAC;IAAE,IAAI,EAAE,MAAM,CAAA;CAAE,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,GAC/C,CAAC;IACC,IAAI,EAAE,KAAK,CAAC;IACZ,SAAS,CAAC,EAAE,MAAM,CAAC;IACnB,SAAS,CAAC,EAAE,MAAM,CAAC;CACpB,GAAG,OAAO,CAAC,iBAAiB,CAAC,CAAC,CAAC;AACpC,MAAM,WAAW,kBAAkB;IACjC,QAAQ,CAAC,IAAI,EAAE,MAAM,GAAG,KAAK,CAAC;IAC9B,IAAI,CACF,KAAK,EAAE,UAAU,GAAG,WAAW,EAC/B,OAAO,CAAC,EAAE,WAAW,GACpB,OAAO,CAAC,QAAQ,CAAC,CAAC;IACrB,KAAK,CAAC,QAAQ,EAAE,QAAQ,EAAE,OAAO,CAAC,EAAE,YAAY,GAAG,OAAO,CAAC,UAAU,CAAC,CAAC;CACxE"}
@@ -0,0 +1,4 @@
1
+ import { type SpreadsheetLimits } from './errors.js';
2
+ import { type Workbook } from './model.js';
3
+ export declare function readXlsx(bytes: Uint8Array, limits: SpreadsheetLimits): Workbook;
4
+ //# sourceMappingURL=xlsx-read.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xlsx-read.d.ts","sourceRoot":"","sources":["../src/xlsx-read.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EAEvB,MAAM,aAAa,CAAC;AAQrB,OAAO,EAQL,KAAK,QAAQ,EACd,MAAM,YAAY,CAAC;AA8CpB,wBAAgB,QAAQ,CACtB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,iBAAiB,GACxB,QAAQ,CAmYV"}
@@ -0,0 +1,5 @@
1
+ import { type SpreadsheetLimits } from './errors.js';
2
+ import { type Workbook } from './model.js';
3
+ import type { WriteOptions } from './types.js';
4
+ export declare function writeXlsx(workbook: Workbook, limits: SpreadsheetLimits, options: WriteOptions): Uint8Array;
5
+ //# sourceMappingURL=xlsx-write.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xlsx-write.d.ts","sourceRoot":"","sources":["../src/xlsx-write.ts"],"names":[],"mappings":"AACA,OAAO,EAAuB,KAAK,iBAAiB,EAAE,MAAM,aAAa,CAAC;AAG1E,OAAO,EAAoC,KAAK,QAAQ,EAAE,MAAM,YAAY,CAAC;AAC7E,OAAO,KAAK,EAAE,YAAY,EAAE,MAAM,YAAY,CAAC;AAQ/C,wBAAgB,SAAS,CACvB,QAAQ,EAAE,QAAQ,EAClB,MAAM,EAAE,iBAAiB,EACzB,OAAO,EAAE,YAAY,GACpB,UAAU,CAgMZ"}
package/dist/xml.d.ts ADDED
@@ -0,0 +1,14 @@
1
+ import { type SpreadsheetLimits } from './errors.js';
2
+ export interface XmlNode {
3
+ name: string;
4
+ attrs: Record<string, string>;
5
+ children: XmlNode[];
6
+ text: string;
7
+ }
8
+ export declare function children(node: XmlNode, name: string): XmlNode[];
9
+ export declare function child(node: XmlNode, name: string): XmlNode | undefined;
10
+ export declare function textContent(node: XmlNode): string;
11
+ /** Deliberately small OOXML tokenizer. No declarations, DTDs or custom entities. */
12
+ export declare function parseXml(bytes: Uint8Array, limits: SpreadsheetLimits, allocate?: () => void): XmlNode;
13
+ export declare function escapeXml(value: string): string;
14
+ //# sourceMappingURL=xml.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"xml.d.ts","sourceRoot":"","sources":["../src/xml.ts"],"names":[],"mappings":"AAAA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAErB,MAAM,WAAW,OAAO;IACtB,IAAI,EAAE,MAAM,CAAC;IACb,KAAK,EAAE,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC9B,QAAQ,EAAE,OAAO,EAAE,CAAC;IACpB,IAAI,EAAE,MAAM,CAAC;CACd;AACD,wBAAgB,QAAQ,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,EAAE,CAE/D;AACD,wBAAgB,KAAK,CAAC,IAAI,EAAE,OAAO,EAAE,IAAI,EAAE,MAAM,GAAG,OAAO,GAAG,SAAS,CAEtE;AACD,wBAAgB,WAAW,CAAC,IAAI,EAAE,OAAO,GAAG,MAAM,CAEjD;AAwCD,oFAAoF;AACpF,wBAAgB,QAAQ,CACtB,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,iBAAiB,EACzB,QAAQ,GAAE,MAAM,IAAe,GAC9B,OAAO,CA2GT;AAED,wBAAgB,SAAS,CAAC,KAAK,EAAE,MAAM,GAAG,MAAM,CAc/C"}
package/dist/zip.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ import { type SpreadsheetLimits } from './errors.js';
2
+ export declare function unzipBounded(bytes: Uint8Array, limits: SpreadsheetLimits): Map<string, Uint8Array>;
3
+ //# sourceMappingURL=zip.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"zip.d.ts","sourceRoot":"","sources":["../src/zip.ts"],"names":[],"mappings":"AAKA,OAAO,EAGL,KAAK,iBAAiB,EACvB,MAAM,aAAa,CAAC;AAGrB,wBAAgB,YAAY,CAC1B,KAAK,EAAE,UAAU,EACjB,MAAM,EAAE,iBAAiB,GACxB,GAAG,CAAC,MAAM,EAAE,UAAU,CAAC,CAgHzB"}
package/metadata.json ADDED
@@ -0,0 +1,30 @@
1
+ {
2
+ "name": "@happyvertical/spreadsheets",
3
+ "path": "packages/spreadsheets",
4
+ "position": {
5
+ "index": 29,
6
+ "count": 34
7
+ },
8
+ "description": "Bounded browser-safe XLSX and CSV adapters with structural workbook profiling",
9
+ "provides": [
10
+ "Bounded browser-safe XLSX and CSV adapters with structural workbook profiling"
11
+ ],
12
+ "implements": [],
13
+ "requires": {
14
+ "workspace": [
15
+ "@happyvertical/files"
16
+ ],
17
+ "externalHappyVertical": [],
18
+ "external": [
19
+ "fflate"
20
+ ]
21
+ },
22
+ "dependents": [],
23
+ "stability": {
24
+ "level": "stable",
25
+ "reason": "Primary package surface is described as implemented and production-oriented."
26
+ },
27
+ "keywords": [
28
+ "spreadsheets"
29
+ ]
30
+ }
package/package.json CHANGED
@@ -1,6 +1,57 @@
1
1
  {
2
2
  "name": "@happyvertical/spreadsheets",
3
- "version": "0.0.0-stage",
4
- "stub": true,
5
- "description": "Temporary package placeholder for staged publishing"
3
+ "version": "0.112.3",
4
+ "description": "Bounded browser-safe XLSX and CSV adapters with structural workbook profiling",
5
+ "type": "module",
6
+ "main": "./dist/index.js",
7
+ "types": "./dist/index.d.ts",
8
+ "files": [
9
+ "dist",
10
+ "README.md",
11
+ "LICENSE",
12
+ "AGENT.md",
13
+ "metadata.json"
14
+ ],
15
+ "exports": {
16
+ ".": {
17
+ "types": "./dist/index.d.ts",
18
+ "default": "./dist/index.js"
19
+ }
20
+ },
21
+ "keywords": [
22
+ "spreadsheets",
23
+ "xlsx",
24
+ "csv",
25
+ "workbook",
26
+ "formulas"
27
+ ],
28
+ "author": "HappyVertical",
29
+ "license": "MIT",
30
+ "repository": {
31
+ "type": "git",
32
+ "url": "https://github.com/happyvertical/sdk.git",
33
+ "directory": "packages/spreadsheets"
34
+ },
35
+ "publishConfig": {
36
+ "registry": "https://registry.npmjs.org",
37
+ "access": "public"
38
+ },
39
+ "dependencies": {
40
+ "@happyvertical/files": "0.112.3",
41
+ "fflate": "0.8.2"
42
+ },
43
+ "devDependencies": {
44
+ "@types/node": "25.0.10",
45
+ "typescript": "5.9.3",
46
+ "vite": "8.1.4",
47
+ "vite-plugin-dts": "4.5.4",
48
+ "vitest": "4.1.10"
49
+ },
50
+ "scripts": {
51
+ "build": "vite build",
52
+ "test": "vitest --config ../../vitest.package.config.ts run",
53
+ "test:watch": "vitest --config ../../vitest.package.config.ts",
54
+ "typecheck": "tsc --noEmit -p tsconfig.json",
55
+ "lint": "biome check src"
56
+ }
6
57
  }