psyq-asm 0.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.
Files changed (117) hide show
  1. package/CHANGELOG.md +65 -0
  2. package/LICENSE +56 -0
  3. package/README.md +220 -0
  4. package/bin/psyq-asm.mjs +149 -0
  5. package/dist/asm/assemble.d.ts +10 -0
  6. package/dist/asm/assemble.d.ts.map +1 -0
  7. package/dist/asm/assemble.js +42 -0
  8. package/dist/asm/assemble.js.map +1 -0
  9. package/dist/asm/diagnostics.d.ts +22 -0
  10. package/dist/asm/diagnostics.d.ts.map +1 -0
  11. package/dist/asm/diagnostics.js +40 -0
  12. package/dist/asm/diagnostics.js.map +1 -0
  13. package/dist/asm/directives.d.ts +67 -0
  14. package/dist/asm/directives.d.ts.map +1 -0
  15. package/dist/asm/directives.js +254 -0
  16. package/dist/asm/directives.js.map +1 -0
  17. package/dist/asm/expand.d.ts +21 -0
  18. package/dist/asm/expand.d.ts.map +1 -0
  19. package/dist/asm/expand.js +540 -0
  20. package/dist/asm/expand.js.map +1 -0
  21. package/dist/asm/hazards.d.ts +10 -0
  22. package/dist/asm/hazards.d.ts.map +1 -0
  23. package/dist/asm/hazards.js +196 -0
  24. package/dist/asm/hazards.js.map +1 -0
  25. package/dist/asm/layout.d.ts +17 -0
  26. package/dist/asm/layout.d.ts.map +1 -0
  27. package/dist/asm/layout.js +257 -0
  28. package/dist/asm/layout.js.map +1 -0
  29. package/dist/asm/lexer.d.ts +23 -0
  30. package/dist/asm/lexer.d.ts.map +1 -0
  31. package/dist/asm/lexer.js +81 -0
  32. package/dist/asm/lexer.js.map +1 -0
  33. package/dist/asm/object.d.ts +6 -0
  34. package/dist/asm/object.d.ts.map +1 -0
  35. package/dist/asm/object.js +46 -0
  36. package/dist/asm/object.js.map +1 -0
  37. package/dist/asm/operands.d.ts +49 -0
  38. package/dist/asm/operands.d.ts.map +1 -0
  39. package/dist/asm/operands.js +114 -0
  40. package/dist/asm/operands.js.map +1 -0
  41. package/dist/asm/parser.d.ts +28 -0
  42. package/dist/asm/parser.d.ts.map +1 -0
  43. package/dist/asm/parser.js +60 -0
  44. package/dist/asm/parser.js.map +1 -0
  45. package/dist/asm/relocations.d.ts +42 -0
  46. package/dist/asm/relocations.d.ts.map +1 -0
  47. package/dist/asm/relocations.js +214 -0
  48. package/dist/asm/relocations.js.map +1 -0
  49. package/dist/asm/sections.d.ts +23 -0
  50. package/dist/asm/sections.d.ts.map +1 -0
  51. package/dist/asm/sections.js +81 -0
  52. package/dist/asm/sections.js.map +1 -0
  53. package/dist/asm/stream.d.ts +77 -0
  54. package/dist/asm/stream.d.ts.map +1 -0
  55. package/dist/asm/stream.js +2 -0
  56. package/dist/asm/stream.js.map +1 -0
  57. package/dist/asm/symbols.d.ts +42 -0
  58. package/dist/asm/symbols.d.ts.map +1 -0
  59. package/dist/asm/symbols.js +122 -0
  60. package/dist/asm/symbols.js.map +1 -0
  61. package/dist/errors.d.ts +27 -0
  62. package/dist/errors.d.ts.map +1 -0
  63. package/dist/errors.js +34 -0
  64. package/dist/errors.js.map +1 -0
  65. package/dist/index.d.ts +14 -0
  66. package/dist/index.d.ts.map +1 -0
  67. package/dist/index.js +10 -0
  68. package/dist/index.js.map +1 -0
  69. package/dist/isa/decode.d.ts +8 -0
  70. package/dist/isa/decode.d.ts.map +1 -0
  71. package/dist/isa/decode.js +92 -0
  72. package/dist/isa/decode.js.map +1 -0
  73. package/dist/isa/encode.d.ts +9 -0
  74. package/dist/isa/encode.d.ts.map +1 -0
  75. package/dist/isa/encode.js +124 -0
  76. package/dist/isa/encode.js.map +1 -0
  77. package/dist/isa/fields.d.ts +27 -0
  78. package/dist/isa/fields.d.ts.map +1 -0
  79. package/dist/isa/fields.js +49 -0
  80. package/dist/isa/fields.js.map +1 -0
  81. package/dist/isa/format.d.ts +14 -0
  82. package/dist/isa/format.d.ts.map +1 -0
  83. package/dist/isa/format.js +98 -0
  84. package/dist/isa/format.js.map +1 -0
  85. package/dist/isa/instruction.d.ts +15 -0
  86. package/dist/isa/instruction.d.ts.map +1 -0
  87. package/dist/isa/instruction.js +47 -0
  88. package/dist/isa/instruction.js.map +1 -0
  89. package/dist/isa/registers.d.ts +8 -0
  90. package/dist/isa/registers.d.ts.map +1 -0
  91. package/dist/isa/registers.js +55 -0
  92. package/dist/isa/registers.js.map +1 -0
  93. package/dist/isa/table.d.ts +179 -0
  94. package/dist/isa/table.d.ts.map +1 -0
  95. package/dist/isa/table.js +128 -0
  96. package/dist/isa/table.js.map +1 -0
  97. package/dist/options.d.ts +29 -0
  98. package/dist/options.d.ts.map +1 -0
  99. package/dist/options.js +0 -0
  100. package/dist/options.js.map +1 -0
  101. package/dist/program/decode-words.d.ts +9 -0
  102. package/dist/program/decode-words.d.ts.map +1 -0
  103. package/dist/program/decode-words.js +87 -0
  104. package/dist/program/decode-words.js.map +1 -0
  105. package/dist/program/format-program.d.ts +12 -0
  106. package/dist/program/format-program.d.ts.map +1 -0
  107. package/dist/program/format-program.js +37 -0
  108. package/dist/program/format-program.js.map +1 -0
  109. package/dist/public-types.d.ts +253 -0
  110. package/dist/public-types.d.ts.map +1 -0
  111. package/dist/public-types.js +2 -0
  112. package/dist/public-types.js.map +1 -0
  113. package/dist/util.d.ts +3 -0
  114. package/dist/util.d.ts.map +1 -0
  115. package/dist/util.js +11 -0
  116. package/dist/util.js.map +1 -0
  117. package/package.json +82 -0
