polytypo 1.31.0 → 1.32.0

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (48) hide show
  1. package/dist/{chunk-7NSSCTBK.js → chunk-24BM7JZJ.js} +3 -3
  2. package/dist/{chunk-YATDFC7V.js → chunk-3ZMU6UAI.js} +2 -2
  3. package/dist/{chunk-4FDTU4LV.cjs → chunk-3ZOBO7VH.cjs} +6 -6
  4. package/dist/{chunk-4FDTU4LV.cjs.map → chunk-3ZOBO7VH.cjs.map} +1 -1
  5. package/dist/{chunk-HY3GXZAZ.js → chunk-4CPAE6PG.js} +3 -1
  6. package/dist/chunk-4CPAE6PG.js.map +1 -0
  7. package/dist/{chunk-DNFGA3PK.js → chunk-5Q77FSKG.js} +2 -2
  8. package/dist/chunk-5YZGZOEG.cjs +34 -0
  9. package/dist/{chunk-CFVUGAEQ.cjs.map → chunk-5YZGZOEG.cjs.map} +1 -1
  10. package/dist/{chunk-N5VKLPIT.cjs → chunk-DXQXPBIO.cjs} +23 -23
  11. package/dist/{chunk-N5VKLPIT.cjs.map → chunk-DXQXPBIO.cjs.map} +1 -1
  12. package/dist/chunk-FFEPGPF4.cjs +36 -0
  13. package/dist/{chunk-JG33G4ZR.cjs.map → chunk-FFEPGPF4.cjs.map} +1 -1
  14. package/dist/{chunk-CWHCIX7Q.js → chunk-FPPWQPZD.js} +4 -4
  15. package/dist/{chunk-TWPD6PZY.cjs → chunk-GKIMUEW3.cjs} +3 -1
  16. package/dist/chunk-GKIMUEW3.cjs.map +1 -0
  17. package/dist/{chunk-2EEO3SUH.js → chunk-GSXMWBWM.js} +3 -3
  18. package/dist/{chunk-LHDMQYVE.js → chunk-NE3CHQOZ.js} +2 -2
  19. package/dist/{chunk-BFRFZXOI.cjs → chunk-S7UE6GOZ.cjs} +3 -3
  20. package/dist/{chunk-BFRFZXOI.cjs.map → chunk-S7UE6GOZ.cjs.map} +1 -1
  21. package/dist/{chunk-4GW2ZMIG.cjs → chunk-THV4TTXH.cjs} +4 -4
  22. package/dist/{chunk-4GW2ZMIG.cjs.map → chunk-THV4TTXH.cjs.map} +1 -1
  23. package/dist/{chunk-2GDHU7YJ.js → chunk-TYYF7SJ3.js} +2 -2
  24. package/dist/chunk-UYZCANG2.cjs +38 -0
  25. package/dist/{chunk-QOW2MY3I.cjs.map → chunk-UYZCANG2.cjs.map} +1 -1
  26. package/dist/html.cjs +9 -9
  27. package/dist/html.js +4 -4
  28. package/dist/index.cjs +17 -17
  29. package/dist/index.js +7 -7
  30. package/dist/markdown.cjs +10 -10
  31. package/dist/markdown.js +5 -5
  32. package/dist/text.cjs +8 -8
  33. package/dist/text.js +3 -3
  34. package/dist/yaml.cjs +9 -9
  35. package/dist/yaml.js +4 -4
  36. package/package.json +1 -1
  37. package/dist/chunk-CFVUGAEQ.cjs +0 -34
  38. package/dist/chunk-HY3GXZAZ.js.map +0 -1
  39. package/dist/chunk-JG33G4ZR.cjs +0 -36
  40. package/dist/chunk-QOW2MY3I.cjs +0 -38
  41. package/dist/chunk-TWPD6PZY.cjs.map +0 -1
  42. /package/dist/{chunk-7NSSCTBK.js.map → chunk-24BM7JZJ.js.map} +0 -0
  43. /package/dist/{chunk-YATDFC7V.js.map → chunk-3ZMU6UAI.js.map} +0 -0
  44. /package/dist/{chunk-DNFGA3PK.js.map → chunk-5Q77FSKG.js.map} +0 -0
  45. /package/dist/{chunk-CWHCIX7Q.js.map → chunk-FPPWQPZD.js.map} +0 -0
  46. /package/dist/{chunk-2EEO3SUH.js.map → chunk-GSXMWBWM.js.map} +0 -0
  47. /package/dist/{chunk-LHDMQYVE.js.map → chunk-NE3CHQOZ.js.map} +0 -0
  48. /package/dist/{chunk-2GDHU7YJ.js.map → chunk-TYYF7SJ3.js.map} +0 -0
@@ -1,7 +1,7 @@
1
1
  import {
2
2
  resolveYamlKeys,
3
3
  yamlSpans
4
- } from "./chunk-2GDHU7YJ.js";
4
+ } from "./chunk-TYYF7SJ3.js";
5
5
  import {
6
6
  analyzeOverSpans,
7
7
  assertNoProtect,
@@ -9,7 +9,7 @@ import {
9
9
  planRules,
10
10
  resolveNarrowTarget,
11
11
  runOverSpans
12
- } from "./chunk-HY3GXZAZ.js";
12
+ } from "./chunk-4CPAE6PG.js";
13
13
 
14
14
  // src/engine/yaml-pipeline.ts
15
15
  function runYamlPipeline(input, options) {
@@ -33,4 +33,4 @@ export {
33
33
  runYamlPipeline,
34
34
  analyzeYamlPipeline
35
35
  };
36
- //# sourceMappingURL=chunk-2EEO3SUH.js.map
36
+ //# sourceMappingURL=chunk-GSXMWBWM.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PolytypoError
3
- } from "./chunk-HY3GXZAZ.js";
3
+ } from "./chunk-4CPAE6PG.js";
4
4
 
5
5
  // src/modes/html.ts
6
6
  import { parse, parseFragment } from "parse5";
@@ -248,4 +248,4 @@ export {
248
248
  htmlSpans,
249
249
  htmlFragmentSpans
250
250
  };
