polytypo 1.11.0 → 1.13.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 (82) hide show
  1. package/README.md +18 -0
  2. package/dist/{chunk-M2O7YEYA.js → chunk-6PEHEU6F.js} +2 -2
  3. package/dist/{chunk-U3BQVYLI.js → chunk-ANHMGSED.js} +8 -7
  4. package/dist/chunk-ANHMGSED.js.map +1 -0
  5. package/dist/chunk-CJIH6CFO.cjs +34 -0
  6. package/dist/chunk-CJIH6CFO.cjs.map +1 -0
  7. package/dist/{chunk-R7AVFEMZ.js → chunk-E2HHFHG2.js} +8 -7
  8. package/dist/chunk-E2HHFHG2.js.map +1 -0
  9. package/dist/{chunk-MYO6QNUZ.js → chunk-EL7R55TV.js} +2 -2
  10. package/dist/{chunk-UF734P5M.cjs → chunk-FDNDYPPY.cjs} +3 -3
  11. package/dist/{chunk-UF734P5M.cjs.map → chunk-FDNDYPPY.cjs.map} +1 -1
  12. package/dist/{chunk-OO5UBFQ3.js → chunk-MCQOMIWF.js} +2 -2
  13. package/dist/chunk-MDIDDG32.cjs +38 -0
  14. package/dist/chunk-MDIDDG32.cjs.map +1 -0
  15. package/dist/{chunk-HUSFFMHK.js → chunk-MF6PJO7O.js} +338 -9
  16. package/dist/chunk-MF6PJO7O.js.map +1 -0
  17. package/dist/chunk-OPHUDB2T.cjs +36 -0
  18. package/dist/chunk-OPHUDB2T.cjs.map +1 -0
  19. package/dist/{chunk-EB47BYQP.js → chunk-OWTDZ6UD.js} +10 -9
  20. package/dist/{chunk-EB47BYQP.js.map → chunk-OWTDZ6UD.js.map} +1 -1
  21. package/dist/{chunk-UHXG7EUL.js → chunk-R5VKBH3P.js} +9 -2
  22. package/dist/chunk-R5VKBH3P.js.map +1 -0
  23. package/dist/{chunk-XNXXVTRR.cjs → chunk-TUDHJRJN.cjs} +6 -6
  24. package/dist/{chunk-XNXXVTRR.cjs.map → chunk-TUDHJRJN.cjs.map} +1 -1
  25. package/dist/{chunk-GT3YI4HK.cjs → chunk-W52W6XGA.cjs} +4 -4
  26. package/dist/{chunk-GT3YI4HK.cjs.map → chunk-W52W6XGA.cjs.map} +1 -1
  27. package/dist/{chunk-M2XO2UOC.cjs → chunk-WQEB33J2.cjs} +332 -3
  28. package/dist/chunk-WQEB33J2.cjs.map +1 -0
  29. package/dist/{chunk-RGL2IVXT.cjs → chunk-WWKSWVMX.cjs} +22 -21
  30. package/dist/chunk-WWKSWVMX.cjs.map +1 -0
  31. package/dist/{errors-DeHxbXRn.d.ts → errors-DrNAlWLt.d.cts} +12 -1
  32. package/dist/{errors-DeHxbXRn.d.cts → errors-DrNAlWLt.d.ts} +12 -1
  33. package/dist/html.cjs +9 -10
  34. package/dist/html.cjs.map +1 -1
  35. package/dist/html.d.cts +3 -3
  36. package/dist/html.d.ts +3 -3
  37. package/dist/html.js +4 -5
  38. package/dist/html.js.map +1 -1
  39. package/dist/index.cjs +17 -18
  40. package/dist/index.cjs.map +1 -1
  41. package/dist/index.d.cts +2 -2
  42. package/dist/index.d.ts +2 -2
  43. package/dist/index.js +7 -8
  44. package/dist/index.js.map +1 -1
  45. package/dist/markdown.cjs +10 -11
  46. package/dist/markdown.cjs.map +1 -1
  47. package/dist/markdown.d.cts +3 -3
  48. package/dist/markdown.d.ts +3 -3
  49. package/dist/markdown.js +5 -6
  50. package/dist/markdown.js.map +1 -1
  51. package/dist/text.cjs +8 -8
  52. package/dist/text.cjs.map +1 -1
  53. package/dist/text.d.cts +2 -2
  54. package/dist/text.d.ts +2 -2
  55. package/dist/text.js +3 -3
  56. package/dist/text.js.map +1 -1
  57. package/dist/yaml.cjs +9 -10
  58. package/dist/yaml.cjs.map +1 -1
  59. package/dist/yaml.d.cts +3 -3
  60. package/dist/yaml.d.ts +3 -3
  61. package/dist/yaml.js +4 -5
  62. package/dist/yaml.js.map +1 -1
  63. package/package.json +1 -1
  64. package/dist/chunk-4IMDK5WJ.cjs +0 -31
  65. package/dist/chunk-4IMDK5WJ.cjs.map +0 -1
  66. package/dist/chunk-6SL3VC37.cjs +0 -35
  67. package/dist/chunk-6SL3VC37.cjs.map +0 -1
  68. package/dist/chunk-7YM3XE7R.js +0 -218
  69. package/dist/chunk-7YM3XE7R.js.map +0 -1
  70. package/dist/chunk-E7PHHD77.cjs +0 -218
  71. package/dist/chunk-E7PHHD77.cjs.map +0 -1
  72. package/dist/chunk-HUSFFMHK.js.map +0 -1
  73. package/dist/chunk-M2XO2UOC.cjs.map +0 -1
  74. package/dist/chunk-R7AVFEMZ.js.map +0 -1
  75. package/dist/chunk-RGL2IVXT.cjs.map +0 -1
  76. package/dist/chunk-U3BQVYLI.js.map +0 -1
  77. package/dist/chunk-UHXG7EUL.js.map +0 -1
  78. package/dist/chunk-VRCQJFUG.cjs +0 -33
  79. package/dist/chunk-VRCQJFUG.cjs.map +0 -1
  80. /package/dist/{chunk-M2O7YEYA.js.map → chunk-6PEHEU6F.js.map} +0 -0
  81. /package/dist/{chunk-MYO6QNUZ.js.map → chunk-EL7R55TV.js.map} +0 -0
  82. /package/dist/{chunk-OO5UBFQ3.js.map → chunk-MCQOMIWF.js.map} +0 -0
