punctilio 5.1.1 → 5.1.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/README.md CHANGED
@@ -231,7 +231,7 @@ A `.pre-commit-hooks.yaml` ships in the package, so [pre-commit](https://pre-com
231
231
  # .pre-commit-config.yaml
232
232
  repos:
233
233
  - repo: https://github.com/alexander-turner/punctilio
234
- rev: v5.1.0
234
+ rev: v5.1.2
235
235
  hooks:
236
236
  - id: punctilio # rewrites *.md / *.html in place
237
237
  - id: punctilio-check # or: fail without writing (CI-friendly)
@@ -1 +1 @@
1
- {"version":3,"file":"prose-view.d.ts","sourceRoot":"","sources":["../src/prose-view.ts"],"names":[],"mappings":"AAAA,MAAM,WAAW,SAAS;IACxB,KAAK,EAAE,MAAM,CAAA;CACd;AAED,MAAM,WAAW,SAAS;IACxB,4DAA4D;IAC5D,QAAQ,CAAC,IAAI,EAAE,MAAM,CAAA;IACrB,2KAA2K;IAC3K,QAAQ,CAAC,UAAU,EAAE,SAAS,MAAM,EAAE,CAAA;IACtC,iFAAiF;IACjF,WAAW,CAAC,MAAM,EAAE,MAAM,GAAG,OAAO,CAAA;IACpC,oGAAoG;IACpG,OAAO,CAAC,KAAK,EAAE,MAAM,EAAE,GAAG,EAAE,MAAM,EAAE,IAAI,EAAE,MAAM,EAAE,IAAI,CAAC,EAAE;QAAE,IAAI,CAAC,EAAE,MAAM,GAAG,OAAO,CAAA;KAAE,GAAG,IAAI,CAAA;IAC3F,2KAA2K;IAC3K,MAAM,IAAI,IAAI,CAAA;CACf;AA6LD,wBAAgB,cAAc,CAAC,KAAK,EAAE,SAAS,EAAE,GAAG,SAAS,CAE5D;AAED;;;;;GAKG;AACH,wBAAgB,cAAc,CAAC,CAAC,EAAE,KAAK,EAAE,SAAS,CAAC,EAAE,EAAE,WAAW,EAAE,WAAW,CAAC,MAAM,CAAC,GAAG,CAAC,EAAE,EAAE,CAc9F;AAED,MAAM,WAAW,iBAAiB;IA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AC;AACR,wBAAgB,SAAS,CACvB,KAAK,EAAE,MAAM,GAAG,SAAS,EACzB,GAAG,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,GAC7B,MAAM,GAAG,IAAI,CAAC;AAYjB;;;;;GAKG;AACH,wBAAgB,aAAa,CAAC,GAAG,EAAE,CAAC,IAAI,EAAE,SAAS,KAAK,IAAI,GAAG,SAAS,CAOvE"}
@@ -62,8 +62,12 @@ class ProseViewImpl {
62
62
  * tie-breaking shorter spans first so a zero-length edit sorts before a
63
63
  * spanning edit at the same start. A pure insertion may therefore coexist
64
64
  * with a replacement starting at the same offset: the insertion's text lands
65
- * before the replaced span's text. Overlapping spans (and two pure
66
- * insertions at the same offset) are rejected.
65
+ * before the replaced span's text. Overlapping spans are rejected, as are two
66
+ * pure insertions at the same offset that share a `bind` — those would land in
67
+ * the same node with no defined order. Two same-offset insertions with
68
+ * opposite `bind` are unambiguous: `bind: "left"` routes to the node ending at
69
+ * the offset and `bind: "right"` to the node starting there, so they occupy
70
+ * different nodes (left-bound sorted first).
67
71
  *
68
72
  * All edits are distributed in a single left-to-right pass that rebuilds
69
73
  * each node's value once — per-edit string surgery would be quadratic on
@@ -73,15 +77,22 @@ class ProseViewImpl {
73
77
  if (this.edits.length === 0) {
74
78
  return;
75
79
  }
76
- const sorted = [...this.edits].sort((a, b) => a.start - b.start || (a.end - a.start) - (b.end - b.start));
80
+ const bindRank = (edit) => edit.bind === "left" ? 0 : 1;
81
+ const sorted = [...this.edits].sort((a, b) => a.start - b.start ||
82
+ a.end - a.start - (b.end - b.start) ||
83
+ bindRank(a) - bindRank(b));
77
84
  for (let i = 1; i < sorted.length; i++) {
78
85
  const prev = sorted[i - 1];
79
86
  const curr = sorted[i];
80
87
  if (prev.end > curr.start) {
81
88
  throw new Error(`Overlapping edits: [${prev.start}, ${prev.end}) and [${curr.start}, ${curr.end}).`);
82
89
  }
83
- if (prev.end === curr.start && prev.start === prev.end && curr.start === curr.end) {
84
- throw new Error(`Two pure insertions at the same offset ${curr.start} are ambiguous; combine them.`);
90
+ if (prev.end === curr.start &&
91
+ prev.start === prev.end &&
92
+ curr.start === curr.end &&
93
+ prev.bind === curr.bind) {
94
+ throw new Error(`Two pure insertions at the same offset ${curr.start} with bind "${curr.bind}" are ` +
95
+ `ambiguous; combine them.`);
85
96
  }
86
97
  }
87
98
  // Node spans in `text` via cumulative lengths.
@@ -201,13 +212,15 @@ function lowerBound(values, target) {
201
212
  }
202
213
  /** True iff some interior boundary falls strictly inside the match span. */
203
214
  function matchContainsBoundary(match, view) {
204
- return firstInteriorBoundary(view, match.index, match.index + match[0].length) >= 0;
215
+ return (firstInteriorBoundary(view, match.index, match.index + match[0].length) >= 0);
205
216
  }
206
217
  /** Smallest node boundary strictly inside (start, end), or -1 when none. */
207
218
  export function firstInteriorBoundary(view, start, end) {
208
219
  const boundaries = view.boundaries;
209
220
  const first = lowerBound(boundaries, start + 1);
210
- return first < boundaries.length && boundaries[first] < end ? boundaries[first] : -1;
221
+ return first < boundaries.length && boundaries[first] < end
222
+ ? boundaries[first]
223
+ : -1;
211
224
  }
212
225
  /** Largest node boundary strictly less than `offset`, or -1 when none. O(log n). */
213
226
  export function lastBoundaryBefore(view, offset) {
@@ -311,7 +324,10 @@ function parseDollarToken(template, dollarIndex) {
311
324
  throw new Error(`Unsupported group reference $${digits} in replacement template ` +
312
325
  `${JSON.stringify(template)}; numbered groups start at $1.`);
313
326
  }
314
- return { part: { kind: "indexed", index, fallback }, next: dollarIndex + 1 + digits.length };
327
+ return {
328
+ part: { kind: "indexed", index, fallback },
329
+ next: dollarIndex + 1 + digits.length,
330
+ };
315
331
  }
316
332
  if (next === "<") {
317
333
  const close = template.indexOf(">", dollarIndex + 2);
@@ -1 +1 @@
1
- {"version":3,"file":"prose-view.js","sourceRoot":"","sources":["../src/prose-view.ts"],"names":[],"mappings":"AAwBA,gFAAgF;AAChF,SAAS,mBAAmB,CAAC,IAAY,EAAE,MAAc;IACvD,IAAI,MAAM,IA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AAW,CAAC;IAIlB,SAAS,IAAI,CAAC,KAAyB;QACrC,OAAO,SAAS,CAAC,KAAK,EAAE,CAAC,IAAI,EAAE,EAAE;YAC/B,gBAAgB,CACd,IAAI,EACJ,OAAO,EACP,QAAQ,EACR,eAAe,CAAC,CAAC,CAAC,EAAE,eAAe,EAAE,CAAC,CAAC,CAAC,SAAS,CAClD,CAAC;QACJ,CAAC,CAAC,CAAC;IACL,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC;AAmBD,MAAM,UAAU,SAAS,CACvB,KAAyB,EACzB,GAA8B;IAE9B,IAAI,OAAO,KAAK,KAAK,QAAQ,EAAE,CAAC;QAC9B,OAAO,aAAa,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IACnC,CAAC;IACD,GAAG,CAAC,KAAK,CAAC,CAAC;IACX,KAAK,CAAC,MAAM,EAAE,CAAC;AACjB,CAAC;AAED;;;;;GAKG;AACH,MAAM,UAAU,aAAa,CAAC,GAA8B;IAG1D,SAAS,IAAI,CAAC,KAAyB;QACrC,OAAO,SAAS,CAAC,KAAK,EAAE,GAAG,CAAC,CAAC;IAC/B,CAAC;IACD,OAAO,IAAI,CAAC;AACd,CAAC"}
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "punctilio",
3
- "version": "5.1.1",
3
+ "version": "5.1.3",
4
4
  "description": "Smart typography transformations: curly quotes, em-dashes, en-dashes, and more",
5
5
  "type": "module",
6
6
  "sideEffects": false,
package/src/prose-view.ts CHANGED
@@ -1,93 +1,107 @@
1
1
  export interface ProseNode {
2
- value: string
2
+ value: string;
3
3
  }
4
4
 
5
5
  export interface ProseView {
6
6
  /** Concatenation of the nodes' values. No markers, ever. */
7
- readonly text: string
7
+ readonly text: string;
8
8
  /** Offsets in `text` where one source node ends and the next begins (interior boundaries only; length = nodes.length - 1; may contain duplicates when nodes are empty). */
9
- readonly boundaries: readonly number[]
9
+ readonly boundaries: readonly number[];
10
10
  /** True iff a node edge falls at exactly this offset. O(log n) binary search. */
11
- hasBoundary(offset: number): boolean
11
+ hasBoundary(offset: number): boolean;
12
12
  /** Queue an edit replacing [start, end) with `text`. Edits must not overlap; enforced at commit. */
13
- replace(start: number, end: number, text: string, opts?: { bind?: "left" | "right" }): void
13
+ replace(
14
+ start: number,
15
+ end: number,
16
+ text: string,
17
+ opts?: { bind?: "left" | "right" },
18
+ ): void;
14
19
  /** Apply queued edits back onto the source nodes (mutating their `value`s), then recompute `text`/`boundaries`. The view supports arbitrarily many queue/commit cycles. */
15
- commit(): void
20
+ commit(): void;
16
21
  }
17
22
 
18
23
  interface QueuedEdit {
19
- start: number
20
- end: number
21
- text: string
22
- bind: "left" | "right"
24
+ start: number;
25
+ end: number;
26
+ text: string;
27
+ bind: "left" | "right";
23
28
  }
24
29
 
25
30
  /** True iff the offset falls between a high surrogate and its low surrogate. */
26
31
  function splitsSurrogatePair(text: string, offset: number): boolean {
27
- if (offset <= 0 || offset >= text.length) return false
28
- const high = text.charCodeAt(offset - 1)
29
- const low = text.charCodeAt(offset)
30
- return high >= 0xd800 && high <= 0xdbff && low >= 0xdc00 && low <= 0xdfff
32
+ if (offset <= 0 || offset >= text.length) return false;
33
+ const high = text.charCodeAt(offset - 1);
34
+ const low = text.charCodeAt(offset);
35
+ return high >= 0xd800 && high <= 0xdbff && low >= 0xdc00 && low <= 0xdfff;
31
36
  }
32
37
 
33
38
  class ProseViewImpl implements ProseView {
34
- private readonly nodes: ProseNode[]
35
- private cachedText: string
36
- private cachedBoundaries: number[]
37
- private edits: QueuedEdit[] = []
39
+ private readonly nodes: ProseNode[];
40
+ private cachedText: string;
41
+ private cachedBoundaries: number[];
42
+ private edits: QueuedEdit[] = [];
38
43
 
39
44
  constructor(nodes: ProseNode[]) {
40
- this.nodes = nodes
41
- this.cachedText = ""
42
- this.cachedBoundaries = []
43
- this.refresh()
45
+ this.nodes = nodes;
46
+ this.cachedText = "";
47
+ this.cachedBoundaries = [];
48
+ this.refresh();
44
49
  }
45
50
 
46
51
  get text(): string {
47
- return this.cachedText
52
+ return this.cachedText;
48
53
  }
49
54
 
50
55
  get boundaries(): readonly number[] {
51
- return this.cachedBoundaries
56
+ return this.cachedBoundaries;
52
57
  }
53
58
 
54
59
  /** Recompute `text` and `boundaries` from the current node values. */
55
60
  private refresh(): void {
56
- let text = ""
57
- const boundaries: number[] = []
61
+ let text = "";
62
+ const boundaries: number[] = [];
58
63
  this.nodes.forEach((node, index) => {
59
- text += node.value
64
+ text += node.value;
60
65
  if (index < this.nodes.length - 1) {
61
- boundaries.push(text.length)
66
+ boundaries.push(text.length);
62
67
  }
63
- })
64
- this.cachedText = text
65
- this.cachedBoundaries = boundaries
68
+ });
69
+ this.cachedText = text;
70
+ this.cachedBoundaries = boundaries;
66
71
  }
67
72
 
68
73
  hasBoundary(offset: number): boolean {
69
- const boundaries = this.cachedBoundaries
70
- const first = lowerBound(boundaries, offset)
71
- return first < boundaries.length && boundaries[first] === offset
74
+ const boundaries = this.cachedBoundaries;
75
+ const first = lowerBound(boundaries, offset);
76
+ return first < boundaries.length && boundaries[first] === offset;
72
77
  }
73
78
 
74
- replace(start: number, end: number, text: string, opts?: { bind?: "left" | "right" }): void {
79
+ replace(
80
+ start: number,
81
+ end: number,
82
+ text: string,
83
+ opts?: { bind?: "left" | "right" },
84
+ ): void {
75
85
  if (!Number.isInteger(start) || !Number.isInteger(end)) {
76
- throw new Error(`replace() offsets must be integers, got start=${start}, end=${end}.`)
86
+ throw new Error(
87
+ `replace() offsets must be integers, got start=${start}, end=${end}.`,
88
+ );
77
89
  }
78
90
  if (start < 0 || start > end || end > this.cachedText.length) {
79
91
  throw new Error(
80
92
  `replace() requires 0 <= start <= end <= text.length (${this.cachedText.length}), ` +
81
- `got start=${start}, end=${end}.`
82
- )
93
+ `got start=${start}, end=${end}.`,
94
+ );
83
95
  }
84
96
  if (splitsSurrogatePair(this.cachedText, start)) {
85
- throw new Error(`replace() start=${start} splits a UTF-16 surrogate pair.`)
97
+ throw new Error(
98
+ `replace() start=${start} splits a UTF-16 surrogate pair.`,
99
+ );
86
100
  }
87
101
  if (splitsSurrogatePair(this.cachedText, end)) {
88
- throw new Error(`replace() end=${end} splits a UTF-16 surrogate pair.`)
102
+ throw new Error(`replace() end=${end} splits a UTF-16 surrogate pair.`);
89
103
  }
90
- this.edits.push({ start, end, text, bind: opts?.bind ?? "left" })
104
+ this.edits.push({ start, end, text, bind: opts?.bind ?? "left" });
91
105
  }
92
106
 
93
107
  /**
@@ -95,8 +109,12 @@ class ProseViewImpl implements ProseView {
95
109
  * tie-breaking shorter spans first so a zero-length edit sorts before a
96
110
  * spanning edit at the same start. A pure insertion may therefore coexist
97
111
  * with a replacement starting at the same offset: the insertion's text lands
98
- * before the replaced span's text. Overlapping spans (and two pure
99
- * insertions at the same offset) are rejected.
112
+ * before the replaced span's text. Overlapping spans are rejected, as are two
113
+ * pure insertions at the same offset that share a `bind` — those would land in
114
+ * the same node with no defined order. Two same-offset insertions with
115
+ * opposite `bind` are unambiguous: `bind: "left"` routes to the node ending at
116
+ * the offset and `bind: "right"` to the node starting there, so they occupy
117
+ * different nodes (left-bound sorted first).
100
118
  *
101
119
  * All edits are distributed in a single left-to-right pass that rebuilds
102
120
  * each node's value once — per-edit string surgery would be quadratic on
@@ -104,73 +122,86 @@ class ProseViewImpl implements ProseView {
104
122
  */
105
123
  commit(): void {
106
124
  if (this.edits.length === 0) {
107
- return
125
+ return;
108
126
  }
109
127
 
128
+ const bindRank = (edit: QueuedEdit): number =>
129
+ edit.bind === "left" ? 0 : 1;
110
130
  const sorted = [...this.edits].sort(
111
- (a, b) => a.start - b.start || (a.end - a.start) - (b.end - b.start)
112
- )
131
+ (a, b) =>
132
+ a.start - b.start ||
133
+ a.end - a.start - (b.end - b.start) ||
134
+ bindRank(a) - bindRank(b),
135
+ );
113
136
  for (let i = 1; i < sorted.length; i++) {
114
- const prev = sorted[i - 1]
115
- const curr = sorted[i]
137
+ const prev = sorted[i - 1];
138
+ const curr = sorted[i];
116
139
  if (prev.end > curr.start) {
117
140
  throw new Error(
118
- `Overlapping edits: [${prev.start}, ${prev.end}) and [${curr.start}, ${curr.end}).`
119
- )
141
+ `Overlapping edits: [${prev.start}, ${prev.end}) and [${curr.start}, ${curr.end}).`,
142
+ );
120
143
  }
121
- if (prev.end === curr.start && prev.start === prev.end && curr.start === curr.end) {
144
+ if (
145
+ prev.end === curr.start &&
146
+ prev.start === prev.end &&
147
+ curr.start === curr.end &&
148
+ prev.bind === curr.bind
149
+ ) {
122
150
  throw new Error(
123
- `Two pure insertions at the same offset ${curr.start} are ambiguous; combine them.`
124
- )
151
+ `Two pure insertions at the same offset ${curr.start} with bind "${curr.bind}" are ` +
152
+ `ambiguous; combine them.`,
153
+ );
125
154
  }
126
155
  }
127
156
 
128
157
  // Node spans in `text` via cumulative lengths.
129
- const starts: number[] = []
130
- const ends: number[] = []
131
- let cursor = 0
158
+ const starts: number[] = [];
159
+ const ends: number[] = [];
160
+ let cursor = 0;
132
161
  for (const node of this.nodes) {
133
- starts.push(cursor)
134
- cursor += node.value.length
135
- ends.push(cursor)
162
+ starts.push(cursor);
163
+ cursor += node.value.length;
164
+ ends.push(cursor);
136
165
  }
137
166
 
138
- const text = this.cachedText
139
- const parts: string[][] = this.nodes.map(() => [])
167
+ const text = this.cachedText;
168
+ const parts: string[][] = this.nodes.map(() => []);
140
169
 
141
170
  // Rolling copy state: kept text in [0, copiedUpTo) has been distributed.
142
- let copiedUpTo = 0
143
- let copyNode = 0
171
+ let copiedUpTo = 0;
172
+ let copyNode = 0;
144
173
  const copyUpTo = (target: number): void => {
145
174
  while (copiedUpTo < target) {
146
- while (copyNode < this.nodes.length - 1 && ends[copyNode] <= copiedUpTo) copyNode++
147
- const sliceEnd = Math.min(target, ends[copyNode])
148
- parts[copyNode].push(text.slice(copiedUpTo, sliceEnd))
149
- copiedUpTo = sliceEnd
175
+ while (copyNode < this.nodes.length - 1 && ends[copyNode] <= copiedUpTo)
176
+ copyNode++;
177
+ const sliceEnd = Math.min(target, ends[copyNode]);
178
+ parts[copyNode].push(text.slice(copiedUpTo, sliceEnd));
179
+ copiedUpTo = sliceEnd;
150
180
  }
151
- }
181
+ };
152
182
 
153
183
  for (const edit of sorted) {
154
- copyUpTo(edit.start)
184
+ copyUpTo(edit.start);
155
185
  // Deleted spans are simply never copied; replacement/insertion text
156
186
  // lands in the target node, whose parts are filled exactly up to
157
187
  // `edit.start` at this point.
158
188
  if (edit.text.length > 0) {
159
- const targetIndex = edit.end > edit.start
160
- ? this.nodeContainingChar(edit.start, ends)
161
- : this.targetNodeForInsertion(edit, ends)
162
- parts[targetIndex].push(edit.text)
189
+ const targetIndex =
190
+ edit.end > edit.start
191
+ ? this.nodeContainingChar(edit.start, ends)
192
+ : this.targetNodeForInsertion(edit, ends);
193
+ parts[targetIndex].push(edit.text);
163
194
  }
164
- if (edit.end > copiedUpTo) copiedUpTo = edit.end
195
+ if (edit.end > copiedUpTo) copiedUpTo = edit.end;
165
196
  }
166
- copyUpTo(text.length)
197
+ copyUpTo(text.length);
167
198
 
168
199
  this.nodes.forEach((node, index) => {
169
- node.value = parts[index].join("")
170
- })
200
+ node.value = parts[index].join("");
201
+ });
171
202
 
