polytypo 1.17.2 → 1.17.4

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 (47) hide show
  1. package/dist/{chunk-D5X53S7D.js → chunk-3B7OFB3Z.js} +2 -2
  2. package/dist/chunk-3LFCYGJ2.cjs +34 -0
  3. package/dist/{chunk-UMRHMNDF.cjs.map → chunk-3LFCYGJ2.cjs.map} +1 -1
  4. package/dist/{chunk-OQRJ5BMU.js → chunk-3YFHGJLX.js} +4 -4
  5. package/dist/{chunk-4ZRTKEZA.js → chunk-4C6Q4VWE.js} +2 -2
  6. package/dist/{chunk-DWQ3SDHS.js → chunk-67JPAOD6.js} +2 -2
  7. package/dist/{chunk-S7NXM2JK.js → chunk-7ZKTX4XN.js} +2 -2
  8. package/dist/{chunk-BXENIIJD.js → chunk-CBZVCWYE.js} +41 -5
  9. package/dist/{chunk-BXENIIJD.js.map → chunk-CBZVCWYE.js.map} +1 -1
  10. package/dist/chunk-DKIKUSWJ.cjs +38 -0
  11. package/dist/{chunk-4YXTHZIB.cjs.map → chunk-DKIKUSWJ.cjs.map} +1 -1
  12. package/dist/{chunk-LLKXGT4D.cjs → chunk-GQKLJ73E.cjs} +6 -6
  13. package/dist/{chunk-LLKXGT4D.cjs.map → chunk-GQKLJ73E.cjs.map} +1 -1
  14. package/dist/{chunk-ZC2JQGJN.js → chunk-HOVHQ7FV.js} +3 -3
  15. package/dist/{chunk-YV5DI7CN.cjs → chunk-KFRNMKKO.cjs} +4 -4
  16. package/dist/{chunk-YV5DI7CN.cjs.map → chunk-KFRNMKKO.cjs.map} +1 -1
  17. package/dist/{chunk-VNWEZQWP.cjs → chunk-MTB7GEW4.cjs} +3 -3
  18. package/dist/{chunk-VNWEZQWP.cjs.map → chunk-MTB7GEW4.cjs.map} +1 -1
  19. package/dist/{chunk-TQMYJT3L.js → chunk-PJMNCAM6.js} +3 -3
  20. package/dist/{chunk-7DJG5YVG.cjs → chunk-SFAHXSBP.cjs} +23 -23
  21. package/dist/{chunk-7DJG5YVG.cjs.map → chunk-SFAHXSBP.cjs.map} +1 -1
  22. package/dist/chunk-SUDJFZXB.cjs +36 -0
  23. package/dist/{chunk-KZWW24OZ.cjs.map → chunk-SUDJFZXB.cjs.map} +1 -1
  24. package/dist/{chunk-AWTKVV4E.cjs → chunk-ZTHGDNKA.cjs} +41 -5
  25. package/dist/chunk-ZTHGDNKA.cjs.map +1 -0
  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-4YXTHZIB.cjs +0 -38
  38. package/dist/chunk-AWTKVV4E.cjs.map +0 -1
  39. package/dist/chunk-KZWW24OZ.cjs +0 -36
  40. package/dist/chunk-UMRHMNDF.cjs +0 -34
  41. /package/dist/{chunk-D5X53S7D.js.map → chunk-3B7OFB3Z.js.map} +0 -0
  42. /package/dist/{chunk-OQRJ5BMU.js.map → chunk-3YFHGJLX.js.map} +0 -0
  43. /package/dist/{chunk-4ZRTKEZA.js.map → chunk-4C6Q4VWE.js.map} +0 -0
  44. /package/dist/{chunk-DWQ3SDHS.js.map → chunk-67JPAOD6.js.map} +0 -0
  45. /package/dist/{chunk-S7NXM2JK.js.map → chunk-7ZKTX4XN.js.map} +0 -0
  46. /package/dist/{chunk-ZC2JQGJN.js.map → chunk-HOVHQ7FV.js.map} +0 -0
  47. /package/dist/{chunk-TQMYJT3L.js.map → chunk-PJMNCAM6.js.map} +0 -0
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PolytypoError
3
- } from "./chunk-BXENIIJD.js";
3
+ } from "./chunk-CBZVCWYE.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-D5X53S7D.js.map
147
+ //# sourceMappingURL=chunk-3B7OFB3Z.js.map
@@ -0,0 +1,34 @@
1
+ "use strict";Object.defineProperty(exports, "__esModule", {value: true});
2
+
3
+ var _chunkKFRNMKKOcjs = require('./chunk-KFRNMKKO.cjs');
4
+
5
+
6
+
7
+
8
+
9
+
10
+
11
+ var _chunkZTHGDNKAcjs = require('./chunk-ZTHGDNKA.cjs');
12
+
13
+ // src/engine/html-pipeline.ts
14
+ function runHtmlPipeline(input, options) {
15
+ const narrowTarget = _chunkZTHGDNKAcjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
16
+ const planned = _chunkZTHGDNKAcjs.planRules.call(void 0, options.rules);
17
+ const locale = _chunkZTHGDNKAcjs.getLocaleData.call(void 0, options.locale);
18
+ _chunkZTHGDNKAcjs.assertNoProtect.call(void 0, options.protect, "html");
19
+ const spans = _chunkKFRNMKKOcjs.htmlSpans.call(void 0, input);
20
+ return _chunkZTHGDNKAcjs.runOverSpans.call(void 0, input, spans, planned, locale, "html", narrowTarget);
21
+ }
22
+ function analyzeHtmlPipeline(input, options) {
23
+ const narrowTarget = _chunkZTHGDNKAcjs.resolveNarrowTarget.call(void 0, options.narrowNbsp);
24
+ const planned = _chunkZTHGDNKAcjs.planRules.call(void 0, options.rules);
25
+ const locale = _chunkZTHGDNKAcjs.getLocaleData.call(void 0, options.locale);
26
+ _chunkZTHGDNKAcjs.assertNoProtect.call(void 0, options.protect, "html");
27
+ return _chunkZTHGDNKAcjs.analyzeOverSpans.call(void 0, input, _chunkKFRNMKKOcjs.htmlSpans.call(void 0, input), planned, locale, "html", narrowTarget);
28
+ }
29
+
30
+
31
+
32
+
33
+ exports.runHtmlPipeline = runHtmlPipeline; exports.analyzeHtmlPipeline = analyzeHtmlPipeline;
34
+ //# sourceMappingURL=chunk-3LFCYGJ2.cjs.map
@@ -1 +1 @@
1
- {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-UMRHMNDF.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-UMRHMNDF.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
+ {"version":3,"sources":["/home/runner/work/polytypo-js/polytypo-js/dist/chunk-3LFCYGJ2.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-3LFCYGJ2.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"]}
@@ -2,11 +2,11 @@ import {
2
2
  htmlFragmentSpans,
3
3
  isSkippedElement,
4
4
  wrapParserErrors
5
- } from "./chunk-D5X53S7D.js";
5
+ } from "./chunk-3B7OFB3Z.js";
6
6
  import {
7
7
  resolveFrontmatterKeys,
8
8
  yamlSpans
9
- } from "./chunk-4ZRTKEZA.js";
9
+ } from "./chunk-4C6Q4VWE.js";
10
10
  import {
11
11
  PolytypoError,
12
12
  analyzeOverUnits,
@@ -16,7 +16,7 @@ import {
16
16
  planRules,
17
17
  resolveNarrowTarget,
18
18
  runOverUnits
19
- } from "./chunk-BXENIIJD.js";
19
+ } from "./chunk-CBZVCWYE.js";
20
20
 