package/README.md CHANGED
@@ -126,6 +126,24 @@ scalar containing `''` among them, which is how an apostrophe is written inside
126
126
  The block is also processed separately from the body, which shows up in exactly one place: an
127
127
  unbalanced quotation mark in `title` cannot pair with a mark in your first paragraph.
128
128
 
129
+ `text` mode takes a `protect` option for strings with holes in them, such as template literals or
130
+ ICU messages: ranges of the input that are never edited and that the rules read as content. Offsets
131
+ are Unicode code points, `[start, end)`, ascending and non-overlapping:
132
+
133
+ ```ts
134
+ import { transform } from "polytypo/text";
135
+
136
+ transform("${x} - Rules", { locale: "en-US", protect: [{ start: 0, end: 4 }] });
137
+ // ${x}—Rules
138
+ ```
139
+
140
+ Text next to a hole converts less than the same text would unsplit, never more: a character
141
+ polytypo would insert beside the hole is not written. A hole containing a line break counts as a
142
+ line break to the rules. A malformed list throws `POLYTYPO_INVALID_OPTION`, and so does a non-empty
143
+ list in `html`, `markdown` or `yaml` mode. An empty list is the same as no option. Running the
144
+ output through again is a fixed point only if you move the ranges to where the edits left them;
145
+ `transform` does not return them. `analyze()` takes the same option.
146
+
129
147
  `analyze()` runs the same pipeline and reports what it would do instead of doing it — one record
130
148
  per edit, each with the rule that made it and code-point offsets into the input you passed (into
131
149
  the **document**, in `html`, `markdown` and `yaml` mode, not into a span):
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PolytypoError
3
- } from "./chunk-HUSFFMHK.js";
3
+ } from "./chunk-MF6PJO7O.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-M2O7YEYA.js.map
373
+ //# sourceMappingURL=chunk-6PEHEU6F.js.map
@@ -1,16 +1,15 @@
1
1
  import {
2
2
  resolveYamlKeys,
3
3
  yamlSpans
4
- } from "./chunk-M2O7YEYA.js";
4
+ } from "./chunk-6PEHEU6F.js";
5
5
  import {
6
6
  analyzeOverSpans,
7
- runOverSpans
8
- } from "./chunk-7YM3XE7R.js";
9
- import {
7
+ assertNoProtect,
10
8
  getLocaleData,
11
9
  planRules,
12
- resolveNarrowTarget
13
- } from "./chunk-HUSFFMHK.js";
10
+ resolveNarrowTarget,
11
+ runOverSpans
12
+ } from "./chunk-MF6PJO7O.js";
14
13
 
