roll-parser 3.0.0-beta.0 → 3.0.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.
Files changed (159) hide show
  1. package/CHANGELOG.md +107 -9
  2. package/MIGRATION.md +147 -0
  3. package/README.md +960 -154
  4. package/dist/cli/args.d.ts +1 -0
  5. package/dist/cli/args.d.ts.map +1 -1
  6. package/dist/cli/args.js +81 -0
  7. package/dist/cli/args.js.map +1 -0
  8. package/dist/cli/format.d.ts +15 -3
  9. package/dist/cli/format.d.ts.map +1 -1
  10. package/dist/cli/format.js +17 -0
  11. package/dist/cli/format.js.map +1 -0
  12. package/dist/cli/index.d.ts +3 -0
  13. package/dist/cli/index.d.ts.map +1 -1
  14. package/dist/cli/index.js +14 -0
  15. package/dist/cli/index.js.map +1 -0
  16. package/dist/cli/main.d.ts +36 -0
  17. package/dist/cli/main.d.ts.map +1 -0
  18. package/dist/cli/main.js +83 -0
  19. package/dist/cli/main.js.map +1 -0
  20. package/dist/errors.d.ts +332 -17
  21. package/dist/errors.d.ts.map +1 -1
  22. package/dist/errors.js +141 -0
  23. package/dist/errors.js.map +1 -0
  24. package/dist/evaluator/die.d.ts +26 -0
  25. package/dist/evaluator/die.d.ts.map +1 -0
  26. package/dist/evaluator/die.js +19 -0
  27. package/dist/evaluator/die.js.map +1 -0
  28. package/dist/evaluator/env.d.ts +58 -0
  29. package/dist/evaluator/env.d.ts.map +1 -0
  30. package/dist/evaluator/env.js +11 -0
  31. package/dist/evaluator/env.js.map +1 -0
  32. package/dist/evaluator/evaluator.d.ts +41 -75
  33. package/dist/evaluator/evaluator.d.ts.map +1 -1
  34. package/dist/evaluator/evaluator.js +906 -0
  35. package/dist/evaluator/evaluator.js.map +1 -0
  36. package/dist/evaluator/modifiers/compare.js +15 -0
  37. package/dist/evaluator/modifiers/compare.js.map +1 -0
  38. package/dist/evaluator/modifiers/crit-threshold.d.ts +0 -1
  39. package/dist/evaluator/modifiers/crit-threshold.d.ts.map +1 -1
  40. package/dist/evaluator/modifiers/crit-threshold.js +23 -0
  41. package/dist/evaluator/modifiers/crit-threshold.js.map +1 -0
  42. package/dist/evaluator/modifiers/die-bound.d.ts +26 -0
  43. package/dist/evaluator/modifiers/die-bound.d.ts.map +1 -0
  44. package/dist/evaluator/modifiers/die-bound.js +14 -0
  45. package/dist/evaluator/modifiers/die-bound.js.map +1 -0
  46. package/dist/evaluator/modifiers/explode.d.ts +13 -5
  47. package/dist/evaluator/modifiers/explode.d.ts.map +1 -1
  48. package/dist/evaluator/modifiers/explode.js +103 -0
  49. package/dist/evaluator/modifiers/explode.js.map +1 -0
  50. package/dist/evaluator/modifiers/flags.d.ts +37 -0
  51. package/dist/evaluator/modifiers/flags.d.ts.map +1 -0
  52. package/dist/evaluator/modifiers/flags.js +18 -0
  53. package/dist/evaluator/modifiers/flags.js.map +1 -0
  54. package/dist/evaluator/modifiers/keep-drop.d.ts +12 -28
  55. package/dist/evaluator/modifiers/keep-drop.d.ts.map +1 -1
  56. package/dist/evaluator/modifiers/keep-drop.js +82 -0
  57. package/dist/evaluator/modifiers/keep-drop.js.map +1 -0
  58. package/dist/evaluator/modifiers/reroll.d.ts +12 -4
  59. package/dist/evaluator/modifiers/reroll.d.ts.map +1 -1
  60. package/dist/evaluator/modifiers/reroll.js +62 -0
  61. package/dist/evaluator/modifiers/reroll.js.map +1 -0
  62. package/dist/evaluator/modifiers/sort.d.ts +4 -0
  63. package/dist/evaluator/modifiers/sort.d.ts.map +1 -1
  64. package/dist/evaluator/modifiers/sort.js +13 -0
  65. package/dist/evaluator/modifiers/sort.js.map +1 -0
  66. package/dist/evaluator/modifiers/success-count.d.ts +2 -6
  67. package/dist/evaluator/modifiers/success-count.d.ts.map +1 -1
  68. package/dist/evaluator/modifiers/success-count.js +24 -0
  69. package/dist/evaluator/modifiers/success-count.js.map +1 -0
  70. package/dist/index.d.ts +33 -11
  71. package/dist/index.d.ts.map +1 -1
  72. package/dist/index.js +12 -2560
  73. package/dist/index.js.map +1 -26
  74. package/dist/lexer/lexer.d.ts +50 -5
  75. package/dist/lexer/lexer.d.ts.map +1 -1
  76. package/dist/lexer/lexer.js +260 -0
  77. package/dist/lexer/lexer.js.map +1 -0
  78. package/dist/lexer/tokens.d.ts +31 -6
  79. package/dist/lexer/tokens.d.ts.map +1 -1
  80. package/dist/lexer/tokens.js +42 -0
  81. package/dist/lexer/tokens.js.map +1 -0
  82. package/dist/parser/ast.d.ts +314 -160
  83. package/dist/parser/ast.d.ts.map +1 -1
  84. package/dist/parser/ast.js +52 -0
  85. package/dist/parser/ast.js.map +1 -0
  86. package/dist/parser/guards.d.ts +106 -0
  87. package/dist/parser/guards.d.ts.map +1 -0
  88. package/dist/parser/guards.js +121 -0
  89. package/dist/parser/guards.js.map +1 -0
  90. package/dist/parser/parser.d.ts +118 -14
  91. package/dist/parser/parser.d.ts.map +1 -1
  92. package/dist/parser/parser.js +751 -0
  93. package/dist/parser/parser.js.map +1 -0
  94. package/dist/rng/mock.d.ts +73 -12
  95. package/dist/rng/mock.d.ts.map +1 -1
  96. package/dist/rng/mock.js +30 -0
  97. package/dist/rng/mock.js.map +1 -0
  98. package/dist/rng/seeded.d.ts +141 -9
  99. package/dist/rng/seeded.d.ts.map +1 -1
  100. package/dist/rng/seeded.js +138 -0
  101. package/dist/rng/seeded.js.map +1 -0
  102. package/dist/rng/types.d.ts +57 -0
  103. package/dist/rng/types.d.ts.map +1 -1
  104. package/dist/rng/types.js +2 -0
  105. package/dist/rng/types.js.map +1 -0
  106. package/dist/roll.d.ts +58 -28
  107. package/dist/roll.d.ts.map +1 -1
  108. package/dist/roll.js +8 -0
  109. package/dist/roll.js.map +1 -0
  110. package/dist/testing.d.ts +5 -4
  111. package/dist/testing.d.ts.map +1 -1
  112. package/dist/testing.js +2 -41
  113. package/dist/testing.js.map +1 -11
  114. package/dist/types.d.ts +306 -44
  115. package/dist/types.d.ts.map +1 -1
  116. package/dist/types.js +8 -0
  117. package/dist/types.js.map +1 -0
  118. package/dist/version.d.ts +2 -0
  119. package/dist/version.d.ts.map +1 -0
  120. package/dist/version.js +2 -0
  121. package/dist/version.js.map +1 -0
  122. package/package.json +83 -34
  123. package/src/cli/args.ts +66 -10
  124. package/src/cli/format.ts +22 -3
  125. package/src/cli/index.ts +27 -84
  126. package/src/cli/main.ts +129 -0
  127. package/src/errors.ts +480 -27
  128. package/src/evaluator/die.ts +50 -0
  129. package/src/evaluator/env.ts +73 -0
  130. package/src/evaluator/evaluator.ts +653 -421
  131. package/src/evaluator/modifiers/crit-threshold.ts +3 -6
  132. package/src/evaluator/modifiers/die-bound.ts +39 -0
  133. package/src/evaluator/modifiers/explode.ts +60 -58
  134. package/src/evaluator/modifiers/flags.ts +61 -0
  135. package/src/evaluator/modifiers/keep-drop.ts +124 -126
  136. package/src/evaluator/modifiers/reroll.ts +28 -49
  137. package/src/evaluator/modifiers/sort.ts +14 -1
  138. package/src/evaluator/modifiers/success-count.ts +5 -8
  139. package/src/index.ts +56 -35
  140. package/src/lexer/lexer.ts +107 -34
  141. package/src/lexer/tokens.ts +31 -6
  142. package/src/parser/ast.ts +323 -341
  143. package/src/parser/guards.ts +248 -0
  144. package/src/parser/parser.ts +419 -242
  145. package/src/rng/mock.ts +74 -13
  146. package/src/rng/seeded.ts +299 -64
  147. package/src/rng/types.ts +57 -0
  148. package/src/roll.ts +64 -47
  149. package/src/testing.ts +5 -9
  150. package/src/types.ts +310 -43
  151. package/src/version.ts +2 -0
  152. package/dist/cli.js +0 -2608
  153. package/dist/cli.js.map +0 -28
  154. package/dist/evaluator/index.d.ts +0 -8
  155. package/dist/evaluator/index.d.ts.map +0 -1
  156. package/dist/rng/index.d.ts +0 -8
  157. package/dist/rng/index.d.ts.map +0 -1
  158. package/src/evaluator/index.ts +0 -14
  159. package/src/rng/index.ts +0 -8