172
- this.edits = []
173
- this.refresh()
203
+ this.edits = [];
204
+ this.refresh();
174
205
  }
175
206
 
176
207
  /**
@@ -179,31 +210,31 @@ class ProseViewImpl implements ProseView {
179
210
  * the offset are skipped, matching a first-containing-span linear scan).
180
211
  */
181
212
  private nodeContainingChar(offset: number, ends: number[]): number {
182
- let low = 0
183
- let high = ends.length - 1
213
+ let low = 0;
214
+ let high = ends.length - 1;
184
215
  while (low < high) {
185
- const mid = (low + high) >>> 1
216
+ const mid = (low + high) >>> 1;
186
217
  if (ends[mid] <= offset) {
187
- low = mid + 1
218
+ low = mid + 1;
188
219
  } else {
189
- high = mid
220
+ high = mid;
190
221
  }
191
222
  }
192
- return low
223
+ return low;
193
224
  }
194
225
 
195
226
  private targetNodeForInsertion(edit: QueuedEdit, ends: number[]): number {
196
227
  if (edit.bind === "left") {
197
- if (edit.start === 0) return 0
198
- return this.nodeContainingChar(edit.start - 1, ends)
228
+ if (edit.start === 0) return 0;
229
+ return this.nodeContainingChar(edit.start - 1, ends);
199
230
  }
200
- if (edit.start === this.cachedText.length) return this.nodes.length - 1
201
- return this.nodeContainingChar(edit.start, ends)
231
+ if (edit.start === this.cachedText.length) return this.nodes.length - 1;
232
+ return this.nodeContainingChar(edit.start, ends);
202
233
  }