251
- //# sourceMappingURL=chunk-LHDMQYVE.js.map
251
+ //# sourceMappingURL=chunk-NE3CHQOZ.js.map
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkTWPD6PZYcjs = require('./chunk-TWPD6PZY.cjs');
3
+ var _chunkGKIMUEW3cjs = require('./chunk-GKIMUEW3.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, _chunkTWPD6PZYcjs.PolytypoError)(
8
+ throw new (0, _chunkGKIMUEW3cjs.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-BFRFZXOI.cjs.map
17
+ //# sourceMappingURL=chunk-S7UE6GOZ.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-BFRFZXOI.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-BFRFZXOI.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"]}
1
+ {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-S7UE6GOZ.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-S7UE6GOZ.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"]}
@@ -1,6 +1,6 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkTWPD6PZYcjs = require('./chunk-TWPD6PZY.cjs');
3
+ var _chunkGKIMUEW3cjs = require('./chunk-GKIMUEW3.cjs');
4
4
 
5
5
  // src/modes/html.ts
6
6
  var _parse5 = require('parse5');
@@ -20,8 +20,8 @@ function wrapParserErrors(what, run) {
20
20
  try {
21
21
  return run();
22
22
  } catch (error) {
23
- if (error instanceof _chunkTWPD6PZYcjs.PolytypoError) throw error;
24
- throw new (0, _chunkTWPD6PZYcjs.PolytypoError)(
23
+ if (error instanceof _chunkGKIMUEW3cjs.PolytypoError) throw error;
24
+ throw new (0, _chunkGKIMUEW3cjs.PolytypoError)(
25
25
  "POLYTYPO_MALFORMED_INPUT",
26
26
  `Input does not parse as ${what}: ${describe(error)}`
27
27
  );
@@ -248,4 +248,4 @@ function htmlFragmentSpans(source, offset) {
248
248
 
249
249
 
250
250
  exports.wrapParserErrors = wrapParserErrors; exports.SKIPPED_ELEMENTS = SKIPPED_ELEMENTS; exports.isSkippedElement = isSkippedElement; exports.htmlSpans = htmlSpans; exports.htmlFragmentSpans = htmlFragmentSpans;
251
- //# sourceMappingURL=chunk-4GW2ZMIG.cjs.map
251
+ //# sourceMappingURL=chunk-THV4TTXH.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-4GW2ZMIG.cjs","../src/modes/html.ts","../src/modes/parse-error.ts"],"names":[],"mappings":"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","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-4GW2ZMIG.cjs","sourcesContent":[null,"import { parse, parseFragment } from \"parse5\";\nimport type { DefaultTreeAdapterMap } from \"parse5\";\nimport { wrapParserErrors } from \"./parse-error.js\";\nimport type { Span } from \"./spans.js\";\n\ntype Node = DefaultTreeAdapterMap[\"node\"];\ntype ParentNode = DefaultTreeAdapterMap[\"parentNode\"];\n\n/**\n * spec/rules/modes.md 3.6, exhaustive and **closed**: extending it is a spec change, not an\n * implementation decision. `svg` and `math` are here because in MathML a quotation mark, a\n * hyphen and a prime are operators and identifiers — substituting a curly glyph changes what\n * the expression means. Everything not listed is processable, **including unknown and custom\n * elements**: guessing from a tag name is exactly the heuristic that diverges across runtimes.\n */\nexport const SKIPPED_ELEMENTS: readonly string[] = Object.freeze([\n \"code\",\n \"pre\",\n \"kbd\",\n \"samp\",\n \"var\",\n \"script\",\n \"style\",\n \"textarea\",\n \"svg\",\n \"math\",\n]);\n\nconst SKIPPED_ELEMENT_SET: ReadonlySet<string> = new Set(SKIPPED_ELEMENTS);\n\nexport function isSkippedElement(tagName: string): boolean {\n return SKIPPED_ELEMENT_SET.has(tagName);\n}\n\nconst AMPERSAND = 0x26;\nconst SEMICOLON = 0x3b;\nconst HASH = 0x23;\nconst LOWER_X = 0x78;\nconst UPPER_X = 0x58;\n\n/** Longest named reference in the WHATWG table is 32 characters; the guard is a bound, not a rule. */\nconst MAX_REFERENCE_BODY = 34;\n\nfunction isAsciiDigit(unit: number): boolean {\n return unit >= 0x30 && unit <= 0x39;\n}\n\nfunction isAsciiHexDigit(unit: number): boolean {\n return isAsciiDigit(unit) || (unit >= 0x61 && unit <= 0x66) || (unit >= 0x41 && unit <= 0x46);\n}\n\nfunction isAsciiAlphanumeric(unit: number): boolean {\n return isAsciiDigit(unit) || (unit >= 0x61 && unit <= 0x7a) || (unit >= 0x41 && unit <= 0x5a);\n}\n\n/**\n * The end offset of a well-formed character reference starting at `at`, or -1. A bare `&` that a\n * parser would repair is deliberately **not** treated as a reference: it stays inside the span,\n * where no rule can emit or delete it, rather than manufacturing a boundary that suppresses\n * conversions around it.\n */\nfunction characterReferenceEnd(source: string, at: number, limit: number): number {\n if (source.charCodeAt(at) !== AMPERSAND) return -1;\n let i = at + 1;\n if (i >= limit) return -1;\n\n if (source.charCodeAt(i) === HASH) {\n i += 1;\n const unit = i < limit ? source.charCodeAt(i) : -1;\n const hex = unit === LOWER_X || unit === UPPER_X;\n if (hex) i += 1;\n const digitsAt = i;\n while (\n i < limit &&\n (hex ? isAsciiHexDigit(source.charCodeAt(i)) : isAsciiDigit(source.charCodeAt(i)))\n ) {\n i += 1;\n }\n if (i === digitsAt) return -1;\n return i < limit && source.charCodeAt(i) === SEMICOLON ? i + 1 : -1;\n }\n\n const nameAt = i;\n while (\n i < limit &&\n i - nameAt < MAX_REFERENCE_BODY &&\n isAsciiAlphanumeric(source.charCodeAt(i))\n ) {\n i += 1;\n }\n if (i === nameAt) return -1;\n return i < limit && source.charCodeAt(i) === SEMICOLON ? i + 1 : -1;\n}\n\n/**\n * modes.md 3.6: every character reference is skipped as an **opaque unit**, and a text node\n * containing one is split into spans around it. That is the only way `&nbsp;` survives as\n * `&nbsp;` instead of becoming a literal U+00A0 on the way out.\n */\nexport function splitCharacterReferences(source: string, start: number, end: number): Span[] {\n const spans: Span[] = [];\n let cursor = start;\n let i = start;\n while (i < end) {\n if (source.charCodeAt(i) === AMPERSAND) {\n const stop = characterReferenceEnd(source, i, end);\n if (stop > 0) {\n if (i > cursor) spans.push({ start: cursor, end: i });\n cursor = stop;\n i = stop;\n continue;\n }\n }\n i += 1;\n }\n if (end > cursor) spans.push({ start: cursor, end });\n return spans;\n}\n\nfunction isParent(node: Node): node is ParentNode {\n return \"childNodes\" in node;\n}\n\n/**\n * modes.md 3.6 (spec 1.23.0): a text node of only U+0009, U+000A, U+000C, U+000D and U+0020 that\n * holds a line break is not a span, so the gap around it carries the raw line break and 3.2\n * picks the line marker. Pretty-printed markup then reads as `text` mode reads the same lines.\n */\nfunction isLineBreakWhitespace(source: string, start: number, end: number): boolean {\n let hasLineBreak = false;\n for (let i = start; i < end; i += 1) {\n const c = source.charCodeAt(i);\n if (c === 0x0a || c === 0x0c || c === 0x0d) hasLineBreak = true;\n else if (c !== 0x09 && c !== 0x20) return false;\n }\n return hasLineBreak;\n}\n\nconst LESS_THAN = 0x3c;\nconst SOLIDUS = 0x2f;\nconst GREATER_THAN = 0x3e;\nconst EQUALS = 0x3d;\n\nfunction isAsciiAlpha(unit: number): boolean {\n return (unit >= 0x41 && unit <= 0x5a) || (unit >= 0x61 && unit <= 0x7a);\n}\n\nfunction isTagSpace(unit: number): boolean {\n return unit === 0x09 || unit === 0x0a || unit === 0x0c || unit === 0x0d || unit === 0x20;\n}\n\n/**\n * The offset just past the tag that starts at `at`, or -1 when no tag starts there. Follows the\n * HTML tokenizer: `<` plus a letter, `</` plus a letter, or `</>`. A quote opens a value only in\n * the before-attribute-value state, reached by an `=` that follows an attribute name; an `=` that\n * begins a name, or sits inside an unquoted value, is data.\n */\nfunction tagEnd(source: string, at: number, limit: number): number {\n if (source.charCodeAt(at) !== LESS_THAN) return -1;\n let i = at + 1;\n if (i >= limit) return -1;\n if (source.charCodeAt(i) === SOLIDUS) {\n i += 1;\n if (i >= limit) return -1;\n if (source.charCodeAt(i) === GREATER_THAN) return i + 1;\n }\n if (!isAsciiAlpha(source.charCodeAt(i))) return -1;\n // tag name\n while (i < limit) {\n const c = source.charCodeAt(i);\n if (isTagSpace(c) || c === SOLIDUS || c === GREATER_THAN) break;\n i += 1;\n }\n while (i < limit) {\n // before attribute name\n let c = source.charCodeAt(i);\n if (isTagSpace(c) || c === SOLIDUS) {\n i += 1;\n continue;\n }\n if (c === GREATER_THAN) return i + 1;\n // attribute name: an `=` first in the name is part of it\n i += 1;\n while (i < limit) {\n c = source.charCodeAt(i);\n if (isTagSpace(c) || c === SOLIDUS || c === GREATER_THAN || c === EQUALS) break;\n i += 1;\n }\n // after attribute name\n while (i < limit && isTagSpace(source.charCodeAt(i))) i += 1;\n if (i >= limit) return -1;\n c = source.charCodeAt(i);\n if (c === GREATER_THAN) return i + 1;\n if (c !== EQUALS) continue;\n // before attribute value\n i += 1;\n while (i < limit && isTagSpace(source.charCodeAt(i))) i += 1;\n if (i >= limit) return -1;\n c = source.charCodeAt(i);\n if (c === GREATER_THAN) return i + 1;\n if (c === 0x22 || c === 0x27) {\n const close = source.indexOf(c === 0x22 ? '\"' : \"'\", i + 1);\n if (close === -1 || close >= limit) return -1;\n i = close + 1;\n continue;\n }\n while (i < limit) {\n c = source.charCodeAt(i);\n if (isTagSpace(c) || c === GREATER_THAN) break;\n i += 1;\n }\n }\n return -1;\n}\n\n/**\n * modes.md 3.6 (spec 1.23.1): a tag the parser ignores is still a tag in the source, and parse5\n * merges the text on either side of it into one node. Splitting the run at every tag-shaped token\n * keeps the tag outside every span and puts it in the gap, where 3.2 chooses the marker.\n */\nfunction textPieces(source: string, start: number, end: number): Array<[number, number]> {\n const pieces: Array<[number, number]> = [];\n let cursor = start;\n let i = start;\n while (i < end) {\n if (source.charCodeAt(i) === LESS_THAN) {\n const stop = tagEnd(source, i, end);\n if (stop > 0) {\n if (i > cursor) pieces.push([cursor, i]);\n cursor = stop;\n i = stop;\n continue;\n }\n }\n i += 1;\n }\n if (end > cursor) pieces.push([cursor, end]);\n return pieces;\n}\n\n// Their text is character data, not markup: `<` begins no tag inside them (HTML tokenizer RCDATA,\n// RAWTEXT and PLAINTEXT states), so textPieces must not look for one.\nconst TEXT_ONLY_PARENTS = new Set([\n \"title\",\n \"xmp\",\n \"iframe\",\n \"noembed\",\n \"noframes\",\n \"noscript\",\n \"plaintext\",\n]);\n\nfunction collect(node: Node, source: string, spans: Span[], isTextOnly = false): void {\n if (node.nodeName === \"#text\") {\n const location = node.sourceCodeLocation;\n if (location === undefined || location === null) return;\n const pieces = isTextOnly\n ? ([[location.startOffset, location.endOffset]] as Array<[number, number]>)\n : textPieces(source, location.startOffset, location.endOffset);\n for (const [from, to] of pieces) {\n if (isLineBreakWhitespace(source, from, to)) continue;\n for (const span of splitCharacterReferences(source, from, to)) spans.push(span);\n }\n return;\n }\n\n // Comments, doctype and processing instructions never contribute a span (modes.md 3.6).\n if (node.nodeName === \"#comment\" || node.nodeName === \"#documentType\") return;\n\n if (\"tagName\" in node && isSkippedElement(node.tagName)) return;\n\n // A `template`'s children live in a separate document fragment; `template` is not skipped.\n if (node.nodeName === \"template\" && \"content\" in node) {\n collect(node.content, source, spans);\n return;\n }\n\n if (!isParent(node)) return;\n const textOnly = \"tagName\" in node && TEXT_ONLY_PARENTS.has(node.tagName);\n for (const child of node.childNodes) collect(child, source, spans, textOnly);\n}\n\n/**\n * Locate the processable spans of an HTML document. The tree is used only to find offsets and is\n * then discarded — modes.md 4 forbids reserialisation, which is what makes attribute quoting,\n * self-closing forms, entity spelling, tag case and malformed-input recovery preserved by\n * construction rather than by effort.\n */\nexport function htmlSpans(source: string): Span[] {\n const document = wrapParserErrors(\"HTML\", () => parse(source, { sourceCodeLocationInfo: true }));\n const spans: Span[] = [];\n collect(document, source, spans);\n return spans;\n}\n\n/** The same, for a fragment: used for HTML blocks embedded in markdown (modes.md 3.7). */\nexport function htmlFragmentSpans(source: string, offset: number): Span[] {\n const fragment = wrapParserErrors(\"HTML\", () =>\n parseFragment(source, { sourceCodeLocationInfo: true }),\n );\n const spans: Span[] = [];\n collect(fragment, source, spans);\n return offset === 0\n ? spans\n : spans.map((span) => ({ start: span.start + offset, end: span.end + offset }));\n}\n","import { PolytypoError } from \"../errors.js\";\n\ninterface PositionedError {\n readonly reason?: unknown;\n readonly place?: { readonly line?: unknown; readonly column?: unknown } | null;\n}\n\nfunction describe(error: unknown): string {\n if (typeof error !== \"object\" || error === null) return String(error);\n const positioned = error as PositionedError;\n const reason =\n typeof positioned.reason === \"string\" ? positioned.reason : (error as Error).message;\n const place = positioned.place;\n if (\n place !== null &&\n place !== undefined &&\n typeof place.line === \"number\" &&\n typeof place.column === \"number\"\n ) {\n return `${reason} (line ${place.line}, column ${place.column})`;\n }\n return reason;\n}\n\n/**\n * spec/rules/modes.md 3.7.2. **The parser's own error type must never escape.** A\n * `VFileMessage`, a `Nokogiri::SyntaxError` or a Python exception on the public surface puts a\n * dependency's type into the contract and is unreproducible in the other four runtimes; only the\n * code is contractual (ARCHITECTURE.md 4.6), while the message and the source position are\n * useful and are not.\n *\n * Reachable in exactly one place: `dialect: \"mdx\"`, because MDX embeds JavaScript. HTML parsing\n * is specified with total error recovery and every byte sequence is valid CommonMark, so neither\n * of the other two languages can fail. The wrapper is applied to all of them anyway — the\n * guarantee is that no parser type escapes, not that this particular parser is trusted.\n */\nexport function wrapParserErrors<T>(what: string, run: () => T): T {\n try {\n return run();\n } catch (error) {\n if (error instanceof PolytypoError) throw error;\n throw new PolytypoError(\n \"POLYTYPO_MALFORMED_INPUT\",\n `Input does not parse as ${what}: ${describe(error)}`,\n );\n }\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-THV4TTXH.cjs","../src/modes/html.ts","../src/modes/parse-error.ts"],"names":[],"mappings":"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","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-THV4TTXH.cjs","sourcesContent":[null,"import { parse, parseFragment } from \"parse5\";\nimport type { DefaultTreeAdapterMap } from \"parse5\";\nimport { wrapParserErrors } from \"./parse-error.js\";\nimport type { Span } from \"./spans.js\";\n\ntype Node = DefaultTreeAdapterMap[\"node\"];\ntype ParentNode = DefaultTreeAdapterMap[\"parentNode\"];\n\n/**\n * spec/rules/modes.md 3.6, exhaustive and **closed**: extending it is a spec change, not an\n * implementation decision. `svg` and `math` are here because in MathML a quotation mark, a\n * hyphen and a prime are operators and identifiers — substituting a curly glyph changes what\n * the expression means. Everything not listed is processable, **including unknown and custom\n * elements**: guessing from a tag name is exactly the heuristic that diverges across runtimes.\n */\nexport const SKIPPED_ELEMENTS: readonly string[] = Object.freeze([\n \"code\",\n \"pre\",\n \"kbd\",\n \"samp\",\n \"var\",\n \"script\",\n \"style\",\n \"textarea\",\n \"svg\",\n \"math\",\n]);\n\nconst SKIPPED_ELEMENT_SET: ReadonlySet<string> = new Set(SKIPPED_ELEMENTS);\n\nexport function isSkippedElement(tagName: string): boolean {\n return SKIPPED_ELEMENT_SET.has(tagName);\n}\n\nconst AMPERSAND = 0x26;\nconst SEMICOLON = 0x3b;\nconst HASH = 0x23;\nconst LOWER_X = 0x78;\nconst UPPER_X = 0x58;\n\n/** Longest named reference in the WHATWG table is 32 characters; the guard is a bound, not a rule. */\nconst MAX_REFERENCE_BODY = 34;\n\nfunction isAsciiDigit(unit: number): boolean {\n return unit >= 0x30 && unit <= 0x39;\n}\n\nfunction isAsciiHexDigit(unit: number): boolean {\n return isAsciiDigit(unit) || (unit >= 0x61 && unit <= 0x66) || (unit >= 0x41 && unit <= 0x46);\n}\n\nfunction isAsciiAlphanumeric(unit: number): boolean {\n return isAsciiDigit(unit) || (unit >= 0x61 && unit <= 0x7a) || (unit >= 0x41 && unit <= 0x5a);\n}\n\n/**\n * The end offset of a well-formed character reference starting at `at`, or -1. A bare `&` that a\n * parser would repair is deliberately **not** treated as a reference: it stays inside the span,\n * where no rule can emit or delete it, rather than manufacturing a boundary that suppresses\n * conversions around it.\n */\nfunction characterReferenceEnd(source: string, at: number, limit: number): number {\n if (source.charCodeAt(at) !== AMPERSAND) return -1;\n let i = at + 1;\n if (i >= limit) return -1;\n\n if (source.charCodeAt(i) === HASH) {\n i += 1;\n const unit = i < limit ? source.charCodeAt(i) : -1;\n const hex = unit === LOWER_X || unit === UPPER_X;\n if (hex) i += 1;\n const digitsAt = i;\n while (\n i < limit &&\n (hex ? isAsciiHexDigit(source.charCodeAt(i)) : isAsciiDigit(source.charCodeAt(i)))\n ) {\n i += 1;\n }\n if (i === digitsAt) return -1;\n return i < limit && source.charCodeAt(i) === SEMICOLON ? i + 1 : -1;\n }\n\n const nameAt = i;\n while (\n i < limit &&\n i - nameAt < MAX_REFERENCE_BODY &&\n isAsciiAlphanumeric(source.charCodeAt(i))\n ) {\n i += 1;\n }\n if (i === nameAt) return -1;\n return i < limit && source.charCodeAt(i) === SEMICOLON ? i + 1 : -1;\n}\n\n/**\n * modes.md 3.6: every character reference is skipped as an **opaque unit**, and a text node\n * containing one is split into spans around it. That is the only way `&nbsp;` survives as\n * `&nbsp;` instead of becoming a literal U+00A0 on the way out.\n */\nexport function splitCharacterReferences(source: string, start: number, end: number): Span[] {\n const spans: Span[] = [];\n let cursor = start;\n let i = start;\n while (i < end) {\n if (source.charCodeAt(i) === AMPERSAND) {\n const stop = characterReferenceEnd(source, i, end);\n if (stop > 0) {\n if (i > cursor) spans.push({ start: cursor, end: i });\n cursor = stop;\n i = stop;\n continue;\n }\n }\n i += 1;\n }\n if (end > cursor) spans.push({ start: cursor, end });\n return spans;\n}\n\nfunction isParent(node: Node): node is ParentNode {\n return \"childNodes\" in node;\n}\n\n/**\n * modes.md 3.6 (spec 1.23.0): a text node of only U+0009, U+000A, U+000C, U+000D and U+0020 that\n * holds a line break is not a span, so the gap around it carries the raw line break and 3.2\n * picks the line marker. Pretty-printed markup then reads as `text` mode reads the same lines.\n */\nfunction isLineBreakWhitespace(source: string, start: number, end: number): boolean {\n let hasLineBreak = false;\n for (let i = start; i < end; i += 1) {\n const c = source.charCodeAt(i);\n if (c === 0x0a || c === 0x0c || c === 0x0d) hasLineBreak = true;\n else if (c !== 0x09 && c !== 0x20) return false;\n }\n return hasLineBreak;\n}\n\nconst LESS_THAN = 0x3c;\nconst SOLIDUS = 0x2f;\nconst GREATER_THAN = 0x3e;\nconst EQUALS = 0x3d;\n\nfunction isAsciiAlpha(unit: number): boolean {\n return (unit >= 0x41 && unit <= 0x5a) || (unit >= 0x61 && unit <= 0x7a);\n}\n\nfunction isTagSpace(unit: number): boolean {\n return unit === 0x09 || unit === 0x0a || unit === 0x0c || unit === 0x0d || unit === 0x20;\n}\n\n/**\n * The offset just past the tag that starts at `at`, or -1 when no tag starts there. Follows the\n * HTML tokenizer: `<` plus a letter, `</` plus a letter, or `</>`. A quote opens a value only in\n * the before-attribute-value state, reached by an `=` that follows an attribute name; an `=` that\n * begins a name, or sits inside an unquoted value, is data.\n */\nfunction tagEnd(source: string, at: number, limit: number): number {\n if (source.charCodeAt(at) !== LESS_THAN) return -1;\n let i = at + 1;\n if (i >= limit) return -1;\n if (source.charCodeAt(i) === SOLIDUS) {\n i += 1;\n if (i >= limit) return -1;\n if (source.charCodeAt(i) === GREATER_THAN) return i + 1;\n }\n if (!isAsciiAlpha(source.charCodeAt(i))) return -1;\n // tag name\n while (i < limit) {\n const c = source.charCodeAt(i);\n if (isTagSpace(c) || c === SOLIDUS || c === GREATER_THAN) break;\n i += 1;\n }\n while (i < limit) {\n // before attribute name\n let c = source.charCodeAt(i);\n if (isTagSpace(c) || c === SOLIDUS) {\n i += 1;\n continue;\n }\n if (c === GREATER_THAN) return i + 1;\n // attribute name: an `=` first in the name is part of it\n i += 1;\n while (i < limit) {\n c = source.charCodeAt(i);\n if (isTagSpace(c) || c === SOLIDUS || c === GREATER_THAN || c === EQUALS) break;\n i += 1;\n }\n // after attribute name\n while (i < limit && isTagSpace(source.charCodeAt(i))) i += 1;\n if (i >= limit) return -1;\n c = source.charCodeAt(i);\n if (c === GREATER_THAN) return i + 1;\n if (c !== EQUALS) continue;\n // before attribute value\n i += 1;\n while (i < limit && isTagSpace(source.charCodeAt(i))) i += 1;\n if (i >= limit) return -1;\n c = source.charCodeAt(i);\n if (c === GREATER_THAN) return i + 1;\n if (c === 0x22 || c === 0x27) {\n const close = source.indexOf(c === 0x22 ? '\"' : \"'\", i + 1);\n if (close === -1 || close >= limit) return -1;\n i = close + 1;\n continue;\n }\n while (i < limit) {\n c = source.charCodeAt(i);\n if (isTagSpace(c) || c === GREATER_THAN) break;\n i += 1;\n }\n }\n return -1;\n}\n\n/**\n * modes.md 3.6 (spec 1.23.1): a tag the parser ignores is still a tag in the source, and parse5\n * merges the text on either side of it into one node. Splitting the run at every tag-shaped token\n * keeps the tag outside every span and puts it in the gap, where 3.2 chooses the marker.\n */\nfunction textPieces(source: string, start: number, end: number): Array<[number, number]> {\n const pieces: Array<[number, number]> = [];\n let cursor = start;\n let i = start;\n while (i < end) {\n if (source.charCodeAt(i) === LESS_THAN) {\n const stop = tagEnd(source, i, end);\n if (stop > 0) {\n if (i > cursor) pieces.push([cursor, i]);\n cursor = stop;\n i = stop;\n continue;\n }\n }\n i += 1;\n }\n if (end > cursor) pieces.push([cursor, end]);\n return pieces;\n}\n\n// Their text is character data, not markup: `<` begins no tag inside them (HTML tokenizer RCDATA,\n// RAWTEXT and PLAINTEXT states), so textPieces must not look for one.\nconst TEXT_ONLY_PARENTS = new Set([\n \"title\",\n \"xmp\",\n \"iframe\",\n \"noembed\",\n \"noframes\",\n \"noscript\",\n \"plaintext\",\n]);\n\nfunction collect(node: Node, source: string, spans: Span[], isTextOnly = false): void {\n if (node.nodeName === \"#text\") {\n const location = node.sourceCodeLocation;\n if (location === undefined || location === null) return;\n const pieces = isTextOnly\n ? ([[location.startOffset, location.endOffset]] as Array<[number, number]>)\n : textPieces(source, location.startOffset, location.endOffset);\n for (const [from, to] of pieces) {\n if (isLineBreakWhitespace(source, from, to)) continue;\n for (const span of splitCharacterReferences(source, from, to)) spans.push(span);\n }\n return;\n }\n\n // Comments, doctype and processing instructions never contribute a span (modes.md 3.6).\n if (node.nodeName === \"#comment\" || node.nodeName === \"#documentType\") return;\n\n if (\"tagName\" in node && isSkippedElement(node.tagName)) return;\n\n // A `template`'s children live in a separate document fragment; `template` is not skipped.\n if (node.nodeName === \"template\" && \"content\" in node) {\n collect(node.content, source, spans);\n return;\n }\n\n if (!isParent(node)) return;\n const textOnly = \"tagName\" in node && TEXT_ONLY_PARENTS.has(node.tagName);\n for (const child of node.childNodes) collect(child, source, spans, textOnly);\n}\n\n/**\n * Locate the processable spans of an HTML document. The tree is used only to find offsets and is\n * then discarded — modes.md 4 forbids reserialisation, which is what makes attribute quoting,\n * self-closing forms, entity spelling, tag case and malformed-input recovery preserved by\n * construction rather than by effort.\n */\nexport function htmlSpans(source: string): Span[] {\n const document = wrapParserErrors(\"HTML\", () => parse(source, { sourceCodeLocationInfo: true }));\n const spans: Span[] = [];\n collect(document, source, spans);\n return spans;\n}\n\n/** The same, for a fragment: used for HTML blocks embedded in markdown (modes.md 3.7). */\nexport function htmlFragmentSpans(source: string, offset: number): Span[] {\n const fragment = wrapParserErrors(\"HTML\", () =>\n parseFragment(source, { sourceCodeLocationInfo: true }),\n );\n const spans: Span[] = [];\n collect(fragment, source, spans);\n return offset === 0\n ? spans\n : spans.map((span) => ({ start: span.start + offset, end: span.end + offset }));\n}\n","import { PolytypoError } from \"../errors.js\";\n\ninterface PositionedError {\n readonly reason?: unknown;\n readonly place?: { readonly line?: unknown; readonly column?: unknown } | null;\n}\n\nfunction describe(error: unknown): string {\n if (typeof error !== \"object\" || error === null) return String(error);\n const positioned = error as PositionedError;\n const reason =\n typeof positioned.reason === \"string\" ? positioned.reason : (error as Error).message;\n const place = positioned.place;\n if (\n place !== null &&\n place !== undefined &&\n typeof place.line === \"number\" &&\n typeof place.column === \"number\"\n ) {\n return `${reason} (line ${place.line}, column ${place.column})`;\n }\n return reason;\n}\n\n/**\n * spec/rules/modes.md 3.7.2. **The parser's own error type must never escape.** A\n * `VFileMessage`, a `Nokogiri::SyntaxError` or a Python exception on the public surface puts a\n * dependency's type into the contract and is unreproducible in the other four runtimes; only the\n * code is contractual (ARCHITECTURE.md 4.6), while the message and the source position are\n * useful and are not.\n *\n * Reachable in exactly one place: `dialect: \"mdx\"`, because MDX embeds JavaScript. HTML parsing\n * is specified with total error recovery and every byte sequence is valid CommonMark, so neither\n * of the other two languages can fail. The wrapper is applied to all of them anyway — the\n * guarantee is that no parser type escapes, not that this particular parser is trusted.\n */\nexport function wrapParserErrors<T>(what: string, run: () => T): T {\n try {\n return run();\n } catch (error) {\n if (error instanceof PolytypoError) throw error;\n throw new PolytypoError(\n \"POLYTYPO_MALFORMED_INPUT\",\n `Input does not parse as ${what}: ${describe(error)}`,\n );\n }\n}\n"]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PolytypoError
3
- } from "./chunk-HY3GXZAZ.js";
3
+ } from "./chunk-4CPAE6PG.js";
4
4
 
5
5
  // src/modes/yaml.ts
6
6
  var TAB = 9;
@@ -370,4 +370,4 @@ export {
370
370
  resolveYamlKeys,
371
371
  resolveFrontmatterKeys
372
372
  };
373
- //# sourceMappingURL=chunk-2GDHU7YJ.js.map
373
+ //# sourceMappingURL=chunk-TYYF7SJ3.js.map
@@ -0,0 +1,38 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+
12
+ var _chunkGKIMUEW3cjs = require('./chunk-GKIMUEW3.cjs');
13
+
14
+ // src/engine/text-pipeline.ts
15
+ function runTextPipeline(input, options) {
16
+ const narrowTarget = _chunkGKIMUEW3cjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
17
+ const planned = _chunkGKIMUEW3cjs.planRules.call(void 0, options.rules);
18
+ const locale = _chunkGKIMUEW3cjs.getLocaleData.call(void 0, options.locale);
19
+ const holes = _chunkGKIMUEW3cjs.resolveProtect.call(void 0, options.protect, _chunkGKIMUEW3cjs.toCodePoints.call(void 0, input).length);
20
+ if (holes.length > 0) return _chunkGKIMUEW3cjs.runProtected.call(void 0, input, holes, planned, locale, narrowTarget);
21
+ return _chunkGKIMUEW3cjs.fromCodePoints.call(void 0, _chunkGKIMUEW3cjs.runRules.call(void 0, _chunkGKIMUEW3cjs.toCodePoints.call(void 0, input), planned, locale, "text", narrowTarget));
22
+ }
23
+ function analyzeTextPipeline(input, options) {
24
+ const narrowTarget = _chunkGKIMUEW3cjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
25
+ const planned = _chunkGKIMUEW3cjs.planRules.call(void 0, options.rules);
26
+ const locale = _chunkGKIMUEW3cjs.getLocaleData.call(void 0, options.locale);
27
+ const cp = _chunkGKIMUEW3cjs.toCodePoints.call(void 0, input);
28
+ const holes = _chunkGKIMUEW3cjs.resolveProtect.call(void 0, options.protect, cp.length);
29
+ if (holes.length > 0) return _chunkGKIMUEW3cjs.analyzeProtected.call(void 0, input, holes, planned, locale, narrowTarget);
30
+ const origin = cp.map((_value, index) => index);
31
+ return _chunkGKIMUEW3cjs.runRulesRecording.call(void 0, cp, planned, locale, "text", narrowTarget, origin, cp.length);
32
+ }
33
+
34
+
35
+
36
+
37
+ exports.runTextPipeline = runTextPipeline; exports.analyzeTextPipeline = analyzeTextPipeline;
38
+ //# sourceMappingURL=chunk-UYZCANG2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-QOW2MY3I.cjs","../src/engine/text-pipeline.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACMO,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,8CAAA,OAAe,CAAQ,OAAA,EAAS,4CAAA,KAAkB,CAAA,CAAE,MAAM,CAAA;AACxE,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,EAAS,CAAA,EAAG,OAAO,4CAAA,KAAa,EAAO,KAAA,EAAO,OAAA,EAAS,MAAA,EAAQ,YAAY,CAAA;AACrF,EAAA,OAAO,8CAAA,wCAAe,4CAAS,KAAkB,CAAA,EAAG,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,YAAY,CAAC,CAAA;AAC5F;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,GAAA,EAAK,4CAAA,KAAkB,CAAA;AAC7B,EAAA,MAAM,MAAA,EAAQ,8CAAA,OAAe,CAAQ,OAAA,EAAS,EAAA,CAAG,MAAM,CAAA;AACvD,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,EAAS,CAAA,EAAG,OAAO,gDAAA,KAAiB,EAAO,KAAA,EAAO,OAAA,EAAS,MAAA,EAAQ,YAAY,CAAA;AACzF,EAAA,MAAM,OAAA,EAAS,EAAA,CAAG,GAAA,CAAI,CAAC,MAAA,EAAQ,KAAA,EAAA,GAAU,KAAK,CAAA;AAC9C,EAAA,OAAO,iDAAA,EAAkB,EAAI,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,YAAA,EAAc,MAAA,EAAQ,EAAA,CAAG,MAAM,CAAA;AACvF;ADNA;AACA;AACE;AACA;AACF,6FAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-QOW2MY3I.cjs","sourcesContent":[null,"import type { Options } from \"../types.js\";\nimport { fromCodePoints, toCodePoints } from \"./codepoints.js\";\nimport type { Change } from \"./origin.js\";\nimport { getLocaleData } from \"./locale.js\";\nimport { resolveNarrowTarget } from \"./narrow-target.js\";\nimport { planRules, runRules, runRulesRecording } from \"./rule-runner.js\";\nimport { analyzeProtected, resolveProtect, runProtected } from \"./protect.js\";\n\n/**\n * `text` mode only. Deliberately imports nothing from `../modes/html.js` or\n * `../modes/markdown.js` (or their parser dependencies) — this is what makes `polytypo/text`'s\n * module graph exclude `parse5` and the Micromark stack (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md\n * 5.1).\n *\n * Validation order — `planRules` before `getLocaleData` — mirrors the pre-Stage-5 aggregate\n * `runPipeline` exactly (an unknown-rule error must win over an unknown-locale error when both\n * are present, since that is public, tested behaviour, not an implementation detail this\n * refactor was authorised to change).\n */\nexport function runTextPipeline(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 holes = resolveProtect(options.protect, toCodePoints(input).length);\n if (holes.length > 0) return runProtected(input, holes, planned, locale, narrowTarget);\n return fromCodePoints(runRules(toCodePoints(input), planned, locale, \"text\", narrowTarget));\n}\n\n/** analyze.md §1: the same pipeline as `runTextPipeline`, reporting instead of applying. */\nexport function analyzeTextPipeline(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 cp = toCodePoints(input);\n const holes = resolveProtect(options.protect, cp.length);\n if (holes.length > 0) return analyzeProtected(input, holes, planned, locale, narrowTarget);\n const origin = cp.map((_value, index) => index);\n return runRulesRecording(cp, planned, locale, \"text\", narrowTarget, origin, cp.length);\n}\n"]}
1
+ {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-UYZCANG2.cjs","../src/engine/text-pipeline.ts"],"names":[],"mappings":"AAAA;AACE;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACA;AACF,wDAA6B;AAC7B;AACA;ACMO,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,8CAAA,OAAe,CAAQ,OAAA,EAAS,4CAAA,KAAkB,CAAA,CAAE,MAAM,CAAA;AACxE,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,EAAS,CAAA,EAAG,OAAO,4CAAA,KAAa,EAAO,KAAA,EAAO,OAAA,EAAS,MAAA,EAAQ,YAAY,CAAA;AACrF,EAAA,OAAO,8CAAA,wCAAe,4CAAS,KAAkB,CAAA,EAAG,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,YAAY,CAAC,CAAA;AAC5F;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,GAAA,EAAK,4CAAA,KAAkB,CAAA;AAC7B,EAAA,MAAM,MAAA,EAAQ,8CAAA,OAAe,CAAQ,OAAA,EAAS,EAAA,CAAG,MAAM,CAAA;AACvD,EAAA,GAAA,CAAI,KAAA,CAAM,OAAA,EAAS,CAAA,EAAG,OAAO,gDAAA,KAAiB,EAAO,KAAA,EAAO,OAAA,EAAS,MAAA,EAAQ,YAAY,CAAA;AACzF,EAAA,MAAM,OAAA,EAAS,EAAA,CAAG,GAAA,CAAI,CAAC,MAAA,EAAQ,KAAA,EAAA,GAAU,KAAK,CAAA;AAC9C,EAAA,OAAO,iDAAA,EAAkB,EAAI,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,YAAA,EAAc,MAAA,EAAQ,EAAA,CAAG,MAAM,CAAA;AACvF;ADNA;AACA;AACE;AACA;AACF,6FAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-UYZCANG2.cjs","sourcesContent":[null,"import type { Options } from \"../types.js\";\nimport { fromCodePoints, toCodePoints } from \"./codepoints.js\";\nimport type { Change } from \"./origin.js\";\nimport { getLocaleData } from \"./locale.js\";\nimport { resolveNarrowTarget } from \"./narrow-target.js\";\nimport { planRules, runRules, runRulesRecording } from \"./rule-runner.js\";\nimport { analyzeProtected, resolveProtect, runProtected } from \"./protect.js\";\n\n/**\n * `text` mode only. Deliberately imports nothing from `../modes/html.js` or\n * `../modes/markdown.js` (or their parser dependencies) — this is what makes `polytypo/text`'s\n * module graph exclude `parse5` and the Micromark stack (AUDIT_REMEDIATION_AND_RELEASE_PLAN.md\n * 5.1).\n *\n * Validation order — `planRules` before `getLocaleData` — mirrors the pre-Stage-5 aggregate\n * `runPipeline` exactly (an unknown-rule error must win over an unknown-locale error when both\n * are present, since that is public, tested behaviour, not an implementation detail this\n * refactor was authorised to change).\n */\nexport function runTextPipeline(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 holes = resolveProtect(options.protect, toCodePoints(input).length);\n if (holes.length > 0) return runProtected(input, holes, planned, locale, narrowTarget);\n return fromCodePoints(runRules(toCodePoints(input), planned, locale, \"text\", narrowTarget));\n}\n\n/** analyze.md §1: the same pipeline as `runTextPipeline`, reporting instead of applying. */\nexport function analyzeTextPipeline(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 cp = toCodePoints(input);\n const holes = resolveProtect(options.protect, cp.length);\n if (holes.length > 0) return analyzeProtected(input, holes, planned, locale, narrowTarget);\n const origin = cp.map((_value, index) => index);\n return runRulesRecording(cp, planned, locale, \"text\", narrowTarget, origin, cp.length);\n}\n"]}
package/dist/html.cjs CHANGED
@@ -1,32 +1,32 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunkCFVUGAEQcjs = require('./chunk-CFVUGAEQ.cjs');
4
+ var _chunk5YZGZOEGcjs = require('./chunk-5YZGZOEG.cjs');
5
5
 
6
6
 
7
- var _chunk4GW2ZMIGcjs = require('./chunk-4GW2ZMIG.cjs');
7
+ var _chunkTHV4TTXHcjs = require('./chunk-THV4TTXH.cjs');
8
8
 
9
9
 
10
- var _chunkBFRFZXOIcjs = require('./chunk-BFRFZXOI.cjs');
10
+ var _chunkS7UE6GOZcjs = require('./chunk-S7UE6GOZ.cjs');
11
11
 
12
12
 
13
- var _chunkTWPD6PZYcjs = require('./chunk-TWPD6PZY.cjs');
13
+ var _chunkGKIMUEW3cjs = require('./chunk-GKIMUEW3.cjs');
14
14
 
15
15
  // src/index.html.ts
16
16
  function transform(input, options) {
17
17
  const given = _nullishCoalesce(options, () => ( {}));
18
- _chunkBFRFZXOIcjs.assertFixedMode.call(void 0, given.mode, "html", "polytypo/html");
19
- return _chunkCFVUGAEQcjs.runHtmlPipeline.call(void 0, input, given);
18
+ _chunkS7UE6GOZcjs.assertFixedMode.call(void 0, given.mode, "html", "polytypo/html");
19
+ return _chunk5YZGZOEGcjs.runHtmlPipeline.call(void 0, input, given);
20
20
  }
21
21
  function analyze(input, options) {
22
22
  const given = _nullishCoalesce(options, () => ( {}));
23
- _chunkBFRFZXOIcjs.assertFixedMode.call(void 0, given.mode, "html", "polytypo/html");
24
- return _chunkCFVUGAEQcjs.analyzeHtmlPipeline.call(void 0, input, given);
23
+ _chunkS7UE6GOZcjs.assertFixedMode.call(void 0, given.mode, "html", "polytypo/html");
24
+ return _chunk5YZGZOEGcjs.analyzeHtmlPipeline.call(void 0, input, given);
25
25
  }
26
26
 
27
27
 
28
28
 
29
29
 
30
30
 
31
- exports.PolytypoError = _chunkTWPD6PZYcjs.PolytypoError; exports.SKIPPED_ELEMENTS = _chunk4GW2ZMIGcjs.SKIPPED_ELEMENTS; exports.analyze = analyze; exports.transform = transform;
31
+ exports.PolytypoError = _chunkGKIMUEW3cjs.PolytypoError; exports.SKIPPED_ELEMENTS = _chunkTHV4TTXHcjs.SKIPPED_ELEMENTS; exports.analyze = analyze; exports.transform = transform;
32
32
  //# sourceMappingURL=html.cjs.map
package/dist/html.js CHANGED
@@ -1,16 +1,16 @@
1
1
  import {
2
2
  analyzeHtmlPipeline,
3
3
  runHtmlPipeline
4
- } from "./chunk-7NSSCTBK.js";
4
+ } from "./chunk-24BM7JZJ.js";
5
5
  import {
6
6
  SKIPPED_ELEMENTS
7
- } from "./chunk-LHDMQYVE.js";
7
+ } from "./chunk-NE3CHQOZ.js";
8
8
  import {
9
9
  assertFixedMode
10
- } from "./chunk-DNFGA3PK.js";
10
+ } from "./chunk-5Q77FSKG.js";
11
11
  import {
12
12
  PolytypoError
13
- } from "./chunk-HY3GXZAZ.js";
13
+ } from "./chunk-4CPAE6PG.js";
14
14
 