21
21
  // src/modes/markdown.ts
22
22
  import { parse, postprocess, preprocess } from "micromark";
@@ -394,4 +394,4 @@ export {
394
394
  runMarkdownPipeline,
395
395
  analyzeMarkdownPipeline
396
396
  };
397
- //# sourceMappingURL=chunk-OQRJ5BMU.js.map
397
+ //# sourceMappingURL=chunk-3YFHGJLX.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PolytypoError
3
- } from "./chunk-BXENIIJD.js";
3
+ } from "./chunk-CBZVCWYE.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-4ZRTKEZA.js.map
373
+ //# sourceMappingURL=chunk-4C6Q4VWE.js.map
@@ -1,6 +1,6 @@
1
1
  import {
2
2
  PolytypoError
3
- } from "./chunk-BXENIIJD.js";
3
+ } from "./chunk-CBZVCWYE.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-DWQ3SDHS.js.map
17
+ //# sourceMappingURL=chunk-67JPAOD6.js.map
@@ -9,7 +9,7 @@ import {
9
9
  runRules,
10
10
  runRulesRecording,
11
11
  toCodePoints
12
- } from "./chunk-BXENIIJD.js";
12
+ } from "./chunk-CBZVCWYE.js";
13
13
 
14
14
  // src/engine/text-pipeline.ts
15
15
  function runTextPipeline(input, options) {
@@ -35,4 +35,4 @@ export {
35
35
  runTextPipeline,
36
36
  analyzeTextPipeline
37
37
  };
38
- //# sourceMappingURL=chunk-S7NXM2JK.js.map
38
+ //# sourceMappingURL=chunk-7ZKTX4XN.js.map
@@ -5933,7 +5933,39 @@ function changesDelimiterFlank(cp, p, q, w) {
5933
5933
  }
5934
5934
  return false;
5935
5935
  }