@@ -0,0 +1,253 @@
1
+ /**
2
+ * The public type surface. Type-only: no runtime code lives here, which is why
3
+ * the module is excluded from coverage (see CONTRIBUTING.md).
4
+ */
5
+ import type { TableMnemonic } from './isa/table.js';
6
+ /** ASPSX versions this package emulates. */
7
+ export type AspsxVersion = '2.81';
8
+ /** Discriminant of every error thrown by psyq-asm. */
9
+ export type ErrorCode = 'invalid-options' | 'invalid-instruction';
10
+ /**
11
+ * Behaviour switches that the differential oracle has not yet settled. Each
12
+ * defaults to the value believed correct; overriding them is for fixture
13
+ * experiments and is not covered by semver.
14
+ */
15
+ export interface ExperimentalBehaviours {
16
+ /**
17
+ * Treat `.extern sym,size` with `size <= gpSize` as small data, addressed
18
+ * through `$gp`. Default false, which is what ASPSX 2.81 does: it addresses
19
+ * external symbols with `lui`/`%lo` whatever their declared size.
20
+ */
21
+ readonly externSmallData: boolean;
22
+ /**
23
+ * Insert a nop after `mfc2`/`cfc2` when the next instruction reads the
24
+ * register just written. Default true, which is what ASPSX 2.81 does.
25
+ */
26
+ readonly copMoveDelayNop: boolean;
27
+ }
28
+ export interface AssembleOptions {
29
+ /**
30
+ * The small-data threshold, the -G value given to ASPSX. A non-negative
31
+ * integer; PsyQ builds use 0 or 8. Required; never guessed.
32
+ */
33
+ readonly gpSize: number;
34
+ /** Emulated assembler version. Only '2.81' is accepted. Default '2.81'. */
35
+ readonly aspsxVersion?: AspsxVersion;
36
+ /** Reproduce `ASPSX -0`: `div`/`rem` without divide-by-zero and overflow traps. Default false. */
37
+ readonly partialDivExpansion?: boolean;
38
+ /** Logical file name used in diagnostics. A single path segment. Default 'input.s'. */
39
+ readonly filename?: string;
40
+ /** Overrides for unsettled behaviours; see `ExperimentalBehaviours`. */
41
+ readonly experimental?: Partial<ExperimentalBehaviours>;
42
+ }
43
+ export type AssembleResult = AssembleSuccess | AssembleFailure;
44
+ export interface AssembleSuccess {
45
+ readonly success: true;
46
+ readonly object: AssembledObject;
47
+ /** Warnings only. */
48
+ readonly diagnostics: readonly Diagnostic[];
49
+ }
50
+ export interface AssembleFailure {
51
+ readonly success: false;
52
+ /** At least one error, sorted by line. */
53
+ readonly diagnostics: readonly Diagnostic[];
54
+ }
55
+ export type DiagnosticCode = 'unknown-mnemonic' | 'unknown-directive' | 'unsupported-syntax' | 'invalid-operand' | 'invalid-directive' | 'undefined-label' | 'duplicate-label' | 'immediate-out-of-range' | 'branch-out-of-range' | 'ignored-directive' | 'function-mismatch';
56
+ export interface Diagnostic {
57
+ readonly severity: 'error' | 'warning';
58
+ /** `AssembleOptions.filename`. */
59
+ readonly file: string;
60
+ /** 1-based source line. */
61
+ readonly line: number;
62
+ /** 1-based column of the statement, when known. */
63
+ readonly column?: number;
64
+ readonly code: DiagnosticCode;
65
+ readonly message: string;
66
+ }
67
+ /** A section name; the common ones are listed, but any name is allowed. */
68
+ export type SectionName = '.text' | '.data' | '.rdata' | '.sdata' | '.sbss' | '.bss' | (string & Record<never, never>);
69
+ export interface AssembledObject {
70
+ readonly info: {
71
+ readonly aspsxVersion: AspsxVersion;
72
+ readonly gpSize: number;
73
+ readonly partialDivExpansion: boolean;
74
+ };
75
+ /** In order of first appearance; `.comm` allocations create `.sbss`/`.bss` last. */
76
+ readonly sections: readonly Section[];
77
+ readonly symbols: readonly SymbolEntry[];
78
+ readonly functions: readonly FunctionRange[];
79
+ /** Symbols addressed through `$gp` at this -G value, with the reason. */
80
+ readonly smallData: readonly SmallDataEntry[];
81
+ }
82
+ export interface Section {
83
+ readonly name: SectionName;
84
+ readonly kind: 'code' | 'data' | 'bss';
85
+ /** Section contents; empty for bss. */
86
+ readonly bytes: Uint8Array;
87
+ /** Size in bytes, including reserved bss space. */
88
+ readonly size: number;
89
+ /** Code sections only: `bytes` as little-endian words. */
90
+ readonly words?: Uint32Array;
91
+ readonly relocations: readonly Relocation[];
92
+ /** Code sections only: where each word came from, one entry per word. */
93
+ readonly provenance?: readonly WordOrigin[];
94
+ }
95
+ export type RelocationKind = 'HI16' | 'LO16' | 'GPREL16' | 'MIPS26' | 'WORD32';
96
+ export interface Relocation {
97
+ /** Byte offset of the patched word in its section. */
98
+ readonly offset: number;
99
+ readonly kind: RelocationKind;
100
+ /** Bits of the word the linker patches: 0xFFFF, 0x03FFFFFF, or 0xFFFFFFFF. */
101
+ readonly fieldMask: number;
102
+ readonly target: RelocationTarget;
103
+ /** The value already encoded in the patched field. */
104
+ readonly fieldValue: number;
105
+ }
106
+ export type RelocationTarget = {
107
+ readonly kind: 'symbol';
108
+ readonly name: string;
109
+ readonly addend: number;
110
+ } | {
111
+ readonly kind: 'section';
112
+ readonly section: SectionName;
113
+ /** Offset in `section`, addend included. */
114
+ readonly offset: number;
115
+ readonly label?: string;
116
+ };
117
+ export interface SymbolEntry {
118
+ readonly name: string;
119
+ readonly binding: 'global' | 'local' | 'extern' | 'common';
120
+ /** Absent for extern symbols. */
121
+ readonly section?: SectionName;
122
+ readonly offset?: number;
123
+ /** From `.comm`, `.lcomm`, or `.extern`. */
124
+ readonly size?: number;
125
+ }
126
+ export interface FunctionRange {
127
+ /** From `.ent`. */
128
+ readonly name: string;
129
+ readonly section: '.text';
130
+ /** First word index. */
131
+ readonly start: number;
132
+ /** Word index at `.end`, exclusive. */
133
+ readonly end: number;
134
+ readonly frame?: {
135
+ readonly reg: number;
136
+ readonly size: number;
137
+ readonly returnReg: number;
138
+ };
139
+ readonly mask?: {
140
+ readonly bits: number;
141
+ readonly offset: number;
142
+ };
143
+ readonly fmask?: {
144
+ readonly bits: number;
145
+ readonly offset: number;
146
+ };
147
+ }
148
+ export type WordOriginKind = 'instruction' | 'macro' | 'branch-delay-nop' | 'load-delay-nop' | 'hilo-gap-nop' | 'cop-delay-nop' | 'align' | 'data';
149
+ export interface WordOrigin {
150
+ /** Source line that produced the word. */
151
+ readonly line: number;
152
+ readonly kind: WordOriginKind;
153
+ /** The macro that expanded, e.g. 'li' or 'div'. */
154
+ readonly macro?: string;
155
+ /** Why the word exists, for inserted nops. */
156
+ readonly note?: string;
157
+ }
158
+ export interface SmallDataEntry {
159
+ readonly name: string;
160
+ /** Defined in `.sdata`/`.sbss`, declared by `.comm`/`.lcomm`, or (opt-in) by `.extern`. */
161
+ readonly reason: 'sdata' | 'sbss' | 'common' | 'extern';
162
+ readonly size?: number;
163
+ }
164
+ /** Every mnemonic in the R3000 instruction table. */
165
+ export type Mnemonic = TableMnemonic;
166
+ /** Encoding family: SPECIAL/R-type, immediate, jump, coprocessor move, GTE command. */
167
+ export type InstructionFormat = 'R' | 'I' | 'J' | 'COP' | 'COP2CMD';
168
+ /** How an instruction takes part in ASPSX's nop insertion. */
169
+ export type HazardClass = 'none' | 'load' | 'branch' | 'jump' | 'mult' | 'div' | 'mflo' | 'mtlo' | 'cop-from' | 'cop-to';
170
+ /** One operand, in assembly-syntax order. */
171
+ export type Operand =
172
+ /** A general-purpose register, 0 to 31. */
173
+ {
174
+ readonly kind: 'gpr';
175
+ readonly number: number;
176
+ }
177
+ /** A coprocessor register, 0 to 31, in the data or control space. */
178
+ | {
179
+ readonly kind: 'cop';
180
+ readonly number: number;
181
+ readonly unit: 0 | 2;
182
+ readonly space: 'data' | 'control';
183
+ }
184
+ /** An immediate or code field. `bits` is its width; `signed` whether it is sign-extended. */
185
+ | {
186
+ readonly kind: 'imm';
187
+ readonly value: number;
188
+ readonly bits: 10 | 16 | 20 | 25;
189
+ readonly signed: boolean;
190
+ }
191
+ /** A shift amount, 0 to 31. */
192
+ | {
193
+ readonly kind: 'shamt';
194
+ readonly value: number;
195
+ }
196
+ /** `offset(base)`, with a signed 16-bit offset. */
197
+ | {
198
+ readonly kind: 'mem';
199
+ readonly base: number;
200
+ readonly offset: number;
201
+ }
202
+ /** A branch displacement in instructions, relative to the delay slot (pc + 4). */
203
+ | {
204
+ readonly kind: 'branch';
205
+ readonly displacement: number;
206
+ }
207
+ /** The 26-bit index field of `j`/`jal`; the target address is `(pc & 0xF0000000) | index << 2`. */
208
+ | {
209
+ readonly kind: 'target';
210
+ readonly index: number;
211
+ };
212
+ /** A decoded (or encodable) R3000 instruction. */
213
+ export interface Instruction {
214
+ readonly mnemonic: Mnemonic;
215
+ readonly format: InstructionFormat;
216
+ readonly operands: readonly Operand[];
217
+ /** General-purpose registers read, excluding `$0`. */
218
+ readonly reads: readonly number[];
219
+ /** General-purpose registers written, excluding `$0`. */
220
+ readonly writes: readonly number[];
221
+ readonly hazardClass: HazardClass;
222
+ }
223
+ /** What `encode` needs: the derived fields of `Instruction` are ignored. */
224
+ export type EncodableInstruction = Pick<Instruction, 'mnemonic' | 'operands'>;
225
+ /** A word that is not a valid R3000 instruction. */
226
+ export interface UnknownInstruction {
227
+ readonly mnemonic: '.word';
228
+ readonly word: number;
229
+ readonly reason: string;
230
+ }
231
+ export interface FormatStyle {
232
+ /** `$v0` (default `'abi'`) or `$2` (`'numeric'`). Coprocessor registers are always numeric. */
233
+ readonly registers?: 'numeric' | 'abi';
234
+ /** Render `nop`, `move`, `beqz`, and `bnez` where they apply. Default false. */
235
+ readonly pseudo?: boolean;
236
+ /** Immediates, offsets, and targets in hexadecimal. Default true. */
237
+ readonly hex?: boolean;
238
+ }
239
+ export interface DecodeOptions {
240
+ /** Address of the first word: labels are named by address and jump targets resolved. */
241
+ readonly baseAddress?: number;
242
+ /** Prefix of synthetic label names. Default 'L'. */
243
+ readonly labelPrefix?: string;
244
+ }
245
+ export interface DecodedProgram {
246
+ readonly instructions: readonly (Instruction | UnknownInstruction)[];
247
+ /** Word index to synthetic label, for every branch (and jump) target inside the program. */
248
+ readonly labels: ReadonlyMap<number, string>;
249
+ /** Instruction index to target word index, for branches (and jumps) whose target is labelled. */
250
+ readonly branchTargets: ReadonlyMap<number, number>;
251
+ readonly baseAddress?: number;
252
+ }
253
+ //# sourceMappingURL=public-types.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-types.d.ts","sourceRoot":"","sources":["../src/public-types.ts"],"names":[],"mappings":"AACA;;;GAGG;AACH,OAAO,KAAK,EAAE,aAAa,EAAE,MAAM,gBAAgB,CAAC;AAEpD,4CAA4C;AAC5C,MAAM,MAAM,YAAY,GAAG,MAAM,CAAC;AAElC,sDAAsD;AACtD,MAAM,MAAM,SAAS,GAAG,iBAAiB,GAAG,qBAAqB,CAAC;AAIlE;;;;GAIG;AACH,MAAM,WAAW,sBAAsB;IACrC;;;;OAIG;IACH,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;IAClC;;;OAGG;IACH,QAAQ,CAAC,eAAe,EAAE,OAAO,CAAC;CACnC;AAED,MAAM,WAAW,eAAe;IAC9B;;;OAGG;IACH,QAAQ,CAAC,MAAM,EAA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Q,CAAC,MAAM,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IAC7C,iGAAiG;IACjG,QAAQ,CAAC,aAAa,EAAE,WAAW,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC;IACpD,QAAQ,CAAC,WAAW,CAAC,EAAE,MAAM,CAAC;CAC/B"}
@@ -0,0 +1,2 @@
1
+ export {};
2
+ //# sourceMappingURL=public-types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"public-types.js","sourceRoot":"","sources":["../src/public-types.ts"],"names":[],"mappings":""}
package/dist/util.d.ts ADDED
@@ -0,0 +1,3 @@
1
+ /** Pair up two lists element by element, stopping at the shorter one. */
2
+ export declare function zip<A, B>(first: readonly A[], second: readonly B[]): [A, B][];
3
+ //# sourceMappingURL=util.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.d.ts","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAEA,yEAAyE;AACzE,wBAAgB,GAAG,CAAC,CAAC,EAAE,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,MAAM,EAAE,SAAS,CAAC,EAAE,GAAG,CAAC,CAAC,EAAE,CAAC,CAAC,EAAE,CAO7E"}
package/dist/util.js ADDED
@@ -0,0 +1,11 @@
1
+ // SPDX-License-Identifier: MIT
2
+ /** Pair up two lists element by element, stopping at the shorter one. */
3
+ export function zip(first, second) {
4
+ const pairs = [];
5
+ const length = Math.min(first.length, second.length);
6
+ for (let i = 0; i < length; i++) {
7
+ pairs.push([first[i], second[i]]);
8
+ }
9
+ return pairs;
10
+ }
11
+ //# sourceMappingURL=util.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"util.js","sourceRoot":"","sources":["../src/util.ts"],"names":[],"mappings":"AAAA,+BAA+B;AAE/B,yEAAyE;AACzE,MAAM,UAAU,GAAG,CAAO,KAAmB,EAAE,MAAoB;IACjE,MAAM,KAAK,GAAa,EAAE,CAAC;IAC3B,MAAM,MAAM,GAAG,IAAI,CAAC,GAAG,CAAC,KAAK,CAAC,MAAM,EAAE,MAAM,CAAC,MAAM,CAAC,CAAC;IACrD,KAAK,IAAI,CAAC,GAAG,CAAC,EAAE,CAAC,GAAG,MAAM,EAAE,CAAC,EAAE,EAAE,CAAC;QAChC,KAAK,CAAC,IAAI,CAAC,CAAC,KAAK,CAAC,CAAC,CAAM,EAAE,MAAM,CAAC,CAAC,CAAM,CAAC,CAAC,CAAC;IAC9C,CAAC;IACD,OAAO,KAAK,CAAC;AACf,CAAC"}
package/package.json ADDED
@@ -0,0 +1,82 @@
1
+ {
2
+ "name": "psyq-asm",
3
+ "version": "0.0.1",
4
+ "description": "ASPSX 2.81-compatible assembler and R3000 encoder/decoder in TypeScript, for PlayStation 1 matching-decompilation tooling in the browser and Node.js",
5
+ "keywords": [
6
+ "psyq",
7
+ "aspsx",
8
+ "maspsx",
9
+ "mips",
10
+ "r3000",
11
+ "playstation",
12
+ "ps1",
13
+ "psx",
14
+ "decompilation",
15
+ "assembler",
16
+ "disassembler"
17
+ ],
18
+ "homepage": "https://github.com/jaysonvirissimo/psyq-asm#readme",
19
+ "bugs": {
20
+ "url": "https://github.com/jaysonvirissimo/psyq-asm/issues"
21
+ },
22
+ "repository": {
23
+ "type": "git",
24
+ "url": "git+https://github.com/jaysonvirissimo/psyq-asm.git"
25
+ },
26
+ "license": "MIT",
27
+ "author": "Jayson Virissimo",
28
+ "type": "module",
29
+ "sideEffects": false,
30
+ "engines": {
31
+ "node": ">=22"
32
+ },
33
+ "files": [
34
+ "dist/",
35
+ "bin/",
36
+ "LICENSE",
37
+ "CHANGELOG.md",
38
+ "README.md"
39
+ ],
40
+ "exports": {
41
+ ".": {
42
+ "types": "./dist/index.d.ts",
43
+ "default": "./dist/index.js"
44
+ },
45
+ "./package.json": "./package.json"
46
+ },
47
+ "bin": {
48
+ "psyq-asm": "./bin/psyq-asm.mjs"
49
+ },
50
+ "scripts": {
51
+ "format": "prettier --write .",
52
+ "format:check": "prettier --check .",
53
+ "lint": "eslint .",
54
+ "typecheck": "tsc -p tsconfig.json --noEmit",
55
+ "test": "vitest run --project unit",
56
+ "test:watch": "vitest --project unit",
57
+ "test:coverage": "vitest run --project unit --coverage",
58
+ "test:differential": "vitest run --project differential",
59
+ "test:browser": "playwright test",
60
+ "test:package": "node test/package/run.mjs",
61
+ "build": "tsc -p tsconfig.build.json",
62
+ "check": "npm run format:check && npm run lint && npm run typecheck && npm run test:coverage",
63
+ "bench": "node scripts/bench.mjs",
64
+ "serve": "node scripts/serve.mjs"
65
+ },
66
+ "devDependencies": {
67
+ "@eslint/js": "^10.0.1",
68
+ "@playwright/test": "^1.63.0",
69
+ "@types/node": "^26.0.0",
70
+ "@vitest/coverage-v8": "^5.0.0",
71
+ "eslint": "^10.10.0",
72
+ "eslint-config-prettier": "^10.1.8",
73
+ "fast-check": "^4.9.0",
74
+ "globals": "^17.12.0",
75
+ "prettier": "^3.9.6",
76
+ "psyq-wasm": "^1.0.0",
77
+ "typescript": "~6.0.3",
78
+ "typescript-eslint": "^8.69.0",
79
+ "vite": "^8.0.0",
80
+ "vitest": "^5.0.0"
81
+ }
82
+ }