package/dist/types.d.ts CHANGED
@@ -5,40 +5,103 @@
5
5
  */
6
6
  import type { ASTNode } from './parser/ast.js';
7
7
  /**
8
- * Comparison operator for compare points.
8
+ * Comparison operator for compare points. Spelled exactly as it appears in
9
+ * notation — `4d6!>=5` carries `'>='`, bare `f1` normalizes to `'='`.
10
+ *
11
+ * @category AST
9
12
  */
10
13
  export type CompareOp = '>' | '>=' | '<' | '<=' | '=';
11
14
  /**
12
- * A comparison threshold used by exploding dice, reroll, and success counting.
15
+ * A comparison threshold used by exploding dice, reroll, success counting, and
16
+ * crit-threshold overrides.
17
+ *
18
+ * The value is an {@link ASTNode} to support computed thresholds
19
+ * (`1d6!>(1d2+3)`), matching the pattern used by `DiceNode.count` and
20
+ * `DiceNode.sides`. The evaluated counterpart is {@link ResolvedComparePoint}.
13
21
  *
14
- * The value is an ASTNode to support computed thresholds (e.g., `>=ceil(5)`),
15
- * matching the pattern used by DiceNode.count and DiceNode.sides.
22
+ * @category AST
16
23
  */
17
24
  export type ComparePoint = {
18
- operator: CompareOp;
19
- value: ASTNode;
25
+ readonly operator: CompareOp;
26
+ readonly value: ASTNode;
20
27
  };