203
234
  }
204
235
 
205
236
  export function buildProseView(nodes: ProseNode[]): ProseView {
206
- return new ProseViewImpl(nodes)
237
+ return new ProseViewImpl(nodes);
207
238
  }
208
239
 
209
240
  /**
@@ -212,27 +243,30 @@ export function buildProseView(nodes: ProseNode[]): ProseView {
212
243
  * group; an empty list yields no groups. Used to isolate opaque-delimited
213
244
  * segments so a pass never sees text as adjacent across removed content.
214
245
  */
215
- export function splitAtIndices<T>(items: readonly T[], breakBefore: ReadonlySet<number>): T[][] {
246
+ export function splitAtIndices<T>(
247
+ items: readonly T[],
248
+ breakBefore: ReadonlySet<number>,
249
+ ): T[][] {
216
250
  if (breakBefore.size === 0) {
217
- return items.length > 0 ? [items.slice()] : []
251
+ return items.length > 0 ? [items.slice()] : [];
218
252
  }
219
- const groups: T[][] = []
220
- let start = 0
253
+ const groups: T[][] = [];
254
+ let start = 0;
221
255
  for (let i = 1; i < items.length; i++) {
222
256
  if (breakBefore.has(i)) {
223
- groups.push(items.slice(start, i))
224
- start = i
257
+ groups.push(items.slice(start, i));
258
+ start = i;
225
259
  }
226
260
  }
227
- groups.push(items.slice(start))
228
- return groups
261
+ groups.push(items.slice(start));
262
+ return groups;
229
263
  }
230
264
 
231
265
  export interface ReplaceAllOptions {
232
266
  /** Opt-in: allow a match that contains an interior node boundary. Default: such matches are skipped. */
233
- allowBoundaries?: (match: RegExpExecArray, view: ProseView) => boolean
267
+ allowBoundaries?: (match: RegExpExecArray, view: ProseView) => boolean;
234
268
  /** For pure-insertion edits produced by the replacer (rare), bind side. */
235
- bind?: "left" | "right"
269
+ bind?: "left" | "right";
236
270
  }
237
271
 
238
272
  /**
@@ -241,33 +275,44 @@ export interface ReplaceAllOptions {
241
275
  * linear scan here would make inline-element-heavy views O(text × nodes).
242
276
  */
243
277
  function lowerBound(values: readonly number[], target: number): number {
244
- let low = 0
245
- let high = values.length
278
+ let low = 0;
279
+ let high = values.length;
246
280
  while (low < high) {
247
- const mid = (low + high) >>> 1
248
- if (values[mid] < target) low = mid + 1
249
- else high = mid
281
+ const mid = (low + high) >>> 1;
282
+ if (values[mid] < target) low = mid + 1;
283
+ else high = mid;
250
284
  }
251
- return low
285
+ return low;
252
286
  }
253
287
 
254
288
  /** True iff some interior boundary falls strictly inside the match span. */
255
- function matchContainsBoundary(match: RegExpExecArray, view: ProseView): boolean {
256
- return firstInteriorBoundary(view, match.index, match.index + match[0].length) >= 0
289
+ function matchContainsBoundary(
290
+ match: RegExpExecArray,
291
+ view: ProseView,
292
+ ): boolean {
293
+ return (
294
+ firstInteriorBoundary(view, match.index, match.index + match[0].length) >= 0
295
+ );
257
296
  }
258
297
 
259
298
  /** Smallest node boundary strictly inside (start, end), or -1 when none. */
260
- export function firstInteriorBoundary(view: ProseView, start: number, end: number): number {
261
- const boundaries = view.boundaries
262
- const first = lowerBound(boundaries, start + 1)
263
- return first < boundaries.length && boundaries[first] < end ? boundaries[first] : -1
299
+ export function firstInteriorBoundary(
300
+ view: ProseView,
301
+ start: number,
302
+ end: number,
303
+ ): number {
304
+ const boundaries = view.boundaries;
305
+ const first = lowerBound(boundaries, start + 1);
306
+ return first < boundaries.length && boundaries[first] < end
307
+ ? boundaries[first]
308
+ : -1;
264
309
  }
265
310
 
266
311
  /** Largest node boundary strictly less than `offset`, or -1 when none. O(log n). */
267
312
  export function lastBoundaryBefore(view: ProseView, offset: number): number {
268
- const boundaries = view.boundaries
269
- const first = lowerBound(boundaries, offset)
270
- return first > 0 ? boundaries[first - 1] : -1
313
+ const boundaries = view.boundaries;
314
+ const first = lowerBound(boundaries, offset);
315
+ return first > 0 ? boundaries[first - 1] : -1;
271
316
  }
272
317
 
273
318
  /**
@@ -282,23 +327,27 @@ export function interiorBoundariesWithin(
282
327
  end: number,
283
328
  allowedSlots: readonly number[],
284
329
  ): boolean {
285
- const boundaries = view.boundaries
286
- for (let i = lowerBound(boundaries, start + 1); i < boundaries.length && boundaries[i] < end; i++) {
287
- if (!allowedSlots.includes(boundaries[i])) return false
330
+ const boundaries = view.boundaries;
331
+ for (
332
+ let i = lowerBound(boundaries, start + 1);
333
+ i < boundaries.length && boundaries[i] < end;
334
+ i++
335
+ ) {
336
+ if (!allowedSlots.includes(boundaries[i])) return false;
288
337
  }
289
- return true
338
+ return true;
290
339
  }
291
340
 
292
341
  /** Count of node boundaries that fall at exactly `offset` (empty nodes stack). */
293
342
  export function boundaryCountAt(view: ProseView, offset: number): number {
294
- const boundaries = view.boundaries
295
- let i = lowerBound(boundaries, offset)
296
- let count = 0
343
+ const boundaries = view.boundaries;
344
+ let i = lowerBound(boundaries, offset);
345
+ let count = 0;
297
346
  while (i < boundaries.length && boundaries[i] === offset) {
298
- count++
299
- i++
347
+ count++;
348
+ i++;
300
349
  }
301
- return count
350
+ return count;
302
351
  }
303
352
 
304
353
  /**
@@ -306,8 +355,11 @@ export function boundaryCountAt(view: ProseView, offset: number): number {
306
355
  * position exceeds the single-boundary tolerance the passes allow in an
307
356
  * editing slot.
308
357
  */
309
- export function exceedsSingleBoundary(view: ProseView, offset: number): boolean {
310
- return boundaryCountAt(view, offset) > 1
358
+ export function exceedsSingleBoundary(
359
+ view: ProseView,
360
+ offset: number,
361
+ ): boolean {
362
+ return boundaryCountAt(view, offset) > 1;
311
363
  }
312
364
 
313
365
  export function replaceAllInView(
@@ -317,30 +369,37 @@ export function replaceAllInView(
317
369
  options?: ReplaceAllOptions,
318
370
  ): void {
319
371
  if (!regex.global) {
320
- throw new Error("replaceAllInView() requires a regex with the global (g) flag.")
372
+ throw new Error(
373
+ "replaceAllInView() requires a regex with the global (g) flag.",
374
+ );
321
375
  }
322
376
 
323
- const allowBoundaries = options?.allowBoundaries
324
- const bind = options?.bind
325
- const text = view.text
326
- regex.lastIndex = 0
377
+ const allowBoundaries = options?.allowBoundaries;
378
+ const bind = options?.bind;
379
+ const text = view.text;
380
+ regex.lastIndex = 0;
327
381
 
328
- let match: RegExpExecArray | null
382
+ let match: RegExpExecArray | null;
329
383
  while ((match = regex.exec(text)) !== null) {
330
384
  if (match[0].length === 0) {
331
- regex.lastIndex += 1
385
+ regex.lastIndex += 1;
332
386
  }
333
387
 
334
388
  if (matchContainsBoundary(match, view) && !allowBoundaries?.(match, view)) {
335
- continue
389
+ continue;
336
390
  }
337
391
 
338
- const replacement = replacer(match, view)
392
+ const replacement = replacer(match, view);
339
393
  if (replacement === null) {
340
- continue
394
+ continue;
341
395
  }
342
396
 
343
- view.replace(match.index, match.index + match[0].length, replacement, bind ? { bind } : undefined)
397
+ view.replace(
398
+ match.index,
399
+ match.index + match[0].length,
400
+ replacement,
401
+ bind ? { bind } : undefined,
402
+ );
344
403
  }
345
404
  }
346
405
 
@@ -348,12 +407,15 @@ export function replaceAllInView(
348
407
  * String↔view bridge: builds a single-node ProseView over `text`, runs `run`
349
408
  * against it, commits any queued edits, and returns the resulting text.
350
409
  */
351
- export function withProseView(text: string, run: (view: ProseView) => void): string {
352
- const node: ProseNode = { value: text }
353
- const view = buildProseView([node])
354
- run(view)
355
- view.commit()
356
- return node.value
410
+ export function withProseView(
411
+ text: string,
412
+ run: (view: ProseView) => void,
413
+ ): string {
414
+ const node: ProseNode = { value: text };
415
+ const view = buildProseView([node]);
416
+ run(view);
417
+ view.commit();
418
+ return node.value;
357
419
  }
358
420
 
359
421
  /**
@@ -362,9 +424,9 @@ export function withProseView(text: string, run: (view: ProseView) => void): str
362
424
  * edits committed onto it in place.
363
425
  */
364
426
  export type ProsePass = {
365
- (input: string): string
366
- (input: ProseView): void
367
- }
427
+ (input: string): string;
428
+ (input: ProseView): void;
429
+ };
368
430
 
369
431
  export interface DefinePassOptions {
370
432
  /**
@@ -377,64 +439,78 @@ export interface DefinePassOptions {
377
439
  * - predicate: forwarded as `allowBoundaries` to {@link replaceAllInView};
378
440
  * return `true` to allow that particular boundary-spanning match.
379
441
  */
380
- boundaries?: "skip" | "allow" | ((match: RegExpExecArray, view: ProseView) => boolean)
442
+ boundaries?:
443
+ | "skip"
444
+ | "allow"
445
+ | ((match: RegExpExecArray, view: ProseView) => boolean);
381
446
  }
382
447
 
383
448
  type ReplacementPart =
384
449
  | { kind: "literal"; text: string }
385
450
  | { kind: "whole" }
386
- | { kind: "indexed"; index: number; fallback?: { index: number; literal: string } }
387
- | { kind: "named"; name: string }
451
+ | {
452
+ kind: "indexed";
453
+ index: number;
454
+ fallback?: { index: number; literal: string };
455
+ }
456
+ | { kind: "named"; name: string };
388
457
 
389
458
  function isAsciiDigit(char: string | undefined): char is string {
390
- return char !== undefined && char >= "0" && char <= "9"
459
+ return char !== undefined && char >= "0" && char <= "9";
391
460
  }
392
461
 
393
462
  /** Parses the `$`-token starting at `dollarIndex`; returns the part and the offset past it. */
394
- function parseDollarToken(template: string, dollarIndex: number): { part: ReplacementPart; next: number } {
463
+ function parseDollarToken(
464
+ template: string,
465
+ dollarIndex: number,
466
+ ): { part: ReplacementPart; next: number } {
395
467
  const unsupported = (): Error =>
396
468
  new Error(
397
469
  `Unsupported "$" form in replacement template ${JSON.stringify(template)}; ` +
398
- `supported forms are $$, $&, $1-$99, and $<name>.`
399
- )
470
+ `supported forms are $$, $&, $1-$99, and $<name>.`,
471
+ );
400
472
 
401
- const next = template[dollarIndex + 1]
473
+ const next = template[dollarIndex + 1];
402
474
  if (next === "$") {
403
- return { part: { kind: "literal", text: "$" }, next: dollarIndex + 2 }
475
+ return { part: { kind: "literal", text: "$" }, next: dollarIndex + 2 };
404
476
  }
405
477
  if (next === "&") {
406
- return { part: { kind: "whole" }, next: dollarIndex + 2 }
478
+ return { part: { kind: "whole" }, next: dollarIndex + 2 };
407
479
  }
408
480
  if (isAsciiDigit(next)) {
409
481
  const digits = isAsciiDigit(template[dollarIndex + 2])
410
482
  ? next + template[dollarIndex + 2]
411
- : next
412
- const index = parseInt(digits, 10)
483
+ : next;
484
+ const index = parseInt(digits, 10);
413
485
  // `$12` means group 12 when it exists, otherwise group 1 followed by a
414
486
  // literal "2" — matching String.replace. `$0`/`$00` reference nothing.
415
- const fallbackIndex = parseInt(digits[0], 10)
416
- const fallback = digits.length === 2 && fallbackIndex > 0
417
- ? { index: fallbackIndex, literal: digits[1] }
418
- : undefined
487
+ const fallbackIndex = parseInt(digits[0], 10);
488
+ const fallback =
489
+ digits.length === 2 && fallbackIndex > 0
490
+ ? { index: fallbackIndex, literal: digits[1] }
491
+ : undefined;
419
492
  if (index === 0 && fallback === undefined) {
420
493
  throw new Error(
421
494
  `Unsupported group reference $${digits} in replacement template ` +
422
- `${JSON.stringify(template)}; numbered groups start at $1.`
423
- )
495
+ `${JSON.stringify(template)}; numbered groups start at $1.`,
496
+ );
424
497
  }
425
- return { part: { kind: "indexed", index, fallback }, next: dollarIndex + 1 + digits.length }
498
+ return {
499
+ part: { kind: "indexed", index, fallback },
500
+ next: dollarIndex + 1 + digits.length,
501
+ };
426
502
  }
427
503
  if (next === "<") {
428
- const close = template.indexOf(">", dollarIndex + 2)
504
+ const close = template.indexOf(">", dollarIndex + 2);
429
505
  if (close === -1 || close === dollarIndex + 2) {
430
- throw unsupported()
506
+ throw unsupported();
431
507
  }
432
508
  return {
433
509
  part: { kind: "named", name: template.slice(dollarIndex + 2, close) },
434
510
  next: close + 1,
435
- }
511
+ };
436
512
  }
437
- throw unsupported()
513
+ throw unsupported();
438
514
  }
439
515
 
440
516
  /**
@@ -444,29 +520,29 @@ function parseDollarToken(template: string, dollarIndex: number): { part: Replac
444
520
  * `$'`, a bare or malformed `$`) throws rather than silently substituting.
445
521
  */
446
522
  function parseReplacementTemplate(template: string): ReplacementPart[] {
447
- const parts: ReplacementPart[] = []
448
- let literalStart = 0
449
- let i = 0
523
+ const parts: ReplacementPart[] = [];
524
+ let literalStart = 0;
525
+ let i = 0;
450
526
 
451
527
  while (i < template.length) {
452
528
  if (template[i] !== "$") {
453
- i++
454
- continue
529
+ i++;
530
+ continue;
455
531
  }
456
532
  if (i > literalStart) {
457
- parts.push({ kind: "literal", text: template.slice(literalStart, i) })
533
+ parts.push({ kind: "literal", text: template.slice(literalStart, i) });
458
534
  }
459
- const { part, next } = parseDollarToken(template, i)
460
- parts.push(part)
461
- i = next
462
- literalStart = next
535
+ const { part, next } = parseDollarToken(template, i);
536
+ parts.push(part);
537
+ i = next;
538
+ literalStart = next;
463
539
  }
464
540
 
465
541
  if (template.length > literalStart) {
466
- parts.push({ kind: "literal", text: template.slice(literalStart) })
542
+ parts.push({ kind: "literal", text: template.slice(literalStart) });
467
543
  }
468
544
 
469
- return parts
545
+ return parts;
470
546
  }
471
547
 
472
548
  /** Renders a numbered group reference, applying the `$12` → `$1` + "2" fallback. */
@@ -475,15 +551,15 @@ function renderIndexedPart(
475
551
  match: RegExpExecArray,
476
552
  ): string {
477
553
  if (part.index < match.length) {
478
- return match[part.index] ?? ""
554
+ return match[part.index] ?? "";
479
555
  }
480
556
  if (part.fallback && part.fallback.index < match.length) {
481
- return (match[part.fallback.index] ?? "") + part.fallback.literal
557
+ return (match[part.fallback.index] ?? "") + part.fallback.literal;
482
558
  }
483
559
  throw new Error(
484
560
  `Replacement references group $${part.index} but the pattern only has ` +
485
- `${match.length - 1} capture group(s).`
486
- )
561
+ `${match.length - 1} capture group(s).`,
562
+ );
487
563
  }
488
564
 
489
565
  /**
@@ -492,31 +568,33 @@ function renderIndexedPart(
492
568
  * throws, while a defined group that simply did not participate in the match
493
569
  * substitutes the empty string (as with String.replace).
494
570
  */
495
- function compileReplacementTemplate(template: string): (match: RegExpExecArray) => string {
496
- const parts = parseReplacementTemplate(template)
571
+ function compileReplacementTemplate(
572
+ template: string,
573
+ ): (match: RegExpExecArray) => string {
574
+ const parts = parseReplacementTemplate(template);
497
575
  return (match) =>
498
576
  parts
499
577
  .map((part) => {
500
578
  switch (part.kind) {
501
579
  case "literal":
502
- return part.text
580
+ return part.text;
503
581
  case "whole":
504
- return match[0]
582
+ return match[0];
505
583
  case "indexed":
506
- return renderIndexedPart(part, match)
584
+ return renderIndexedPart(part, match);
507
585
  case "named": {
508
- const groups = match.groups
586
+ const groups = match.groups;
509
587
  if (!groups || !(part.name in groups)) {
510
588
  throw new Error(
511
589
  `Replacement references group $<${part.name}> but the pattern ` +
512
- `has no capture group named "${part.name}".`
513
- )
590
+ `has no capture group named "${part.name}".`,
591
+ );
514
592
  }
515
- return groups[part.name] ?? ""
593
+ return groups[part.name] ?? "";
516
594
  }
517
595
  }
518
596
  })
519
- .join("")
597
+ .join("");
520
598
  }
521
599
 
522
600
  /**
@@ -535,38 +613,48 @@ function compileReplacementTemplate(template: string): (match: RegExpExecArray)
535
613
  */
536
614
  export function definePass(
537
615
  pattern: RegExp,
538
- replacement: string | ((match: RegExpExecArray, view: ProseView) => string | null),
616
+ replacement:
617
+ | string
618
+ | ((match: RegExpExecArray, view: ProseView) => string | null),
539
619
  options: DefinePassOptions = {},
540
620
  ): ProsePass {
541
621
  if (!pattern.global) {
542
- throw new Error("definePass() requires a pattern with the global (g) flag.")
622
+ throw new Error(
623
+ "definePass() requires a pattern with the global (g) flag.",
624
+ );
543
625
  }
544
626
 
545
- const boundaries = options.boundaries ?? "skip"
546
- let allowBoundaries: ReplaceAllOptions["allowBoundaries"]
627
+ const boundaries = options.boundaries ?? "skip";
628
+ let allowBoundaries: ReplaceAllOptions["allowBoundaries"];
547
629
  if (boundaries === "allow") {
548
- allowBoundaries = () => true
630
+ allowBoundaries = () => true;
549
631
  } else if (typeof boundaries === "function") {
550
- allowBoundaries = boundaries
632
+ allowBoundaries = boundaries;
551
633
  } else if (boundaries !== "skip") {
552
634
  throw new Error(
553
635
  `Invalid boundaries option: ${JSON.stringify(boundaries)}. ` +
554
- `Must be "skip", "allow", or a predicate.`
555
- )
636
+ `Must be "skip", "allow", or a predicate.`,
637
+ );
556
638
  }
557
639
 
558
- const replacer = typeof replacement === "string"
559
- ? compileReplacementTemplate(replacement)
560
- : replacement
640
+ const replacer =
641
+ typeof replacement === "string"
642
+ ? compileReplacementTemplate(replacement)
643
+ : replacement;
561
644
 
562
- function pass(input: string): string
563
- function pass(input: ProseView): void
645
+ function pass(input: string): string;
646
+ function pass(input: ProseView): void;
564
647
  function pass(input: string | ProseView): string | void {
565
648
  return overInput(input, (view) => {
566
- replaceAllInView(view, pattern, replacer, allowBoundaries ? { allowBoundaries } : undefined)
567
- })
649
+ replaceAllInView(
650
+ view,
651
+ pattern,
652
+ replacer,
653
+ allowBoundaries ? { allowBoundaries } : undefined,
654
+ );
655
+ });
568
656
  }
569
- return pass
657
+ return pass;
570
658
  }
