roll-parser 3.0.0-beta.0 → 3.1.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 (164) hide show
  1. package/CHANGELOG.md +142 -9
  2. package/MIGRATION.md +219 -0
  3. package/README.md +1026 -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 +18 -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 +27 -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 +89 -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 +914 -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 +57 -5
  39. package/dist/evaluator/modifiers/crit-threshold.d.ts.map +1 -1
  40. package/dist/evaluator/modifiers/crit-threshold.js +42 -0
  41. package/dist/evaluator/modifiers/crit-threshold.js.map +1 -0
  42. package/dist/evaluator/modifiers/die-bound.d.ts +29 -0
  43. package/dist/evaluator/modifiers/die-bound.d.ts.map +1 -0
  44. package/dist/evaluator/modifiers/die-bound.js +17 -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 +105 -0
  49. package/dist/evaluator/modifiers/explode.js.map +1 -0
  50. package/dist/evaluator/modifiers/flags.d.ts +47 -0
  51. package/dist/evaluator/modifiers/flags.d.ts.map +1 -0
  52. package/dist/evaluator/modifiers/flags.js +25 -0
  53. package/dist/evaluator/modifiers/flags.js.map +1 -0
  54. package/dist/evaluator/modifiers/keep-drop.d.ts +15 -29
  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 +68 -0
  61. package/dist/evaluator/modifiers/reroll.js.map +1 -0
  62. package/dist/evaluator/modifiers/sort.d.ts +5 -1
  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 +6 -7
  67. package/dist/evaluator/modifiers/success-count.d.ts.map +1 -1
  68. package/dist/evaluator/modifiers/success-count.js +25 -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 +324 -165
  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/render.d.ts +95 -0
  95. package/dist/render.d.ts.map +1 -0
  96. package/dist/render.js +227 -0
  97. package/dist/render.js.map +1 -0
  98. package/dist/rng/mock.d.ts +73 -12
  99. package/dist/rng/mock.d.ts.map +1 -1
  100. package/dist/rng/mock.js +30 -0
  101. package/dist/rng/mock.js.map +1 -0
  102. package/dist/rng/seeded.d.ts +141 -9
  103. package/dist/rng/seeded.d.ts.map +1 -1
  104. package/dist/rng/seeded.js +138 -0
  105. package/dist/rng/seeded.js.map +1 -0
  106. package/dist/rng/types.d.ts +57 -0
  107. package/dist/rng/types.d.ts.map +1 -1
  108. package/dist/rng/types.js +2 -0
  109. package/dist/rng/types.js.map +1 -0
  110. package/dist/roll.d.ts +58 -28
  111. package/dist/roll.d.ts.map +1 -1
  112. package/dist/roll.js +8 -0
  113. package/dist/roll.js.map +1 -0
  114. package/dist/testing.d.ts +5 -4
  115. package/dist/testing.d.ts.map +1 -1
  116. package/dist/testing.js +2 -41
  117. package/dist/testing.js.map +1 -11
  118. package/dist/types.d.ts +349 -47
  119. package/dist/types.d.ts.map +1 -1
  120. package/dist/types.js +8 -0
  121. package/dist/types.js.map +1 -0
  122. package/dist/version.d.ts +2 -0
  123. package/dist/version.d.ts.map +1 -0
  124. package/dist/version.js +2 -0
  125. package/dist/version.js.map +1 -0
  126. package/package.json +93 -34
  127. package/src/cli/args.ts +66 -10
  128. package/src/cli/format.ts +37 -26
  129. package/src/cli/index.ts +27 -84
  130. package/src/cli/main.ts +129 -0
  131. package/src/errors.ts +480 -27
  132. package/src/evaluator/die.ts +51 -0
  133. package/src/evaluator/env.ts +105 -0
  134. package/src/evaluator/evaluator.ts +693 -434
  135. package/src/evaluator/modifiers/crit-threshold.ts +96 -14
  136. package/src/evaluator/modifiers/die-bound.ts +48 -0
  137. package/src/evaluator/modifiers/explode.ts +70 -62
  138. package/src/evaluator/modifiers/flags.ts +78 -0
  139. package/src/evaluator/modifiers/keep-drop.ts +129 -127
  140. package/src/evaluator/modifiers/reroll.ts +44 -56
  141. package/src/evaluator/modifiers/sort.ts +21 -2
  142. package/src/evaluator/modifiers/success-count.ts +24 -12
  143. package/src/index.ts +56 -35
  144. package/src/lexer/lexer.ts +107 -34
  145. package/src/lexer/tokens.ts +31 -6
  146. package/src/parser/ast.ts +333 -346
  147. package/src/parser/guards.ts +248 -0
  148. package/src/parser/parser.ts +419 -242
  149. package/src/render.ts +392 -0
  150. package/src/rng/mock.ts +74 -13
  151. package/src/rng/seeded.ts +299 -64
  152. package/src/rng/types.ts +57 -0
  153. package/src/roll.ts +64 -47
  154. package/src/testing.ts +5 -9
  155. package/src/types.ts +353 -46
  156. package/src/version.ts +2 -0
  157. package/dist/cli.js +0 -2608
  158. package/dist/cli.js.map +0 -28
  159. package/dist/evaluator/index.d.ts +0 -8
  160. package/dist/evaluator/index.d.ts.map +0 -1
  161. package/dist/rng/index.d.ts +0 -8
  162. package/dist/rng/index.d.ts.map +0 -1
  163. package/src/evaluator/index.ts +0 -14
  164. package/src/rng/index.ts +0 -8