15
15
  // src/index.html.ts
16
16
  function transform(input, options) {
package/dist/index.cjs CHANGED
@@ -1,32 +1,32 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunkQOW2MY3Icjs = require('./chunk-QOW2MY3I.cjs');
4
+ var _chunkUYZCANG2cjs = require('./chunk-UYZCANG2.cjs');
5
5
 
6
6
 
7
7
 
8
- var _chunkCFVUGAEQcjs = require('./chunk-CFVUGAEQ.cjs');
8
+ var _chunk5YZGZOEGcjs = require('./chunk-5YZGZOEG.cjs');
9
9
 
10
10
 
11
11
 
12
- var _chunkN5VKLPITcjs = require('./chunk-N5VKLPIT.cjs');
12
+ var _chunkDXQXPBIOcjs = require('./chunk-DXQXPBIO.cjs');
13
13
 
14
14
 
15
- var _chunk4GW2ZMIGcjs = require('./chunk-4GW2ZMIG.cjs');
15
+ var _chunkTHV4TTXHcjs = require('./chunk-THV4TTXH.cjs');
16
16
 
17
17
 
18
18
 
19
- var _chunkJG33G4ZRcjs = require('./chunk-JG33G4ZR.cjs');
20
- require('./chunk-4FDTU4LV.cjs');
19
+ var _chunkFFEPGPF4cjs = require('./chunk-FFEPGPF4.cjs');
20
+ require('./chunk-3ZOBO7VH.cjs');
21
21
 
22
22
 
23
- var _chunkTWPD6PZYcjs = require('./chunk-TWPD6PZY.cjs');
23
+ var _chunkGKIMUEW3cjs = require('./chunk-GKIMUEW3.cjs');
24
24
 
25
25
  // src/engine/pipeline.ts
26
26
  function resolveMode(mode) {
27
27
  if (mode === void 0 || mode === "text") return "text";
28
28
  if (mode === "html" || mode === "markdown" || mode === "yaml") return mode;
29
- throw new (0, _chunkTWPD6PZYcjs.PolytypoError)(
29
+ throw new (0, _chunkGKIMUEW3cjs.PolytypoError)(
30
30
  "POLYTYPO_INVALID_MODE",
31
31
  `Unknown mode "${String(mode)}". Expected "text", "html", "markdown" or "yaml".`
32
32
  );
@@ -34,18 +34,18 @@ function resolveMode(mode) {
34
34
  function runPipeline(input, options) {
35
35
  const given = _nullishCoalesce(options, () => ( {}));
36
36
  const mode = resolveMode(given.mode);
37
- if (mode === "text") return _chunkQOW2MY3Icjs.runTextPipeline.call(void 0, input, given);
38
- if (mode === "html") return _chunkCFVUGAEQcjs.runHtmlPipeline.call(void 0, input, given);
39
- if (mode === "yaml") return _chunkJG33G4ZRcjs.runYamlPipeline.call(void 0, input, given);
40
- return _chunkN5VKLPITcjs.runMarkdownPipeline.call(void 0, input, given);
37
+ if (mode === "text") return _chunkUYZCANG2cjs.runTextPipeline.call(void 0, input, given);
38
+ if (mode === "html") return _chunk5YZGZOEGcjs.runHtmlPipeline.call(void 0, input, given);
39
+ if (mode === "yaml") return _chunkFFEPGPF4cjs.runYamlPipeline.call(void 0, input, given);
40
+ return _chunkDXQXPBIOcjs.runMarkdownPipeline.call(void 0, input, given);
41
41
  }
42
42
  function runAnalyze(input, options) {
43
43
  const given = _nullishCoalesce(options, () => ( {}));
44
44
  const mode = resolveMode(given.mode);
45
- if (mode === "text") return _chunkQOW2MY3Icjs.analyzeTextPipeline.call(void 0, input, given);
46
- if (mode === "html") return _chunkCFVUGAEQcjs.analyzeHtmlPipeline.call(void 0, input, given);
47
- if (mode === "yaml") return _chunkJG33G4ZRcjs.analyzeYamlPipeline.call(void 0, input, given);
48
- return _chunkN5VKLPITcjs.analyzeMarkdownPipeline.call(void 0, input, given);
45
+ if (mode === "text") return _chunkUYZCANG2cjs.analyzeTextPipeline.call(void 0, input, given);
46
+ if (mode === "html") return _chunk5YZGZOEGcjs.analyzeHtmlPipeline.call(void 0, input, given);
47
+ if (mode === "yaml") return _chunkFFEPGPF4cjs.analyzeYamlPipeline.call(void 0, input, given);
48
+ return _chunkDXQXPBIOcjs.analyzeMarkdownPipeline.call(void 0, input, given);
49
49
  }
50
50
 
51
51
  // src/index.ts
@@ -60,5 +60,5 @@ function analyze(input, options) {
60
60
 
61
61
 
62
62
 
63
- exports.PolytypoError = _chunkTWPD6PZYcjs.PolytypoError; exports.SKIPPED_ELEMENTS = _chunk4GW2ZMIGcjs.SKIPPED_ELEMENTS; exports.analyze = analyze; exports.transform = transform;
63
+ exports.PolytypoError = _chunkGKIMUEW3cjs.PolytypoError; exports.SKIPPED_ELEMENTS = _chunkTHV4TTXHcjs.SKIPPED_ELEMENTS; exports.analyze = analyze; exports.transform = transform;
64
64
  //# sourceMappingURL=index.cjs.map
package/dist/index.js CHANGED
@@ -1,26 +1,26 @@
1
1
  import {
2
2
  analyzeTextPipeline,
3
3
  runTextPipeline
4
- } from "./chunk-YATDFC7V.js";
4
+ } from "./chunk-3ZMU6UAI.js";
5
5
  import {
6
6
  analyzeHtmlPipeline,
7
7
  runHtmlPipeline
8
- } from "./chunk-7NSSCTBK.js";
8
+ } from "./chunk-24BM7JZJ.js";
9
9
  import {
10
10
  analyzeMarkdownPipeline,
11
11
  runMarkdownPipeline
12
- } from "./chunk-CWHCIX7Q.js";
12
+ } from "./chunk-FPPWQPZD.js";
13
13
  import {
14
14
  SKIPPED_ELEMENTS
15
- } from "./chunk-LHDMQYVE.js";
15
+ } from "./chunk-NE3CHQOZ.js";
16
16
  import {
17
17
  analyzeYamlPipeline,
18
18
  runYamlPipeline
19
- } from "./chunk-2EEO3SUH.js";
20
- import "./chunk-2GDHU7YJ.js";
19
+ } from "./chunk-GSXMWBWM.js";
20
+ import "./chunk-TYYF7SJ3.js";
21
21
  import {
22
22
  PolytypoError
23
- } from "./chunk-HY3GXZAZ.js";
23
+ } from "./chunk-4CPAE6PG.js";
24
24
 