21
28
  /**
22
- * A ComparePoint whose value has been evaluated to a number. Used in
23
- * `RollPart` where meta-expressions are already resolved.
29
+ * A {@link ComparePoint} whose value has been evaluated to a number. Used
30
+ * throughout {@link RollPart}, where meta-expressions are already resolved
31
+ * `1d6!>(1d2+3)` surfaces as `{ operator: '>', value: 5 }`.
32
+ *
33
+ * @category Results
24
34
  */
25
35
  export type ResolvedComparePoint = {
26
- operator: CompareOp;
27
- value: number;
36
+ readonly operator: CompareOp;
37
+ readonly value: number;
28
38
  };
29
39
  /**
30
40
  * A resolved crit threshold — `'default'` means the per-die default rule
31
- * (`result === sides` for critical, `result === 1` for fumble).
41
+ * (`result === sides` for critical, `result === 1` for fumble), which is what
42
+ * bare `cs` / `cf` produce.
43
+ *
44
+ * @category Results
32
45
  */
33
46
  export type ResolvedCritThreshold = ResolvedComparePoint | 'default';
34
47
  /**
35
- * Modifier flags applied to individual die results.
48
+ * Tags attached to a {@link DieResult} by the evaluator. A die can carry more
49
+ * than one (an exploded die that was later dropped is `['dropped',
50
+ * 'exploded']`), and the set drives the markers in `RollResult.rendered`.
51
+ *
52
+ * | Tag | Meaning | Rendered as |
53
+ * |-----|---------|-------------|
54
+ * | `'kept'` | Counted toward the total. Every non-dropped die carries it. | plain |
55
+ * | `'dropped'` | Excluded from the total by `kh`/`kl`/`dh`/`dl` or group selection. | `~~n~~` |
56
+ * | `'exploded'` | Produced by, or the trigger of, an explosion (`!`, `!!`, `!p`). | plain |
57
+ * | `'rerolled'` | A discarded intermediate from `r` / `ro`, always paired with `'dropped'` — the replacement die carries no tag. | `~~n~~` (via `'dropped'`) |
58
+ * | `'min'` | Raised to a `minN` bound; `initialResult` keeps the raw face. | plain |
59
+ * | `'max'` | Lowered to a `maxN` bound; `initialResult` keeps the raw face. | plain |
60
+ * | `'success'` | Met a success-count threshold (`>=6`). | `**n**` |
61
+ * | `'failure'` | Met a failure threshold (`f1`). | `__n__` |
62
+ * | `'meta'` | Rolled by a meta-expression rather than by the visible pool. | not shown |
63
+ * | `'dc'` | The DC side of a `vs` comparison. Never part of the roll-side pool. | plain |
64
+ *
65
+ * `'meta'` is the one tag with no counterpart in the notation. Dice counts,
66
+ * sides, modifier counts and computed thresholds may themselves be dice
67
+ * (`(1d4)d6`, `4d6kh(1d2)`, `1d6!>(1d2+3)`). Those inner dice are not part of
68
+ * any pool, so they never appear in a {@link RollPart}; they are appended to
69
+ * `RollResult.rolls` tagged `'meta'` so an audit log can still show what the
70
+ * meta-expression rolled. Filter them out when summing or displaying a pool.
71
+ *
72
+ * `'dc'` marks the DC side of a `vs` comparison. Unlike `'meta'` these dice do
73
+ * render — `1d20[3] vs 2d10[5, 6]` shows both sides — but they are not part of
74
+ * the roll-side pool, so no modifier may sum, select, clamp, reroll, explode,
75
+ * or tally them. Filter them out when summing a pool, exactly as with `'meta'`.
76
+ *
77
+ * @category Results
36
78
  */