package/dist/types.d.ts CHANGED
@@ -5,40 +5,110 @@
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
- * A resolved crit threshold — `'default'` means the per-die default rule
31
- * (`result === sides` for critical, `result === 1` for fumble).
40
+ * A resolved crit threshold — `'default'` means the per-die default rule,
41
+ * which is what bare `cs` / `cf` produce. It reads the natural face
42
+ * (`initialResult ?? result`): critical when it equals `sides`, fumble when
43
+ * it equals 1, both only for `sides > 1`. An explicit ComparePoint instead
44
+ * reads the die's current `result`, so a preceding modifier that rewrote it
45
+ * is visible to the comparison.
46
+ *
47
+ * @category Results
32
48
  */
33
49
  export type ResolvedCritThreshold = ResolvedComparePoint | 'default';
34
50
  /**
35
- * Modifier flags applied to individual die results.
51
+ * Tags attached to a {@link DieResult} by the evaluator. A die can carry more
52
+ * than one (an exploded die that was later dropped is `['dropped',
53
+ * 'exploded']`), and the set drives the markers in `RollResult.rendered`.
54
+ *
55
+ * | Tag | Meaning | Rendered as |
56
+ * |-----|---------|-------------|
57
+ * | `'kept'` | Counted toward the total. Every non-dropped die carries it. | plain |
58
+ * | `'dropped'` | Excluded from the total by `kh`/`kl`/`dh`/`dl` or group selection. | `~~n~~` |
59
+ * | `'exploded'` | Produced by, or the trigger of, an explosion (`!`, `!!`, `!p`). | plain |
60
+ * | `'rerolled'` | A discarded intermediate from `r` / `ro`, always paired with `'dropped'` — the replacement die carries no tag. | `~~n~~` (via `'dropped'`) |
61
+ * | `'min'` | Raised to a `minN` bound; `initialResult` keeps the raw face. | plain |
62
+ * | `'max'` | Lowered to a `maxN` bound; `initialResult` keeps the raw face. | plain |
63
+ * | `'success'` | Met a success-count threshold (`>=6`). | `**n**` |
64
+ * | `'failure'` | Met a failure threshold (`f1`). | `__n__` |
65
+ * | `'meta'` | Rolled by a meta-expression rather than by the visible pool. | not shown |
66
+ * | `'dc'` | The DC side of a `vs` comparison. Never part of the roll-side pool. | plain |
67
+ *
68
+ * `'meta'` is the one tag with no counterpart in the notation. Dice counts,
69
+ * sides, modifier counts and computed thresholds may themselves be dice
70
+ * (`(1d4)d6`, `4d6kh(1d2)`, `1d6!>(1d2+3)`). Those inner dice belong to no
71
+ * pool: they never appear on a `dice` or `fateDice` part, and they are
72
+ * appended to `RollResult.rolls` tagged `'meta'` so an audit log can still
73
+ * show what the meta-expression rolled.
74
+ *
75
+ * The four whole-pool views — `sort`, `explode`, `reroll`, and `successCount`
76
+ * `rolls` — are snapshots of an evaluation context rather than of a pool, so
77
+ * they do carry meta dice. Filter them out when summing or displaying a pool.
78
+ *
79
+ * `'dc'` marks the DC side of a `vs` comparison. Unlike `'meta'` these dice do
80
+ * render — `1d20[3] vs 2d10[5, 6]` shows both sides — but they are not part of
81
+ * the roll-side pool, so no modifier may sum, select, clamp, reroll, explode,
82
+ * or tally them. Filter them out when summing a pool, exactly as with `'meta'`.
83
+ *
84
+ * @category Results
36
85
  */