25
25
  // src/engine/pipeline.ts
26
26
  function resolveMode(mode) {
package/dist/markdown.cjs CHANGED
@@ -1,30 +1,30 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunkN5VKLPITcjs = require('./chunk-N5VKLPIT.cjs');
5
- require('./chunk-4GW2ZMIG.cjs');
6
- require('./chunk-4FDTU4LV.cjs');
4
+ var _chunkDXQXPBIOcjs = require('./chunk-DXQXPBIO.cjs');
5
+ require('./chunk-THV4TTXH.cjs');
6
+ require('./chunk-3ZOBO7VH.cjs');
7
7
 
8
8
 
9
- var _chunkBFRFZXOIcjs = require('./chunk-BFRFZXOI.cjs');
9
+ var _chunkS7UE6GOZcjs = require('./chunk-S7UE6GOZ.cjs');
10
10
 
11
11
 
12
- var _chunkTWPD6PZYcjs = require('./chunk-TWPD6PZY.cjs');
12
+ var _chunkGKIMUEW3cjs = require('./chunk-GKIMUEW3.cjs');
13
13
 
14
14
  // src/index.markdown.ts
15
15
  function transform(input, options) {
16
16
  const given = _nullishCoalesce(options, () => ( {}));
17
- _chunkBFRFZXOIcjs.assertFixedMode.call(void 0, given.mode, "markdown", "polytypo/markdown");
18
- return _chunkN5VKLPITcjs.runMarkdownPipeline.call(void 0, input, given);
17
+ _chunkS7UE6GOZcjs.assertFixedMode.call(void 0, given.mode, "markdown", "polytypo/markdown");
18
+ return _chunkDXQXPBIOcjs.runMarkdownPipeline.call(void 0, input, given);
19
19
  }
20
20
  function analyze(input, options) {
21
21
  const given = _nullishCoalesce(options, () => ( {}));
22
- _chunkBFRFZXOIcjs.assertFixedMode.call(void 0, given.mode, "markdown", "polytypo/markdown");
23
- return _chunkN5VKLPITcjs.analyzeMarkdownPipeline.call(void 0, input, given);
22
+ _chunkS7UE6GOZcjs.assertFixedMode.call(void 0, given.mode, "markdown", "polytypo/markdown");
23
+ return _chunkDXQXPBIOcjs.analyzeMarkdownPipeline.call(void 0, input, given);
24
24
  }
25
25
 
26
26
 
27
27
 
28
28
 
29
- exports.PolytypoError = _chunkTWPD6PZYcjs.PolytypoError; exports.analyze = analyze; exports.transform = transform;
29
+ exports.PolytypoError = _chunkGKIMUEW3cjs.PolytypoError; exports.analyze = analyze; exports.transform = transform;
30
30
  //# sourceMappingURL=markdown.cjs.map
package/dist/markdown.js CHANGED
@@ -1,15 +1,15 @@
1
1
  import {
2
2
  analyzeMarkdownPipeline,
3
3
  runMarkdownPipeline
4
- } from "./chunk-CWHCIX7Q.js";
5
- import "./chunk-LHDMQYVE.js";
6
- import "./chunk-2GDHU7YJ.js";
4
+ } from "./chunk-FPPWQPZD.js";
5
+ import "./chunk-NE3CHQOZ.js";
6
+ import "./chunk-TYYF7SJ3.js";
7
7
  import {
8
8
  assertFixedMode
9
- } from "./chunk-DNFGA3PK.js";
9
+ } from "./chunk-5Q77FSKG.js";
10
10
  import {
11
11
  PolytypoError
12
- } from "./chunk-HY3GXZAZ.js";
12
+ } from "./chunk-4CPAE6PG.js";
13
13
 