15
14
  // src/engine/yaml-pipeline.ts
16
15
  function runYamlPipeline(input, options) {
@@ -18,6 +17,7 @@ function runYamlPipeline(input, options) {
18
17
  const planned = planRules(options.rules);
19
18
  const locale = getLocaleData(options.locale);
20
19
  const keys = resolveYamlKeys(options.keys);
20
+ assertNoProtect(options.protect, "yaml");
21
21
  return runOverSpans(input, yamlSpans(input, keys), planned, locale, "yaml", narrowTarget);
22
22
  }
23
23
  function analyzeYamlPipeline(input, options) {
@@ -25,6 +25,7 @@ function analyzeYamlPipeline(input, options) {
25
25
  const planned = planRules(options.rules);
26
26
  const locale = getLocaleData(options.locale);
27
27
  const keys = resolveYamlKeys(options.keys);
28
+ assertNoProtect(options.protect, "yaml");
28
29
  return analyzeOverSpans(input, yamlSpans(input, keys), planned, locale, "yaml", narrowTarget);
29
30
  }
30
31
 
@@ -32,4 +33,4 @@ export {
32
33
  runYamlPipeline,
33
34
  analyzeYamlPipeline
34
35
  };
35
- //# sourceMappingURL=chunk-U3BQVYLI.js.map
36
+ //# sourceMappingURL=chunk-ANHMGSED.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/engine/yaml-pipeline.ts"],"sourcesContent":["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 { assertNoProtect } from \"./protect.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 assertNoProtect(options.protect, \"yaml\");\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 assertNoProtect(options.protect, \"yaml\");\n return analyzeOverSpans(input, yamlSpans(input, keys), planned, locale, \"yaml\", narrowTarget);\n}\n"],"mappings":";;;;;;;;;;;;;;AAiBO,SAAS,gBAAgB,OAAe,SAAmC;AAChF,QAAM,eAAe,oBAAoB,QAAQ,UAAU;AAC3D,QAAM,UAAU,UAAU,QAAQ,KAAK;AACvC,QAAM,SAAS,cAAc,QAAQ,MAAM;AAC3C,QAAM,OAAO,gBAAgB,QAAQ,IAAI;AACzC,kBAAgB,QAAQ,SAAS,MAAM;AACvC,SAAO,aAAa,OAAO,UAAU,OAAO,IAAI,GAAG,SAAS,QAAQ,QAAQ,YAAY;AAC1F;AAGO,SAAS,oBAAoB,OAAe,SAAqC;AACtF,QAAM,eAAe,oBAAoB,QAAQ,UAAU;AAC3D,QAAM,UAAU,UAAU,QAAQ,KAAK;AACvC,QAAM,SAAS,cAAc,QAAQ,MAAM;AAC3C,QAAM,OAAO,gBAAgB,QAAQ,IAAI;AACzC,kBAAgB,QAAQ,SAAS,MAAM;AACvC,SAAO,iBAAiB,OAAO,UAAU,OAAO,IAAI,GAAG,SAAS,QAAQ,QAAQ,YAAY;AAC9F;","names":[]}
@@ -0,0 +1,34 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkW52W6XGAcjs = require('./chunk-W52W6XGA.cjs');
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+ var _chunkWQEB33J2cjs = require('./chunk-WQEB33J2.cjs');
12
+
13
+ // src/engine/html-pipeline.ts
14
+ function runHtmlPipeline(input, options) {
15
+ const narrowTarget = _chunkWQEB33J2cjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
16
+ const planned = _chunkWQEB33J2cjs.planRules.call(void 0, options.rules);
17
+ const locale = _chunkWQEB33J2cjs.getLocaleData.call(void 0, options.locale);
18
+ _chunkWQEB33J2cjs.assertNoProtect.call(void 0, options.protect, "html");
19
+ const spans = _chunkW52W6XGAcjs.htmlSpans.call(void 0, input);
20
+ return _chunkWQEB33J2cjs.runOverSpans.call(void 0, input, spans, planned, locale, "html", narrowTarget);
21
+ }
22
+ function analyzeHtmlPipeline(input, options) {
23
+ const narrowTarget = _chunkWQEB33J2cjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
24
+ const planned = _chunkWQEB33J2cjs.planRules.call(void 0, options.rules);
25
+ const locale = _chunkWQEB33J2cjs.getLocaleData.call(void 0, options.locale);
26
+ _chunkWQEB33J2cjs.assertNoProtect.call(void 0, options.protect, "html");
27
+ return _chunkWQEB33J2cjs.analyzeOverSpans.call(void 0, input, _chunkW52W6XGAcjs.htmlSpans.call(void 0, input), planned, locale, "html", narrowTarget);
28
+ }
29
+
30
+
31
+
32
+
33
+ exports.runHtmlPipeline = runHtmlPipeline; exports.analyzeHtmlPipeline = analyzeHtmlPipeline;
34
+ //# sourceMappingURL=chunk-CJIH6CFO.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-CJIH6CFO.cjs","../src/engine/html-pipeline.ts"],"names":[],"mappings":"AAAA;AACE;AACF,wDAA6B;AAC7B;AACE;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,+CAAA,OAAgB,CAAQ,OAAA,EAAS,MAAM,CAAA;AACvC,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,+CAAA,OAAgB,CAAQ,OAAA,EAAS,MAAM,CAAA;AACvC,EAAA,OAAO,gDAAA,KAAiB,EAAO,yCAAA,KAAe,CAAA,EAAG,OAAA,EAAS,MAAA,EAAQ,MAAA,EAAQ,YAAY,CAAA;AACxF;ADNA;AACA;AACE;AACA;AACF,6FAAC","file":"/home/runner/work/polytypo-js/polytypo-js/dist/chunk-CJIH6CFO.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 { assertNoProtect } from \"./protect.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 assertNoProtect(options.protect, \"html\");\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 assertNoProtect(options.protect, \"html\");\n return analyzeOverSpans(input, htmlSpans(input), planned, locale, \"html\", narrowTarget);\n}\n"]}
@@ -1,21 +1,21 @@
1
1
  import {
2
2
  htmlSpans
3
- } from "./chunk-OO5UBFQ3.js";
3
+ } from "./chunk-MCQOMIWF.js";
4
4
  import {
5
5
  analyzeOverSpans,
6
- runOverSpans
7
- } from "./chunk-7YM3XE7R.js";
8
- import {
6
+ assertNoProtect,
9
7
  getLocaleData,
10
8
  planRules,
11
- resolveNarrowTarget
12
- } from "./chunk-HUSFFMHK.js";
9
+ resolveNarrowTarget,
10
+ runOverSpans
11
+ } from "./chunk-MF6PJO7O.js";
13
12
 