37
- export type DieModifier = 'dropped' | 'kept' | 'exploded' | 'rerolled' | 'success' | 'failure' | 'meta';
86
+ export type DieModifier = 'dropped' | 'kept' | 'exploded' | 'rerolled' | 'min' | 'max' | 'success' | 'failure' | 'meta' | 'dc';
38
87
  /**
39
88
  * PF2e Degree of Success. Produced by the `vs` operator when comparing a
40
89
  * roll against a Difficulty Class. Ordering is significant — natural 20
41
90
  * upgrades one step and natural 1 downgrades one step.
91
+ *
92
+ * Numeric by design: the enum members are plain numbers, so `--json` CLI
93
+ * output and `JSON.stringify` emit `0`–`3` and comparisons like
94
+ * `degree >= DegreeOfSuccess.Success` work.
95
+ *
96
+ * @example
97
+ * ```typescript
98
+ * import { DegreeOfSuccess, roll } from 'roll-parser';
99
+ * import { createMockRng } from 'roll-parser/testing';
100
+ *
101
+ * const result = roll('1d20+7 vs 15', { rng: createMockRng([12]) });
102
+ * result.degree; // DegreeOfSuccess.Success (2)
103
+ * result.natural; // 12 — the raw d20 face, used for the ±1 step
104
+ * result.rendered; // '1d20[12] + 7 vs 15 = Success'
105
+ *
106
+ * if (result.degree != null && result.degree >= DegreeOfSuccess.Success) {
107
+ * // hit
108
+ * }
109
+ * ```
110
+ *
111
+ * @category Results
42
112
  */