14
14
  // src/index.markdown.ts
15
15
  function transform(input, options) {
package/dist/text.cjs CHANGED
@@ -1,28 +1,28 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunkQOW2MY3Icjs = require('./chunk-QOW2MY3I.cjs');
4
+ var _chunkUYZCANG2cjs = require('./chunk-UYZCANG2.cjs');
5
5
 
6
6
 
7
- var _chunkBFRFZXOIcjs = require('./chunk-BFRFZXOI.cjs');
7
+ var _chunkS7UE6GOZcjs = require('./chunk-S7UE6GOZ.cjs');
8
8
 
9
9
 
10
- var _chunkTWPD6PZYcjs = require('./chunk-TWPD6PZY.cjs');
10
+ var _chunkGKIMUEW3cjs = require('./chunk-GKIMUEW3.cjs');
11
11
 
12
12
  // src/index.text.ts
13
13
  function transform(input, options) {
14
14
  const given = _nullishCoalesce(options, () => ( {}));
15
- _chunkBFRFZXOIcjs.assertFixedMode.call(void 0, given.mode, "text", "polytypo/text");
16
- return _chunkQOW2MY3Icjs.runTextPipeline.call(void 0, input, given);
15
+ _chunkS7UE6GOZcjs.assertFixedMode.call(void 0, given.mode, "text", "polytypo/text");
16
+ return _chunkUYZCANG2cjs.runTextPipeline.call(void 0, input, given);
17
17
  }
18
18
  function analyze(input, options) {
19
19
  const given = _nullishCoalesce(options, () => ( {}));
20
- _chunkBFRFZXOIcjs.assertFixedMode.call(void 0, given.mode, "text", "polytypo/text");
21
- return _chunkQOW2MY3Icjs.analyzeTextPipeline.call(void 0, input, given);
20
+ _chunkS7UE6GOZcjs.assertFixedMode.call(void 0, given.mode, "text", "polytypo/text");
21
+ return _chunkUYZCANG2cjs.analyzeTextPipeline.call(void 0, input, given);
22
22
  }
23
23
 
24
24
 
25
25
 
26
26
 
27
- exports.PolytypoError = _chunkTWPD6PZYcjs.PolytypoError; exports.analyze = analyze; exports.transform = transform;
27
+ exports.PolytypoError = _chunkGKIMUEW3cjs.PolytypoError; exports.analyze = analyze; exports.transform = transform;
28
28
  //# sourceMappingURL=text.cjs.map
package/dist/text.js CHANGED
@@ -1,13 +1,13 @@
1
1
  import {
2
2
  analyzeTextPipeline,
3
3
  runTextPipeline
4
- } from "./chunk-YATDFC7V.js";
4
+ } from "./chunk-3ZMU6UAI.js";
5
5
  import {
6
6
  assertFixedMode
7
- } from "./chunk-DNFGA3PK.js";
7
+ } from "./chunk-5Q77FSKG.js";
8
8
  import {
9
9
  PolytypoError
10
- } from "./chunk-HY3GXZAZ.js";
10
+ } from "./chunk-4CPAE6PG.js";
11
11
 