37
- export type DieModifier = 'dropped' | 'kept' | 'exploded' | 'rerolled' | 'success' | 'failure' | 'meta';
79
+ export type DieModifier = 'dropped' | 'kept' | 'exploded' | 'rerolled' | 'min' | 'max' | 'success' | 'failure' | 'meta' | 'dc';
38
80
  /**
39
81
  * PF2e Degree of Success. Produced by the `vs` operator when comparing a
40
82
  * roll against a Difficulty Class. Ordering is significant — natural 20
41
83
  * upgrades one step and natural 1 downgrades one step.
84
+ *
85
+ * Numeric by design: the enum members are plain numbers, so `--json` CLI
86
+ * output and `JSON.stringify` emit `0`–`3` and comparisons like
87
+ * `degree >= DegreeOfSuccess.Success` work.
88
+ *
89
+ * @example
90
+ * ```typescript
91
+ * import { DegreeOfSuccess, roll } from 'roll-parser';
92
+ * import { createMockRng } from 'roll-parser/testing';
93
+ *
94
+ * const result = roll('1d20+7 vs 15', { rng: createMockRng([12]) });
95
+ * result.degree; // DegreeOfSuccess.Success (2)
96
+ * result.natural; // 12 — the raw d20 face, used for the ±1 step
97
+ * result.rendered; // '1d20[12] + 7 vs 15 = Success'
98
+ *
99
+ * if (result.degree != null && result.degree >= DegreeOfSuccess.Success) {
100
+ * // hit
101
+ * }
102
+ * ```
103
+ *
104
+ * @category Results
42
105
  */