5936
- function filterBoundaryEdits(cp, edits, ranges, delimiterNeighbours = false, guarded = []) {
5936
+ function isAsciiPunctuation(c) {
5937
+ if (c === void 0) return false;
5938
+ return c >= 33 && c <= 47 || c >= 58 && c <= 64 || c >= 91 && c <= 96 || c >= 123 && c <= 126;
5939
+ }
5940
+ function isAsciiAlphanumeric2(c) {
5941
+ if (c === void 0) return false;
5942
+ return c >= 48 && c <= 57 || c >= 65 && c <= 90 || c >= 97 && c <= 122;
5943
+ }
5944
+ function createsEscape(cp, p, q, w) {
5945
+ if (p - 1 < 0 || cp[p - 1] !== 92) return false;
5946
+ const before = cp[p];
5947
+ const after = w.length > 0 ? w[0] : cp[q + 1];
5948
+ return isAsciiPunctuation(before) !== isAsciiPunctuation(after);
5949
+ }
5950
+ function createsReference(cp, p, q, w) {
5951
+ if (w.length !== 0 || p - 1 < 0 || q + 1 >= cp.length) return false;
5952
+ let left = p - 1;
5953
+ let alnum = 0;
5954
+ while (left >= 0 && isAsciiAlphanumeric2(cp[left])) {
5955
+ left -= 1;
5956
+ alnum += 1;
5957
+ }
5958
+ let right = q + 1;
5959
+ if (cp[left] === 38 && cp[right] === 35 && alnum === 0) right += 1;
5960
+ while (right < cp.length && isAsciiAlphanumeric2(cp[right])) {
5961
+ right += 1;
5962
+ alnum += 1;
5963
+ }
5964
+ if (cp[right] !== 59 || alnum === 0) return false;
5965
+ if (left >= 0 && cp[left] === 35) left -= 1;
5966
+ return left >= 0 && cp[left] === 38;
5967
+ }
5968
+ function filterBoundaryEdits(cp, edits, ranges, mode = void 0, guarded = []) {
5937
5969
  const out = [];
5938
5970
  for (const edit of edits) {
5939
5971
  let containsMarker = false;
@@ -5948,7 +5980,11 @@ function filterBoundaryEdits(cp, edits, ranges, delimiterNeighbours = false, gua
5948
5980
  const q = edit.end - 1;
5949
5981
  const d = edit.end - edit.start;
5950
5982
  const r = edit.replacement.length;
5951
- if (delimiterNeighbours && changesDelimiterFlank(cp, p, q, edit.replacement)) continue;
5983
+ if (mode === "markdown" && changesDelimiterFlank(cp, p, q, edit.replacement)) continue;
5984
+ if (mode === "markdown" && createsEscape(cp, p, q, edit.replacement)) continue;
5985
+ if ((mode === "markdown" || mode === "html") && createsReference(cp, p, q, edit.replacement)) {
5986
+ continue;
5987
+ }
5952
5988
  const span = spanContaining(ranges, p);
5953
5989
  if (span !== void 0 && p === span.first && guarded[ranges.indexOf(span)] === true) {
5954
5990
  if (edit.replacement.length === 0 || edit.replacement[0] !== SPACE5) continue;
@@ -6014,7 +6050,7 @@ function runRulesOverSpans(cp, planned, locale, mode, narrowTarget, guarded = []
6014
6050
  const edits = rule.apply({ cp: current, locale, mode, narrowTarget });
6015
6051
  current = applyEdits(
6016
6052
  current,
6017
- filterBoundaryEdits(current, edits, spanRangesOf(current), mode === "markdown", guarded),
6053
+ filterBoundaryEdits(current, edits, spanRangesOf(current), mode, guarded),
6018
6054
  id
6019
6055
  );
6020
6056
  }
@@ -6070,7 +6106,7 @@ function analyzeOverSpans(source, spans, planned, locale, mode, narrowTarget) {
6070
6106
  current,
6071
6107
  edits,
6072
6108
  spanRangesOf(current),
6073
- mode === "markdown",
6109
+ mode,
6074
6110
  normalized.map((span) => span.urlTail === true)
6075
6111
  )
6076
6112
  );
@@ -6209,4 +6245,4 @@ export {
6209
6245
  runProtected,
6210
6246
  analyzeProtected
6211
6247
  };
6212
- //# sourceMappingURL=chunk-BXENIIJD.js.map
6248
+ //# sourceMappingURL=chunk-CBZVCWYE.js.map