12
12
  // src/index.text.ts
13
13
  function transform(input, options) {
package/dist/yaml.cjs CHANGED
@@ -1,29 +1,29 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true}); function _nullishCoalesce(lhs, rhsFn) { if (lhs != null) { return lhs; } else { return rhsFn(); } }
2
2
 
3
3
 
4
- var _chunkJG33G4ZRcjs = require('./chunk-JG33G4ZR.cjs');
5
- require('./chunk-4FDTU4LV.cjs');
4
+ var _chunkFFEPGPF4cjs = require('./chunk-FFEPGPF4.cjs');
5
+ require('./chunk-3ZOBO7VH.cjs');
6
6
 
7
7
 
8
- var _chunkBFRFZXOIcjs = require('./chunk-BFRFZXOI.cjs');
8
+ var _chunkS7UE6GOZcjs = require('./chunk-S7UE6GOZ.cjs');
9
9
 
10
10
 
11
- var _chunkTWPD6PZYcjs = require('./chunk-TWPD6PZY.cjs');
11
+ var _chunkGKIMUEW3cjs = require('./chunk-GKIMUEW3.cjs');
12
12
 
13
13
  // src/index.yaml.ts
14
14
  function transform(input, options) {
15
15
  const given = _nullishCoalesce(options, () => ( {}));
16
- _chunkBFRFZXOIcjs.assertFixedMode.call(void 0, given.mode, "yaml", "polytypo/yaml");
17
- return _chunkJG33G4ZRcjs.runYamlPipeline.call(void 0, input, given);
16
+ _chunkS7UE6GOZcjs.assertFixedMode.call(void 0, given.mode, "yaml", "polytypo/yaml");
17
+ return _chunkFFEPGPF4cjs.runYamlPipeline.call(void 0, input, given);
18
18
  }