43
113
  export declare enum DegreeOfSuccess {
44
114
  CriticalFailure = 0,
@@ -47,7 +117,25 @@ export declare enum DegreeOfSuccess {
47
117
  CriticalSuccess = 3
48
118
  }
49
119
  /**
50
- * Individual die roll result with metadata.
120
+ * One physical die and everything the evaluator learned about it.
121
+ *
122
+ * The same object is shared between `RollResult.rolls` and the `rolls[]` of
123
+ * the {@link RollPart} that produced it — there is no deep clone, so mutating
124
+ * a die is visible through both views.
125
+ *
126
+ * @example
127
+ * ```typescript
128
+ * import { roll } from 'roll-parser';
129
+ * import { createMockRng } from 'roll-parser/testing';
130
+ *
131
+ * const result = roll('4d6kh3', { rng: createMockRng([3, 6, 2, 5]) });
132
+ * result.rolls[1];
133
+ * // { sides: 6, result: 6, modifiers: ['kept'], critical: true, fumble: false }
134
+ * result.rolls[2];
135
+ * // { sides: 6, result: 2, modifiers: ['dropped'], critical: false, fumble: false }
136
+ * ```
137
+ *
138
+ * @category Results
51
139
  */
52
140
  export type DieResult = {
53
141
  /**
@@ -67,27 +155,47 @@ export type DieResult = {
67
155
  initialResult?: number;
68
156
  /** Modifiers applied to this die */
69
157
  modifiers: DieModifier[];
70
- /** True if rolled the maximum value (always false for Fate dice) */
158
+ /**
159
+ * True if the die met its critical criteria — by default, rolling the
160
+ * maximum face on a die with more than one side. That default never fires
161
+ * on `d1` or on Fate dice (`sides = 0` has no maximum face), but an
162
+ * explicit `cs` threshold does: `4dFcs>0` flags every `+1`.
163
+ */
71
164
  critical: boolean;
72
- /** True if rolled 1 (always false for Fate dice) */
165
+ /**
166
+ * True if the die met its fumble criteria — by default, rolling a 1 on a
167
+ * die with more than one side. As with {@link DieResult.critical}, the
168
+ * default never fires on `d1` or Fate dice, while an explicit `cf`
169
+ * threshold does: `4dFcf=-1` flags every `-1`.
170
+ */
73
171
  fumble: boolean;
74
172
  };
75
173
  /**
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).
174
+ * One entry inside a flattened keep/drop chain. Counts are resolved at
175
+ * evaluation time (meta-expressions like `kh(1d2)` become the rolled number).
176
+ *
177
+ * Chained keep/drop modifiers flatten into one list — `4d6kh3dl1` yields two
178
+ * specs against a single pool, each applied independently, with drop sets
179
+ * unioned (Roll20 semantics).
180
+ *
181
+ * @category Results
79
182
  */
80
- export type ModifierSpec = {
81
- kind: 'keep' | 'drop';
82
- selector: 'highest' | 'lowest';
83
- count: number;
183
+ export type KeepDropSpec = {
184
+ readonly kind: 'keep' | 'drop';
185
+ readonly selector: 'highest' | 'lowest';
186
+ readonly count: number;
84
187
  };
85
188
  /**
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.
189
+ * Fields shared by every {@link RollPart} variant. `start`/`end` mirror the
190
+ * source span of the AST node the part was evaluated from — present whenever
191
+ * the AST came from `parse()`, absent on hand-built ASTs.
192
+ *
193
+ * Useful for code that walks the parts tree generically: any part can be
194
+ * narrowed to this shape without switching on `type` first.
195
+ *
196
+ * @category Results
89
197
  */
90
- type RollPartBase = {
198
+ export type RollPartBase = {
91
199
  /** Sub-total this part contributed to its parent. */
92
200
  total: number;
93
201
  start?: number;
@@ -111,6 +219,63 @@ type RollPartBase = {
111
219
  * thresholds) are not surfaced as nested parts — their resolved numbers
112
220
  * appear in the owning part, and their dice are inspectable in
113
221
  * `RollResult.rolls` via the `'meta'` modifier tag.
222
+ *
223
+ * @example Walking the tree with an exhaustive switch
224
+ * ```typescript
225
+ * import type { RollPart } from 'roll-parser';
226
+ *
227
+ * function describe(part: RollPart): string {
228
+ * switch (part.type) {
229
+ * case 'literal':
230
+ * return String(part.value);
231
+ * case 'variable':
232
+ * return `@${part.name}`;
233
+ * case 'dice':
234
+ * return `${part.count}d${part.sides}[${part.rolls.map((d) => d.result).join(', ')}]`;
235
+ * case 'fateDice':
236
+ * return `${part.count}dF`;
237
+ * case 'grouped':
238
+ * return `(${describe(part.inner)})`;
239
+ * case 'binaryOp':
240
+ * return `${describe(part.left)} ${part.operator} ${describe(part.right)}`;
241
+ * case 'unaryOp':
242
+ * return `-${describe(part.operand)}`;
243
+ * case 'keepDrop':
244
+ * return `${describe(part.target)} [${part.specs.length} keep/drop]`;
245
+ * case 'explode':
246
+ * return `${describe(part.target)} (${part.variant} explode)`;
247
+ * case 'reroll':
248
+ * return `${describe(part.target)} (reroll${part.once ? ' once' : ''})`;
249
+ * case 'dieBound':
250
+ * return `${describe(part.target)} (${part.bound} ${part.value})`;
251
+ * case 'successCount':
252
+ * return `${describe(part.target)} => ${part.successes}-${part.failures}`;
253
+ * case 'versus':
254
+ * return `${describe(part.roll)} vs ${describe(part.dc)}`;
255
+ * case 'functionCall':
256
+ * return `${part.name}(${part.args.map(describe).join(', ')})`;
257
+ * case 'group':
258
+ * return `{${part.parts.map(describe).join(', ')}}`;
259
+ * case 'sort':
260
+ * return `${describe(part.target)} (${part.order})`;
261
+ * case 'critThreshold':
262
+ * return `${describe(part.target)} (crit override)`;
263
+ * }
264
+ * }
265
+ * ```
266
+ *
267
+ * @example Reading a concrete tree
268
+ * ```typescript
269
+ * import { roll } from 'roll-parser';
270
+ * import { createMockRng } from 'roll-parser/testing';
271
+ *
272
+ * const result = roll('4d6kh3 + 2', { rng: createMockRng([3, 6, 2, 5]) });
273
+ * result.parts.type; // 'binaryOp'
274
+ * result.parts.total; // 16 — always equal to result.total
275
+ * describe(result.parts); // '4d6[3, 6, 2, 5] [1 keep/drop] + 2'
276
+ * ```
277
+ *
278
+ * @category Results
114
279
  */
115
280
  export type RollPart = (RollPartBase & {
116
281
  type: 'literal';
@@ -141,23 +306,51 @@ export type RollPart = (RollPartBase & {
141
306
  operator: '-';
142
307
  operand: RollPart;
143
308
  }) | (RollPartBase & {
144
- type: 'modifier';
145
- specs: ModifierSpec[];
309
+ type: 'keepDrop';
310
+ specs: KeepDropSpec[];
146
311
  target: RollPart;
147
312
  }) | (RollPartBase & {
148
313
  type: 'explode';
149
314
  variant: 'standard' | 'compound' | 'penetrating';
150
315
  threshold?: ResolvedComparePoint;
316
+ /**
317
+ * The expanded pool. Standard and penetrating explosions append dice
318
+ * that exist nowhere under `target`, so this is the only view of the
319
+ * pool the modifier actually produced. Compound explosions accumulate
320
+ * in place, making it the same dice as `target` carries.
321
+ *
322
+ * Like `RollResult.rolls` — and unlike the pool under `target` — this
323
+ * keeps `'meta'` dice. Filter them out before counting or displaying.
324
+ */
325
+ rolls: DieResult[];
151
326
  target: RollPart;
152
327
  }) | (RollPartBase & {
153
328
  type: 'reroll';
154
329
  once: boolean;
155
330
  condition: ResolvedComparePoint;
331
+ /**
332
+ * The post-reroll pool: discarded intermediates (`'rerolled'` +
333
+ * `'dropped'`) alongside their replacements. Both are appended rather
334
+ * than substituted, so neither appears under `target`.
335
+ *
336
+ * Keeps `'meta'` dice, as `RollResult.rolls` does.
337
+ */
338
+ rolls: DieResult[];
339
+ target: RollPart;
340
+ }) | (RollPartBase & {
341
+ type: 'dieBound';
342
+ bound: 'min' | 'max';
343
+ value: number;
156
344
  target: RollPart;
157
345
  }) | (RollPartBase & {
158
346
  type: 'successCount';
159
347
  threshold: ResolvedComparePoint;
160
348
  failThreshold?: ResolvedComparePoint;
349
+ /**
350
+ * The tallied pool, sharing `DieResult` references with `target`.
351
+ * Keeps `'meta'` dice, as `RollResult.rolls` does.
352
+ */
353
+ rolls: DieResult[];
161
354
  target: RollPart;
162
355
  successes: number;
163
356
  failures: number;
@@ -177,6 +370,13 @@ export type RollPart = (RollPartBase & {
177
370
  }) | (RollPartBase & {
178
371
  type: 'sort';
179
372
  order: 'ascending' | 'descending';
373
+ /**
374
+ * Every die the target produced, in sorted order, sharing `DieResult`
375
+ * references with `target` — so flags set after the sort (`4d6s dl1`)
376
+ * show through both. Like `RollResult.rolls` it keeps `'meta'` dice,
377
+ * which `rendered` omits from the bracket.
378
+ */
379
+ rolls: DieResult[];
180
380
  target: RollPart;
181
381
  }) | (RollPartBase & {
182
382
  type: 'critThreshold';
@@ -184,12 +384,52 @@ export type RollPart = (RollPartBase & {
184
384
  failThresholds: ResolvedCritThreshold[];
185
385
  target: RollPart;
186
386
  });
187
- /** Convenience alias for consumers writing exhaustive switches. */
387
+ /**
388
+ * The 17 discriminant strings of {@link RollPart}. Convenience alias for
389
+ * consumers writing exhaustive switches or part-type lookup tables.
390
+ *
391
+ * @category Results
392
+ */
188
393
  export type RollPartType = RollPart['type'];
189
394
  /**
190
- * Complete roll result with all metadata.
395
+ * Complete roll result with all metadata — what {@link roll} and
396
+ * {@link evaluate} return.
397
+ *
398
+ * The top level is `Readonly` — a result describes one completed evaluation
399
+ * and is never re-targeted. The `rolls` array and the `parts` tree stay
400
+ * mutable so consumers can annotate or re-sort their own views.
401
+ *
402
+ * Fully JSON-serializable; this is exactly what the CLI's `--json` flag emits.
403
+ *
404
+ * @example
405
+ * ```typescript
406
+ * import { roll } from 'roll-parser';
407
+ * import { createMockRng } from 'roll-parser/testing';
408
+ *
409
+ * const result = roll('3d6', { rng: createMockRng([4, 2, 6]) });
410
+ *
411
+ * JSON.stringify(result);
412
+ * // {
413
+ * // "total": 12,
414
+ * // "notation": "3d6",
415
+ * // "expression": "3d6",
416
+ * // "rendered": "3d6[4, 2, 6] = 12",
417
+ * // "rolls": [
418
+ * // { "sides": 6, "result": 4, "modifiers": ["kept"], "critical": false, "fumble": false },
419
+ * // { "sides": 6, "result": 2, "modifiers": ["kept"], "critical": false, "fumble": false },
420
+ * // { "sides": 6, "result": 6, "modifiers": ["kept"], "critical": true, "fumble": false }
421
+ * // ],
422
+ * // "parts": {
423
+ * // "type": "dice", "count": 3, "sides": 6,
424
+ * // "rolls": [ ...the same three objects... ],
425
+ * // "total": 12, "start": 0, "end": 3
426
+ * // }
427
+ * // }
428
+ * ```
429
+ *
430
+ * @category Results
191
431
  */
192
- export type RollResult = {
432
+ export type RollResult = Readonly<{
193
433
  /** Final computed total */
194
434
  total: number;
195
435
  /** Original input notation */
@@ -198,20 +438,28 @@ export type RollResult = {
198
438
  expression: string;
199
439
  /** Rendered result with individual rolls shown */
200
440
  rendered: string;
201
- /** All individual die results */
441
+ /**
442
+ * All individual die results, in evaluation order.
443
+ *
444
+ * Shares `DieResult` object references with the `rolls[]` arrays inside
445
+ * `parts` — no deep clone. Mutating a die here is visible through the part
446
+ * tree and vice versa; clone first if that matters.
447
+ */
202
448
  rolls: DieResult[];
203
449
  /** Structured breakdown of the evaluated expression, mirroring the AST 1:1. */
204
450
  parts: RollPart;
205
451
  /**
206
452
  * Number of dice tagged as success across the whole expression. Present
207
453
  * 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`.
454
+ * arithmetic on top of a success count (e.g. `{5d6>=5}+2`) affects `total`
455
+ * but not `successes`. Success counts are terminal, so the group braces are
456
+ * required: `5d6>=5 * 2` is an `INVALID_SUCCESS_COUNT_TARGET` parse error.
210
457
  */
211
458
  successes?: number;
212
459
  /**
213
460
  * Number of dice tagged as failure across the whole expression. Present
214
- * only when a success-counting modifier with a fail threshold was used.
461
+ * whenever a success-counting modifier was used `0` when no failure
462
+ * threshold was given, since nothing can be tagged as a failure.
215
463
  */
216
464
  failures?: number;
217
465
  /**
@@ -224,23 +472,77 @@ export type RollResult = {
224
472
  * exactly one kept d20 was rolled on the roll side of a `vs` expression.
225
473
  */
226
474
  natural?: number;
227
- };
475
+ }>;
228
476
  /**
229
- * Options for the evaluate function.
477
+ * Evaluation guardrails and variable resolution, shared by `EvaluateOptions`
478
+ * and `RollOptions`. Every field is optional — the defaults bound adversarial
479
+ * notation without capping any realistic expression.
480
+ *
481
+ * Tighten them when the notation comes from users you do not control; the
482
+ * caps are the difference between a typed `EvaluatorError` and a request that
483
+ * rolls ten million dice. Parse depth is capped separately and
484
+ * unconditionally by {@link MAX_PARSE_DEPTH}.
485
+ *
486
+ * The three numeric limits fail closed: omit one — or pass `undefined` or
487
+ * `null`, the no-options path a partial config produces — and it takes its
488
+ * default, but supply anything else that is not a safe integer in range — a
489
+ * string, `NaN`, `±Infinity`, a negative, a fraction — and evaluation throws
490
+ * `INVALID_EVALUATION_LIMIT` before rolling. `maxDice` accepts `>= 1`, the two
491
+ * iteration limits `>= 0`. No coercion: `maxDice: Number(input)` on
492
+ * unparseable input rejects rather than quietly reverting to the permissive
493
+ * default.
494
+ *
495
+ * @example Untrusted input
496
+ * ```typescript
497
+ * import { isRollParserError, roll } from 'roll-parser';
498
+ *
499
+ * const limits = {
500
+ * maxDice: 100,
501
+ * maxExplodeIterations: 20,
502
+ * maxRerollIterations: 20,
503
+ * };
504
+ *
505
+ * try {
506
+ * roll('99999d6', limits).total;
507
+ * } catch (error) {
508
+ * isRollParserError(error) && error.code; // 'DICE_LIMIT_EXCEEDED'
509
+ * }
510
+ * ```
511
+ *
512
+ * @example Variables
513
+ * ```typescript
514
+ * import { roll } from 'roll-parser';
515
+ *
516
+ * roll('1d20+@str', { context: { str: 4 }, seed: 'demo' }).total; // 5
517
+ * roll('1d20+@str', { onMissingVariable: 'zero', seed: 'demo' }).total; // 1
518
+ * ```
519
+ *
520
+ * @category Core
230
521
  */
231
- export type EvaluateOptions = {
232
- /** Original notation string (for result metadata) */
233
- notation?: string;
234
- /** Maximum total dice allowed per evaluation (default: 10,000) */
522
+ export type EvaluationOptions = {
523
+ /** Maximum total dice allowed per evaluation; integer >= 1 (default: 10,000) */
235
524
  maxDice?: number;
236
- /** Maximum explosion iterations allowed per die (default: 1,000) */
525
+ /** Maximum explosion iterations allowed per die; integer >= 0 (default: 1,000) */
237
526
  maxExplodeIterations?: number;
238
- /** Maximum reroll iterations allowed per die (default: 1,000) */
527
+ /** Maximum reroll iterations allowed per die; integer >= 0 (default: 1,000) */
239
528
  maxRerollIterations?: number;
240
529
  /** Variable context for `@name` / `@{name}` references (default: empty) */
241
- context?: Record<string, number>;
530
+ context?: Readonly<Record<string, number>>;
242
531
  /** Behavior when a referenced variable is missing from context (default: 'throw') */
243
532
  onMissingVariable?: 'throw' | 'zero';
244
533
  };
245
- export {};
534
+ /**
535
+ * Options for {@link evaluate}: the shared {@link EvaluationOptions} plus the
536
+ * original notation, which `evaluate` cannot recover from an AST.
537
+ *
538
+ * @category Core
539
+ */
540
+ export type EvaluateOptions = EvaluationOptions & {
541
+ /**
542
+ * Original notation string, echoed back as `RollResult.notation`. When
543
+ * omitted, falls back to the normalized `expression` reconstructed from the
544
+ * AST — {@link roll} always forwards the string the caller typed.
545
+ */
546
+ notation?: string;
547
+ };
246
548
  //# 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,KAAK,EAAE,OAAO,EAAE,MAAM,iBAAiB,CAAC;AAE/C;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,GAAG,IAAI,GAAG,GAAG,CAAC;AAEtD;;;;;GAKG;AACH,MAAM,MAAM,YAAY,GAAG;IACzB,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,OAAO,CAAC;CAChB,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,oBAAoB,GAAG;IACjC,QAAQ,EAAE,SAAS,CAAC;IACpB,KAAK,EAAE,MAAM,CAAC;CACf,CAAC;AAEF;;;GAGG;AACH,MAAM,MAAM,qBAAqB,GAAG,oBAAoB,GAAG,SAAS,CAAC;AAErE;;GAEG;AACH,MAAM,MAAM,WAAW,GACnB,SAAS,GACT,MAAM,GACN,UAAU,GACV,UAAU,GACV,SAAS,GACT,SAAS,GACT,MAAM,CAAC;AAEX;;;;GAIG;AACH,oBAAY,eAAe;IACzB,eAAe,IAAI;IACnB,OAAO,IAAI;IACX,OAAO,IAAI;IACX,eAAe,IAAI;CACpB;AAED;;GAEG;AACH,MAAM,MAAM,SAAS,GAAG;IACtB;;;;OAIG;IACH,KAAK,EAAE,MAAM,CAAC;IACd,uBAAuB;IACvB,MAAM,EAAE,MAAM,CAAC;IACf;;;;;OAKG;IACH,aAAa,CAAC,EAAE,MAAM,CAAC;IACvB,oCAAoC;IACpC,SAAS,EAAE,WAAW,EAAE,CAAC;IACzB,oEAAoE;IACpE,QAAQ,EAAE,OAAO,CAAC;IACl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reeOfSuccess) {
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":"AAiIA,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.1.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.1.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"}