polytypo 1.6.0 → 1.6.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/dist/{chunk-GDZCWLM3.cjs → chunk-DKUR763G.cjs} +16 -16
- package/dist/{chunk-GDZCWLM3.cjs.map → chunk-DKUR763G.cjs.map} +1 -1
- package/dist/{chunk-ZHF6GNJ4.js → chunk-FICUT4OU.js} +2 -2
- package/dist/{chunk-TDIDDBNH.js → chunk-IN32R4AX.js} +4 -4
- package/dist/{chunk-242RX2X7.js → chunk-LDXWXCGL.js} +2 -2
- package/dist/{chunk-V3EGRWOR.cjs → chunk-M4PJNXRU.cjs} +13 -13
- package/dist/{chunk-V3EGRWOR.cjs.map → chunk-M4PJNXRU.cjs.map} +1 -1
- package/dist/chunk-MDESZMU2.cjs +33 -0
- package/dist/{chunk-3HRK4WOC.cjs.map → chunk-MDESZMU2.cjs.map} +1 -1
- package/dist/{chunk-A4CH2EQC.cjs → chunk-P6IBHZL6.cjs} +3 -3
- package/dist/{chunk-A4CH2EQC.cjs.map → chunk-P6IBHZL6.cjs.map} +1 -1
- package/dist/{chunk-JWODP74P.cjs → chunk-PGHLZCGV.cjs} +17 -17
- package/dist/{chunk-JWODP74P.cjs.map → chunk-PGHLZCGV.cjs.map} +1 -1
- package/dist/{chunk-IMWES4GY.js → chunk-URE2U73R.js} +3 -3
- package/dist/{chunk-P47H3TPN.cjs → chunk-V6SSSZLP.cjs} +4 -4
- package/dist/{chunk-P47H3TPN.cjs.map → chunk-V6SSSZLP.cjs.map} +1 -1
- package/dist/{chunk-2OERMYTV.js → chunk-VBZAV63L.js} +2 -2
- package/dist/{chunk-GAIX76FT.cjs → chunk-VCD45VZH.cjs} +1 -1
- package/dist/{chunk-GAIX76FT.cjs.map → chunk-VCD45VZH.cjs.map} +1 -1
- package/dist/chunk-VSONV4W4.cjs +31 -0
- package/dist/{chunk-3JF6P2GI.cjs.map → chunk-VSONV4W4.cjs.map} +1 -1
- package/dist/{chunk-C2KW4GOY.js → chunk-VST7L77N.js} +2 -2
- package/dist/{chunk-MOAEMPFT.js → chunk-W77K6K6G.js} +1 -1
- package/dist/{chunk-MOAEMPFT.js.map → chunk-W77K6K6G.js.map} +1 -1
- package/dist/{chunk-CVYDGAIH.js → chunk-YD5JMNLT.js} +4 -4
- package/dist/html.cjs +10 -10
- package/dist/html.js +5 -5
- package/dist/index.cjs +17 -17
- package/dist/index.js +7 -7
- package/dist/markdown.cjs +10 -10
- package/dist/markdown.js +5 -5
- package/dist/text.cjs +8 -8
- package/dist/text.js +3 -3
- package/dist/yaml.cjs +9 -9
- package/dist/yaml.js +4 -4
- package/package.json +1 -1
- package/dist/chunk-3HRK4WOC.cjs +0 -33
- package/dist/chunk-3JF6P2GI.cjs +0 -31
- /package/dist/{chunk-ZHF6GNJ4.js.map → chunk-FICUT4OU.js.map} +0 -0
- /package/dist/{chunk-TDIDDBNH.js.map → chunk-IN32R4AX.js.map} +0 -0
- /package/dist/{chunk-242RX2X7.js.map → chunk-LDXWXCGL.js.map} +0 -0
- /package/dist/{chunk-IMWES4GY.js.map → chunk-URE2U73R.js.map} +0 -0
- /package/dist/{chunk-2OERMYTV.js.map → chunk-VBZAV63L.js.map} +0 -0
- /package/dist/{chunk-C2KW4GOY.js.map → chunk-VST7L77N.js.map} +0 -0
- /package/dist/{chunk-CVYDGAIH.js.map → chunk-YD5JMNLT.js.map} +0 -0
|
@@ -9,7 +9,7 @@
|
|
|
9
9
|
|
|
10
10
|
|
|
11
11
|
|
|
12
|
-
var
|
|
12
|
+
var _chunkVCD45VZHcjs = require('./chunk-VCD45VZH.cjs');
|
|
13
13
|
|
|
14
14
|
// src/modes/spans.ts
|
|
15
15
|
var SPACE = 32;
|
|
@@ -38,7 +38,7 @@ function normalizeSpans(spans) {
|
|
|
38
38
|
continue;
|
|
39
39
|
}
|
|
40
40
|
if (span.start < last.end) {
|
|
41
|
-
throw new (0,
|
|
41
|
+
throw new (0, _chunkVCD45VZHcjs.PolytypoError)(
|
|
42
42
|
"POLYTYPO_RULE_CONTRACT",
|
|
43
43
|
`mode extractor produced overlapping spans (${last.start}, ${last.end}) and (${span.start}, ${span.end})`
|
|
44
44
|
);
|
|
@@ -56,9 +56,9 @@ function concatenateSpans(source, spans) {
|
|
|
56
56
|
let previous;
|
|
57
57
|
for (const span of spans) {
|
|
58
58
|
if (previous !== void 0) {
|
|
59
|
-
cp.push(gapIsLineBoundary(source, previous.end, span.start) ?
|
|
59
|
+
cp.push(gapIsLineBoundary(source, previous.end, span.start) ? _chunkVCD45VZHcjs.LINE_MARKER : _chunkVCD45VZHcjs.MARKER);
|
|
60
60
|
}
|
|
61
|
-
for (const value of
|
|
61
|
+
for (const value of _chunkVCD45VZHcjs.toCodePoints.call(void 0, source.slice(span.start, span.end))) cp.push(value);
|
|
62
62
|
previous = span;
|
|
63
63
|
}
|
|
64
64
|
return cp;
|
|
@@ -67,7 +67,7 @@ function spanRangesOf(cp) {
|
|
|
67
67
|
const ranges = [];
|
|
68
68
|
let first = 0;
|
|
69
69
|
for (let i = 0; i < cp.length; i += 1) {
|
|
70
|
-
if (
|
|
70
|
+
if (_chunkVCD45VZHcjs.isMarker.call(void 0, cp[i])) {
|
|
71
71
|
ranges.push({ first, last: i - 1 });
|
|
72
72
|
first = i + 1;
|
|
73
73
|
}
|
|
@@ -86,7 +86,7 @@ function filterBoundaryEdits(cp, edits, ranges) {
|
|
|
86
86
|
for (const edit of edits) {
|
|
87
87
|
let containsMarker = false;
|
|
88
88
|
for (let i = edit.start; i < edit.end; i += 1) {
|
|
89
|
-
if (
|
|
89
|
+
if (_chunkVCD45VZHcjs.isMarker.call(void 0, cp[i])) {
|
|
90
90
|
containsMarker = true;
|
|
91
91
|
break;
|
|
92
92
|
}
|
|
@@ -111,14 +111,14 @@ function filterBoundaryEdits(cp, edits, ranges) {
|
|
|
111
111
|
function splitOnMarker(cp, expected) {
|
|
112
112
|
const pieces = [[]];
|
|
113
113
|
for (const value of cp) {
|
|
114
|
-
if (
|
|
114
|
+
if (_chunkVCD45VZHcjs.isMarker.call(void 0, value)) {
|
|
115
115
|
pieces.push([]);
|
|
116
116
|
continue;
|
|
117
117
|
}
|
|
118
118
|
pieces[pieces.length - 1].push(value);
|
|
119
119
|
}
|
|
120
120
|
if (pieces.length !== expected) {
|
|
121
|
-
throw new (0,
|
|
121
|
+
throw new (0, _chunkVCD45VZHcjs.PolytypoError)(
|
|
122
122
|
"POLYTYPO_RULE_CONTRACT",
|
|
123
123
|
`boundary markers did not survive the pipeline: expected ${expected} spans, found ${pieces.length}`
|
|
124
124
|
);
|
|
@@ -140,9 +140,9 @@ function originOfSpans(source, spans) {
|
|
|
140
140
|
const origin = [];
|
|
141
141
|
let previous;
|
|
142
142
|
for (const span of spans) {
|
|
143
|
-
if (previous !== void 0) origin.push(
|
|
143
|
+
if (previous !== void 0) origin.push(_chunkVCD45VZHcjs.NO_ORIGIN);
|
|
144
144
|
const base = codePointIndexOf[span.start];
|
|
145
|
-
const length =
|
|
145
|
+
const length = _chunkVCD45VZHcjs.toCodePoints.call(void 0, source.slice(span.start, span.end)).length;
|
|
146
146
|
for (let k = 0; k < length; k += 1) origin.push(base + k);
|
|
147
147
|
previous = span;
|
|
148
148
|
}
|
|
@@ -153,10 +153,10 @@ function originOfSpans(source, spans) {
|
|
|
153
153
|
function runRulesOverSpans(cp, planned, locale, mode, narrowTarget) {
|
|
154
154
|
let current = cp;
|
|
155
155
|
for (const id of planned) {
|
|
156
|
-
const rule =
|
|
156
|
+
const rule = _chunkVCD45VZHcjs.RULES[id];
|
|
157
157
|
if (rule === void 0) continue;
|
|
158
158
|
const edits = rule.apply({ cp: current, locale, mode, narrowTarget });
|
|
159
|
-
current =
|
|
159
|
+
current = _chunkVCD45VZHcjs.applyEdits.call(void 0, current, filterBoundaryEdits(current, edits, spanRangesOf(current)), id);
|
|
160
160
|
}
|
|
161
161
|
return current;
|
|
162
162
|
}
|
|
@@ -175,7 +175,7 @@ function runOverSpans(source, spans, planned, locale, mode, narrowTarget) {
|
|
|
175
175
|
let cursor = 0;
|
|
176
176
|
for (let i = 0; i < normalized.length; i += 1) {
|
|
177
177
|
const span = normalized[i];
|
|
178
|
-
const replacement =
|
|
178
|
+
const replacement = _chunkVCD45VZHcjs.fromCodePoints.call(void 0, pieces[i]);
|
|
179
179
|
const original = source.slice(span.start, span.end);
|
|
180
180
|
out += source.slice(cursor, span.start);
|
|
181
181
|
out += replacement === original ? original : replacement;
|
|
@@ -186,14 +186,14 @@ function runOverSpans(source, spans, planned, locale, mode, narrowTarget) {
|
|
|
186
186
|
function analyzeOverSpans(source, spans, planned, locale, mode, narrowTarget) {
|
|
187
187
|
const normalized = normalizeSpans(spans);
|
|
188
188
|
if (normalized.length === 0) return [];
|
|
189
|
-
return
|
|
189
|
+
return _chunkVCD45VZHcjs.runRulesRecording.call(void 0,
|
|
190
190
|
concatenateSpans(source, normalized),
|
|
191
191
|
planned,
|
|
192
192
|
locale,
|
|
193
193
|
mode,
|
|
194
194
|
narrowTarget,
|
|
195
195
|
originOfSpans(source, normalized),
|
|
196
|
-
|
|
196
|
+
_chunkVCD45VZHcjs.toCodePoints.call(void 0, source).length,
|
|
197
197
|
(current, edits) => filterBoundaryEdits(current, edits, spanRangesOf(current))
|
|
198
198
|
);
|
|
199
199
|
}
|
|
@@ -202,4 +202,4 @@ function analyzeOverSpans(source, spans, planned, locale, mode, narrowTarget) {
|
|
|
202
202
|
|
|
203
203
|
|
|
204
204
|
exports.runOverSpans = runOverSpans; exports.analyzeOverSpans = analyzeOverSpans;
|
|
205
|
-
//# sourceMappingURL=chunk-
|
|
205
|
+
//# sourceMappingURL=chunk-DKUR763G.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-GDZCWLM3.cjs","../src/modes/spans.ts","../src/engine/span-runner.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AAC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,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACgC,IAAA;AACX,IAAA;AACwD,EAAA;AAEjF;AF4FA;AACA;AACA;AACA;AACA","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-GDZCWLM3.cjs","sourcesContent":[null,"import { toCodePoints } from \"../engine/codepoints.js\";\nimport { isMarker, LINE_MARKER, MARKER } from \"../engine/sentinels.js\";\nimport { PolytypoError } from \"../errors.js\";\nimport type { Edit } from \"../types.js\";\nimport { NO_ORIGIN } from \"../engine/origin.js\";\n\n/**\n * The boundary markers are defined in the engine (src/engine/sentinels.ts), which is where all\n * three non-code-point sentinels live and where their disjointness is maintained. They are\n * re-exported here because the mode layer is what writes them into the array.\n *\n * Which marker separates two spans is decided by the **raw source bytes of the gap between\n * them**, so it is decidable without asking the parser anything and is identical in five\n * runtimes: a gap containing a line terminator gives `LINE_MARKER`, anything else `MARKER`.\n */\nexport { LINE_MARKER, MARKER, isMarker } from \"../engine/sentinels.js\";\n\n/** `BREAK` as the rules define it (`spaces.md` 3.1), tested against the gap's raw source. */\n/** U+0020, the one emitted code point whose meaning is positional (modes.md 3.4, 5 item 2). */\nconst SPACE = 0x20;\n\nconst LINE_TERMINATORS: ReadonlySet<number> = new Set([\n 0x0a, 0x0d, 0x0b, 0x0c, 0x85, 0x2028, 0x2029,\n]);\n\nfunction gapIsLineBoundary(source: string, from: number, to: number): boolean {\n for (let i = from; i < to; i += 1) {\n if (LINE_TERMINATORS.has(source.charCodeAt(i))) return true;\n }\n return false;\n}\n\n/**\n * A processable span, identified by its offsets in the **original source**. Offsets are UTF-16\n * indices into the JS source string, which is what every JS parser reports; they are an\n * implementation detail of this runtime and never reach the rules, which index code points.\n */\nexport interface Span {\n readonly start: number;\n readonly end: number;\n}\n\n/** A span's extent in the concatenated code-point array: `s₀` and `s₁` of modes.md 3.4. */\nexport interface SpanRange {\n readonly first: number;\n readonly last: number;\n}\n\n/**\n * Sort, drop empties, and coalesce spans separated by nothing in the source (modes.md 7.5:\n * a parser that reports one text run as two adjacent nodes must not manufacture a boundary).\n * Overlapping spans are an extractor bug and are rejected rather than silently merged.\n */\nexport function normalizeSpans(spans: readonly Span[]): Span[] {\n const sorted = spans.filter((s) => s.end > s.start).sort((a, b) => a.start - b.start);\n const out: Span[] = [];\n for (const span of sorted) {\n const last = out[out.length - 1];\n if (last === undefined) {\n out.push(span);\n continue;\n }\n if (span.start < last.end) {\n throw new PolytypoError(\n \"POLYTYPO_RULE_CONTRACT\",\n `mode extractor produced overlapping spans (${last.start}, ${last.end}) and (${span.start}, ${span.end})`,\n );\n }\n if (span.start === last.end) {\n out[out.length - 1] = { start: last.start, end: span.end };\n continue;\n }\n out.push(span);\n }\n return out;\n}\n\n/** `S₁ ⌢ [marker] ⌢ S₂ ⌢ … ⌢ Sₘ` (modes.md 3.5 step 2). */\nexport function concatenateSpans(source: string, spans: readonly Span[]): number[] {\n const cp: number[] = [];\n let previous: Span | undefined;\n for (const span of spans) {\n if (previous !== undefined) {\n cp.push(gapIsLineBoundary(source, previous.end, span.start) ? LINE_MARKER : MARKER);\n }\n for (const value of toCodePoints(source.slice(span.start, span.end))) cp.push(value);\n previous = span;\n }\n return cp;\n}\n\n/**\n * The span extents of the array as it stands. Recomputed after every rule, because applying\n * edits shifts every index after the first one — the markers themselves are guaranteed to\n * survive, since no edit may contain one.\n */\nexport function spanRangesOf(cp: readonly number[]): SpanRange[] {\n const ranges: SpanRange[] = [];\n let first = 0;\n for (let i = 0; i < cp.length; i += 1) {\n if (isMarker(cp[i] as number)) {\n ranges.push({ first, last: i - 1 });\n first = i + 1;\n }\n }\n ranges.push({ first, last: cp.length - 1 });\n return ranges;\n}\n\nfunction spanContaining(ranges: readonly SpanRange[], p: number): SpanRange | undefined {\n for (const range of ranges) {\n if (p >= range.first && p <= range.last + 1) return range;\n }\n return undefined;\n}\n\n/**\n * modes.md 3.4, two safety nets, both pure functions of `(p, q, r, s₀, s₁)` — so the verdict is\n * identical on every run, which is what makes redistribution deterministic (modes.md 5, point 3).\n *\n * 1. **No edit may contain a marker.** No rule can produce one; one that does is a bug, and the\n * edit is discarded rather than treated as a redistribution question.\n * 2. **The edge-growth rule.** An edit is discarded if it would place code points at an\n * extremity of its span that were not there before: with `d = q - p + 1` the replaced length\n * and `r` the replacement length, discard when `p = s₀ and r > d`, or `q = s₁ and r > d`.\n *\n * The length test is the whole rule and needs no knowledge of Markdown or HTML syntax. It\n * separates exactly the cases that matter: `\"` → `“` at an edge is 1 → 1 and applies; `--` →\n * `␣–␣` at an edge is 2 → 3 and is discarded, while the same edit interior to a span applies;\n * `(c)` → `©` is 3 → 1 and applies, because shrinking is always safe. An insertion has `d = 0`,\n * so it is discarded exactly when its position coincides with a span edge — the rule this one\n * generalises.\n *\n * **Deletion at an edge is not restricted here**, and must not be: `r > d` is false for a\n * deletion, so this filter never sees one. Deletion at an edge is governed by modes.md 3.3's\n * *Edge tests* clause instead — where a rule asks \"am I at the edge of the text I am allowed to\n * modify\" rather than \"what character is here\", the marker behaves as `NONE`. That clause is the\n * one place a rule may treat a span edge as the end of the text, it exists because `spaces` is\n * the only rule that deletes, and 3.3 states the division: **a rule that deletes must treat a\n * span edge as the end of the text; a rule that replaces or inserts must not, and is governed by\n * this filter.** The single test that claims the clause is `spaces.md` 3.2 step 4.\n */\nexport function filterBoundaryEdits(\n cp: readonly number[],\n edits: readonly Edit[],\n ranges: readonly SpanRange[],\n): Edit[] {\n const out: Edit[] = [];\n for (const edit of edits) {\n let containsMarker = false;\n for (let i = edit.start; i < edit.end; i += 1) {\n if (isMarker(cp[i] as number)) {\n containsMarker = true;\n break;\n }\n }\n if (containsMarker) continue;\n\n // `[start, end)` in the engine's half-open form is `cp[p … q]` with p = start, q = end - 1;\n // an insertion is `q = p - 1`, which falls out of the same expression.\n const p = edit.start;\n const q = edit.end - 1;\n const d = edit.end - edit.start;\n const r = edit.replacement.length;\n const span = spanContaining(ranges, p);\n if (span !== undefined && (p === span.first || q === span.last)) {\n if (r > d) continue;\n // The character clause. `r > d` is not the rule, only a formalisation of it that misses\n // `r === d`: `dashes` P3 admits a run of THREE dashes, so `---` -> `␣–␣` is 3 -> 3 and the\n // length test sees nothing while U+0020 lands on both extremities anyway. Testing the\n // character catches it, and only U+0020 needs testing — it is the one code point any rule\n // emits whose meaning comes from its position rather than from itself (modes.md 5 item 2).\n const first = edit.replacement[0];\n const last = edit.replacement[r - 1];\n if (r > 0 && p === span.first && first === SPACE && cp[p] !== SPACE) continue;\n if (r > 0 && q === span.last && last === SPACE && cp[q] !== SPACE) continue;\n }\n\n out.push(edit);\n }\n return out;\n}\n\n/** Redistribute the transformed array back to one piece per span (modes.md 3.5 step 4). */\nexport function splitOnMarker(cp: readonly number[], expected: number): number[][] {\n const pieces: number[][] = [[]];\n for (const value of cp) {\n if (isMarker(value)) {\n pieces.push([]);\n continue;\n }\n (pieces[pieces.length - 1] as number[]).push(value);\n }\n if (pieces.length !== expected) {\n throw new PolytypoError(\n \"POLYTYPO_RULE_CONTRACT\",\n `boundary markers did not survive the pipeline: expected ${expected} spans, found ${pieces.length}`,\n );\n }\n return pieces;\n}\n\n/**\n * The origin map for `concatenateSpans` (analyze.md §2): for every code point of the joined\n * array, the code-point offset of the character it came from IN THE DOCUMENT, and NO_ORIGIN for\n * the markers, which came from nowhere. `Span` bounds are native string indices, so the\n * conversion to code-point offsets happens here and not in the caller — this is the one place\n * that knows both coordinate systems.\n */\nexport function originOfSpans(source: string, spans: readonly Span[]): number[] {\n const codePointIndexOf = new Array<number>(source.length + 1);\n let cpIndex = 0;\n for (let i = 0; i < source.length;) {\n codePointIndexOf[i] = cpIndex;\n const code = source.codePointAt(i) as number;\n const width = code > 0xffff ? 2 : 1;\n if (width === 2) codePointIndexOf[i + 1] = cpIndex;\n i += width;\n cpIndex += 1;\n }\n codePointIndexOf[source.length] = cpIndex;\n\n const origin: number[] = [];\n let previous: Span | undefined;\n for (const span of spans) {\n if (previous !== undefined) origin.push(NO_ORIGIN);\n const base = codePointIndexOf[span.start] as number;\n const length = toCodePoints(source.slice(span.start, span.end)).length;\n for (let k = 0; k < length; k += 1) origin.push(base + k);\n previous = span;\n }\n return origin;\n}\n","import {\n concatenateSpans,\n filterBoundaryEdits,\n normalizeSpans,\n originOfSpans,\n spanRangesOf,\n splitOnMarker,\n type Span,\n} from \"../modes/spans.js\";\nimport { RULES } from \"../rules/registry.js\";\nimport type { LocaleData, Mode, RuleId } from \"../types.js\";\nimport { applyEdits } from \"./edits.js\";\nimport { fromCodePoints, toCodePoints } from \"./codepoints.js\";\nimport type { Change } from \"./origin.js\";\nimport { runRulesRecording } from \"./rule-runner.js\";\n\n/**\n * The same sequence as `runRules` (`./rule-runner.js`), with the two boundary filters of\n * modes.md 3.4 interposed. The span extents are recomputed after every rule, because applying\n * an edit shifts every index after it; the markers themselves always survive, since no edit may\n * contain one.\n */\nfunction runRulesOverSpans(\n cp: readonly number[],\n planned: readonly RuleId[],\n locale: LocaleData,\n mode: Mode,\n narrowTarget: number,\n): readonly number[] {\n let current = cp;\n for (const id of planned) {\n const rule = RULES[id];\n if (rule === undefined) continue;\n const edits = rule.apply({ cp: current, locale, mode, narrowTarget });\n current = applyEdits(current, filterBoundaryEdits(current, edits, spanRangesOf(current)), id);\n }\n return current;\n}\n\n/**\n * modes.md 3.5. The pipeline runs **once**, over the marker-separated concatenation of every\n * processable span — not per span, which would pair quotation marks in isolation, and not over a\n * naive concatenation, which would manufacture adjacencies the document does not have.\n *\n * The output is the input with a set of disjoint substring replacements applied and nothing else\n * (modes.md 4). A span whose content the rules did not change contributes no replacement, so a\n * document needing no changes comes back byte-identical; the parser located the spans and was\n * then discarded, and the document is never serialised.\n */\nexport function runOverSpans(\n source: string,\n spans: readonly Span[],\n planned: readonly RuleId[],\n locale: LocaleData,\n mode: Mode,\n narrowTarget: number,\n): string {\n const normalized = normalizeSpans(spans);\n if (normalized.length === 0) return source;\n\n const transformed = runRulesOverSpans(\n concatenateSpans(source, normalized),\n planned,\n locale,\n mode,\n narrowTarget,\n );\n const pieces = splitOnMarker(transformed, normalized.length);\n\n let out = \"\";\n let cursor = 0;\n for (let i = 0; i < normalized.length; i += 1) {\n const span = normalized[i] as Span;\n const replacement = fromCodePoints(pieces[i] as number[]);\n const original = source.slice(span.start, span.end);\n out += source.slice(cursor, span.start);\n out += replacement === original ? original : replacement;\n cursor = span.end;\n }\n return out + source.slice(cursor);\n}\n\n/**\n * `runOverSpans`, reporting instead of applying (analyze.md §1). The span table supplies the\n * origin map, so every change comes back in DOCUMENT coordinates — analyze.md §6 names a\n * runtime that reports span-local offsets here as the mistake that passes every text-mode test.\n */\nexport function analyzeOverSpans(\n source: string,\n spans: readonly Span[],\n planned: readonly RuleId[],\n locale: LocaleData,\n mode: Mode,\n narrowTarget: number,\n): Change[] {\n const normalized = normalizeSpans(spans);\n if (normalized.length === 0) return [];\n return runRulesRecording(\n concatenateSpans(source, normalized),\n planned,\n locale,\n mode,\n narrowTarget,\n originOfSpans(source, normalized),\n toCodePoints(source).length,\n (current, edits) => filterBoundaryEdits(current, edits, spanRangesOf(current)),\n );\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-DKUR763G.cjs","../src/modes/spans.ts","../src/engine/span-runner.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACMA,IAAM,MAAA,EAAQ,EAAA;AAEd,IAAM,iBAAA,kBAAwC,IAAI,GAAA,CAAI;AAAA,EACpD,EAAA;AAAA,EAAM,EAAA;AAAA,EAAM,EAAA;AAAA,EAAM,EAAA;AAAA,EAAM,GAAA;AAAA,EAAM,IAAA;AAAA,EAAQ;AACxC,CAAC,CAAA;AAED,SAAS,iBAAA,CAAkB,MAAA,EAAgB,IAAA,EAAc,EAAA,EAAqB;AAC5E,EAAA,IAAA,CAAA,IAAS,EAAA,EAAI,IAAA,EAAM,EAAA,EAAI,EAAA,EAAI,EAAA,GAAK,C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I,oCAAA;AAAA,MACR,wBAAA;AAAA,MACA,CAAA,wDAAA,EAA2D,QAAQ,CAAA,cAAA,EAAiB,MAAA,CAAO,MAAM,CAAA;AAAA,IAAA;AACnG,EAAA;AAEF,EAAA;AACF;AASO;AACL,EAAA;AACA,EAAA;AACA,EAAA;AACE,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAAW,EAAA;AAEb,EAAA;AAEA,EAAA;AACA,EAAA;AACA,EAAA;AACE,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAAW,EAAA;AAEb,EAAA;AACF;ADlFA;AACA;AEjIA;AAOE,EAAA;AACA,EAAA;AACE,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAA4F,EAAA;AAE9F,EAAA;AACF;AAYO;AAQL,EAAA;AACA,EAAA;AAEA,EAAA;AAAoB,IAAA;AACiB,IAAA;AACnC,IAAA;AACA,IAAA;AACA,IAAA;AACA,EAAA;AAEF,EAAA;AAEA,EAAA;AACA,EAAA;AACA,EAAA;AACE,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AAAc,EAAA;AAEhB,EAAA;AACF;AAOO;AAQL,EAAA;AACA,EAAA;AACA,EAAA;AAAO,IAAA;AAC8B,IAAA;AACnC,IAAA;AACA,IAAA;AACA,IAAA;AACA,IAAA;AACgC,IAAA;AACX,IAAA;AACwD,EAAA;AAEjF;AF4FA;AACA;AACA;AACA;AACA","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-DKUR763G.cjs","sourcesContent":[null,"import { toCodePoints } from \"../engine/codepoints.js\";\nimport { isMarker, LINE_MARKER, MARKER } from \"../engine/sentinels.js\";\nimport { PolytypoError } from \"../errors.js\";\nimport type { Edit } from \"../types.js\";\nimport { NO_ORIGIN } from \"../engine/origin.js\";\n\n/**\n * The boundary markers are defined in the engine (src/engine/sentinels.ts), which is where all\n * three non-code-point sentinels live and where their disjointness is maintained. They are\n * re-exported here because the mode layer is what writes them into the array.\n *\n * Which marker separates two spans is decided by the **raw source bytes of the gap between\n * them**, so it is decidable without asking the parser anything and is identical in five\n * runtimes: a gap containing a line terminator gives `LINE_MARKER`, anything else `MARKER`.\n */\nexport { LINE_MARKER, MARKER, isMarker } from \"../engine/sentinels.js\";\n\n/** `BREAK` as the rules define it (`spaces.md` 3.1), tested against the gap's raw source. */\n/** U+0020, the one emitted code point whose meaning is positional (modes.md 3.4, 5 item 2). */\nconst SPACE = 0x20;\n\nconst LINE_TERMINATORS: ReadonlySet<number> = new Set([\n 0x0a, 0x0d, 0x0b, 0x0c, 0x85, 0x2028, 0x2029,\n]);\n\nfunction gapIsLineBoundary(source: string, from: number, to: number): boolean {\n for (let i = from; i < to; i += 1) {\n if (LINE_TERMINATORS.has(source.charCodeAt(i))) return true;\n }\n return false;\n}\n\n/**\n * A processable span, identified by its offsets in the **original source**. Offsets are UTF-16\n * indices into the JS source string, which is what every JS parser reports; they are an\n * implementation detail of this runtime and never reach the rules, which index code points.\n */\nexport interface Span {\n readonly start: number;\n readonly end: number;\n}\n\n/** A span's extent in the concatenated code-point array: `s₀` and `s₁` of modes.md 3.4. */\nexport interface SpanRange {\n readonly first: number;\n readonly last: number;\n}\n\n/**\n * Sort, drop empties, and coalesce spans separated by nothing in the source (modes.md 7.5:\n * a parser that reports one text run as two adjacent nodes must not manufacture a boundary).\n * Overlapping spans are an extractor bug and are rejected rather than silently merged.\n */\nexport function normalizeSpans(spans: readonly Span[]): Span[] {\n const sorted = spans.filter((s) => s.end > s.start).sort((a, b) => a.start - b.start);\n const out: Span[] = [];\n for (const span of sorted) {\n const last = out[out.length - 1];\n if (last === undefined) {\n out.push(span);\n continue;\n }\n if (span.start < last.end) {\n throw new PolytypoError(\n \"POLYTYPO_RULE_CONTRACT\",\n `mode extractor produced overlapping spans (${last.start}, ${last.end}) and (${span.start}, ${span.end})`,\n );\n }\n if (span.start === last.end) {\n out[out.length - 1] = { start: last.start, end: span.end };\n continue;\n }\n out.push(span);\n }\n return out;\n}\n\n/** `S₁ ⌢ [marker] ⌢ S₂ ⌢ … ⌢ Sₘ` (modes.md 3.5 step 2). */\nexport function concatenateSpans(source: string, spans: readonly Span[]): number[] {\n const cp: number[] = [];\n let previous: Span | undefined;\n for (const span of spans) {\n if (previous !== undefined) {\n cp.push(gapIsLineBoundary(source, previous.end, span.start) ? LINE_MARKER : MARKER);\n }\n for (const value of toCodePoints(source.slice(span.start, span.end))) cp.push(value);\n previous = span;\n }\n return cp;\n}\n\n/**\n * The span extents of the array as it stands. Recomputed after every rule, because applying\n * edits shifts every index after the first one — the markers themselves are guaranteed to\n * survive, since no edit may contain one.\n */\nexport function spanRangesOf(cp: readonly number[]): SpanRange[] {\n const ranges: SpanRange[] = [];\n let first = 0;\n for (let i = 0; i < cp.length; i += 1) {\n if (isMarker(cp[i] as number)) {\n ranges.push({ first, last: i - 1 });\n first = i + 1;\n }\n }\n ranges.push({ first, last: cp.length - 1 });\n return ranges;\n}\n\nfunction spanContaining(ranges: readonly SpanRange[], p: number): SpanRange | undefined {\n for (const range of ranges) {\n if (p >= range.first && p <= range.last + 1) return range;\n }\n return undefined;\n}\n\n/**\n * modes.md 3.4, two safety nets, both pure functions of `(p, q, r, s₀, s₁)` — so the verdict is\n * identical on every run, which is what makes redistribution deterministic (modes.md 5, point 3).\n *\n * 1. **No edit may contain a marker.** No rule can produce one; one that does is a bug, and the\n * edit is discarded rather than treated as a redistribution question.\n * 2. **The edge-growth rule.** An edit is discarded if it would place code points at an\n * extremity of its span that were not there before: with `d = q - p + 1` the replaced length\n * and `r` the replacement length, discard when `p = s₀ and r > d`, or `q = s₁ and r > d`.\n *\n * The length test is the whole rule and needs no knowledge of Markdown or HTML syntax. It\n * separates exactly the cases that matter: `\"` → `“` at an edge is 1 → 1 and applies; `--` →\n * `␣–␣` at an edge is 2 → 3 and is discarded, while the same edit interior to a span applies;\n * `(c)` → `©` is 3 → 1 and applies, because shrinking is always safe. An insertion has `d = 0`,\n * so it is discarded exactly when its position coincides with a span edge — the rule this one\n * generalises.\n *\n * **Deletion at an edge is not restricted here**, and must not be: `r > d` is false for a\n * deletion, so this filter never sees one. Deletion at an edge is governed by modes.md 3.3's\n * *Edge tests* clause instead — where a rule asks \"am I at the edge of the text I am allowed to\n * modify\" rather than \"what character is here\", the marker behaves as `NONE`. That clause is the\n * one place a rule may treat a span edge as the end of the text, it exists because `spaces` is\n * the only rule that deletes, and 3.3 states the division: **a rule that deletes must treat a\n * span edge as the end of the text; a rule that replaces or inserts must not, and is governed by\n * this filter.** The single test that claims the clause is `spaces.md` 3.2 step 4.\n */\nexport function filterBoundaryEdits(\n cp: readonly number[],\n edits: readonly Edit[],\n ranges: readonly SpanRange[],\n): Edit[] {\n const out: Edit[] = [];\n for (const edit of edits) {\n let containsMarker = false;\n for (let i = edit.start; i < edit.end; i += 1) {\n if (isMarker(cp[i] as number)) {\n containsMarker = true;\n break;\n }\n }\n if (containsMarker) continue;\n\n // `[start, end)` in the engine's half-open form is `cp[p … q]` with p = start, q = end - 1;\n // an insertion is `q = p - 1`, which falls out of the same expression.\n const p = edit.start;\n const q = edit.end - 1;\n const d = edit.end - edit.start;\n const r = edit.replacement.length;\n const span = spanContaining(ranges, p);\n if (span !== undefined && (p === span.first || q === span.last)) {\n if (r > d) continue;\n // The character clause. `r > d` is not the rule, only a formalisation of it that misses\n // `r === d`: `dashes` P3 admits a run of THREE dashes, so `---` -> `␣–␣` is 3 -> 3 and the\n // length test sees nothing while U+0020 lands on both extremities anyway. Testing the\n // character catches it, and only U+0020 needs testing — it is the one code point any rule\n // emits whose meaning comes from its position rather than from itself (modes.md 5 item 2).\n const first = edit.replacement[0];\n const last = edit.replacement[r - 1];\n if (r > 0 && p === span.first && first === SPACE && cp[p] !== SPACE) continue;\n if (r > 0 && q === span.last && last === SPACE && cp[q] !== SPACE) continue;\n }\n\n out.push(edit);\n }\n return out;\n}\n\n/** Redistribute the transformed array back to one piece per span (modes.md 3.5 step 4). */\nexport function splitOnMarker(cp: readonly number[], expected: number): number[][] {\n const pieces: number[][] = [[]];\n for (const value of cp) {\n if (isMarker(value)) {\n pieces.push([]);\n continue;\n }\n (pieces[pieces.length - 1] as number[]).push(value);\n }\n if (pieces.length !== expected) {\n throw new PolytypoError(\n \"POLYTYPO_RULE_CONTRACT\",\n `boundary markers did not survive the pipeline: expected ${expected} spans, found ${pieces.length}`,\n );\n }\n return pieces;\n}\n\n/**\n * The origin map for `concatenateSpans` (analyze.md §2): for every code point of the joined\n * array, the code-point offset of the character it came from IN THE DOCUMENT, and NO_ORIGIN for\n * the markers, which came from nowhere. `Span` bounds are native string indices, so the\n * conversion to code-point offsets happens here and not in the caller — this is the one place\n * that knows both coordinate systems.\n */\nexport function originOfSpans(source: string, spans: readonly Span[]): number[] {\n const codePointIndexOf = new Array<number>(source.length + 1);\n let cpIndex = 0;\n for (let i = 0; i < source.length;) {\n codePointIndexOf[i] = cpIndex;\n const code = source.codePointAt(i) as number;\n const width = code > 0xffff ? 2 : 1;\n if (width === 2) codePointIndexOf[i + 1] = cpIndex;\n i += width;\n cpIndex += 1;\n }\n codePointIndexOf[source.length] = cpIndex;\n\n const origin: number[] = [];\n let previous: Span | undefined;\n for (const span of spans) {\n if (previous !== undefined) origin.push(NO_ORIGIN);\n const base = codePointIndexOf[span.start] as number;\n const length = toCodePoints(source.slice(span.start, span.end)).length;\n for (let k = 0; k < length; k += 1) origin.push(base + k);\n previous = span;\n }\n return origin;\n}\n","import {\n concatenateSpans,\n filterBoundaryEdits,\n normalizeSpans,\n originOfSpans,\n spanRangesOf,\n splitOnMarker,\n type Span,\n} from \"../modes/spans.js\";\nimport { RULES } from \"../rules/registry.js\";\nimport type { LocaleData, Mode, RuleId } from \"../types.js\";\nimport { applyEdits } from \"./edits.js\";\nimport { fromCodePoints, toCodePoints } from \"./codepoints.js\";\nimport type { Change } from \"./origin.js\";\nimport { runRulesRecording } from \"./rule-runner.js\";\n\n/**\n * The same sequence as `runRules` (`./rule-runner.js`), with the two boundary filters of\n * modes.md 3.4 interposed. The span extents are recomputed after every rule, because applying\n * an edit shifts every index after it; the markers themselves always survive, since no edit may\n * contain one.\n */\nfunction runRulesOverSpans(\n cp: readonly number[],\n planned: readonly RuleId[],\n locale: LocaleData,\n mode: Mode,\n narrowTarget: number,\n): readonly number[] {\n let current = cp;\n for (const id of planned) {\n const rule = RULES[id];\n if (rule === undefined) continue;\n const edits = rule.apply({ cp: current, locale, mode, narrowTarget });\n current = applyEdits(current, filterBoundaryEdits(current, edits, spanRangesOf(current)), id);\n }\n return current;\n}\n\n/**\n * modes.md 3.5. The pipeline runs **once**, over the marker-separated concatenation of every\n * processable span — not per span, which would pair quotation marks in isolation, and not over a\n * naive concatenation, which would manufacture adjacencies the document does not have.\n *\n * The output is the input with a set of disjoint substring replacements applied and nothing else\n * (modes.md 4). A span whose content the rules did not change contributes no replacement, so a\n * document needing no changes comes back byte-identical; the parser located the spans and was\n * then discarded, and the document is never serialised.\n */\nexport function runOverSpans(\n source: string,\n spans: readonly Span[],\n planned: readonly RuleId[],\n locale: LocaleData,\n mode: Mode,\n narrowTarget: number,\n): string {\n const normalized = normalizeSpans(spans);\n if (normalized.length === 0) return source;\n\n const transformed = runRulesOverSpans(\n concatenateSpans(source, normalized),\n planned,\n locale,\n mode,\n narrowTarget,\n );\n const pieces = splitOnMarker(transformed, normalized.length);\n\n let out = \"\";\n let cursor = 0;\n for (let i = 0; i < normalized.length; i += 1) {\n const span = normalized[i] as Span;\n const replacement = fromCodePoints(pieces[i] as number[]);\n const original = source.slice(span.start, span.end);\n out += source.slice(cursor, span.start);\n out += replacement === original ? original : replacement;\n cursor = span.end;\n }\n return out + source.slice(cursor);\n}\n\n/**\n * `runOverSpans`, reporting instead of applying (analyze.md §1). The span table supplies the\n * origin map, so every change comes back in DOCUMENT coordinates — analyze.md §6 names a\n * runtime that reports span-local offsets here as the mistake that passes every text-mode test.\n */\nexport function analyzeOverSpans(\n source: string,\n spans: readonly Span[],\n planned: readonly RuleId[],\n locale: LocaleData,\n mode: Mode,\n narrowTarget: number,\n): Change[] {\n const normalized = normalizeSpans(spans);\n if (normalized.length === 0) return [];\n return runRulesRecording(\n concatenateSpans(source, normalized),\n planned,\n locale,\n mode,\n narrowTarget,\n originOfSpans(source, normalized),\n toCodePoints(source).length,\n (current, edits) => filterBoundaryEdits(current, edits, spanRangesOf(current)),\n );\n}\n"]}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
import {
|
|
2
2
|
PolytypoError
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-W77K6K6G.js";
|
|
4
4
|
|
|
5
5
|
// src/engine/assert-fixed-mode.ts
|
|
6
6
|
function assertFixedMode(mode, fixed, entryPoint) {
|
|
@@ -14,4 +14,4 @@ function assertFixedMode(mode, fixed, entryPoint) {
|
|
|
14
14
|
export {
|
|
15
15
|
assertFixedMode
|
|
16
16
|
};
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-FICUT4OU.js.map
|
|
@@ -1,15 +1,15 @@
|
|
|
1
1
|
import {
|
|
2
2
|
htmlSpans
|
|
3
|
-
} from "./chunk-
|
|
3
|
+
} from "./chunk-VST7L77N.js";
|
|
4
4
|
import {
|
|
5
5
|
analyzeOverSpans,
|
|
6
6
|
runOverSpans
|
|
7
|
-
} from "./chunk-
|
|
7
|
+
} from "./chunk-LDXWXCGL.js";
|
|
8
8
|
import {
|
|
9
9
|
getLocaleData,
|
|
10
10
|
planRules,
|
|
11
11
|
resolveNarrowTarget
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-W77K6K6G.js";
|
|
13
13
|
|
|
14
14
|
// src/engine/html-pipeline.ts
|
|
15
15
|
function runHtmlPipeline(input, options) {
|
|
@@ -30,4 +30,4 @@ export {
|
|
|
30
30
|
runHtmlPipeline,
|
|
31
31
|
analyzeHtmlPipeline
|
|
32
32
|
};
|
|
33
|
-
//# sourceMappingURL=chunk-
|
|
33
|
+
//# sourceMappingURL=chunk-IN32R4AX.js.map
|
|
@@ -9,7 +9,7 @@ import {
|
|
|
9
9
|
isMarker,
|
|
10
10
|
runRulesRecording,
|
|
11
11
|
toCodePoints
|
|
12
|
-
} from "./chunk-
|
|
12
|
+
} from "./chunk-W77K6K6G.js";
|
|
13
13
|
|
|
14
14
|
// src/modes/spans.ts
|
|
15
15
|
var SPACE = 32;
|
|
@@ -202,4 +202,4 @@ export {
|
|
|
202
202
|
runOverSpans,
|
|
203
203
|
analyzeOverSpans
|
|
204
204
|
};
|
|
205
|
-
//# sourceMappingURL=chunk-
|
|
205
|
+
//# sourceMappingURL=chunk-LDXWXCGL.js.map
|
|
@@ -1,13 +1,13 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
3
|
|
|
4
|
-
var
|
|
4
|
+
var _chunkDKUR763Gcjs = require('./chunk-DKUR763G.cjs');
|
|
5
5
|
|
|
6
6
|
|
|
7
7
|
|
|
8
8
|
|
|
9
9
|
|
|
10
|
-
var
|
|
10
|
+
var _chunkVCD45VZHcjs = require('./chunk-VCD45VZH.cjs');
|
|
11
11
|
|
|
12
12
|
// src/modes/yaml.ts
|
|
13
13
|
var TAB = 9;
|
|
@@ -225,14 +225,14 @@ function plainScalar(source, line, v, spans) {
|
|
|
225
225
|
// src/engine/yaml-keys.ts
|
|
226
226
|
function resolveYamlKeys(value) {
|
|
227
227
|
if (!Array.isArray(value)) {
|
|
228
|
-
throw new (0,
|
|
228
|
+
throw new (0, _chunkVCD45VZHcjs.PolytypoError)(
|
|
229
229
|
"POLYTYPO_INVALID_OPTION",
|
|
230
230
|
`"keys" is required when mode is "yaml" and must be a list of strings (modes.md \xA73.8.2). Received ${value === void 0 ? "nothing" : JSON.stringify(value)}.`
|
|
231
231
|
);
|
|
232
232
|
}
|
|
233
233
|
for (const key of value) {
|
|
234
234
|
if (typeof key !== "string") {
|
|
235
|
-
throw new (0,
|
|
235
|
+
throw new (0, _chunkVCD45VZHcjs.PolytypoError)(
|
|
236
236
|
"POLYTYPO_INVALID_OPTION",
|
|
237
237
|
`"keys" must contain only strings; received ${JSON.stringify(key)}.`
|
|
238
238
|
);
|
|
@@ -243,22 +243,22 @@ function resolveYamlKeys(value) {
|
|
|
243
243
|
|
|
244
244
|
// src/engine/yaml-pipeline.ts
|
|
245
245
|
function runYamlPipeline(input, options) {
|
|
246
|
-
const narrowTarget =
|
|
247
|
-
const planned =
|
|
248
|
-
const locale =
|
|
246
|
+
const narrowTarget = _chunkVCD45VZHcjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
|
|
247
|
+
const planned = _chunkVCD45VZHcjs.planRules.call(void 0, options.rules);
|
|
248
|
+
const locale = _chunkVCD45VZHcjs.getLocaleData.call(void 0, options.locale);
|
|
249
249
|
const keys = resolveYamlKeys(options.keys);
|
|
250
|
-
return
|
|
250
|
+
return _chunkDKUR763Gcjs.runOverSpans.call(void 0, input, yamlSpans(input, keys), planned, locale, "yaml", narrowTarget);
|
|
251
251
|
}
|
|
252
252
|
function analyzeYamlPipeline(input, options) {
|
|
253
|
-
const narrowTarget =
|
|
254
|
-
const planned =
|
|
255
|
-
const locale =
|
|
253
|
+
const narrowTarget = _chunkVCD45VZHcjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
|
|
254
|
+
const planned = _chunkVCD45VZHcjs.planRules.call(void 0, options.rules);
|
|
255
|
+
const locale = _chunkVCD45VZHcjs.getLocaleData.call(void 0, options.locale);
|
|
256
256
|
const keys = resolveYamlKeys(options.keys);
|
|
257
|
-
return
|
|
257
|
+
return _chunkDKUR763Gcjs.analyzeOverSpans.call(void 0, input, yamlSpans(input, keys), planned, locale, "yaml", narrowTarget);
|
|
258
258
|
}
|
|
259
259
|
|
|
260
260
|
|
|
261
261
|
|
|
262
262
|
|
|
263
263
|
exports.runYamlPipeline = runYamlPipeline; exports.analyzeYamlPipeline = analyzeYamlPipeline;
|
|
264
|
-
//# sourceMappingURL=chunk-
|
|
264
|
+
//# sourceMappingURL=chunk-M4PJNXRU.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-V3EGRWOR.cjs","../src/modes/yaml.ts","../src/engine/yaml-keys.ts","../src/engine/yaml-pipeline.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACWA,IAAM,IAAA,EAAM,CAAA;AACZ,IAAM,GAAA,EAAK,EAAA;AACX,IAAM,GAAA,EAAK,EAAA;AACX,IAAM,MAAA,EAAQ,EAAA;AACd,IAAM,KAAA,EAAO,EAAA;AACb,IAAM,OAAA,EAAS,EAAA;AACf,IAAM,KAAA,EAAO,EAAA;AACb,IAAM,QAAA,EAAU,EAAA;AAChB,IAAM,UAAA,EAAY,EAAA;AAClB,IAAM,OAAA,EAAS,EAAA;AACf,IAAM,KAAA,EAAO,EAAA;AACb,IAAM,KAAA,EAAO,EAAA;AACb,IAAM,KAAA,EAAO,EAAA;AACb,IAAM,IAAA,EAAM,EAAA;AACZ,IAAM,KAAA,EAAO,EAAA;AACb,IAAM,IAAA,EAAM,EAAA;AACZ,IAAM,KAAA,EAAO,EAAA;AACb,IAAM,MAAA,EAAQ,EAAA;AACd,IAAM,QAAA,EAAU,EAAA;AAChB,IAAM,SAAA,EAAW,EAAA;AACjB,IAAM,UAAA,EAAY,EAAA;AAClB,IAAM,OAAA,EAAS,GAAA;AACf,IAAM,KAAA,EAAO,GAAA;AAgBb,SAAS,UAAA,CAAW,MAAA,EAAwB;AAC1C,EAAA,MAAM,MAAA,EAAgB,CAAC,CAAA;AACvB,EAAA,IAAI,MAAA,EAAQ,CAAA;AACZ,EAAA,MAAM,MAAA,EAAQ,CAAC,CAAA,EAAA,GAAuB,EAAA,EAAI,MAAA,GAAS,MAAA,CAAO,UAAA,CAAW,EAAA,EAAI,CAAC,EAAA,IA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;AAChF,EAAA,MAAM,aAAA,EAAe,mDAAA,OAAoB,CAAQ,UAAU,CAAA;AAC3D,EAAA,MAAM,QAAA,EAAU,yCAAA,OAAU,CAAQ,KAAK,CAAA;AACvC,EAAA,MAAM,OAAA,EAAS,6CAAA,OAAc,CAAQ,MAAM,CAAA;AAC3C,EAAA,MAAM,KAAA,EAAO,eAAA,CAAgB,OAAA,CAAQ,IAAI,CAAA;AACzC,EAAA,OAAO,4CAAA,KAAa,EAAO,SAAA,CAAU,KAAA,EAAO,IAAI,CAAA,EAAG,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,YAAY,CAAA;AAC1F;AAGO,SAAS,mBAAA,CAAoB,KAAA,EAAe,OAAA,EAAqC;AACtF,EAAA,MAAM,aAAA,EAAe,mDAAA,OAAoB,CAAQ,UAAU,CAAA;AAC3D,EAAA,MAAM,QAAA,EAAU,yCAAA,OAAU,CAAQ,KAAK,CAAA;AACvC,EAAA,MAAM,OAAA,EAAS,6CAAA,OAAc,CAAQ,MAAM,CAAA;AAC3C,EAAA,MAAM,KAAA,EAAO,eAAA,CAAgB,OAAA,CAAQ,IAAI,CAAA;AACzC,EAAA,OAAO,gDAAA,KAAiB,EAAO,SAAA,CAAU,KAAA,EAAO,IAAI,CAAA,EAAG,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,YAAY,CAAA;AAC9F;AHmOA;AACA;AACE;AACA;AACF,6FAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-V3EGRWOR.cjs","sourcesContent":[null,"import type { Span } from \"./spans.js\";\n\n/**\n * spec/rules/modes.md 3.8. `yaml` differs from the other two document modes twice over.\n *\n * It uses **no parser** (3.8.1): two of the five ecosystems' YAML libraries cannot report the\n * source offsets the round-trip guarantee needs, so the scan below is specified rather than\n * delegated and is written the same way in every runtime.\n *\n * And the caller names the keys (3.8.2). YAML is a data format with islands of prose in it — the\n * inverse of HTML and Markdown — and nothing in its syntax separates `description:` from `run:`.\n * A keyless draft of this file rewrote `if !` as `if!` inside a workflow's shell script; there is\n * no content test that would not, because shell and template expressions are written in words.\n *\n * It also **skips by default** — the inverse of 3.6's closed skip list. A construct this scan\n * does not recognise with certainty yields no spans, so the worst outcome of a gap in it is prose\n * left untypeset, never a changed byte.\n *\n * Offsets are UTF-16 indices, like every other mode in this runtime; every character the scan\n * tests is ASCII, so indexing by code unit and indexing by code point agree on all of them.\n */\n\nconst TAB = 0x09;\nconst LF = 0x0a;\nconst CR = 0x0d;\nconst SPACE = 0x20;\nconst BANG = 0x21;\nconst DQUOTE = 0x22;\nconst HASH = 0x23;\nconst PERCENT = 0x25;\nconst AMPERSAND = 0x26;\nconst SQUOTE = 0x27;\nconst STAR = 0x2a;\nconst PLUS = 0x2b;\nconst DASH = 0x2d;\nconst DOT = 0x2e;\nconst ZERO = 0x30;\nconst ONE = 0x31;\nconst NINE = 0x39;\nconst COLON = 0x3a;\nconst GREATER = 0x3e;\nconst LBRACKET = 0x5b;\nconst BACKSLASH = 0x5c;\nconst LBRACE = 0x7b;\nconst PIPE = 0x7c;\n\ninterface Line {\n readonly start: number;\n /** Index of the line terminator, or of the end of the source — never inside a span. */\n readonly end: number;\n}\n\n/**\n * 3.8.4: a line ends at U+000A, and **a U+000D immediately before it is not part of the line** —\n * it is a terminator like the U+000A itself, so it lies outside every span and comes back\n * untouched. Without that clause a CRLF file behaves differently from the same bytes with LF: the\n * block header reads as `|\\r` and is unrecognised, and a plain scalar carries the carriage return\n * inside its span. Five runtimes split lines with five different standard-library calls, so the\n * treatment has to be stated rather than inherited.\n */\nfunction splitLines(source: string): Line[] {\n const lines: Line[] = [];\n let start = 0;\n const endOf = (i: number): number => (i > start && source.charCodeAt(i - 1) === CR ? i - 1 : i);\n for (let i = 0; i < source.length; i += 1) {\n if (source.charCodeAt(i) === LF) {\n lines.push({ start, end: endOf(i) });\n start = i + 1;\n }\n }\n if (start < source.length) lines.push({ start, end: endOf(source.length) });\n return lines;\n}\n\n/** Index of the first code unit that is not U+0020, or `line.end` for a blank line. */\nfunction firstNonSpace(source: string, line: Line): number {\n let i = line.start;\n while (i < line.end && source.charCodeAt(i) === SPACE) i += 1;\n return i;\n}\n\nfunction isBlank(source: string, line: Line): boolean {\n return firstNonSpace(source, line) === line.end;\n}\n\nfunction hasTab(source: string, line: Line): boolean {\n for (let i = line.start; i < line.end; i += 1) if (source.charCodeAt(i) === TAB) return true;\n return false;\n}\n\n/**\n * 3.8.4 step 3. `---` and `...` at the head of a line, bare or introducing a node: the\n * trailing-content form is declined too, so `--- key: value` never yields a key of `--- key`.\n */\nfunction isDocumentMarker(source: string, from: number, end: number): boolean {\n if (end - from < 3) return false;\n const c = source.charCodeAt(from);\n if (c !== DASH && c !== DOT) return false;\n if (source.charCodeAt(from + 1) !== c || source.charCodeAt(from + 2) !== c) return false;\n return from + 3 === end || source.charCodeAt(from + 3) === SPACE;\n}\n\n/** A colon that ends the line or is followed by U+0020 — the only colon YAML reads as an indicator. */\nfunction isIndicatorColon(source: string, j: number, end: number): boolean {\n if (source.charCodeAt(j) !== COLON) return false;\n return j + 1 === end || source.charCodeAt(j + 1) === SPACE;\n}\n\n/** A `-` that ends the line or is followed by U+0020 — a block sequence entry marker. */\nfunction isSequenceDash(source: string, j: number, end: number): boolean {\n if (source.charCodeAt(j) !== DASH) return false;\n return j + 1 === end || source.charCodeAt(j + 1) === SPACE;\n}\n\n/**\n * The value run of 3.8.4 step 7: every following line that is blank or indented more than the\n * key line. **Those lines are never scanned again** — without that, a multi-line quoted scalar,\n * a multi-line flow collection and a folded plain scalar all leak their continuation lines back\n * into the scan as if they were mappings, and a span can end up holding a scalar's own closing\n * delimiter.\n */\nfunction valueRunEnd(source: string, lines: readonly Line[], li: number, indent: number): number {\n let k = li + 1;\n while (k < lines.length) {\n const next = lines[k] as Line;\n if (!isBlank(source, next) && firstNonSpace(source, next) - next.start <= indent) break;\n k += 1;\n }\n return k;\n}\n\nexport function yamlSpans(source: string, keys: readonly string[]): Span[] {\n const listed = new Set(keys);\n const lines = splitLines(source);\n const spans: Span[] = [];\n let li = 0;\n while (li < lines.length) li = scanLine(source, lines, li, listed, spans);\n return spans;\n}\n\n/** One step of 3.8.4. Returns the index of the next line to scan. */\nfunction scanLine(\n source: string,\n lines: readonly Line[],\n li: number,\n listed: ReadonlySet<string>,\n spans: Span[],\n): number {\n const line = lines[li] as Line;\n const skipLine = li + 1;\n\n // step 1 — blank, or a tab anywhere, which makes indentation undecidable.\n const start = firstNonSpace(source, line);\n if (start === line.end || hasTab(source, line)) return skipLine;\n const indent = start - line.start;\n\n // steps 2 and 3 — comment, directive, document marker.\n const head = source.charCodeAt(start);\n if (head === HASH || head === PERCENT) return skipLine;\n if (isDocumentMarker(source, start, line.end)) return skipLine;\n\n // step 4 — block sequence entries are consumed, not skipped; `- - key: v` nests.\n let i = start;\n while (i < line.end && isSequenceDash(source, i, line.end)) {\n i += 2;\n while (i < line.end && source.charCodeAt(i) === SPACE) i += 1;\n }\n if (i >= line.end) return skipLine;\n\n // step 5 — find the key. A colon NOT followed by U+0020 or the line end is an ordinary key\n // character, so `a:b: v` has the key `a:b`; stating that is what keeps five scanners agreeing.\n const keyStart = i;\n let colon = -1;\n for (let j = i; j < line.end; j += 1) {\n const c = source.charCodeAt(j);\n if (\n c === DQUOTE ||\n c === SQUOTE ||\n c === LBRACE ||\n c === LBRACKET ||\n c === AMPERSAND ||\n c === STAR ||\n c === BANG ||\n c === HASH\n ) {\n return skipLine;\n }\n if (isIndicatorColon(source, j, line.end)) {\n colon = j;\n break;\n }\n }\n if (colon < 0) return skipLine;\n let keyEnd = colon;\n while (keyEnd > keyStart && source.charCodeAt(keyEnd - 1) === SPACE) keyEnd -= 1;\n if (keyEnd <= keyStart) return skipLine;\n\n // step 6 — an empty value means a nested node, whose lines ARE scanned on their own.\n let v = colon + 1;\n while (v < line.end && source.charCodeAt(v) === SPACE) v += 1;\n if (v >= line.end) return skipLine;\n\n // step 7 — the line carries an inline value, so its continuation lines belong to that value.\n const next = valueRunEnd(source, lines, li, indent);\n\n // step 8 — the key must be listed. Checked before the value's form, so an unlisted key costs\n // nothing to decline: this is what makes `run:`, `if:` and `image:` unreachable.\n if (!listed.has(source.slice(keyStart, keyEnd))) return next;\n\n // step 9 — the scalar form.\n const value = source.charCodeAt(v);\n if (\n value === HASH ||\n value === AMPERSAND ||\n value === STAR ||\n value === BANG ||\n value === LBRACE ||\n value === LBRACKET\n ) {\n return next;\n }\n if (value === PIPE || value === GREATER) {\n blockScalar(source, lines, li, next, indent, v, spans);\n return next;\n }\n if (value === DQUOTE || value === SQUOTE) {\n if (next === li + 1) quotedScalar(source, line, v, spans);\n return next;\n }\n if (next === li + 1) plainScalar(source, line, v, spans);\n return next;\n}\n\n/**\n * 3.8.5. One span per non-blank content line, starting after the block's own indentation. The\n * header, the indentation and every line terminator lie outside every span — including the run\n * of line terminators at the end that the chomping indicator governs, which is why `|`, `|-`,\n * `|+`, `>`, `>-` and `>+` are handled identically here.\n */\nfunction blockScalar(\n source: string,\n lines: readonly Line[],\n li: number,\n runEnd: number,\n indent: number,\n v: number,\n spans: Span[],\n): void {\n const line = lines[li] as Line;\n\n // The header: at most one chomping indicator and at most one indentation indicator, in either\n // order, then optional spaces and an optional comment. Anything else is unrecognised.\n let h = v + 1;\n let explicitIndent = 0;\n let chomping = false;\n while (h < line.end) {\n const c = source.charCodeAt(h);\n if ((c === DASH || c === PLUS) && !chomping) {\n chomping = true;\n h += 1;\n continue;\n }\n if (c >= ONE && c <= NINE && explicitIndent === 0) {\n explicitIndent = c - ZERO;\n h += 1;\n continue;\n }\n break;\n }\n while (h < line.end && source.charCodeAt(h) === SPACE) h += 1;\n if (h < line.end && source.charCodeAt(h) !== HASH) return;\n\n // One definition of the run, and three conditions that make the whole block yield no spans.\n const content: Line[] = [];\n let contentIndent = -1;\n for (let k = li + 1; k < runEnd; k += 1) {\n const next = lines[k] as Line;\n if (isBlank(source, next)) continue; // blank lines belong to the block and yield no span\n if (hasTab(source, next)) return;\n const nextIndent = firstNonSpace(source, next) - next.start;\n if (contentIndent < 0) {\n contentIndent = explicitIndent > 0 ? indent + explicitIndent : nextIndent;\n }\n // An explicit indicator that disagrees with the block as written, or a later line dedented\n // inside it, is ambiguous rather than guessable — bail rather than choose.\n if (nextIndent < contentIndent) return;\n content.push(next);\n }\n if (contentIndent <= 0) return;\n\n for (const c of content) {\n const from = c.start + contentIndent;\n if (c.end > from) spans.push({ start: from, end: c.end });\n }\n}\n\n/**\n * 3.8.6. The span is the content between the quotes. Both bails exist so that source characters\n * and content characters are the same thing, which the offset model of 3.1 requires — the same\n * constraint that makes an HTML character reference an opaque unit in 3.6. No colon test applies\n * here: quoting neutralises the colon, and applying the plain-scalar test would decline\n * `title: \"Chapter 1: the beginning\"`.\n */\nfunction quotedScalar(source: string, line: Line, v: number, spans: Span[]): void {\n const quote = source.charCodeAt(v);\n let close = -1;\n for (let j = v + 1; j < line.end; j += 1) {\n const c = source.charCodeAt(j);\n if (quote === DQUOTE && c === BACKSLASH) return;\n if (\n quote === SQUOTE &&\n c === SQUOTE &&\n j + 1 < line.end &&\n source.charCodeAt(j + 1) === SQUOTE\n ) {\n return;\n }\n if (c === quote) {\n close = j;\n break;\n }\n }\n if (close < 0) return;\n\n let after = close + 1;\n while (after < line.end && source.charCodeAt(after) === SPACE) after += 1;\n if (after < line.end && source.charCodeAt(after) !== HASH) return;\n\n if (close > v + 1) spans.push({ start: v + 1, end: close });\n}\n\n/**\n * 3.8.6. In a plain scalar `:` and `#` are still live: U+0020 beside either of them is what turns\n * a scalar into a mapping indicator or a comment, and `dashes` emits U+0020 in every `-spaced`\n * locale. Lifting both out as opaque units leaves the dash token against a boundary marker, which\n * `dashes` declines on its own account — the edge-growth rule of 3.4 is the second net, not the\n * first.\n */\nfunction plainScalar(source: string, line: Line, v: number, spans: Span[]): void {\n // The scalar ends before a trailing comment, so a colon inside that comment is not the\n // scalar's and must not decline it.\n let end = line.end;\n for (let j = v; j < line.end; j += 1) {\n if (source.charCodeAt(j) === HASH && j > v && source.charCodeAt(j - 1) === SPACE) {\n end = j - 1;\n break;\n }\n }\n while (end > v && source.charCodeAt(end - 1) === SPACE) end -= 1;\n if (end <= v) return;\n\n // Compact nesting is not a value: `key: - item` opens a sequence, and `key: a .:` is a mapping\n // whose key is `a .` — a plain scalar can never contain a colon in that position.\n if (isSequenceDash(source, v, line.end)) return;\n for (let j = v; j < end; j += 1) if (isIndicatorColon(source, j, line.end)) return;\n\n let segment = v;\n for (let j = v; j <= end; j += 1) {\n if (j === end || source.charCodeAt(j) === COLON || source.charCodeAt(j) === HASH) {\n if (j > segment) spans.push({ start: segment, end: j });\n segment = j + 1;\n }\n }\n}\n","import { PolytypoError } from \"../errors.js\";\n\n/**\n * modes.md §3.8.2: `yaml` mode's `keys` option, resolved once at the call boundary.\n *\n * It has **no default**, for the reason `dialect` has none. YAML is a data format with islands of\n * prose in it, and nothing in its syntax marks them — `description` holds a sentence and `run`\n * holds a shell script, spelled identically — so a default would be a guess about the schema\n * above the document. An **empty list is legal**: \"process nothing\" is a choice a caller may\n * make, not an error.\n *\n * Checked after `locale`, last of the option checks, alongside `dialect` (ARCHITECTURE.md §7).\n * The two never both apply, since each belongs to a different mode.\n */\nexport function resolveYamlKeys(value: unknown): readonly string[] {\n if (!Array.isArray(value)) {\n throw new PolytypoError(\n \"POLYTYPO_INVALID_OPTION\",\n `\"keys\" is required when mode is \"yaml\" and must be a list of strings (modes.md §3.8.2). ` +\n `Received ${value === undefined ? \"nothing\" : JSON.stringify(value)}.`,\n );\n }\n for (const key of value as readonly unknown[]) {\n if (typeof key !== \"string\") {\n throw new PolytypoError(\n \"POLYTYPO_INVALID_OPTION\",\n `\"keys\" must contain only strings; received ${JSON.stringify(key)}.`,\n );\n }\n }\n return value as readonly string[];\n}\n","import { yamlSpans } from \"../modes/yaml.js\";\nimport type { Options } from \"../types.js\";\nimport { getLocaleData } from \"./locale.js\";\nimport { resolveNarrowTarget } from \"./narrow-target.js\";\nimport { resolveYamlKeys } from \"./yaml-keys.js\";\nimport { planRules } from \"./rule-runner.js\";\nimport { analyzeOverSpans, runOverSpans } from \"./span-runner.js\";\nimport type { Change } from \"./origin.js\";\n\n/**\n * `yaml` mode only, and the only mode pipeline with **no parser dependency at all** — span\n * selection is the specified scan of modes.md 3.8, not a library. There is likewise no\n * `POLYTYPO_MALFORMED_INPUT` counterpart here: with no declared grammar to violate, a file that\n * is not YAML yields few spans or none and comes back byte for byte (modes.md 3.8.3). The only\n * throw this mode adds is `keys`, which is about the call and not the input.\n */\nexport function runYamlPipeline(input: string, options: Partial<Options>): string {\n const narrowTarget = resolveNarrowTarget(options.narrowNbsp);\n const planned = planRules(options.rules);\n const locale = getLocaleData(options.locale);\n const keys = resolveYamlKeys(options.keys);\n return runOverSpans(input, yamlSpans(input, keys), planned, locale, \"yaml\", narrowTarget);\n}\n\n/** analyze.md §1, `yaml` mode: offsets are into the document, not into a span (analyze.md §6). */\nexport function analyzeYamlPipeline(input: string, options: Partial<Options>): Change[] {\n const narrowTarget = resolveNarrowTarget(options.narrowNbsp);\n const planned = planRules(options.rules);\n const locale = getLocaleData(options.locale);\n const keys = resolveYamlKeys(options.keys);\n return analyzeOverSpans(input, yamlSpans(input, keys), planned, locale, \"yaml\", narrowTarget);\n}\n"]}
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-M4PJNXRU.cjs","../src/modes/yaml.ts","../src/engine/yaml-keys.ts","../src/engine/yaml-pipeline.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACWA,IAAM,IAAA,EAAM,CAAA;AACZ,IAAM,GAAA,EAAK,EAAA;AACX,IAAM,GAAA,EAAK,EAAA;AACX,IAAM,MAAA,EAAQ,EAAA;AACd,IAAM,KAAA,EAAO,EAAA;AACb,IAAM,OAAA,EAAS,EAAA;AACf,IAAM,KAAA,EAAO,EAAA;AACb,IAAM,QAAA,EAAU,EAAA;AACh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AU,yCAAA,OAAU,CAAQ,KAAK,CAAA;AACvC,EAAA,MAAM,OAAA,EAAS,6CAAA,OAAc,CAAQ,MAAM,CAAA;AAC3C,EAAA,MAAM,KAAA,EAAO,eAAA,CAAgB,OAAA,CAAQ,IAAI,CAAA;AACzC,EAAA,OAAO,gDAAA,KAAiB,EAAO,SAAA,CAAU,KAAA,EAAO,IAAI,CAAA,EAAG,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,YAAY,CAAA;AAC9F;AHmOA;AACA;AACE;AACA;AACF,6FAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-M4PJNXRU.cjs","sourcesContent":[null,"import type { Span } from \"./spans.js\";\n\n/**\n * spec/rules/modes.md 3.8. `yaml` differs from the other two document modes twice over.\n *\n * It uses **no parser** (3.8.1): two of the five ecosystems' YAML libraries cannot report the\n * source offsets the round-trip guarantee needs, so the scan below is specified rather than\n * delegated and is written the same way in every runtime.\n *\n * And the caller names the keys (3.8.2). YAML is a data format with islands of prose in it — the\n * inverse of HTML and Markdown — and nothing in its syntax separates `description:` from `run:`.\n * A keyless draft of this file rewrote `if !` as `if!` inside a workflow's shell script; there is\n * no content test that would not, because shell and template expressions are written in words.\n *\n * It also **skips by default** — the inverse of 3.6's closed skip list. A construct this scan\n * does not recognise with certainty yields no spans, so the worst outcome of a gap in it is prose\n * left untypeset, never a changed byte.\n *\n * Offsets are UTF-16 indices, like every other mode in this runtime; every character the scan\n * tests is ASCII, so indexing by code unit and indexing by code point agree on all of them.\n */\n\nconst TAB = 0x09;\nconst LF = 0x0a;\nconst CR = 0x0d;\nconst SPACE = 0x20;\nconst BANG = 0x21;\nconst DQUOTE = 0x22;\nconst HASH = 0x23;\nconst PERCENT = 0x25;\nconst AMPERSAND = 0x26;\nconst SQUOTE = 0x27;\nconst STAR = 0x2a;\nconst PLUS = 0x2b;\nconst DASH = 0x2d;\nconst DOT = 0x2e;\nconst ZERO = 0x30;\nconst ONE = 0x31;\nconst NINE = 0x39;\nconst COLON = 0x3a;\nconst GREATER = 0x3e;\nconst LBRACKET = 0x5b;\nconst BACKSLASH = 0x5c;\nconst LBRACE = 0x7b;\nconst PIPE = 0x7c;\n\ninterface Line {\n readonly start: number;\n /** Index of the line terminator, or of the end of the source — never inside a span. */\n readonly end: number;\n}\n\n/**\n * 3.8.4: a line ends at U+000A, and **a U+000D immediately before it is not part of the line** —\n * it is a terminator like the U+000A itself, so it lies outside every span and comes back\n * untouched. Without that clause a CRLF file behaves differently from the same bytes with LF: the\n * block header reads as `|\\r` and is unrecognised, and a plain scalar carries the carriage return\n * inside its span. Five runtimes split lines with five different standard-library calls, so the\n * treatment has to be stated rather than inherited.\n */\nfunction splitLines(source: string): Line[] {\n const lines: Line[] = [];\n let start = 0;\n const endOf = (i: number): number => (i > start && source.charCodeAt(i - 1) === CR ? i - 1 : i);\n for (let i = 0; i < source.length; i += 1) {\n if (source.charCodeAt(i) === LF) {\n lines.push({ start, end: endOf(i) });\n start = i + 1;\n }\n }\n if (start < source.length) lines.push({ start, end: endOf(source.length) });\n return lines;\n}\n\n/** Index of the first code unit that is not U+0020, or `line.end` for a blank line. */\nfunction firstNonSpace(source: string, line: Line): number {\n let i = line.start;\n while (i < line.end && source.charCodeAt(i) === SPACE) i += 1;\n return i;\n}\n\nfunction isBlank(source: string, line: Line): boolean {\n return firstNonSpace(source, line) === line.end;\n}\n\nfunction hasTab(source: string, line: Line): boolean {\n for (let i = line.start; i < line.end; i += 1) if (source.charCodeAt(i) === TAB) return true;\n return false;\n}\n\n/**\n * 3.8.4 step 3. `---` and `...` at the head of a line, bare or introducing a node: the\n * trailing-content form is declined too, so `--- key: value` never yields a key of `--- key`.\n */\nfunction isDocumentMarker(source: string, from: number, end: number): boolean {\n if (end - from < 3) return false;\n const c = source.charCodeAt(from);\n if (c !== DASH && c !== DOT) return false;\n if (source.charCodeAt(from + 1) !== c || source.charCodeAt(from + 2) !== c) return false;\n return from + 3 === end || source.charCodeAt(from + 3) === SPACE;\n}\n\n/** A colon that ends the line or is followed by U+0020 — the only colon YAML reads as an indicator. */\nfunction isIndicatorColon(source: string, j: number, end: number): boolean {\n if (source.charCodeAt(j) !== COLON) return false;\n return j + 1 === end || source.charCodeAt(j + 1) === SPACE;\n}\n\n/** A `-` that ends the line or is followed by U+0020 — a block sequence entry marker. */\nfunction isSequenceDash(source: string, j: number, end: number): boolean {\n if (source.charCodeAt(j) !== DASH) return false;\n return j + 1 === end || source.charCodeAt(j + 1) === SPACE;\n}\n\n/**\n * The value run of 3.8.4 step 7: every following line that is blank or indented more than the\n * key line. **Those lines are never scanned again** — without that, a multi-line quoted scalar,\n * a multi-line flow collection and a folded plain scalar all leak their continuation lines back\n * into the scan as if they were mappings, and a span can end up holding a scalar's own closing\n * delimiter.\n */\nfunction valueRunEnd(source: string, lines: readonly Line[], li: number, indent: number): number {\n let k = li + 1;\n while (k < lines.length) {\n const next = lines[k] as Line;\n if (!isBlank(source, next) && firstNonSpace(source, next) - next.start <= indent) break;\n k += 1;\n }\n return k;\n}\n\nexport function yamlSpans(source: string, keys: readonly string[]): Span[] {\n const listed = new Set(keys);\n const lines = splitLines(source);\n const spans: Span[] = [];\n let li = 0;\n while (li < lines.length) li = scanLine(source, lines, li, listed, spans);\n return spans;\n}\n\n/** One step of 3.8.4. Returns the index of the next line to scan. */\nfunction scanLine(\n source: string,\n lines: readonly Line[],\n li: number,\n listed: ReadonlySet<string>,\n spans: Span[],\n): number {\n const line = lines[li] as Line;\n const skipLine = li + 1;\n\n // step 1 — blank, or a tab anywhere, which makes indentation undecidable.\n const start = firstNonSpace(source, line);\n if (start === line.end || hasTab(source, line)) return skipLine;\n const indent = start - line.start;\n\n // steps 2 and 3 — comment, directive, document marker.\n const head = source.charCodeAt(start);\n if (head === HASH || head === PERCENT) return skipLine;\n if (isDocumentMarker(source, start, line.end)) return skipLine;\n\n // step 4 — block sequence entries are consumed, not skipped; `- - key: v` nests.\n let i = start;\n while (i < line.end && isSequenceDash(source, i, line.end)) {\n i += 2;\n while (i < line.end && source.charCodeAt(i) === SPACE) i += 1;\n }\n if (i >= line.end) return skipLine;\n\n // step 5 — find the key. A colon NOT followed by U+0020 or the line end is an ordinary key\n // character, so `a:b: v` has the key `a:b`; stating that is what keeps five scanners agreeing.\n const keyStart = i;\n let colon = -1;\n for (let j = i; j < line.end; j += 1) {\n const c = source.charCodeAt(j);\n if (\n c === DQUOTE ||\n c === SQUOTE ||\n c === LBRACE ||\n c === LBRACKET ||\n c === AMPERSAND ||\n c === STAR ||\n c === BANG ||\n c === HASH\n ) {\n return skipLine;\n }\n if (isIndicatorColon(source, j, line.end)) {\n colon = j;\n break;\n }\n }\n if (colon < 0) return skipLine;\n let keyEnd = colon;\n while (keyEnd > keyStart && source.charCodeAt(keyEnd - 1) === SPACE) keyEnd -= 1;\n if (keyEnd <= keyStart) return skipLine;\n\n // step 6 — an empty value means a nested node, whose lines ARE scanned on their own.\n let v = colon + 1;\n while (v < line.end && source.charCodeAt(v) === SPACE) v += 1;\n if (v >= line.end) return skipLine;\n\n // step 7 — the line carries an inline value, so its continuation lines belong to that value.\n const next = valueRunEnd(source, lines, li, indent);\n\n // step 8 — the key must be listed. Checked before the value's form, so an unlisted key costs\n // nothing to decline: this is what makes `run:`, `if:` and `image:` unreachable.\n if (!listed.has(source.slice(keyStart, keyEnd))) return next;\n\n // step 9 — the scalar form.\n const value = source.charCodeAt(v);\n if (\n value === HASH ||\n value === AMPERSAND ||\n value === STAR ||\n value === BANG ||\n value === LBRACE ||\n value === LBRACKET\n ) {\n return next;\n }\n if (value === PIPE || value === GREATER) {\n blockScalar(source, lines, li, next, indent, v, spans);\n return next;\n }\n if (value === DQUOTE || value === SQUOTE) {\n if (next === li + 1) quotedScalar(source, line, v, spans);\n return next;\n }\n if (next === li + 1) plainScalar(source, line, v, spans);\n return next;\n}\n\n/**\n * 3.8.5. One span per non-blank content line, starting after the block's own indentation. The\n * header, the indentation and every line terminator lie outside every span — including the run\n * of line terminators at the end that the chomping indicator governs, which is why `|`, `|-`,\n * `|+`, `>`, `>-` and `>+` are handled identically here.\n */\nfunction blockScalar(\n source: string,\n lines: readonly Line[],\n li: number,\n runEnd: number,\n indent: number,\n v: number,\n spans: Span[],\n): void {\n const line = lines[li] as Line;\n\n // The header: at most one chomping indicator and at most one indentation indicator, in either\n // order, then optional spaces and an optional comment. Anything else is unrecognised.\n let h = v + 1;\n let explicitIndent = 0;\n let chomping = false;\n while (h < line.end) {\n const c = source.charCodeAt(h);\n if ((c === DASH || c === PLUS) && !chomping) {\n chomping = true;\n h += 1;\n continue;\n }\n if (c >= ONE && c <= NINE && explicitIndent === 0) {\n explicitIndent = c - ZERO;\n h += 1;\n continue;\n }\n break;\n }\n while (h < line.end && source.charCodeAt(h) === SPACE) h += 1;\n if (h < line.end && source.charCodeAt(h) !== HASH) return;\n\n // One definition of the run, and three conditions that make the whole block yield no spans.\n const content: Line[] = [];\n let contentIndent = -1;\n for (let k = li + 1; k < runEnd; k += 1) {\n const next = lines[k] as Line;\n if (isBlank(source, next)) continue; // blank lines belong to the block and yield no span\n if (hasTab(source, next)) return;\n const nextIndent = firstNonSpace(source, next) - next.start;\n if (contentIndent < 0) {\n contentIndent = explicitIndent > 0 ? indent + explicitIndent : nextIndent;\n }\n // An explicit indicator that disagrees with the block as written, or a later line dedented\n // inside it, is ambiguous rather than guessable — bail rather than choose.\n if (nextIndent < contentIndent) return;\n content.push(next);\n }\n if (contentIndent <= 0) return;\n\n for (const c of content) {\n const from = c.start + contentIndent;\n if (c.end > from) spans.push({ start: from, end: c.end });\n }\n}\n\n/**\n * 3.8.6. The span is the content between the quotes. Both bails exist so that source characters\n * and content characters are the same thing, which the offset model of 3.1 requires — the same\n * constraint that makes an HTML character reference an opaque unit in 3.6. No colon test applies\n * here: quoting neutralises the colon, and applying the plain-scalar test would decline\n * `title: \"Chapter 1: the beginning\"`.\n */\nfunction quotedScalar(source: string, line: Line, v: number, spans: Span[]): void {\n const quote = source.charCodeAt(v);\n let close = -1;\n for (let j = v + 1; j < line.end; j += 1) {\n const c = source.charCodeAt(j);\n if (quote === DQUOTE && c === BACKSLASH) return;\n if (\n quote === SQUOTE &&\n c === SQUOTE &&\n j + 1 < line.end &&\n source.charCodeAt(j + 1) === SQUOTE\n ) {\n return;\n }\n if (c === quote) {\n close = j;\n break;\n }\n }\n if (close < 0) return;\n\n let after = close + 1;\n while (after < line.end && source.charCodeAt(after) === SPACE) after += 1;\n if (after < line.end && source.charCodeAt(after) !== HASH) return;\n\n if (close > v + 1) spans.push({ start: v + 1, end: close });\n}\n\n/**\n * 3.8.6. In a plain scalar `:` and `#` are still live: U+0020 beside either of them is what turns\n * a scalar into a mapping indicator or a comment, and `dashes` emits U+0020 in every `-spaced`\n * locale. Lifting both out as opaque units leaves the dash token against a boundary marker, which\n * `dashes` declines on its own account — the edge-growth rule of 3.4 is the second net, not the\n * first.\n */\nfunction plainScalar(source: string, line: Line, v: number, spans: Span[]): void {\n // The scalar ends before a trailing comment, so a colon inside that comment is not the\n // scalar's and must not decline it.\n let end = line.end;\n for (let j = v; j < line.end; j += 1) {\n if (source.charCodeAt(j) === HASH && j > v && source.charCodeAt(j - 1) === SPACE) {\n end = j - 1;\n break;\n }\n }\n while (end > v && source.charCodeAt(end - 1) === SPACE) end -= 1;\n if (end <= v) return;\n\n // Compact nesting is not a value: `key: - item` opens a sequence, and `key: a .:` is a mapping\n // whose key is `a .` — a plain scalar can never contain a colon in that position.\n if (isSequenceDash(source, v, line.end)) return;\n for (let j = v; j < end; j += 1) if (isIndicatorColon(source, j, line.end)) return;\n\n let segment = v;\n for (let j = v; j <= end; j += 1) {\n if (j === end || source.charCodeAt(j) === COLON || source.charCodeAt(j) === HASH) {\n if (j > segment) spans.push({ start: segment, end: j });\n segment = j + 1;\n }\n }\n}\n","import { PolytypoError } from \"../errors.js\";\n\n/**\n * modes.md §3.8.2: `yaml` mode's `keys` option, resolved once at the call boundary.\n *\n * It has **no default**, for the reason `dialect` has none. YAML is a data format with islands of\n * prose in it, and nothing in its syntax marks them — `description` holds a sentence and `run`\n * holds a shell script, spelled identically — so a default would be a guess about the schema\n * above the document. An **empty list is legal**: \"process nothing\" is a choice a caller may\n * make, not an error.\n *\n * Checked after `locale`, last of the option checks, alongside `dialect` (ARCHITECTURE.md §7).\n * The two never both apply, since each belongs to a different mode.\n */\nexport function resolveYamlKeys(value: unknown): readonly string[] {\n if (!Array.isArray(value)) {\n throw new PolytypoError(\n \"POLYTYPO_INVALID_OPTION\",\n `\"keys\" is required when mode is \"yaml\" and must be a list of strings (modes.md §3.8.2). ` +\n `Received ${value === undefined ? \"nothing\" : JSON.stringify(value)}.`,\n );\n }\n for (const key of value as readonly unknown[]) {\n if (typeof key !== \"string\") {\n throw new PolytypoError(\n \"POLYTYPO_INVALID_OPTION\",\n `\"keys\" must contain only strings; received ${JSON.stringify(key)}.`,\n );\n }\n }\n return value as readonly string[];\n}\n","import { yamlSpans } from \"../modes/yaml.js\";\nimport type { Options } from \"../types.js\";\nimport { getLocaleData } from \"./locale.js\";\nimport { resolveNarrowTarget } from \"./narrow-target.js\";\nimport { resolveYamlKeys } from \"./yaml-keys.js\";\nimport { planRules } from \"./rule-runner.js\";\nimport { analyzeOverSpans, runOverSpans } from \"./span-runner.js\";\nimport type { Change } from \"./origin.js\";\n\n/**\n * `yaml` mode only, and the only mode pipeline with **no parser dependency at all** — span\n * selection is the specified scan of modes.md 3.8, not a library. There is likewise no\n * `POLYTYPO_MALFORMED_INPUT` counterpart here: with no declared grammar to violate, a file that\n * is not YAML yields few spans or none and comes back byte for byte (modes.md 3.8.3). The only\n * throw this mode adds is `keys`, which is about the call and not the input.\n */\nexport function runYamlPipeline(input: string, options: Partial<Options>): string {\n const narrowTarget = resolveNarrowTarget(options.narrowNbsp);\n const planned = planRules(options.rules);\n const locale = getLocaleData(options.locale);\n const keys = resolveYamlKeys(options.keys);\n return runOverSpans(input, yamlSpans(input, keys), planned, locale, \"yaml\", narrowTarget);\n}\n\n/** analyze.md §1, `yaml` mode: offsets are into the document, not into a span (analyze.md §6). */\nexport function analyzeYamlPipeline(input: string, options: Partial<Options>): Change[] {\n const narrowTarget = resolveNarrowTarget(options.narrowNbsp);\n const planned = planRules(options.rules);\n const locale = getLocaleData(options.locale);\n const keys = resolveYamlKeys(options.keys);\n return analyzeOverSpans(input, yamlSpans(input, keys), planned, locale, \"yaml\", narrowTarget);\n}\n"]}
|
|
@@ -0,0 +1,33 @@
|
|
|
1
|
+
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
|
+
|
|
3
|
+
var _chunkV6SSSZLPcjs = require('./chunk-V6SSSZLP.cjs');
|
|
4
|
+
|
|
5
|
+
|
|
6
|
+
|
|
7
|
+
var _chunkDKUR763Gcjs = require('./chunk-DKUR763G.cjs');
|
|
8
|
+
|
|
9
|
+
|
|
10
|
+
|
|
11
|
+
|
|
12
|
+
var _chunkVCD45VZHcjs = require('./chunk-VCD45VZH.cjs');
|
|
13
|
+
|
|
14
|
+
// src/engine/html-pipeline.ts
|
|
15
|
+
function runHtmlPipeline(input, options) {
|
|
16
|
+
const narrowTarget = _chunkVCD45VZHcjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
|
|
17
|
+
const planned = _chunkVCD45VZHcjs.planRules.call(void 0, options.rules);
|
|
18
|
+
const locale = _chunkVCD45VZHcjs.getLocaleData.call(void 0, options.locale);
|
|
19
|
+
const spans = _chunkV6SSSZLPcjs.htmlSpans.call(void 0, input);
|
|
20
|
+
return _chunkDKUR763Gcjs.runOverSpans.call(void 0, input, spans, planned, locale, "html", narrowTarget);
|
|
21
|
+
}
|
|
22
|
+
function analyzeHtmlPipeline(input, options) {
|
|
23
|
+
const narrowTarget = _chunkVCD45VZHcjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
|
|
24
|
+
const planned = _chunkVCD45VZHcjs.planRules.call(void 0, options.rules);
|
|
25
|
+
const locale = _chunkVCD45VZHcjs.getLocaleData.call(void 0, options.locale);
|
|
26
|
+
return _chunkDKUR763Gcjs.analyzeOverSpans.call(void 0, input, _chunkV6SSSZLPcjs.htmlSpans.call(void 0, input), planned, locale, "html", narrowTarget);
|
|
27
|
+
}
|
|
28
|
+
|
|
29
|
+
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
exports.runHtmlPipeline = runHtmlPipeline; exports.analyzeHtmlPipeline = analyzeHtmlPipeline;
|
|
33
|
+
//# sourceMappingURL=chunk-MDESZMU2.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-MDESZMU2.cjs","../src/engine/html-pipeline.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;AACA;AACF,wDAA6B;AAC7B;AACE;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACIO,SAAS,eAAA,CAAgB,KAAA,EAAe,OAAA,EAAmC;AAChF,EAAA,MAAM,aAAA,EAAe,mDAAA,OAAoB,CAAQ,UAAU,CAAA;AAC3D,EAAA,MAAM,QAAA,EAAU,yCAAA,OAAU,CAAQ,KAAK,CAAA;AACvC,EAAA,MAAM,OAAA,EAAS,6CAAA,OAAc,CAAQ,MAAM,CAAA;AAC3C,EAAA,MAAM,MAAA,EAAQ,yCAAA,KAAe,CAAA;AAC7B,EAAA,OAAO,4CAAA,KAAa,EAAO,KAAA,EAAO,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,YAAY,CAAA;AACzE;AAGO,SAAS,mBAAA,CAAoB,KAAA,EAAe,OAAA,EAAqC;AACtF,EAAA,MAAM,aAAA,EAAe,mDAAA,OAAoB,CAAQ,UAAU,CAAA;AAC3D,EAAA,MAAM,QAAA,EAAU,yCAAA,OAAU,CAAQ,KAAK,CAAA;AACvC,EAAA,MAAM,OAAA,EAAS,6CAAA,OAAc,CAAQ,MAAM,CAAA;AAC3C,EAAA,OAAO,gDAAA,KAAiB,EAAO,yCAAA,KAAe,CAAA,EAAG,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,YAAY,CAAA;AACxF;ADJA;AACA;AACE;AACA;AACF,6FAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-MDESZMU2.cjs","sourcesContent":[null,"import { htmlSpans } from \"../modes/html.js\";\nimport type { Options } from \"../types.js\";\nimport { getLocaleData } from \"./locale.js\";\nimport { resolveNarrowTarget } from \"./narrow-target.js\";\nimport { planRules } from \"./rule-runner.js\";\nimport { analyzeOverSpans, runOverSpans } from \"./span-runner.js\";\nimport type { Change } from \"./origin.js\";\n\n/**\n * `html` mode only. Imports `parse5` (via `../modes/html.js`) and nothing from\n * `../modes/markdown.js` or the Micromark/MDX stack — this is what makes `polytypo/html`'s\n * module graph exclude the Markdown parser (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1).\n *\n * Validation order — `planRules` before `getLocaleData` before parsing — mirrors the pre-Stage-5\n * aggregate `runPipeline` exactly (an unknown-rule error must win over an unknown-locale error,\n * and both must win over a parse failure, since that is public, tested behaviour).\n */\nexport function runHtmlPipeline(input: string, options: Partial<Options>): string {\n const narrowTarget = resolveNarrowTarget(options.narrowNbsp);\n const planned = planRules(options.rules);\n const locale = getLocaleData(options.locale);\n const spans = htmlSpans(input);\n return runOverSpans(input, spans, planned, locale, \"html\", narrowTarget);\n}\n\n/** analyze.md §1, `html` mode: offsets are into the document, not into a span (analyze.md §6). */\nexport function analyzeHtmlPipeline(input: string, options: Partial<Options>): Change[] {\n const narrowTarget = resolveNarrowTarget(options.narrowNbsp);\n const planned = planRules(options.rules);\n const locale = getLocaleData(options.locale);\n return analyzeOverSpans(input, htmlSpans(input), planned, locale, \"html\", narrowTarget);\n}\n"]}
|
|
@@ -1,11 +1,11 @@
|
|
|
1
1
|
"use strict";Object.defineProperty(exports, "__esModule", {value: true});
|
|
2
2
|
|
|
3
|
-
var
|
|
3
|
+
var _chunkVCD45VZHcjs = require('./chunk-VCD45VZH.cjs');
|
|
4
4
|
|
|
5
5
|
// src/engine/assert-fixed-mode.ts
|
|
6
6
|
function assertFixedMode(mode, fixed, entryPoint) {
|
|
7
7
|
if (mode === void 0 || mode === fixed) return;
|
|
8
|
-
throw new (0,
|
|
8
|
+
throw new (0, _chunkVCD45VZHcjs.PolytypoError)(
|
|
9
9
|
"POLYTYPO_INVALID_MODE",
|
|
10
10
|
`"${entryPoint}" only supports mode "${fixed}". Received "${String(mode)}" \u2014 import from "polytypo" for the other modes, or omit \`mode\` here.`
|
|
11
11
|
);
|
|
@@ -14,4 +14,4 @@ function assertFixedMode(mode, fixed, entryPoint) {
|
|
|
14
14
|
|
|
15
15
|
|
|
16
16
|
exports.assertFixedMode = assertFixedMode;
|
|
17
|
-
//# sourceMappingURL=chunk-
|
|
17
|
+
//# sourceMappingURL=chunk-P6IBHZL6.cjs.map
|
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-
|
|
1
|
+
{"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-P6IBHZL6.cjs","../src/engine/assert-fixed-mode.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACA;ACMO,SAAS,eAAA,CAAgB,IAAA,EAAe,KAAA,EAAa,UAAA,EAA0B;AACpF,EAAA,GAAA,CAAI,KAAA,IAAS,KAAA,EAAA,GAAa,KAAA,IAAS,KAAA,EAAO,MAAA;AAC1C,EAAA,MAAM,IAAI,oCAAA;AAAA,IACR,uBAAA;AAAA,IACA,CAAA,CAAA,EAAI,UAAU,CAAA,sBAAA,EAAyB,KAAK,CAAA,aAAA,EAAgB,MAAA,CAAO,IAAI,CAAC,CAAA,2EAAA;AAAA,EAE1E,CAAA;AACF;ADLA;AACA;AACE;AACF,0CAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-P6IBHZL6.cjs","sourcesContent":[null,"import { PolytypoError } from \"../errors.js\";\nimport type { Mode } from \"../types.js\";\n\n/**\n * `polytypo/text`, `polytypo/html` and `polytypo/markdown` each fix `mode` at the type level by\n * omitting it from their Options type (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md 5.1, criterion 6).\n * A plain-JS caller — or a TypeScript caller passing a wider-typed variable, which excess-property\n * checking does not catch — can still supply a conflicting `mode` at runtime. That is rejected\n * explicitly here, never silently ignored or overridden.\n */\nexport function assertFixedMode(mode: unknown, fixed: Mode, entryPoint: string): void {\n if (mode === undefined || mode === fixed) return;\n throw new PolytypoError(\n \"POLYTYPO_INVALID_MODE\",\n `\"${entryPoint}\" only supports mode \"${fixed}\". Received \"${String(mode)}\" — ` +\n `import from \"polytypo\" for the other modes, or omit \\`mode\\` here.`,\n );\n}\n"]}
|