19
19
  function analyze(input, options) {
20
20
  const given = _nullishCoalesce(options, () => ( {}));
21
- _chunkBFRFZXOIcjs.assertFixedMode.call(void 0, given.mode, "yaml", "polytypo/yaml");
22
- return _chunkJG33G4ZRcjs.analyzeYamlPipeline.call(void 0, input, given);
21
+ _chunkS7UE6GOZcjs.assertFixedMode.call(void 0, given.mode, "yaml", "polytypo/yaml");
22
+ return _chunkFFEPGPF4cjs.analyzeYamlPipeline.call(void 0, input, given);
23
23
  }
24
24
 
25
25
 
26
26
 
27
27
 
28
- exports.PolytypoError = _chunkTWPD6PZYcjs.PolytypoError; exports.analyze = analyze; exports.transform = transform;
28
+ exports.PolytypoError = _chunkGKIMUEW3cjs.PolytypoError; exports.analyze = analyze; exports.transform = transform;
29
29
  //# sourceMappingURL=yaml.cjs.map
package/dist/yaml.js CHANGED
@@ -1,14 +1,14 @@
1
1
  import {
2
2
  analyzeYamlPipeline,
3
3
  runYamlPipeline
4
- } from "./chunk-2EEO3SUH.js";
5
- import "./chunk-2GDHU7YJ.js";
4
+ } from "./chunk-GSXMWBWM.js";
5
+ import "./chunk-TYYF7SJ3.js";
6
6
  import {
7
7
  assertFixedMode
8
- } from "./chunk-DNFGA3PK.js";
8
+ } from "./chunk-5Q77FSKG.js";
9
9
  import {
10
10
  PolytypoError
11
- } from "./chunk-HY3GXZAZ.js";
11
+ } from "./chunk-4CPAE6PG.js";
12
12
 
13
13
  // src/index.yaml.ts
14
14
  function transform(input, options) {
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "polytypo",
3
- "version": "1.31.0",
3
+ "version": "1.32.0",
4
4
  "description": "Normalize typography across languages: locale-correct quotes, dashes, ellipses and no-break spaces.",
5
5
  "keywords": [
6
6
  "typography",