571
659
 
572
660
  /**
@@ -574,15 +662,27 @@ export function definePass(
574
662
  * single-node view and returns the transformed string; a ProseView has the
575
663
  * pass's edits queued and committed onto it in place (returns nothing).
576
664
  */
577
- export function overInput(input: string, run: (view: ProseView) => void): string
578
- export function overInput(input: ProseView, run: (view: ProseView) => void): void
579
- export function overInput(input: string | ProseView, run: (view: ProseView) => void): string | void
580
- export function overInput(input: string | ProseView, run: (view: ProseView) => void): string | void {
665
+ export function overInput(
666
+ input: string,
667
+ run: (view: ProseView) => void,
668
+ ): string;
669
+ export function overInput(
670
+ input: ProseView,
671
+ run: (view: ProseView) => void,
672
+ ): void;
673
+ export function overInput(
674
+ input: string | ProseView,
675
+ run: (view: ProseView) => void,
676
+ ): string | void;
677
+ export function overInput(
678
+ input: string | ProseView,
679
+ run: (view: ProseView) => void,
680
+ ): string | void {
581
681
  if (typeof input === "string") {
582
- return withProseView(input, run)
682
+ return withProseView(input, run);
583
683
  }
584
- run(input)
585
- input.commit()
684
+ run(input);
685
+ input.commit();
586
686
  }
587
687
 
588
688
  /**
@@ -592,10 +692,10 @@ export function overInput(input: string | ProseView, run: (view: ProseView) => v
592
692
  * otherwise repeat.
593
693
  */
594
694
  export function makeProsePass(run: (view: ProseView) => void): ProsePass {
595
- function pass(input: string): string
596
- function pass(input: ProseView): void
695
+ function pass(input: string): string;
696
+ function pass(input: ProseView): void;
597
697
  function pass(input: string | ProseView): string | void {
598
- return overInput(input, run)
698
+ return overInput(input, run);
599
699
  }
600
- return pass
700
+ return pass;
601
701
  }