43
106
  export declare enum DegreeOfSuccess {
44
107
  CriticalFailure = 0,
@@ -47,7 +110,25 @@ export declare enum DegreeOfSuccess {
47
110
  CriticalSuccess = 3
48
111
  }
49
112
  /**
50
- * Individual die roll result with metadata.
113
+ * One physical die and everything the evaluator learned about it.
114
+ *
115
+ * The same object is shared between `RollResult.rolls` and the `rolls[]` of
116
+ * the {@link RollPart} that produced it — there is no deep clone, so mutating
117
+ * a die is visible through both views.
118
+ *
119
+ * @example
120
+ * ```typescript
121
+ * import { roll } from 'roll-parser';
122
+ * import { createMockRng } from 'roll-parser/testing';
123
+ *
124
+ * const result = roll('4d6kh3', { rng: createMockRng([3, 6, 2, 5]) });
125
+ * result.rolls[1];
126
+ * // { sides: 6, result: 6, modifiers: ['kept'], critical: true, fumble: false }
127
+ * result.rolls[2];
128
+ * // { sides: 6, result: 2, modifiers: ['dropped'], critical: false, fumble: false }
129
+ * ```
130
+ *
131
+ * @category Results
51
132
  */
52
133
  export type DieResult = {
53
134
  /**
@@ -73,21 +154,31 @@ export type DieResult = {
73
154
  fumble: boolean;
74
155
  };
75
156
  /**
76
- * Per-spec keep/drop entry inside a flattened modifier chain. Counts are
77
- * resolved at evaluation time (meta-expressions like `kh(1d2)` become the
78
- * rolled number).
157
+ * One entry inside a flattened keep/drop chain. Counts are resolved at
158
+ * evaluation time (meta-expressions like `kh(1d2)` become the rolled number).
159
+ *
160
+ * Chained keep/drop modifiers flatten into one list — `4d6kh3dl1` yields two
161
+ * specs against a single pool, each applied independently, with drop sets
162
+ * unioned (Roll20 semantics).
163
+ *
164
+ * @category Results
79
165
  */
80
- export type ModifierSpec = {
81
- kind: 'keep' | 'drop';
82
- selector: 'highest' | 'lowest';
83
- count: number;
166
+ export type KeepDropSpec = {
167
+ readonly kind: 'keep' | 'drop';
168
+ readonly selector: 'highest' | 'lowest';
169
+ readonly count: number;
84
170
  };
85
171
  /**
86
- * Fields shared by every RollPart variant. `start`/`end` mirror the source
87
- * span of the AST node the part was evaluated from — present whenever the
88
- * AST came from `parse()`, absent on hand-built ASTs.
172
+ * Fields shared by every {@link RollPart} variant. `start`/`end` mirror the
173
+ * source span of the AST node the part was evaluated from — present whenever
174
+ * the AST came from `parse()`, absent on hand-built ASTs.
175
+ *
176
+ * Useful for code that walks the parts tree generically: any part can be
177
+ * narrowed to this shape without switching on `type` first.
178
+ *
179
+ * @category Results
89
180
  */
90
- type RollPartBase = {
181
+ export type RollPartBase = {
91
182
  /** Sub-total this part contributed to its parent. */
92
183
  total: number;
93
184
  start?: number;
@@ -111,6 +202,63 @@ type RollPartBase = {
111
202
  * thresholds) are not surfaced as nested parts — their resolved numbers
112
203
  * appear in the owning part, and their dice are inspectable in
113
204
  * `RollResult.rolls` via the `'meta'` modifier tag.
205
+ *
206
+ * @example Walking the tree with an exhaustive switch
207
+ * ```typescript
208
+ * import type { RollPart } from 'roll-parser';
209
+ *
210
+ * function describe(part: RollPart): string {
211
+ * switch (part.type) {
212
+ * case 'literal':
213
+ * return String(part.value);
214
+ * case 'variable':
215
+ * return `@${part.name}`;
216
+ * case 'dice':
217
+ * return `${part.count}d${part.sides}[${part.rolls.map((d) => d.result).join(', ')}]`;
218
+ * case 'fateDice':
219
+ * return `${part.count}dF`;
220
+ * case 'grouped':
221
+ * return `(${describe(part.inner)})`;
222
+ * case 'binaryOp':
223
+ * return `${describe(part.left)} ${part.operator} ${describe(part.right)}`;
224
+ * case 'unaryOp':
225
+ * return `-${describe(part.operand)}`;
226
+ * case 'keepDrop':
227
+ * return `${describe(part.target)} [${part.specs.length} keep/drop]`;
228
+ * case 'explode':
229
+ * return `${describe(part.target)} (${part.variant} explode)`;
230
+ * case 'reroll':
231
+ * return `${describe(part.target)} (reroll${part.once ? ' once' : ''})`;
232
+ * case 'dieBound':
233
+ * return `${describe(part.target)} (${part.bound} ${part.value})`;
234
+ * case 'successCount':
235
+ * return `${describe(part.target)} => ${part.successes}-${part.failures}`;
236
+ * case 'versus':
237
+ * return `${describe(part.roll)} vs ${describe(part.dc)}`;
238
+ * case 'functionCall':
239
+ * return `${part.name}(${part.args.map(describe).join(', ')})`;
240
+ * case 'group':
241
+ * return `{${part.parts.map(describe).join(', ')}}`;
242
+ * case 'sort':
243
+ * return `${describe(part.target)} (${part.order})`;
244
+ * case 'critThreshold':
245
+ * return `${describe(part.target)} (crit override)`;
246
+ * }
247
+ * }
248
+ * ```
249
+ *
250
+ * @example Reading a concrete tree
251
+ * ```typescript
252
+ * import { roll } from 'roll-parser';
253
+ * import { createMockRng } from 'roll-parser/testing';
254
+ *
255
+ * const result = roll('4d6kh3 + 2', { rng: createMockRng([3, 6, 2, 5]) });
256
+ * result.parts.type; // 'binaryOp'
257
+ * result.parts.total; // 16 — always equal to result.total
258
+ * describe(result.parts); // '4d6[3, 6, 2, 5] [1 keep/drop] + 2'
259
+ * ```
260
+ *
261
+ * @category Results
114
262
  */
115
263
  export type RollPart = (RollPartBase & {
116
264
  type: 'literal';
@@ -141,8 +289,8 @@ export type RollPart = (RollPartBase & {
141
289
  operator: '-';
142
290
  operand: RollPart;
143
291
  }) | (RollPartBase & {
144
- type: 'modifier';
145
- specs: ModifierSpec[];
292
+ type: 'keepDrop';
293
+ specs: KeepDropSpec[];
146
294
  target: RollPart;
147
295
  }) | (RollPartBase & {
148
296
  type: 'explode';
@@ -154,6 +302,11 @@ export type RollPart = (RollPartBase & {
154
302
  once: boolean;
155
303
  condition: ResolvedComparePoint;
156
304
  target: RollPart;
305
+ }) | (RollPartBase & {
306
+ type: 'dieBound';
307
+ bound: 'min' | 'max';
308
+ value: number;
309
+ target: RollPart;
157
310
  }) | (RollPartBase & {
158
311
  type: 'successCount';
159
312
  threshold: ResolvedComparePoint;
@@ -177,6 +330,13 @@ export type RollPart = (RollPartBase & {
177
330
  }) | (RollPartBase & {
178
331
  type: 'sort';
179
332
  order: 'ascending' | 'descending';
333
+ /**
334
+ * Every die the target produced, in sorted order, sharing `DieResult`
335
+ * references with `target` — so flags set after the sort (`4d6s dl1`)
336
+ * show through both. Like `RollResult.rolls` it keeps `'meta'` dice,
337
+ * which `rendered` omits from the bracket.
338
+ */
339
+ rolls: DieResult[];
180
340
  target: RollPart;
181
341
  }) | (RollPartBase & {
182
342
  type: 'critThreshold';
@@ -184,12 +344,52 @@ export type RollPart = (RollPartBase & {
184
344
  failThresholds: ResolvedCritThreshold[];
185
345
  target: RollPart;
186
346
  });
187
- /** Convenience alias for consumers writing exhaustive switches. */
347
+ /**
348
+ * The 17 discriminant strings of {@link RollPart}. Convenience alias for
349
+ * consumers writing exhaustive switches or part-type lookup tables.
350
+ *
351
+ * @category Results
352
+ */
188
353
  export type RollPartType = RollPart['type'];
189
354
  /**
190
- * Complete roll result with all metadata.
355
+ * Complete roll result with all metadata — what {@link roll} and
356
+ * {@link evaluate} return.
357
+ *
358
+ * The top level is `Readonly` — a result describes one completed evaluation
359
+ * and is never re-targeted. The `rolls` array and the `parts` tree stay
360
+ * mutable so consumers can annotate or re-sort their own views.
361
+ *
362
+ * Fully JSON-serializable; this is exactly what the CLI's `--json` flag emits.
363
+ *
364
+ * @example
365
+ * ```typescript
366
+ * import { roll } from 'roll-parser';
367
+ * import { createMockRng } from 'roll-parser/testing';
368
+ *
369
+ * const result = roll('3d6', { rng: createMockRng([4, 2, 6]) });
370
+ *
371
+ * JSON.stringify(result);
372
+ * // {
373
+ * // "total": 12,
374
+ * // "notation": "3d6",
375
+ * // "expression": "3d6",
376
+ * // "rendered": "3d6[4, 2, 6] = 12",
377
+ * // "rolls": [
378
+ * // { "sides": 6, "result": 4, "modifiers": ["kept"], "critical": false, "fumble": false },
379
+ * // { "sides": 6, "result": 2, "modifiers": ["kept"], "critical": false, "fumble": false },
380
+ * // { "sides": 6, "result": 6, "modifiers": ["kept"], "critical": true, "fumble": false }
381
+ * // ],
382
+ * // "parts": {
383
+ * // "type": "dice", "count": 3, "sides": 6,
384
+ * // "rolls": [ ...the same three objects... ],
385
+ * // "total": 12, "start": 0, "end": 3
386
+ * // }
387
+ * // }
388
+ * ```
389
+ *
390
+ * @category Results
191
391
  */
192
- export type RollResult = {
392
+ export type RollResult = Readonly<{
193
393
  /** Final computed total */
194
394
  total: number;
195
395
  /** Original input notation */
@@ -198,20 +398,28 @@ export type RollResult = {
198
398
  expression: string;
199
399
  /** Rendered result with individual rolls shown */
200
400
  rendered: string;
201
- /** All individual die results */
401
+ /**
402
+ * All individual die results, in evaluation order.
403
+ *
404
+ * Shares `DieResult` object references with the `rolls[]` arrays inside
405
+ * `parts` — no deep clone. Mutating a die here is visible through the part
406
+ * tree and vice versa; clone first if that matters.
407
+ */
202
408
  rolls: DieResult[];
203
409
  /** Structured breakdown of the evaluated expression, mirroring the AST 1:1. */
204
410
  parts: RollPart;
205
411
  /**
206
412
  * Number of dice tagged as success across the whole expression. Present
207
413
  * only when a success-counting modifier was used. Independent of `total` —
208
- * arithmetic on top of a success count (e.g. `5d6>=5 * 2`) affects `total`
209
- * but not `successes`.
414
+ * arithmetic on top of a success count (e.g. `{5d6>=5}+2`) affects `total`
415
+ * but not `successes`. Success counts are terminal, so the group braces are
416
+ * required: `5d6>=5 * 2` is an `INVALID_SUCCESS_COUNT_TARGET` parse error.
210
417
  */
211
418
  successes?: number;
212
419
  /**
213
420
  * Number of dice tagged as failure across the whole expression. Present
214
- * only when a success-counting modifier with a fail threshold was used.
421
+ * whenever a success-counting modifier was used `0` when no failure
422
+ * threshold was given, since nothing can be tagged as a failure.
215
423
  */
216
424
  failures?: number;
217
425
  /**
@@ -224,23 +432,77 @@ export type RollResult = {
224
432
  * exactly one kept d20 was rolled on the roll side of a `vs` expression.
225
433
  */
226
434
  natural?: number;
227
- };
435
+ }>;
228
436
  /**
229
- * Options for the evaluate function.
437
+ * Evaluation guardrails and variable resolution, shared by `EvaluateOptions`
438
+ * and `RollOptions`. Every field is optional — the defaults bound adversarial
439
+ * notation without capping any realistic expression.
440
+ *
441
+ * Tighten them when the notation comes from users you do not control; the
442
+ * caps are the difference between a typed `EvaluatorError` and a request that
443
+ * rolls ten million dice. Parse depth is capped separately and
444
+ * unconditionally by {@link MAX_PARSE_DEPTH}.
445
+ *
446
+ * The three numeric limits fail closed: omit one — or pass `undefined` or
447
+ * `null`, the no-options path a partial config produces — and it takes its
448
+ * default, but supply anything else that is not a safe integer in range — a
449
+ * string, `NaN`, `±Infinity`, a negative, a fraction — and evaluation throws
450
+ * `INVALID_EVALUATION_LIMIT` before rolling. `maxDice` accepts `>= 1`, the two
451
+ * iteration limits `>= 0`. No coercion: `maxDice: Number(input)` on
452
+ * unparseable input rejects rather than quietly reverting to the permissive
453
+ * default.
454
+ *
455
+ * @example Untrusted input
456
+ * ```typescript
457
+ * import { isRollParserError, roll } from 'roll-parser';
458
+ *
459
+ * const limits = {
460
+ * maxDice: 100,
461
+ * maxExplodeIterations: 20,
462
+ * maxRerollIterations: 20,
463
+ * };
464
+ *
465
+ * try {
466
+ * roll('99999d6', limits).total;
467
+ * } catch (error) {
468
+ * isRollParserError(error) && error.code; // 'DICE_LIMIT_EXCEEDED'
469
+ * }
470
+ * ```
471
+ *
472
+ * @example Variables
473
+ * ```typescript
474
+ * import { roll } from 'roll-parser';
475
+ *
476
+ * roll('1d20+@str', { context: { str: 4 }, seed: 'demo' }).total; // 5
477
+ * roll('1d20+@str', { onMissingVariable: 'zero', seed: 'demo' }).total; // 1
478
+ * ```
479
+ *
480
+ * @category Core
230
481
  */
231
- export type EvaluateOptions = {
232
- /** Original notation string (for result metadata) */
233
- notation?: string;
234
- /** Maximum total dice allowed per evaluation (default: 10,000) */
482
+ export type EvaluationOptions = {
483
+ /** Maximum total dice allowed per evaluation; integer >= 1 (default: 10,000) */
235
484
  maxDice?: number;
236
- /** Maximum explosion iterations allowed per die (default: 1,000) */
485
+ /** Maximum explosion iterations allowed per die; integer >= 0 (default: 1,000) */
237
486
  maxExplodeIterations?: number;
238
- /** Maximum reroll iterations allowed per die (default: 1,000) */
487
+ /** Maximum reroll iterations allowed per die; integer >= 0 (default: 1,000) */
239
488
  maxRerollIterations?: number;
240
489
  /** Variable context for `@name` / `@{name}` references (default: empty) */
241
- context?: Record<string, number>;
490
+ context?: Readonly<Record<string, number>>;
242
491
  /** Behavior when a referenced variable is missing from context (default: 'throw') */
243
492
  onMissingVariable?: 'throw' | 'zero';
244
493
  };
245
- export {};
494
+ /**
495
+ * Options for {@link evaluate}: the shared {@link EvaluationOptions} plus the
496
+ * original notation, which `evaluate` cannot recover from an AST.
497
+ *
498
+ * @category Core
499
+ */
500
+ export type EvaluateOptions = EvaluationOptions & {
501
+ /**
502
+ * Original notation string, echoed back as `RollResult.notation`. When
503
+ * omitted, falls back to the normalized `expression` reconstructed from the
504
+ * AST — {@link roll} always forwards the string the caller typed.
505
+ */
506
+ notation?: string;
507
+ };
246
508
  //# sourceMappingURL=types.d.ts.map
@@ -1 +1 @@
1
- {"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AAAA;;;;GAIG;AAEH,OAAO,K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nB;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;IAClB;;;OAGG;IACH,MAAM,CAAC,EAAE,eAAe,CAAC;IACzB;;;OAGG;IACH,OAAO,CAAC,EAAE,MAAM,CAAC;CAClB,CAAC,CAAC;AAEH;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;;GA6CG;AACH,MAAM,MAAM,iBAAiB,GAAG;IAC9B,gFAAgF;IAChF,OAAO,CAAC,EAAE,MAAM,CAAC;IACjB,kFAAkF;IAClF,oBAAoB,CAAC,EAAE,MAAM,CAAC;IAC9B,+EAA+E;IAC/E,mBAAmB,CAAC,EAAE,MAAM,CAAC;IAC7B,2EAA2E;IAC3E,OAAO,CAAC,EAAE,QAAQ,CAAC,MAAM,CAAC,MAAM,EAAE,MAAM,CAAC,CAAC,CAAC;IAC3C,qFAAqF;IACrF,iBAAiB,CAAC,EAAE,OAAO,GAAG,MAAM,CAAC;CACtC,CAAC;AAEF;;;;;GAKG;AACH,MAAM,MAAM,eAAe,GAAG,iBAAiB,GAAG;IAChD;;;;OAIG;IACH,QAAQ,CAAC,EAAE,MAAM,CAAC;CACnB,CAAC"}
package/dist/types.js ADDED
@@ -0,0 +1,8 @@
1
+ export var DegreeOfSuccess;
2
+ (function (DegreeOfSuccess) {
3
+ DegreeOfSuccess[DegreeOfSuccess["CriticalFailure"] = 0] = "CriticalFailure";
4
+ DegreeOfSuccess[DegreeOfSuccess["Failure"] = 1] = "Failure";
5
+ DegreeOfSuccess[DegreeOfSuccess["Success"] = 2] = "Success";
6
+ DegreeOfSuccess[DegreeOfSuccess["CriticalSuccess"] = 3] = "CriticalSuccess";
7
+ })(DegreeOfSuccess || (DegreeOfSuccess = {}));
8
+ //# sourceMappingURL=types.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"types.js","sourceRoot":"","sources":["../src/types.ts"],"names":[],"mappings":"AA0HA,MAAM,CAAN,IAAY,eAKX;AALD,WAAY,eAAe;IACzB,2EAAmB,CAAA;IACnB,2DAAW,CAAA;IACX,2DAAW,CAAA;IACX,2EAAmB,CAAA;AACrB,CAAC,EALW,eAAe,KAAf,eAAe,QAK1B"}
@@ -0,0 +1,2 @@
1
+ export declare const version = "3.0.0";
2
+ //# sourceMappingURL=version.d.ts.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.d.ts","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,eAAO,MAAM,OAAO,UAAU,CAAC"}
@@ -0,0 +1,2 @@
1
+ export const version = '3.0.0';
2
+ //# sourceMappingURL=version.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"file":"version.js","sourceRoot":"","sources":["../src/version.ts"],"names":[],"mappings":"AACA,MAAM,CAAC,MAAM,OAAO,GAAG,OAAO,CAAC"}