14
13
  // src/engine/html-pipeline.ts
15
14
  function runHtmlPipeline(input, options) {
16
15
  const narrowTarget = resolveNarrowTarget(options.narrowNbsp);
17
16
  const planned = planRules(options.rules);
18
17
  const locale = getLocaleData(options.locale);
18
+ assertNoProtect(options.protect, "html");
19
19
  const spans = htmlSpans(input);
20
20
  return runOverSpans(input, spans, planned, locale, "html", narrowTarget);
21
21
  }
@@ -23,6 +23,7 @@ function analyzeHtmlPipeline(input, options) {
23
23
  const narrowTarget = resolveNarrowTarget(options.narrowNbsp);
24
24
  const planned = planRules(options.rules);
25
25
  const locale = getLocaleData(options.locale);
26
+ assertNoProtect(options.protect, "html");
26
27
  return analyzeOverSpans(input, htmlSpans(input), planned, locale, "html", narrowTarget);
27
28
  }
28
29
 
@@ -30,4 +31,4 @@ export {
30
31
  runHtmlPipeline,
31
32
  analyzeHtmlPipeline
32
33
  };
33
- //# sourceMappingURL=chunk-R7AVFEMZ.js.map
34
+ //# sourceMappingURL=chunk-E2HHFHG2.js.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["../src/engine/html-pipeline.ts"],"sourcesContent":["import { htmlSpans } from \"../modes/html.js\";\nimport type { Options } from \"../types.js\";\nimport { getLocaleData } from \"./locale.js\";\nimport { resolveNarrowTarget } from \"./narrow-target.js\";\nimport { assertNoProtect } from \"./protect.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 assertNoProtect(options.protect, \"html\");\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 assertNoProtect(options.protect, \"html\");\n return analyzeOverSpans(input, htmlSpans(input), planned, locale, \"html\", narrowTarget);\n}\n"],"mappings":";;;;;;;;;;;;;AAkBO,SAAS,gBAAgB,OAAe,SAAmC;AAChF,QAAM,eAAe,oBAAoB,QAAQ,UAAU;AAC3D,QAAM,UAAU,UAAU,QAAQ,KAAK;AACvC,QAAM,SAAS,cAAc,QAAQ,MAAM;AAC3C,kBAAgB,QAAQ,SAAS,MAAM;AACvC,QAAM,QAAQ,UAAU,KAAK;AAC7B,SAAO,aAAa,OAAO,OAAO,SAAS,QAAQ,QAAQ,YAAY;AACzE;AAGO,SAAS,oBAAoB,OAAe,SAAqC;AACtF,QAAM,eAAe,oBAAoB,QAAQ,UAAU;AAC3D,QAAM,UAAU,UAAU,QAAQ,KAAK;AACvC,QAAM,SAAS,cAAc,QAAQ,MAAM;AAC3C,kBAAgB,QAAQ,SAAS,MAAM;AACvC,SAAO,iBAAiB,OAAO,UAAU,KAAK,GAAG,SAAS,QAAQ,QAAQ,YAAY;AACxF;","names":[]}
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PolytypoError
3
- } from "./chunk-HUSFFMHK.js";
3
+ } from "./chunk-MF6PJO7O.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-MYO6QNUZ.js.map
17
+ //# sourceMappingURL=chunk-EL7R55TV.js.map
@@ -1,11 +1,11 @@
1
1
  "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
2
 
3
- var _chunkM2XO2UOCcjs = require('./chunk-M2XO2UOC.cjs');
3
+ var _chunkWQEB33J2cjs = require('./chunk-WQEB33J2.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, _chunkM2XO2UOCcjs.PolytypoError)(
8
+ throw new (0, _chunkWQEB33J2cjs.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-UF734P5M.cjs.map
17
+ //# sourceMappingURL=chunk-FDNDYPPY.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-UF734P5M.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-UF734P5M.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-FDNDYPPY.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-FDNDYPPY.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
  import {
2
2
  PolytypoError
3
- } from "./chunk-HUSFFMHK.js";
3
+ } from "./chunk-MF6PJO7O.js";
4
4
 
5
5
  // src/modes/html.ts
6
6
  import { parse, parseFragment } from "parse5";
@@ -144,4 +144,4 @@ export {
144
144
  htmlSpans,
145
145
  htmlFragmentSpans
146
146
  };
147
- //# sourceMappingURL=chunk-OO5UBFQ3.js.map
147
+ //# sourceMappingURL=chunk-MCQOMIWF.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 _chunkWQEB33J2cjs = require('./chunk-WQEB33J2.cjs');
13
+
14
+ // src/engine/text-pipeline.ts
15
+ function runTextPipeline(input, options) {
16
+ const narrowTarget = _chunkWQEB33J2cjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
17
+ const planned = _chunkWQEB33J2cjs.planRules.call(void 0, options.rules);
18
+ const locale = _chunkWQEB33J2cjs.getLocaleData.call(void 0, options.locale);
19
+ const holes = _chunkWQEB33J2cjs.resolveProtect.call(void 0, options.protect, _chunkWQEB33J2cjs.toCodePoints.call(void 0, input).length);
20
+ if (holes.length > 0) return _chunkWQEB33J2cjs.runProtected.call(void 0, input, holes, planned, locale, narrowTarget);
21
+ return _chunkWQEB33J2cjs.fromCodePoints.call(void 0, _chunkWQEB33J2cjs.runRules.call(void 0, _chunkWQEB33J2cjs.toCodePoints.call(void 0, input), planned, locale, "text", narrowTarget));
22
+ }
23
+ function analyzeTextPipeline(input, options) {
24
+ const narrowTarget = _chunkWQEB33J2cjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
25
+ const planned = _chunkWQEB33J2cjs.planRules.call(void 0, options.rules);
26
+ const locale = _chunkWQEB33J2cjs.getLocaleData.call(void 0, options.locale);
27
+ const cp = _chunkWQEB33J2cjs.toCodePoints.call(void 0, input);
28
+ const holes = _chunkWQEB33J2cjs.resolveProtect.call(void 0, options.protect, cp.length);
29
+ if (holes.length > 0) return _chunkWQEB33J2cjs.analyzeProtected.call(void 0, input, holes, planned, locale, narrowTarget);
30
+ const origin = cp.map((_value, index) => index);
31
+ return _chunkWQEB33J2cjs.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-MDIDDG32.cjs.map
@@ -0,0 +1 @@
1
+ {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-MDIDDG32.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-MDIDDG32.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"]}